From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MvVkM-0007cb-Fl for qemu-devel@nongnu.org; Wed, 07 Oct 2009 08:35:58 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MvVkH-0007aI-8H for qemu-devel@nongnu.org; Wed, 07 Oct 2009 08:35:57 -0400 Received: from [199.232.76.173] (port=56708 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MvVkH-0007aD-4W for qemu-devel@nongnu.org; Wed, 07 Oct 2009 08:35:53 -0400 Received: from mx1.redhat.com ([209.132.183.28]:25226) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MvVkG-0004EF-Ji for qemu-devel@nongnu.org; Wed, 07 Oct 2009 08:35:52 -0400 Date: Wed, 7 Oct 2009 14:33:49 +0200 From: "Michael S. Tsirkin" Message-ID: <20091007123348.GA31537@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Subject: [Qemu-devel] [PATCH] qemu/pci: optimize pci config handling List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, Isaku Yamahata There's no need to save all of config space before each config cycle: just the 64 byte header is enough for our purposes. This will become more important as we add pci express support, which has 4K config space. Signed-off-by: Michael S. Tsirkin Cc: Isaku Yamahata --- Isaku Yamahata, I think with this change, you can increase the size of config space to 4K without need for helper functions. Makes sense? hw/pci.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/pci.c b/hw/pci.c index 41e99a9..5986937 100644 --- a/hw/pci.c +++ b/hw/pci.c @@ -541,11 +541,11 @@ uint32_t pci_default_read_config(PCIDevice *d, void pci_default_write_config(PCIDevice *d, uint32_t addr, uint32_t val, int l) { - uint8_t orig[PCI_CONFIG_SPACE_SIZE]; + uint8_t orig[PCI_CONFIG_HEADER_SIZE]; int i; /* not efficient, but simple */ - memcpy(orig, d->config, PCI_CONFIG_SPACE_SIZE); + memcpy(orig, d->config, sizeof orig); for(i = 0; i < l && addr < PCI_CONFIG_SPACE_SIZE; val >>= 8, ++i, ++addr) { uint8_t wmask = d->wmask[addr]; d->config[addr] = (d->config[addr] & ~wmask) | (val & wmask); -- 1.6.5.rc2