--- a/tools/qemu-xen-traditional/hw/pass-through.c 2016-11-29 17:36:38.000000000 +0100 +++ b/tools/qemu-xen-traditional/hw/pass-through.c 2017-04-06 18:45:34.545980614 +0200 @@ -692,7 +692,7 @@ static struct pt_reg_info_tbl pt_emu_reg .init_val = 0x0000, .res_mask = 0xFE00, .ro_mask = 0x018E, - .emu_mask = 0x017E, + .emu_mask = 0x017F, .init = pt_msgctrl_reg_init, .u.w.read = pt_word_reg_read, .u.w.write = pt_msgctrl_reg_write, @@ -3589,16 +3589,16 @@ static int pt_cmd_reg_write(struct pt_de /* create value for writing to I/O device register */ if (*value & PCI_COMMAND_DISABLE_INTx) { - if (ptdev->msi_trans_en) + /*if (ptdev->msi_trans_en) msi_set_enable(ptdev, 0); - else + else*/ throughable_mask |= PCI_COMMAND_DISABLE_INTx; } else { - if (ptdev->msi_trans_en) + /*if (ptdev->msi_trans_en) msi_set_enable(ptdev, 1); - else + else*/ if (ptdev->machine_irq) throughable_mask |= PCI_COMMAND_DISABLE_INTx; } @@ -3968,10 +3968,12 @@ static int pt_msgctrl_reg_write(struct p /* modify emulate register */ writable_mask = reg->emu_mask & ~reg->ro_mask & valid_mask; /* also emulate MSI_ENABLE bit for MSI-INTx translation */ +/* if (ptdev->msi_trans_en) { writable_mask |= PCI_MSI_FLAGS_ENABLE & valid_mask; throughable_mask &= ~PCI_MSI_FLAGS_ENABLE; } +*/ cfg_entry->data = PT_MERGE_VALUE(*value, cfg_entry->data, writable_mask); /* update the msi_info too */ ptdev->msi->flags |= cfg_entry->data & @@ -3987,10 +3989,10 @@ static int pt_msgctrl_reg_write(struct p /* setup MSI pirq for the first time */ if (ptdev->msi->flags & MSI_FLAG_UNINIT) { - if (ptdev->msi_trans_en) { +/* if (ptdev->msi_trans_en) { PT_LOG("guest enabling MSI, disable MSI-INTx translation\n"); pt_disable_msi_translate(ptdev); - } + } */ /* Init physical one */ PT_LOG("setup msi for dev %x\n", pd->devfn); if (pt_msi_setup(ptdev)) @@ -4022,6 +4024,12 @@ static int pt_msgctrl_reg_write(struct p } } + /* pass through MSI_ENABLE bit when no MSI-INTx translation */ + if (!ptdev->msi_trans_en) { + *value &= ~PCI_MSI_FLAGS_ENABLE; + *value |= val & PCI_MSI_FLAGS_ENABLE; + } + return 0; } @@ -4149,10 +4157,10 @@ static int pt_msixctrl_reg_write(struct /* update MSI-X */ if ((*value & PCI_MSIX_ENABLE) && !(*value & PCI_MSIX_MASK)) { - if (ptdev->msi_trans_en) { +/* if (ptdev->msi_trans_en) { PT_LOG("guest enabling MSI-X, disable MSI-INTx translation\n"); pt_disable_msi_translate(ptdev); - } + }*/ pt_msix_update(ptdev); } else if (!(*value & PCI_MSIX_ENABLE) && ptdev->msix->enabled) { pt_msix_disable(ptdev);