From c4f453c9ecab315930661a9f14cc4f6f7611d88b Mon Sep 17 00:00:00 2001 From: Naveen Kumar Parna Date: Sat, 1 Mar 2025 15:34:48 +0530 Subject: [PATCH 2/2] instrumented the PCI config accessors to log all the reads and writes to my device (01:00.0) --- drivers/pci/access.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/pci/access.c b/drivers/pci/access.c index b123da16b..99d47d84f 100644 --- a/drivers/pci/access.c +++ b/drivers/pci/access.c @@ -51,6 +51,12 @@ int noinline pci_bus_read_config_##size \ *value = (type)data; \ pci_unlock_config(flags); \ \ + /* Log all reads for device 01:00.0 */ \ + if (bus->number == 1 && PCI_SLOT(devfn) == 0 && PCI_FUNC(devfn) == 0) { \ + pr_info("PCI READ: res=%d, bus=%02x dev=%02x func=%x pos=0x%02x len=%d data=0x%x\n", \ + res, bus->number, PCI_SLOT(devfn), PCI_FUNC(devfn), pos, len, data); \ + } \ + \ return res; \ } @@ -68,6 +74,12 @@ int noinline pci_bus_write_config_##size \ res = bus->ops->write(bus, devfn, pos, len, value); \ pci_unlock_config(flags); \ \ + /* Log all writes for device 01:00.0 */ \ + if (bus->number == 1 && PCI_SLOT(devfn) == 0 && PCI_FUNC(devfn) == 0) { \ + pr_info("PCI WRITE: res=%d, bus=%02x dev=%02x func=%x pos=0x%02x len=%d value=0x%x\n", \ + res, bus->number, PCI_SLOT(devfn), PCI_FUNC(devfn), pos, len, value); \ + } \ + \ return res; \ } -- 2.25.1