qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] qemu/pci: optimize pci config handling
@ 2009-10-07 12:33 Michael S. Tsirkin
  2009-10-07 13:01 ` [Qemu-devel] " Paolo Bonzini
  2009-10-08  0:08 ` Isaku Yamahata
  0 siblings, 2 replies; 11+ messages in thread
From: Michael S. Tsirkin @ 2009-10-07 12:33 UTC (permalink / raw)
  To: qemu-devel, 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 <mst@redhat.com>
Cc: Isaku Yamahata <yamahata@valinux.co.jp>
---

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

^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2009-10-13 12:17 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-07 12:33 [Qemu-devel] [PATCH] qemu/pci: optimize pci config handling Michael S. Tsirkin
2009-10-07 13:01 ` [Qemu-devel] " Paolo Bonzini
2009-10-07 13:48   ` Michael S. Tsirkin
2009-10-07 14:24     ` Paolo Bonzini
2009-10-07 19:21       ` Michael S. Tsirkin
2009-10-08  8:23         ` Paolo Bonzini
2009-10-08  8:57           ` Michael S. Tsirkin
2009-10-08  0:08 ` Isaku Yamahata
2009-10-08  8:54   ` Michael S. Tsirkin
2009-10-08  9:29   ` Michael S. Tsirkin
2009-10-13 12:17     ` Isaku Yamahata

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).