On 2012-03-07 19:32, Alex Williamson wrote: > On Wed, 2012-03-07 at 19:18 +0100, Jan Kiszka wrote: >> Enable the new KVM feature that allows legacy interrupt sharing for >> PCI-2.3-compliant devices. This requires to synchronize any guest >> change of the INTx mask bit to the kernel. >> >> The feature is controlled by the property 'share_intx' and is off by >> default for now. >> >> Signed-off-by: Jan Kiszka <jan.kiszka@xxxxxxxxxxx> >> --- >> >> Changes in v3: >> - fixed nit :) >> >> hw/device-assignment.c | 24 ++++++++++++++++++++++++ >> hw/device-assignment.h | 10 ++++++---- >> qemu-kvm.c | 9 +++++++++ >> qemu-kvm.h | 2 ++ >> 4 files changed, 41 insertions(+), 4 deletions(-) >> >> diff --git a/hw/device-assignment.c b/hw/device-assignment.c >> index a5f1abb..e2a8479 100644 >> --- a/hw/device-assignment.c >> +++ b/hw/device-assignment.c >> @@ -782,6 +782,13 @@ static int assign_device(AssignedDevice *dev) >> "cause host memory corruption if the device issues DMA write " >> "requests!\n"); >> } >> + if (dev->features & ASSIGNED_DEVICE_SHARE_INTX_MASK) { >> + assigned_dev_data.flags |= KVM_DEV_ASSIGN_PCI_2_3; >> + >> + /* hide host-side INTx masking from the guest */ >> + dev->emulate_config_read[PCI_COMMAND + 1] |= >> + PCI_COMMAND_INTX_DISABLE >> 8; >> + } >> >> r = kvm_assign_pci_device(kvm_state, &assigned_dev_data); >> if (r < 0) { >> @@ -1121,10 +1128,25 @@ static void assigned_dev_pci_write_config(PCIDevice *pci_dev, uint32_t address, >> uint32_t val, int len) >> { >> AssignedDevice *assigned_dev = DO_UPCAST(AssignedDevice, dev, pci_dev); >> + uint16_t old_cmd = pci_get_word(pci_dev->config + PCI_COMMAND); >> uint32_t emulate_mask, full_emulation_mask; >> + int ret; >> >> pci_default_write_config(pci_dev, address, val, len); >> >> + if (range_covers_byte(address, len, PCI_COMMAND + 1)) { > > Hmm, now that I've acked this... shouldn't we have a feature check here > to avoid the ioctl when share_intx=false or when the host kernel doesn't > support this? Thanks, Hmm, I thought I handled this, somehow. But it's not there. v4 follows... Thanks, Jan -- Siemens AG, Corporate Technology, CT T DE IT 1 Corporate Competence Center Embedded Linux -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html