[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH] ioemu: passthough: add no_wb option for pci conf write
Current pt_pci_write_config always writes back to real pci conf space. However, in the case of MSI address and data registers, if guest changes the affinity of the interrupt, stale data will be written to these registers. This is particularly a problem if Xen uses per-CPU vector, where the interrupt in question fails to work. This patch fixes this by adding an option to disable the write back of certain controls. Signed-off-by: Qing He <qing.he@xxxxxxxxx> --- diff --git a/hw/pass-through.c b/hw/pass-through.c index 8d80755..b1a3b09 100644 --- a/hw/pass-through.c +++ b/hw/pass-through.c @@ -626,6 +626,7 @@ static struct pt_reg_info_tbl pt_emu_reg_msi_tbl[] = { .init_val = 0x00000000, .ro_mask = 0x00000003, .emu_mask = 0xFFFFFFFF, + .no_wb = 1, .init = pt_common_reg_init, .u.dw.read = pt_long_reg_read, .u.dw.write = pt_msgaddr32_reg_write, @@ -638,6 +639,7 @@ static struct pt_reg_info_tbl pt_emu_reg_msi_tbl[] = { .init_val = 0x00000000, .ro_mask = 0x00000000, .emu_mask = 0xFFFFFFFF, + .no_wb = 1, .init = pt_msgaddr64_reg_init, .u.dw.read = pt_long_reg_read, .u.dw.write = pt_msgaddr64_reg_write, @@ -650,6 +652,7 @@ static struct pt_reg_info_tbl pt_emu_reg_msi_tbl[] = { .init_val = 0x0000, .ro_mask = 0x0000, .emu_mask = 0xFFFF, + .no_wb = 1, .init = pt_msgdata_reg_init, .u.w.read = pt_word_reg_read, .u.w.write = pt_msgdata_reg_write, @@ -662,6 +665,7 @@ static struct pt_reg_info_tbl pt_emu_reg_msi_tbl[] = { .init_val = 0x0000, .ro_mask = 0x0000, .emu_mask = 0xFFFF, + .no_wb = 1, .init = pt_msgdata_reg_init, .u.w.read = pt_word_reg_read, .u.w.write = pt_msgdata_reg_write, @@ -1550,10 +1554,12 @@ static void pt_pci_write_config(PCIDevice *d, uint32_t address, uint32_t val, val >>= ((address & 3) << 3); out: - ret = pci_write_block(pci_dev, address, (uint8_t *)&val, len); + if (!reg->no_wb) { + ret = pci_write_block(pci_dev, address, (uint8_t *)&val, len); - if (!ret) - PT_LOG("Error: pci_write_block failed. return value[%d].\n", ret); + if (!ret) + PT_LOG("Error: pci_write_block failed. return value[%d].\n", ret); + } if (pm_state != NULL && pm_state->flags & PT_FLAG_TRANSITING) /* set QEMUTimer */ diff --git a/hw/pass-through.h b/hw/pass-through.h index 028a03e..3c79885 100644 --- a/hw/pass-through.h +++ b/hw/pass-through.h @@ -364,6 +364,8 @@ struct pt_reg_info_tbl { uint32_t ro_mask; /* reg emulate field mask (ON:emu, OFF:passthrough) */ uint32_t emu_mask; + /* no write back allowed */ + uint32_t no_wb; /* emul reg initialize method */ conf_reg_init init; union { _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |