All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [RFC PATCH 00/29] remove i386/pc dependency: generic SuperIO, PIIX cleanup
@ 2018-01-08  2:45 Philippe Mathieu-Daudé
  2018-01-08  2:45 ` [Qemu-devel] [PATCH 01/29] hw/acpi: add mem/nvdimm.h dependency Philippe Mathieu-Daudé
                   ` (28 more replies)
  0 siblings, 29 replies; 32+ messages in thread
From: Philippe Mathieu-Daudé @ 2018-01-08  2:45 UTC (permalink / raw)
  To: Paolo Bonzini, Michael S. Tsirkin, Hervé Poussineau,
	Aurelien Jarno, Eduardo Habkost, Marcel Apfelbaum
  Cc: Philippe Mathieu-Daudé, qemu-devel, Igor Mammedov

Hi,

This series could be the 'part 2' of my previous "remove i386/pc dependency
from non-PC world" I started around 2.9.

As Hervé sent a PIIX4 series [1], I awoke this old branch to reduce duplicated
effort and added Hervé patches.

Hervé: what is missing from your series is the 'user_creatable' part, I'll
fix this when I find more spare time.

Regards,

Phil.

[1]: http://lists.nongnu.org/archive/html/qemu-devel/2018-01/msg01028.html

Hervé Poussineau (8):
  mc146818rtc: always register rtc to rtc list
  piix4: rename some variables in realize function
  piix4: convert reset function to QOM
  piix4: add Reset Control Register
  piix4: add a i8259 interrupt controller as specified in datasheet
  piix4: add a i8257 dma controller as specified in datasheet
  piix4: add a i8254 pit controller as specified in datasheet
  piix4: add a speaker as specified in datasheet

Philippe Mathieu-Daudé (21):
  hw/acpi: add mem/nvdimm.h dependency
  pci/pci_host: move generic definitions out of i386/pc.h
  hw/isa: extract parallel-isa specific code
  hw/dma/i8257: rename DMA_init() to i8257_dma_init()
  hw/input/i8042: extract declarations from i386/pc.h into input/i8042.h
  hw/isa: add a generic isa_superio_init()
  hw/i386/pc: use isa_superio_init()
  hw/mips/fulong2e: use isa_superio_init()
  hw/mips/malta: code movement
  hw/mips/malta: add fdc37m81x_init() which uses isa_superio_init()
  Revert "irq: introduce qemu_irq_proxy()"
  piix: move piix4 declaration into new southbridge/i82371_piix.h
  piix: move southbridge related declarations/definitions to i82371_piix.h
  piix3: extract piix3_init() from i440fx_init()
  hw/i386: extract i440fx related declarations/definitions to i440fx.h
  hw/i386: extract i440fx code from piix.c into i440fx.c
  hw/i386: move piix from hw/pci-host to hw/southbridge
  configs/mips-softmmu: use common CONFIG_PCI_PIIX instead of CONFIG_PIIX4
  piix3: convert reset function to QOM
  piix: merge common code from isa/piix4.c with southbridge piix3
  piix4: add isa_superio_init

 default-configs/i386-softmmu.mak        |   1 +
 default-configs/mips-softmmu-common.mak |   2 +-
 default-configs/x86_64-softmmu.mak      |   1 +
 include/hw/acpi/piix4.h                 |   6 -
 include/hw/char/parallel.h              |  14 +
 include/hw/{isa => dma}/i8257.h         |   6 +
 include/hw/i386/pc.h                    |  63 ----
 include/hw/input/i8042.h                |  25 ++
 include/hw/irq.h                        |   5 -
 include/hw/isa/isa.h                    |   2 -
 include/hw/isa/superio.h                |  17 +
 include/hw/pci-host/i440fx.h            |  51 +++
 include/hw/pci/pci_host.h               |   8 +
 include/hw/southbridge/i82371_piix.h    |  38 +++
 hw/acpi/ich9.c                          |   1 +
 hw/acpi/pcihp.c                         |   2 +-
 hw/acpi/piix4.c                         |   3 +-
 hw/alpha/dp264.c                        |   3 +-
 hw/char/parallel-isa.c                  |  29 ++
 hw/char/parallel.c                      |   2 +-
 hw/core/irq.c                           |  14 -
 hw/dma/i82374.c                         |   3 +-
 hw/dma/i8257.c                          |   4 +-
 hw/i386/acpi-build.c                    |   2 +-
 hw/i386/pc.c                            |  22 +-
 hw/i386/pc_piix.c                       |   2 +
 hw/i386/vmmouse.c                       |   1 +
 hw/i386/vmport.c                        |   1 +
 hw/input/pckbd.c                        |   2 +-
 hw/isa/isa-bus.c                        |  26 --
 hw/isa/isa-superio.c                    |  45 +++
 hw/isa/piix4.c                          | 146 --------
 hw/mips/gt64xxx_pci.c                   |   1 +
 hw/mips/mips_fulong2e.c                 |  12 +-
 hw/mips/mips_jazz.c                     |   5 +-
 hw/mips/mips_malta.c                    |  71 ++--
 hw/mips/mips_r4k.c                      |   3 +-
 hw/pci-host/{piix.c => i440fx.c}        | 409 +---------------------
 hw/ppc/prep.c                           |   5 +-
 hw/southbridge/piix.c                   | 586 ++++++++++++++++++++++++++++++++
 hw/sparc/sun4m.c                        |   4 -
 hw/sparc64/sun4u.c                      |   8 +-
 hw/timer/mc146818rtc.c                  |   6 +-
 hw/unicore32/puv3.c                     |   1 +
 stubs/pci-host-piix.c                   |   3 +-
 MAINTAINERS                             |  14 +-
 hw/Makefile.objs                        |   1 +
 hw/char/Makefile.objs                   |   1 +
 hw/isa/Makefile.objs                    |   2 +-
 hw/pci-host/Makefile.objs               |   2 +-
 hw/southbridge/Makefile.objs            |   1 +
 51 files changed, 923 insertions(+), 759 deletions(-)
 delete mode 100644 include/hw/acpi/piix4.h
 create mode 100644 include/hw/char/parallel.h
 rename include/hw/{isa => dma}/i8257.h (86%)
 create mode 100644 include/hw/input/i8042.h
 create mode 100644 include/hw/isa/superio.h
 create mode 100644 include/hw/pci-host/i440fx.h
 create mode 100644 include/hw/southbridge/i82371_piix.h
 create mode 100644 hw/char/parallel-isa.c
 create mode 100644 hw/isa/isa-superio.c
 delete mode 100644 hw/isa/piix4.c
 rename hw/pci-host/{piix.c => i440fx.c} (59%)
 create mode 100644 hw/southbridge/piix.c
 create mode 100644 hw/southbridge/Makefile.objs

-- 
2.15.1

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

* [Qemu-devel] [PATCH 01/29] hw/acpi: add mem/nvdimm.h dependency
  2018-01-08  2:45 [Qemu-devel] [RFC PATCH 00/29] remove i386/pc dependency: generic SuperIO, PIIX cleanup Philippe Mathieu-Daudé
@ 2018-01-08  2:45 ` Philippe Mathieu-Daudé
  2018-01-08  2:45 ` [Qemu-devel] [PATCH 02/29] pci/pci_host: move generic definitions out of i386/pc.h Philippe Mathieu-Daudé
                   ` (27 subsequent siblings)
  28 siblings, 0 replies; 32+ messages in thread
From: Philippe Mathieu-Daudé @ 2018-01-08  2:45 UTC (permalink / raw)
  To: Paolo Bonzini, Michael S. Tsirkin, Keith Busch
  Cc: Philippe Mathieu-Daudé, qemu-devel, Igor Mammedov

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 hw/acpi/ich9.c  | 1 +
 hw/acpi/piix4.c | 1 +
 2 files changed, 2 insertions(+)

diff --git a/hw/acpi/ich9.c b/hw/acpi/ich9.c
index c5d8646abc..26aa87fa1a 100644
--- a/hw/acpi/ich9.c
+++ b/hw/acpi/ich9.c
@@ -37,6 +37,7 @@
 
 #include "hw/i386/ich9.h"
 #include "hw/mem/pc-dimm.h"
+#include "hw/mem/nvdimm.h"
 
 //#define DEBUG
 
diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c
index a0fb1ce037..32caa4f0fc 100644
--- a/hw/acpi/piix4.c
+++ b/hw/acpi/piix4.c
@@ -37,6 +37,7 @@
 #include "hw/acpi/cpu.h"
 #include "hw/hotplug.h"
 #include "hw/mem/pc-dimm.h"
+#include "hw/mem/nvdimm.h"
 #include "hw/acpi/memory_hotplug.h"
 #include "hw/acpi/acpi_dev_interface.h"
 #include "hw/xen/xen.h"
-- 
2.15.1

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

* [Qemu-devel] [PATCH 02/29] pci/pci_host: move generic definitions out of i386/pc.h
  2018-01-08  2:45 [Qemu-devel] [RFC PATCH 00/29] remove i386/pc dependency: generic SuperIO, PIIX cleanup Philippe Mathieu-Daudé
  2018-01-08  2:45 ` [Qemu-devel] [PATCH 01/29] hw/acpi: add mem/nvdimm.h dependency Philippe Mathieu-Daudé
@ 2018-01-08  2:45 ` Philippe Mathieu-Daudé
  2018-01-08  2:45 ` [Qemu-devel] [PATCH 03/29] hw/isa: extract parallel-isa specific code Philippe Mathieu-Daudé
                   ` (26 subsequent siblings)
  28 siblings, 0 replies; 32+ messages in thread
From: Philippe Mathieu-Daudé @ 2018-01-08  2:45 UTC (permalink / raw)
  To: Paolo Bonzini, Michael S. Tsirkin, Hervé Poussineau,
	Aurelien Jarno, Eduardo Habkost, Marcel Apfelbaum
  Cc: Philippe Mathieu-Daudé, qemu-devel, Igor Mammedov

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 include/hw/i386/pc.h      | 9 ---------
 include/hw/pci/pci_host.h | 8 ++++++++
 2 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index 6f77eb0665..780fa049d7 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -218,15 +218,6 @@ void pc_acpi_init(const char *default_dsdt);
 
 void pc_guest_info_init(PCMachineState *pcms);
 
-#define PCI_HOST_PROP_PCI_HOLE_START   "pci-hole-start"
-#define PCI_HOST_PROP_PCI_HOLE_END     "pci-hole-end"
-#define PCI_HOST_PROP_PCI_HOLE64_START "pci-hole64-start"
-#define PCI_HOST_PROP_PCI_HOLE64_END   "pci-hole64-end"
-#define PCI_HOST_PROP_PCI_HOLE64_SIZE  "pci-hole64-size"
-#define PCI_HOST_BELOW_4G_MEM_SIZE     "below-4g-mem-size"
-#define PCI_HOST_ABOVE_4G_MEM_SIZE     "above-4g-mem-size"
-
-
 void pc_pci_as_mapping_init(Object *owner, MemoryRegion *system_memory,
                             MemoryRegion *pci_address_space);
 
diff --git a/include/hw/pci/pci_host.h b/include/hw/pci/pci_host.h
index ba31595fc7..5239adf7e6 100644
--- a/include/hw/pci/pci_host.h
+++ b/include/hw/pci/pci_host.h
@@ -56,6 +56,14 @@ typedef struct PCIHostBridgeClass {
     const char *(*root_bus_path)(PCIHostState *, PCIBus *);
 } PCIHostBridgeClass;
 
+#define PCI_HOST_PROP_PCI_HOLE_START   "pci-hole-start"
+#define PCI_HOST_PROP_PCI_HOLE_END     "pci-hole-end"
+#define PCI_HOST_PROP_PCI_HOLE64_START "pci-hole64-start"
+#define PCI_HOST_PROP_PCI_HOLE64_END   "pci-hole64-end"
+#define PCI_HOST_PROP_PCI_HOLE64_SIZE  "pci-hole64-size"
+#define PCI_HOST_BELOW_4G_MEM_SIZE     "below-4g-mem-size"
+#define PCI_HOST_ABOVE_4G_MEM_SIZE     "above-4g-mem-size"
+
 /* common internal helpers for PCI/PCIe hosts, cut off overflows */
 void pci_host_config_write_common(PCIDevice *pci_dev, uint32_t addr,
                                   uint32_t limit, uint32_t val, uint32_t len);
-- 
2.15.1

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

* [Qemu-devel] [PATCH 03/29] hw/isa: extract parallel-isa specific code
  2018-01-08  2:45 [Qemu-devel] [RFC PATCH 00/29] remove i386/pc dependency: generic SuperIO, PIIX cleanup Philippe Mathieu-Daudé
  2018-01-08  2:45 ` [Qemu-devel] [PATCH 01/29] hw/acpi: add mem/nvdimm.h dependency Philippe Mathieu-Daudé
  2018-01-08  2:45 ` [Qemu-devel] [PATCH 02/29] pci/pci_host: move generic definitions out of i386/pc.h Philippe Mathieu-Daudé
@ 2018-01-08  2:45 ` Philippe Mathieu-Daudé
  2018-01-08  2:45 ` [Qemu-devel] [PATCH 04/29] hw/dma/i8257: rename DMA_init() to i8257_dma_init() Philippe Mathieu-Daudé
                   ` (25 subsequent siblings)
  28 siblings, 0 replies; 32+ messages in thread
From: Philippe Mathieu-Daudé @ 2018-01-08  2:45 UTC (permalink / raw)
  To: Paolo Bonzini, Michael S. Tsirkin, Hervé Poussineau,
	Aurelien Jarno, Eduardo Habkost, Marcel Apfelbaum
  Cc: Philippe Mathieu-Daudé,
	qemu-devel, Igor Mammedov, Richard Henderson, Yongbok Kim,
	Mark Cave-Ayland, Artyom Tarasenko

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 include/hw/char/parallel.h | 14 ++++++++++++++
 include/hw/i386/pc.h       |  8 --------
 hw/char/parallel-isa.c     | 29 +++++++++++++++++++++++++++++
 hw/char/parallel.c         |  2 +-
 hw/i386/pc.c               |  1 +
 hw/isa/isa-bus.c           | 26 --------------------------
 hw/mips/mips_fulong2e.c    |  1 +
 hw/mips/mips_jazz.c        |  1 +
 hw/mips/mips_malta.c       |  1 +
 hw/sparc64/sun4u.c         |  1 +
 MAINTAINERS                |  3 ++-
 hw/char/Makefile.objs      |  1 +
 12 files changed, 52 insertions(+), 36 deletions(-)
 create mode 100644 include/hw/char/parallel.h
 create mode 100644 hw/char/parallel-isa.c

diff --git a/include/hw/char/parallel.h b/include/hw/char/parallel.h
new file mode 100644
index 0000000000..d6dd62fb9f
--- /dev/null
+++ b/include/hw/char/parallel.h
@@ -0,0 +1,14 @@
+#ifndef HW_PARALLEL_H
+#define HW_PARALLEL_H
+
+#include "exec/memory.h"
+#include "hw/isa/isa.h"
+#include "chardev/char.h"
+
+void parallel_hds_isa_init(ISABus *bus, int n);
+
+bool parallel_mm_init(MemoryRegion *address_space,
+                      hwaddr base, int it_shift, qemu_irq irq,
+                      Chardev *chr);
+
+#endif
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index 780fa049d7..87a377011b 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -151,14 +151,6 @@ struct PCMachineClass {
 #define PC_MACHINE_CLASS(klass) \
     OBJECT_CLASS_CHECK(PCMachineClass, (klass), TYPE_PC_MACHINE)
 
-/* parallel.c */
-
-void parallel_hds_isa_init(ISABus *bus, int n);
-
-bool parallel_mm_init(MemoryRegion *address_space,
-                      hwaddr base, int it_shift, qemu_irq irq,
-                      Chardev *chr);
-
 /* i8259.c */
 
 extern DeviceState *isa_pic;
diff --git a/hw/char/parallel-isa.c b/hw/char/parallel-isa.c
new file mode 100644
index 0000000000..906a55a07d
--- /dev/null
+++ b/hw/char/parallel-isa.c
@@ -0,0 +1,29 @@
+#include "qemu/osdep.h"
+#include "sysemu/sysemu.h"
+#include "hw/isa/isa.h"
+#include "hw/char/parallel.h"
+
+static void parallel_init(ISABus *bus, int index, Chardev *chr)
+{
+    DeviceState *dev;
+    ISADevice *isadev;
+
+    isadev = isa_create(bus, "isa-parallel");
+    dev = DEVICE(isadev);
+    qdev_prop_set_uint32(dev, "index", index);
+    qdev_prop_set_chr(dev, "chardev", chr);
+    qdev_init_nofail(dev);
+}
+
+void parallel_hds_isa_init(ISABus *bus, int n)
+{
+    int i;
+
+    assert(n <= MAX_PARALLEL_PORTS);
+
+    for (i = 0; i < n; i++) {
+        if (parallel_hds[i]) {
+            parallel_init(bus, i, parallel_hds[i]);
+        }
+    }
+}
diff --git a/hw/char/parallel.c b/hw/char/parallel.c
index f79dc76543..1542d62201 100644
--- a/hw/char/parallel.c
+++ b/hw/char/parallel.c
@@ -28,7 +28,7 @@
 #include "chardev/char-parallel.h"
 #include "chardev/char-fe.h"
 #include "hw/isa/isa.h"
-#include "hw/i386/pc.h"
+#include "hw/char/parallel.h"
 #include "sysemu/sysemu.h"
 
 //#define DEBUG_PARALLEL
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 3fcf318a95..6d3b2a8d1c 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -25,6 +25,7 @@
 #include "hw/hw.h"
 #include "hw/i386/pc.h"
 #include "hw/char/serial.h"
+#include "hw/char/parallel.h"
 #include "hw/i386/apic.h"
 #include "hw/i386/topology.h"
 #include "sysemu/cpus.h"
diff --git a/hw/isa/isa-bus.c b/hw/isa/isa-bus.c
index 348e0eab9d..0f732b5b58 100644
--- a/hw/isa/isa-bus.c
+++ b/hw/isa/isa-bus.c
@@ -23,7 +23,6 @@
 #include "hw/sysbus.h"
 #include "sysemu/sysemu.h"
 #include "hw/isa/isa.h"
-#include "hw/i386/pc.h"
 
 static ISABus *isabus;
 
@@ -287,28 +286,3 @@ MemoryRegion *isa_address_space_io(ISADevice *dev)
 }
 
 type_init(isabus_register_types)
-
-static void parallel_init(ISABus *bus, int index, Chardev *chr)
-{
-    DeviceState *dev;
-    ISADevice *isadev;
-
-    isadev = isa_create(bus, "isa-parallel");
-    dev = DEVICE(isadev);
-    qdev_prop_set_uint32(dev, "index", index);
-    qdev_prop_set_chr(dev, "chardev", chr);
-    qdev_init_nofail(dev);
-}
-
-void parallel_hds_isa_init(ISABus *bus, int n)
-{
-    int i;
-
-    assert(n <= MAX_PARALLEL_PORTS);
-
-    for (i = 0; i < n; i++) {
-        if (parallel_hds[i]) {
-            parallel_init(bus, i, parallel_hds[i]);
-        }
-    }
-}
diff --git a/hw/mips/mips_fulong2e.c b/hw/mips/mips_fulong2e.c
index 725e25a134..d3c3a6ab61 100644
--- a/hw/mips/mips_fulong2e.c
+++ b/hw/mips/mips_fulong2e.c
@@ -23,6 +23,7 @@
 #include "hw/hw.h"
 #include "hw/i386/pc.h"
 #include "hw/char/serial.h"
+#include "hw/char/parallel.h"
 #include "hw/block/fdc.h"
 #include "net/net.h"
 #include "hw/boards.h"
diff --git a/hw/mips/mips_jazz.c b/hw/mips/mips_jazz.c
index 0d2c0683ba..afb33beffd 100644
--- a/hw/mips/mips_jazz.c
+++ b/hw/mips/mips_jazz.c
@@ -28,6 +28,7 @@
 #include "hw/mips/cpudevs.h"
 #include "hw/i386/pc.h"
 #include "hw/char/serial.h"
+#include "hw/char/parallel.h"
 #include "hw/isa/isa.h"
 #include "hw/block/fdc.h"
 #include "sysemu/sysemu.h"
diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c
index 37f19428d6..95d22288f4 100644
--- a/hw/mips/mips_malta.c
+++ b/hw/mips/mips_malta.c
@@ -28,6 +28,7 @@
 #include "hw/hw.h"
 #include "hw/i386/pc.h"
 #include "hw/char/serial.h"
+#include "hw/char/parallel.h"
 #include "hw/block/fdc.h"
 #include "net/net.h"
 #include "hw/boards.h"
diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c
index 1672f256e7..8bbc210fc8 100644
--- a/hw/sparc64/sun4u.c
+++ b/hw/sparc64/sun4u.c
@@ -31,6 +31,7 @@
 #include "hw/pci-host/apb.h"
 #include "hw/i386/pc.h"
 #include "hw/char/serial.h"
+#include "hw/char/parallel.h"
 #include "hw/timer/m48t59.h"
 #include "hw/block/fdc.h"
 #include "net/net.h"
diff --git a/MAINTAINERS b/MAINTAINERS
index 73a5555735..f11c0386e9 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -867,7 +867,7 @@ M: Michael S. Tsirkin <mst@redhat.com>
 M: Paolo Bonzini <pbonzini@redhat.com>
 S: Supported
 F: hw/char/debugcon.c
-F: hw/char/parallel.c
+F: hw/char/parallel*
 F: hw/char/serial*
 F: hw/dma/i8257*
 F: hw/i2c/pm_smbus.c
@@ -882,6 +882,7 @@ F: hw/timer/i8254*
 F: hw/timer/mc146818rtc*
 F: hw/watchdog/wdt_ib700.c
 F: include/hw/display/vga.h
+F: include/hw/char/parallel.h
 F: include/hw/i2c/pm_smbus.h
 F: include/hw/isa/i8257.h
 F: include/hw/timer/hpet.h
diff --git a/hw/char/Makefile.objs b/hw/char/Makefile.objs
index 1bcd37e98d..1b979100b7 100644
--- a/hw/char/Makefile.objs
+++ b/hw/char/Makefile.objs
@@ -1,6 +1,7 @@
 common-obj-$(CONFIG_IPACK) += ipoctal232.o
 common-obj-$(CONFIG_ESCC) += escc.o
 common-obj-$(CONFIG_PARALLEL) += parallel.o
+common-obj-$(CONFIG_PARALLEL) += parallel-isa.o
 common-obj-$(CONFIG_PL011) += pl011.o
 common-obj-$(CONFIG_SERIAL) += serial.o
 common-obj-$(CONFIG_SERIAL_ISA) += serial-isa.o
-- 
2.15.1

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

* [Qemu-devel] [PATCH 04/29] hw/dma/i8257: rename DMA_init() to i8257_dma_init()
  2018-01-08  2:45 [Qemu-devel] [RFC PATCH 00/29] remove i386/pc dependency: generic SuperIO, PIIX cleanup Philippe Mathieu-Daudé
                   ` (2 preceding siblings ...)
  2018-01-08  2:45 ` [Qemu-devel] [PATCH 03/29] hw/isa: extract parallel-isa specific code Philippe Mathieu-Daudé
@ 2018-01-08  2:45 ` Philippe Mathieu-Daudé
  2018-01-08  2:45 ` [Qemu-devel] [PATCH 05/29] hw/input/i8042: extract declarations from i386/pc.h into input/i8042.h Philippe Mathieu-Daudé
                   ` (24 subsequent siblings)
  28 siblings, 0 replies; 32+ messages in thread
From: Philippe Mathieu-Daudé @ 2018-01-08  2:45 UTC (permalink / raw)
  To: Paolo Bonzini, Michael S. Tsirkin, Hervé Poussineau,
	Aurelien Jarno, Eduardo Habkost, Marcel Apfelbaum
  Cc: Philippe Mathieu-Daudé,
	qemu-devel, Igor Mammedov, Richard Henderson, Yongbok Kim,
	Mark Cave-Ayland, Artyom Tarasenko, open list:PReP

- move the header from hw/isa/ to hw/dma/
- remove the old i386/pc dependency

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 include/hw/{isa => dma}/i8257.h | 6 ++++++
 include/hw/isa/isa.h            | 2 --
 hw/dma/i82374.c                 | 3 ++-
 hw/dma/i8257.c                  | 4 ++--
 hw/i386/pc.c                    | 3 ++-
 hw/mips/mips_fulong2e.c         | 3 ++-
 hw/mips/mips_jazz.c             | 3 ++-
 hw/mips/mips_malta.c            | 3 ++-
 hw/sparc/sun4m.c                | 4 ----
 hw/sparc64/sun4u.c              | 4 ----
 MAINTAINERS                     | 2 +-
 11 files changed, 19 insertions(+), 18 deletions(-)
 rename include/hw/{isa => dma}/i8257.h (86%)

diff --git a/include/hw/isa/i8257.h b/include/hw/dma/i8257.h
similarity index 86%
rename from include/hw/isa/i8257.h
rename to include/hw/dma/i8257.h
index 88a2766a3f..0041565177 100644
--- a/include/hw/isa/i8257.h
+++ b/include/hw/dma/i8257.h
@@ -1,6 +1,10 @@
 #ifndef HW_I8257_H
 #define HW_I8257_H
 
+#include "hw/hw.h"
+#include "hw/isa/isa.h"
+#include "exec/ioport.h"
+
 #define TYPE_I8257 "i8257"
 
 typedef struct I8257Regs {
@@ -40,4 +44,6 @@ typedef struct I8257State {
     PortioList portio_pageh;
 } I8257State;
 
+void i8257_dma_init(ISABus *bus, int high_page_enable);
+
 #endif
diff --git a/include/hw/isa/isa.h b/include/hw/isa/isa.h
index 95593408ef..b9dbab24b4 100644
--- a/include/hw/isa/isa.h
+++ b/include/hw/isa/isa.h
@@ -151,6 +151,4 @@ static inline ISABus *isa_bus_from_device(ISADevice *d)
     return ISA_BUS(qdev_get_parent_bus(DEVICE(d)));
 }
 
-/* i8257.c */
-void DMA_init(ISABus *bus, int high_page_enable);
 #endif
diff --git a/hw/dma/i82374.c b/hw/dma/i82374.c
index 6c0f975df0..0b8a6f4a80 100644
--- a/hw/dma/i82374.c
+++ b/hw/dma/i82374.c
@@ -24,6 +24,7 @@
 
 #include "qemu/osdep.h"
 #include "hw/isa/isa.h"
+#include "hw/dma/i8257.h"
 
 #define TYPE_I82374 "i82374"
 #define I82374(obj) OBJECT_CHECK(I82374State, (obj), TYPE_I82374)
@@ -123,7 +124,7 @@ static void i82374_realize(DeviceState *dev, Error **errp)
     portio_list_add(&s->port_list, isa_address_space_io(&s->parent_obj),
                     s->iobase);
 
-    DMA_init(isa_bus_from_device(ISA_DEVICE(dev)), 1);
+    i8257_dma_init(isa_bus_from_device(ISA_DEVICE(dev)), 1);
     memset(s->commands, 0, sizeof(s->commands));
 }
 
diff --git a/hw/dma/i8257.c b/hw/dma/i8257.c
index bd23e893bf..07bfbdb618 100644
--- a/hw/dma/i8257.c
+++ b/hw/dma/i8257.c
@@ -24,7 +24,7 @@
 #include "qemu/osdep.h"
 #include "hw/hw.h"
 #include "hw/isa/isa.h"
-#include "hw/isa/i8257.h"
+#include "hw/dma/i8257.h"
 #include "qemu/main-loop.h"
 #include "trace.h"
 
@@ -622,7 +622,7 @@ static void i8257_register_types(void)
 
 type_init(i8257_register_types)
 
-void DMA_init(ISABus *bus, int high_page_enable)
+void i8257_dma_init(ISABus *bus, int high_page_enable)
 {
     ISADevice *isa1, *isa2;
     DeviceState *d;
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 6d3b2a8d1c..e39af3d48c 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -40,6 +40,7 @@
 #include "elf.h"
 #include "multiboot.h"
 #include "hw/timer/mc146818rtc.h"
+#include "hw/dma/i8257.h"
 #include "hw/timer/i8254.h"
 #include "hw/audio/pcspk.h"
 #include "hw/pci/msi.h"
@@ -1605,7 +1606,7 @@ void pc_basic_device_init(ISABus *isa_bus, qemu_irq *gsi,
     port92_init(port92, a20_line[1]);
     g_free(a20_line);
 
-    DMA_init(isa_bus, 0);
+    i8257_dma_init(isa_bus, 0);
 
     for(i = 0; i < MAX_FD; i++) {
         fd[i] = drive_get(IF_FLOPPY, 0, i);
diff --git a/hw/mips/mips_fulong2e.c b/hw/mips/mips_fulong2e.c
index d3c3a6ab61..cbe159034d 100644
--- a/hw/mips/mips_fulong2e.c
+++ b/hw/mips/mips_fulong2e.c
@@ -22,6 +22,7 @@
 #include "qapi/error.h"
 #include "hw/hw.h"
 #include "hw/i386/pc.h"
+#include "hw/dma/i8257.h"
 #include "hw/char/serial.h"
 #include "hw/char/parallel.h"
 #include "hw/block/fdc.h"
@@ -361,7 +362,7 @@ static void mips_fulong2e_init(MachineState *machine)
 
     /* init other devices */
     pit = i8254_pit_init(isa_bus, 0x40, 0, NULL);
-    DMA_init(isa_bus, 0);
+    i8257_dma_init(isa_bus, 0);
 
     /* Super I/O */
     isa_create_simple(isa_bus, "i8042");
diff --git a/hw/mips/mips_jazz.c b/hw/mips/mips_jazz.c
index afb33beffd..6ed4b83f40 100644
--- a/hw/mips/mips_jazz.c
+++ b/hw/mips/mips_jazz.c
@@ -27,6 +27,7 @@
 #include "hw/mips/mips.h"
 #include "hw/mips/cpudevs.h"
 #include "hw/i386/pc.h"
+#include "hw/dma/i8257.h"
 #include "hw/char/serial.h"
 #include "hw/char/parallel.h"
 #include "hw/isa/isa.h"
@@ -219,7 +220,7 @@ static void mips_jazz_init(MachineState *machine,
     /* ISA devices */
     i8259 = i8259_init(isa_bus, env->irq[4]);
     isa_bus_irqs(isa_bus, i8259);
-    DMA_init(isa_bus, 0);
+    i8257_dma_init(isa_bus, 0);
     pit = i8254_pit_init(isa_bus, 0x40, 0, NULL);
     pcspk_init(isa_bus, pit);
 
diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c
index 95d22288f4..0a9e3dedf4 100644
--- a/hw/mips/mips_malta.c
+++ b/hw/mips/mips_malta.c
@@ -27,6 +27,7 @@
 #include "cpu.h"
 #include "hw/hw.h"
 #include "hw/i386/pc.h"
+#include "hw/dma/i8257.h"
 #include "hw/char/serial.h"
 #include "hw/char/parallel.h"
 #include "hw/block/fdc.h"
@@ -1210,7 +1211,7 @@ void mips_malta_init(MachineState *machine)
     smbus_eeprom_init(smbus, 8, smbus_eeprom_buf, smbus_eeprom_size);
     g_free(smbus_eeprom_buf);
     pit = i8254_pit_init(isa_bus, 0x40, 0, NULL);
-    DMA_init(isa_bus, 0);
+    i8257_dma_init(isa_bus, 0);
 
     /* Super I/O */
     isa_create_simple(isa_bus, "i8042");
diff --git a/hw/sparc/sun4m.c b/hw/sparc/sun4m.c
index e71648404c..2ed28c4d25 100644
--- a/hw/sparc/sun4m.c
+++ b/hw/sparc/sun4m.c
@@ -99,10 +99,6 @@ struct sun4m_hwdef {
     uint8_t nvram_machine_id;
 };
 
-void DMA_init(ISABus *bus, int high_page_enable)
-{
-}
-
 static void fw_cfg_boot_set(void *opaque, const char *boot_device,
                             Error **errp)
 {
diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c
index 8bbc210fc8..135f8088ca 100644
--- a/hw/sparc64/sun4u.c
+++ b/hw/sparc64/sun4u.c
@@ -87,10 +87,6 @@ typedef struct EbusState {
     MemoryRegion bar1;
 } EbusState;
 
-void DMA_init(ISABus *bus, int high_page_enable)
-{
-}
-
 static void fw_cfg_boot_set(void *opaque, const char *boot_device,
                             Error **errp)
 {
diff --git a/MAINTAINERS b/MAINTAINERS
index f11c0386e9..89810df375 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -883,8 +883,8 @@ F: hw/timer/mc146818rtc*
 F: hw/watchdog/wdt_ib700.c
 F: include/hw/display/vga.h
 F: include/hw/char/parallel.h
+F: include/hw/dma/i8257.h
 F: include/hw/i2c/pm_smbus.h
-F: include/hw/isa/i8257.h
 F: include/hw/timer/hpet.h
 F: include/hw/timer/i8254*
 F: include/hw/timer/mc146818rtc*
-- 
2.15.1

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

* [Qemu-devel] [PATCH 05/29] hw/input/i8042: extract declarations from i386/pc.h into input/i8042.h
  2018-01-08  2:45 [Qemu-devel] [RFC PATCH 00/29] remove i386/pc dependency: generic SuperIO, PIIX cleanup Philippe Mathieu-Daudé
                   ` (3 preceding siblings ...)
  2018-01-08  2:45 ` [Qemu-devel] [PATCH 04/29] hw/dma/i8257: rename DMA_init() to i8257_dma_init() Philippe Mathieu-Daudé
@ 2018-01-08  2:45 ` Philippe Mathieu-Daudé
  2018-01-08  2:54   ` David Gibson
  2018-01-08  2:45 ` [Qemu-devel] [PATCH 06/29] hw/isa: add a generic isa_superio_init() Philippe Mathieu-Daudé
                   ` (23 subsequent siblings)
  28 siblings, 1 reply; 32+ messages in thread
From: Philippe Mathieu-Daudé @ 2018-01-08  2:45 UTC (permalink / raw)
  To: Paolo Bonzini, Michael S. Tsirkin, Hervé Poussineau,
	Aurelien Jarno, Eduardo Habkost, Marcel Apfelbaum
  Cc: Philippe Mathieu-Daudé,
	qemu-devel, Igor Mammedov, Richard Henderson, Yongbok Kim,
	David Gibson, Alexander Graf, Mark Cave-Ayland, Artyom Tarasenko,
	Guan Xuetao, open list:PReP

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 include/hw/i386/pc.h     |  9 ---------
 include/hw/input/i8042.h | 25 +++++++++++++++++++++++++
 hw/alpha/dp264.c         |  3 ++-
 hw/i386/pc.c             |  1 +
 hw/i386/vmmouse.c        |  1 +
 hw/i386/vmport.c         |  1 +
 hw/input/pckbd.c         |  2 +-
 hw/mips/mips_fulong2e.c  |  3 ++-
 hw/mips/mips_jazz.c      |  1 +
 hw/mips/mips_malta.c     |  3 ++-
 hw/mips/mips_r4k.c       |  3 ++-
 hw/ppc/prep.c            |  5 +++--
 hw/sparc64/sun4u.c       |  3 ++-
 hw/unicore32/puv3.c      |  1 +
 MAINTAINERS              |  1 +
 15 files changed, 45 insertions(+), 17 deletions(-)
 create mode 100644 include/hw/input/i8042.h

diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index 87a377011b..103c7a9916 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -188,15 +188,6 @@ void vmport_register(unsigned char command, VMPortReadFunc *func, void *opaque);
 void vmmouse_get_data(uint32_t *data);
 void vmmouse_set_data(const uint32_t *data);
 
-/* pckbd.c */
-#define I8042_A20_LINE "a20"
-
-void i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq,
-                   MemoryRegion *region, ram_addr_t size,
-                   hwaddr mask);
-void i8042_isa_mouse_fake_event(void *opaque);
-void i8042_setup_a20_line(ISADevice *dev, qemu_irq a20_out);
-
 /* pc.c */
 extern int fd_bootchk;
 
diff --git a/include/hw/input/i8042.h b/include/hw/input/i8042.h
new file mode 100644
index 0000000000..15115004a3
--- /dev/null
+++ b/include/hw/input/i8042.h
@@ -0,0 +1,25 @@
+/*
+ * QEMU PS/2 Controller
+ *
+ * Copyright (c) 2003 Fabrice Bellard
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+#ifndef HW_INPUT_I8042_H
+#define HW_INPUT_I8042_H
+
+#include "hw/hw.h"
+#include "hw/isa/isa.h"
+
+#define TYPE_I8042 "i8042"
+
+#define I8042_A20_LINE "a20"
+
+void i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq,
+                   MemoryRegion *region, ram_addr_t size,
+                   hwaddr mask);
+void i8042_isa_mouse_fake_event(void *opaque);
+void i8042_setup_a20_line(ISADevice *dev, qemu_irq a20_out);
+
+#endif /* HW_INPUT_I8042_H */
diff --git a/hw/alpha/dp264.c b/hw/alpha/dp264.c
index 766373eec7..e13cb576fd 100644
--- a/hw/alpha/dp264.c
+++ b/hw/alpha/dp264.c
@@ -19,6 +19,7 @@
 #include "hw/timer/mc146818rtc.h"
 #include "hw/ide.h"
 #include "hw/timer/i8254.h"
+#include "hw/input/i8042.h"
 #include "hw/char/serial.h"
 #include "qemu/cutils.h"
 
@@ -81,7 +82,7 @@ static void clipper_init(MachineState *machine)
     mc146818_rtc_init(isa_bus, 1900, rtc_irq);
 
     i8254_pit_init(isa_bus, 0x40, 0, NULL);
-    isa_create_simple(isa_bus, "i8042");
+    isa_create_simple(isa_bus, TYPE_I8042);
 
     /* VGA setup.  Don't bother loading the bios.  */
     pci_vga_init(pci_bus);
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index e39af3d48c..e5c4e48ebb 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -42,6 +42,7 @@
 #include "hw/timer/mc146818rtc.h"
 #include "hw/dma/i8257.h"
 #include "hw/timer/i8254.h"
+#include "hw/input/i8042.h"
 #include "hw/audio/pcspk.h"
 #include "hw/pci/msi.h"
 #include "hw/sysbus.h"
diff --git a/hw/i386/vmmouse.c b/hw/i386/vmmouse.c
index 65ef55329e..5d2d278be4 100644
--- a/hw/i386/vmmouse.c
+++ b/hw/i386/vmmouse.c
@@ -25,6 +25,7 @@
 #include "hw/hw.h"
 #include "ui/console.h"
 #include "hw/i386/pc.h"
+#include "hw/input/i8042.h"
 #include "hw/qdev.h"
 
 /* debug only vmmouse */
diff --git a/hw/i386/vmport.c b/hw/i386/vmport.c
index 116aa09819..3bf8cfe041 100644
--- a/hw/i386/vmport.c
+++ b/hw/i386/vmport.c
@@ -25,6 +25,7 @@
 #include "hw/hw.h"
 #include "hw/isa/isa.h"
 #include "hw/i386/pc.h"
+#include "hw/input/i8042.h"
 #include "sysemu/hw_accel.h"
 #include "hw/qdev.h"
 #include "qemu/log.h"
diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c
index c479f827b6..f17f18e51b 100644
--- a/hw/input/pckbd.c
+++ b/hw/input/pckbd.c
@@ -26,6 +26,7 @@
 #include "hw/isa/isa.h"
 #include "hw/i386/pc.h"
 #include "hw/input/ps2.h"
+#include "hw/input/i8042.h"
 #include "sysemu/sysemu.h"
 
 /* debug PC keyboard */
@@ -480,7 +481,6 @@ void i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq,
     qemu_register_reset(kbd_reset, s);
 }
 
-#define TYPE_I8042 "i8042"
 #define I8042(obj) OBJECT_CHECK(ISAKBDState, (obj), TYPE_I8042)
 
 typedef struct ISAKBDState {
diff --git a/hw/mips/mips_fulong2e.c b/hw/mips/mips_fulong2e.c
index cbe159034d..8660d078c8 100644
--- a/hw/mips/mips_fulong2e.c
+++ b/hw/mips/mips_fulong2e.c
@@ -44,6 +44,7 @@
 #include "hw/isa/vt82c686.h"
 #include "hw/timer/mc146818rtc.h"
 #include "hw/timer/i8254.h"
+#include "hw/input/i8042.h"
 #include "sysemu/blockdev.h"
 #include "exec/address-spaces.h"
 #include "sysemu/qtest.h"
@@ -365,7 +366,7 @@ static void mips_fulong2e_init(MachineState *machine)
     i8257_dma_init(isa_bus, 0);
 
     /* Super I/O */
-    isa_create_simple(isa_bus, "i8042");
+    isa_create_simple(isa_bus, TYPE_I8042);
 
     mc146818_rtc_init(isa_bus, 2000, NULL);
 
diff --git a/hw/mips/mips_jazz.c b/hw/mips/mips_jazz.c
index 6ed4b83f40..7a83009059 100644
--- a/hw/mips/mips_jazz.c
+++ b/hw/mips/mips_jazz.c
@@ -43,6 +43,7 @@
 #include "hw/timer/i8254.h"
 #include "hw/display/vga.h"
 #include "hw/audio/pcspk.h"
+#include "hw/input/i8042.h"
 #include "sysemu/block-backend.h"
 #include "hw/sysbus.h"
 #include "exec/address-spaces.h"
diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c
index 0a9e3dedf4..28cc37ee08 100644
--- a/hw/mips/mips_malta.c
+++ b/hw/mips/mips_malta.c
@@ -47,6 +47,7 @@
 #include "hw/loader.h"
 #include "elf.h"
 #include "hw/timer/mc146818rtc.h"
+#include "hw/input/i8042.h"
 #include "hw/timer/i8254.h"
 #include "sysemu/blockdev.h"
 #include "exec/address-spaces.h"
@@ -1214,7 +1215,7 @@ void mips_malta_init(MachineState *machine)
     i8257_dma_init(isa_bus, 0);
 
     /* Super I/O */
-    isa_create_simple(isa_bus, "i8042");
+    isa_create_simple(isa_bus, TYPE_I8042);
 
     mc146818_rtc_init(isa_bus, 2000, NULL);
     serial_hds_isa_init(isa_bus, 0, 2);
diff --git a/hw/mips/mips_r4k.c b/hw/mips/mips_r4k.c
index 244bd41813..92acae149d 100644
--- a/hw/mips/mips_r4k.c
+++ b/hw/mips/mips_r4k.c
@@ -28,6 +28,7 @@
 #include "hw/loader.h"
 #include "elf.h"
 #include "hw/timer/mc146818rtc.h"
+#include "hw/input/i8042.h"
 #include "hw/timer/i8254.h"
 #include "sysemu/block-backend.h"
 #include "exec/address-spaces.h"
@@ -288,7 +289,7 @@ void mips_r4k_init(MachineState *machine)
                      hd[MAX_IDE_DEVS * i],
 		     hd[MAX_IDE_DEVS * i + 1]);
 
-    isa_create_simple(isa_bus, "i8042");
+    isa_create_simple(isa_bus, TYPE_I8042);
 }
 
 static void mips_machine_init(MachineClass *mc)
diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c
index af08ac319a..4304e93ada 100644
--- a/hw/ppc/prep.c
+++ b/hw/ppc/prep.c
@@ -41,6 +41,7 @@
 #include "hw/ide.h"
 #include "hw/loader.h"
 #include "hw/timer/mc146818rtc.h"
+#include "hw/input/i8042.h"
 #include "hw/isa/pc87312.h"
 #include "hw/net/ne2000-isa.h"
 #include "sysemu/block-backend.h"
@@ -641,7 +642,7 @@ static void ppc_prep_init(MachineState *machine)
                      hd[2 * i],
 		     hd[2 * i + 1]);
     }
-    isa_create_simple(isa_bus, "i8042");
+    isa_create_simple(isa_bus, TYPE_I8042);
 
     cpu = POWERPC_CPU(first_cpu);
     sysctrl->reset_irq = cpu->env.irq_inputs[PPC6xx_INPUT_HRESET];
@@ -771,7 +772,7 @@ static void ibm_40p_init(MachineState *machine)
 
     /* add some more devices */
     if (defaults_enabled()) {
-        isa_create_simple(isa_bus, "i8042");
+        isa_create_simple(isa_bus, TYPE_I8042);
         m48t59 = NVRAM(isa_create_simple(isa_bus, "isa-m48t59"));
 
         dev = DEVICE(isa_create(isa_bus, "cs4231a"));
diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c
index 135f8088ca..2a60f5c1d6 100644
--- a/hw/sparc64/sun4u.c
+++ b/hw/sparc64/sun4u.c
@@ -33,6 +33,7 @@
 #include "hw/char/serial.h"
 #include "hw/char/parallel.h"
 #include "hw/timer/m48t59.h"
+#include "hw/input/i8042.h"
 #include "hw/block/fdc.h"
 #include "net/net.h"
 #include "qemu/timer.h"
@@ -513,7 +514,7 @@ static void sun4uv_init(MemoryRegion *address_space_mem,
     qdev_init_nofail(&pci_dev->qdev);
     pci_ide_create_devs(pci_dev, hd);
 
-    isa_create_simple(isa_bus, "i8042");
+    isa_create_simple(isa_bus, TYPE_I8042);
 
     /* Floppy */
     for(i = 0; i < MAX_FD; i++) {
diff --git a/hw/unicore32/puv3.c b/hw/unicore32/puv3.c
index db26959a1d..830fe3face 100644
--- a/hw/unicore32/puv3.c
+++ b/hw/unicore32/puv3.c
@@ -20,6 +20,7 @@
 
 #undef DEBUG_PUV3
 #include "hw/unicore32/puv3.h"
+#include "hw/input/i8042.h"
 
 #define KERNEL_LOAD_ADDR        0x03000000
 #define KERNEL_MAX_SIZE         0x00800000 /* Just a guess */
diff --git a/MAINTAINERS b/MAINTAINERS
index 89810df375..7f9e98a046 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -885,6 +885,7 @@ F: include/hw/display/vga.h
 F: include/hw/char/parallel.h
 F: include/hw/dma/i8257.h
 F: include/hw/i2c/pm_smbus.h
+F: include/hw/input/i8042.h
 F: include/hw/timer/hpet.h
 F: include/hw/timer/i8254*
 F: include/hw/timer/mc146818rtc*
-- 
2.15.1

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

* [Qemu-devel] [PATCH 06/29] hw/isa: add a generic isa_superio_init()
  2018-01-08  2:45 [Qemu-devel] [RFC PATCH 00/29] remove i386/pc dependency: generic SuperIO, PIIX cleanup Philippe Mathieu-Daudé
                   ` (4 preceding siblings ...)
  2018-01-08  2:45 ` [Qemu-devel] [PATCH 05/29] hw/input/i8042: extract declarations from i386/pc.h into input/i8042.h Philippe Mathieu-Daudé
@ 2018-01-08  2:45 ` Philippe Mathieu-Daudé
  2018-01-14 18:22   ` Philippe Mathieu-Daudé
  2018-01-08  2:45 ` [Qemu-devel] [PATCH 07/29] hw/i386/pc: use isa_superio_init() Philippe Mathieu-Daudé
                   ` (22 subsequent siblings)
  28 siblings, 1 reply; 32+ messages in thread
From: Philippe Mathieu-Daudé @ 2018-01-08  2:45 UTC (permalink / raw)
  To: Paolo Bonzini, Michael S. Tsirkin, Hervé Poussineau,
	Aurelien Jarno, Eduardo Habkost, Marcel Apfelbaum
  Cc: Philippe Mathieu-Daudé, qemu-devel, Igor Mammedov

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 include/hw/isa/superio.h | 17 +++++++++++++++++
 hw/isa/isa-superio.c     | 45 +++++++++++++++++++++++++++++++++++++++++++++
 MAINTAINERS              |  2 ++
 hw/isa/Makefile.objs     |  1 +
 4 files changed, 65 insertions(+)
 create mode 100644 include/hw/isa/superio.h
 create mode 100644 hw/isa/isa-superio.c

diff --git a/include/hw/isa/superio.h b/include/hw/isa/superio.h
new file mode 100644
index 0000000000..e685b96653
--- /dev/null
+++ b/include/hw/isa/superio.h
@@ -0,0 +1,17 @@
+/*
+ * Generic ISA Super I/O
+ *
+ * Copyright (c) 2018 Philippe Mathieu-Daudé
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+#ifndef HW_ISA_SUPERIO_H
+#define HW_ISA_SUPERIO_H
+
+#include "hw/isa/isa.h"
+
+ISADevice *isa_superio_init(ISABus *isa_bus, int serial_count,
+                            int parallel_count, int drive_count);
+
+#endif
diff --git a/hw/isa/isa-superio.c b/hw/isa/isa-superio.c
new file mode 100644
index 0000000000..93d8457c6b
--- /dev/null
+++ b/hw/isa/isa-superio.c
@@ -0,0 +1,45 @@
+/*
+ * Generic ISA Super I/O
+ *
+ * Copyright (c) 2018 Philippe Mathieu-Daudé
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+#include "qemu/osdep.h"
+#include "qemu/error-report.h"
+#include "sysemu/blockdev.h"
+#include "hw/isa/superio.h"
+#include "hw/char/serial.h"
+#include "hw/char/parallel.h"
+#include "hw/block/fdc.h"
+#include "hw/input/i8042.h"
+
+ISADevice *isa_superio_init(ISABus *isa_bus, int serial_count,
+                            int parallel_count, int drive_count)
+{
+    serial_hds_isa_init(isa_bus, 0, serial_count);
+
+    parallel_hds_isa_init(isa_bus, parallel_count);
+
+    if (drive_count) {
+        DriveInfo **fd;
+        int i;
+
+        if (drive_count > MAX_FD) {
+            warn_report("superio: ignoring %d floppy controllers",
+                        drive_count - MAX_FD);
+            drive_count = MAX_FD;
+        }
+        fd = g_new(DriveInfo *, drive_count);
+
+        for (i = 0; i < drive_count; i++) {
+            fd[i] = drive_get(IF_FLOPPY, 0, i);
+        }
+        fdctrl_init_isa(isa_bus, fd);
+
+        g_free(fd); /* FIXME */
+    }
+
+    return isa_create_simple(isa_bus, TYPE_I8042);
+}
diff --git a/MAINTAINERS b/MAINTAINERS
index 7f9e98a046..6f867da743 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -875,6 +875,7 @@ F: hw/input/pckbd.c
 F: hw/intc/apic*
 F: hw/intc/ioapic*
 F: hw/intc/i8259*
+F: hw/isa/isa-superio.c
 F: hw/misc/debugexit.c
 F: hw/misc/pc-testdev.c
 F: hw/timer/hpet*
@@ -885,6 +886,7 @@ F: include/hw/display/vga.h
 F: include/hw/char/parallel.h
 F: include/hw/dma/i8257.h
 F: include/hw/i2c/pm_smbus.h
+F: include/hw/isa/superio.h
 F: include/hw/input/i8042.h
 F: include/hw/timer/hpet.h
 F: include/hw/timer/i8254*
diff --git a/hw/isa/Makefile.objs b/hw/isa/Makefile.objs
index fb37c55cf2..cac655ba58 100644
--- a/hw/isa/Makefile.objs
+++ b/hw/isa/Makefile.objs
@@ -1,4 +1,5 @@
 common-obj-$(CONFIG_ISA_BUS) += isa-bus.o
+common-obj-$(CONFIG_ISA_BUS) += isa-superio.o
 common-obj-$(CONFIG_APM) += apm.o
 common-obj-$(CONFIG_I82378) += i82378.o
 common-obj-$(CONFIG_PC87312) += pc87312.o
-- 
2.15.1

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

* [Qemu-devel] [PATCH 07/29] hw/i386/pc: use isa_superio_init()
  2018-01-08  2:45 [Qemu-devel] [RFC PATCH 00/29] remove i386/pc dependency: generic SuperIO, PIIX cleanup Philippe Mathieu-Daudé
                   ` (5 preceding siblings ...)
  2018-01-08  2:45 ` [Qemu-devel] [PATCH 06/29] hw/isa: add a generic isa_superio_init() Philippe Mathieu-Daudé
@ 2018-01-08  2:45 ` Philippe Mathieu-Daudé
  2018-01-08  2:45 ` [Qemu-devel] [PATCH 08/29] hw/mips/fulong2e: " Philippe Mathieu-Daudé
                   ` (21 subsequent siblings)
  28 siblings, 0 replies; 32+ messages in thread
From: Philippe Mathieu-Daudé @ 2018-01-08  2:45 UTC (permalink / raw)
  To: Paolo Bonzini, Michael S. Tsirkin, Hervé Poussineau,
	Aurelien Jarno, Eduardo Habkost, Marcel Apfelbaum
  Cc: Philippe Mathieu-Daudé,
	qemu-devel, Igor Mammedov, Richard Henderson

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 hw/i386/pc.c | 19 +++----------------
 1 file changed, 3 insertions(+), 16 deletions(-)

diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index e5c4e48ebb..f9479351f3 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -24,12 +24,9 @@
 #include "qemu/osdep.h"
 #include "hw/hw.h"
 #include "hw/i386/pc.h"
-#include "hw/char/serial.h"
-#include "hw/char/parallel.h"
 #include "hw/i386/apic.h"
 #include "hw/i386/topology.h"
 #include "sysemu/cpus.h"
-#include "hw/block/fdc.h"
 #include "hw/ide.h"
 #include "hw/pci/pci.h"
 #include "hw/pci/pci_bus.h"
@@ -41,6 +38,7 @@
 #include "multiboot.h"
 #include "hw/timer/mc146818rtc.h"
 #include "hw/dma/i8257.h"
+#include "hw/isa/superio.h"
 #include "hw/timer/i8254.h"
 #include "hw/input/i8042.h"
 #include "hw/audio/pcspk.h"
@@ -1523,7 +1521,6 @@ void pc_basic_device_init(ISABus *isa_bus, qemu_irq *gsi,
                           uint32_t hpet_irqs)
 {
     int i;
-    DriveInfo *fd[MAX_FD];
     DeviceState *hpet = NULL;
     int pit_isa_irq = 0;
     qemu_irq pit_alt_irq = NULL;
@@ -1586,11 +1583,9 @@ void pc_basic_device_init(ISABus *isa_bus, qemu_irq *gsi,
         pcspk_init(isa_bus, pit);
     }
 
-    serial_hds_isa_init(isa_bus, 0, MAX_SERIAL_PORTS);
-    parallel_hds_isa_init(isa_bus, MAX_PARALLEL_PORTS);
-
     a20_line = qemu_allocate_irqs(handle_a20_line_change, first_cpu, 2);
-    i8042 = isa_create_simple(isa_bus, "i8042");
+    i8042 = isa_superio_init(isa_bus, MAX_SERIAL_PORTS, 1,
+                             create_fdctrl ? MAX_FD : 0);
     i8042_setup_a20_line(i8042, a20_line[0]);
     if (!no_vmport) {
         vmport_init(isa_bus);
@@ -1608,14 +1603,6 @@ void pc_basic_device_init(ISABus *isa_bus, qemu_irq *gsi,
     g_free(a20_line);
 
     i8257_dma_init(isa_bus, 0);
-
-    for(i = 0; i < MAX_FD; i++) {
-        fd[i] = drive_get(IF_FLOPPY, 0, i);
-        create_fdctrl |= !!fd[i];
-    }
-    if (create_fdctrl) {
-        fdctrl_init_isa(isa_bus, fd);
-    }
 }
 
 void pc_nic_init(ISABus *isa_bus, PCIBus *pci_bus)
-- 
2.15.1

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

* [Qemu-devel] [PATCH 08/29] hw/mips/fulong2e: use isa_superio_init()
  2018-01-08  2:45 [Qemu-devel] [RFC PATCH 00/29] remove i386/pc dependency: generic SuperIO, PIIX cleanup Philippe Mathieu-Daudé
                   ` (6 preceding siblings ...)
  2018-01-08  2:45 ` [Qemu-devel] [PATCH 07/29] hw/i386/pc: use isa_superio_init() Philippe Mathieu-Daudé
@ 2018-01-08  2:45 ` Philippe Mathieu-Daudé
  2018-01-08  2:45 ` [Qemu-devel] [PATCH 09/29] hw/mips/malta: code movement Philippe Mathieu-Daudé
                   ` (20 subsequent siblings)
  28 siblings, 0 replies; 32+ messages in thread
From: Philippe Mathieu-Daudé @ 2018-01-08  2:45 UTC (permalink / raw)
  To: Paolo Bonzini, Michael S. Tsirkin, Hervé Poussineau,
	Aurelien Jarno, Eduardo Habkost, Marcel Apfelbaum, Yongbok Kim
  Cc: Philippe Mathieu-Daudé, qemu-devel, Igor Mammedov

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 hw/mips/mips_fulong2e.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/hw/mips/mips_fulong2e.c b/hw/mips/mips_fulong2e.c
index 8660d078c8..2f4cc5d05e 100644
--- a/hw/mips/mips_fulong2e.c
+++ b/hw/mips/mips_fulong2e.c
@@ -23,13 +23,10 @@
 #include "hw/hw.h"
 #include "hw/i386/pc.h"
 #include "hw/dma/i8257.h"
-#include "hw/char/serial.h"
-#include "hw/char/parallel.h"
-#include "hw/block/fdc.h"
+#include "hw/isa/superio.h"
 #include "net/net.h"
 #include "hw/boards.h"
 #include "hw/i2c/smbus.h"
-#include "sysemu/block-backend.h"
 #include "hw/block/flash.h"
 #include "hw/mips/mips.h"
 #include "hw/mips/cpudevs.h"
@@ -44,7 +41,6 @@
 #include "hw/isa/vt82c686.h"
 #include "hw/timer/mc146818rtc.h"
 #include "hw/timer/i8254.h"
-#include "hw/input/i8042.h"
 #include "sysemu/blockdev.h"
 #include "exec/address-spaces.h"
 #include "sysemu/qtest.h"
@@ -366,13 +362,10 @@ static void mips_fulong2e_init(MachineState *machine)
     i8257_dma_init(isa_bus, 0);
 
     /* Super I/O */
-    isa_create_simple(isa_bus, TYPE_I8042);
+    isa_superio_init(isa_bus, MAX_SERIAL_PORTS, 1, 0);
 
     mc146818_rtc_init(isa_bus, 2000, NULL);
 
-    serial_hds_isa_init(isa_bus, 0, MAX_SERIAL_PORTS);
-    parallel_hds_isa_init(isa_bus, 1);
-
     /* Sound card */
     audio_init(pci_bus);
     /* Network card */
-- 
2.15.1

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

* [Qemu-devel] [PATCH 09/29] hw/mips/malta: code movement
  2018-01-08  2:45 [Qemu-devel] [RFC PATCH 00/29] remove i386/pc dependency: generic SuperIO, PIIX cleanup Philippe Mathieu-Daudé
                   ` (7 preceding siblings ...)
  2018-01-08  2:45 ` [Qemu-devel] [PATCH 08/29] hw/mips/fulong2e: " Philippe Mathieu-Daudé
@ 2018-01-08  2:45 ` Philippe Mathieu-Daudé
  2018-01-08  2:45 ` [Qemu-devel] [PATCH 10/29] hw/mips/malta: add fdc37m81x_init() which uses isa_superio_init() Philippe Mathieu-Daudé
                   ` (19 subsequent siblings)
  28 siblings, 0 replies; 32+ messages in thread
From: Philippe Mathieu-Daudé @ 2018-01-08  2:45 UTC (permalink / raw)
  To: Paolo Bonzini, Michael S. Tsirkin, Hervé Poussineau,
	Aurelien Jarno, Eduardo Habkost, Marcel Apfelbaum
  Cc: Philippe Mathieu-Daudé, qemu-devel, Igor Mammedov, Yongbok Kim

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 hw/mips/mips_malta.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c
index 28cc37ee08..195d7dd59e 100644
--- a/hw/mips/mips_malta.c
+++ b/hw/mips/mips_malta.c
@@ -1063,10 +1063,6 @@ void mips_malta_init(MachineState *machine)
         memory_region_add_subregion(system_memory, 512 << 20, ram_low_postio);
     }
 
-    /* generate SPD EEPROM data */
-    generate_eeprom_spd(&smbus_eeprom_buf[0 * 256], ram_size);
-    generate_eeprom_serial(&smbus_eeprom_buf[6 * 256]);
-
 #ifdef TARGET_WORDS_BIGENDIAN
     be = 1;
 #else
@@ -1209,15 +1205,19 @@ void mips_malta_init(MachineState *machine)
     pci_create_simple(pci_bus, piix4_devfn + 2, "piix4-usb-uhci");
     smbus = piix4_pm_init(pci_bus, piix4_devfn + 3, 0x1100,
                           isa_get_irq(NULL, 9), NULL, 0, NULL);
-    smbus_eeprom_init(smbus, 8, smbus_eeprom_buf, smbus_eeprom_size);
-    g_free(smbus_eeprom_buf);
     pit = i8254_pit_init(isa_bus, 0x40, 0, NULL);
     i8257_dma_init(isa_bus, 0);
+    mc146818_rtc_init(isa_bus, 2000, NULL);
+
+    /* generate SPD EEPROM data */
+    generate_eeprom_spd(&smbus_eeprom_buf[0 * 256], ram_size);
+    generate_eeprom_serial(&smbus_eeprom_buf[6 * 256]);
+    smbus_eeprom_init(smbus, 8, smbus_eeprom_buf, smbus_eeprom_size);
+    g_free(smbus_eeprom_buf);
 
     /* Super I/O */
     isa_create_simple(isa_bus, TYPE_I8042);
 
-    mc146818_rtc_init(isa_bus, 2000, NULL);
     serial_hds_isa_init(isa_bus, 0, 2);
     parallel_hds_isa_init(isa_bus, 1);
 
-- 
2.15.1

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

* [Qemu-devel] [PATCH 10/29] hw/mips/malta: add fdc37m81x_init() which uses isa_superio_init()
  2018-01-08  2:45 [Qemu-devel] [RFC PATCH 00/29] remove i386/pc dependency: generic SuperIO, PIIX cleanup Philippe Mathieu-Daudé
                   ` (8 preceding siblings ...)
  2018-01-08  2:45 ` [Qemu-devel] [PATCH 09/29] hw/mips/malta: code movement Philippe Mathieu-Daudé
@ 2018-01-08  2:45 ` Philippe Mathieu-Daudé
  2018-01-08  2:45 ` [Qemu-devel] [PATCH 11/29] mc146818rtc: always register rtc to rtc list Philippe Mathieu-Daudé
                   ` (18 subsequent siblings)
  28 siblings, 0 replies; 32+ messages in thread
From: Philippe Mathieu-Daudé @ 2018-01-08  2:45 UTC (permalink / raw)
  To: Paolo Bonzini, Michael S. Tsirkin, Hervé Poussineau,
	Aurelien Jarno, Eduardo Habkost, Marcel Apfelbaum
  Cc: Philippe Mathieu-Daudé, qemu-devel, Igor Mammedov, Yongbok Kim

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 hw/mips/mips_malta.c | 28 +++++++++++++---------------
 1 file changed, 13 insertions(+), 15 deletions(-)

diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c
index 195d7dd59e..bfa79c374d 100644
--- a/hw/mips/mips_malta.c
+++ b/hw/mips/mips_malta.c
@@ -27,14 +27,12 @@
 #include "cpu.h"
 #include "hw/hw.h"
 #include "hw/i386/pc.h"
+#include "hw/isa/superio.h"
 #include "hw/dma/i8257.h"
 #include "hw/char/serial.h"
-#include "hw/char/parallel.h"
-#include "hw/block/fdc.h"
 #include "net/net.h"
 #include "hw/boards.h"
 #include "hw/i2c/smbus.h"
-#include "sysemu/block-backend.h"
 #include "hw/block/flash.h"
 #include "hw/mips/mips.h"
 #include "hw/mips/cpudevs.h"
@@ -47,7 +45,6 @@
 #include "hw/loader.h"
 #include "elf.h"
 #include "hw/timer/mc146818rtc.h"
-#include "hw/input/i8042.h"
 #include "hw/timer/i8254.h"
 #include "sysemu/blockdev.h"
 #include "exec/address-spaces.h"
@@ -980,6 +977,16 @@ static void mips_create_cpu(MaltaState *s, const char *cpu_type,
     }
 }
 
+#define FDC37M81X_SERIAL_COUNT      2
+#define FDC37M81X_DRIVE_COUNT       2
+#define FDC37M81X_PARALLEL_COUNT    1
+
+static ISADevice *fdc37m81x_init(ISABus *isa_bus)
+{
+    return isa_superio_init(isa_bus, FDC37M81X_SERIAL_COUNT,
+                            FDC37M81X_PARALLEL_COUNT, FDC37M81X_DRIVE_COUNT);
+}
+
 static
 void mips_malta_init(MachineState *machine)
 {
@@ -1008,7 +1015,6 @@ void mips_malta_init(MachineState *machine)
     int i;
     DriveInfo *dinfo;
     DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
-    DriveInfo *fd[MAX_FD];
     int fl_idx = 0;
     int fl_sectors = bios_size >> 16;
     int be;
@@ -1215,16 +1221,8 @@ void mips_malta_init(MachineState *machine)
     smbus_eeprom_init(smbus, 8, smbus_eeprom_buf, smbus_eeprom_size);
     g_free(smbus_eeprom_buf);
 
-    /* Super I/O */
-    isa_create_simple(isa_bus, TYPE_I8042);
-
-    serial_hds_isa_init(isa_bus, 0, 2);
-    parallel_hds_isa_init(isa_bus, 1);
-
-    for(i = 0; i < MAX_FD; i++) {
-        fd[i] = drive_get(IF_FLOPPY, 0, i);
-    }
-    fdctrl_init_isa(isa_bus, fd);
+    /* SuperI/O: SMS FDC37M817 */
+    fdc37m81x_init(isa_bus);
 
     /* Network card */
     network_init(pci_bus);
-- 
2.15.1

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

* [Qemu-devel] [PATCH 11/29] mc146818rtc: always register rtc to rtc list
  2018-01-08  2:45 [Qemu-devel] [RFC PATCH 00/29] remove i386/pc dependency: generic SuperIO, PIIX cleanup Philippe Mathieu-Daudé
                   ` (9 preceding siblings ...)
  2018-01-08  2:45 ` [Qemu-devel] [PATCH 10/29] hw/mips/malta: add fdc37m81x_init() which uses isa_superio_init() Philippe Mathieu-Daudé
@ 2018-01-08  2:45 ` Philippe Mathieu-Daudé
  2018-01-08  2:45 ` [Qemu-devel] [PATCH 12/29] piix4: rename some variables in realize function Philippe Mathieu-Daudé
                   ` (17 subsequent siblings)
  28 siblings, 0 replies; 32+ messages in thread
From: Philippe Mathieu-Daudé @ 2018-01-08  2:45 UTC (permalink / raw)
  To: Paolo Bonzini, Michael S. Tsirkin, Hervé Poussineau,
	Aurelien Jarno, Eduardo Habkost, Marcel Apfelbaum
  Cc: qemu-devel, Igor Mammedov

From: Hervé Poussineau <hpoussin@reactos.org>

We are not required anymore to use rtc_init() function.

Acked-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
---
 hw/timer/mc146818rtc.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/hw/timer/mc146818rtc.c b/hw/timer/mc146818rtc.c
index 35a05a64cc..b0027e8f62 100644
--- a/hw/timer/mc146818rtc.c
+++ b/hw/timer/mc146818rtc.c
@@ -997,17 +997,16 @@ static void rtc_realizefn(DeviceState *dev, Error **errp)
                               OBJECT(s), "date", NULL);
 
     qdev_init_gpio_out(dev, &s->irq, 1);
+    QLIST_INSERT_HEAD(&rtc_devices, s, link);
 }
 
 ISADevice *mc146818_rtc_init(ISABus *bus, int base_year, qemu_irq intercept_irq)
 {
     DeviceState *dev;
     ISADevice *isadev;
-    RTCState *s;
 
     isadev = isa_create(bus, TYPE_MC146818_RTC);
     dev = DEVICE(isadev);
-    s = MC146818_RTC(isadev);
     qdev_prop_set_int32(dev, "base_year", base_year);
     qdev_init_nofail(dev);
     if (intercept_irq) {
@@ -1015,7 +1014,6 @@ ISADevice *mc146818_rtc_init(ISABus *bus, int base_year, qemu_irq intercept_irq)
     } else {
         isa_connect_gpio_out(isadev, 0, RTC_ISA_IRQ);
     }
-    QLIST_INSERT_HEAD(&rtc_devices, s, link);
 
     return isadev;
 }
@@ -1046,8 +1044,6 @@ static void rtc_class_initfn(ObjectClass *klass, void *data)
     dc->reset = rtc_resetdev;
     dc->vmsd = &vmstate_rtc;
     dc->props = mc146818rtc_properties;
-    /* Reason: needs to be wired up by rtc_init() */
-    dc->user_creatable = false;
 }
 
 static void rtc_finalize(Object *obj)
-- 
2.15.1

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

* [Qemu-devel] [PATCH 12/29] piix4: rename some variables in realize function
  2018-01-08  2:45 [Qemu-devel] [RFC PATCH 00/29] remove i386/pc dependency: generic SuperIO, PIIX cleanup Philippe Mathieu-Daudé
                   ` (10 preceding siblings ...)
  2018-01-08  2:45 ` [Qemu-devel] [PATCH 11/29] mc146818rtc: always register rtc to rtc list Philippe Mathieu-Daudé
@ 2018-01-08  2:45 ` Philippe Mathieu-Daudé
  2018-01-08  2:45 ` [Qemu-devel] [PATCH 13/29] piix4: convert reset function to QOM Philippe Mathieu-Daudé
                   ` (16 subsequent siblings)
  28 siblings, 0 replies; 32+ messages in thread
From: Philippe Mathieu-Daudé @ 2018-01-08  2:45 UTC (permalink / raw)
  To: Paolo Bonzini, Michael S. Tsirkin, Hervé Poussineau,
	Aurelien Jarno, Eduardo Habkost, Marcel Apfelbaum
  Cc: qemu-devel, Igor Mammedov

From: Hervé Poussineau <hpoussin@reactos.org>

PIIX4 structure is now 's'
PCI device is now 'pci_dev'
DeviceState is now 'dev'

Acked-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
---
 hw/isa/piix4.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/hw/isa/piix4.c b/hw/isa/piix4.c
index 6b8bc3faf0..7b231b704b 100644
--- a/hw/isa/piix4.c
+++ b/hw/isa/piix4.c
@@ -87,16 +87,17 @@ static const VMStateDescription vmstate_piix4 = {
     }
 };
 
-static void piix4_realize(PCIDevice *dev, Error **errp)
+static void piix4_realize(PCIDevice *pci_dev, Error **errp)
 {
-    PIIX4State *d = PIIX4_PCI_DEVICE(dev);
+    DeviceState *dev = DEVICE(pci_dev);
+    PIIX4State *s = DO_UPCAST(PIIX4State, dev, pci_dev);
 
-    if (!isa_bus_new(DEVICE(d), pci_address_space(dev),
-                     pci_address_space_io(dev), errp)) {
+    if (!isa_bus_new(dev, pci_address_space(pci_dev),
+                     pci_address_space_io(pci_dev), errp)) {
         return;
     }
-    piix4_dev = &d->dev;
-    qemu_register_reset(piix4_reset, d);
+    piix4_dev = pci_dev;
+    qemu_register_reset(piix4_reset, s);
 }
 
 int piix4_init(PCIBus *bus, ISABus **isa_bus, int devfn)
-- 
2.15.1

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

* [Qemu-devel] [PATCH 13/29] piix4: convert reset function to QOM
  2018-01-08  2:45 [Qemu-devel] [RFC PATCH 00/29] remove i386/pc dependency: generic SuperIO, PIIX cleanup Philippe Mathieu-Daudé
                   ` (11 preceding siblings ...)
  2018-01-08  2:45 ` [Qemu-devel] [PATCH 12/29] piix4: rename some variables in realize function Philippe Mathieu-Daudé
@ 2018-01-08  2:45 ` Philippe Mathieu-Daudé
  2018-01-08  2:45 ` [Qemu-devel] [PATCH 14/29] piix4: add Reset Control Register Philippe Mathieu-Daudé
                   ` (15 subsequent siblings)
  28 siblings, 0 replies; 32+ messages in thread
From: Philippe Mathieu-Daudé @ 2018-01-08  2:45 UTC (permalink / raw)
  To: Paolo Bonzini, Michael S. Tsirkin, Hervé Poussineau,
	Aurelien Jarno, Eduardo Habkost, Marcel Apfelbaum
  Cc: qemu-devel, Igor Mammedov

From: Hervé Poussineau <hpoussin@reactos.org>

Acked-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
---
 hw/isa/piix4.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/hw/isa/piix4.c b/hw/isa/piix4.c
index 7b231b704b..314f7f7359 100644
--- a/hw/isa/piix4.c
+++ b/hw/isa/piix4.c
@@ -39,10 +39,10 @@ typedef struct PIIX4State {
 #define PIIX4_PCI_DEVICE(obj) \
     OBJECT_CHECK(PIIX4State, (obj), TYPE_PIIX4_PCI_DEVICE)
 
-static void piix4_reset(void *opaque)
+static void piix4_reset(DeviceState *dev)
 {
-    PIIX4State *d = opaque;
-    uint8_t *pci_conf = d->dev.config;
+    PIIX4State *s = PIIX4_PCI_DEVICE(dev);
+    uint8_t *pci_conf = s->dev.config;
 
     pci_conf[0x04] = 0x07; // master, memory and I/O
     pci_conf[0x05] = 0x00;
@@ -97,7 +97,6 @@ static void piix4_realize(PCIDevice *pci_dev, Error **errp)
         return;
     }
     piix4_dev = pci_dev;
-    qemu_register_reset(piix4_reset, s);
 }
 
 int piix4_init(PCIBus *bus, ISABus **isa_bus, int devfn)
@@ -118,6 +117,7 @@ static void piix4_class_init(ObjectClass *klass, void *data)
     k->vendor_id = PCI_VENDOR_ID_INTEL;
     k->device_id = PCI_DEVICE_ID_INTEL_82371AB_0;
     k->class_id = PCI_CLASS_BRIDGE_ISA;
+    dc->reset = piix4_reset;
     dc->desc = "ISA bridge";
     dc->vmsd = &vmstate_piix4;
     /*
-- 
2.15.1

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

* [Qemu-devel] [PATCH 14/29] piix4: add Reset Control Register
  2018-01-08  2:45 [Qemu-devel] [RFC PATCH 00/29] remove i386/pc dependency: generic SuperIO, PIIX cleanup Philippe Mathieu-Daudé
                   ` (12 preceding siblings ...)
  2018-01-08  2:45 ` [Qemu-devel] [PATCH 13/29] piix4: convert reset function to QOM Philippe Mathieu-Daudé
@ 2018-01-08  2:45 ` Philippe Mathieu-Daudé
  2018-01-08  2:45 ` [Qemu-devel] [PATCH 15/29] piix4: add a i8259 interrupt controller as specified in datasheet Philippe Mathieu-Daudé
                   ` (14 subsequent siblings)
  28 siblings, 0 replies; 32+ messages in thread
From: Philippe Mathieu-Daudé @ 2018-01-08  2:45 UTC (permalink / raw)
  To: Paolo Bonzini, Michael S. Tsirkin, Hervé Poussineau,
	Aurelien Jarno, Eduardo Habkost, Marcel Apfelbaum
  Cc: qemu-devel, Igor Mammedov

From: Hervé Poussineau <hpoussin@reactos.org>

The RCR I/O port (0xcf9) is used to generate a hard reset or a soft reset.

Acked-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
---
 hw/isa/piix4.c | 39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/hw/isa/piix4.c b/hw/isa/piix4.c
index 314f7f7359..13f4eaa2dd 100644
--- a/hw/isa/piix4.c
+++ b/hw/isa/piix4.c
@@ -2,6 +2,7 @@
  * QEMU PIIX4 PCI Bridge Emulation
  *
  * Copyright (c) 2006 Fabrice Bellard
+ * Copyright (c) 2018 Hervé Poussineau
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -33,6 +34,10 @@ PCIDevice *piix4_dev;
 
 typedef struct PIIX4State {
     PCIDevice dev;
+
+    /* Reset Control Register */
+    MemoryRegion rcr_mem;
+    uint8_t rcr;
 } PIIX4State;
 
 #define TYPE_PIIX4_PCI_DEVICE "PIIX4"
@@ -87,6 +92,34 @@ static const VMStateDescription vmstate_piix4 = {
     }
 };
 
+static void piix4_rcr_write(void *opaque, hwaddr addr, uint64_t val,
+                            unsigned int len)
+{
+    PIIX4State *s = opaque;
+
+    if (val & 4) {
+        qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET);
+        return;
+    }
+    s->rcr = val & 2; /* keep System Reset type only */
+}
+
+static uint64_t piix4_rcr_read(void *opaque, hwaddr addr, unsigned int len)
+{
+    PIIX4State *s = opaque;
+    return s->rcr;
+}
+
+static const MemoryRegionOps piix4_rcr_ops = {
+    .read = piix4_rcr_read,
+    .write = piix4_rcr_write,
+    .endianness = DEVICE_LITTLE_ENDIAN,
+    .impl = {
+        .min_access_size = 1,
+        .max_access_size = 1,
+    },
+};
+
 static void piix4_realize(PCIDevice *pci_dev, Error **errp)
 {
     DeviceState *dev = DEVICE(pci_dev);
@@ -96,6 +129,12 @@ static void piix4_realize(PCIDevice *pci_dev, Error **errp)
                      pci_address_space_io(pci_dev), errp)) {
         return;
     }
+
+    memory_region_init_io(&s->rcr_mem, OBJECT(dev), &piix4_rcr_ops, s,
+                          "reset-control", 1);
+    memory_region_add_subregion_overlap(pci_address_space_io(pci_dev), 0xcf9,
+                                        &s->rcr_mem, 1);
+
     piix4_dev = pci_dev;
 }
 
-- 
2.15.1

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

* [Qemu-devel] [PATCH 15/29] piix4: add a i8259 interrupt controller as specified in datasheet
  2018-01-08  2:45 [Qemu-devel] [RFC PATCH 00/29] remove i386/pc dependency: generic SuperIO, PIIX cleanup Philippe Mathieu-Daudé
                   ` (13 preceding siblings ...)
  2018-01-08  2:45 ` [Qemu-devel] [PATCH 14/29] piix4: add Reset Control Register Philippe Mathieu-Daudé
@ 2018-01-08  2:45 ` Philippe Mathieu-Daudé
  2018-01-08  2:45 ` [Qemu-devel] [RFC PATCH 16/29] Revert "irq: introduce qemu_irq_proxy()" Philippe Mathieu-Daudé
                   ` (13 subsequent siblings)
  28 siblings, 0 replies; 32+ messages in thread
From: Philippe Mathieu-Daudé @ 2018-01-08  2:45 UTC (permalink / raw)
  To: Paolo Bonzini, Michael S. Tsirkin, Hervé Poussineau,
	Aurelien Jarno, Eduardo Habkost, Marcel Apfelbaum
  Cc: qemu-devel, Igor Mammedov, Philippe Mathieu-Daudé, Yongbok Kim

From: Hervé Poussineau <hpoussin@reactos.org>

Add ISA irqs as piix4 gpio in, and CPU interrupt request as piix4 gpio out.
Remove i8259 instanciated in malta board, to not have it twice.

We can also remove the now unused piix4_init() function.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
[PMD: rebased]
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 include/hw/i386/pc.h |  1 -
 hw/isa/piix4.c       | 38 ++++++++++++++++++++++++++++----------
 hw/mips/mips_malta.c | 28 ++++++++++++----------------
 3 files changed, 40 insertions(+), 27 deletions(-)

diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index 103c7a9916..d2b67e44a7 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -274,7 +274,6 @@ PCIBus *i440fx_init(const char *host_type, const char *pci_type,
 PCIBus *find_i440fx(void);
 /* piix4.c */
 extern PCIDevice *piix4_dev;
-int piix4_init(PCIBus *bus, ISABus **isa_bus, int devfn);
 
 /* pc_sysfw.c */
 void pc_system_firmware_init(MemoryRegion *rom_memory,
diff --git a/hw/isa/piix4.c b/hw/isa/piix4.c
index 13f4eaa2dd..c19aa5a74f 100644
--- a/hw/isa/piix4.c
+++ b/hw/isa/piix4.c
@@ -34,6 +34,8 @@ PCIDevice *piix4_dev;
 
 typedef struct PIIX4State {
     PCIDevice dev;
+    qemu_irq cpu_intr;
+    qemu_irq *isa;
 
     /* Reset Control Register */
     MemoryRegion rcr_mem;
@@ -92,6 +94,18 @@ static const VMStateDescription vmstate_piix4 = {
     }
 };
 
+static void piix4_request_i8259_irq(void *opaque, int irq, int level)
+{
+    PIIX4State *s = opaque;
+    qemu_set_irq(s->cpu_intr, level);
+}
+
+static void piix4_set_i8259_irq(void *opaque, int irq, int level)
+{
+    PIIX4State *s = opaque;
+    qemu_set_irq(s->isa[irq], level);
+}
+
 static void piix4_rcr_write(void *opaque, hwaddr addr, uint64_t val,
                             unsigned int len)
 {
@@ -124,27 +138,31 @@ static void piix4_realize(PCIDevice *pci_dev, Error **errp)
 {
     DeviceState *dev = DEVICE(pci_dev);
     PIIX4State *s = DO_UPCAST(PIIX4State, dev, pci_dev);
+    ISABus *isa_bus;
+    qemu_irq *i8259_out_irq;
 
-    if (!isa_bus_new(dev, pci_address_space(pci_dev),
-                     pci_address_space_io(pci_dev), errp)) {
+    isa_bus = isa_bus_new(dev, pci_address_space(pci_dev),
+                          pci_address_space_io(pci_dev), errp);
+    if (!isa_bus) {
         return;
     }
 
+    qdev_init_gpio_in_named(dev, piix4_set_i8259_irq, "isa", ISA_NUM_IRQS);
+    qdev_init_gpio_out_named(dev, &s->cpu_intr, "intr", 1);
+
     memory_region_init_io(&s->rcr_mem, OBJECT(dev), &piix4_rcr_ops, s,
                           "reset-control", 1);
     memory_region_add_subregion_overlap(pci_address_space_io(pci_dev), 0xcf9,
                                         &s->rcr_mem, 1);
 
-    piix4_dev = pci_dev;
-}
+    /* initialize i8259 pic */
+    i8259_out_irq = qemu_allocate_irqs(piix4_request_i8259_irq, s, 1);
+    s->isa = i8259_init(isa_bus, *i8259_out_irq);
 
-int piix4_init(PCIBus *bus, ISABus **isa_bus, int devfn)
-{
-    PCIDevice *d;
+    /* initialize ISA irqs */
+    isa_bus_irqs(isa_bus, s->isa);
 
-    d = pci_create_simple_multifunction(bus, devfn, true, "PIIX4");
-    *isa_bus = ISA_BUS(qdev_get_child_bus(DEVICE(d), "isa.0"));
-    return d->devfn;
+    piix4_dev = pci_dev;
 }
 
 static void piix4_class_init(ObjectClass *klass, void *data)
diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c
index bfa79c374d..d31e144b70 100644
--- a/hw/mips/mips_malta.c
+++ b/hw/mips/mips_malta.c
@@ -96,7 +96,7 @@ typedef struct {
     SysBusDevice parent_obj;
 
     MIPSCPSState *cps;
-    qemu_irq *i8259;
+    qemu_irq i8259[16];
 } MaltaState;
 
 static ISADevice *pit;
@@ -1008,8 +1008,8 @@ void mips_malta_init(MachineState *machine)
     int64_t kernel_entry, bootloader_run_addr;
     PCIBus *pci_bus;
     ISABus *isa_bus;
-    qemu_irq *isa_irq;
     qemu_irq cbus_irq, i8259_irq;
+    PCIDevice *pci;
     int piix4_devfn;
     I2CBus *smbus;
     int i;
@@ -1185,28 +1185,24 @@ void mips_malta_init(MachineState *machine)
     /* Board ID = 0x420 (Malta Board with CoreLV) */
     stl_p(memory_region_get_ram_ptr(bios_copy) + 0x10, 0x00000420);
 
-    /*
-     * We have a circular dependency problem: pci_bus depends on isa_irq,
-     * isa_irq is provided by i8259, i8259 depends on ISA, ISA depends
-     * on piix4, and piix4 depends on pci_bus.  To stop the cycle we have
-     * qemu_irq_proxy() adds an extra bit of indirection, allowing us
-     * to resolve the isa_irq -> i8259 dependency after i8259 is initialized.
-     */
-    isa_irq = qemu_irq_proxy(&s->i8259, 16);
-
     /* Northbridge */
-    pci_bus = gt64120_register(isa_irq);
+    pci_bus = gt64120_register(s->i8259);
 
     /* Southbridge */
     ide_drive_get(hd, ARRAY_SIZE(hd));
 
-    piix4_devfn = piix4_init(pci_bus, &isa_bus, 80);
+    pci = pci_create_simple_multifunction(pci_bus, PCI_DEVFN(10, 0),
+                                          true, "PIIX4");
+    dev = DEVICE(pci);
+    isa_bus = ISA_BUS(qdev_get_child_bus(dev, "isa.0"));
+    piix4_devfn = pci->devfn;
 
     /* Interrupt controller */
-    /* The 8259 is attached to the MIPS CPU INT0 pin, ie interrupt 2 */
-    s->i8259 = i8259_init(isa_bus, i8259_irq);
+    qdev_connect_gpio_out_named(dev, "intr", 0, i8259_irq);
+    for (i = 0; i < 16; i++) {
+        s->i8259[i] = qdev_get_gpio_in_named(dev, "isa", i);
+    }
 
-    isa_bus_irqs(isa_bus, s->i8259);
     pci_piix4_ide_init(pci_bus, hd, piix4_devfn + 1);
     pci_create_simple(pci_bus, piix4_devfn + 2, "piix4-usb-uhci");
     smbus = piix4_pm_init(pci_bus, piix4_devfn + 3, 0x1100,
-- 
2.15.1

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

* [Qemu-devel] [RFC PATCH 16/29] Revert "irq: introduce qemu_irq_proxy()"
  2018-01-08  2:45 [Qemu-devel] [RFC PATCH 00/29] remove i386/pc dependency: generic SuperIO, PIIX cleanup Philippe Mathieu-Daudé
                   ` (14 preceding siblings ...)
  2018-01-08  2:45 ` [Qemu-devel] [PATCH 15/29] piix4: add a i8259 interrupt controller as specified in datasheet Philippe Mathieu-Daudé
@ 2018-01-08  2:45 ` Philippe Mathieu-Daudé
  2018-01-08  2:45 ` [Qemu-devel] [PATCH 17/29] piix: move piix4 declaration into new southbridge/i82371_piix.h Philippe Mathieu-Daudé
                   ` (12 subsequent siblings)
  28 siblings, 0 replies; 32+ messages in thread
From: Philippe Mathieu-Daudé @ 2018-01-08  2:45 UTC (permalink / raw)
  To: Paolo Bonzini, Michael S. Tsirkin, Hervé Poussineau,
	Aurelien Jarno, Eduardo Habkost, Marcel Apfelbaum, Peter Maydell
  Cc: Philippe Mathieu-Daudé, qemu-devel, Igor Mammedov

This function isn't used anymore.

This reverts commit 22ec3283efba9ba0792790da786d6776d83f2a92.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
I think circular IRQ dependencies should be avoided with today's QOM devices.

 include/hw/irq.h |  5 -----
 hw/core/irq.c    | 14 --------------
 2 files changed, 19 deletions(-)

diff --git a/include/hw/irq.h b/include/hw/irq.h
index 4c4c2eaf9a..ee823177e6 100644
--- a/include/hw/irq.h
+++ b/include/hw/irq.h
@@ -53,11 +53,6 @@ qemu_irq qemu_irq_invert(qemu_irq irq);
 /* Returns a new IRQ which feeds into both the passed IRQs */
 qemu_irq qemu_irq_split(qemu_irq irq1, qemu_irq irq2);
 
-/* Returns a new IRQ set which connects 1:1 to another IRQ set, which
- * may be set later.
- */
-qemu_irq *qemu_irq_proxy(qemu_irq **target, int n);
-
 /* For internal use in qtest.  Similar to qemu_irq_split, but operating
    on an existing vector of qemu_irq.  */
 void qemu_irq_intercept_in(qemu_irq *gpio_in, qemu_irq_handler handler, int n);
diff --git a/hw/core/irq.c b/hw/core/irq.c
index b98d1d69f5..c8e96f122a 100644
--- a/hw/core/irq.c
+++ b/hw/core/irq.c
@@ -121,20 +121,6 @@ qemu_irq qemu_irq_split(qemu_irq irq1, qemu_irq irq2)
     return qemu_allocate_irq(qemu_splitirq, s, 0);
 }
 
-static void proxy_irq_handler(void *opaque, int n, int level)
-{
-    qemu_irq **target = opaque;
-
-    if (*target) {
-        qemu_set_irq((*target)[n], level);
-    }
-}
-
-qemu_irq *qemu_irq_proxy(qemu_irq **target, int n)
-{
-    return qemu_allocate_irqs(proxy_irq_handler, target, n);
-}
-
 void qemu_irq_intercept_in(qemu_irq *gpio_in, qemu_irq_handler handler, int n)
 {
     int i;
-- 
2.15.1

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

* [Qemu-devel] [PATCH 17/29] piix: move piix4 declaration into new southbridge/i82371_piix.h
  2018-01-08  2:45 [Qemu-devel] [RFC PATCH 00/29] remove i386/pc dependency: generic SuperIO, PIIX cleanup Philippe Mathieu-Daudé
                   ` (15 preceding siblings ...)
  2018-01-08  2:45 ` [Qemu-devel] [RFC PATCH 16/29] Revert "irq: introduce qemu_irq_proxy()" Philippe Mathieu-Daudé
@ 2018-01-08  2:45 ` Philippe Mathieu-Daudé
  2018-01-08  2:45 ` [Qemu-devel] [PATCH 18/29] piix4: add a i8257 dma controller as specified in datasheet Philippe Mathieu-Daudé
                   ` (11 subsequent siblings)
  28 siblings, 0 replies; 32+ messages in thread
From: Philippe Mathieu-Daudé @ 2018-01-08  2:45 UTC (permalink / raw)
  To: Paolo Bonzini, Michael S. Tsirkin, Hervé Poussineau,
	Aurelien Jarno, Eduardo Habkost, Marcel Apfelbaum
  Cc: Philippe Mathieu-Daudé, qemu-devel, Igor Mammedov, Yongbok Kim

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 include/hw/i386/pc.h                 |  2 --
 include/hw/southbridge/i82371_piix.h | 17 +++++++++++++++++
 hw/isa/piix4.c                       |  1 +
 hw/mips/gt64xxx_pci.c                |  1 +
 MAINTAINERS                          |  1 +
 5 files changed, 20 insertions(+), 2 deletions(-)
 create mode 100644 include/hw/southbridge/i82371_piix.h

diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index d2b67e44a7..195c02febe 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -272,8 +272,6 @@ PCIBus *i440fx_init(const char *host_type, const char *pci_type,
                     MemoryRegion *ram_memory);
 
 PCIBus *find_i440fx(void);
-/* piix4.c */
-extern PCIDevice *piix4_dev;
 
 /* pc_sysfw.c */
 void pc_system_firmware_init(MemoryRegion *rom_memory,
diff --git a/include/hw/southbridge/i82371_piix.h b/include/hw/southbridge/i82371_piix.h
new file mode 100644
index 0000000000..95ac25becd
--- /dev/null
+++ b/include/hw/southbridge/i82371_piix.h
@@ -0,0 +1,17 @@
+/*
+ * Intel 82371 PIIX South Bridge Emulation
+ *
+ * Copyright (c) 2018 Philippe Mathieu-Daudé
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+#ifndef HW_ISA_PIIX_H
+#define HW_ISA_PIIX_H
+
+#include "hw/pci/pci.h"
+
+/* piix4.c */
+extern PCIDevice *piix4_dev;
+
+#endif /* HW_ISA_PIIX_H */
diff --git a/hw/isa/piix4.c b/hw/isa/piix4.c
index c19aa5a74f..b0f6a0a342 100644
--- a/hw/isa/piix4.c
+++ b/hw/isa/piix4.c
@@ -28,6 +28,7 @@
 #include "hw/i386/pc.h"
 #include "hw/pci/pci.h"
 #include "hw/isa/isa.h"
+#include "hw/southbridge/i82371_piix.h"
 #include "hw/sysbus.h"
 
 PCIDevice *piix4_dev;
diff --git a/hw/mips/gt64xxx_pci.c b/hw/mips/gt64xxx_pci.c
index 5a9dad9aae..24cc4044d7 100644
--- a/hw/mips/gt64xxx_pci.c
+++ b/hw/mips/gt64xxx_pci.c
@@ -28,6 +28,7 @@
 #include "hw/pci/pci.h"
 #include "hw/pci/pci_host.h"
 #include "hw/i386/pc.h"
+#include "hw/southbridge/i82371_piix.h"
 #include "exec/address-spaces.h"
 
 //#define DEBUG
diff --git a/MAINTAINERS b/MAINTAINERS
index 6f867da743..cead15b69b 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -888,6 +888,7 @@ F: include/hw/dma/i8257.h
 F: include/hw/i2c/pm_smbus.h
 F: include/hw/isa/superio.h
 F: include/hw/input/i8042.h
+F: include/hw/southbridge/i82371_piix.h
 F: include/hw/timer/hpet.h
 F: include/hw/timer/i8254*
 F: include/hw/timer/mc146818rtc*
-- 
2.15.1

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

* [Qemu-devel] [PATCH 18/29] piix4: add a i8257 dma controller as specified in datasheet
  2018-01-08  2:45 [Qemu-devel] [RFC PATCH 00/29] remove i386/pc dependency: generic SuperIO, PIIX cleanup Philippe Mathieu-Daudé
                   ` (16 preceding siblings ...)
  2018-01-08  2:45 ` [Qemu-devel] [PATCH 17/29] piix: move piix4 declaration into new southbridge/i82371_piix.h Philippe Mathieu-Daudé
@ 2018-01-08  2:45 ` Philippe Mathieu-Daudé
  2018-01-08  2:45 ` [Qemu-devel] [PATCH 19/29] piix4: add a i8254 pit " Philippe Mathieu-Daudé
                   ` (10 subsequent siblings)
  28 siblings, 0 replies; 32+ messages in thread
From: Philippe Mathieu-Daudé @ 2018-01-08  2:45 UTC (permalink / raw)
  To: Paolo Bonzini, Michael S. Tsirkin, Hervé Poussineau,
	Aurelien Jarno, Eduardo Habkost, Marcel Apfelbaum
  Cc: qemu-devel, Igor Mammedov, Philippe Mathieu-Daudé, Yongbok Kim

From: Hervé Poussineau <hpoussin@reactos.org>

Remove i8257 instanciated in malta board, to not have it twice.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
[PMD: rebased]
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 hw/isa/piix4.c       | 4 ++++
 hw/mips/mips_malta.c | 2 --
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/hw/isa/piix4.c b/hw/isa/piix4.c
index b0f6a0a342..56a1c7d429 100644
--- a/hw/isa/piix4.c
+++ b/hw/isa/piix4.c
@@ -29,6 +29,7 @@
 #include "hw/pci/pci.h"
 #include "hw/isa/isa.h"
 #include "hw/southbridge/i82371_piix.h"
+#include "hw/dma/i8257.h"
 #include "hw/sysbus.h"
 
 PCIDevice *piix4_dev;
@@ -163,6 +164,9 @@ static void piix4_realize(PCIDevice *pci_dev, Error **errp)
     /* initialize ISA irqs */
     isa_bus_irqs(isa_bus, s->isa);
 
+    /* DMA */
+    i8257_dma_init(isa_bus, 0);
+
     piix4_dev = pci_dev;
 }
 
diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c
index d31e144b70..db5a8b1811 100644
--- a/hw/mips/mips_malta.c
+++ b/hw/mips/mips_malta.c
@@ -28,7 +28,6 @@
 #include "hw/hw.h"
 #include "hw/i386/pc.h"
 #include "hw/isa/superio.h"
-#include "hw/dma/i8257.h"
 #include "hw/char/serial.h"
 #include "net/net.h"
 #include "hw/boards.h"
@@ -1208,7 +1207,6 @@ void mips_malta_init(MachineState *machine)
     smbus = piix4_pm_init(pci_bus, piix4_devfn + 3, 0x1100,
                           isa_get_irq(NULL, 9), NULL, 0, NULL);
     pit = i8254_pit_init(isa_bus, 0x40, 0, NULL);
-    i8257_dma_init(isa_bus, 0);
     mc146818_rtc_init(isa_bus, 2000, NULL);
 
     /* generate SPD EEPROM data */
-- 
2.15.1

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

* [Qemu-devel] [PATCH 19/29] piix4: add a i8254 pit controller as specified in datasheet
  2018-01-08  2:45 [Qemu-devel] [RFC PATCH 00/29] remove i386/pc dependency: generic SuperIO, PIIX cleanup Philippe Mathieu-Daudé
                   ` (17 preceding siblings ...)
  2018-01-08  2:45 ` [Qemu-devel] [PATCH 18/29] piix4: add a i8257 dma controller as specified in datasheet Philippe Mathieu-Daudé
@ 2018-01-08  2:45 ` Philippe Mathieu-Daudé
  2018-01-08  2:45 ` [Qemu-devel] [PATCH 20/29] piix4: add a speaker " Philippe Mathieu-Daudé
                   ` (9 subsequent siblings)
  28 siblings, 0 replies; 32+ messages in thread
From: Philippe Mathieu-Daudé @ 2018-01-08  2:45 UTC (permalink / raw)
  To: Paolo Bonzini, Michael S. Tsirkin, Hervé Poussineau,
	Aurelien Jarno, Eduardo Habkost, Marcel Apfelbaum
  Cc: qemu-devel, Igor Mammedov, Philippe Mathieu-Daudé, Yongbok Kim

From: Hervé Poussineau <hpoussin@reactos.org>

Remove i8254 instanciated in malta board, to not have it twice.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
[PMD: rebased]
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 hw/isa/piix4.c       | 4 ++++
 hw/mips/mips_malta.c | 4 ----
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/hw/isa/piix4.c b/hw/isa/piix4.c
index 56a1c7d429..04b13f97c6 100644
--- a/hw/isa/piix4.c
+++ b/hw/isa/piix4.c
@@ -31,6 +31,7 @@
 #include "hw/southbridge/i82371_piix.h"
 #include "hw/dma/i8257.h"
 #include "hw/sysbus.h"
+#include "hw/timer/i8254.h"
 
 PCIDevice *piix4_dev;
 
@@ -164,6 +165,9 @@ static void piix4_realize(PCIDevice *pci_dev, Error **errp)
     /* initialize ISA irqs */
     isa_bus_irqs(isa_bus, s->isa);
 
+    /* initialize pit */
+    i8254_pit_init(isa_bus, 0x40, 0, NULL);
+
     /* DMA */
     i8257_dma_init(isa_bus, 0);
 
diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c
index db5a8b1811..84b4d5c423 100644
--- a/hw/mips/mips_malta.c
+++ b/hw/mips/mips_malta.c
@@ -44,7 +44,6 @@
 #include "hw/loader.h"
 #include "elf.h"
 #include "hw/timer/mc146818rtc.h"
-#include "hw/timer/i8254.h"
 #include "sysemu/blockdev.h"
 #include "exec/address-spaces.h"
 #include "hw/sysbus.h"             /* SysBusDevice */
@@ -98,8 +97,6 @@ typedef struct {
     qemu_irq i8259[16];
 } MaltaState;
 
-static ISADevice *pit;
-
 static struct _loaderparams {
     int ram_size, ram_low_size;
     const char *kernel_filename;
@@ -1206,7 +1203,6 @@ void mips_malta_init(MachineState *machine)
     pci_create_simple(pci_bus, piix4_devfn + 2, "piix4-usb-uhci");
     smbus = piix4_pm_init(pci_bus, piix4_devfn + 3, 0x1100,
                           isa_get_irq(NULL, 9), NULL, 0, NULL);
-    pit = i8254_pit_init(isa_bus, 0x40, 0, NULL);
     mc146818_rtc_init(isa_bus, 2000, NULL);
 
     /* generate SPD EEPROM data */
-- 
2.15.1

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

* [Qemu-devel] [PATCH 20/29] piix4: add a speaker as specified in datasheet
  2018-01-08  2:45 [Qemu-devel] [RFC PATCH 00/29] remove i386/pc dependency: generic SuperIO, PIIX cleanup Philippe Mathieu-Daudé
                   ` (18 preceding siblings ...)
  2018-01-08  2:45 ` [Qemu-devel] [PATCH 19/29] piix4: add a i8254 pit " Philippe Mathieu-Daudé
@ 2018-01-08  2:45 ` Philippe Mathieu-Daudé
  2018-01-08  2:45 ` [Qemu-devel] [PATCH 21/29] piix: move southbridge related declarations/definitions to i82371_piix.h Philippe Mathieu-Daudé
                   ` (8 subsequent siblings)
  28 siblings, 0 replies; 32+ messages in thread
From: Philippe Mathieu-Daudé @ 2018-01-08  2:45 UTC (permalink / raw)
  To: Paolo Bonzini, Michael S. Tsirkin, Hervé Poussineau,
	Aurelien Jarno, Eduardo Habkost, Marcel Apfelbaum
  Cc: qemu-devel, Igor Mammedov

From: Hervé Poussineau <hpoussin@reactos.org>

Acked-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
---
 hw/isa/piix4.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/hw/isa/piix4.c b/hw/isa/piix4.c
index 04b13f97c6..c78516e595 100644
--- a/hw/isa/piix4.c
+++ b/hw/isa/piix4.c
@@ -31,6 +31,7 @@
 #include "hw/southbridge/i82371_piix.h"
 #include "hw/dma/i8257.h"
 #include "hw/sysbus.h"
+#include "hw/audio/pcspk.h"
 #include "hw/timer/i8254.h"
 
 PCIDevice *piix4_dev;
@@ -142,6 +143,7 @@ static void piix4_realize(PCIDevice *pci_dev, Error **errp)
     DeviceState *dev = DEVICE(pci_dev);
     PIIX4State *s = DO_UPCAST(PIIX4State, dev, pci_dev);
     ISABus *isa_bus;
