diff mbox series

[4/4] hw/sparc64/ebus: Access memory regions via pci_address_space_io()

Message ID 20231011185954.10337-5-philmd@linaro.org
State Superseded
Headers show
Series hw/pci: Have functions acess memory regions via pci_address_space() | expand

Commit Message

Philippe Mathieu-Daudé Oct. 11, 2023, 6:59 p.m. UTC
PCI functions are plugged on a PCI bus. They can only access
external memory regions via the bus.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/sparc64/sun4u.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Mark Cave-Ayland Oct. 13, 2023, 6:29 p.m. UTC | #1
On 11/10/2023 19:59, Philippe Mathieu-Daudé wrote:

> PCI functions are plugged on a PCI bus. They can only access
> external memory regions via the bus.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   hw/sparc64/sun4u.c | 8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c
> index d908a38f73..c871170378 100644
> --- a/hw/sparc64/sun4u.c
> +++ b/hw/sparc64/sun4u.c
> @@ -360,11 +360,11 @@ static void ebus_realize(PCIDevice *pci_dev, Error **errp)
>       pci_dev->config[0x09] = 0x00; // programming i/f
>       pci_dev->config[0x0D] = 0x0a; // latency_timer
>   
> -    memory_region_init_alias(&s->bar0, OBJECT(s), "bar0", get_system_io(),
> -                             0, 0x1000000);
> +    memory_region_init_alias(&s->bar0, OBJECT(s), "bar0",
> +                             pci_address_space_io(pci_dev), 0, 0x1000000);
>       pci_register_bar(pci_dev, 0, PCI_BASE_ADDRESS_SPACE_MEMORY, &s->bar0);
> -    memory_region_init_alias(&s->bar1, OBJECT(s), "bar1", get_system_io(),
> -                             0, 0x8000);
> +    memory_region_init_alias(&s->bar1, OBJECT(s), "bar1",
> +                             pci_address_space_io(pci_dev), 0, 0x8000);
>       pci_register_bar(pci_dev, 1, PCI_BASE_ADDRESS_SPACE_IO, &s->bar1);
>   }

Nice!

Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>


ATB,

Mark.
diff mbox series

Patch

diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c
index d908a38f73..c871170378 100644
--- a/hw/sparc64/sun4u.c
+++ b/hw/sparc64/sun4u.c
@@ -360,11 +360,11 @@  static void ebus_realize(PCIDevice *pci_dev, Error **errp)
     pci_dev->config[0x09] = 0x00; // programming i/f
     pci_dev->config[0x0D] = 0x0a; // latency_timer
 
-    memory_region_init_alias(&s->bar0, OBJECT(s), "bar0", get_system_io(),
-                             0, 0x1000000);
+    memory_region_init_alias(&s->bar0, OBJECT(s), "bar0",
+                             pci_address_space_io(pci_dev), 0, 0x1000000);
     pci_register_bar(pci_dev, 0, PCI_BASE_ADDRESS_SPACE_MEMORY, &s->bar0);
-    memory_region_init_alias(&s->bar1, OBJECT(s), "bar1", get_system_io(),
-                             0, 0x8000);
+    memory_region_init_alias(&s->bar1, OBJECT(s), "bar1",
+                             pci_address_space_io(pci_dev), 0, 0x8000);
     pci_register_bar(pci_dev, 1, PCI_BASE_ADDRESS_SPACE_IO, &s->bar1);
 }