[PATCH v2 4/4] hw/ppc/ppc440_pcix: Move ppc440_pcix.c to hw/pci-host/

Philippe Mathieu-Daudé posted 4 patches 9 months, 3 weeks ago
Maintainers: Paolo Bonzini <pbonzini@redhat.com>, Nicholas Piggin <npiggin@gmail.com>, Daniel Henrique Barboza <danielhb413@gmail.com>, "Cédric Le Goater" <clg@kaod.org>, BALATON Zoltan <balaton@eik.bme.hu>
There is a newer version of this series
[PATCH v2 4/4] hw/ppc/ppc440_pcix: Move ppc440_pcix.c to hw/pci-host/
Posted by Philippe Mathieu-Daudé 9 months, 3 weeks ago
ppc440_pcix.c is moved from the target specific ppc_ss[] meson
source set to pci_ss[] which is common to all targets: the
object is built once.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 MAINTAINERS                        | 2 +-
 hw/{ppc => pci-host}/ppc440_pcix.c | 0
 hw/pci-host/Kconfig                | 4 ++++
 hw/pci-host/meson.build            | 1 +
 hw/pci-host/trace-events           | 8 ++++++++
 hw/ppc/Kconfig                     | 1 +
 hw/ppc/meson.build                 | 2 +-
 hw/ppc/trace-events                | 8 --------
 8 files changed, 16 insertions(+), 10 deletions(-)
 rename hw/{ppc => pci-host}/ppc440_pcix.c (100%)

diff --git a/MAINTAINERS b/MAINTAINERS
index 1927530c2d..42e63ed696 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1554,7 +1554,7 @@ L: qemu-ppc@nongnu.org
 S: Maintained
 F: hw/ppc/sam460ex.c
 F: hw/ppc/ppc440_uc.c
-F: hw/ppc/ppc440_pcix.c
+F: hw/pci-host/ppc440_pcix.c
 F: hw/display/sm501*
 F: hw/ide/sii3112.c
 F: hw/rtc/m41t80.c
diff --git a/hw/ppc/ppc440_pcix.c b/hw/pci-host/ppc440_pcix.c
similarity index 100%
rename from hw/ppc/ppc440_pcix.c
rename to hw/pci-host/ppc440_pcix.c
diff --git a/hw/pci-host/Kconfig b/hw/pci-host/Kconfig
index 0a221e719e..b348cacadb 100644
--- a/hw/pci-host/Kconfig
+++ b/hw/pci-host/Kconfig
@@ -10,6 +10,10 @@ config PPC4XX_PCI
     bool
     select PCI
 
+config PPC440_PCI
+    bool
+    select PCI
+
 config RAVEN_PCI
     bool
     select PCI
diff --git a/hw/pci-host/meson.build b/hw/pci-host/meson.build
index eb6dc71c88..83cf3a1783 100644
--- a/hw/pci-host/meson.build
+++ b/hw/pci-host/meson.build
@@ -15,6 +15,7 @@ pci_ss.add(when: 'CONFIG_SH_PCI', if_true: files('sh_pci.c'))
 
 # PPC devices
 pci_ss.add(when: 'CONFIG_PPC4XX_PCI', if_true: files('ppc4xx_pci.c'))
+pci_ss.add(when: 'CONFIG_PPC440_PCI', if_true: files('ppc440_pcix.c'))
 pci_ss.add(when: 'CONFIG_RAVEN_PCI', if_true: files('raven.c'))
 pci_ss.add(when: 'CONFIG_GRACKLE_PCI', if_true: files('grackle.c'))
 # NewWorld PowerMac
diff --git a/hw/pci-host/trace-events b/hw/pci-host/trace-events
index 90a37ebff0..0a816b9aa1 100644
--- a/hw/pci-host/trace-events
+++ b/hw/pci-host/trace-events
@@ -41,6 +41,14 @@ unin_read(uint64_t addr, uint64_t value) "addr=0x%" PRIx64 " val=0x%"PRIx64
 ppc4xx_pci_map_irq(int32_t devfn, int irq_num, int slot) "devfn 0x%x irq %d -> %d"
 ppc4xx_pci_set_irq(int irq_num) "PCI irq %d"
 
