From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=42313 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PHqQ6-0000PH-MI for qemu-devel@nongnu.org; Sun, 14 Nov 2010 23:11:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PHqQ5-0006Ce-Gc for qemu-devel@nongnu.org; Sun, 14 Nov 2010 23:11:54 -0500 Received: from mx1.redhat.com ([209.132.183.28]:7224) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PHqQ5-0006CG-8G for qemu-devel@nongnu.org; Sun, 14 Nov 2010 23:11:53 -0500 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id oAF4BpgM018470 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sun, 14 Nov 2010 23:11:51 -0500 From: Alex Williamson In-Reply-To: <20101113212107.GA24071@redhat.com> References: <20101113212107.GA24071@redhat.com> Content-Type: text/plain; charset="UTF-8" Date: Sun, 14 Nov 2010 21:11:50 -0700 Message-ID: <1289794310.2805.161.camel@x201> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [PATCH] pci: split config update for dev assignment List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" Cc: qemu-devel@nongnu.org On Sat, 2010-11-13 at 23:21 +0200, Michael S. Tsirkin wrote: > Device assignment in qemu-kvm wants to update > config array without any side-efects. > Make it easier to do so. This isn't exactly true. The change is a side-effect of qemu-kvm capability support currently being broken wrt wmask. Device assignment is just trying to make use of it. > Signed-off-by: Michael S. Tsirkin > --- > > Alex, I think your work on dev assignment will be easier if I apply > this on qemu.kvm. Right? Let me know. It might make merging easier, I don't really know how you handle that, but I wonder if the right (although much more work on my part) is to push my 8/9 patch down in my queue. That removes pci_default_cap_write_config, then my current 1/9 patch isn't really needed and this merge conflict goes away. Let me know. Thanks, Alex > hw/pci.c | 12 ++++++++++-- > 1 files changed, 10 insertions(+), 2 deletions(-) > > diff --git a/hw/pci.c b/hw/pci.c > index 8f6fcf8..30e1603 100644 > --- a/hw/pci.c > +++ b/hw/pci.c > @@ -996,10 +996,10 @@ uint32_t pci_default_read_config(PCIDevice *d, > return le32_to_cpu(val); > } > > -void pci_default_write_config(PCIDevice *d, uint32_t addr, uint32_t val, int l) > +static void pci_update_config(PCIDevice *d, uint32_t addr, uint32_t val, int l) > { > - int i, was_irq_disabled = pci_irq_disabled(d); > uint32_t config_size = pci_config_size(d); > + int i; > > for (i = 0; i < l && addr + i < config_size; val >>= 8, ++i) { > uint8_t wmask = d->wmask[addr + i]; > @@ -1008,6 +1008,14 @@ void pci_default_write_config(PCIDevice *d, uint32_t addr, uint32_t val, int l) > d->config[addr + i] = (d->config[addr + i] & ~wmask) | (val & wmask); > d->config[addr + i] &= ~(val & w1cmask); /* W1C: Write 1 to Clear */ > } > +} > + > +void pci_default_write_config(PCIDevice *d, uint32_t addr, uint32_t val, int l) > +{ > + int was_irq_disabled = pci_irq_disabled(d); > + > + pci_update_config(d, addr, val, l); > + > if (ranges_overlap(addr, l, PCI_BASE_ADDRESS_0, 24) || > ranges_overlap(addr, l, PCI_ROM_ADDRESS, 4) || > ranges_overlap(addr, l, PCI_ROM_ADDRESS1, 4) ||