Skip to content

Commit f931e3c

Browse files
committed
Merge branch 'pci/endpoint'
- Make pci_epf_bus_type const (Ricardo B. Marliere) - Update pci_epf_alloc_space() interface and move bar_fixed_size[] testing from pci_epf_test_alloc_space() and pci_epf_configure_bar() into it (Niklas Cassel) - Drop redundant size & alignment checking from epf_ntb_db_bar_init() since pci_epf_alloc_space() already does it (Niklas Cassel) - Fix ntb_register_device() name leak in error path (Yang Yingliang) - Return actual error code for pci_vntb_probe() failure (Yang Yingliang) - Prefix sysfs function names with "pci_epf_mhi_", e.g., "/sys/kernel/config/functions/pci_epf_mhi_sdx55", to leave room for other endpoint functions (Manivannan Sadhasivam) - Add EPF MHI support for SA8775P SoC (Mrinmay Sarkar) - Consolidate endpoint BAR hardware description in new struct pci_epc_bar_desc (Niklas Cassel) - Drop only_64bit on reserved BARs (Niklas Cassel) * pci/endpoint: PCI: endpoint: Drop only_64bit on reserved BARs PCI: endpoint: Clean up hardware description for BARs PCI: epf-mhi: Add support for SA8775P SoC PCI: epf-mhi: Add "pci_epf_mhi_" prefix to the function names PCI: epf-vntb: Return actual error code during pci_vntb_probe() failure NTB: fix possible name leak in ntb_register_device() PCI: endpoint: pci-epf-vntb: Remove superfluous checks for pci_epf_alloc_space() API PCI: endpoint: pci-epf-test: Remove superfluous checks for pci_epf_alloc_space() API PCI: endpoint: Improve pci_epf_alloc_space() API PCI: endpoint: Refactor pci_epf_alloc_space() API PCI: endpoint: Make pci_epf_bus_type const
2 parents c5176fd + 9266514 commit f931e3c

17 files changed

+150
-90
lines changed

drivers/ntb/core.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@ EXPORT_SYMBOL(ntb_unregister_client);
100100

101101
int ntb_register_device(struct ntb_dev *ntb)
102102
{
103+
int ret;
104+
103105
if (!ntb)
104106
return -EINVAL;
105107
if (!ntb->pdev)
@@ -120,7 +122,11 @@ int ntb_register_device(struct ntb_dev *ntb)
120122
ntb->ctx_ops = NULL;
121123
spin_lock_init(&ntb->ctx_lock);
122124

123-
return device_register(&ntb->dev);
125+
ret = device_register(&ntb->dev);
126+
if (ret)
127+
put_device(&ntb->dev);
128+
129+
return ret;
124130
}
125131
EXPORT_SYMBOL(ntb_register_device);
126132

drivers/pci/controller/dwc/pci-imx6.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1081,7 +1081,8 @@ static const struct pci_epc_features imx8m_pcie_epc_features = {
10811081
.linkup_notifier = false,
10821082
.msi_capable = true,
10831083
.msix_capable = false,
1084-
.reserved_bar = 1 << BAR_1 | 1 << BAR_3,
1084+
.bar[BAR_1] = { .type = BAR_RESERVED, },
1085+
.bar[BAR_3] = { .type = BAR_RESERVED, },
10851086
.align = SZ_64K,
10861087
};
10871088

drivers/pci/controller/dwc/pci-keystone.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -924,12 +924,12 @@ static const struct pci_epc_features ks_pcie_am654_epc_features = {
924924
.linkup_notifier = false,
925925
.msi_capable = true,
926926
.msix_capable = true,
927-
.reserved_bar = 1 << BAR_0 | 1 << BAR_1,
928-
.bar_fixed_64bit = 1 << BAR_0,
929-
.bar_fixed_size[2] = SZ_1M,
930-
.bar_fixed_size[3] = SZ_64K,
931-
.bar_fixed_size[4] = 256,
932-
.bar_fixed_size[5] = SZ_1M,
927+
.bar[BAR_0] = { .type = BAR_RESERVED, },
928+
.bar[BAR_1] = { .type = BAR_RESERVED, },
929+
.bar[BAR_2] = { .type = BAR_FIXED, .fixed_size = SZ_1M, },
930+
.bar[BAR_3] = { .type = BAR_FIXED, .fixed_size = SZ_64K, },
931+
.bar[BAR_4] = { .type = BAR_FIXED, .fixed_size = 256, },
932+
.bar[BAR_5] = { .type = BAR_FIXED, .fixed_size = SZ_1M, },
933933
.align = SZ_1M,
934934
};
935935

