Skip to content

Commit a079d83

Browse files
jbrun3tMani-Sadhasivam
authored andcommitted
PCI: endpoint: pci-epf-vntb: Align MW naming with config names
The config file related to the memory windows start the numbering of the MW from 1. The other NTB function does the same, yet the enumeration defining the BARs of the vNTB function starts numbering the MW from 0. Both numbering should be fine, but mixing the two is a bit confusing. The configfs file being the interface with userspace, keep that stable and consistently start the numbering of the MW from 1. Signed-off-by: Jerome Brunet <jbrunet@baylibre.com> [mani: commit message rewording] Signed-off-by: Manivannan Sadhasivam <mani@kernel.org> Reviewed-by: Frank Li <Frank.Li@nxp.com> Link: https://patch.msgid.link/20250603-pci-vntb-bar-mapping-v2-2-fc685a22ad28@baylibre.com
1 parent 7ea488c commit a079d83

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

drivers/pci/endpoint/functions/pci-epf-vntb.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,9 @@ static struct workqueue_struct *kpcintb_workqueue;
7070
enum epf_ntb_bar {
7171
BAR_CONFIG,
7272
BAR_DB,
73-
BAR_MW0,
7473
BAR_MW1,
7574
BAR_MW2,
75+
BAR_MW3,
7676
};
7777

7878
/*
@@ -576,7 +576,7 @@ static int epf_ntb_mw_bar_init(struct epf_ntb *ntb)
576576

577577
for (i = 0; i < ntb->num_mws; i++) {
578578
size = ntb->mws_size[i];
579-
barno = ntb->epf_ntb_bar[BAR_MW0 + i];
579+
barno = ntb->epf_ntb_bar[BAR_MW1 + i];
580580

581581
ntb->epf->bar[barno].barno = barno;
582582
ntb->epf->bar[barno].size = size;
@@ -629,7 +629,7 @@ static void epf_ntb_mw_bar_clear(struct epf_ntb *ntb, int num_mws)
629629
int i;
630630

631631
for (i = 0; i < num_mws; i++) {
632-
barno = ntb->epf_ntb_bar[BAR_MW0 + i];
632+
barno = ntb->epf_ntb_bar[BAR_MW1 + i];
633633
pci_epc_clear_bar(ntb->epf->epc,
634634
ntb->epf->func_no,
635635
ntb->epf->vfunc_no,
@@ -676,7 +676,7 @@ static int epf_ntb_init_epc_bar(struct epf_ntb *ntb)
676676
epc_features = pci_epc_get_features(ntb->epf->epc, ntb->epf->func_no, ntb->epf->vfunc_no);
677677

678678
/* These are required BARs which are mandatory for NTB functionality */
679-
for (bar = BAR_CONFIG; bar <= BAR_MW0; bar++, barno++) {
679+
for (bar = BAR_CONFIG; bar <= BAR_MW1; bar++, barno++) {
680680
barno = pci_epc_get_next_free_bar(epc_features, barno);
681681
if (barno < 0) {
682682
dev_err(dev, "Fail to get NTB function BAR\n");
@@ -1048,7 +1048,7 @@ static int vntb_epf_mw_set_trans(struct ntb_dev *ndev, int pidx, int idx,
10481048
struct device *dev;
10491049

10501050
dev = &ntb->ntb.dev;
1051-
barno = ntb->epf_ntb_bar[BAR_MW0 + idx];
1051+
barno = ntb->epf_ntb_bar[BAR_MW1 + idx];
10521052
epf_bar = &ntb->epf->bar[barno];
10531053
epf_bar->phys_addr = addr;
10541054
epf_bar->barno = barno;

0 commit comments

Comments
 (0)