+# ppc440_pcix.c
+ppc440_pcix_map_irq(int32_t devfn, int irq_num, int slot) "devfn 0x%x irq %d -> %d"
+ppc440_pcix_set_irq(int irq_num) "PCI irq %d"
+ppc440_pcix_update_pim(int idx, uint64_t size, uint64_t la) "Added window %d of size=0x%" PRIx64 " to CPU=0x%" PRIx64
+ppc440_pcix_update_pom(int idx, uint32_t size, uint64_t la, uint64_t pcia) "Added window %d of size=0x%x from CPU=0x%" PRIx64 " to PCI=0x%" PRIx64
+ppc440_pcix_reg_read(uint64_t addr, uint32_t val) "addr 0x%" PRIx64 " = 0x%" PRIx32
+ppc440_pcix_reg_write(uint64_t addr, uint32_t val, uint32_t size) "addr 0x%" PRIx64 " = 0x%" PRIx32 " size 0x%" PRIx32
+
 # pnv_phb4.c
 pnv_phb4_xive_notify(uint64_t notif_port, uint64_t data) "notif=@0x%"PRIx64" data=0x%"PRIx64
 pnv_phb4_xive_notify_ic(uint64_t addr, uint64_t data) "addr=@0x%"PRIx64" data=0x%"PRIx64
diff --git a/hw/ppc/Kconfig b/hw/ppc/Kconfig
index 82e847d22c..2da6c16186 100644
--- a/hw/ppc/Kconfig
+++ b/hw/ppc/Kconfig
@@ -46,6 +46,7 @@ config PPC440
     imply TEST_DEVICES
     imply E1000_PCI
     select PCI_EXPRESS
+    select PPC440_PCI
     select PPC4XX
     select SERIAL
     select FDT_PPC
diff --git a/hw/ppc/meson.build b/hw/ppc/meson.build
index d0efc0aba5..da14fccce5 100644
--- a/hw/ppc/meson.build
+++ b/hw/ppc/meson.build
@@ -60,7 +60,7 @@ ppc_ss.add(when: 'CONFIG_PPC405', if_true: files(
   'ppc405_uc.c'))
 ppc_ss.add(when: 'CONFIG_PPC440', if_true: files(
   'ppc440_bamboo.c',
-  'ppc440_pcix.c', 'ppc440_uc.c'))
+  'ppc440_uc.c'))
 ppc_ss.add(when: 'CONFIG_PPC4XX', if_true: files(
   'ppc4xx_devs.c',
   'ppc4xx_sdram.c'))
diff --git a/hw/ppc/trace-events b/hw/ppc/trace-events
index b59fbf340f..157ea756e9 100644
--- a/hw/ppc/trace-events
+++ b/hw/ppc/trace-events
@@ -146,14 +146,6 @@ rs6000mc_size_read(uint32_t addr, uint32_t val) "read addr=0x%x val=0x%x"
 rs6000mc_size_write(uint32_t addr, uint32_t val) "write addr=0x%x val=0x%x"
 rs6000mc_parity_read(uint32_t addr, uint32_t val) "read addr=0x%x val=0x%x"
 
-# ppc440_pcix.c
-ppc440_pcix_map_irq(int32_t devfn, int irq_num, int slot) "devfn 0x%x irq %d -> %d"
-ppc440_pcix_set_irq(int irq_num) "PCI irq %d"
-ppc440_pcix_update_pim(int idx, uint64_t size, uint64_t la) "Added window %d of size=0x%" PRIx64 " to CPU=0x%" PRIx64
-ppc440_pcix_update_pom(int idx, uint32_t size, uint64_t la, uint64_t pcia) "Added window %d of size=0x%x from CPU=0x%" PRIx64 " to PCI=0x%" PRIx64
-ppc440_pcix_reg_read(uint64_t addr, uint32_t val) "addr 0x%" PRIx64 " = 0x%" PRIx32
-ppc440_pcix_reg_write(uint64_t addr, uint32_t val, uint32_t size) "addr 0x%" PRIx64 " = 0x%" PRIx32 " size 0x%" PRIx32
-
 # ppc405_boards.c
 opba_readb(uint64_t addr, uint32_t val) "addr 0x%" PRIx64 " = 0x%" PRIx32
 opba_writeb(uint64_t addr, uint64_t val) "addr 0x%" PRIx64 " = 0x%" PRIx64
-- 
2.41.0


