mirror of
https://github.com/torvalds/linux.git
synced 2025-12-07 20:06:24 +00:00
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>
This commit is contained in:
committed by
Krzysztof Wilczyński
parent
9ca65c373f
commit
516f366434
@@ -263,6 +263,15 @@ fail:
|
|||||||
return false;
|
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,
|
static bool pci_endpoint_test_bar(struct pci_endpoint_test *test,
|
||||||
enum pci_barno barno)
|
enum pci_barno barno)
|
||||||
{
|
{
|
||||||
@@ -280,11 +289,12 @@ static bool pci_endpoint_test_bar(struct pci_endpoint_test *test,
|
|||||||
size = 0x4;
|
size = 0x4;
|
||||||
|
|
||||||
for (j = 0; j < size; j += 4)
|
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) {
|
for (j = 0; j < size; j += 4) {
|
||||||
val = pci_endpoint_test_bar_readl(test, barno, j);
|
val = pci_endpoint_test_bar_readl(test, barno, j);
|
||||||
if (val != 0xA0A0A0A0)
|
if (val != bar_test_pattern[barno])
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user