drivers/pci/controller/dwc/pci-layerscape-ep.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,10 @@ static int __init ls_pcie_ep_probe(struct platform_device *pdev)
250250
pci->dev = dev;
251251
pci->ops = pcie->drvdata->dw_pcie_ops;
252252

253-
ls_epc->bar_fixed_64bit = (1 << BAR_2) | (1 << BAR_4);
253+
ls_epc->bar[BAR_2].only_64bit = true;
254+
ls_epc->bar[BAR_3].type = BAR_RESERVED;
255+
ls_epc->bar[BAR_4].only_64bit = true;
256+
ls_epc->bar[BAR_5].type = BAR_RESERVED;
254257
ls_epc->linkup_notifier = true;
255258

256259
pcie->pci = pci;

drivers/pci/controller/dwc/pcie-keembay.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,8 +312,12 @@ static const struct pci_epc_features keembay_pcie_epc_features = {
312312
.linkup_notifier = false,
313313
.msi_capable = true,
314314
.msix_capable = true,
315-
.reserved_bar = BIT(BAR_1) | BIT(BAR_3) | BIT(BAR_5),
316-
.bar_fixed_64bit = BIT(BAR_0) | BIT(BAR_2) | BIT(BAR_4),
315+
.bar[BAR_0] = { .only_64bit = true, },
316+
.bar[BAR_1] = { .type = BAR_RESERVED, },
317+
.bar[BAR_2] = { .only_64bit = true, },
318+
.bar[BAR_3] = { .type = BAR_RESERVED, },
319+
.bar[BAR_4] = { .only_64bit = true, },
320+
.bar[BAR_5] = { .type = BAR_RESERVED, },
317321
.align = SZ_16K,
318322
};
319323

drivers/pci/controller/dwc/pcie-rcar-gen4.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,9 @@ static const struct pci_epc_features rcar_gen4_pcie_epc_features = {
383383
.linkup_notifier = false,
384384
.msi_capable = true,
385385
.msix_capable = false,
386-
.reserved_bar = 1 << BAR_1 | 1 << BAR_3 | 1 << BAR_5,
386+
.bar[BAR_1] = { .type = BAR_RESERVED, },
387+
.bar[BAR_3] = { .type = BAR_RESERVED, },
388+
.bar[BAR_5] = { .type = BAR_RESERVED, },
387389
.align = SZ_1M,
388390
};
389391

drivers/pci/controller/dwc/pcie-tegra194.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2007,9 +2007,13 @@ static const struct pci_epc_features tegra_pcie_epc_features = {
20072007
.core_init_notifier = true,
20082008
.msi_capable = false,
20092009
.msix_capable = false,
2010-
.reserved_bar = 1 << BAR_2 | 1 << BAR_3 | 1 << BAR_4 | 1 << BAR_5,
2011-
.bar_fixed_64bit = 1 << BAR_0,
2012-
.bar_fixed_size[0] = SZ_1M,
2010+
.bar[BAR_0] = { .type = BAR_FIXED, .fixed_size = SZ_1M,
2011+
.only_64bit = true, },
2012+
.bar[BAR_1] = { .type = BAR_RESERVED, },
2013+
.bar[BAR_2] = { .type = BAR_RESERVED, },
2014+
.bar[BAR_3] = { .type = BAR_RESERVED, },
2015+
.bar[BAR_4] = { .type = BAR_RESERVED, },
2016+
.bar[BAR_5] = { .type = BAR_RESERVED, },
20132017
};
20142018

20152019
static const struct pci_epc_features*

drivers/pci/controller/dwc/pcie-uniphier-ep.c

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -411,8 +411,12 @@ static const struct uniphier_pcie_ep_soc_data uniphier_pro5_data = {
411411
.msi_capable = true,
412412
.msix_capable = false,
413413
.align = 1 << 16,
414-
.bar_fixed_64bit = BIT(BAR_0) | BIT(BAR_2) | BIT(BAR_4),
415-
.reserved_bar = BIT(BAR_4),
414+
.bar[BAR_0] = { .only_64bit = true, },
415+
.bar[BAR_1] = { .type = BAR_RESERVED, },
416+
.bar[BAR_2] = { .only_64bit = true, },
417+
.bar[BAR_3] = { .type = BAR_RESERVED, },
418+
.bar[BAR_4] = { .type = BAR_RESERVED, },
419+
.bar[BAR_5] = { .type = BAR_RESERVED, },
416420
},
417421
};
418422

@@ -425,7 +429,12 @@ static const struct uniphier_pcie_ep_soc_data uniphier_nx1_data = {
425429
.msi_capable = true,
426430
.msix_capable = false,
427431
.align = 1 << 12,
428-
.bar_fixed_64bit = BIT(BAR_0) | BIT(BAR_2) | BIT(BAR_4),
432+
.bar[BAR_0] = { .only_64bit = true, },
433+
.bar[BAR_1] = { .type = BAR_RESERVED, },
434+
.bar[BAR_2] = { .only_64bit = true, },
435+
.bar[BAR_3] = { .type = BAR_RESERVED, },
436+
.bar[BAR_4] = { .only_64bit = true, },
437+
.bar[BAR_5] = { .type = BAR_RESERVED, },
429438
},
430439
};
431440

drivers/pci/controller/pcie-rcar-ep.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -440,11 +440,15 @@ static const struct pci_epc_features rcar_pcie_epc_features = {
440440
.msi_capable = true,
441441
.msix_capable = false,
442442
/* use 64-bit BARs so mark BAR[1,3,5] as reserved */
443-
.reserved_bar = 1 << BAR_1 | 1 << BAR_3 | 1 << BAR_5,
444-
.bar_fixed_64bit = 1 << BAR_0 | 1 << BAR_2 | 1 << BAR_4,
445-
.bar_fixed_size[0] = 128,
446-
.bar_fixed_size[2] = 256,
447-
.bar_fixed_size[4] = 256,
443+
.bar[BAR_0] = { .type = BAR_FIXED, .fixed_size = 128,
444+
.only_64bit = true, },
445+
.bar[BAR_1] = { .type = BAR_RESERVED, },
446+
.bar[BAR_2] = { .type = BAR_FIXED, .fixed_size = 256,
447+
.only_64bit = true, },
448+
.bar[BAR_3] = { .type = BAR_RESERVED, },
449+
.bar[BAR_4] = { .type = BAR_FIXED, .fixed_size = 256,
450+
.only_64bit = true, },
451+
.bar[BAR_5] = { .type = BAR_RESERVED, },
448452
};
449453

450454
static const struct pci_epc_features*

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

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,22 @@ static const struct pci_epf_mhi_ep_info sm8450_info = {
123123
.flags = MHI_EPF_USE_DMA,
124124
};
125125

126+
static struct pci_epf_header sa8775p_header = {
127+
.vendorid = PCI_VENDOR_ID_QCOM,
128+
.deviceid = 0x0306, /* FIXME: Update deviceid for sa8775p EP */
129+
.baseclass_code = PCI_CLASS_OTHERS,
130+
.interrupt_pin = PCI_INTERRUPT_INTA,
131+
};
132+
133+
static const struct pci_epf_mhi_ep_info sa8775p_info = {
134+
.config = &mhi_v1_config,
135+
.epf_header = &sa8775p_header,
136+
.bar_num = BAR_0,
137+
.epf_flags = PCI_BASE_ADDRESS_MEM_TYPE_32,
138+
.msi_count = 32,
139+
.mru = 0x8000,
140+
};
141+
126142
struct pci_epf_mhi {
127143
const struct pci_epc_features *epc_features;
128144
const struct pci_epf_mhi_ep_info *info;
@@ -913,8 +929,9 @@ static int pci_epf_mhi_probe(struct pci_epf *epf,
913929
}
914930

915931
static const struct pci_epf_device_id pci_epf_mhi_ids[] = {
916-
{ .name = "sdx55", .driver_data = (kernel_ulong_t)&sdx55_info },
917-
{ .name = "sm8450", .driver_data = (kernel_ulong_t)&sm8450_info },
932+
{ .name = "pci_epf_mhi_sa8775p", .driver_data = (kernel_ulong_t)&sa8775p_info },
933+
{ .name = "pci_epf_mhi_sdx55", .driver_data = (kernel_ulong_t)&sdx55_info },
934+
{ .name = "pci_epf_mhi_sm8450", .driver_data = (kernel_ulong_t)&sm8450_info },
918935
{},
919936
};
920937

0 commit comments

Comments
 (0)