Re: [PATCH v2 4/4] hw/ppc/ppc440_pcix: Move ppc440_pcix.c to hw/pci-host/
Posted by BALATON Zoltan 9 months, 3 weeks ago
On Wed, 7 Feb 2024, Philippe Mathieu-Daudé wrote:
> ppc440_pcix.c is moved from the target specific ppc_ss[] meson
> source set to pci_ss[] which is common to all targets: the
> object is built once.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> MAINTAINERS                        | 2 +-
> hw/{ppc => pci-host}/ppc440_pcix.c | 0
> hw/pci-host/Kconfig                | 4 ++++
> hw/pci-host/meson.build            | 1 +
> hw/pci-host/trace-events           | 8 ++++++++
> hw/ppc/Kconfig                     | 1 +
> hw/ppc/meson.build                 | 2 +-
> hw/ppc/trace-events                | 8 --------
> 8 files changed, 16 insertions(+), 10 deletions(-)
> rename hw/{ppc => pci-host}/ppc440_pcix.c (100%)
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 1927530c2d..42e63ed696 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -1554,7 +1554,7 @@ L: qemu-ppc@nongnu.org
> S: Maintained
> F: hw/ppc/sam460ex.c
> F: hw/ppc/ppc440_uc.c
> -F: hw/ppc/ppc440_pcix.c
> +F: hw/pci-host/ppc440_pcix.c
> F: hw/display/sm501*
> F: hw/ide/sii3112.c
> F: hw/rtc/m41t80.c
> diff --git a/hw/ppc/ppc440_pcix.c b/hw/pci-host/ppc440_pcix.c
> similarity index 100%
> rename from hw/ppc/ppc440_pcix.c
> rename to hw/pci-host/ppc440_pcix.c
> diff --git a/hw/pci-host/Kconfig b/hw/pci-host/Kconfig
> index 0a221e719e..b348cacadb 100644
> --- a/hw/pci-host/Kconfig
> +++ b/hw/pci-host/Kconfig
> @@ -10,6 +10,10 @@ config PPC4XX_PCI
>     bool
>     select PCI
>
> +config PPC440_PCI

Maybe PPC440_PCIX to be consistent with the file name? There are different 
versions of these PCI hosts in different SoCs so I'm not sure there isn't 
another earlier one with is called just pci so better call this one pcix 
as it's referred to in the device tree so we don't need to rename it if 
another SoC with just PCI host is added later.

Regards,
BALATON Zoltan

