Linux PCI subsystem development
 help / color / mirror / Atom feed
* [PATCH] misc: pci_endpoint_test: Use a unique test pattern for each BAR
@ 2023-12-15 10:59 Niklas Cassel
  2023-12-18 10:03 ` Damien Le Moal
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Niklas Cassel @ 2023-12-15 10:59 UTC (permalink / raw)
  To: Lorenzo Pieralisi, Krzysztof Wilczyński,
	Manivannan Sadhasivam, Kishon Vijay Abraham I, Arnd Bergmann,
	Greg Kroah-Hartman
  Cc: Niklas Cassel, linux-pci

From: Niklas Cassel <niklas.cassel@wdc.com>

Use a unique test pattern for each BAR in. This makes it easier to
detect/debug address translation issues, since a developer can dump
the backing memory on the EP side, using e.g. devmem, to verify that
the address translation for each BAR is actually correct.

Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
---
 drivers/misc/pci_endpoint_test.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/drivers/misc/pci_endpoint_test.c b/drivers/misc/pci_endpoint_test.c
index a765a05f0c64..7ac1922475af 100644
--- a/drivers/misc/pci_endpoint_test.c
+++ b/drivers/misc/pci_endpoint_test.c
@@ -263,6 +263,15 @@ static bool pci_endpoint_test_request_irq(struct pci_endpoint_test *test)
 	return false;
 }
 
+static const u32 bar_test_pattern[] = {
+	0xA0A0A0A0,
+	0xA1A1A1A1,
+	0xA2A2A2A2,
+	0xA3A3A3A3,
+	0xA4A4A4A4,
+	0xA5A5A5A5,
+};
+
 static bool pci_endpoint_test_bar(struct pci_endpoint_test *test,
 				  enum pci_barno barno)
 {
@@ -280,11 +289,12 @@ static bool pci_endpoint_test_bar(struct pci_endpoint_test *test,
 		size = 0x4;
 
 	for (j = 0; j < size; j += 4)
-		pci_endpoint_test_bar_writel(test, barno, j, 0xA0A0A0A0);
+		pci_endpoint_test_bar_writel(test, barno, j,
+					     bar_test_pattern[barno]);
 
 	for (j = 0; j < size; j += 4) {
 		val = pci_endpoint_test_bar_readl(test, barno, j);
-		if (val != 0xA0A0A0A0)
+		if (val != bar_test_pattern[barno])
 			return false;
 	}
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-01-06  5:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-15 10:59 [PATCH] misc: pci_endpoint_test: Use a unique test pattern for each BAR Niklas Cassel
2023-12-18 10:03 ` Damien Le Moal
2023-12-18 16:18 ` Manivannan Sadhasivam
2024-01-06  5:03 ` Krzysztof Wilczyński

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox