From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alex Williamson Subject: Re: [PATCH v2 2/3] pci-assign: Use PCI-2.3-based shared legacy interrupts Date: Wed, 07 Mar 2012 11:14:09 -0700 Message-ID: <1331144049.29701.332.camel@bling.home> References: <6ef91f83c1d72b986813350611c0df21de786760.1331140766.git.jan.kiszka@siemens.com> <1331142392.29701.329.camel@bling.home> <4F57A37F.3020502@siemens.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Cc: Avi Kivity , Marcelo Tosatti , "kvm@vger.kernel.org" , "Michael S. Tsirkin" To: Jan Kiszka Return-path: Received: from mx1.redhat.com ([209.132.183.28]:1439 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754732Ab2CGSON (ORCPT ); Wed, 7 Mar 2012 13:14:13 -0500 In-Reply-To: <4F57A37F.3020502@siemens.com> Sender: kvm-owner@vger.kernel.org List-ID: On Wed, 2012-03-07 at 19:05 +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 > --- > > Changes in v2: > - only call into kvm_device_intx_set_mask if the mask actually changed > > 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..12e2195 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); > + uint32_t old_cmd = pci_get_word(pci_dev->config + PCI_COMMAND); nit, uint16_t