lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20241216073941.2572407-2-hayashi.kunihiko@socionext.com>
Date: Mon, 16 Dec 2024 16:39:41 +0900
From: Kunihiko Hayashi <hayashi.kunihiko@...ionext.com>
To: Manivannan Sadhasivam <manivannan.sadhasivam@...aro.org>,
	Krzysztof Wilczyski <kw@...ux.com>,
	Kishon Vijay Abraham I <kishon@...nel.org>,
	Arnd Bergmann <arnd@...db.de>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Lorenzo Pieralisi <lpieralisi@...nel.org>
Cc: linux-pci@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	Kunihiko Hayashi <hayashi.kunihiko@...ionext.com>
Subject: [PATCH 2/2] misc: pci_endpoint_test: Set reserved BARs for each SoCs

There are bar numbers that cannot be used on the endpoint.
So instead of SoC-specific conditions, add "reserved_bar" bar number
bitmap to the SoC data.

Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@...ionext.com>
---
 drivers/misc/pci_endpoint_test.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/misc/pci_endpoint_test.c b/drivers/misc/pci_endpoint_test.c
index 854480921470..e6a1a2916425 100644
--- a/drivers/misc/pci_endpoint_test.c
+++ b/drivers/misc/pci_endpoint_test.c
@@ -76,9 +76,6 @@
 #define PCI_DEVICE_ID_LS1088A			0x80c0
 #define PCI_DEVICE_ID_IMX8			0x0808
 
-#define is_am654_pci_dev(pdev)		\
-		((pdev)->device == PCI_DEVICE_ID_TI_AM654)
-
 #define PCI_DEVICE_ID_RENESAS_R8A774A1		0x0028
 #define PCI_DEVICE_ID_RENESAS_R8A774B1		0x002b
 #define PCI_DEVICE_ID_RENESAS_R8A774C0		0x002d
@@ -123,6 +120,7 @@ struct pci_endpoint_test {
 	struct miscdevice miscdev;
 	enum pci_barno test_reg_bar;
 	size_t alignment;
+	u32 reserved_bar;
 	const char *name;
 };
 
@@ -130,6 +128,7 @@ struct pci_endpoint_test_data {
 	enum pci_barno test_reg_bar;
 	size_t alignment;
 	int irq_type;
+	u32 reserved_bar;
 };
 
 static inline u32 pci_endpoint_test_readl(struct pci_endpoint_test *test,
@@ -753,7 +752,6 @@ static long pci_endpoint_test_ioctl(struct file *file, unsigned int cmd,
 	int ret = -EINVAL;
 	enum pci_barno bar;
 	struct pci_endpoint_test *test = to_endpoint_test(file->private_data);
-	struct pci_dev *pdev = test->pdev;
 
 	mutex_lock(&test->mutex);
 
@@ -765,7 +763,7 @@ static long pci_endpoint_test_ioctl(struct file *file, unsigned int cmd,
 		bar = arg;
 		if (bar > BAR_5)
 			goto ret;
-		if (is_am654_pci_dev(pdev) && bar == BAR_0)
+		if (BIT(bar) & test->reserved_bar)
 			goto ret;
 		ret = pci_endpoint_test_bar(test, bar);
 		break;
@@ -840,6 +838,7 @@ static int pci_endpoint_test_probe(struct pci_dev *pdev,
 		test_reg_bar = data->test_reg_bar;
 		test->test_reg_bar = test_reg_bar;
 		test->alignment = data->alignment;
+		test->reserved_bar = data->reserved_bar;
 		irq_type = data->irq_type;
 	}
 
@@ -991,6 +990,7 @@ static const struct pci_endpoint_test_data am654_data = {
 	.test_reg_bar = BAR_2,
 	.alignment = SZ_64K,
 	.irq_type = IRQ_TYPE_MSI,
+	.reserved_bar = BIT(BAR_0),
 };
 
 static const struct pci_endpoint_test_data j721e_data = {
-- 
2.25.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