]> rtime.felk.cvut.cz Git - jailhouse.git/commitdiff
x86: Further improve EPT error reporting
authorJan Kiszka <jan.kiszka@siemens.com>
Mon, 2 Jun 2014 10:09:53 +0000 (12:09 +0200)
committerJan Kiszka <jan.kiszka@siemens.com>
Wed, 4 Jun 2014 06:22:12 +0000 (08:22 +0200)
Avoid double error reporting in vmx_handle_ept_violation if an access
handler already did this. Also correct the access direction message, it
was inverted.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
hypervisor/arch/x86/vmx.c

index 34d874b5c02702a74050acd7571cba14427eef4d..7c713d9f6b37b32bb1e7d0ce4e736fb9675e0709 100644 (file)
@@ -1031,6 +1031,7 @@ static bool vmx_handle_ept_violation(struct registers *guest_regs,
        u64 exitq = vmcs_read64(EXIT_QUALIFICATION);
        struct guest_paging_structures pg_structs;
        struct mmio_access access;
+       int result = 0;
        bool is_write;
        u32 val;
 
@@ -1049,9 +1050,10 @@ static bool vmx_handle_ept_violation(struct registers *guest_regs,
        if (is_write)
                val = ((unsigned long *)guest_regs)[access.reg];
 
-       /* Filter out requests to PCI configuration space */
-       if (pci_mmio_access_handler(cpu_data->cell, is_write,
-                                   phys_addr, &val) == 1) {
+       result = pci_mmio_access_handler(cpu_data->cell, is_write, phys_addr,
+                                        &val);
+
+       if (result == 1) {
                if (!is_write)
                        ((unsigned long *)guest_regs)[access.reg] = val;
                vmx_skip_emulated_instruction(
@@ -1060,9 +1062,10 @@ static bool vmx_handle_ept_violation(struct registers *guest_regs,
        }
 
 invalid_access:
-       panic_printk("FATAL: Invalid MMIO/RAM %s, addr: %p\n",
-                    is_write ? "read" : "write", phys_addr);
-
+       /* report only unhandled access failures */
+       if (result == 0)
+               panic_printk("FATAL: Invalid MMIO/RAM %s, addr: %p\n",
+                            is_write ? "write" : "read", phys_addr);
        return false;
 }