qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] pci: Fix function pci_default_write_config
@ 2009-11-13 22:26 Stefan Weil
  2009-11-13 22:58 ` Ryan Harper
  0 siblings, 1 reply; 2+ messages in thread
From: Stefan Weil @ 2009-11-13 22:26 UTC (permalink / raw)
  To: qemu-devel

Change 260c0cd3d985e51b15870ff47e17b7b930efbda1
(pci: use range helper functions) introduced a
bug which made pci cirrus vga on mips malta
(and maybe other pci devices) fail.

Don't change addr - its original value is needed
by ranges_overlap() and range_covers().

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
---
 hw/pci.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/hw/pci.c b/hw/pci.c
index a326930..6864339 100644
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -856,9 +856,9 @@ void pci_default_write_config(PCIDevice *d, uint32_t addr, uint32_t val, int l)
     int i;
     uint32_t config_size = pci_config_size(d);
 
-    for(i = 0; i < l && addr < config_size; val >>= 8, ++i, ++addr) {
-        uint8_t wmask = d->wmask[addr];
-        d->config[addr] = (d->config[addr] & ~wmask) | (val & wmask);
+    for (i = 0; i < l && addr + i < config_size; val >>= 8, ++i) {
+        uint8_t wmask = d->wmask[addr + i];
+        d->config[addr + i] = (d->config[addr + i] & ~wmask) | (val & wmask);
     }
     if (ranges_overlap(addr, l, PCI_BASE_ADDRESS_0, 24) ||
         ranges_overlap(addr, l, PCI_ROM_ADDRESS, 4) ||
-- 
1.5.6.5

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

* Re: [Qemu-devel] [PATCH] pci: Fix function pci_default_write_config
  2009-11-13 22:26 [Qemu-devel] [PATCH] pci: Fix function pci_default_write_config Stefan Weil
@ 2009-11-13 22:58 ` Ryan Harper
  0 siblings, 0 replies; 2+ messages in thread
From: Ryan Harper @ 2009-11-13 22:58 UTC (permalink / raw)
  To: Stefan Weil; +Cc: qemu-devel

* Stefan Weil <weil@mail.berlios.de> [2009-11-13 16:29]:
> Change 260c0cd3d985e51b15870ff47e17b7b930efbda1
> (pci: use range helper functions) introduced a
> bug which made pci cirrus vga on mips malta
> (and maybe other pci devices) fail.
> 
> Don't change addr - its original value is needed
> by ranges_overlap() and range_covers().
> 
> Signed-off-by: Stefan Weil <weil@mail.berlios.de>

This fixes the fedora 9 boot from dvd issue I've seen.

Acked-by: Ryan Harper <ryanh@us.ibm.com>

> ---
>  hw/pci.c |    6 +++---
>  1 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/hw/pci.c b/hw/pci.c
> index a326930..6864339 100644
> --- a/hw/pci.c
> +++ b/hw/pci.c
> @@ -856,9 +856,9 @@ void pci_default_write_config(PCIDevice *d, uint32_t addr, uint32_t val, int l)
>      int i;
>      uint32_t config_size = pci_config_size(d);
> 
> -    for(i = 0; i < l && addr < config_size; val >>= 8, ++i, ++addr) {
> -        uint8_t wmask = d->wmask[addr];
> -        d->config[addr] = (d->config[addr] & ~wmask) | (val & wmask);
> +    for (i = 0; i < l && addr + i < config_size; val >>= 8, ++i) {
> +        uint8_t wmask = d->wmask[addr + i];
> +        d->config[addr + i] = (d->config[addr + i] & ~wmask) | (val & wmask);
>      }
>      if (ranges_overlap(addr, l, PCI_BASE_ADDRESS_0, 24) ||
>          ranges_overlap(addr, l, PCI_ROM_ADDRESS, 4) ||
> -- 
> 1.5.6.5
> 
> 

-- 
Ryan Harper
Software Engineer; Linux Technology Center
IBM Corp., Austin, Tx
ryanh@us.ibm.com

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

end of thread, other threads:[~2009-11-13 22:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-13 22:26 [Qemu-devel] [PATCH] pci: Fix function pci_default_write_config Stefan Weil
2009-11-13 22:58 ` Ryan Harper

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).