Skip to contentSkip to conversation

hw/pci-host: Build ppc4xx_pci.c/ppc440_pcix.c once

PATCH Superseded Philippe Mathieu-Daudé 3 participants 12 messages Oct 11, 2023 Arm/Amlogic Meson SoC support

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover hw/pci-host: Build ppc4xx_pci.c/ppc440_pcix.c once

- Move ppc4xx_pci.c/ppc440_pcix.c from hw/ppc/ to hw/pci-host/
- Build them once for all targets

Philippe Mathieu-Daudé (5):
hw/ppc/ppc4xx_pci: Remove unused "hw/ppc/ppc.h" header hw/ppc/ppc4xx_pci: Extract PCI host definitions to
hw/pci-host/ppc4xx.h
hw/ppc/ppc4xx_pci: Declare PPC4XX_PCI in Kconfig hw/ppc/ppc4xx_pci: Move ppc4xx_pci.c to hw/pci-host/ hw/ppc/ppc440_pcix: Move ppc440_pcix.c to hw/pci-host/

 MAINTAINERS                        |  4 +++-
 include/hw/pci-host/ppc4xx.h       | 17 +++++++++++++++++
 include/hw/ppc/ppc4xx.h            |  5 -----
 hw/{ppc => pci-host}/ppc440_pcix.c |  3 +--
 hw/{ppc => pci-host}/ppc4xx_pci.c  |  3 +--
 hw/pci-host/ppce500.c              |  2 +-
 hw/ppc/ppc440_bamboo.c             |  1 +
 hw/ppc/ppc440_uc.c                 |  1 +
 hw/ppc/sam460ex.c                  |  1 +
 hw/pci-host/Kconfig                |  8 ++++++++
 hw/pci-host/meson.build            |  2 ++
 hw/pci-host/trace-events           | 12 ++++++++++++
 hw/ppc/Kconfig                     |  3 ++-
 hw/ppc/meson.build                 |  3 +--
 hw/ppc/trace-events                | 12 ------------
 15 files changed, 51 insertions(+), 26 deletions(-)
 create mode 100644 include/hw/pci-host/ppc4xx.h
 rename hw/{ppc => pci-host}/ppc440_pcix.c (99%)
 rename hw/{ppc => pci-host}/ppc4xx_pci.c (99%)
Signature · 1 line
2.41.0
#1 lore raw

PATCH 1/5 hw/ppc/ppc4xx_pci: Remove unused "hw/ppc/ppc.h" header

---
 hw/ppc/ppc440_pcix.c | 1 -
 hw/ppc/ppc4xx_pci.c  | 1 -
 2 files changed, 2 deletions(-)
hw/ppc/ppc440_pcix.c +0 -1
index 672090de94..e4dadbc84d 100644
@@ -25,7 +25,6 @@
 #include "qemu/module.h"
 #include "qemu/units.h"
 #include "hw/irq.h"
-#include "hw/ppc/ppc.h"
 #include "hw/ppc/ppc4xx.h"
 #include "hw/pci/pci_device.h"
 #include "hw/pci/pci_host.h"
hw/ppc/ppc4xx_pci.c +0 -1
index 6652119008..51c265f0ba 100644
@@ -24,7 +24,6 @@
 #include "qemu/osdep.h"
 #include "qemu/log.h"
 #include "hw/irq.h"
-#include "hw/ppc/ppc.h"
 #include "hw/ppc/ppc4xx.h"
 #include "migration/vmstate.h"
 #include "qemu/module.h"
Signature · 1 line
2.41.0
Reviewed-by on v1 1/5
#2 lore raw

Re: [PATCH 1/5] hw/ppc/ppc4xx_pci: Remove unused "hw/ppc/ppc.h" header

Quoted 1 line · Philippe Mathieu-Daudé
Quoted 30 lines

---
hw/ppc/ppc440_pcix.c | 1 -
hw/ppc/ppc4xx_pci.c | 1 -

2 files changed, 2 deletions(-)
hw/ppc/ppc440_pcix.c +0 -1
index 672090de94..e4dadbc84d 100644
@@ -25,7 +25,6 @@
 #include "qemu/module.h"
 #include "qemu/units.h"
 #include "hw/irq.h"