+    ISADevice *pit;
     qemu_irq *i8259_out_irq;
 
     isa_bus = isa_bus_new(dev, pci_address_space(pci_dev),
@@ -166,7 +168,10 @@ static void piix4_realize(PCIDevice *pci_dev, Error **errp)
     isa_bus_irqs(isa_bus, s->isa);
 
     /* initialize pit */
-    i8254_pit_init(isa_bus, 0x40, 0, NULL);
+    pit = i8254_pit_init(isa_bus, 0x40, 0, NULL);
+
+    /* speaker */
+    pcspk_init(isa_bus, pit);
 
     /* DMA */
     i8257_dma_init(isa_bus, 0);
-- 
2.15.1

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

* [Qemu-devel] [PATCH 21/29] piix: move southbridge related declarations/definitions to i82371_piix.h
  2018-01-08  2:45 [Qemu-devel] [RFC PATCH 00/29] remove i386/pc dependency: generic SuperIO, PIIX cleanup Philippe Mathieu-Daudé
                   ` (19 preceding siblings ...)
  2018-01-08  2:45 ` [Qemu-devel] [PATCH 20/29] piix4: add a speaker " Philippe Mathieu-Daudé
@ 2018-01-08  2:45 ` Philippe Mathieu-Daudé
  2018-01-08  2:45 ` [Qemu-devel] [PATCH 22/29] piix3: extract piix3_init() from i440fx_init() Philippe Mathieu-Daudé
                   ` (7 subsequent siblings)
  28 siblings, 0 replies; 32+ messages in thread
From: Philippe Mathieu-Daudé @ 2018-01-08  2:45 UTC (permalink / raw)
  To: Paolo Bonzini, Michael S. Tsirkin, Hervé Poussineau,
	Aurelien Jarno, Eduardo Habkost, Marcel Apfelbaum
  Cc: Philippe Mathieu-Daudé,
	qemu-devel, Igor Mammedov, Richard Henderson, Yongbok Kim

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 include/hw/acpi/piix4.h              |  6 ------
 include/hw/i386/pc.h                 | 12 ------------
 include/hw/southbridge/i82371_piix.h | 17 +++++++++++++++++
 hw/acpi/piix4.c                      |  2 +-
 hw/i386/acpi-build.c                 |  2 +-
 hw/i386/pc_piix.c                    |  1 +
 hw/mips/mips_malta.c                 |  2 +-
 hw/pci-host/piix.c                   |  1 -
 MAINTAINERS                          |  1 -
 9 files changed, 21 insertions(+), 23 deletions(-)
 delete mode 100644 include/hw/acpi/piix4.h

diff --git a/include/hw/acpi/piix4.h b/include/hw/acpi/piix4.h
deleted file mode 100644
index 26c2370e30..0000000000
--- a/include/hw/acpi/piix4.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef HW_ACPI_PIIX4_H
-#define HW_ACPI_PIIX4_H
-
-Object *piix4_pm_find(void);
-
-#endif
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index 195c02febe..768428db3b 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -236,12 +236,6 @@ int cmos_get_fd_drive_type(FloppyDriveType fd0);
 
 #define PORT92_A20_LINE "a20"
 
-/* acpi_piix.c */
-
-I2CBus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base,
-                      qemu_irq sci_irq, qemu_irq smi_irq,
-                      int smm_enabled, DeviceState **piix4_pm);
-
 /* hpet.c */
 extern int no_hpet;
 
@@ -254,12 +248,6 @@ typedef struct PCII440FXState PCII440FXState;
 
 #define TYPE_IGD_PASSTHROUGH_I440FX_PCI_DEVICE "igd-passthrough-i440FX"
 
-/*
- * Reset Control Register: PCI-accessible ISA-Compatible Register at address
- * 0xcf9, provided by the PCI/ISA bridge (PIIX3 PCI function 0, 8086:7000).
- */
-#define RCR_IOPORT 0xcf9
-
 PCIBus *i440fx_init(const char *host_type, const char *pci_type,
                     PCII440FXState **pi440fx_state, int *piix_devfn,
                     ISABus **isa_bus, qemu_irq *pic,
diff --git a/include/hw/southbridge/i82371_piix.h b/include/hw/southbridge/i82371_piix.h
index 95ac25becd..8a5f9a7596 100644
--- a/include/hw/southbridge/i82371_piix.h
+++ b/include/hw/southbridge/i82371_piix.h
@@ -10,8 +10,25 @@
 #define HW_ISA_PIIX_H
 
 #include "hw/pci/pci.h"
+#include "hw/isa/isa.h"
+
+#define TYPE_PIIX4_PCI_DEVICE "PIIX4"
+
+#define PIIX_NUM_PIRQS          4ULL    /* PIRQ[A-D] */
+
+/*
+ * Reset Control Register: PCI-accessible ISA-Compatible Register at address
+ * 0xcf9, provided by the PCI/ISA bridge (PIIX3 PCI function 0, 8086:7000).
+ */
+#define RCR_IOPORT 0xcf9
 
 /* piix4.c */
 extern PCIDevice *piix4_dev;
 
+/* acpi_piix.c */
+Object *piix4_pm_find(void);
+I2CBus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base,
+                      qemu_irq sci_irq, qemu_irq smi_irq,
+                      int smm_enabled, DeviceState **piix4_pm);
+
 #endif /* HW_ISA_PIIX_H */
diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c
index 32caa4f0fc..7e37587f3a 100644
--- a/hw/acpi/piix4.c
+++ b/hw/acpi/piix4.c
@@ -21,6 +21,7 @@
 #include "qemu/osdep.h"
 #include "hw/hw.h"
 #include "hw/i386/pc.h"
+#include "hw/southbridge/i82371_piix.h"
 #include "hw/isa/apm.h"
 #include "hw/i2c/pm_smbus.h"
 #include "hw/pci/pci.h"
@@ -31,7 +32,6 @@
 #include "exec/ioport.h"
 #include "hw/nvram/fw_cfg.h"
 #include "exec/address-spaces.h"
-#include "hw/acpi/piix4.h"
 #include "hw/acpi/pcihp.h"
 #include "hw/acpi/cpu_hotplug.h"
 #include "hw/acpi/cpu.h"
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 5a6dee081c..d166187bc5 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -48,7 +48,7 @@
 #include "sysemu/numa.h"
 
 /* Supported chipsets: */
-#include "hw/acpi/piix4.h"
+#include "hw/southbridge/i82371_piix.h"
 #include "hw/acpi/pcihp.h"
 #include "hw/i386/ich9.h"
 #include "hw/pci/pci_bus.h"
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index 5e47528993..89606c85db 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -31,6 +31,7 @@
 #include "hw/smbios/smbios.h"
 #include "hw/pci/pci.h"
 #include "hw/pci/pci_ids.h"
+#include "hw/southbridge/i82371_piix.h"
 #include "hw/usb.h"
 #include "net/net.h"
 #include "hw/boards.h"
diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c
index 84b4d5c423..03fe98e35e 100644
--- a/hw/mips/mips_malta.c
+++ b/hw/mips/mips_malta.c
@@ -26,7 +26,7 @@
 #include "qemu-common.h"
 #include "cpu.h"
 #include "hw/hw.h"
-#include "hw/i386/pc.h"
+#include "hw/southbridge/i82371_piix.h"
 #include "hw/isa/superio.h"
 #include "hw/char/serial.h"
 #include "net/net.h"
diff --git a/hw/pci-host/piix.c b/hw/pci-host/piix.c
index a684a7cca9..0bd22fa33a 100644
--- a/hw/pci-host/piix.c
+++ b/hw/pci-host/piix.c
@@ -55,7 +55,6 @@ typedef struct I440FXState {
 } I440FXState;
 
 #define PIIX_NUM_PIC_IRQS       16      /* i8259 * 2 */
-#define PIIX_NUM_PIRQS          4ULL    /* PIRQ[A-D] */
 #define XEN_PIIX_NUM_PIRQS      128ULL
 #define PIIX_PIRQC              0x60
 
diff --git a/MAINTAINERS b/MAINTAINERS
index cead15b69b..968f32f93d 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -859,7 +859,6 @@ F: hw/i2c/smbus_ich9.c
 F: hw/acpi/piix4.c
 F: hw/acpi/ich9.c
 F: include/hw/acpi/ich9.h
-F: include/hw/acpi/piix4.h
 F: hw/misc/sga.c
 
 PC Chipset
-- 
2.15.1

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

* [Qemu-devel] [PATCH 22/29] piix3: extract piix3_init() from i440fx_init()
  2018-01-08  2:45 [Qemu-devel] [RFC PATCH 00/29] remove i386/pc dependency: generic SuperIO, PIIX cleanup Philippe Mathieu-Daudé
                   ` (20 preceding siblings ...)
  2018-01-08  2:45 ` [Qemu-devel] [PATCH 21/29] piix: move southbridge related declarations/definitions to i82371_piix.h Philippe Mathieu-Daudé
@ 2018-01-08  2:45 ` Philippe Mathieu-Daudé
  2018-01-08  2:45 ` [Qemu-devel] [PATCH 23/29] hw/i386: extract i440fx related declarations/definitions to i440fx.h Philippe Mathieu-Daudé
                   ` (6 subsequent siblings)
  28 siblings, 0 replies; 32+ messages in thread
From: Philippe Mathieu-Daudé @ 2018-01-08  2:45 UTC (permalink / raw)
  To: Paolo Bonzini, Michael S. Tsirkin, Hervé Poussineau,
	Aurelien Jarno, Eduardo Habkost, Marcel Apfelbaum
  Cc: Philippe Mathieu-Daudé, qemu-devel, Igor Mammedov

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 include/hw/southbridge/i82371_piix.h |  4 +++
 hw/pci-host/piix.c                   | 62 ++++++++++++++++++++----------------
 2 files changed, 38 insertions(+), 28 deletions(-)

diff --git a/include/hw/southbridge/i82371_piix.h b/include/hw/southbridge/i82371_piix.h
index 8a5f9a7596..00a9f4d5b9 100644
--- a/include/hw/southbridge/i82371_piix.h
+++ b/include/hw/southbridge/i82371_piix.h
@@ -22,6 +22,10 @@
  */
 #define RCR_IOPORT 0xcf9
 
+/* piix.c */
+PCIDevice *piix3_init(PCIBus *bus, ISABus **isa_bus,
+                      qemu_irq *pic, int *piix3_devfn);
+
 /* piix4.c */
 extern PCIDevice *piix4_dev;
 
diff --git a/hw/pci-host/piix.c b/hw/pci-host/piix.c
index 0bd22fa33a..6e8cea8372 100644
--- a/hw/pci-host/piix.c
+++ b/hw/pci-host/piix.c
@@ -27,6 +27,7 @@
 #include "hw/i386/pc.h"
 #include "hw/pci/pci.h"
 #include "hw/pci/pci_host.h"
+#include "hw/southbridge/i82371_piix.h"
 #include "hw/isa/isa.h"
 #include "hw/sysbus.h"
 #include "qapi/error.h"
@@ -120,11 +121,6 @@ struct PCII440FXState {
  */
 #define I440FX_COREBOOT_RAM_SIZE 0x57
 
-static void piix3_set_irq(void *opaque, int pirq, int level);
-static PCIINTxRoute piix3_route_intx_pin_to_irq(void *opaque, int pci_intx);
-static void piix3_write_config_xen(PCIDevice *dev,
-                               uint32_t address, uint32_t val, int len);
-
 /* return the global irq number corresponding to a given device irq
    pin. We could also use the bus number to have a more precise
    mapping. */
@@ -353,7 +349,6 @@ PCIBus *i440fx_init(const char *host_type, const char *pci_type,
     PCIBus *b;
     PCIDevice *d;
     PCIHostState *s;
-    PIIX3State *piix3;
     PCII440FXState *f;
     unsigned i;
     I440FXState *i440fx;
@@ -406,28 +401,7 @@ PCIBus *i440fx_init(const char *host_type, const char *pci_type,
                  PAM_EXPAN_SIZE);
     }
 
-    /* Xen supports additional interrupt routes from the PCI devices to
-     * the IOAPIC: the four pins of each PCI device on the bus are also
-     * connected to the IOAPIC directly.
-     * These additional routes can be discovered through ACPI. */
-    if (xen_enabled()) {
-        PCIDevice *pci_dev = pci_create_simple_multifunction(b,
-                             -1, true, "PIIX3-xen");
-        piix3 = PIIX3_PCI_DEVICE(pci_dev);
-        pci_bus_irqs(b, xen_piix3_set_irq, xen_pci_slot_get_pirq,
-                piix3, XEN_PIIX_NUM_PIRQS);
-    } else {
-        PCIDevice *pci_dev = pci_create_simple_multifunction(b,
-                             -1, true, "PIIX3");
-        piix3 = PIIX3_PCI_DEVICE(pci_dev);
-        pci_bus_irqs(b, piix3_set_irq, pci_slot_get_pirq, piix3,
-                PIIX_NUM_PIRQS);
-        pci_bus_set_route_irq_fn(b, piix3_route_intx_pin_to_irq);
-    }
-    piix3->pic = pic;
-    *isa_bus = ISA_BUS(qdev_get_child_bus(DEVICE(piix3), "isa.0"));
-
-    *piix3_devfn = piix3->dev.devfn;
+    piix3_init(b, isa_bus, pic, piix3_devfn);
 
     ram_size = ram_size / 8 / 1024 / 1024;
     if (ram_size > 255) {
@@ -508,6 +482,38 @@ static PCIINTxRoute piix3_route_intx_pin_to_irq(void *opaque, int pin)
     return route;
 }
 
+PCIDevice *piix3_init(PCIBus *bus, ISABus **isa_bus,
+                      qemu_irq *pic, int *piix3_devfn)
+{
+    PCIDevice *pci_dev;
+    PIIX3State *piix3;
+
+    /* Xen supports additional interrupt routes from the PCI devices to
+     * the IOAPIC: the four pins of each PCI device on the bus are also
+     * connected to the IOAPIC directly.
+     * These additional routes can be discovered through ACPI. */
+    if (xen_enabled()) {
+        pci_dev = pci_create_simple_multifunction(bus,
+                             -1, true, "PIIX3-xen");
+        piix3 = PIIX3_PCI_DEVICE(pci_dev);
+        pci_bus_irqs(bus, xen_piix3_set_irq, xen_pci_slot_get_pirq,
+                piix3, XEN_PIIX_NUM_PIRQS);
+    } else {
+        pci_dev = pci_create_simple_multifunction(bus,
+                             -1, true, "PIIX3");
+        piix3 = PIIX3_PCI_DEVICE(pci_dev);
+        pci_bus_irqs(bus, piix3_set_irq, pci_slot_get_pirq, piix3,
+                PIIX_NUM_PIRQS);
+        pci_bus_set_route_irq_fn(bus, piix3_route_intx_pin_to_irq);
+    }
+    piix3->pic = pic;
+    *isa_bus = ISA_BUS(qdev_get_child_bus(DEVICE(piix3), "isa.0"));
+
+    *piix3_devfn = piix3->dev.devfn;
+
+    return pci_dev;
+}
+
 /* irq routing is changed. so rebuild bitmap */
 static void piix3_update_irq_levels(PIIX3State *piix3)
 {
-- 
2.15.1

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

* [Qemu-devel] [PATCH 23/29] hw/i386: extract i440fx related declarations/definitions to i440fx.h
  2018-01-08  2:45 [Qemu-devel] [RFC PATCH 00/29] remove i386/pc dependency: generic SuperIO, PIIX cleanup Philippe Mathieu-Daudé
                   ` (21 preceding siblings ...)
  2018-01-08  2:45 ` [Qemu-devel] [PATCH 22/29] piix3: extract piix3_init() from i440fx_init() Philippe Mathieu-Daudé
@ 2018-01-08  2:45 ` Philippe Mathieu-Daudé
  2018-01-08  2:45 ` [Qemu-devel] [PATCH 24/29] hw/i386: extract i440fx code from piix.c into i440fx.c Philippe Mathieu-Daudé
                   ` (5 subsequent siblings)
  28 siblings, 0 replies; 32+ messages in thread
From: Philippe Mathieu-Daudé @ 2018-01-08  2:45 UTC (permalink / raw)
  To: Paolo Bonzini, Michael S. Tsirkin, Hervé Poussineau,
	Aurelien Jarno, Eduardo Habkost, Marcel Apfelbaum
  Cc: Philippe Mathieu-Daudé,
	qemu-devel, Igor Mammedov, Richard Henderson

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 include/hw/i386/pc.h         | 22 -------------------
 include/hw/pci-host/i440fx.h | 51 ++++++++++++++++++++++++++++++++++++++++++++
 hw/acpi/pcihp.c              |  2 +-
 hw/i386/pc_piix.c            |  1 +
 hw/pci-host/piix.c           |  1 +
 stubs/pci-host-piix.c        |  3 ++-
 MAINTAINERS                  |  1 +
 7 files changed, 57 insertions(+), 24 deletions(-)
 create mode 100644 include/hw/pci-host/i440fx.h

diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index 768428db3b..b63fdbd9e2 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -239,28 +239,6 @@ int cmos_get_fd_drive_type(FloppyDriveType fd0);
 /* hpet.c */
 extern int no_hpet;
 
-/* piix_pci.c */
-struct PCII440FXState;
-typedef struct PCII440FXState PCII440FXState;
-
-#define TYPE_I440FX_PCI_HOST_BRIDGE "i440FX-pcihost"
-#define TYPE_I440FX_PCI_DEVICE "i440FX"
-
-#define TYPE_IGD_PASSTHROUGH_I440FX_PCI_DEVICE "igd-passthrough-i440FX"
-
-PCIBus *i440fx_init(const char *host_type, const char *pci_type,
-                    PCII440FXState **pi440fx_state, int *piix_devfn,
-                    ISABus **isa_bus, qemu_irq *pic,
-                    MemoryRegion *address_space_mem,
-                    MemoryRegion *address_space_io,
-                    ram_addr_t ram_size,
-                    ram_addr_t below_4g_mem_size,
-                    ram_addr_t above_4g_mem_size,
-                    MemoryRegion *pci_memory,
-                    MemoryRegion *ram_memory);
-
-PCIBus *find_i440fx(void);
-
 /* pc_sysfw.c */
 void pc_system_firmware_init(MemoryRegion *rom_memory,
                              bool isapc_ram_fw);
diff --git a/include/hw/pci-host/i440fx.h b/include/hw/pci-host/i440fx.h
new file mode 100644
index 0000000000..c796382d52
--- /dev/null
+++ b/include/hw/pci-host/i440fx.h
@@ -0,0 +1,51 @@
+/*
+ * QEMU i440FX North Bridge Emulation
+ *
+ * Copyright (c) 2006 Fabrice Bellard
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+#ifndef HW_PCI_HOST_I440FX_H
+#define HW_PCI_HOST_I440FX_H
+
+#include "qemu-common.h"
+#include "hw/hw.h"
+
+struct PCII440FXState;
+typedef struct PCII440FXState PCII440FXState;
+
+#define TYPE_I440FX_PCI_HOST_BRIDGE "i440FX-pcihost"
+#define TYPE_I440FX_PCI_DEVICE "i440FX"
+
+#define TYPE_IGD_PASSTHROUGH_I440FX_PCI_DEVICE "igd-passthrough-i440FX"
+
+PCIBus *i440fx_init(const char *host_type, const char *pci_type,
+                    PCII440FXState **pi440fx_state, int *piix_devfn,
+                    ISABus **isa_bus, qemu_irq *pic,
+                    MemoryRegion *address_space_mem,
+                    MemoryRegion *address_space_io,
+                    ram_addr_t ram_size,
+                    ram_addr_t below_4g_mem_size,
+                    ram_addr_t above_4g_mem_size,
+                    MemoryRegion *pci_memory,
+                    MemoryRegion *ram_memory);
+
+PCIBus *find_i440fx(void);
+
+#endif /* HW_PCI_HOST_I440FX_H */
diff --git a/hw/acpi/pcihp.c b/hw/acpi/pcihp.c
index 7da51c0569..51a65a34a1 100644
--- a/hw/acpi/pcihp.c
+++ b/hw/acpi/pcihp.c
@@ -28,8 +28,8 @@
 #include "hw/acpi/pcihp.h"
 
 #include "hw/hw.h"
-#include "hw/i386/pc.h"
 #include "hw/pci/pci.h"
+#include "hw/pci-host/i440fx.h"
 #include "hw/acpi/acpi.h"
 #include "sysemu/sysemu.h"
 #include "exec/ioport.h"
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index 89606c85db..326ca302dc 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -31,6 +31,7 @@
 #include "hw/smbios/smbios.h"
 #include "hw/pci/pci.h"
 #include "hw/pci/pci_ids.h"
+#include "hw/pci-host/i440fx.h"
 #include "hw/southbridge/i82371_piix.h"
 #include "hw/usb.h"
 #include "net/net.h"
diff --git a/hw/pci-host/piix.c b/hw/pci-host/piix.c
index 6e8cea8372..6f963b5a07 100644
--- a/hw/pci-host/piix.c
+++ b/hw/pci-host/piix.c
@@ -27,6 +27,7 @@
 #include "hw/i386/pc.h"
 #include "hw/pci/pci.h"
 #include "hw/pci/pci_host.h"
+#include "hw/pci-host/i440fx.h"
 #include "hw/southbridge/i82371_piix.h"
 #include "hw/isa/isa.h"
 #include "hw/sysbus.h"
diff --git a/stubs/pci-host-piix.c b/stubs/pci-host-piix.c
index 6ed81b1f21..93975adbfe 100644
--- a/stubs/pci-host-piix.c
+++ b/stubs/pci-host-piix.c
@@ -1,5 +1,6 @@
 #include "qemu/osdep.h"
-#include "hw/i386/pc.h"
+#include "hw/pci-host/i440fx.h"
+
 PCIBus *find_i440fx(void)
 {
     return NULL;
diff --git a/MAINTAINERS b/MAINTAINERS
index 968f32f93d..c3efcd2316 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -859,6 +859,7 @@ F: hw/i2c/smbus_ich9.c
 F: hw/acpi/piix4.c
 F: hw/acpi/ich9.c
 F: include/hw/acpi/ich9.h
+F: include/hw/pci-host/i440fx.h
 F: hw/misc/sga.c
 
 PC Chipset
-- 
2.15.1

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

* [Qemu-devel] [PATCH 24/29] hw/i386: extract i440fx code from piix.c into i440fx.c
  2018-01-08  2:45 [Qemu-devel] [RFC PATCH 00/29] remove i386/pc dependency: generic SuperIO, PIIX cleanup Philippe Mathieu-Daudé
                   ` (22 preceding siblings ...)
  2018-01-08  2:45 ` [Qemu-devel] [PATCH 23/29] hw/i386: extract i440fx related declarations/definitions to i440fx.h Philippe Mathieu-Daudé
@ 2018-01-08  2:45 ` Philippe Mathieu-Daudé
  2018-01-08  2:45 ` [Qemu-devel] [PATCH 25/29] hw/i386: move piix from hw/pci-host to hw/southbridge Philippe Mathieu-Daudé
                   ` (4 subsequent siblings)
  28 siblings, 0 replies; 32+ messages in thread
From: Philippe Mathieu-Daudé @ 2018-01-08  2:45 UTC (permalink / raw)
  To: Paolo Bonzini, Michael S. Tsirkin, Hervé Poussineau,
	Aurelien Jarno, Eduardo Habkost, Marcel Apfelbaum
  Cc: Philippe Mathieu-Daudé, qemu-devel, Igor Mammedov

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 default-configs/i386-softmmu.mak   |   1 +
 default-configs/x86_64-softmmu.mak |   1 +
 hw/pci-host/i440fx.c               | 543 +++++++++++++++++++++++++++++++++++++
 hw/pci-host/piix.c                 | 522 +----------------------------------
 MAINTAINERS                        |   1 +
 hw/pci-host/Makefile.objs          |   1 +
 6 files changed, 552 insertions(+), 517 deletions(-)
 create mode 100644 hw/pci-host/i440fx.c

diff --git a/default-configs/i386-softmmu.mak b/default-configs/i386-softmmu.mak
index 95ac4b464a..c7e4af01a5 100644
--- a/default-configs/i386-softmmu.mak
+++ b/default-configs/i386-softmmu.mak
@@ -38,6 +38,7 @@ CONFIG_I8259=y
 CONFIG_PFLASH_CFI01=y
 CONFIG_TPM_TIS=$(CONFIG_TPM)
 CONFIG_MC146818RTC=y
+CONFIG_PCI_I440FX=y
 CONFIG_PCI_PIIX=y
 CONFIG_WDT_IB700=y
 CONFIG_ISA_DEBUG=y
diff --git a/default-configs/x86_64-softmmu.mak b/default-configs/x86_64-softmmu.mak
index 0221236825..926997fe60 100644
--- a/default-configs/x86_64-softmmu.mak
+++ b/default-configs/x86_64-softmmu.mak
@@ -38,6 +38,7 @@ CONFIG_I8259=y
 CONFIG_PFLASH_CFI01=y
 CONFIG_TPM_TIS=$(CONFIG_TPM)
 CONFIG_MC146818RTC=y
+CONFIG_PCI_I440FX=y
 CONFIG_PCI_PIIX=y
 CONFIG_WDT_IB700=y
 CONFIG_ISA_DEBUG=y
diff --git a/hw/pci-host/i440fx.c b/hw/pci-host/i440fx.c
new file mode 100644
index 0000000000..76968f8fbf
--- /dev/null
+++ b/hw/pci-host/i440fx.c
@@ -0,0 +1,543 @@
+/*
+ * QEMU i440FX North Bridge Emulation
+ *
+ * Copyright (c) 2006 Fabrice Bellard
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include "qemu/osdep.h"
+#include "qemu/error-report.h"
+#include "qapi/error.h"
+#include "qapi/visitor.h"
+#include "hw/hw.h"
+#include "hw/i386/pc.h"
+#include "hw/pci/pci.h"
+#include "hw/pci/pci_host.h"
+#include "hw/pci-host/pam.h"
+#include "hw/pci-host/i440fx.h"
+#include "hw/southbridge/i82371_piix.h"
+
+/*
+ * I440FX chipset data sheet.
+ * http://download.intel.com/design/chipsets/datashts/29054901.pdf
+ */
+
+#define I440FX_PCI_HOST_BRIDGE(obj) \
+    OBJECT_CHECK(I440FXState, (obj), TYPE_I440FX_PCI_HOST_BRIDGE)
+
+typedef struct I440FXState {
+    PCIHostState parent_obj;
+    Range pci_hole;
+    uint64_t pci_hole64_size;
+    bool pci_hole64_fix;
+    uint32_t short_root_bus;
+} I440FXState;
+
+#define I440FX_PCI_DEVICE(obj) \
+    OBJECT_CHECK(PCII440FXState, (obj), TYPE_I440FX_PCI_DEVICE)
+
+struct PCII440FXState {
+    /*< private >*/
+    PCIDevice parent_obj;
+    /*< public >*/
+
+    MemoryRegion *system_memory;
+    MemoryRegion *pci_address_space;
+    MemoryRegion *ram_memory;
+    PAMMemoryRegion pam_regions[13];
+    MemoryRegion smram_region;
+    MemoryRegion smram, low_smram;
+};
+
+
+#define I440FX_PAM      0x59
+#define I440FX_PAM_SIZE 7
+#define I440FX_SMRAM    0x72
+
+/* Keep it 2G to comply with older win32 guests */
+#define I440FX_PCI_HOST_HOLE64_SIZE_DEFAULT (1ULL << 31)
+
+/* Older coreboot versions (4.0 and older) read a config register that doesn't
+ * exist in real hardware, to get the RAM size from QEMU.
+ */
+#define I440FX_COREBOOT_RAM_SIZE 0x57
+
+static void i440fx_update_memory_mappings(PCII440FXState *d)
+{
+    int i;
+    PCIDevice *pd = PCI_DEVICE(d);
+
+    memory_region_transaction_begin();
+    for (i = 0; i < 13; i++) {
+        pam_update(&d->pam_regions[i], i,
+                   pd->config[I440FX_PAM + (DIV_ROUND_UP(i, 2))]);
+    }
+    memory_region_set_enabled(&d->smram_region,
+                              !(pd->config[I440FX_SMRAM] & SMRAM_D_OPEN));
+    memory_region_set_enabled(&d->smram,
+                              pd->config[I440FX_SMRAM] & SMRAM_G_SMRAME);
+    memory_region_transaction_commit();
+}
+
+
+static void i440fx_write_config(PCIDevice *dev,
+                                uint32_t address, uint32_t val, int len)
+{
+    PCII440FXState *d = I440FX_PCI_DEVICE(dev);
+
+    /* XXX: implement SMRAM.D_LOCK */
+    pci_default_write_config(dev, address, val, len);
+    if (ranges_overlap(address, len, I440FX_PAM, I440FX_PAM_SIZE) ||
+        range_covers_byte(address, len, I440FX_SMRAM)) {
+        i440fx_update_memory_mappings(d);
+    }
+}
+
+static int i440fx_load_old(QEMUFile *f, void *opaque, int version_id)
+{
+    PCII440FXState *d = opaque;
+    PCIDevice *pd = PCI_DEVICE(d);
+    int ret, i;
+    uint8_t smm_enabled;
+
+    ret = pci_device_load(pd, f);
+    if (ret < 0) {
+        return ret;
+    }
+    i440fx_update_memory_mappings(d);
+    qemu_get_8s(f, &smm_enabled);
+
+    if (version_id == 2) {
+        for (i = 0; i < PIIX_NUM_PIRQS; i++) {
+            qemu_get_be32(f); /* dummy load for compatibility */
+        }
+    }
+
+    return 0;
+}
+
+static int i440fx_post_load(void *opaque, int version_id)
+{
+    PCII440FXState *d = opaque;
+
+    i440fx_update_memory_mappings(d);
+    return 0;
+}
+
+static const VMStateDescription vmstate_i440fx = {
+    .name = "I440FX",
+    .version_id = 3,
+    .minimum_version_id = 3,
+    .minimum_version_id_old = 1,
+    .load_state_old = i440fx_load_old,
+    .post_load = i440fx_post_load,
+    .fields = (VMStateField[]) {
+        VMSTATE_PCI_DEVICE(parent_obj, PCII440FXState),
+        /* Used to be smm_enabled, which was basically always zero because
+         * SeaBIOS hardly uses SMM.  SMRAM is now handled by CPU code.
+         */
+        VMSTATE_UNUSED(1),
+        VMSTATE_END_OF_LIST()
+    }
+};
+
+static void i440fx_pcihost_get_pci_hole_start(Object *obj, Visitor *v,
+                                              const char *name, void *opaque,
+                                              Error **errp)
+{
+    I440FXState *s = I440FX_PCI_HOST_BRIDGE(obj);
+    uint64_t val64;
+    uint32_t value;
+
+    val64 = range_is_empty(&s->pci_hole) ? 0 : range_lob(&s->pci_hole);
+    value = val64;
+    assert(value == val64);
+    visit_type_uint32(v, name, &value, errp);
+}
+
+static void i440fx_pcihost_get_pci_hole_end(Object *obj, Visitor *v,
+                                            const char *name, void *opaque,
+                                            Error **errp)
+{
+    I440FXState *s = I440FX_PCI_HOST_BRIDGE(obj);
+    uint64_t val64;
+    uint32_t value;
+
+    val64 = range_is_empty(&s->pci_hole) ? 0 : range_upb(&s->pci_hole) + 1;
+    value = val64;
+    assert(value == val64);
+    visit_type_uint32(v, name, &value, errp);
+}
+
+/*
+ * The 64bit PCI hole start is set by the Guest firmware
+ * as the address of the first 64bit PCI MEM resource.
+ * If no PCI device has resources on the 64bit area,
+ * the 64bit PCI hole will start after "over 4G RAM" and the
+ * reserved space for memory hotplug if any.
+ */
+static void i440fx_pcihost_get_pci_hole64_start(Object *obj, Visitor *v,
+                                                const char *name,
+                                                void *opaque, Error **errp)
+{
+    PCIHostState *h = PCI_HOST_BRIDGE(obj);
+    I440FXState *s = I440FX_PCI_HOST_BRIDGE(obj);
+    Range w64;
+    uint64_t value;
+
+    pci_bus_get_w64_range(h->bus, &w64);
+    value = range_is_empty(&w64) ? 0 : range_lob(&w64);
+    if (!value && s->pci_hole64_fix) {
+        value = pc_pci_hole64_start();
+    }
+    visit_type_uint64(v, name, &value, errp);
+}
+
+/*
+ * The 64bit PCI hole end is set by the Guest firmware
+ * as the address of the last 64bit PCI MEM resource.
+ * Then it is expanded to the PCI_HOST_PROP_PCI_HOLE64_SIZE
+ * that can be configured by the user.
+ */
+static void i440fx_pcihost_get_pci_hole64_end(Object *obj, Visitor *v,
+                                              const char *name, void *opaque,
+                                              Error **errp)
+{
+    PCIHostState *h = PCI_HOST_BRIDGE(obj);
+    I440FXState *s = I440FX_PCI_HOST_BRIDGE(obj);
+    uint64_t hole64_start = pc_pci_hole64_start();
+    Range w64;
+    uint64_t value, hole64_end;
+
+    pci_bus_get_w64_range(h->bus, &w64);
+    value = range_is_empty(&w64) ? 0 : range_upb(&w64) + 1;
+    hole64_end = ROUND_UP(hole64_start + s->pci_hole64_size, 1ULL << 30);
+    if (s->pci_hole64_fix && value < hole64_end) {
+        value = hole64_end;
+    }
+    visit_type_uint64(v, name, &value, errp);
+}
+
+static void i440fx_pcihost_initfn(Object *obj)
+{
+    PCIHostState *s = PCI_HOST_BRIDGE(obj);
+
+    memory_region_init_io(&s->conf_mem, obj, &pci_host_conf_le_ops, s,
+                          "pci-conf-idx", 4);
+    memory_region_init_io(&s->data_mem, obj, &pci_host_data_le_ops, s,
+                          "pci-conf-data", 4);
+
+    object_property_add(obj, PCI_HOST_PROP_PCI_HOLE_START, "uint32",
+                        i440fx_pcihost_get_pci_hole_start,
+                        NULL, NULL, NULL, NULL);
+
+    object_property_add(obj, PCI_HOST_PROP_PCI_HOLE_END, "uint32",
+                        i440fx_pcihost_get_pci_hole_end,
+                        NULL, NULL, NULL, NULL);
+
+    object_property_add(obj, PCI_HOST_PROP_PCI_HOLE64_START, "uint64",
+                        i440fx_pcihost_get_pci_hole64_start,
+                        NULL, NULL, NULL, NULL);
+
+    object_property_add(obj, PCI_HOST_PROP_PCI_HOLE64_END, "uint64",
+                        i440fx_pcihost_get_pci_hole64_end,
+                        NULL, NULL, NULL, NULL);
+}
+
+static void i440fx_pcihost_realize(DeviceState *dev, Error **errp)
+{
+    PCIHostState *s = PCI_HOST_BRIDGE(dev);
+    SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
+
+    sysbus_add_io(sbd, 0xcf8, &s->conf_mem);
+    sysbus_init_ioports(sbd, 0xcf8, 4);
+
+    sysbus_add_io(sbd, 0xcfc, &s->data_mem);
+    sysbus_init_ioports(sbd, 0xcfc, 4);
+}
+
+static void i440fx_realize(PCIDevice *dev, Error **errp)
+{
+    dev->config[I440FX_SMRAM] = 0x02;
+
+    if (object_property_get_bool(qdev_get_machine(), "iommu", NULL)) {
+        warn_report("i440fx doesn't support emulated iommu");
+    }
+}
+
+PCIBus *i440fx_init(const char *host_type, const char *pci_type,
+                    PCII440FXState **pi440fx_state,
+                    int *piix3_devfn,
+                    ISABus **isa_bus, qemu_irq *pic,
+                    MemoryRegion *address_space_mem,
+                    MemoryRegion *address_space_io,
+                    ram_addr_t ram_size,
+                    ram_addr_t below_4g_mem_size,
+                    ram_addr_t above_4g_mem_size,
+                    MemoryRegion *pci_address_space,
+                    MemoryRegion *ram_memory)
+{
+    DeviceState *dev;
+    PCIBus *b;
+    PCIDevice *d;
+    PCIHostState *s;
+    PCII440FXState *f;
+    unsigned i;
+    I440FXState *i440fx;
+
+    dev = qdev_create(NULL, host_type);
+    s = PCI_HOST_BRIDGE(dev);
+    b = pci_bus_new(dev, NULL, pci_address_space,
+                    address_space_io, 0, TYPE_PCI_BUS);
+    s->bus = b;
+    object_property_add_child(qdev_get_machine(), "i440fx", OBJECT(dev), NULL);
+    qdev_init_nofail(dev);
+
+    d = pci_create_simple(b, 0, pci_type);
+    *pi440fx_state = I440FX_PCI_DEVICE(d);
+    f = *pi440fx_state;
+    f->system_memory = address_space_mem;
+    f->pci_address_space = pci_address_space;
+    f->ram_memory = ram_memory;
+
+    i440fx = I440FX_PCI_HOST_BRIDGE(dev);
+    range_set_bounds(&i440fx->pci_hole, below_4g_mem_size,
+                     IO_APIC_DEFAULT_ADDRESS - 1);
+
+    /* setup pci memory mapping */
+    pc_pci_as_mapping_init(OBJECT(f), f->system_memory,
+                           f->pci_address_space);
+
+    /* if *disabled* show SMRAM to all CPUs */
+    memory_region_init_alias(&f->smram_region, OBJECT(d), "smram-region",
+                             f->pci_address_space, 0xa0000, 0x20000);
+    memory_region_add_subregion_overlap(f->system_memory, 0xa0000,
+                                        &f->smram_region, 1);
+    memory_region_set_enabled(&f->smram_region, true);
+
+    /* smram, as seen by SMM CPUs */
+    memory_region_init(&f->smram, OBJECT(d), "smram", 1ull << 32);
+    memory_region_set_enabled(&f->smram, true);
+    memory_region_init_alias(&f->low_smram, OBJECT(d), "smram-low",
+                             f->ram_memory, 0xa0000, 0x20000);
+    memory_region_set_enabled(&f->low_smram, true);
+    memory_region_add_subregion(&f->smram, 0xa0000, &f->low_smram);
+    object_property_add_const_link(qdev_get_machine(), "smram",
+                                   OBJECT(&f->smram), &error_abort);
+
+    init_pam(dev, f->ram_memory, f->system_memory, f->pci_address_space,
+             &f->pam_regions[0], PAM_BIOS_BASE, PAM_BIOS_SIZE);
+    for (i = 0; i < 12; ++i) {
+        init_pam(dev, f->ram_memory, f->system_memory, f->pci_address_space,
+                 &f->pam_regions[i + 1], PAM_EXPAN_BASE + i * PAM_EXPAN_SIZE,
+                 PAM_EXPAN_SIZE);
+    }
+
+    piix3_init(b, isa_bus, pic, piix3_devfn);
+
+    ram_size = ram_size / 8 / 1024 / 1024;
+    if (ram_size > 255) {
+        ram_size = 255;
+    }
+    d->config[I440FX_COREBOOT_RAM_SIZE] = ram_size;
+
+    i440fx_update_memory_mappings(f);
+
+    return b;
+}
+
+PCIBus *find_i440fx(void)
+{
+    PCIHostState *s = OBJECT_CHECK(PCIHostState,
+                                   object_resolve_path("/machine/i440fx", NULL),
+                                   TYPE_PCI_HOST_BRIDGE);
+    return s ? s->bus : NULL;
+}
+
+static void i440fx_class_init(ObjectClass *klass, void *data)
+{
+    DeviceClass *dc = DEVICE_CLASS(klass);
+    PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
+
+    k->realize = i440fx_realize;
+    k->config_write = i440fx_write_config;
+    k->vendor_id = PCI_VENDOR_ID_INTEL;
+    k->device_id = PCI_DEVICE_ID_INTEL_82441;
+    k->revision = 0x02;
+    k->class_id = PCI_CLASS_BRIDGE_HOST;
+    dc->desc = "Host bridge";
+    dc->vmsd = &vmstate_i440fx;
+    /*
+     * PCI-facing part of the host bridge, not usable without the
+     * host-facing part, which can't be device_add'ed, yet.
+     */
+    dc->user_creatable = false;
+    dc->hotpluggable   = false;
+}
+
+static const TypeInfo i440fx_info = {
+    .name          = TYPE_I440FX_PCI_DEVICE,
+    .parent        = TYPE_PCI_DEVICE,
+    .instance_size = sizeof(PCII440FXState),
+    .class_init    = i440fx_class_init,
+    .interfaces = (InterfaceInfo[]) {
+        { INTERFACE_CONVENTIONAL_PCI_DEVICE },
+        { },
+    },
+};
+
+/* IGD Passthrough Host Bridge. */
+typedef struct {
+    uint8_t offset;
+    uint8_t len;
+} IGDHostInfo;
+
+/* Here we just expose minimal host bridge offset subset. */
+static const IGDHostInfo igd_host_bridge_infos[] = {
+    {0x08, 2},  /* revision id */
+    {0x2c, 2},  /* sybsystem vendor id */
+    {0x2e, 2},  /* sybsystem id */
+    {0x50, 2},  /* SNB: processor graphics control register */
+    {0x52, 2},  /* processor graphics control register */
+    {0xa4, 4},  /* SNB: graphics base of stolen memory */
+    {0xa8, 4},  /* SNB: base of GTT stolen memory */
+};
+
+static int host_pci_config_read(int pos, int len, uint32_t *val)
+{
+    char path[PATH_MAX];
+    int config_fd;
+    ssize_t size = sizeof(path);
+    /* Access real host bridge. */
+    int rc = snprintf(path, size, "/sys/bus/pci/devices/%04x:%02x:%02x.%d/%s",
+                      0, 0, 0, 0, "config");
+    int ret = 0;
+
+    if (rc >= size || rc < 0) {
+        return -ENODEV;
+    }
+
+    config_fd = open(path, O_RDWR);
+    if (config_fd < 0) {
+        return -ENODEV;
+    }
+
+    if (lseek(config_fd, pos, SEEK_SET) != pos) {
+        ret = -errno;
+        goto out;
+    }
+
+    do {
+        rc = read(config_fd, (uint8_t *)val, len);
+    } while (rc < 0 && (errno == EINTR || errno == EAGAIN));
+    if (rc != len) {
+        ret = -errno;
+    }
+
+out:
+    close(config_fd);
+    return ret;
+}
+
+static int igd_pt_i440fx_initfn(struct PCIDevice *pci_dev)
+{
+    uint32_t val = 0;
+    int rc, i, num;
+    int pos, len;
+
+    num = ARRAY_SIZE(igd_host_bridge_infos);
+    for (i = 0; i < num; i++) {
+        pos = igd_host_bridge_infos[i].offset;
+        len = igd_host_bridge_infos[i].len;
+        rc = host_pci_config_read(pos, len, &val);
+        if (rc) {
+            return -ENODEV;
+        }
+        pci_default_write_config(pci_dev, pos, val, len);
+    }
+
+    return 0;
+}
+
+static void igd_passthrough_i440fx_class_init(ObjectClass *klass, void *data)
+{
+    DeviceClass *dc = DEVICE_CLASS(klass);
+    PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
+
+    k->init = igd_pt_i440fx_initfn;
+    dc->desc = "IGD Passthrough Host bridge";
+}
+
+static const TypeInfo igd_passthrough_i440fx_info = {
+    .name          = TYPE_IGD_PASSTHROUGH_I440FX_PCI_DEVICE,
+    .parent        = TYPE_I440FX_PCI_DEVICE,
+    .instance_size = sizeof(PCII440FXState),
+    .class_init    = igd_passthrough_i440fx_class_init,
+};
+
+static const char *i440fx_pcihost_root_bus_path(PCIHostState *host_bridge,
+                                                PCIBus *rootbus)
+{
+    I440FXState *s = I440FX_PCI_HOST_BRIDGE(host_bridge);
+
+    /* For backwards compat with old device paths */
+    if (s->short_root_bus) {
+        return "0000";
+    }
+    return "0000:00";
+}
+
+static Property i440fx_props[] = {
+    DEFINE_PROP_SIZE(PCI_HOST_PROP_PCI_HOLE64_SIZE, I440FXState,
+                     pci_hole64_size, I440FX_PCI_HOST_HOLE64_SIZE_DEFAULT),
+    DEFINE_PROP_UINT32("short_root_bus", I440FXState, short_root_bus, 0),
+    DEFINE_PROP_BOOL("x-pci-hole64-fix", I440FXState, pci_hole64_fix, true),
+    DEFINE_PROP_END_OF_LIST(),
+};
+
+static void i440fx_pcihost_class_init(ObjectClass *klass, void *data)
+{
+    DeviceClass *dc = DEVICE_CLASS(klass);
+    PCIHostBridgeClass *hc = PCI_HOST_BRIDGE_CLASS(klass);
+
+    hc->root_bus_path = i440fx_pcihost_root_bus_path;
+    dc->realize = i440fx_pcihost_realize;
+    dc->fw_name = "pci";
+    dc->props = i440fx_props;
+    /* Reason: needs to be wired up by pc_init1 */
+    dc->user_creatable = false;
+}
+
+static const TypeInfo i440fx_pcihost_info = {
+    .name          = TYPE_I440FX_PCI_HOST_BRIDGE,
+    .parent        = TYPE_PCI_HOST_BRIDGE,
+    .instance_size = sizeof(I440FXState),
+    .instance_init = i440fx_pcihost_initfn,
+    .class_init    = i440fx_pcihost_class_init,
+};
+
+static void i440fx_register_types(void)
+{
+    type_register_static(&i440fx_info);
+    type_register_static(&igd_passthrough_i440fx_info);
+    type_register_static(&i440fx_pcihost_info);
+}
+
+type_init(i440fx_register_types)
diff --git a/hw/pci-host/piix.c b/hw/pci-host/piix.c
index 6f963b5a07..df08d94a59 100644
--- a/hw/pci-host/piix.c
+++ b/hw/pci-host/piix.c
@@ -1,5 +1,5 @@
 /*
- * QEMU i440FX/PIIX3 PCI Bridge Emulation
+ * QEMU PIIX South Bridge Emulation
  *
  * Copyright (c) 2006 Fabrice Bellard
  *
@@ -23,38 +23,11 @@
  */
 
 #include "qemu/osdep.h"
+#include "qemu/range.h"
+#include "sysemu/sysemu.h"
 #include "hw/hw.h"
-#include "hw/i386/pc.h"
-#include "hw/pci/pci.h"
-#include "hw/pci/pci_host.h"
-#include "hw/pci-host/i440fx.h"
 #include "hw/southbridge/i82371_piix.h"
-#include "hw/isa/isa.h"
-#include "hw/sysbus.h"
-#include "qapi/error.h"
-#include "qemu/range.h"
 #include "hw/xen/xen.h"
-#include "hw/pci-host/pam.h"
-#include "sysemu/sysemu.h"
-#include "hw/i386/ioapic.h"
-#include "qapi/visitor.h"
-#include "qemu/error-report.h"
-
-/*
- * I440FX chipset data sheet.
- * http://download.intel.com/design/chipsets/datashts/29054901.pdf
- */
-
-#define I440FX_PCI_HOST_BRIDGE(obj) \
-    OBJECT_CHECK(I440FXState, (obj), TYPE_I440FX_PCI_HOST_BRIDGE)
-
-typedef struct I440FXState {
-    PCIHostState parent_obj;
-    Range pci_hole;
-    uint64_t pci_hole64_size;
-    bool pci_hole64_fix;
-    uint32_t short_root_bus;
-} I440FXState;
 
 #define PIIX_NUM_PIC_IRQS       16      /* i8259 * 2 */
 #define XEN_PIIX_NUM_PIRQS      128ULL
@@ -93,35 +66,6 @@ typedef struct PIIX3State {
 #define PIIX3_PCI_DEVICE(obj) \
     OBJECT_CHECK(PIIX3State, (obj), TYPE_PIIX3_PCI_DEVICE)
 
-#define I440FX_PCI_DEVICE(obj) \
-    OBJECT_CHECK(PCII440FXState, (obj), TYPE_I440FX_PCI_DEVICE)
-
-struct PCII440FXState {
-    /*< private >*/
-    PCIDevice parent_obj;
-    /*< public >*/
-
-    MemoryRegion *system_memory;
-    MemoryRegion *pci_address_space;
-    MemoryRegion *ram_memory;
-    PAMMemoryRegion pam_regions[13];
-    MemoryRegion smram_region;
-    MemoryRegion smram, low_smram;
-};
-
-
-#define I440FX_PAM      0x59
-#define I440FX_PAM_SIZE 7
-#define I440FX_SMRAM    0x72
-
-/* Keep it 2G to comply with older win32 guests */
-#define I440FX_PCI_HOST_HOLE64_SIZE_DEFAULT (1ULL << 31)
-
-/* Older coreboot versions (4.0 and older) read a config register that doesn't
- * exist in real hardware, to get the RAM size from QEMU.
- */
-#define I440FX_COREBOOT_RAM_SIZE 0x57
-
 /* return the global irq number corresponding to a given device irq
    pin. We could also use the bus number to have a more precise
    mapping. */
@@ -132,297 +76,6 @@ static int pci_slot_get_pirq(PCIDevice *pci_dev, int pci_intx)
     return (pci_intx + slot_addend) & 3;
 }
 
-static void i440fx_update_memory_mappings(PCII440FXState *d)
-{
-    int i;
-    PCIDevice *pd = PCI_DEVICE(d);
-
-    memory_region_transaction_begin();
-    for (i = 0; i < 13; i++) {
-        pam_update(&d->pam_regions[i], i,
-                   pd->config[I440FX_PAM + (DIV_ROUND_UP(i, 2))]);
-    }
-    memory_region_set_enabled(&d->smram_region,
-                              !(pd->config[I440FX_SMRAM] & SMRAM_D_OPEN));
-    memory_region_set_enabled(&d->smram,
-                              pd->config[I440FX_SMRAM] & SMRAM_G_SMRAME);
-    memory_region_transaction_commit();
-}
-
-
-static void i440fx_write_config(PCIDevice *dev,
-                                uint32_t address, uint32_t val, int len)
-{
-    PCII440FXState *d = I440FX_PCI_DEVICE(dev);
-
-    /* XXX: implement SMRAM.D_LOCK */
-    pci_default_write_config(dev, address, val, len);
-    if (ranges_overlap(address, len, I440FX_PAM, I440FX_PAM_SIZE) ||
-        range_covers_byte(address, len, I440FX_SMRAM)) {
-        i440fx_update_memory_mappings(d);
-    }
-}
-
-static int i440fx_load_old(QEMUFile* f, void *opaque, int version_id)
-{
-    PCII440FXState *d = opaque;
-    PCIDevice *pd = PCI_DEVICE(d);
-    int ret, i;
-    uint8_t smm_enabled;
-
-    ret = pci_device_load(pd, f);
-    if (ret < 0)
-        return ret;
-    i440fx_update_memory_mappings(d);
-    qemu_get_8s(f, &smm_enabled);
-
-    if (version_id == 2) {
-        for (i = 0; i < PIIX_NUM_PIRQS; i++) {
-            qemu_get_be32(f); /* dummy load for compatibility */
-        }
-    }
-
-    return 0;
-}
-
-static int i440fx_post_load(void *opaque, int version_id)
-{
-    PCII440FXState *d = opaque;
-
-    i440fx_update_memory_mappings(d);
-    return 0;
-}
-
-static const VMStateDescription vmstate_i440fx = {
-    .name = "I440FX",
-    .version_id = 3,
-    .minimum_version_id = 3,
-    .minimum_version_id_old = 1,
-    .load_state_old = i440fx_load_old,
-    .post_load = i440fx_post_load,
-    .fields = (VMStateField[]) {
-        VMSTATE_PCI_DEVICE(parent_obj, PCII440FXState),
-        /* Used to be smm_enabled, which was basically always zero because
-         * SeaBIOS hardly uses SMM.  SMRAM is now handled by CPU code.
-         */
-        VMSTATE_UNUSED(1),
-        VMSTATE_END_OF_LIST()
-    }
-};
-
-static void i440fx_pcihost_get_pci_hole_start(Object *obj, Visitor *v,
-                                              const char *name, void *opaque,
-                                              Error **errp)
-{
-    I440FXState *s = I440FX_PCI_HOST_BRIDGE(obj);
-    uint64_t val64;
-    uint32_t value;
-
-    val64 = range_is_empty(&s->pci_hole) ? 0 : range_lob(&s->pci_hole);
-    value = val64;
-    assert(value == val64);
-    visit_type_uint32(v, name, &value, errp);
-}
-
-static void i440fx_pcihost_get_pci_hole_end(Object *obj, Visitor *v,
-                                            const char *name, void *opaque,
-                                            Error **errp)
-{
-    I440FXState *s = I440FX_PCI_HOST_BRIDGE(obj);
-    uint64_t val64;
-    uint32_t value;
-
-    val64 = range_is_empty(&s->pci_hole) ? 0 : range_upb(&s->pci_hole) + 1;
-    value = val64;
-    assert(value == val64);
-    visit_type_uint32(v, name, &value, errp);
-}
-
-/*
- * The 64bit PCI hole start is set by the Guest firmware
- * as the address of the first 64bit PCI MEM resource.
- * If no PCI device has resources on the 64bit area,
- * the 64bit PCI hole will start after "over 4G RAM" and the
- * reserved space for memory hotplug if any.
- */
-static void i440fx_pcihost_get_pci_hole64_start(Object *obj, Visitor *v,
-                                                const char *name,
-                                                void *opaque, Error **errp)
-{
-    PCIHostState *h = PCI_HOST_BRIDGE(obj);
-    I440FXState *s = I440FX_PCI_HOST_BRIDGE(obj);
-    Range w64;
-    uint64_t value;
-
-    pci_bus_get_w64_range(h->bus, &w64);
-    value = range_is_empty(&w64) ? 0 : range_lob(&w64);
-    if (!value && s->pci_hole64_fix) {
-        value = pc_pci_hole64_start();
-    }
-    visit_type_uint64(v, name, &value, errp);
-}
-
-/*
- * The 64bit PCI hole end is set by the Guest firmware
- * as the address of the last 64bit PCI MEM resource.
- * Then it is expanded to the PCI_HOST_PROP_PCI_HOLE64_SIZE
- * that can be configured by the user.
- */
-static void i440fx_pcihost_get_pci_hole64_end(Object *obj, Visitor *v,
-                                              const char *name, void *opaque,
-                                              Error **errp)
-{
-    PCIHostState *h = PCI_HOST_BRIDGE(obj);
-    I440FXState *s = I440FX_PCI_HOST_BRIDGE(obj);
-    uint64_t hole64_start = pc_pci_hole64_start();
-    Range w64;
-    uint64_t value, hole64_end;
-
-    pci_bus_get_w64_range(h->bus, &w64);
-    value = range_is_empty(&w64) ? 0 : range_upb(&w64) + 1;
-    hole64_end = ROUND_UP(hole64_start + s->pci_hole64_size, 1ULL << 30);
-    if (s->pci_hole64_fix && value < hole64_end) {
-        value = hole64_end;
-    }
-    visit_type_uint64(v, name, &value, errp);
-}
-
-static void i440fx_pcihost_initfn(Object *obj)
-{
-    PCIHostState *s = PCI_HOST_BRIDGE(obj);
-
-    memory_region_init_io(&s->conf_mem, obj, &pci_host_conf_le_ops, s,
-                          "pci-conf-idx", 4);
-    memory_region_init_io(&s->data_mem, obj, &pci_host_data_le_ops, s,
-                          "pci-conf-data", 4);
-
-    object_property_add(obj, PCI_HOST_PROP_PCI_HOLE_START, "uint32",
-                        i440fx_pcihost_get_pci_hole_start,
-                        NULL, NULL, NULL, NULL);
-
-    object_property_add(obj, PCI_HOST_PROP_PCI_HOLE_END, "uint32",
-                        i440fx_pcihost_get_pci_hole_end,
-                        NULL, NULL, NULL, NULL);
-
-    object_property_add(obj, PCI_HOST_PROP_PCI_HOLE64_START, "uint64",
-                        i440fx_pcihost_get_pci_hole64_start,
-                        NULL, NULL, NULL, NULL);
-
-    object_property_add(obj, PCI_HOST_PROP_PCI_HOLE64_END, "uint64",
-                        i440fx_pcihost_get_pci_hole64_end,
-                        NULL, NULL, NULL, NULL);
-}
-
-static void i440fx_pcihost_realize(DeviceState *dev, Error **errp)
-{
-    PCIHostState *s = PCI_HOST_BRIDGE(dev);
-    SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
-
-    sysbus_add_io(sbd, 0xcf8, &s->conf_mem);
-    sysbus_init_ioports(sbd, 0xcf8, 4);
-
-    sysbus_add_io(sbd, 0xcfc, &s->data_mem);
-    sysbus_init_ioports(sbd, 0xcfc, 4);
-}
-
-static void i440fx_realize(PCIDevice *dev, Error **errp)
-{
-    dev->config[I440FX_SMRAM] = 0x02;
-
-    if (object_property_get_bool(qdev_get_machine(), "iommu", NULL)) {
-        warn_report("i440fx doesn't support emulated iommu");
-    }
-}
-
-PCIBus *i440fx_init(const char *host_type, const char *pci_type,
-                    PCII440FXState **pi440fx_state,
-                    int *piix3_devfn,
-                    ISABus **isa_bus, qemu_irq *pic,
-                    MemoryRegion *address_space_mem,
-                    MemoryRegion *address_space_io,
-                    ram_addr_t ram_size,
-                    ram_addr_t below_4g_mem_size,
-                    ram_addr_t above_4g_mem_size,
-                    MemoryRegion *pci_address_space,
-                    MemoryRegion *ram_memory)
-{
-    DeviceState *dev;
-    PCIBus *b;
-    PCIDevice *d;
-    PCIHostState *s;
-    PCII440FXState *f;
-    unsigned i;
-    I440FXState *i440fx;
-
-    dev = qdev_create(NULL, host_type);
-    s = PCI_HOST_BRIDGE(dev);
-    b = pci_bus_new(dev, NULL, pci_address_space,
-                    address_space_io, 0, TYPE_PCI_BUS);
-    s->bus = b;
-    object_property_add_child(qdev_get_machine(), "i440fx", OBJECT(dev), NULL);
-    qdev_init_nofail(dev);
-
-    d = pci_create_simple(b, 0, pci_type);
-    *pi440fx_state = I440FX_PCI_DEVICE(d);
-    f = *pi440fx_state;
-    f->system_memory = address_space_mem;
-    f->pci_address_space = pci_address_space;
-    f->ram_memory = ram_memory;
-
-    i440fx = I440FX_PCI_HOST_BRIDGE(dev);
-    range_set_bounds(&i440fx->pci_hole, below_4g_mem_size,
-                     IO_APIC_DEFAULT_ADDRESS - 1);
-
-    /* setup pci memory mapping */
-    pc_pci_as_mapping_init(OBJECT(f), f->system_memory,
-                           f->pci_address_space);
-
-    /* if *disabled* show SMRAM to all CPUs */
-    memory_region_init_alias(&f->smram_region, OBJECT(d), "smram-region",
-                             f->pci_address_space, 0xa0000, 0x20000);
-    memory_region_add_subregion_overlap(f->system_memory, 0xa0000,
-                                        &f->smram_region, 1);
-    memory_region_set_enabled(&f->smram_region, true);
-
-    /* smram, as seen by SMM CPUs */
-    memory_region_init(&f->smram, OBJECT(d), "smram", 1ull << 32);
-    memory_region_set_enabled(&f->smram, true);
-    memory_region_init_alias(&f->low_smram, OBJECT(d), "smram-low",
-                             f->ram_memory, 0xa0000, 0x20000);
-    memory_region_set_enabled(&f->low_smram, true);
-    memory_region_add_subregion(&f->smram, 0xa0000, &f->low_smram);
-    object_property_add_const_link(qdev_get_machine(), "smram",
-                                   OBJECT(&f->smram), &error_abort);
-
-    init_pam(dev, f->ram_memory, f->system_memory, f->pci_address_space,
-             &f->pam_regions[0], PAM_BIOS_BASE, PAM_BIOS_SIZE);
-    for (i = 0; i < 12; ++i) {
-        init_pam(dev, f->ram_memory, f->system_memory, f->pci_address_space,
-                 &f->pam_regions[i+1], PAM_EXPAN_BASE + i * PAM_EXPAN_SIZE,
-                 PAM_EXPAN_SIZE);
-    }
-
-    piix3_init(b, isa_bus, pic, piix3_devfn);
-
-    ram_size = ram_size / 8 / 1024 / 1024;
-    if (ram_size > 255) {
-        ram_size = 255;
-    }
-    d->config[I440FX_COREBOOT_RAM_SIZE] = ram_size;
-
-    i440fx_update_memory_mappings(f);
-
-    return b;
-}
-
-PCIBus *find_i440fx(void)
-{
-    PCIHostState *s = OBJECT_CHECK(PCIHostState,
-                                   object_resolve_path("/machine/i440fx", NULL),
-                                   TYPE_PCI_HOST_BRIDGE);
-    return s ? s->bus : NULL;
-}
-
 /* PIIX3 PCI to ISA bridge */
 static void piix3_set_irq_pic(PIIX3State *piix3, int pic_irq)
 {
@@ -761,176 +414,11 @@ static const TypeInfo piix3_xen_info = {
     .class_init    = piix3_xen_class_init,
 };
 
-static void i440fx_class_init(ObjectClass *klass, void *data)
-{
-    DeviceClass *dc = DEVICE_CLASS(klass);
-    PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
-
-    k->realize = i440fx_realize;
-    k->config_write = i440fx_write_config;
-    k->vendor_id = PCI_VENDOR_ID_INTEL;
-    k->device_id = PCI_DEVICE_ID_INTEL_82441;
-    k->revision = 0x02;
-    k->class_id = PCI_CLASS_BRIDGE_HOST;
-    dc->desc = "Host bridge";
-    dc->vmsd = &vmstate_i440fx;
-    /*
-     * PCI-facing part of the host bridge, not usable without the
-     * host-facing part, which can't be device_add'ed, yet.
-     */
-    dc->user_creatable = false;
-    dc->hotpluggable   = false;
-}
-
-static const TypeInfo i440fx_info = {
-    .name          = TYPE_I440FX_PCI_DEVICE,
-    .parent        = TYPE_PCI_DEVICE,
-    .instance_size = sizeof(PCII440FXState),
-    .class_init    = i440fx_class_init,
-    .interfaces = (InterfaceInfo[]) {
-        { INTERFACE_CONVENTIONAL_PCI_DEVICE },
-        { },
-    },
-};
-
-/* IGD Passthrough Host Bridge. */
-typedef struct {
-    uint8_t offset;
-    uint8_t len;
-} IGDHostInfo;
-
-/* Here we just expose minimal host bridge offset subset. */
-static const IGDHostInfo igd_host_bridge_infos[] = {
-    {0x08, 2},  /* revision id */
-    {0x2c, 2},  /* sybsystem vendor id */
-    {0x2e, 2},  /* sybsystem id */
-    {0x50, 2},  /* SNB: processor graphics control register */
-    {0x52, 2},  /* processor graphics control register */
-    {0xa4, 4},  /* SNB: graphics base of stolen memory */
-    {0xa8, 4},  /* SNB: base of GTT stolen memory */
-};
-
-static int host_pci_config_read(int pos, int len, uint32_t *val)
-{
-    char path[PATH_MAX];
-    int config_fd;
-    ssize_t size = sizeof(path);
-    /* Access real host bridge. */
-    int rc = snprintf(path, size, "/sys/bus/pci/devices/%04x:%02x:%02x.%d/%s",
-                      0, 0, 0, 0, "config");
-    int ret = 0;
-
-    if (rc >= size || rc < 0) {
-        return -ENODEV;
-    }
-
-    config_fd = open(path, O_RDWR);
-    if (config_fd < 0) {
-        return -ENODEV;
-    }
-
-    if (lseek(config_fd, pos, SEEK_SET) != pos) {
-        ret = -errno;
-        goto out;
-    }
-
-    do {
-        rc = read(config_fd, (uint8_t *)val, len);
-    } while (rc < 0 && (errno == EINTR || errno == EAGAIN));
-    if (rc != len) {
-        ret = -errno;
-    }
-
-out:
-    close(config_fd);
-    return ret;
-}
-
-static int igd_pt_i440fx_initfn(struct PCIDevice *pci_dev)
-{
-    uint32_t val = 0;
-    int rc, i, num;
-    int pos, len;
-
-    num = ARRAY_SIZE(igd_host_bridge_infos);
-    for (i = 0; i < num; i++) {
-        pos = igd_host_bridge_infos[i].offset;
-        len = igd_host_bridge_infos[i].len;
-        rc = host_pci_config_read(pos, len, &val);
-        if (rc) {
-            return -ENODEV;
-        }
-        pci_default_write_config(pci_dev, pos, val, len);
-    }
-
-    return 0;
-}
-
-static void igd_passthrough_i440fx_class_init(ObjectClass *klass, void *data)
-{
-    DeviceClass *dc = DEVICE_CLASS(klass);
-    PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
-
-    k->init = igd_pt_i440fx_initfn;
-    dc->desc = "IGD Passthrough Host bridge";
-}
-
-static const TypeInfo igd_passthrough_i440fx_info = {
-    .name          = TYPE_IGD_PASSTHROUGH_I440FX_PCI_DEVICE,
-    .parent        = TYPE_I440FX_PCI_DEVICE,
-    .instance_size = sizeof(PCII440FXState),
-    .class_init    = igd_passthrough_i440fx_class_init,
-};
-
-static const char *i440fx_pcihost_root_bus_path(PCIHostState *host_bridge,
-                                                PCIBus *rootbus)
-{
-    I440FXState *s = I440FX_PCI_HOST_BRIDGE(host_bridge);
-
-    /* For backwards compat with old device paths */
-    if (s->short_root_bus) {
-        return "0000";
-    }
-    return "0000:00";
-}
-
-static Property i440fx_props[] = {
-    DEFINE_PROP_SIZE(PCI_HOST_PROP_PCI_HOLE64_SIZE, I440FXState,
-                     pci_hole64_size, I440FX_PCI_HOST_HOLE64_SIZE_DEFAULT),
-    DEFINE_PROP_UINT32("short_root_bus", I440FXState, short_root_bus, 0),
-    DEFINE_PROP_BOOL("x-pci-hole64-fix", I440FXState, pci_hole64_fix, true),
-    DEFINE_PROP_END_OF_LIST(),
-};
-
-static void i440fx_pcihost_class_init(ObjectClass *klass, void *data)
-{
-    DeviceClass *dc = DEVICE_CLASS(klass);
-    PCIHostBridgeClass *hc = PCI_HOST_BRIDGE_CLASS(klass);
-
-    hc->root_bus_path = i440fx_pcihost_root_bus_path;
-    dc->realize = i440fx_pcihost_realize;
-    dc->fw_name = "pci";
-    dc->props = i440fx_props;
-    /* Reason: needs to be wired up by pc_init1 */
-    dc->user_creatable = false;
-}
-
-static const TypeInfo i440fx_pcihost_info = {
-    .name          = TYPE_I440FX_PCI_HOST_BRIDGE,
-    .parent        = TYPE_PCI_HOST_BRIDGE,
-    .instance_size = sizeof(I440FXState),
-    .instance_init = i440fx_pcihost_initfn,
-    .class_init    = i440fx_pcihost_class_init,
-};
-
-static void i440fx_register_types(void)
+static void piix_register_types(void)
 {
-    type_register_static(&i440fx_info);
-    type_register_static(&igd_passthrough_i440fx_info);
     type_register_static(&piix3_pci_type_info);
     type_register_static(&piix3_info);
     type_register_static(&piix3_xen_info);
-    type_register_static(&i440fx_pcihost_info);
 }
 
-type_init(i440fx_register_types)
+type_init(piix_register_types)
diff --git a/MAINTAINERS b/MAINTAINERS
index c3efcd2316..a4dc72a47b 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -849,6 +849,7 @@ S: Supported
 F: include/hw/i386/
 F: hw/i386/
 F: hw/pci-host/piix.c
+F: hw/pci-host/i440fx.c
 F: hw/pci-host/q35.c
 F: hw/pci-host/pam.c
 F: include/hw/pci-host/q35.h
diff --git a/hw/pci-host/Makefile.objs b/hw/pci-host/Makefile.objs
index 9c7909cf44..acf61023b5 100644
--- a/hw/pci-host/Makefile.objs
+++ b/hw/pci-host/Makefile.objs
@@ -14,6 +14,7 @@ common-obj-$(CONFIG_VERSATILE_PCI) += versatile.o
 common-obj-$(CONFIG_PCI_APB) += apb.o
 common-obj-$(CONFIG_FULONG) += bonito.o
 common-obj-$(CONFIG_PCI_PIIX) += piix.o
+common-obj-$(CONFIG_PCI_I440FX) += i440fx.o
 common-obj-$(CONFIG_PCI_Q35) += q35.o
 common-obj-$(CONFIG_PCI_GENERIC) += gpex.o
 common-obj-$(CONFIG_PCI_XILINX) += xilinx-pcie.o
-- 
2.15.1

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

* [Qemu-devel] [PATCH 25/29] hw/i386: move piix from hw/pci-host to hw/southbridge
  2018-01-08  2:45 [Qemu-devel] [RFC PATCH 00/29] remove i386/pc dependency: generic SuperIO, PIIX cleanup Philippe Mathieu-Daudé
                   ` (23 preceding siblings ...)
  2018-01-08  2:45 ` [Qemu-devel] [PATCH 24/29] hw/i386: extract i440fx code from piix.c into i440fx.c Philippe Mathieu-Daudé
@ 2018-01-08  2:45 ` Philippe Mathieu-Daudé
  2018-01-08  2:45 ` [Qemu-devel] [PATCH 26/29] configs/mips-softmmu: use common CONFIG_PCI_PIIX instead of CONFIG_PIIX4 Philippe Mathieu-Daudé
                   ` (3 subsequent siblings)
  28 siblings, 0 replies; 32+ messages in thread
From: Philippe Mathieu-Daudé @ 2018-01-08  2:45 UTC (permalink / raw)
  To: Paolo Bonzini, Michael S. Tsirkin, Hervé Poussineau,
	Aurelien Jarno, Eduardo Habkost, Marcel Apfelbaum
  Cc: Philippe Mathieu-Daudé, qemu-devel, Igor Mammedov

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 hw/{pci-host => southbridge}/piix.c | 0
 MAINTAINERS                         | 2 +-
 hw/Makefile.objs                    | 1 +
 hw/pci-host/Makefile.objs           | 1 -
 hw/southbridge/Makefile.objs        | 1 +
 5 files changed, 3 insertions(+), 2 deletions(-)
 rename hw/{pci-host => southbridge}/piix.c (100%)
 create mode 100644 hw/southbridge/Makefile.objs

diff --git a/hw/pci-host/piix.c b/hw/southbridge/piix.c
similarity index 100%
rename from hw/pci-host/piix.c
rename to hw/southbridge/piix.c
diff --git a/MAINTAINERS b/MAINTAINERS
index a4dc72a47b..e88ed8851b 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -848,7 +848,6 @@ M: Michael S. Tsirkin <mst@redhat.com>
 S: Supported
 F: include/hw/i386/
 F: hw/i386/
-F: hw/pci-host/piix.c
 F: hw/pci-host/i440fx.c
 F: hw/pci-host/q35.c
 F: hw/pci-host/pam.c
@@ -879,6 +878,7 @@ F: hw/intc/i8259*
 F: hw/isa/isa-superio.c
 F: hw/misc/debugexit.c
 F: hw/misc/pc-testdev.c
+F: hw/southbridge/piix.c
 F: hw/timer/hpet*
 F: hw/timer/i8254*
 F: hw/timer/mc146818rtc*
diff --git a/hw/Makefile.objs b/hw/Makefile.objs
index cf4cb2010b..1594754976 100644
--- a/hw/Makefile.objs
+++ b/hw/Makefile.objs
@@ -21,6 +21,7 @@ devices-dirs-$(CONFIG_SOFTMMU) += net/
 devices-dirs-$(CONFIG_SOFTMMU) += nvram/
 devices-dirs-$(CONFIG_SOFTMMU) += pci/
 devices-dirs-$(CONFIG_PCI) += pci-bridge/ pci-host/
+devices-dirs-$(CONFIG_SOFTMMU) += southbridge/
 devices-dirs-$(CONFIG_SOFTMMU) += pcmcia/
 devices-dirs-$(CONFIG_SOFTMMU) += scsi/
 devices-dirs-$(CONFIG_SOFTMMU) += sd/
diff --git a/hw/pci-host/Makefile.objs b/hw/pci-host/Makefile.objs
index acf61023b5..1ef713df2b 100644
--- a/hw/pci-host/Makefile.objs
+++ b/hw/pci-host/Makefile.objs
@@ -13,7 +13,6 @@ common-obj-$(CONFIG_VERSATILE_PCI) += versatile.o
 
 common-obj-$(CONFIG_PCI_APB) += apb.o
 common-obj-$(CONFIG_FULONG) += bonito.o
-common-obj-$(CONFIG_PCI_PIIX) += piix.o
 common-obj-$(CONFIG_PCI_I440FX) += i440fx.o
 common-obj-$(CONFIG_PCI_Q35) += q35.o
 common-obj-$(CONFIG_PCI_GENERIC) += gpex.o
diff --git a/hw/southbridge/Makefile.objs b/hw/southbridge/Makefile.objs
new file mode 100644
index 0000000000..88e9273b3c
--- /dev/null
+++ b/hw/southbridge/Makefile.objs
@@ -0,0 +1 @@
+common-obj-$(CONFIG_PCI_PIIX) += piix.o
-- 
2.15.1

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

* [Qemu-devel] [PATCH 26/29] configs/mips-softmmu: use common CONFIG_PCI_PIIX instead of CONFIG_PIIX4
  2018-01-08  2:45 [Qemu-devel] [RFC PATCH 00/29] remove i386/pc dependency: generic SuperIO, PIIX cleanup Philippe Mathieu-Daudé
                   ` (24 preceding siblings ...)
  2018-01-08  2:45 ` [Qemu-devel] [PATCH 25/29] hw/i386: move piix from hw/pci-host to hw/southbridge Philippe Mathieu-Daudé
@ 2018-01-08  2:45 ` Philippe Mathieu-Daudé
  2018-01-08  2:45 ` [Qemu-devel] [PATCH 27/29] piix3: convert reset function to QOM Philippe Mathieu-Daudé
                   ` (2 subsequent siblings)
  28 siblings, 0 replies; 32+ messages in thread
From: Philippe Mathieu-Daudé @ 2018-01-08  2:45 UTC (permalink / raw)
  To: Paolo Bonzini, Michael S. Tsirkin, Hervé Poussineau,
	Aurelien Jarno, Eduardo Habkost, Marcel Apfelbaum
  Cc: Philippe Mathieu-Daudé, qemu-devel, Igor Mammedov

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 default-configs/mips-softmmu-common.mak | 2 +-
 hw/isa/Makefile.objs                    | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/default-configs/mips-softmmu-common.mak b/default-configs/mips-softmmu-common.mak
index 7d8f5db983..f29beb1419 100644
--- a/default-configs/mips-softmmu-common.mak
+++ b/default-configs/mips-softmmu-common.mak
@@ -22,7 +22,7 @@ CONFIG_ACPI_NVDIMM=y
 CONFIG_ACPI_CPU_HOTPLUG=y
 CONFIG_APM=y
 CONFIG_I8257=y
-CONFIG_PIIX4=y
+CONFIG_PCI_PIIX=y
 CONFIG_IDE_ISA=y
 CONFIG_IDE_PIIX=y
 CONFIG_NE2000_ISA=y
diff --git a/hw/isa/Makefile.objs b/hw/isa/Makefile.objs
index cac655ba58..fa071082d4 100644
--- a/hw/isa/Makefile.objs
+++ b/hw/isa/Makefile.objs
@@ -3,7 +3,7 @@ common-obj-$(CONFIG_ISA_BUS) += isa-superio.o
 common-obj-$(CONFIG_APM) += apm.o
 common-obj-$(CONFIG_I82378) += i82378.o
 common-obj-$(CONFIG_PC87312) += pc87312.o
-common-obj-$(CONFIG_PIIX4) += piix4.o
+common-obj-$(CONFIG_PCI_PIIX) += piix4.o
 common-obj-$(CONFIG_VT82C686) += vt82c686.o
 
 obj-$(CONFIG_LPC_ICH9) += lpc_ich9.o
-- 
2.15.1

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

* [Qemu-devel] [PATCH 27/29] piix3: convert reset function to QOM
  2018-01-08  2:45 [Qemu-devel] [RFC PATCH 00/29] remove i386/pc dependency: generic SuperIO, PIIX cleanup Philippe Mathieu-Daudé
                   ` (25 preceding siblings ...)
  2018-01-08  2:45 ` [Qemu-devel] [PATCH 26/29] configs/mips-softmmu: use common CONFIG_PCI_PIIX instead of CONFIG_PIIX4 Philippe Mathieu-Daudé
@ 2018-01-08  2:45 ` Philippe Mathieu-Daudé
  2018-01-08  2:45 ` [Qemu-devel] [PATCH 28/29] piix: merge common code from isa/piix4.c with southbridge piix3 Philippe Mathieu-Daudé
  2018-01-08  2:45 ` [Qemu-devel] [NOTFORMERGE PATCH 29/29] piix4: add isa_superio_init Philippe Mathieu-Daudé
  28 siblings, 0 replies; 32+ messages in thread
From: Philippe Mathieu-Daudé @ 2018-01-08  2:45 UTC (permalink / raw)
  To: Paolo Bonzini, Michael S. Tsirkin, Hervé Poussineau,
	Aurelien Jarno, Eduardo Habkost, Marcel Apfelbaum
  Cc: Philippe Mathieu-Daudé, qemu-devel, Igor Mammedov

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 hw/southbridge/piix.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/hw/southbridge/piix.c b/hw/southbridge/piix.c
index df08d94a59..2d429d6b29 100644
--- a/hw/southbridge/piix.c
+++ b/hw/southbridge/piix.c
@@ -203,10 +203,10 @@ static void piix3_write_config_xen(PCIDevice *dev,
     piix3_write_config(dev, address, val, len);
 }
 
-static void piix3_reset(void *opaque)
+static void piix3_reset(DeviceState *dev)
 {
-    PIIX3State *d = opaque;
-    uint8_t *pci_conf = d->dev.config;
+    PIIX3State *s = PIIX3_PCI_DEVICE(dev);
+    uint8_t *pci_conf = s->dev.config;
 
     pci_conf[0x04] = 0x07; /* master, memory and I/O */
     pci_conf[0x05] = 0x00;
@@ -240,8 +240,8 @@ static void piix3_reset(void *opaque)
     pci_conf[0xac] = 0x00;
     pci_conf[0xae] = 0x00;
 
-    d->pic_levels = 0;
-    d->rcr = 0;
+    s->pic_levels = 0;
+    s->rcr = 0;
 }
 
 static int piix3_post_load(void *opaque, int version_id)
@@ -352,8 +352,6 @@ static void piix3_realize(PCIDevice *dev, Error **errp)
                           "piix3-reset-control", 1);
     memory_region_add_subregion_overlap(pci_address_space_io(dev), RCR_IOPORT,
                                         &d->rcr_mem, 1);
-
-    qemu_register_reset(piix3_reset, d);
 }
 
 static void pci_piix3_class_init(ObjectClass *klass, void *data)
@@ -364,6 +362,7 @@ static void pci_piix3_class_init(ObjectClass *klass, void *data)
     dc->desc        = "ISA bridge";
     dc->vmsd        = &vmstate_piix3;
     dc->hotpluggable   = false;
+    dc->reset       = piix3_reset;
     k->realize      = piix3_realize;
     k->vendor_id    = PCI_VENDOR_ID_INTEL;
     /* 82371SB PIIX3 PCI-to-ISA bridge (Step A1) */
-- 
2.15.1

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

* [Qemu-devel] [PATCH 28/29] piix: merge common code from isa/piix4.c with southbridge piix3
  2018-01-08  2:45 [Qemu-devel] [RFC PATCH 00/29] remove i386/pc dependency: generic SuperIO, PIIX cleanup Philippe Mathieu-Daudé
                   ` (26 preceding siblings ...)
  2018-01-08  2:45 ` [Qemu-devel] [PATCH 27/29] piix3: convert reset function to QOM Philippe Mathieu-Daudé
@ 2018-01-08  2:45 ` Philippe Mathieu-Daudé
  2018-01-08  2:45 ` [Qemu-devel] [NOTFORMERGE PATCH 29/29] piix4: add isa_superio_init Philippe Mathieu-Daudé
  28 siblings, 0 replies; 32+ messages in thread
From: Philippe Mathieu-Daudé @ 2018-01-08  2:45 UTC (permalink / raw)
  To: Paolo Bonzini, Michael S. Tsirkin, Hervé Poussineau,
	Aurelien Jarno, Eduardo Habkost, Marcel Apfelbaum
  Cc: Philippe Mathieu-Daudé, qemu-devel, Igor Mammedov

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 hw/isa/piix4.c        | 218 --------------------------------------------
 hw/southbridge/piix.c | 246 +++++++++++++++++++++++++++++++++++++++++---------
 hw/isa/Makefile.objs  |   1 -
 3 files changed, 203 insertions(+), 262 deletions(-)
 delete mode 100644 hw/isa/piix4.c

diff --git a/hw/isa/piix4.c b/hw/isa/piix4.c
deleted file mode 100644
index c78516e595..0000000000
--- a/hw/isa/piix4.c
+++ /dev/null
@@ -1,218 +0,0 @@
-/*
- * QEMU PIIX4 PCI Bridge Emulation
- *
- * Copyright (c) 2006 Fabrice Bellard
- * Copyright (c) 2018 Hervé Poussineau
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-#include "qemu/osdep.h"
-#include "hw/hw.h"
-#include "hw/i386/pc.h"
-#include "hw/pci/pci.h"
-#include "hw/isa/isa.h"
-#include "hw/southbridge/i82371_piix.h"
-#include "hw/dma/i8257.h"
-#include "hw/sysbus.h"
-#include "hw/audio/pcspk.h"
-#include "hw/timer/i8254.h"
-
-PCIDevice *piix4_dev;
-
-typedef struct PIIX4State {
-    PCIDevice dev;
-    qemu_irq cpu_intr;
-    qemu_irq *isa;
-
-    /* Reset Control Register */
-    MemoryRegion rcr_mem;
-    uint8_t rcr;
-} PIIX4State;
-
-#define TYPE_PIIX4_PCI_DEVICE "PIIX4"
-#define PIIX4_PCI_DEVICE(obj) \
-    OBJECT_CHECK(PIIX4State, (obj), TYPE_PIIX4_PCI_DEVICE)
-
-static void piix4_reset(DeviceState *dev)
-{
-    PIIX4State *s = PIIX4_PCI_DEVICE(dev);
-    uint8_t *pci_conf = s->dev.config;
-
-    pci_conf[0x04] = 0x07; // master, memory and I/O
-    pci_conf[0x05] = 0x00;
-    pci_conf[0x06] = 0x00;
-    pci_conf[0x07] = 0x02; // PCI_status_devsel_medium
-    pci_conf[0x4c] = 0x4d;
-    pci_conf[0x4e] = 0x03;
-    pci_conf[0x4f] = 0x00;
-    pci_conf[0x60] = 0x0a; // PCI A -> IRQ 10
-    pci_conf[0x61] = 0x0a; // PCI B -> IRQ 10
-    pci_conf[0x62] = 0x0b; // PCI C -> IRQ 11
-    pci_conf[0x63] = 0x0b; // PCI D -> IRQ 11
-    pci_conf[0x69] = 0x02;
-    pci_conf[0x70] = 0x80;
-    pci_conf[0x76] = 0x0c;
-    pci_conf[0x77] = 0x0c;
-    pci_conf[0x78] = 0x02;
-    pci_conf[0x79] = 0x00;
-    pci_conf[0x80] = 0x00;
-    pci_conf[0x82] = 0x00;
-    pci_conf[0xa0] = 0x08;
-    pci_conf[0xa2] = 0x00;
-    pci_conf[0xa3] = 0x00;
-    pci_conf[0xa4] = 0x00;
-    pci_conf[0xa5] = 0x00;
-    pci_conf[0xa6] = 0x00;
-    pci_conf[0xa7] = 0x00;
-    pci_conf[0xa8] = 0x0f;
-    pci_conf[0xaa] = 0x00;
-    pci_conf[0xab] = 0x00;
-    pci_conf[0xac] = 0x00;
-    pci_conf[0xae] = 0x00;
-}
-
-static const VMStateDescription vmstate_piix4 = {
-    .name = "PIIX4",
-    .version_id = 2,
-    .minimum_version_id = 2,
-    .fields = (VMStateField[]) {
-        VMSTATE_PCI_DEVICE(dev, PIIX4State),
-        VMSTATE_END_OF_LIST()
-    }
-};
-
-static void piix4_request_i8259_irq(void *opaque, int irq, int level)
-{
-    PIIX4State *s = opaque;
-    qemu_set_irq(s->cpu_intr, level);
-}
-
-static void piix4_set_i8259_irq(void *opaque, int irq, int level)
-{
-    PIIX4State *s = opaque;
-    qemu_set_irq(s->isa[irq], level);
-}
-
-static void piix4_rcr_write(void *opaque, hwaddr addr, uint64_t val,
-                            unsigned int len)
-{
-    PIIX4State *s = opaque;
-
-    if (val & 4) {
-        qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET);
-        return;
-    }
-    s->rcr = val & 2; /* keep System Reset type only */
-}
-
-static uint64_t piix4_rcr_read(void *opaque, hwaddr addr, unsigned int len)
-{
-    PIIX4State *s = opaque;
-    return s->rcr;
-}
-
-static const MemoryRegionOps piix4_rcr_ops = {
-    .read = piix4_rcr_read,
-    .write = piix4_rcr_write,
-    .endianness = DEVICE_LITTLE_ENDIAN,
-    .impl = {
-        .min_access_size = 1,
-        .max_access_size = 1,
-    },
-};
-
-static void piix4_realize(PCIDevice *pci_dev, Error **errp)
-{
-    DeviceState *dev = DEVICE(pci_dev);
-    PIIX4State *s = DO_UPCAST(PIIX4State, dev, pci_dev);
-    ISABus *isa_bus;
-    ISADevice *pit;
-    qemu_irq *i8259_out_irq;
-
-    isa_bus = isa_bus_new(dev, pci_address_space(pci_dev),
-                          pci_address_space_io(pci_dev), errp);
-    if (!isa_bus) {
-        return;
-    }
-
-    qdev_init_gpio_in_named(dev, piix4_set_i8259_irq, "isa", ISA_NUM_IRQS);
-    qdev_init_gpio_out_named(dev, &s->cpu_intr, "intr", 1);
-
-    memory_region_init_io(&s->rcr_mem, OBJECT(dev), &piix4_rcr_ops, s,
-                          "reset-control", 1);
-    memory_region_add_subregion_overlap(pci_address_space_io(pci_dev), 0xcf9,
-                                        &s->rcr_mem, 1);
-
-    /* initialize i8259 pic */
-    i8259_out_irq = qemu_allocate_irqs(piix4_request_i8259_irq, s, 1);
-    s->isa = i8259_init(isa_bus, *i8259_out_irq);
-
-    /* initialize ISA irqs */
-    isa_bus_irqs(isa_bus, s->isa);
-
-    /* initialize pit */
-    pit = i8254_pit_init(isa_bus, 0x40, 0, NULL);
-
-    /* speaker */
-    pcspk_init(isa_bus, pit);
-
-    /* DMA */
-    i8257_dma_init(isa_bus, 0);
-
-    piix4_dev = pci_dev;
-}
-
-static void piix4_class_init(ObjectClass *klass, void *data)
-{
-    DeviceClass *dc = DEVICE_CLASS(klass);
-    PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
-
-    k->realize = piix4_realize;
-    k->vendor_id = PCI_VENDOR_ID_INTEL;
-    k->device_id = PCI_DEVICE_ID_INTEL_82371AB_0;
-    k->class_id = PCI_CLASS_BRIDGE_ISA;
-    dc->reset = piix4_reset;
-    dc->desc = "ISA bridge";
-    dc->vmsd = &vmstate_piix4;
-    /*
-     * Reason: part of PIIX4 southbridge, needs to be wired up,
-     * e.g. by mips_malta_init()
-     */
-    dc->user_creatable = false;
-    dc->hotpluggable = false;
-}
-
-static const TypeInfo piix4_info = {
-    .name          = TYPE_PIIX4_PCI_DEVICE,
-    .parent        = TYPE_PCI_DEVICE,
-    .instance_size = sizeof(PIIX4State),
-    .class_init    = piix4_class_init,
-    .interfaces = (InterfaceInfo[]) {
-        { INTERFACE_CONVENTIONAL_PCI_DEVICE },
-        { },
-    },
-};
-
-static void piix4_register_types(void)
-{
-    type_register_static(&piix4_info);
-}
-
-type_init(piix4_register_types)
diff --git a/hw/southbridge/piix.c b/hw/southbridge/piix.c
index 2d429d6b29..53ee177866 100644
--- a/hw/southbridge/piix.c
+++ b/hw/southbridge/piix.c
@@ -24,17 +24,26 @@
 
 #include "qemu/osdep.h"
 #include "qemu/range.h"
+#include "qapi/error.h"
 #include "sysemu/sysemu.h"
 #include "hw/hw.h"
+#include "hw/i386/pc.h"
 #include "hw/southbridge/i82371_piix.h"
+#include "hw/dma/i8257.h"
+#include "hw/audio/pcspk.h"
+#include "hw/timer/i8254.h"
 #include "hw/xen/xen.h"
 
 #define PIIX_NUM_PIC_IRQS       16      /* i8259 * 2 */
 #define XEN_PIIX_NUM_PIRQS      128ULL
 #define PIIX_PIRQC              0x60
 
-typedef struct PIIX3State {
+typedef struct PIIXState {
+    /*< private >*/
     PCIDevice dev;
+    /*< public >*/
+
+    ISABus *isa_bus;
 
     /*
      * bitmap to track pic levels.
@@ -50,6 +59,7 @@ typedef struct PIIX3State {
 #endif
     uint64_t pic_levels;
 
+    qemu_irq cpu_intr;
     qemu_irq *pic;
 
     /* This member isn't used. Just for save/load compatibility */
@@ -57,14 +67,43 @@ typedef struct PIIX3State {
 
     /* Reset Control Register contents */
     uint8_t rcr;
-
     /* IO memory region for Reset Control Register (RCR_IOPORT) */
     MemoryRegion rcr_mem;
-} PIIX3State;
+} PIIXState;
 
-#define TYPE_PIIX3_PCI_DEVICE "pci-piix3"
-#define PIIX3_PCI_DEVICE(obj) \
-    OBJECT_CHECK(PIIX3State, (obj), TYPE_PIIX3_PCI_DEVICE)
+static void piix_rcr_write(void *opaque, hwaddr addr, uint64_t val,
+                           unsigned int len)
+{
+    PIIXState *s = opaque;
+
+    if (val & 4) {
+        qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET);
+        return;
+    }
+    s->rcr = val & 2; /* keep System Reset type only */
+}
+
+static uint64_t piix_rcr_read(void *opaque, hwaddr addr, unsigned int len)
+{
+    PIIXState *s = opaque;
+    return s->rcr;
+}
+
+static const MemoryRegionOps rcr_ops = {
+    .read = piix_rcr_read,
+    .write = piix_rcr_write,
+    .endianness = DEVICE_LITTLE_ENDIAN,
+    .impl = {
+        .min_access_size = 1,
+        .max_access_size = 1,
+    },
+};
+
+static void piix_rcr_init(PIIXState *s, MemoryRegion *io, const char *regname)
+{
+    memory_region_init_io(&s->rcr_mem, OBJECT(s), &rcr_ops, s, regname, 1);
+    memory_region_add_subregion_overlap(io, RCR_IOPORT, &s->rcr_mem, 1);
+}
 
 /* return the global irq number corresponding to a given device irq
    pin. We could also use the bus number to have a more precise
@@ -76,6 +115,28 @@ static int pci_slot_get_pirq(PCIDevice *pci_dev, int pci_intx)
     return (pci_intx + slot_addend) & 3;
 }
 
+static void piix_realize(PCIDevice *pci_dev, PIIXState *s, Error **errp)
+{
+    MemoryRegion *pci_io = pci_address_space_io(pci_dev);
+
+    s->isa_bus = isa_bus_new(DEVICE(s), pci_address_space(pci_dev),
+                             pci_io, errp);
+    if (!s->isa_bus) {
+        if (!errp) {
+            error_setg(errp, "can not create ISA bus");
+        }
+        return;
+    }
+
+    piix_rcr_init(s, pci_io, "reset-control");
+}
+
+typedef struct PIIXState PIIX3State;
+
+#define TYPE_PIIX3_PCI_DEVICE "pci-piix3"
+#define PIIX3_PCI_DEVICE(obj) \
+    OBJECT_CHECK(PIIX3State, (obj), TYPE_PIIX3_PCI_DEVICE)
+
 /* PIIX3 PCI to ISA bridge */
 static void piix3_set_irq_pic(PIIX3State *piix3, int pic_irq)
 {
@@ -314,44 +375,9 @@ static const VMStateDescription vmstate_piix3 = {
     }
 };
 
-
-static void rcr_write(void *opaque, hwaddr addr, uint64_t val, unsigned len)
-{
-    PIIX3State *d = opaque;
-
-    if (val & 4) {
-        qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET);
-        return;
-    }
-    d->rcr = val & 2; /* keep System Reset type only */
-}
-
-static uint64_t rcr_read(void *opaque, hwaddr addr, unsigned len)
-{
-    PIIX3State *d = opaque;
-
-    return d->rcr;
-}
-
-static const MemoryRegionOps rcr_ops = {
-    .read = rcr_read,
-    .write = rcr_write,
-    .endianness = DEVICE_LITTLE_ENDIAN
-};
-
-static void piix3_realize(PCIDevice *dev, Error **errp)
+static void piix3_realize(PCIDevice *pci_dev, Error **errp)
 {
-    PIIX3State *d = PIIX3_PCI_DEVICE(dev);
-
-    if (!isa_bus_new(DEVICE(d), get_system_memory(),
-                     pci_address_space_io(dev), errp)) {
-        return;
-    }
-
-    memory_region_init_io(&d->rcr_mem, OBJECT(dev), &rcr_ops, d,
-                          "piix3-reset-control", 1);
-    memory_region_add_subregion_overlap(pci_address_space_io(dev), RCR_IOPORT,
-                                        &d->rcr_mem, 1);
+    piix_realize(pci_dev, PIIX3_PCI_DEVICE(pci_dev), errp);
 }
 
 static void pci_piix3_class_init(ObjectClass *klass, void *data)
@@ -413,11 +439,145 @@ static const TypeInfo piix3_xen_info = {
     .class_init    = piix3_xen_class_init,
 };
 
+typedef struct PIIXState PIIX4State;
+
+#define TYPE_PIIX4_PCI_DEVICE "PIIX4"
+#define PIIX4_PCI_DEVICE(obj) \
+    OBJECT_CHECK(PIIX4State, (obj), TYPE_PIIX4_PCI_DEVICE)
+
+static const VMStateDescription vmstate_piix4 = {
+    .name = "PIIX4",
+    .version_id = 2,
+    .minimum_version_id = 2,
+    .fields = (VMStateField[]) {
+        VMSTATE_PCI_DEVICE(dev, PIIX4State),
+        VMSTATE_END_OF_LIST()
+    }
+};
+
+static void piix4_request_i8259_irq(void *opaque, int irq, int level)
+{
+    PIIX4State *s = opaque;
+    qemu_set_irq(s->cpu_intr, level);
+}
+
+static void piix4_set_i8259_irq(void *opaque, int irq, int level)
+{
+    PIIX4State *s = opaque;
+    qemu_set_irq(s->pic[irq], level);
+}
+
+static void piix4_reset(DeviceState *dev)
+{
+    PIIX4State *s = PIIX4_PCI_DEVICE(dev);
+    uint8_t *pci_conf = s->dev.config;
+
+    pci_conf[0x04] = 0x07; /* master, memory and I/O */
+    pci_conf[0x05] = 0x00;
+    pci_conf[0x06] = 0x00;
+    pci_conf[0x07] = 0x02; /* PCI_status_devsel_medium */
+    pci_conf[0x4c] = 0x4d;
+    pci_conf[0x4e] = 0x03;
+    pci_conf[0x4f] = 0x00;
+    pci_conf[0x60] = 0x0a; /* PCI A -> IRQ 10 */
+    pci_conf[0x61] = 0x0a; /* PCI B -> IRQ 10 */
+    pci_conf[0x62] = 0x0b; /* PCI C -> IRQ 11 */
+    pci_conf[0x63] = 0x0b; /* PCI D -> IRQ 11 */
+    pci_conf[0x69] = 0x02;
+    pci_conf[0x70] = 0x80;
+    pci_conf[0x76] = 0x0c;
+    pci_conf[0x77] = 0x0c;
+    pci_conf[0x78] = 0x02;
+    pci_conf[0x79] = 0x00;
+    pci_conf[0x80] = 0x00;
+    pci_conf[0x82] = 0x00;
+    pci_conf[0xa0] = 0x08;
+    pci_conf[0xa2] = 0x00;
+    pci_conf[0xa3] = 0x00;
+    pci_conf[0xa4] = 0x00;
+    pci_conf[0xa5] = 0x00;
+    pci_conf[0xa6] = 0x00;
+    pci_conf[0xa7] = 0x00;
+    pci_conf[0xa8] = 0x0f;
+    pci_conf[0xaa] = 0x00;
+    pci_conf[0xab] = 0x00;
+    pci_conf[0xac] = 0x00;
+    pci_conf[0xae] = 0x00;
+}
+
+PCIDevice *piix4_dev;
+
+static void piix4_realize(PCIDevice *pci_dev, Error **errp)
+{
+    DeviceState *dev = DEVICE(pci_dev);
+    PIIX4State *s = DO_UPCAST(PIIX4State, dev, pci_dev);
+    ISADevice *pit;
+    qemu_irq *i8259_out_irq;
+
+    piix_realize(pci_dev, s, errp);
+    if (errp) {
+        return;
+    }
+
+    qdev_init_gpio_in_named(dev, piix4_set_i8259_irq, "isa", ISA_NUM_IRQS);
+    qdev_init_gpio_out_named(dev, &s->cpu_intr, "intr", 1);
+
+    /* initialize i8259 pic */
+    i8259_out_irq = qemu_allocate_irqs(piix4_request_i8259_irq, s, 1);
+    s->pic = i8259_init(s->isa_bus, *i8259_out_irq);
+
+    /* initialize ISA irqs */
+    isa_bus_irqs(s->isa_bus, s->pic);
+
+    /* initialize pit */
+    pit = i8254_pit_init(s->isa_bus, 0x40, 0, NULL);
+
+    /* speaker */
+    pcspk_init(s->isa_bus, pit);
+
+    /* DMA */
+    i8257_dma_init(s->isa_bus, 0);
+
+    piix4_dev = pci_dev;
+}
+
+static void piix4_class_init(ObjectClass *klass, void *data)
+{
+    DeviceClass *dc = DEVICE_CLASS(klass);
+    PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
+
+    k->realize = piix4_realize;
+    k->vendor_id = PCI_VENDOR_ID_INTEL;
+    k->device_id = PCI_DEVICE_ID_INTEL_82371AB_0;
+    k->class_id = PCI_CLASS_BRIDGE_ISA;
+    dc->reset = piix4_reset;
+    dc->desc = "ISA bridge";
+    dc->vmsd = &vmstate_piix4;
+    /*
+     * Reason: part of PIIX4 southbridge, needs to be wired up,
+     * e.g. by mips_malta_init()
+     */
+    dc->user_creatable = false;
+    dc->hotpluggable = false;
+}
+
+static const TypeInfo piix4_info = {
+    .name          = TYPE_PIIX4_PCI_DEVICE,
+    .parent        = TYPE_PCI_DEVICE,
+    .instance_size = sizeof(PIIX4State),
+    .class_init    = piix4_class_init,
+    .interfaces = (InterfaceInfo[]) {
+        { INTERFACE_CONVENTIONAL_PCI_DEVICE },
+        { },
+    },
+};
+
 static void piix_register_types(void)
 {
     type_register_static(&piix3_pci_type_info);
     type_register_static(&piix3_info);
     type_register_static(&piix3_xen_info);
+    type_register_static(&piix4_info);
 }
 
 type_init(piix_register_types)
diff --git a/hw/isa/Makefile.objs b/hw/isa/Makefile.objs
index fa071082d4..40c34ba184 100644
--- a/hw/isa/Makefile.objs
+++ b/hw/isa/Makefile.objs
@@ -3,7 +3,6 @@ common-obj-$(CONFIG_ISA_BUS) += isa-superio.o
 common-obj-$(CONFIG_APM) += apm.o
 common-obj-$(CONFIG_I82378) += i82378.o
 common-obj-$(CONFIG_PC87312) += pc87312.o
-common-obj-$(CONFIG_PCI_PIIX) += piix4.o
 common-obj-$(CONFIG_VT82C686) += vt82c686.o
 
 obj-$(CONFIG_LPC_ICH9) += lpc_ich9.o
-- 
2.15.1

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

* [Qemu-devel] [NOTFORMERGE PATCH 29/29] piix4: add isa_superio_init
  2018-01-08  2:45 [Qemu-devel] [RFC PATCH 00/29] remove i386/pc dependency: generic SuperIO, PIIX cleanup Philippe Mathieu-Daudé
                   ` (27 preceding siblings ...)
  2018-01-08  2:45 ` [Qemu-devel] [PATCH 28/29] piix: merge common code from isa/piix4.c with southbridge piix3 Philippe Mathieu-Daudé
@ 2018-01-08  2:45 ` Philippe Mathieu-Daudé
  28 siblings, 0 replies; 32+ messages in thread
From: Philippe Mathieu-Daudé @ 2018-01-08  2:45 UTC (permalink / raw)
  To: Hervé Poussineau
  Cc: Philippe Mathieu-Daudé,
	qemu-devel, Michael S. Tsirkin, Paolo Bonzini

For Hervé to test his VirtualPC2007.

 hw/southbridge/piix.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/hw/southbridge/piix.c b/hw/southbridge/piix.c
index 53ee177866..b800d538da 100644
--- a/hw/southbridge/piix.c
+++ b/hw/southbridge/piix.c
@@ -32,6 +32,7 @@
 #include "hw/dma/i8257.h"
 #include "hw/audio/pcspk.h"
 #include "hw/timer/i8254.h"
+#include "hw/isa/superio.h"
 #include "hw/xen/xen.h"
 
 #define PIIX_NUM_PIC_IRQS       16      /* i8259 * 2 */
@@ -538,6 +539,8 @@ static void piix4_realize(PCIDevice *pci_dev, Error **errp)
     /* DMA */
     i8257_dma_init(s->isa_bus, 0);
 
+    isa_superio_init(s->isa_bus, 2, 1, 1);
+
     piix4_dev = pci_dev;
 }
 
-- 
2.15.1

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

* Re: [Qemu-devel] [PATCH 05/29] hw/input/i8042: extract declarations from i386/pc.h into input/i8042.h
  2018-01-08  2:45 ` [Qemu-devel] [PATCH 05/29] hw/input/i8042: extract declarations from i386/pc.h into input/i8042.h Philippe Mathieu-Daudé
@ 2018-01-08  2:54   ` David Gibson
  0 siblings, 0 replies; 32+ messages in thread
From: David Gibson @ 2018-01-08  2:54 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Paolo Bonzini, Michael S. Tsirkin, Hervé Poussineau,
	Aurelien Jarno, Eduardo Habkost, Marcel Apfelbaum, qemu-devel,
	Igor Mammedov, Richard Henderson, Yongbok Kim, Alexander Graf,
	Mark Cave-Ayland, Artyom Tarasenko, Guan Xuetao, open list:PReP

[-- Attachment #1: Type: text/plain, Size: 10352 bytes --]

On Sun, Jan 07, 2018 at 11:45:34PM -0300, Philippe Mathieu-Daudé wrote:
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

ppc parts

Acked-by: David Gibson <david@gibson.dropbear.id.au>

> ---
>  include/hw/i386/pc.h     |  9 ---------
>  include/hw/input/i8042.h | 25 +++++++++++++++++++++++++
>  hw/alpha/dp264.c         |  3 ++-
>  hw/i386/pc.c             |  1 +
>  hw/i386/vmmouse.c        |  1 +
>  hw/i386/vmport.c         |  1 +
>  hw/input/pckbd.c         |  2 +-
>  hw/mips/mips_fulong2e.c  |  3 ++-
>  hw/mips/mips_jazz.c      |  1 +
>  hw/mips/mips_malta.c     |  3 ++-
>  hw/mips/mips_r4k.c       |  3 ++-
>  hw/ppc/prep.c            |  5 +++--
>  hw/sparc64/sun4u.c       |  3 ++-
>  hw/unicore32/puv3.c      |  1 +
>  MAINTAINERS              |  1 +
>  15 files changed, 45 insertions(+), 17 deletions(-)
>  create mode 100644 include/hw/input/i8042.h
> 
> diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
> index 87a377011b..103c7a9916 100644
> --- a/include/hw/i386/pc.h
> +++ b/include/hw/i386/pc.h
> @@ -188,15 +188,6 @@ void vmport_register(unsigned char command, VMPortReadFunc *func, void *opaque);
>  void vmmouse_get_data(uint32_t *data);
>  void vmmouse_set_data(const uint32_t *data);
>  
> -/* pckbd.c */
> -#define I8042_A20_LINE "a20"
> -
> -void i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq,
> -                   MemoryRegion *region, ram_addr_t size,
> -                   hwaddr mask);
> -void i8042_isa_mouse_fake_event(void *opaque);
> -void i8042_setup_a20_line(ISADevice *dev, qemu_irq a20_out);
> -
>  /* pc.c */
>  extern int fd_bootchk;
>  
> diff --git a/include/hw/input/i8042.h b/include/hw/input/i8042.h
> new file mode 100644
> index 0000000000..15115004a3
> --- /dev/null
> +++ b/include/hw/input/i8042.h
> @@ -0,0 +1,25 @@
> +/*
> + * QEMU PS/2 Controller
> + *
> + * Copyright (c) 2003 Fabrice Bellard
> + *
> + * This work is licensed under the terms of the GNU GPL, version 2 or later.
> + * See the COPYING file in the top-level directory.
> + */
> +#ifndef HW_INPUT_I8042_H
> +#define HW_INPUT_I8042_H
> +
> +#include "hw/hw.h"
> +#include "hw/isa/isa.h"
> +
> +#define TYPE_I8042 "i8042"
> +
> +#define I8042_A20_LINE "a20"
> +
> +void i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq,
> +                   MemoryRegion *region, ram_addr_t size,
> +                   hwaddr mask);
> +void i8042_isa_mouse_fake_event(void *opaque);
> +void i8042_setup_a20_line(ISADevice *dev, qemu_irq a20_out);
> +
> +#endif /* HW_INPUT_I8042_H */
> diff --git a/hw/alpha/dp264.c b/hw/alpha/dp264.c
> index 766373eec7..e13cb576fd 100644
> --- a/hw/alpha/dp264.c
> +++ b/hw/alpha/dp264.c
> @@ -19,6 +19,7 @@
>  #include "hw/timer/mc146818rtc.h"
>  #include "hw/ide.h"
>  #include "hw/timer/i8254.h"
> +#include "hw/input/i8042.h"
>  #include "hw/char/serial.h"
>  #include "qemu/cutils.h"
>  
> @@ -81,7 +82,7 @@ static void clipper_init(MachineState *machine)
>      mc146818_rtc_init(isa_bus, 1900, rtc_irq);
>  
>      i8254_pit_init(isa_bus, 0x40, 0, NULL);
> -    isa_create_simple(isa_bus, "i8042");
> +    isa_create_simple(isa_bus, TYPE_I8042);
>  
>      /* VGA setup.  Don't bother loading the bios.  */
>      pci_vga_init(pci_bus);
> diff --git a/hw/i386/pc.c b/hw/i386/pc.c
> index e39af3d48c..e5c4e48ebb 100644
> --- a/hw/i386/pc.c
> +++ b/hw/i386/pc.c
> @@ -42,6 +42,7 @@
>  #include "hw/timer/mc146818rtc.h"
>  #include "hw/dma/i8257.h"
>  #include "hw/timer/i8254.h"
> +#include "hw/input/i8042.h"
>  #include "hw/audio/pcspk.h"
>  #include "hw/pci/msi.h"
>  #include "hw/sysbus.h"
> diff --git a/hw/i386/vmmouse.c b/hw/i386/vmmouse.c
> index 65ef55329e..5d2d278be4 100644
> --- a/hw/i386/vmmouse.c
> +++ b/hw/i386/vmmouse.c
> @@ -25,6 +25,7 @@
>  #include "hw/hw.h"
>  #include "ui/console.h"
>  #include "hw/i386/pc.h"
> +#include "hw/input/i8042.h"
>  #include "hw/qdev.h"
>  
>  /* debug only vmmouse */
> diff --git a/hw/i386/vmport.c b/hw/i386/vmport.c
> index 116aa09819..3bf8cfe041 100644
> --- a/hw/i386/vmport.c
> +++ b/hw/i386/vmport.c
> @@ -25,6 +25,7 @@
>  #include "hw/hw.h"
>  #include "hw/isa/isa.h"
>  #include "hw/i386/pc.h"
> +#include "hw/input/i8042.h"
>  #include "sysemu/hw_accel.h"
>  #include "hw/qdev.h"
>  #include "qemu/log.h"
> diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c
> index c479f827b6..f17f18e51b 100644
> --- a/hw/input/pckbd.c
> +++ b/hw/input/pckbd.c
> @@ -26,6 +26,7 @@
>  #include "hw/isa/isa.h"
>  #include "hw/i386/pc.h"
>  #include "hw/input/ps2.h"
> +#include "hw/input/i8042.h"
>  #include "sysemu/sysemu.h"
>  
>  /* debug PC keyboard */
> @@ -480,7 +481,6 @@ void i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq,
>      qemu_register_reset(kbd_reset, s);
>  }
>  
> -#define TYPE_I8042 "i8042"
>  #define I8042(obj) OBJECT_CHECK(ISAKBDState, (obj), TYPE_I8042)
>  
>  typedef struct ISAKBDState {
> diff --git a/hw/mips/mips_fulong2e.c b/hw/mips/mips_fulong2e.c
> index cbe159034d..8660d078c8 100644
> --- a/hw/mips/mips_fulong2e.c
> +++ b/hw/mips/mips_fulong2e.c
> @@ -44,6 +44,7 @@
>  #include "hw/isa/vt82c686.h"
>  #include "hw/timer/mc146818rtc.h"
>  #include "hw/timer/i8254.h"
> +#include "hw/input/i8042.h"
>  #include "sysemu/blockdev.h"
>  #include "exec/address-spaces.h"
>  #include "sysemu/qtest.h"
> @@ -365,7 +366,7 @@ static void mips_fulong2e_init(MachineState *machine)
>      i8257_dma_init(isa_bus, 0);
>  
>      /* Super I/O */
> -    isa_create_simple(isa_bus, "i8042");
> +    isa_create_simple(isa_bus, TYPE_I8042);
>  
>      mc146818_rtc_init(isa_bus, 2000, NULL);
>  
> diff --git a/hw/mips/mips_jazz.c b/hw/mips/mips_jazz.c
> index 6ed4b83f40..7a83009059 100644
> --- a/hw/mips/mips_jazz.c
> +++ b/hw/mips/mips_jazz.c
> @@ -43,6 +43,7 @@
>  #include "hw/timer/i8254.h"
>  #include "hw/display/vga.h"
>  #include "hw/audio/pcspk.h"
> +#include "hw/input/i8042.h"
>  #include "sysemu/block-backend.h"
>  #include "hw/sysbus.h"
>  #include "exec/address-spaces.h"
> diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c
> index 0a9e3dedf4..28cc37ee08 100644
> --- a/hw/mips/mips_malta.c
> +++ b/hw/mips/mips_malta.c
> @@ -47,6 +47,7 @@
>  #include "hw/loader.h"
>  #include "elf.h"
>  #include "hw/timer/mc146818rtc.h"
> +#include "hw/input/i8042.h"
>  #include "hw/timer/i8254.h"
>  #include "sysemu/blockdev.h"
>  #include "exec/address-spaces.h"
> @@ -1214,7 +1215,7 @@ void mips_malta_init(MachineState *machine)
>      i8257_dma_init(isa_bus, 0);
>  
>      /* Super I/O */
> -    isa_create_simple(isa_bus, "i8042");
> +    isa_create_simple(isa_bus, TYPE_I8042);
>  
>      mc146818_rtc_init(isa_bus, 2000, NULL);
>      serial_hds_isa_init(isa_bus, 0, 2);
> diff --git a/hw/mips/mips_r4k.c b/hw/mips/mips_r4k.c
> index 244bd41813..92acae149d 100644
> --- a/hw/mips/mips_r4k.c
> +++ b/hw/mips/mips_r4k.c
> @@ -28,6 +28,7 @@
>  #include "hw/loader.h"
>  #include "elf.h"
>  #include "hw/timer/mc146818rtc.h"
> +#include "hw/input/i8042.h"
>  #include "hw/timer/i8254.h"
>  #include "sysemu/block-backend.h"
>  #include "exec/address-spaces.h"
> @@ -288,7 +289,7 @@ void mips_r4k_init(MachineState *machine)
>                       hd[MAX_IDE_DEVS * i],
>  		     hd[MAX_IDE_DEVS * i + 1]);
>  
> -    isa_create_simple(isa_bus, "i8042");
> +    isa_create_simple(isa_bus, TYPE_I8042);
>  }
>  
>  static void mips_machine_init(MachineClass *mc)
> diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c
> index af08ac319a..4304e93ada 100644
> --- a/hw/ppc/prep.c
> +++ b/hw/ppc/prep.c
> @@ -41,6 +41,7 @@
>  #include "hw/ide.h"
>  #include "hw/loader.h"
>  #include "hw/timer/mc146818rtc.h"
> +#include "hw/input/i8042.h"
>  #include "hw/isa/pc87312.h"
>  #include "hw/net/ne2000-isa.h"
>  #include "sysemu/block-backend.h"
> @@ -641,7 +642,7 @@ static void ppc_prep_init(MachineState *machine)
>                       hd[2 * i],
>  		     hd[2 * i + 1]);
>      }
> -    isa_create_simple(isa_bus, "i8042");
> +    isa_create_simple(isa_bus, TYPE_I8042);
>  
>      cpu = POWERPC_CPU(first_cpu);
>      sysctrl->reset_irq = cpu->env.irq_inputs[PPC6xx_INPUT_HRESET];
> @@ -771,7 +772,7 @@ static void ibm_40p_init(MachineState *machine)
>  
>      /* add some more devices */
>      if (defaults_enabled()) {
> -        isa_create_simple(isa_bus, "i8042");
> +        isa_create_simple(isa_bus, TYPE_I8042);
>          m48t59 = NVRAM(isa_create_simple(isa_bus, "isa-m48t59"));
>  
>          dev = DEVICE(isa_create(isa_bus, "cs4231a"));
> diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c
> index 135f8088ca..2a60f5c1d6 100644
> --- a/hw/sparc64/sun4u.c
> +++ b/hw/sparc64/sun4u.c
> @@ -33,6 +33,7 @@
>  #include "hw/char/serial.h"
>  #include "hw/char/parallel.h"
>  #include "hw/timer/m48t59.h"
> +#include "hw/input/i8042.h"
>  #include "hw/block/fdc.h"
>  #include "net/net.h"
>  #include "qemu/timer.h"
> @@ -513,7 +514,7 @@ static void sun4uv_init(MemoryRegion *address_space_mem,
>      qdev_init_nofail(&pci_dev->qdev);
>      pci_ide_create_devs(pci_dev, hd);
>  
> -    isa_create_simple(isa_bus, "i8042");
> +    isa_create_simple(isa_bus, TYPE_I8042);
>  
>      /* Floppy */
>      for(i = 0; i < MAX_FD; i++) {
> diff --git a/hw/unicore32/puv3.c b/hw/unicore32/puv3.c
> index db26959a1d..830fe3face 100644
> --- a/hw/unicore32/puv3.c
> +++ b/hw/unicore32/puv3.c
> @@ -20,6 +20,7 @@
>  
>  #undef DEBUG_PUV3
>  #include "hw/unicore32/puv3.h"
> +#include "hw/input/i8042.h"
>  
>  #define KERNEL_LOAD_ADDR        0x03000000
>  #define KERNEL_MAX_SIZE         0x00800000 /* Just a guess */
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 89810df375..7f9e98a046 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -885,6 +885,7 @@ F: include/hw/display/vga.h
>  F: include/hw/char/parallel.h
>  F: include/hw/dma/i8257.h
>  F: include/hw/i2c/pm_smbus.h
> +F: include/hw/input/i8042.h
>  F: include/hw/timer/hpet.h
>  F: include/hw/timer/i8254*
>  F: include/hw/timer/mc146818rtc*

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [Qemu-devel] [PATCH 06/29] hw/isa: add a generic isa_superio_init()
  2018-01-08  2:45 ` [Qemu-devel] [PATCH 06/29] hw/isa: add a generic isa_superio_init() Philippe Mathieu-Daudé
@ 2018-01-14 18:22   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 32+ messages in thread
From: Philippe Mathieu-Daudé @ 2018-01-14 18:22 UTC (permalink / raw)
  To: Paolo Bonzini, Michael S. Tsirkin, Hervé Poussineau,
	Aurelien Jarno, Eduardo Habkost, Marcel Apfelbaum
  Cc: qemu-devel, Igor Mammedov

On 01/07/2018 11:45 PM, Philippe Mathieu-Daudé wrote:
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>  include/hw/isa/superio.h | 17 +++++++++++++++++
>  hw/isa/isa-superio.c     | 45 +++++++++++++++++++++++++++++++++++++++++++++
>  MAINTAINERS              |  2 ++
>  hw/isa/Makefile.objs     |  1 +
>  4 files changed, 65 insertions(+)
>  create mode 100644 include/hw/isa/superio.h
>  create mode 100644 hw/isa/isa-superio.c
> 
> diff --git a/include/hw/isa/superio.h b/include/hw/isa/superio.h
> new file mode 100644
> index 0000000000..e685b96653
> --- /dev/null
> +++ b/include/hw/isa/superio.h
> @@ -0,0 +1,17 @@
> +/*
> + * Generic ISA Super I/O
> + *
> + * Copyright (c) 2018 Philippe Mathieu-Daudé
> + *
> + * This work is licensed under the terms of the GNU GPL, version 2 or later.
> + * See the COPYING file in the top-level directory.
> + */
> +#ifndef HW_ISA_SUPERIO_H
> +#define HW_ISA_SUPERIO_H
> +
> +#include "hw/isa/isa.h"
> +
> +ISADevice *isa_superio_init(ISABus *isa_bus, int serial_count,
> +                            int parallel_count, int drive_count);

This approach is simple enough, but how Hervé wrote hw/isa/pc87312.c is
way cleaner, so I'll respin using it.

> +
> +#endif
> diff --git a/hw/isa/isa-superio.c b/hw/isa/isa-superio.c
> new file mode 100644
> index 0000000000..93d8457c6b
> --- /dev/null
> +++ b/hw/isa/isa-superio.c
> @@ -0,0 +1,45 @@
> +/*
> + * Generic ISA Super I/O
> + *
> + * Copyright (c) 2018 Philippe Mathieu-Daudé
> + *
> + * This work is licensed under the terms of the GNU GPL, version 2 or later.
> + * See the COPYING file in the top-level directory.
> + */
> +#include "qemu/osdep.h"
> +#include "qemu/error-report.h"
> +#include "sysemu/blockdev.h"
> +#include "hw/isa/superio.h"
> +#include "hw/char/serial.h"
> +#include "hw/char/parallel.h"
> +#include "hw/block/fdc.h"
> +#include "hw/input/i8042.h"
> +
> +ISADevice *isa_superio_init(ISABus *isa_bus, int serial_count,
> +                            int parallel_count, int drive_count)
> +{
> +    serial_hds_isa_init(isa_bus, 0, serial_count);
> +
> +    parallel_hds_isa_init(isa_bus, parallel_count);
> +
> +    if (drive_count) {
> +        DriveInfo **fd;
> +        int i;
> +
> +        if (drive_count > MAX_FD) {
> +            warn_report("superio: ignoring %d floppy controllers",
> +                        drive_count - MAX_FD);
> +            drive_count = MAX_FD;
> +        }
> +        fd = g_new(DriveInfo *, drive_count);
> +
> +        for (i = 0; i < drive_count; i++) {
> +            fd[i] = drive_get(IF_FLOPPY, 0, i);
> +        }
> +        fdctrl_init_isa(isa_bus, fd);
> +
> +        g_free(fd); /* FIXME */
> +    }
> +
> +    return isa_create_simple(isa_bus, TYPE_I8042);
> +}
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 7f9e98a046..6f867da743 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -875,6 +875,7 @@ F: hw/input/pckbd.c
>  F: hw/intc/apic*
>  F: hw/intc/ioapic*
>  F: hw/intc/i8259*
> +F: hw/isa/isa-superio.c
>  F: hw/misc/debugexit.c
>  F: hw/misc/pc-testdev.c
>  F: hw/timer/hpet*
> @@ -885,6 +886,7 @@ F: include/hw/display/vga.h
>  F: include/hw/char/parallel.h
>  F: include/hw/dma/i8257.h
>  F: include/hw/i2c/pm_smbus.h
> +F: include/hw/isa/superio.h
>  F: include/hw/input/i8042.h
>  F: include/hw/timer/hpet.h
>  F: include/hw/timer/i8254*
> diff --git a/hw/isa/Makefile.objs b/hw/isa/Makefile.objs
> index fb37c55cf2..cac655ba58 100644
> --- a/hw/isa/Makefile.objs
> +++ b/hw/isa/Makefile.objs
> @@ -1,4 +1,5 @@
>  common-obj-$(CONFIG_ISA_BUS) += isa-bus.o
> +common-obj-$(CONFIG_ISA_BUS) += isa-superio.o
>  common-obj-$(CONFIG_APM) += apm.o
>  common-obj-$(CONFIG_I82378) += i82378.o
>  common-obj-$(CONFIG_PC87312) += pc87312.o
> 

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

end of thread, other threads:[~2018-01-14 18:22 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-08  2:45 [Qemu-devel] [RFC PATCH 00/29] remove i386/pc dependency: generic SuperIO, PIIX cleanup Philippe Mathieu-Daudé
2018-01-08  2:45 ` [Qemu-devel] [PATCH 01/29] hw/acpi: add mem/nvdimm.h dependency Philippe Mathieu-Daudé
2018-01-08  2:45 ` [Qemu-devel] [PATCH 02/29] pci/pci_host: move generic definitions out of i386/pc.h Philippe Mathieu-Daudé
2018-01-08  2:45 ` [Qemu-devel] [PATCH 03/29] hw/isa: extract parallel-isa specific code Philippe Mathieu-Daudé
2018-01-08  2:45 ` [Qemu-devel] [PATCH 04/29] hw/dma/i8257: rename DMA_init() to i8257_dma_init() Philippe Mathieu-Daudé
2018-01-08  2:45 ` [Qemu-devel] [PATCH 05/29] hw/input/i8042: extract declarations from i386/pc.h into input/i8042.h Philippe Mathieu-Daudé
2018-01-08  2:54   ` David Gibson
2018-01-08  2:45 ` [Qemu-devel] [PATCH 06/29] hw/isa: add a generic isa_superio_init() Philippe Mathieu-Daudé
2018-01-14 18:22   ` Philippe Mathieu-Daudé
2018-01-08  2:45 ` [Qemu-devel] [PATCH 07/29] hw/i386/pc: use isa_superio_init() Philippe Mathieu-Daudé
2018-01-08  2:45 ` [Qemu-devel] [PATCH 08/29] hw/mips/fulong2e: " Philippe Mathieu-Daudé
2018-01-08  2:45 ` [Qemu-devel] [PATCH 09/29] hw/mips/malta: code movement Philippe Mathieu-Daudé
2018-01-08  2:45 ` [Qemu-devel] [PATCH 10/29] hw/mips/malta: add fdc37m81x_init() which uses isa_superio_init() Philippe Mathieu-Daudé
2018-01-08  2:45 ` [Qemu-devel] [PATCH 11/29] mc146818rtc: always register rtc to rtc list Philippe Mathieu-Daudé
2018-01-08  2:45 ` [Qemu-devel] [PATCH 12/29] piix4: rename some variables in realize function Philippe Mathieu-Daudé
2018-01-08  2:45 ` [Qemu-devel] [PATCH 13/29] piix4: convert reset function to QOM Philippe Mathieu-Daudé
2018-01-08  2:45 ` [Qemu-devel] [PATCH 14/29] piix4: add Reset Control Register Philippe Mathieu-Daudé
2018-01-08  2:45 ` [Qemu-devel] [PATCH 15/29] piix4: add a i8259 interrupt controller as specified in datasheet Philippe Mathieu-Daudé
2018-01-08  2:45 ` [Qemu-devel] [RFC PATCH 16/29] Revert "irq: introduce qemu_irq_proxy()" Philippe Mathieu-Daudé
2018-01-08  2:45 ` [Qemu-devel] [PATCH 17/29] piix: move piix4 declaration into new southbridge/i82371_piix.h Philippe Mathieu-Daudé
2018-01-08  2:45 ` [Qemu-devel] [PATCH 18/29] piix4: add a i8257 dma controller as specified in datasheet Philippe Mathieu-Daudé
2018-01-08  2:45 ` [Qemu-devel] [PATCH 19/29] piix4: add a i8254 pit " Philippe Mathieu-Daudé
2018-01-08  2:45 ` [Qemu-devel] [PATCH 20/29] piix4: add a speaker " Philippe Mathieu-Daudé
2018-01-08  2:45 ` [Qemu-devel] [PATCH 21/29] piix: move southbridge related declarations/definitions to i82371_piix.h Philippe Mathieu-Daudé
2018-01-08  2:45 ` [Qemu-devel] [PATCH 22/29] piix3: extract piix3_init() from i440fx_init() Philippe Mathieu-Daudé
2018-01-08  2:45 ` [Qemu-devel] [PATCH 23/29] hw/i386: extract i440fx related declarations/definitions to i440fx.h Philippe Mathieu-Daudé
2018-01-08  2:45 ` [Qemu-devel] [PATCH 24/29] hw/i386: extract i440fx code from piix.c into i440fx.c Philippe Mathieu-Daudé
2018-01-08  2:45 ` [Qemu-devel] [PATCH 25/29] hw/i386: move piix from hw/pci-host to hw/southbridge Philippe Mathieu-Daudé
2018-01-08  2:45 ` [Qemu-devel] [PATCH 26/29] configs/mips-softmmu: use common CONFIG_PCI_PIIX instead of CONFIG_PIIX4 Philippe Mathieu-Daudé
2018-01-08  2:45 ` [Qemu-devel] [PATCH 27/29] piix3: convert reset function to QOM Philippe Mathieu-Daudé
2018-01-08  2:45 ` [Qemu-devel] [PATCH 28/29] piix: merge common code from isa/piix4.c with southbridge piix3 Philippe Mathieu-Daudé
2018-01-08  2:45 ` [Qemu-devel] [NOTFORMERGE PATCH 29/29] piix4: add isa_superio_init Philippe Mathieu-Daudé

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.