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: <20260206172646.1556847-9-den@valinux.co.jp>
Date: Sat,  7 Feb 2026 02:26:45 +0900
From: Koichiro Den <den@...inux.co.jp>
To: vkoul@...nel.org,
	mani@...nel.org,
	Frank.Li@....com,
	jingoohan1@...il.com,
	lpieralisi@...nel.org,
	kwilczynski@...nel.org,
	robh@...nel.org,
	bhelgaas@...gle.com
Cc: dmaengine@...r.kernel.org,
	linux-pci@...r.kernel.org,
	linux-kselftest@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH v4 8/9] misc: pci_endpoint_test: Allow selecting embedded doorbell

Allow users to request the embedded doorbell variant via the
PCITEST_DOORBELL ioctl argument.

If the argument requests embedded doorbell, program the endpoint-test
FLAGS register accordingly before enabling doorbell. Otherwise keep the
existing MSI doorbell behaviour.

This is used by selftests to exercise both doorbell implementations.

Signed-off-by: Koichiro Den <den@...inux.co.jp>
---
 drivers/misc/pci_endpoint_test.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/misc/pci_endpoint_test.c b/drivers/misc/pci_endpoint_test.c
index 74ab5b5b9011..e484bd47c7fe 100644
--- a/drivers/misc/pci_endpoint_test.c
+++ b/drivers/misc/pci_endpoint_test.c
@@ -77,6 +77,7 @@
 #define PCI_ENDPOINT_TEST_FLAGS			0x2c
 
 #define FLAG_USE_DMA				BIT(0)
+#define FLAG_DB_EMBEDDED			BIT(1)
 
 #define PCI_ENDPOINT_TEST_CAPS			0x30
 #define CAP_UNALIGNED_ACCESS			BIT(0)
@@ -1050,13 +1051,15 @@ static int pci_endpoint_test_set_irq(struct pci_endpoint_test *test,
 	return 0;
 }
 
-static int pci_endpoint_test_doorbell(struct pci_endpoint_test *test)
+static int pci_endpoint_test_doorbell(struct pci_endpoint_test *test,
+				      unsigned long arg)
 {
 	struct pci_dev *pdev = test->pdev;
 	struct device *dev = &pdev->dev;
 	int irq_type = test->irq_type;
 	enum pci_barno bar;
 	u32 data, status;
+	u32 flags = 0;
 	u32 addr;
 	int left;
 
@@ -1066,8 +1069,12 @@ static int pci_endpoint_test_doorbell(struct pci_endpoint_test *test)
 		return -EINVAL;
 	}
 
+	if (arg)
+		flags |= FLAG_DB_EMBEDDED;
+
 	pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_IRQ_TYPE, irq_type);
 	pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_IRQ_NUMBER, 1);
+	pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_FLAGS, flags);
 	pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_COMMAND,
 				 COMMAND_ENABLE_DOORBELL);
 
@@ -1173,7 +1180,7 @@ static long pci_endpoint_test_ioctl(struct file *file, unsigned int cmd,
 		ret = pci_endpoint_test_clear_irq(test);
 		break;
 	case PCITEST_DOORBELL:
-		ret = pci_endpoint_test_doorbell(test);
+		ret = pci_endpoint_test_doorbell(test, arg);
 		break;
 	}
 
-- 
2.51.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