-#include "hw/ppc/ppc.h"
 #include "hw/ppc/ppc4xx.h"
 #include "hw/pci/pci_device.h"
 #include "hw/pci/pci_host.h"
hw/ppc/ppc4xx_pci.c +0 -1
index 6652119008..51c265f0ba 100644
@@ -24,7 +24,6 @@
 #include "qemu/osdep.h"
 #include "qemu/log.h"
 #include "hw/irq.h"
-#include "hw/ppc/ppc.h"
 #include "hw/ppc/ppc4xx.h"
 #include "migration/vmstate.h"
 #include "qemu/module.h"
#3 lore raw

PATCH 2/5 hw/ppc/ppc4xx_pci: Extract PCI host definitions to hw/pci-host/ppc4xx.h

In reply to Philippe Mathieu-Daudé
---
 MAINTAINERS                  |  1 +
 include/hw/pci-host/ppc4xx.h | 17 +++++++++++++++++
 include/hw/ppc/ppc4xx.h      |  5 -----
 hw/ppc/ppc440_bamboo.c       |  1 +
 hw/ppc/ppc440_pcix.c         |  2 +-
 hw/ppc/ppc440_uc.c           |  1 +
 hw/ppc/ppc4xx_pci.c          |  2 +-
 hw/ppc/sam460ex.c            |  1 +
 8 files changed, 23 insertions(+), 7 deletions(-)
 create mode 100644 include/hw/pci-host/ppc4xx.h
MAINTAINERS +1 -0
index 8c07d07927..158896d03e 100644
@@ -1969,6 +1969,7 @@ L: [email protected]
 S: Orphan
 F: hw/ppc/ppc4*.c
 F: hw/i2c/ppc4xx_i2c.c
+F: include/hw/pci-host/ppc4xx.h
 F: include/hw/ppc/ppc4xx.h
 F: include/hw/i2c/ppc4xx_i2c.h
 F: hw/intc/ppc-uic.c
include/hw/pci-host/ppc4xx.h new file +17 -0
new file mode 100644
index 0000000000..dc36e1ea29
@@ -0,0 +1,17 @@
+/*
+ * QEMU PowerPC 4xx PCI-host definitions
+ *
+ * Copyright (c) 2007 Jocelyn Mayer
+ *
+ * SPDX-License-Identifier: MIT
+ */
+
+#ifndef HW_PCIHOST_PPC4XX_H
+#define HW_PCIHOST_PPC4XX_H
+
+#define TYPE_PPC4xx_HOST_BRIDGE "ppc4xx-host-bridge"
+#define TYPE_PPC4xx_PCI_HOST "ppc4xx-pci-host"
+#define TYPE_PPC440_PCIX_HOST "ppc440-pcix-host"
+#define TYPE_PPC460EX_PCIE_HOST "ppc460ex-pcie-host"
+
+#endif
include/hw/ppc/ppc4xx.h +0 -5
index ea7740239b..1bd9b8821b 100644
@@ -29,11 +29,6 @@
 #include "exec/memory.h"
 #include "hw/sysbus.h"
 
-#define TYPE_PPC4xx_HOST_BRIDGE "ppc4xx-host-bridge"
-#define TYPE_PPC4xx_PCI_HOST "ppc4xx-pci-host"
-#define TYPE_PPC440_PCIX_HOST "ppc440-pcix-host"
-#define TYPE_PPC460EX_PCIE_HOST "ppc460ex-pcie-host"
-
 /*
  * Generic DCR device
  */
hw/ppc/ppc440_bamboo.c +1 -0
index 45f409c838..2049ff0eef 100644
@@ -24,6 +24,7 @@
 #include "elf.h"
 #include "hw/char/serial.h"
 #include "hw/ppc/ppc.h"
+#include "hw/pci-host/ppc4xx.h"
 #include "ppc405.h"
 #include "sysemu/sysemu.h"
 #include "sysemu/reset.h"
hw/ppc/ppc440_pcix.c +1 -1
index e4dadbc84d..418dff6590 100644
@@ -25,7 +25,7 @@
 #include "qemu/module.h"
 #include "qemu/units.h"
 #include "hw/irq.h"
