Patchwork [V6,27/32] pci: teach pci_default_config_write() ROM bar for normal/bridge device .

login
register
mail settings
Submitter Isaku Yamahata
Date Oct. 30, 2009, 12:21 p.m.
Message ID <1256905286-25435-28-git-send-email-yamahata@valinux.co.jp>
Download mbox | patch
Permalink /patch/37284/
State New
Headers show

Comments

Isaku Yamahata - Oct. 30, 2009, 12:21 p.m.
When updated ROM expantion address of header type 0, it missed
to update mappings.
Add PCI_ROM_ADDRESS check whether to call pci_update_mappings()
Also update pci mapping when PCI_ROM_ADDRESS1 is written for header type 1.

pci_update_mapping() path isn't performance critical,
so call it even independent of header type.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
 hw/pci.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
Michael S. Tsirkin - Nov. 3, 2009, 2:20 p.m.
On Fri, Oct 30, 2009 at 09:21:21PM +0900, Isaku Yamahata wrote:
> When updated ROM expantion address of header type 0, it missed
> to update mappings.
> Add PCI_ROM_ADDRESS check whether to call pci_update_mappings()
> Also update pci mapping when PCI_ROM_ADDRESS1 is written for header type 1.
> 
> pci_update_mapping() path isn't performance critical,
> so call it even independent of header type.
> 
> Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>

Acked-by: Michael S. Tsirkin <mst@redhat.com>

> ---
>  hw/pci.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/hw/pci.c b/hw/pci.c
> index d9fd564..46b22ec 100644
> --- a/hw/pci.c
> +++ b/hw/pci.c
> @@ -707,6 +707,8 @@ void pci_default_write_config(PCIDevice *d, uint32_t addr, uint32_t val, int l)
>          d->config[addr] = (d->config[addr] & ~wmask) | (val & wmask);
>      }
>      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) ||
>          range_covers_byte(addr, l, PCI_COMMAND))
>          pci_update_mappings(d);
>  }
> -- 
> 1.6.0.2
Michael S. Tsirkin - Nov. 10, 2009, 4:01 p.m.
On Fri, Oct 30, 2009 at 09:21:21PM +0900, Isaku Yamahata wrote:
> When updated ROM expantion address of header type 0, it missed
> to update mappings.
> Add PCI_ROM_ADDRESS check whether to call pci_update_mappings()
> Also update pci mapping when PCI_ROM_ADDRESS1 is written for header type 1.
> 
> pci_update_mapping() path isn't performance critical,
> so call it even independent of header type.
> 
> Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>

If possible please float this to start of series to I can
put on pci tree.

> ---
>  hw/pci.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/hw/pci.c b/hw/pci.c
> index d9fd564..46b22ec 100644
> --- a/hw/pci.c
> +++ b/hw/pci.c
> @@ -707,6 +707,8 @@ void pci_default_write_config(PCIDevice *d, uint32_t addr, uint32_t val, int l)
>          d->config[addr] = (d->config[addr] & ~wmask) | (val & wmask);
>      }
>      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) ||
>          range_covers_byte(addr, l, PCI_COMMAND))
>          pci_update_mappings(d);
>  }
> -- 
> 1.6.0.2
> 
>

Patch

diff --git a/hw/pci.c b/hw/pci.c
index d9fd564..46b22ec 100644
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -707,6 +707,8 @@  void pci_default_write_config(PCIDevice *d, uint32_t addr, uint32_t val, int l)
         d->config[addr] = (d->config[addr] & ~wmask) | (val & wmask);
     }
     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) ||
         range_covers_byte(addr, l, PCI_COMMAND))
         pci_update_mappings(d);
 }