From 45634c43177f148c40edd125f9e2c45c0d86b4d2 Mon Sep 17 00:00:00 2001 From: Keir Fraser Date: Fri, 1 Aug 2008 10:04:39 +0100 Subject: [PATCH] passthru: fix libpci error handling. libpci returns ALL F when error occurs. Currently, if libpci returns ALL F, emulation stops. But it is possible that the field of real register which is read by guest software is ALL F. After applying this patch, if libpci returns ALL F, ioemu will log warning message and continue the emulation. Signed-off-by: Yuji Shimada --- hw/pass-through.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/hw/pass-through.c b/hw/pass-through.c index 9bed5d87..3a1c8c47 100644 --- a/hw/pass-through.c +++ b/hw/pass-through.c @@ -1085,15 +1085,14 @@ static void pt_pci_write_config(PCIDevice *d, uint32_t address, uint32_t val, break; } - /* check libpci error */ + /* check libpci result */ valid_mask = (0xFFFFFFFF >> ((4 - len) << 3)); if ((read_val & valid_mask) == valid_mask) { - PT_LOG("libpci read error. No emulation. " + PT_LOG("Warning: Return ALL F from libpci read. " "[%02x:%02x.%x][Offset:%02xh][Length:%d]\n", pci_bus_num(d->bus), ((d->devfn >> 3) & 0x1F), (d->devfn & 0x7), address, len); - goto exit; } /* pass directly to libpci for passthrough type register group */ @@ -1262,15 +1261,14 @@ static uint32_t pt_pci_read_config(PCIDevice *d, uint32_t address, int len) break; } - /* check libpci error */ + /* check libpci result */ valid_mask = (0xFFFFFFFF >> ((4 - len) << 3)); if ((val & valid_mask) == valid_mask) { - PT_LOG("libpci read error. No emulation. " + PT_LOG("Warning: Return ALL F from libpci read. " "[%02x:%02x.%x][Offset:%02xh][Length:%d]\n", pci_bus_num(d->bus), ((d->devfn >> 3) & 0x1F), (d->devfn & 0x7), address, len); - goto exit; } /* just return the I/O device register value for -- 2.39.5