-#include "hw/ppc/ppc4xx.h"
+#include "hw/pci-host/ppc4xx.h"
 #include "hw/pci/pci_device.h"
 #include "hw/pci/pci_host.h"
 #include "trace.h"
hw/ppc/ppc440_uc.c +1 -0
index 643a79e330..3a66b0c7f7 100644
@@ -14,6 +14,7 @@
 #include "qemu/log.h"
 #include "hw/irq.h"
 #include "hw/ppc/ppc4xx.h"
+#include "hw/pci-host/ppc4xx.h"
 #include "hw/qdev-properties.h"
 #include "hw/pci/pci.h"
 #include "sysemu/reset.h"
hw/ppc/ppc4xx_pci.c +1 -1
index 51c265f0ba..d2434a93ac 100644
@@ -24,7 +24,7 @@
 #include "qemu/osdep.h"
 #include "qemu/log.h"
 #include "hw/irq.h"
-#include "hw/ppc/ppc4xx.h"
+#include "hw/pci-host/ppc4xx.h"
 #include "migration/vmstate.h"
 #include "qemu/module.h"
 #include "sysemu/reset.h"
hw/ppc/sam460ex.c +1 -0
index 1e615b8d35..a28498f39c 100644
@@ -25,6 +25,7 @@
 #include "elf.h"
 #include "exec/memory.h"
 #include "ppc440.h"
+#include "hw/pci-host/ppc4xx.h"
 #include "hw/block/flash.h"
 #include "sysemu/sysemu.h"
 #include "sysemu/reset.h"
Signature · 1 line
2.41.0
Reviewed-by on v1 2/5
#4 lore raw

Re: [PATCH 2/5] hw/ppc/ppc4xx_pci: Extract PCI host definitions to hw/pci-host/ppc4xx.h

Quoted 1 line · Philippe Mathieu-Daudé

Regards,
BALATON Zoltan

Quoted 126 lines

---

MAINTAINERS                  |  1 +
include/hw/pci-host/ppc4xx.h | 17 +++++++++++++++++
include/hw/ppc/ppc4xx.h      |  5 -----
hw/ppc/ppc440_bamboo.c       |  1 +
hw/ppc/ppc440_pcix.c         |  2 +-
hw/ppc/ppc440_uc.c           |  1 +
hw/ppc/ppc4xx_pci.c          |  2 +-
hw/ppc/sam460ex.c            |  1 +
8 files changed, 23 insertions(+), 7 deletions(-)

create mode 100644 include/hw/pci-host/ppc4xx.h

MAINTAINERS +0 -0
index 8c07d07927..158896d03e 100644
@@ -1969,6 +1969,7 @@ L: [email protected]

S: Orphan
F: hw/ppc/ppc4*.c
F: hw/i2c/ppc4xx_i2c.c
+F: include/hw/pci-host/ppc4xx.h
F: include/hw/ppc/ppc4xx.h
F: include/hw/i2c/ppc4xx_i2c.h
F: hw/intc/ppc-uic.c

include/hw/pci-host/ppc4xx.h new file +17 -0
new file mode 100644
index 0000000000..dc36e1ea29
@@ -0,0 +1,17 @@
+/*
+ * QEMU PowerPC 4xx PCI-host definitions
+ *
+ * Copyright (c) 2007 Jocelyn Mayer
+ *
+ * SPDX-License-Identifier: MIT
+ */
+
+#ifndef HW_PCIHOST_PPC4XX_H
+#define HW_PCIHOST_PPC4XX_H
+
+#define TYPE_PPC4xx_HOST_BRIDGE "ppc4xx-host-bridge"
+#define TYPE_PPC4xx_PCI_HOST "ppc4xx-pci-host"
+#define TYPE_PPC440_PCIX_HOST "ppc440-pcix-host"
+#define TYPE_PPC460EX_PCIE_HOST "ppc460ex-pcie-host"
+
+#endif
include/hw/ppc/ppc4xx.h +0 -5
index ea7740239b..1bd9b8821b 100644
@@ -29,11 +29,6 @@
 #include "exec/memory.h"
 #include "hw/sysbus.h"
 
