From: Greg Kroah-Hartman Date: Sun, 27 Aug 2023 10:38:22 +0000 (+0200) Subject: drop pci patches for 4.19 X-Git-Tag: v6.1.49~6 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=82eb4f275d91259ade365f6f342e675629def6cc;p=thirdparty%2Fkernel%2Fstable-queue.git drop pci patches for 4.19 Not really needed, they add a lot of infrastructure for a minor issue --- diff --git a/queue-4.19/pci-endpoint-add-helper-to-get-first-unreserved-bar.patch b/queue-4.19/pci-endpoint-add-helper-to-get-first-unreserved-bar.patch deleted file mode 100644 index b19d95d1c9b..00000000000 --- a/queue-4.19/pci-endpoint-add-helper-to-get-first-unreserved-bar.patch +++ /dev/null @@ -1,72 +0,0 @@ -From a15ca4dc80ee6fe71010ff55e80ab03771f66da6 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Mon, 14 Jan 2019 16:45:05 +0530 -Subject: PCI: endpoint: Add helper to get first unreserved BAR - -From: Kishon Vijay Abraham I - -[ Upstream commit 1e9efe6c9976552e88c6e6feaca3a78b8cf5aaf6 ] - -Add a helper function pci_epc_get_first_free_bar() to get the first -unreserved BAR that can be used for endpoint function. - -Tested-by: Gustavo Pimentel -Signed-off-by: Kishon Vijay Abraham I -Signed-off-by: Lorenzo Pieralisi -Stable-dep-of: 7e6689b34a81 ("PCI: rockchip: Set address alignment for endpoint mode") -Signed-off-by: Sasha Levin ---- - drivers/pci/endpoint/pci-epc-core.c | 23 +++++++++++++++++++++++ - include/linux/pci-epc.h | 2 ++ - 2 files changed, 25 insertions(+) - -diff --git a/drivers/pci/endpoint/pci-epc-core.c b/drivers/pci/endpoint/pci-epc-core.c -index 5a099479d9aba..e4712a0f249cb 100644 ---- a/drivers/pci/endpoint/pci-epc-core.c -+++ b/drivers/pci/endpoint/pci-epc-core.c -@@ -83,6 +83,29 @@ struct pci_epc *pci_epc_get(const char *epc_name) - } - EXPORT_SYMBOL_GPL(pci_epc_get); - -+/** -+ * pci_epc_get_first_free_bar() - helper to get first unreserved BAR -+ * @epc_features: pci_epc_features structure that holds the reserved bar bitmap -+ * -+ * Invoke to get the first unreserved BAR that can be used for endpoint -+ * function. For any incorrect value in reserved_bar return '0'. -+ */ -+unsigned int pci_epc_get_first_free_bar(const struct pci_epc_features -+ *epc_features) -+{ -+ int free_bar; -+ -+ if (!epc_features) -+ return 0; -+ -+ free_bar = ffz(epc_features->reserved_bar); -+ if (free_bar > 5) -+ return 0; -+ -+ return free_bar; -+} -+EXPORT_SYMBOL_GPL(pci_epc_get_first_free_bar); -+ - /** - * pci_epc_get_features() - get the features supported by EPC - * @epc: the features supported by *this* EPC device will be returned -diff --git a/include/linux/pci-epc.h b/include/linux/pci-epc.h -index fcd5e50475468..dcaecf715b1cf 100644 ---- a/include/linux/pci-epc.h -+++ b/include/linux/pci-epc.h -@@ -183,6 +183,8 @@ int pci_epc_start(struct pci_epc *epc); - void pci_epc_stop(struct pci_epc *epc); - const struct pci_epc_features *pci_epc_get_features(struct pci_epc *epc, - u8 func_no); -+unsigned int pci_epc_get_first_free_bar(const struct pci_epc_features -+ *epc_features); - struct pci_epc *pci_epc_get(const char *epc_name); - void pci_epc_put(struct pci_epc *epc); - --- -2.40.1 - diff --git a/queue-4.19/pci-endpoint-add-new-pci_epc_ops-to-get-epc-features.patch b/queue-4.19/pci-endpoint-add-new-pci_epc_ops-to-get-epc-features.patch deleted file mode 100644 index 6600f638349..00000000000 --- a/queue-4.19/pci-endpoint-add-new-pci_epc_ops-to-get-epc-features.patch +++ /dev/null @@ -1,115 +0,0 @@ -From 62bdf7eced9f5325b8c7c00018eec9cf7c85650f Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Mon, 14 Jan 2019 16:44:59 +0530 -Subject: PCI: endpoint: Add new pci_epc_ops to get EPC features - -From: Kishon Vijay Abraham I - -[ Upstream commit 41cb8d189c9d4964df52a6f497cab7b301ae831b ] - -Add a new pci_epc_ops ->get_features() to get the features -supported by the EPC. Since EPC can provide different features to -different functions, the ->get_features() ops takes _func_no_ as -an argument. - -Tested-by: Gustavo Pimentel -Signed-off-by: Kishon Vijay Abraham I -Signed-off-by: Lorenzo Pieralisi -Stable-dep-of: 7e6689b34a81 ("PCI: rockchip: Set address alignment for endpoint mode") -Signed-off-by: Sasha Levin ---- - drivers/pci/endpoint/pci-epc-core.c | 30 +++++++++++++++++++++++++++++ - include/linux/pci-epc.h | 22 +++++++++++++++++++++ - 2 files changed, 52 insertions(+) - -diff --git a/drivers/pci/endpoint/pci-epc-core.c b/drivers/pci/endpoint/pci-epc-core.c -index 094dcc3203b8d..5a099479d9aba 100644 ---- a/drivers/pci/endpoint/pci-epc-core.c -+++ b/drivers/pci/endpoint/pci-epc-core.c -@@ -83,6 +83,36 @@ struct pci_epc *pci_epc_get(const char *epc_name) - } - EXPORT_SYMBOL_GPL(pci_epc_get); - -+/** -+ * pci_epc_get_features() - get the features supported by EPC -+ * @epc: the features supported by *this* EPC device will be returned -+ * @func_no: the features supported by the EPC device specific to the -+ * endpoint function with func_no will be returned -+ * -+ * Invoke to get the features provided by the EPC which may be -+ * specific to an endpoint function. Returns pci_epc_features on success -+ * and NULL for any failures. -+ */ -+const struct pci_epc_features *pci_epc_get_features(struct pci_epc *epc, -+ u8 func_no) -+{ -+ const struct pci_epc_features *epc_features; -+ unsigned long flags; -+ -+ if (IS_ERR_OR_NULL(epc) || func_no >= epc->max_functions) -+ return NULL; -+ -+ if (!epc->ops->get_features) -+ return NULL; -+ -+ spin_lock_irqsave(&epc->lock, flags); -+ epc_features = epc->ops->get_features(epc, func_no); -+ spin_unlock_irqrestore(&epc->lock, flags); -+ -+ return epc_features; -+} -+EXPORT_SYMBOL_GPL(pci_epc_get_features); -+ - /** - * pci_epc_stop() - stop the PCI link - * @epc: the link of the EPC device that has to be stopped -diff --git a/include/linux/pci-epc.h b/include/linux/pci-epc.h -index 931fda3e5e0d9..fcd5e50475468 100644 ---- a/include/linux/pci-epc.h -+++ b/include/linux/pci-epc.h -@@ -59,6 +59,8 @@ struct pci_epc_ops { - enum pci_epc_irq_type type, u16 interrupt_num); - int (*start)(struct pci_epc *epc); - void (*stop)(struct pci_epc *epc); -+ const struct pci_epc_features* (*get_features)(struct pci_epc *epc, -+ u8 func_no); - struct module *owner; - }; - -@@ -103,6 +105,24 @@ struct pci_epc { - unsigned int features; - }; - -+/** -+ * struct pci_epc_features - features supported by a EPC device per function -+ * @linkup_notifier: indicate if the EPC device can notify EPF driver on link up -+ * @msi_capable: indicate if the endpoint function has MSI capability -+ * @msix_capable: indicate if the endpoint function has MSI-X capability -+ * @reserved_bar: bitmap to indicate reserved BAR unavailable to function driver -+ * @bar_fixed_64bit: bitmap to indicate fixed 64bit BARs -+ * @bar_fixed_size: Array specifying the size supported by each BAR -+ */ -+struct pci_epc_features { -+ unsigned int linkup_notifier : 1; -+ unsigned int msi_capable : 1; -+ unsigned int msix_capable : 1; -+ u8 reserved_bar; -+ u8 bar_fixed_64bit; -+ u64 bar_fixed_size[BAR_5 + 1]; -+}; -+ - #define EPC_FEATURE_NO_LINKUP_NOTIFIER BIT(0) - #define EPC_FEATURE_BAR_MASK (BIT(1) | BIT(2) | BIT(3)) - #define EPC_FEATURE_MSIX_AVAILABLE BIT(4) -@@ -161,6 +181,8 @@ int pci_epc_raise_irq(struct pci_epc *epc, u8 func_no, - enum pci_epc_irq_type type, u16 interrupt_num); - int pci_epc_start(struct pci_epc *epc); - void pci_epc_stop(struct pci_epc *epc); -+const struct pci_epc_features *pci_epc_get_features(struct pci_epc *epc, -+ u8 func_no); - struct pci_epc *pci_epc_get(const char *epc_name); - void pci_epc_put(struct pci_epc *epc); - --- -2.40.1 - diff --git a/queue-4.19/pci-endpoint-add-support-to-specify-alignment-for-bu.patch b/queue-4.19/pci-endpoint-add-support-to-specify-alignment-for-bu.patch deleted file mode 100644 index fc05aa98205..00000000000 --- a/queue-4.19/pci-endpoint-add-support-to-specify-alignment-for-bu.patch +++ /dev/null @@ -1,135 +0,0 @@ -From f6001f24c202da6845f12873e32dc7f63c7e653f Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Mon, 25 Mar 2019 15:09:39 +0530 -Subject: PCI: endpoint: Add support to specify alignment for buffers allocated - to BARs - -From: Kishon Vijay Abraham I - -[ Upstream commit 2a9a801620efac92885fc9cd53594c0b9aba87a4 ] - -The address that is allocated using pci_epf_alloc_space() is -directly written to the target address of the Inbound Address -Translation unit (ie the HW component implementing inbound address -decoding) on endpoint controllers. - -Designware IP [1] has a configuration parameter (CX_ATU_MIN_REGION_SIZE -[2]) which has 64KB as default value and the lower 16 bits of the Base, -Limit and Target registers of the Inbound ATU are fixed to zero. If the -programmed memory address is not aligned to 64 KB boundary this causes -memory corruption. - -Modify pci_epf_alloc_space() API to take alignment size as argument in -order to allocate buffers to be mapped to BARs with an alignment that -suits the platform where they are used. - -Add an 'align' parameter to epc_features which can be used by platform -drivers to specify the BAR allocation alignment requirements and use -this while invoking pci_epf_alloc_space(). - -[1] "I/O and MEM Match Modes" section in DesignWare Cores PCI Express - Controller Databook version 4.90a -[2] http://www.ti.com/lit/ug/spruid7c/spruid7c.pdf - -Signed-off-by: Kishon Vijay Abraham I -Signed-off-by: Lorenzo Pieralisi -Stable-dep-of: 7e6689b34a81 ("PCI: rockchip: Set address alignment for endpoint mode") -Signed-off-by: Sasha Levin ---- - drivers/pci/endpoint/functions/pci-epf-test.c | 5 +++-- - drivers/pci/endpoint/pci-epf-core.c | 10 ++++++++-- - include/linux/pci-epc.h | 2 ++ - include/linux/pci-epf.h | 3 ++- - 4 files changed, 15 insertions(+), 5 deletions(-) - -diff --git a/drivers/pci/endpoint/functions/pci-epf-test.c b/drivers/pci/endpoint/functions/pci-epf-test.c -index 5cde41afb9a73..a87e7ddcff9de 100644 ---- a/drivers/pci/endpoint/functions/pci-epf-test.c -+++ b/drivers/pci/endpoint/functions/pci-epf-test.c -@@ -437,7 +437,7 @@ static int pci_epf_test_alloc_space(struct pci_epf *epf) - epc_features = epf_test->epc_features; - - base = pci_epf_alloc_space(epf, sizeof(struct pci_epf_test_reg), -- test_reg_bar); -+ test_reg_bar, epc_features->align); - if (!base) { - dev_err(dev, "Failed to allocated register space\n"); - return -ENOMEM; -@@ -451,7 +451,8 @@ static int pci_epf_test_alloc_space(struct pci_epf *epf) - if (!!(epc_features->reserved_bar & (1 << bar))) - continue; - -- base = pci_epf_alloc_space(epf, bar_size[bar], bar); -+ base = pci_epf_alloc_space(epf, bar_size[bar], bar, -+ epc_features->align); - if (!base) - dev_err(dev, "Failed to allocate space for BAR%d\n", - bar); -diff --git a/drivers/pci/endpoint/pci-epf-core.c b/drivers/pci/endpoint/pci-epf-core.c -index 825fa24427a39..7f16b436e1cba 100644 ---- a/drivers/pci/endpoint/pci-epf-core.c -+++ b/drivers/pci/endpoint/pci-epf-core.c -@@ -109,10 +109,12 @@ EXPORT_SYMBOL_GPL(pci_epf_free_space); - * pci_epf_alloc_space() - allocate memory for the PCI EPF register space - * @size: the size of the memory that has to be allocated - * @bar: the BAR number corresponding to the allocated register space -+ * @align: alignment size for the allocation region - * - * Invoke to allocate memory for the PCI EPF register space. - */ --void *pci_epf_alloc_space(struct pci_epf *epf, size_t size, enum pci_barno bar) -+void *pci_epf_alloc_space(struct pci_epf *epf, size_t size, enum pci_barno bar, -+ size_t align) - { - void *space; - struct device *dev = epf->epc->dev.parent; -@@ -120,7 +122,11 @@ void *pci_epf_alloc_space(struct pci_epf *epf, size_t size, enum pci_barno bar) - - if (size < 128) - size = 128; -- size = roundup_pow_of_two(size); -+ -+ if (align) -+ size = ALIGN(size, align); -+ else -+ size = roundup_pow_of_two(size); - - space = dma_alloc_coherent(dev, size, &phys_addr, GFP_KERNEL); - if (!space) { -diff --git a/include/linux/pci-epc.h b/include/linux/pci-epc.h -index dcaecf715b1cf..a9b31ef810faf 100644 ---- a/include/linux/pci-epc.h -+++ b/include/linux/pci-epc.h -@@ -113,6 +113,7 @@ struct pci_epc { - * @reserved_bar: bitmap to indicate reserved BAR unavailable to function driver - * @bar_fixed_64bit: bitmap to indicate fixed 64bit BARs - * @bar_fixed_size: Array specifying the size supported by each BAR -+ * @align: alignment size required for BAR buffer allocation - */ - struct pci_epc_features { - unsigned int linkup_notifier : 1; -@@ -121,6 +122,7 @@ struct pci_epc_features { - u8 reserved_bar; - u8 bar_fixed_64bit; - u64 bar_fixed_size[BAR_5 + 1]; -+ size_t align; - }; - - #define EPC_FEATURE_NO_LINKUP_NOTIFIER BIT(0) -diff --git a/include/linux/pci-epf.h b/include/linux/pci-epf.h -index ec02f58758c84..2d6f075566824 100644 ---- a/include/linux/pci-epf.h -+++ b/include/linux/pci-epf.h -@@ -149,7 +149,8 @@ void pci_epf_destroy(struct pci_epf *epf); - int __pci_epf_register_driver(struct pci_epf_driver *driver, - struct module *owner); - void pci_epf_unregister_driver(struct pci_epf_driver *driver); --void *pci_epf_alloc_space(struct pci_epf *epf, size_t size, enum pci_barno bar); -+void *pci_epf_alloc_space(struct pci_epf *epf, size_t size, enum pci_barno bar, -+ size_t align); - void pci_epf_free_space(struct pci_epf *epf, void *addr, enum pci_barno bar); - int pci_epf_bind(struct pci_epf *epf); - void pci_epf_unbind(struct pci_epf *epf); --- -2.40.1 - diff --git a/queue-4.19/pci-endpoint-fix-null-pointer-dereference-for-get_features.patch b/queue-4.19/pci-endpoint-fix-null-pointer-dereference-for-get_features.patch deleted file mode 100644 index c39c4dc080d..00000000000 --- a/queue-4.19/pci-endpoint-fix-null-pointer-dereference-for-get_features.patch +++ /dev/null @@ -1,72 +0,0 @@ -From 6613bc2301ba291a1c5a90e1dc24cf3edf223c03 Mon Sep 17 00:00:00 2001 -From: Shradha Todi -Date: Wed, 24 Mar 2021 15:46:09 +0530 -Subject: PCI: endpoint: Fix NULL pointer dereference for ->get_features() - -From: Shradha Todi - -commit 6613bc2301ba291a1c5a90e1dc24cf3edf223c03 upstream. - -get_features ops of pci_epc_ops may return NULL, causing NULL pointer -dereference in pci_epf_test_alloc_space function. Let us add a check for -pci_epc_feature pointer in pci_epf_test_bind before we access it to avoid -any such NULL pointer dereference and return -ENOTSUPP in case -pci_epc_feature is not found. - -When the patch is not applied and EPC features is not implemented in the -platform driver, we see the following dump due to kernel NULL pointer -dereference. - -Call trace: - pci_epf_test_bind+0xf4/0x388 - pci_epf_bind+0x3c/0x80 - pci_epc_epf_link+0xa8/0xcc - configfs_symlink+0x1a4/0x48c - vfs_symlink+0x104/0x184 - do_symlinkat+0x80/0xd4 - __arm64_sys_symlinkat+0x1c/0x24 - el0_svc_common.constprop.3+0xb8/0x170 - el0_svc_handler+0x70/0x88 - el0_svc+0x8/0x640 -Code: d2800581 b9403ab9 f9404ebb 8b394f60 (f9400400) ----[ end trace a438e3c5a24f9df0 ]--- - -Link: https://lore.kernel.org/r/20210324101609.79278-1-shradha.t@samsung.com -Fixes: 2c04c5b8eef79 ("PCI: pci-epf-test: Use pci_epc_get_features() to get EPC features") -Signed-off-by: Sriram Dash -Signed-off-by: Shradha Todi -Signed-off-by: Lorenzo Pieralisi -Reviewed-by: Pankaj Dubey -Reviewed-by: Kishon Vijay Abraham I -Signed-off-by: Greg Kroah-Hartman ---- - drivers/pci/endpoint/functions/pci-epf-test.c | 16 ++++++++++------ - 1 file changed, 10 insertions(+), 6 deletions(-) - ---- a/drivers/pci/endpoint/functions/pci-epf-test.c -+++ b/drivers/pci/endpoint/functions/pci-epf-test.c -@@ -496,14 +496,18 @@ static int pci_epf_test_bind(struct pci_ - return -EINVAL; - - epc_features = pci_epc_get_features(epc, epf->func_no); -- if (epc_features) { -- linkup_notifier = epc_features->linkup_notifier; -- msix_capable = epc_features->msix_capable; -- msi_capable = epc_features->msi_capable; -- test_reg_bar = pci_epc_get_first_free_bar(epc_features); -- pci_epf_configure_bar(epf, epc_features); -+ if (!epc_features) { -+ dev_err(&epf->dev, "epc_features not implemented\n"); -+ return -EOPNOTSUPP; - } - -+ linkup_notifier = epc_features->linkup_notifier; -+ core_init_notifier = epc_features->core_init_notifier; -+ test_reg_bar = pci_epc_get_first_free_bar(epc_features); -+ if (test_reg_bar < 0) -+ return -EINVAL; -+ pci_epf_configure_bar(epf, epc_features); -+ - epf_test->test_reg_bar = test_reg_bar; - epf_test->epc_features = epc_features; - diff --git a/queue-4.19/pci-pci-epf-test-remove-setting-epf_bar-flags-in-fun.patch b/queue-4.19/pci-pci-epf-test-remove-setting-epf_bar-flags-in-fun.patch deleted file mode 100644 index 1dfc9fce105..00000000000 --- a/queue-4.19/pci-pci-epf-test-remove-setting-epf_bar-flags-in-fun.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 6a539b42cb7a89d3c63bc8fee76603c1e4e45be8 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Mon, 14 Jan 2019 16:45:07 +0530 -Subject: PCI: pci-epf-test: Remove setting epf_bar flags in function driver - -From: Kishon Vijay Abraham I - -[ Upstream commit 0342e9a797db42a7d4d083d10b5d3f38b0cfc193 ] - -Now that pci_epf_alloc_space() sets BAR MEM TYPE flags as 64Bit or -32Bit based on size, remove setting it in function driver. - -Tested-by: Gustavo Pimentel -Signed-off-by: Kishon Vijay Abraham I -Signed-off-by: Lorenzo Pieralisi -Stable-dep-of: 7e6689b34a81 ("PCI: rockchip: Set address alignment for endpoint mode") -Signed-off-by: Sasha Levin ---- - drivers/pci/endpoint/functions/pci-epf-test.c | 4 ---- - 1 file changed, 4 deletions(-) - -diff --git a/drivers/pci/endpoint/functions/pci-epf-test.c b/drivers/pci/endpoint/functions/pci-epf-test.c -index 09a1e449cd1c6..878e5c97963cb 100644 ---- a/drivers/pci/endpoint/functions/pci-epf-test.c -+++ b/drivers/pci/endpoint/functions/pci-epf-test.c -@@ -406,10 +406,6 @@ static int pci_epf_test_set_bar(struct pci_epf *epf) - for (bar = BAR_0; bar <= BAR_5; bar++) { - epf_bar = &epf->bar[bar]; - -- epf_bar->flags |= upper_32_bits(epf_bar->size) ? -- PCI_BASE_ADDRESS_MEM_TYPE_64 : -- PCI_BASE_ADDRESS_MEM_TYPE_32; -- - ret = pci_epc_set_bar(epc, epf->func_no, epf_bar); - if (ret) { - pci_epf_free_space(epf, epf_test->reg[bar], bar); --- -2.40.1 - diff --git a/queue-4.19/pci-pci-epf-test-use-pci_epc_get_features-to-get-epc.patch b/queue-4.19/pci-pci-epf-test-use-pci_epc_get_features-to-get-epc.patch deleted file mode 100644 index 64a8b5d57c5..00000000000 --- a/queue-4.19/pci-pci-epf-test-use-pci_epc_get_features-to-get-epc.patch +++ /dev/null @@ -1,207 +0,0 @@ -From bd1175a424859cb6bfcabe731f157c40b6674df4 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Mon, 14 Jan 2019 16:45:09 +0530 -Subject: PCI: pci-epf-test: Use pci_epc_get_features() to get EPC features - -From: Kishon Vijay Abraham I - -[ Upstream commit 2c04c5b8eef797dca99699cfb55ff42dd3c12c23 ] - -Use pci_epc_get_features() to get EPC features such as linkup -notifier support, MSI/MSIX capable, BAR configuration etc and use it -for configuring pci-epf-test. Since these features are now obtained -directly from EPC driver, remove pci_epf_test_data which was initially -added to have EPC features in endpoint function driver. - -Tested-by: Gustavo Pimentel -Signed-off-by: Kishon Vijay Abraham I -Signed-off-by: Lorenzo Pieralisi -Stable-dep-of: 7e6689b34a81 ("PCI: rockchip: Set address alignment for endpoint mode") -Signed-off-by: Sasha Levin ---- - drivers/pci/endpoint/functions/pci-epf-test.c | 87 ++++++++++++------- - 1 file changed, 54 insertions(+), 33 deletions(-) - -diff --git a/drivers/pci/endpoint/functions/pci-epf-test.c b/drivers/pci/endpoint/functions/pci-epf-test.c -index 878e5c97963cb..5cde41afb9a73 100644 ---- a/drivers/pci/endpoint/functions/pci-epf-test.c -+++ b/drivers/pci/endpoint/functions/pci-epf-test.c -@@ -47,9 +47,8 @@ struct pci_epf_test { - void *reg[6]; - struct pci_epf *epf; - enum pci_barno test_reg_bar; -- bool linkup_notifier; -- bool msix_available; - struct delayed_work cmd_handler; -+ const struct pci_epc_features *epc_features; - }; - - struct pci_epf_test_reg { -@@ -71,11 +70,6 @@ static struct pci_epf_header test_header = { - .interrupt_pin = PCI_INTERRUPT_INTA, - }; - --struct pci_epf_test_data { -- enum pci_barno test_reg_bar; -- bool linkup_notifier; --}; -- - static size_t bar_size[] = { 512, 512, 1024, 16384, 131072, 1048576 }; - - static int pci_epf_test_copy(struct pci_epf_test *epf_test) -@@ -402,10 +396,16 @@ static int pci_epf_test_set_bar(struct pci_epf *epf) - struct device *dev = &epf->dev; - struct pci_epf_test *epf_test = epf_get_drvdata(epf); - enum pci_barno test_reg_bar = epf_test->test_reg_bar; -+ const struct pci_epc_features *epc_features; -+ -+ epc_features = epf_test->epc_features; - - for (bar = BAR_0; bar <= BAR_5; bar++) { - epf_bar = &epf->bar[bar]; - -+ if (!!(epc_features->reserved_bar & (1 << bar))) -+ continue; -+ - ret = pci_epc_set_bar(epc, epf->func_no, epf_bar); - if (ret) { - pci_epf_free_space(epf, epf_test->reg[bar], bar); -@@ -432,6 +432,9 @@ static int pci_epf_test_alloc_space(struct pci_epf *epf) - void *base; - int bar; - enum pci_barno test_reg_bar = epf_test->test_reg_bar; -+ const struct pci_epc_features *epc_features; -+ -+ epc_features = epf_test->epc_features; - - base = pci_epf_alloc_space(epf, sizeof(struct pci_epf_test_reg), - test_reg_bar); -@@ -444,6 +447,10 @@ static int pci_epf_test_alloc_space(struct pci_epf *epf) - for (bar = BAR_0; bar <= BAR_5; bar++) { - if (bar == test_reg_bar) - continue; -+ -+ if (!!(epc_features->reserved_bar & (1 << bar))) -+ continue; -+ - base = pci_epf_alloc_space(epf, bar_size[bar], bar); - if (!base) - dev_err(dev, "Failed to allocate space for BAR%d\n", -@@ -454,25 +461,50 @@ static int pci_epf_test_alloc_space(struct pci_epf *epf) - return 0; - } - -+static void pci_epf_configure_bar(struct pci_epf *epf, -+ const struct pci_epc_features *epc_features) -+{ -+ struct pci_epf_bar *epf_bar; -+ bool bar_fixed_64bit; -+ int i; -+ -+ for (i = BAR_0; i <= BAR_5; i++) { -+ epf_bar = &epf->bar[i]; -+ bar_fixed_64bit = !!(epc_features->bar_fixed_64bit & (1 << i)); -+ if (bar_fixed_64bit) -+ epf_bar->flags |= PCI_BASE_ADDRESS_MEM_TYPE_64; -+ if (epc_features->bar_fixed_size[i]) -+ bar_size[i] = epc_features->bar_fixed_size[i]; -+ } -+} -+ - static int pci_epf_test_bind(struct pci_epf *epf) - { - int ret; - struct pci_epf_test *epf_test = epf_get_drvdata(epf); - struct pci_epf_header *header = epf->header; -+ const struct pci_epc_features *epc_features; -+ enum pci_barno test_reg_bar = BAR_0; - struct pci_epc *epc = epf->epc; - struct device *dev = &epf->dev; -+ bool linkup_notifier = false; -+ bool msix_capable = false; -+ bool msi_capable = true; - - if (WARN_ON_ONCE(!epc)) - return -EINVAL; - -- if (epc->features & EPC_FEATURE_NO_LINKUP_NOTIFIER) -- epf_test->linkup_notifier = false; -- else -- epf_test->linkup_notifier = true; -- -- epf_test->msix_available = epc->features & EPC_FEATURE_MSIX_AVAILABLE; -+ epc_features = pci_epc_get_features(epc, epf->func_no); -+ if (epc_features) { -+ linkup_notifier = epc_features->linkup_notifier; -+ msix_capable = epc_features->msix_capable; -+ msi_capable = epc_features->msi_capable; -+ test_reg_bar = pci_epc_get_first_free_bar(epc_features); -+ pci_epf_configure_bar(epf, epc_features); -+ } - -- epf_test->test_reg_bar = EPC_FEATURE_GET_BAR(epc->features); -+ epf_test->test_reg_bar = test_reg_bar; -+ epf_test->epc_features = epc_features; - - ret = pci_epc_write_header(epc, epf->func_no, header); - if (ret) { -@@ -488,13 +520,15 @@ static int pci_epf_test_bind(struct pci_epf *epf) - if (ret) - return ret; - -- ret = pci_epc_set_msi(epc, epf->func_no, epf->msi_interrupts); -- if (ret) { -- dev_err(dev, "MSI configuration failed\n"); -- return ret; -+ if (msi_capable) { -+ ret = pci_epc_set_msi(epc, epf->func_no, epf->msi_interrupts); -+ if (ret) { -+ dev_err(dev, "MSI configuration failed\n"); -+ return ret; -+ } - } - -- if (epf_test->msix_available) { -+ if (msix_capable) { - ret = pci_epc_set_msix(epc, epf->func_no, epf->msix_interrupts); - if (ret) { - dev_err(dev, "MSI-X configuration failed\n"); -@@ -502,7 +536,7 @@ static int pci_epf_test_bind(struct pci_epf *epf) - } - } - -- if (!epf_test->linkup_notifier) -+ if (!linkup_notifier) - queue_work(kpcitest_workqueue, &epf_test->cmd_handler.work); - - return 0; -@@ -519,17 +553,6 @@ static int pci_epf_test_probe(struct pci_epf *epf) - { - struct pci_epf_test *epf_test; - struct device *dev = &epf->dev; -- const struct pci_epf_device_id *match; -- struct pci_epf_test_data *data; -- enum pci_barno test_reg_bar = BAR_0; -- bool linkup_notifier = true; -- -- match = pci_epf_match_device(pci_epf_test_ids, epf); -- data = (struct pci_epf_test_data *)match->driver_data; -- if (data) { -- test_reg_bar = data->test_reg_bar; -- linkup_notifier = data->linkup_notifier; -- } - - epf_test = devm_kzalloc(dev, sizeof(*epf_test), GFP_KERNEL); - if (!epf_test) -@@ -537,8 +560,6 @@ static int pci_epf_test_probe(struct pci_epf *epf) - - epf->header = &test_header; - epf_test->epf = epf; -- epf_test->test_reg_bar = test_reg_bar; -- epf_test->linkup_notifier = linkup_notifier; - - INIT_DELAYED_WORK(&epf_test->cmd_handler, pci_epf_test_cmd_handler); - --- -2.40.1 - diff --git a/queue-4.19/pci-rockchip-populate-get_features-dw_pcie_ep_ops.patch b/queue-4.19/pci-rockchip-populate-get_features-dw_pcie_ep_ops.patch deleted file mode 100644 index 20d24ebbd03..00000000000 --- a/queue-4.19/pci-rockchip-populate-get_features-dw_pcie_ep_ops.patch +++ /dev/null @@ -1,55 +0,0 @@ -From 1af927614d7669730343e869536001fa06c08749 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Mon, 14 Jan 2019 16:45:03 +0530 -Subject: PCI: rockchip: Populate ->get_features() dw_pcie_ep_ops - -From: Kishon Vijay Abraham I - -[ Upstream commit 146221768c74bbd969f968b61ec95a0254a6b311 ] - -Populate ->get_features() dw_pcie_ep_ops to return the EPC features -supported by Rockchip PCIe endpoint controller. - -Tested-by: Gustavo Pimentel -Signed-off-by: Kishon Vijay Abraham I -Signed-off-by: Lorenzo Pieralisi -Stable-dep-of: 7e6689b34a81 ("PCI: rockchip: Set address alignment for endpoint mode") -Signed-off-by: Sasha Levin ---- - drivers/pci/controller/pcie-rockchip-ep.c | 13 +++++++++++++ - 1 file changed, 13 insertions(+) - -diff --git a/drivers/pci/controller/pcie-rockchip-ep.c b/drivers/pci/controller/pcie-rockchip-ep.c -index 4d3a589af1296..48b4a1c35523f 100644 ---- a/drivers/pci/controller/pcie-rockchip-ep.c -+++ b/drivers/pci/controller/pcie-rockchip-ep.c -@@ -483,6 +483,18 @@ static int rockchip_pcie_ep_start(struct pci_epc *epc) - return 0; - } - -+static const struct pci_epc_features rockchip_pcie_epc_features = { -+ .linkup_notifier = false, -+ .msi_capable = true, -+ .msix_capable = false, -+}; -+ -+static const struct pci_epc_features* -+rockchip_pcie_ep_get_features(struct pci_epc *epc, u8 func_no) -+{ -+ return &rockchip_pcie_epc_features; -+} -+ - static const struct pci_epc_ops rockchip_pcie_epc_ops = { - .write_header = rockchip_pcie_ep_write_header, - .set_bar = rockchip_pcie_ep_set_bar, -@@ -493,6 +505,7 @@ static const struct pci_epc_ops rockchip_pcie_epc_ops = { - .get_msi = rockchip_pcie_ep_get_msi, - .raise_irq = rockchip_pcie_ep_raise_irq, - .start = rockchip_pcie_ep_start, -+ .get_features = rockchip_pcie_ep_get_features, - }; - - static int rockchip_pcie_parse_ep_dt(struct rockchip_pcie *rockchip, --- -2.40.1 - diff --git a/queue-4.19/pci-rockchip-set-address-alignment-for-endpoint-mode.patch b/queue-4.19/pci-rockchip-set-address-alignment-for-endpoint-mode.patch deleted file mode 100644 index 90428a040e8..00000000000 --- a/queue-4.19/pci-rockchip-set-address-alignment-for-endpoint-mode.patch +++ /dev/null @@ -1,40 +0,0 @@ -From a9072cf071373984db4fbd54bbb2c45b96c06188 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Tue, 18 Apr 2023 09:46:58 +0200 -Subject: PCI: rockchip: Set address alignment for endpoint mode - -From: Damien Le Moal - -[ Upstream commit 7e6689b34a815bd379dfdbe9855d36f395ef056c ] - -The address translation unit of the rockchip EP controller does not use -the lower 8 bits of a PCIe-space address to map local memory. Thus we -must set the align feature field to 256 to let the user know about this -constraint. - -Link: https://lore.kernel.org/r/20230418074700.1083505-12-rick.wertenbroek@gmail.com -Fixes: cf590b078391 ("PCI: rockchip: Add EP driver for Rockchip PCIe controller") -Signed-off-by: Damien Le Moal -Signed-off-by: Rick Wertenbroek -Signed-off-by: Lorenzo Pieralisi -Cc: stable@vger.kernel.org -Signed-off-by: Sasha Levin ---- - drivers/pci/controller/pcie-rockchip-ep.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/drivers/pci/controller/pcie-rockchip-ep.c b/drivers/pci/controller/pcie-rockchip-ep.c -index 48b4a1c35523f..d6e9013936446 100644 ---- a/drivers/pci/controller/pcie-rockchip-ep.c -+++ b/drivers/pci/controller/pcie-rockchip-ep.c -@@ -487,6 +487,7 @@ static const struct pci_epc_features rockchip_pcie_epc_features = { - .linkup_notifier = false, - .msi_capable = true, - .msix_capable = false, -+ .align = 256, - }; - - static const struct pci_epc_features* --- -2.40.1 - diff --git a/queue-4.19/series b/queue-4.19/series index 5587ccf9468..61b2cbe6257 100644 --- a/queue-4.19/series +++ b/queue-4.19/series @@ -41,13 +41,6 @@ mmc-remove-dev_err-usage-after-platform_get_irq.patch mmc-bcm2835-fix-deferred-probing.patch mmc-sunxi-fix-deferred-probing.patch block-fix-signed-int-overflow-in-amiga-partition-sup.patch -pci-endpoint-add-new-pci_epc_ops-to-get-epc-features.patch -pci-rockchip-populate-get_features-dw_pcie_ep_ops.patch -pci-endpoint-add-helper-to-get-first-unreserved-bar.patch -pci-pci-epf-test-remove-setting-epf_bar-flags-in-fun.patch -pci-pci-epf-test-use-pci_epc_get_features-to-get-epc.patch -pci-endpoint-add-support-to-specify-alignment-for-bu.patch -pci-rockchip-set-address-alignment-for-endpoint-mode.patch nfsd4-kill-warnings-on-testing-stateids-with-mismatc.patch nfsd-remove-incorrect-check-in-nfsd4_validate_statei.patch virtio-mmio-convert-to-devm_platform_ioremap_resourc.patch @@ -130,4 +123,3 @@ sched-rt-pick_next_rt_entity-check-list_entry.patch netfilter-nf_queue-fix-socket-leak.patch rtnetlink-reject-negative-ifindexes-in-rtm_newlink.patch irqchip-mips-gic-don-t-touch-vl_map-if-a-local-interrupt-is-not-routable.patch -pci-endpoint-fix-null-pointer-dereference-for-get_features.patch