Skip to content

Commit 516f366

Browse files
Niklas Casselkwilczynski
authored andcommitted
misc: pci_endpoint_test: Use a unique test pattern for each BAR
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. Link: https://lore.kernel.org/linux-pci/20231215105952.1531683-1-nks@flawful.org Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com> Signed-off-by: Krzysztof Wilczyński <kwilczynski@kernel.org> Reviewed-by: Damien Le Moal <dlemoal@kernel.org> Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
1 parent 9ca65c3 commit 516f366

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

drivers/misc/pci_endpoint_test.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,15 @@ static bool pci_endpoint_test_request_irq(struct pci_endpoint_test *test)
263263
return false;
264264
}
265265

266+
static const u32 bar_test_pattern[] = {
267+
0xA0A0A0A0,
268+
0xA1A1A1A1,
269+
0xA2A2A2A2,
270+
0xA3A3A3A3,
271+
0xA4A4A4A4,
272+
0xA5A5A5A5,
273+
};
274+
266275
static bool pci_endpoint_test_bar(struct pci_endpoint_test *test,
267276
enum pci_barno barno)
268277
{
@@ -280,11 +289,12 @@ static bool pci_endpoint_test_bar(struct pci_endpoint_test *test,
280289
size = 0x4;
281290

282291
for (j = 0; j < size; j += 4)
283-
pci_endpoint_test_bar_writel(test, barno, j, 0xA0A0A0A0);
292+
pci_endpoint_test_bar_writel(test, barno, j,
293+
bar_test_pattern[barno]);
284294

285295
for (j = 0; j < size; j += 4) {
286296
val = pci_endpoint_test_bar_readl(test, barno, j);
287-
if (val != 0xA0A0A0A0)
297+
if (val != bar_test_pattern[barno])
288298
return false;
289299
}
290300

0 commit comments

Comments
 (0)