-#define TYPE_PPC4xx_HOST_BRIDGE "ppc4xx-host-bridge"
-#define TYPE_PPC4xx_PCI_HOST "ppc4xx-pci-host"
-#define TYPE_PPC440_PCIX_HOST "ppc440-pcix-host"
-#define TYPE_PPC460EX_PCIE_HOST "ppc460ex-pcie-host"
-
 /*
 * Generic DCR device
 */
hw/ppc/ppc440_bamboo.c +1 -0
index 45f409c838..2049ff0eef 100644
@@ -24,6 +24,7 @@
 #include "elf.h"
 #include "hw/char/serial.h"
 #include "hw/ppc/ppc.h"
+#include "hw/pci-host/ppc4xx.h"
 #include "ppc405.h"
 #include "sysemu/sysemu.h"
 #include "sysemu/reset.h"
hw/ppc/ppc440_pcix.c +1 -1
index e4dadbc84d..418dff6590 100644
@@ -25,7 +25,7 @@
 #include "qemu/module.h"
 #include "qemu/units.h"
 #include "hw/irq.h"
-#include "hw/ppc/ppc4xx.h"
+#include "hw/pci-host/ppc4xx.h"
 #include "hw/pci/pci_device.h"
 #include "hw/pci/pci_host.h"
 #include "trace.h"
hw/ppc/ppc440_uc.c +1 -0
index 643a79e330..3a66b0c7f7 100644
@@ -14,6 +14,7 @@
 #include "qemu/log.h"
 #include "hw/irq.h"
 #include "hw/ppc/ppc4xx.h"
+#include "hw/pci-host/ppc4xx.h"
 #include "hw/qdev-properties.h"
 #include "hw/pci/pci.h"
 #include "sysemu/reset.h"
hw/ppc/ppc4xx_pci.c +1 -1
index 51c265f0ba..d2434a93ac 100644
@@ -24,7 +24,7 @@
 #include "qemu/osdep.h"
 #include "qemu/log.h"
 #include "hw/irq.h"
-#include "hw/ppc/ppc4xx.h"
+#include "hw/pci-host/ppc4xx.h"
 #include "migration/vmstate.h"
 #include "qemu/module.h"
 #include "sysemu/reset.h"
hw/ppc/sam460ex.c +1 -0
index 1e615b8d35..a28498f39c 100644
@@ -25,6 +25,7 @@
 #include "elf.h"
 #include "exec/memory.h"
 #include "ppc440.h"
+#include "hw/pci-host/ppc4xx.h"
 #include "hw/block/flash.h"
 #include "sysemu/sysemu.h"
 #include "sysemu/reset.h"
#5 lore raw

PATCH 3/5 hw/ppc/ppc4xx_pci: Declare PPC4XX_PCI in Kconfig

In reply to Philippe Mathieu-Daudé
---
 hw/pci-host/Kconfig | 4 ++++
 hw/ppc/Kconfig      | 2 +-
 hw/ppc/meson.build  | 2 +-
 3 files changed, 6 insertions(+), 2 deletions(-)
hw/pci-host/Kconfig +4 -0
index a07070eddf..a9030a433b 100644
@@ -6,6 +6,10 @@ config XEN_IGD_PASSTHROUGH
     default y
     depends on XEN && PCI_I440FX
 
+config PPC4XX_PCI
+    bool
+    select PCI
+
 config RAVEN_PCI
     bool
     select PCI
hw/ppc/Kconfig +1 -1
index 5dfbf47ef5..e4e76e87a2 100644
@@ -53,7 +53,7 @@ config PPC440
 config PPC4XX
     bool
     select BITBANG_I2C
-    select PCI
+    select PPC4XX_PCI
     select PPC_UIC
 
 config SAM460EX
hw/ppc/meson.build +1 -1
index 7c2c52434a..6931ba88b4 100644
@@ -60,8 +60,8 @@ ppc_ss.add(when: 'CONFIG_PPC440', if_true: files(
   'ppc440_pcix.c', 'ppc440_uc.c'))
 ppc_ss.add(when: 'CONFIG_PPC4XX', if_true: files(
   'ppc4xx_devs.c',
-  'ppc4xx_pci.c',
   'ppc4xx_sdram.c'))