> +    bool
> +    select PCI
> +
> config RAVEN_PCI
>     bool
>     select PCI
> diff --git a/hw/pci-host/meson.build b/hw/pci-host/meson.build
> index eb6dc71c88..83cf3a1783 100644
> --- a/hw/pci-host/meson.build
> +++ b/hw/pci-host/meson.build
> @@ -15,6 +15,7 @@ pci_ss.add(when: 'CONFIG_SH_PCI', if_true: files('sh_pci.c'))
>
> # PPC devices
> pci_ss.add(when: 'CONFIG_PPC4XX_PCI', if_true: files('ppc4xx_pci.c'))
> +pci_ss.add(when: 'CONFIG_PPC440_PCI', if_true: files('ppc440_pcix.c'))
> pci_ss.add(when: 'CONFIG_RAVEN_PCI', if_true: files('raven.c'))
> pci_ss.add(when: 'CONFIG_GRACKLE_PCI', if_true: files('grackle.c'))
> # NewWorld PowerMac
> diff --git a/hw/pci-host/trace-events b/hw/pci-host/trace-events
> index 90a37ebff0..0a816b9aa1 100644
> --- a/hw/pci-host/trace-events
> +++ b/hw/pci-host/trace-events
> @@ -41,6 +41,14 @@ unin_read(uint64_t addr, uint64_t value) "addr=0x%" PRIx64 " val=0x%"PRIx64
> ppc4xx_pci_map_irq(int32_t devfn, int irq_num, int slot) "devfn 0x%x irq %d -> %d"
> ppc4xx_pci_set_irq(int irq_num) "PCI irq %d"
>
> +# ppc440_pcix.c
> +ppc440_pcix_map_irq(int32_t devfn, int irq_num, int slot) "devfn 0x%x irq %d -> %d"
> +ppc440_pcix_set_irq(int irq_num) "PCI irq %d"
> +ppc440_pcix_update_pim(int idx, uint64_t size, uint64_t la) "Added window %d of size=0x%" PRIx64 " to CPU=0x%" PRIx64
> +ppc440_pcix_update_pom(int idx, uint32_t size, uint64_t la, uint64_t pcia) "Added window %d of size=0x%x from CPU=0x%" PRIx64 " to PCI=0x%" PRIx64
> +ppc440_pcix_reg_read(uint64_t addr, uint32_t val) "addr 0x%" PRIx64 " = 0x%" PRIx32
> +ppc440_pcix_reg_write(uint64_t addr, uint32_t val, uint32_t size) "addr 0x%" PRIx64 " = 0x%" PRIx32 " size 0x%" PRIx32
> +
> # pnv_phb4.c
> pnv_phb4_xive_notify(uint64_t notif_port, uint64_t data) "notif=@0x%"PRIx64" data=0x%"PRIx64
> pnv_phb4_xive_notify_ic(uint64_t addr, uint64_t data) "addr=@0x%"PRIx64" data=0x%"PRIx64
> diff --git a/hw/ppc/Kconfig b/hw/ppc/Kconfig
> index 82e847d22c..2da6c16186 100644
> --- a/hw/ppc/Kconfig
> +++ b/hw/ppc/Kconfig
> @@ -46,6 +46,7 @@ config PPC440
>     imply TEST_DEVICES
>     imply E1000_PCI
>     select PCI_EXPRESS
> +    select PPC440_PCI
>     select PPC4XX
>     select SERIAL
>     select FDT_PPC
> diff --git a/hw/ppc/meson.build b/hw/ppc/meson.build
> index d0efc0aba5..da14fccce5 100644
> --- a/hw/ppc/meson.build
> +++ b/hw/ppc/meson.build
> @@ -60,7 +60,7 @@ ppc_ss.add(when: 'CONFIG_PPC405', if_true: files(
>   'ppc405_uc.c'))
> ppc_ss.add(when: 'CONFIG_PPC440', if_true: files(
>   'ppc440_bamboo.c',
> -  'ppc440_pcix.c', 'ppc440_uc.c'))
> +  'ppc440_uc.c'))
> ppc_ss.add(when: 'CONFIG_PPC4XX', if_true: files(
>   'ppc4xx_devs.c',
>   'ppc4xx_sdram.c'))
> diff --git a/hw/ppc/trace-events b/hw/ppc/trace-events
> index b59fbf340f..157ea756e9 100644
> --- a/hw/ppc/trace-events
> +++ b/hw/ppc/trace-events
> @@ -146,14 +146,6 @@ rs6000mc_size_read(uint32_t addr, uint32_t val) "read addr=0x%x val=0x%x"
> rs6000mc_size_write(uint32_t addr, uint32_t val) "write addr=0x%x val=0x%x"
> rs6000mc_parity_read(uint32_t addr, uint32_t val) "read addr=0x%x val=0x%x"
>
> -# ppc440_pcix.c
> -ppc440_pcix_map_irq(int32_t devfn, int irq_num, int slot) "devfn 0x%x irq %d -> %d"
> -ppc440_pcix_set_irq(int irq_num) "PCI irq %d"
> -ppc440_pcix_update_pim(int idx, uint64_t size, uint64_t la) "Added window %d of size=0x%" PRIx64 " to CPU=0x%" PRIx64
> -ppc440_pcix_update_pom(int idx, uint32_t size, uint64_t la, uint64_t pcia) "Added window %d of size=0x%x from CPU=0x%" PRIx64 " to PCI=0x%" PRIx64
> -ppc440_pcix_reg_read(uint64_t addr, uint32_t val) "addr 0x%" PRIx64 " = 0x%" PRIx32
> -ppc440_pcix_reg_write(uint64_t addr, uint32_t val, uint32_t size) "addr 0x%" PRIx64 " = 0x%" PRIx32 " size 0x%" PRIx32
> -
> # ppc405_boards.c
> opba_readb(uint64_t addr, uint32_t val) "addr 0x%" PRIx64 " = 0x%" PRIx32
> opba_writeb(uint64_t addr, uint64_t val) "addr 0x%" PRIx64 " = 0x%" PRIx64
>
Re: [PATCH v2 4/4] hw/ppc/ppc440_pcix: Move ppc440_pcix.c to hw/pci-host/
Posted by Thomas Huth 9 months, 3 weeks ago
On 07/02/2024 10.12, Philippe Mathieu-Daudé wrote:
> ppc440_pcix.c is moved from the target specific ppc_ss[] meson
> source set to pci_ss[] which is common to all targets: the
> object is built once.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   MAINTAINERS                        | 2 +-
>   hw/{ppc => pci-host}/ppc440_pcix.c | 0
>   hw/pci-host/Kconfig                | 4 ++++
>   hw/pci-host/meson.build            | 1 +
>   hw/pci-host/trace-events           | 8 ++++++++
>   hw/ppc/Kconfig                     | 1 +
>   hw/ppc/meson.build                 | 2 +-
>   hw/ppc/trace-events                | 8 --------
>   8 files changed, 16 insertions(+), 10 deletions(-)
>   rename hw/{ppc => pci-host}/ppc440_pcix.c (100%)

Reviewed-by: Thomas Huth <thuth@redhat.com>