From: Jan Kiszka <[email protected]>

This has been a FAQ on the list way too long: Parsing the address port
register content, translating it into the target PCI device and config
space register is not for beginners and even not convenient for experts.
So add a dedicated printk for this case which allows to remove the
address port reporting from the remaining ones.

This now gives

FATAL: Invalid PCI config write, device 05:00.0, reg: 0x44, size: 2
...

analogously to the MMCONFIG access violations.

Signed-off-by: Jan Kiszka <[email protected]>
---
 hypervisor/arch/x86/pci.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/hypervisor/arch/x86/pci.c b/hypervisor/arch/x86/pci.c
index c979cdad..fbb8ebd5 100644
--- a/hypervisor/arch/x86/pci.c
+++ b/hypervisor/arch/x86/pci.c
@@ -194,16 +194,20 @@ int x86_pci_config_handler(u16 port, bool dir_in, 
unsigned int size)
                        result = data_port_in_handler(device, address, size);
                else
                        result = data_port_out_handler(device, address, size);
-               if (result < 0)
-                       goto invalid_access;
+               if (result < 0) {
+                       panic_printk("FATAL: Invalid PCI config %s, device "
+                                    "%02x:%02x.%x, reg: 0x%x, size: %d\n",
+                                    dir_in ? "read" : "write",
+                                    PCI_BDF_PARAMS(bdf), address, size);
+                       return -1;
+               }
        }
 
        return result;
 
 invalid_access:
-       panic_printk("FATAL: Invalid PCI config %s, port: 0x%x, size: %d, "
-                    "address port: 0x%x\n", dir_in ? "read" : "write", port,
-                    size, cell->arch.pci_addr_port_val);
+       panic_printk("FATAL: Invalid PCI config %s, port: 0x%x, size: %d\n",
+                    dir_in ? "read" : "write", port, size);
        return -1;
 
 }
-- 
2.31.1

-- 
You received this message because you are subscribed to the Google Groups 
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jailhouse-dev/8f5ac8da-7007-ec91-9609-1a1cb7b15b83%40siemens.com.

Reply via email to