+ppc_ss.add(when: 'CONFIG_PPC4XX_PCI', if_true: files('ppc4xx_pci.c'))
 ppc_ss.add(when: 'CONFIG_SAM460EX', if_true: files('sam460ex.c'))
 # PReP
 ppc_ss.add(when: 'CONFIG_PREP', if_true: files('prep.c'))
Signature · 1 line
2.41.0
#6 lore raw

Re: [PATCH 3/5] hw/ppc/ppc4xx_pci: Declare PPC4XX_PCI in Kconfig

Quoted 1 line · Philippe Mathieu-Daudé

Should this be squashed with next patch? It looks strange to have config defined in hw/pci-host/Kconfig but used in hw/ppc/meson.build.

Regards,
BALATON Zoltan

Quoted 49 lines

---

hw/pci-host/Kconfig | 4 ++++
hw/ppc/Kconfig      | 2 +-
hw/ppc/meson.build  | 2 +-
3 files changed, 6 insertions(+), 2 deletions(-)
hw/pci-host/Kconfig +4 -0
index a07070eddf..a9030a433b 100644
@@ -6,6 +6,10 @@ config XEN_IGD_PASSTHROUGH
    default y
    depends on XEN && PCI_I440FX
 
+config PPC4XX_PCI
+    bool
+    select PCI
+

config RAVEN_PCI
bool
select PCI

hw/ppc/Kconfig +0 -0
index 5dfbf47ef5..e4e76e87a2 100644
@@ -53,7 +53,7 @@ config PPC440

config PPC4XX
bool
select BITBANG_I2C

hw/ppc/Kconfig +1 -1
-    select PCI
+    select PPC4XX_PCI
    select PPC_UIC

config SAM460EX

hw/ppc/meson.build +0 -0
index 7c2c52434a..6931ba88b4 100644
@@ -60,8 +60,8 @@ ppc_ss.add(when: 'CONFIG_PPC440', if_true: files(
  'ppc440_pcix.c', 'ppc440_uc.c'))

ppc_ss.add(when: 'CONFIG_PPC4XX', if_true: files(
'ppc4xx_devs.c',

hw/ppc/meson.build +1 -1
-  'ppc4xx_pci.c',
  'ppc4xx_sdram.c'))
+ppc_ss.add(when: 'CONFIG_PPC4XX_PCI', if_true: files('ppc4xx_pci.c'))

ppc_ss.add(when: 'CONFIG_SAM460EX', if_true: files('sam460ex.c')) # PReP
ppc_ss.add(when: 'CONFIG_PREP', if_true: files('prep.c'))

#7 lore raw

Re: [PATCH 3/5] hw/ppc/ppc4xx_pci: Declare PPC4XX_PCI in Kconfig

Quoted 4 lines · BALATON Zoltan
Quoted 1 line · Philippe Mathieu-Daudé

Should this be squashed with next patch? It looks strange to have config defined in hw/pci-host/Kconfig but used in hw/ppc/meson.build.

OK.

Quoted 2 lines

Regards,
BALATON Zoltan

#8 lore raw

PATCH 4/5 hw/ppc/ppc4xx_pci: Move ppc4xx_pci.c to hw/pci-host/

In reply to Philippe Mathieu-Daudé

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

---
 MAINTAINERS                       | 1 +
 hw/{ppc => pci-host}/ppc4xx_pci.c | 0
 hw/pci-host/ppce500.c             | 2 +-
 hw/pci-host/meson.build           | 1 +
 hw/pci-host/trace-events          | 4 ++++
 hw/ppc/meson.build                | 1 -
 hw/ppc/trace-events               | 4 ----
 7 files changed, 7 insertions(+), 6 deletions(-)
 rename hw/{ppc => pci-host}/ppc4xx_pci.c (100%)
MAINTAINERS +1 -0
index 158896d03e..d7af23c1be 100644
@@ -1358,6 +1358,7 @@ Bamboo
 L: [email protected]
 S: Orphan
 F: hw/ppc/ppc440_bamboo.c
+F: hw/pci-host/ppc4xx_pci.c
 F: tests/avocado/ppc_bamboo.py
 
 e500
hw/pci-host/ppc4xx_pci.c renamed from hw/ppc/ppc4xx_pci.c +0 -0
similarity index 100%
rename from hw/ppc/ppc4xx_pci.c
rename to hw/pci-host/ppc4xx_pci.c
hw/pci-host/ppce500.c +1 -1
index 38814247f2..c16bc255ed 100644
@@ -5,7 +5,7 @@
  *
  * Author: Yu Liu,     <[email protected]>
  *
- * This file is derived from hw/ppc4xx_pci.c,
+ * This file is derived from ppc4xx_pci.c,
  * the copyright for that material belongs to the original owners.
  *
  * This is free software; you can redistribute it and/or modify
hw/pci-host/meson.build +1 -0
index 64eada76fe..9cabac5d63 100644
@@ -14,6 +14,7 @@ pci_ss.add(when: 'CONFIG_REMOTE_PCIHOST', if_true: files('remote.c'))
 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_RAVEN_PCI', if_true: files('raven.c'))
 pci_ss.add(when: 'CONFIG_GRACKLE_PCI', if_true: files('grackle.c'))
 # NewWorld PowerMac
hw/pci-host/trace-events +4 -0
index 9d216bb89f..f8afb28a01 100644
@@ -37,6 +37,10 @@ unin_data_read(uint64_t addr, unsigned len, uint64_t val) "read addr 0x%"PRIx64
 unin_write(uint64_t addr, uint64_t value) "addr=0x%" PRIx64 " val=0x%"PRIx64
 unin_read(uint64_t addr, uint64_t value) "addr=0x%" PRIx64 " val=0x%"PRIx64
 
+# ppc4xx_pci.c
+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"
+
 # 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
hw/ppc/meson.build +0 -1
index 6931ba88b4..a4821da094 100644
@@ -61,7 +61,6 @@ ppc_ss.add(when: 'CONFIG_PPC440', if_true: files(
 ppc_ss.add(when: 'CONFIG_PPC4XX', if_true: files(
   'ppc4xx_devs.c',
   'ppc4xx_sdram.c'))
-ppc_ss.add(when: 'CONFIG_PPC4XX_PCI', if_true: files('ppc4xx_pci.c'))
 ppc_ss.add(when: 'CONFIG_SAM460EX', if_true: files('sam460ex.c'))
 # PReP
 ppc_ss.add(when: 'CONFIG_PREP', if_true: files('prep.c'))
hw/ppc/trace-events +0 -4
index f670e8906c..b59fbf340f 100644
@@ -146,10 +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"
 
-# ppc4xx_pci.c
-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"
Signature · 1 line
2.41.0
#9 lore raw

Re: [PATCH 4/5] hw/ppc/ppc4xx_pci: Move ppc4xx_pci.c to hw/pci-host/

Quoted 3 lines · Philippe Mathieu-Daudé

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

At this point I'm not sure. This device is only used for PPC machines so it's kind of target specific. Why do you want to compile it for other targets?

Regards,
BALATON Zoltan

Quoted 96 lines

---

MAINTAINERS                       | 1 +
hw/{ppc => pci-host}/ppc4xx_pci.c | 0
hw/pci-host/ppce500.c             | 2 +-
hw/pci-host/meson.build           | 1 +
hw/pci-host/trace-events          | 4 ++++
hw/ppc/meson.build                | 1 -
hw/ppc/trace-events               | 4 ----
7 files changed, 7 insertions(+), 6 deletions(-)

rename hw/{ppc => pci-host}/ppc4xx_pci.c (100%)

MAINTAINERS +0 -0
index 158896d03e..d7af23c1be 100644
@@ -1358,6 +1358,7 @@ Bamboo

L: [email protected]
S: Orphan
F: hw/ppc/ppc440_bamboo.c
+F: hw/pci-host/ppc4xx_pci.c
F: tests/avocado/ppc_bamboo.py

e500

hw/pci-host/ppc4xx_pci.c renamed from hw/ppc/ppc4xx_pci.c +0 -0
similarity index 100%
rename from hw/ppc/ppc4xx_pci.c
rename to hw/pci-host/ppc4xx_pci.c
hw/pci-host/ppce500.c +1 -1
index 38814247f2..c16bc255ed 100644
@@ -5,7 +5,7 @@
 *
 * Author: Yu Liu,     <[email protected]>
 *
- * This file is derived from hw/ppc4xx_pci.c,
+ * This file is derived from ppc4xx_pci.c,
 * the copyright for that material belongs to the original owners.
 *
 * This is free software; you can redistribute it and/or modify
hw/pci-host/meson.build +1 -0
index 64eada76fe..9cabac5d63 100644
@@ -14,6 +14,7 @@ pci_ss.add(when: 'CONFIG_REMOTE_PCIHOST', if_true: files('remote.c'))
 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_RAVEN_PCI', if_true: files('raven.c'))
 pci_ss.add(when: 'CONFIG_GRACKLE_PCI', if_true: files('grackle.c'))
 # NewWorld PowerMac
hw/pci-host/trace-events +0 -0
index 9d216bb89f..f8afb28a01 100644
@@ -37,6 +37,10 @@ unin_data_read(uint64_t addr, unsigned len, uint64_t val) "read addr 0x%"PRIx64

unin_write(uint64_t addr, uint64_t value) "addr=0x%" PRIx64 " val=0x%"PRIx64 unin_read(uint64_t addr, uint64_t value) "addr=0x%" PRIx64 " val=0x%"PRIx64

hw/pci-host/trace-events +4 -0
+# ppc4xx_pci.c
+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"
+
# 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
hw/ppc/meson.build +0 -0
index 6931ba88b4..a4821da094 100644
@@ -61,7 +61,6 @@ ppc_ss.add(when: 'CONFIG_PPC440', if_true: files(

ppc_ss.add(when: 'CONFIG_PPC4XX', if_true: files(
'ppc4xx_devs.c',
'ppc4xx_sdram.c'))
-ppc_ss.add(when: 'CONFIG_PPC4XX_PCI', if_true: files('ppc4xx_pci.c')) ppc_ss.add(when: 'CONFIG_SAM460EX', if_true: files('sam460ex.c')) # PReP
ppc_ss.add(when: 'CONFIG_PREP', if_true: files('prep.c'))

hw/ppc/trace-events +0 -0
index f670e8906c..b59fbf340f 100644
@@ -146,10 +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"

hw/ppc/trace-events +0 -4
-# ppc4xx_pci.c
-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"
#10 lore raw

Re: [PATCH 4/5] hw/ppc/ppc4xx_pci: Move ppc4xx_pci.c to hw/pci-host/

Quoted 6 lines · BALATON Zoltan
Quoted 3 lines · Philippe Mathieu-Daudé

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

At this point I'm not sure. This device is only used for PPC machines so it's kind of target specific. Why do you want to compile it for other targets?

This way the object code can be shared between qemu-system-ppc64 and qemu-system-ppc. I.e. we only have to compile it once instead of twice.

Thomas

#11 lore raw

PATCH 5/5 hw/ppc/ppc440_pcix: Move ppc440_pcix.c to hw/pci-host/

In reply to Philippe Mathieu-Daudé

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.

---
 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%)
MAINTAINERS +1 -1
index d7af23c1be..d727eab16b 100644
@@ -1484,7 +1484,7 @@ L: [email protected]
 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
hw/pci-host/ppc440_pcix.c renamed from hw/ppc/ppc440_pcix.c +0 -0
similarity index 100%
rename from hw/ppc/ppc440_pcix.c
rename to hw/pci-host/ppc440_pcix.c
hw/pci-host/Kconfig +4 -0
index a9030a433b..19b25b2092 100644
@@ -10,6 +10,10 @@ config PPC4XX_PCI
     bool
     select PCI
 
+config PPC440_PCI
+    bool
+    select PCI
+
 config RAVEN_PCI
     bool
     select PCI
hw/pci-host/meson.build +1 -0
index 9cabac5d63..d724656f70 100644
@@ -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
hw/pci-host/trace-events +8 -0
index f8afb28a01..c902f1cde6 100644
@@ -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
hw/ppc/Kconfig +1 -0
index e4e76e87a2..fc26c775ab 100644
@@ -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
hw/ppc/meson.build +1 -1
index a4821da094..09dfdafe79 100644
@@ -57,7 +57,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'))
hw/ppc/trace-events +0 -8
index b59fbf340f..157ea756e9 100644
@@ -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
Signature · 1 line
2.41.0