* [PATCH 0/4] hw/isa/piix: Housekeeping QOM names / macros
@ 2023-02-10 16:57 Philippe Mathieu-Daudé
2023-02-10 16:57 ` [PATCH 1/4] hw/southbridge/piix: Use OBJECT_DECLARE_SIMPLE_TYPE() macro Philippe Mathieu-Daudé
` (4 more replies)
0 siblings, 5 replies; 10+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-02-10 16:57 UTC (permalink / raw)
To: qemu-devel
Cc: Eduardo Habkost, Thomas Huth, Michael S. Tsirkin,
Richard Henderson, Hervé Poussineau,
Philippe Mathieu-Daudé
- Use QOM macros
- Unify QOM type names
Based-on: <20230210163744.32182-1-philmd@linaro.org>
Philippe Mathieu-Daudé (4):
hw/southbridge/piix: Use OBJECT_DECLARE_SIMPLE_TYPE() macro
hw/isa/piix: Batch register QOM types using DEFINE_TYPES() macro
hw/isa/piix: Unify QOM type name of PIIX ISA function
hw/isa/piix: Unify PIIX-ISA QOM type names using qdev aliases
hw/i386/pc_piix.c | 5 ++-
hw/isa/piix3.c | 63 +++++++++++++++--------------------
hw/isa/piix4.c | 10 +++---
hw/mips/malta.c | 2 +-
include/hw/southbridge/piix.h | 14 ++++----
softmmu/qdev-monitor.c | 3 ++
6 files changed, 44 insertions(+), 53 deletions(-)
--
2.38.1
^ permalink raw reply [flat|nested] 10+ messages in thread* [PATCH 1/4] hw/southbridge/piix: Use OBJECT_DECLARE_SIMPLE_TYPE() macro 2023-02-10 16:57 [PATCH 0/4] hw/isa/piix: Housekeeping QOM names / macros Philippe Mathieu-Daudé @ 2023-02-10 16:57 ` Philippe Mathieu-Daudé 2023-02-28 21:35 ` Bernhard Beschow 2023-02-10 16:57 ` [PATCH 2/4] hw/isa/piix: Batch register QOM types using DEFINE_TYPES() macro Philippe Mathieu-Daudé ` (3 subsequent siblings) 4 siblings, 1 reply; 10+ messages in thread From: Philippe Mathieu-Daudé @ 2023-02-10 16:57 UTC (permalink / raw) To: qemu-devel Cc: Eduardo Habkost, Thomas Huth, Michael S. Tsirkin, Richard Henderson, Hervé Poussineau, Philippe Mathieu-Daudé, Aurelien Jarno, Marcel Apfelbaum Manually convert to OBJECT_DECLARE_SIMPLE_TYPE() macro, similarly to automatic conversion from commit 8063396bf3 ("Use OBJECT_DECLARE_SIMPLE_TYPE when possible"). Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> --- include/hw/southbridge/piix.h | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/include/hw/southbridge/piix.h b/include/hw/southbridge/piix.h index 0bf48e936d..a58bf13a41 100644 --- a/include/hw/southbridge/piix.h +++ b/include/hw/southbridge/piix.h @@ -29,7 +29,7 @@ #define PIIX_NUM_PIC_IRQS 16 /* i8259 * 2 */ #define PIIX_NUM_PIRQS 4ULL /* PIRQ[A-D] */ -struct PIIXState { +struct PIIX3State { PCIDevice dev; /* @@ -57,14 +57,12 @@ struct PIIXState { /* IO memory region for Reset Control Register (PIIX_RCR_IOPORT) */ MemoryRegion rcr_mem; }; -typedef struct PIIXState PIIX3State; #define TYPE_PIIX3_PCI_DEVICE "pci-piix3" -DECLARE_INSTANCE_CHECKER(PIIX3State, PIIX3_PCI_DEVICE, - TYPE_PIIX3_PCI_DEVICE) - #define TYPE_PIIX3_DEVICE "PIIX3" #define TYPE_PIIX3_XEN_DEVICE "PIIX3-xen" #define TYPE_PIIX4_PCI_DEVICE "piix4-isa" +OBJECT_DECLARE_SIMPLE_TYPE(PIIX3State, PIIX3_PCI_DEVICE) + #endif -- 2.38.1 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 1/4] hw/southbridge/piix: Use OBJECT_DECLARE_SIMPLE_TYPE() macro 2023-02-10 16:57 ` [PATCH 1/4] hw/southbridge/piix: Use OBJECT_DECLARE_SIMPLE_TYPE() macro Philippe Mathieu-Daudé @ 2023-02-28 21:35 ` Bernhard Beschow 2023-02-28 22:28 ` Philippe Mathieu-Daudé 0 siblings, 1 reply; 10+ messages in thread From: Bernhard Beschow @ 2023-02-28 21:35 UTC (permalink / raw) To: qemu-devel, Philippe Mathieu-Daudé Cc: Eduardo Habkost, Thomas Huth, Michael S. Tsirkin, Richard Henderson, Hervé Poussineau, Aurelien Jarno, Marcel Apfelbaum Am 10. Februar 2023 16:57:51 UTC schrieb "Philippe Mathieu-Daudé" <philmd@linaro.org>: >Manually convert to OBJECT_DECLARE_SIMPLE_TYPE() macro, >similarly to automatic conversion from commit 8063396bf3 >("Use OBJECT_DECLARE_SIMPLE_TYPE when possible"). > >Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> >--- > include/hw/southbridge/piix.h | 8 +++----- > 1 file changed, 3 insertions(+), 5 deletions(-) > >diff --git a/include/hw/southbridge/piix.h b/include/hw/southbridge/piix.h >index 0bf48e936d..a58bf13a41 100644 >--- a/include/hw/southbridge/piix.h >+++ b/include/hw/southbridge/piix.h >@@ -29,7 +29,7 @@ > #define PIIX_NUM_PIC_IRQS 16 /* i8259 * 2 */ > #define PIIX_NUM_PIRQS 4ULL /* PIRQ[A-D] */ > >-struct PIIXState { >+struct PIIX3State { > PCIDevice dev; > > /* >@@ -57,14 +57,12 @@ struct PIIXState { > /* IO memory region for Reset Control Register (PIIX_RCR_IOPORT) */ > MemoryRegion rcr_mem; > }; >-typedef struct PIIXState PIIX3State; > > #define TYPE_PIIX3_PCI_DEVICE "pci-piix3" >-DECLARE_INSTANCE_CHECKER(PIIX3State, PIIX3_PCI_DEVICE, >- TYPE_PIIX3_PCI_DEVICE) >- > #define TYPE_PIIX3_DEVICE "PIIX3" > #define TYPE_PIIX3_XEN_DEVICE "PIIX3-xen" > #define TYPE_PIIX4_PCI_DEVICE "piix4-isa" > >+OBJECT_DECLARE_SIMPLE_TYPE(PIIX3State, PIIX3_PCI_DEVICE) >+ > #endif The PIIX consolidation series drops the "3" for reuse by PIIX4. Do we really need this? ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/4] hw/southbridge/piix: Use OBJECT_DECLARE_SIMPLE_TYPE() macro 2023-02-28 21:35 ` Bernhard Beschow @ 2023-02-28 22:28 ` Philippe Mathieu-Daudé 0 siblings, 0 replies; 10+ messages in thread From: Philippe Mathieu-Daudé @ 2023-02-28 22:28 UTC (permalink / raw) To: Bernhard Beschow, qemu-devel Cc: Eduardo Habkost, Thomas Huth, Michael S. Tsirkin, Richard Henderson, Hervé Poussineau, Aurelien Jarno, Marcel Apfelbaum On 28/2/23 22:35, Bernhard Beschow wrote: > > > Am 10. Februar 2023 16:57:51 UTC schrieb "Philippe Mathieu-Daudé" <philmd@linaro.org>: >> Manually convert to OBJECT_DECLARE_SIMPLE_TYPE() macro, >> similarly to automatic conversion from commit 8063396bf3 >> ("Use OBJECT_DECLARE_SIMPLE_TYPE when possible"). >> >> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> >> --- >> include/hw/southbridge/piix.h | 8 +++----- >> 1 file changed, 3 insertions(+), 5 deletions(-) >> >> diff --git a/include/hw/southbridge/piix.h b/include/hw/southbridge/piix.h >> index 0bf48e936d..a58bf13a41 100644 >> --- a/include/hw/southbridge/piix.h >> +++ b/include/hw/southbridge/piix.h >> @@ -29,7 +29,7 @@ >> #define PIIX_NUM_PIC_IRQS 16 /* i8259 * 2 */ >> #define PIIX_NUM_PIRQS 4ULL /* PIRQ[A-D] */ >> >> -struct PIIXState { >> +struct PIIX3State { >> PCIDevice dev; >> >> /* >> @@ -57,14 +57,12 @@ struct PIIXState { >> /* IO memory region for Reset Control Register (PIIX_RCR_IOPORT) */ >> MemoryRegion rcr_mem; >> }; >> -typedef struct PIIXState PIIX3State; >> >> #define TYPE_PIIX3_PCI_DEVICE "pci-piix3" >> -DECLARE_INSTANCE_CHECKER(PIIX3State, PIIX3_PCI_DEVICE, >> - TYPE_PIIX3_PCI_DEVICE) >> - >> #define TYPE_PIIX3_DEVICE "PIIX3" >> #define TYPE_PIIX3_XEN_DEVICE "PIIX3-xen" >> #define TYPE_PIIX4_PCI_DEVICE "piix4-isa" >> >> +OBJECT_DECLARE_SIMPLE_TYPE(PIIX3State, PIIX3_PCI_DEVICE) >> + >> #endif > > The PIIX consolidation series drops the "3" for reuse by PIIX4. Do we really need this? Unfortunately we do to be able to use the OBJECT_DECLARE_SIMPLE_TYPE() macro which generates the typedefs. When I get to your patches later this indeed ends as (PIIXState, PIIX_PCI_DEVICE). ^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 2/4] hw/isa/piix: Batch register QOM types using DEFINE_TYPES() macro 2023-02-10 16:57 [PATCH 0/4] hw/isa/piix: Housekeeping QOM names / macros Philippe Mathieu-Daudé 2023-02-10 16:57 ` [PATCH 1/4] hw/southbridge/piix: Use OBJECT_DECLARE_SIMPLE_TYPE() macro Philippe Mathieu-Daudé @ 2023-02-10 16:57 ` Philippe Mathieu-Daudé 2023-02-10 16:57 ` [PATCH 3/4] hw/isa/piix: Unify QOM type name of PIIX ISA function Philippe Mathieu-Daudé ` (2 subsequent siblings) 4 siblings, 0 replies; 10+ messages in thread From: Philippe Mathieu-Daudé @ 2023-02-10 16:57 UTC (permalink / raw) To: qemu-devel Cc: Eduardo Habkost, Thomas Huth, Michael S. Tsirkin, Richard Henderson, Hervé Poussineau, Philippe Mathieu-Daudé, Marcel Apfelbaum See rationale in commit 38b5d79b2e ("qom: add helper macro DEFINE_TYPES()"). Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> --- hw/isa/piix3.c | 53 +++++++++++++++++++++----------------------------- 1 file changed, 22 insertions(+), 31 deletions(-) diff --git a/hw/isa/piix3.c b/hw/isa/piix3.c index a9cb39bf21..0ee94a2313 100644 --- a/hw/isa/piix3.c +++ b/hw/isa/piix3.c @@ -346,19 +346,6 @@ static void pci_piix3_class_init(ObjectClass *klass, void *data) adevc->build_dev_aml = build_pci_isa_aml; } -static const TypeInfo piix3_pci_type_info = { - .name = TYPE_PIIX3_PCI_DEVICE, - .parent = TYPE_PCI_DEVICE, - .instance_size = sizeof(PIIX3State), - .abstract = true, - .class_init = pci_piix3_class_init, - .interfaces = (InterfaceInfo[]) { - { INTERFACE_CONVENTIONAL_PCI_DEVICE }, - { TYPE_ACPI_DEV_AML_IF }, - { }, - }, -}; - static void piix3_realize(PCIDevice *dev, Error **errp) { ERRP_GUARD(); @@ -382,12 +369,6 @@ static void piix3_class_init(ObjectClass *klass, void *data) k->realize = piix3_realize; } -static const TypeInfo piix3_info = { - .name = TYPE_PIIX3_DEVICE, - .parent = TYPE_PIIX3_PCI_DEVICE, - .class_init = piix3_class_init, -}; - static void piix3_xen_realize(PCIDevice *dev, Error **errp) { ERRP_GUARD(); @@ -416,17 +397,27 @@ static void piix3_xen_class_init(ObjectClass *klass, void *data) k->realize = piix3_xen_realize; } -static const TypeInfo piix3_xen_info = { - .name = TYPE_PIIX3_XEN_DEVICE, - .parent = TYPE_PIIX3_PCI_DEVICE, - .class_init = piix3_xen_class_init, +static const TypeInfo piix_isa_types[] = { + { + .name = TYPE_PIIX3_PCI_DEVICE, + .parent = TYPE_PCI_DEVICE, + .instance_size = sizeof(PIIX3State), + .class_init = pci_piix3_class_init, + .abstract = true, + .interfaces = (InterfaceInfo[]) { + { INTERFACE_CONVENTIONAL_PCI_DEVICE }, + { TYPE_ACPI_DEV_AML_IF }, + { }, + }, + }, { + .name = TYPE_PIIX3_DEVICE, + .parent = TYPE_PIIX3_PCI_DEVICE, + .class_init = piix3_class_init, + }, { + .name = TYPE_PIIX3_XEN_DEVICE, + .parent = TYPE_PIIX3_PCI_DEVICE, + .class_init = piix3_xen_class_init, + } }; -static void piix3_register_types(void) -{ - type_register_static(&piix3_pci_type_info); - type_register_static(&piix3_info); - type_register_static(&piix3_xen_info); -} - -type_init(piix3_register_types) +DEFINE_TYPES(piix_isa_types) -- 2.38.1 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 3/4] hw/isa/piix: Unify QOM type name of PIIX ISA function 2023-02-10 16:57 [PATCH 0/4] hw/isa/piix: Housekeeping QOM names / macros Philippe Mathieu-Daudé 2023-02-10 16:57 ` [PATCH 1/4] hw/southbridge/piix: Use OBJECT_DECLARE_SIMPLE_TYPE() macro Philippe Mathieu-Daudé 2023-02-10 16:57 ` [PATCH 2/4] hw/isa/piix: Batch register QOM types using DEFINE_TYPES() macro Philippe Mathieu-Daudé @ 2023-02-10 16:57 ` Philippe Mathieu-Daudé 2023-02-28 21:55 ` Bernhard Beschow 2023-02-10 16:57 ` [PATCH 4/4] hw/isa/piix: Unify PIIX-ISA QOM type names using qdev aliases Philippe Mathieu-Daudé 2023-02-28 13:35 ` [PATCH 0/4] hw/isa/piix: Housekeeping QOM names / macros Philippe Mathieu-Daudé 4 siblings, 1 reply; 10+ messages in thread From: Philippe Mathieu-Daudé @ 2023-02-10 16:57 UTC (permalink / raw) To: qemu-devel Cc: Eduardo Habkost, Thomas Huth, Michael S. Tsirkin, Richard Henderson, Hervé Poussineau, Philippe Mathieu-Daudé, Marcel Apfelbaum, Paolo Bonzini, Aurelien Jarno Mechanical change doing: $ sed -i -e 's/PIIX4_PCI_DEVICE/PIIX4_ISA/g' $(git grep -l PIIX4_PCI_DEVICE) $ sed -i -e 's/PIIX3_XEN_DEVICE/PIIX3_ISA_XEN/g' $(git grep -l PIIX3_XEN_DEVICE) $ sed -i -e 's/PIIX3_DEVICE/PIIX3_ISA/g' $(git grep -l PIIX3_DEVICE) $ sed -i -e 's/PIIX3_PCI_DEVICE/PIIX_ISA/g' $(git grep -l PIIX3_PCI_DEVICE) Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> --- hw/i386/pc_piix.c | 5 ++--- hw/isa/piix3.c | 20 ++++++++++---------- hw/isa/piix4.c | 10 +++++----- hw/mips/malta.c | 2 +- include/hw/southbridge/piix.h | 10 +++++----- 5 files changed, 23 insertions(+), 24 deletions(-) diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 7c48ba30e0..afef5ed115 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -220,8 +220,7 @@ static void pc_init1(MachineState *machine, if (pcmc->pci_enabled) { PIIX3State *piix3; PCIDevice *pci_dev; - const char *type = xen_enabled() ? TYPE_PIIX3_XEN_DEVICE - : TYPE_PIIX3_DEVICE; + const char *type = xen_enabled() ? TYPE_PIIX3_ISA_XEN : TYPE_PIIX3_ISA; pci_bus = i440fx_init(pci_type, i440fx_host, @@ -235,7 +234,7 @@ static void pc_init1(MachineState *machine, pcms->bus = pci_bus; pci_dev = pci_create_simple_multifunction(pci_bus, -1, true, type); - piix3 = PIIX3_PCI_DEVICE(pci_dev); + piix3 = PIIX3_ISA(pci_dev); piix3->pic = x86ms->gsi; piix3_devfn = piix3->dev.devfn; isa_bus = ISA_BUS(qdev_get_child_bus(DEVICE(piix3), "isa.0")); diff --git a/hw/isa/piix3.c b/hw/isa/piix3.c index 0ee94a2313..38e0c269ae 100644 --- a/hw/isa/piix3.c +++ b/hw/isa/piix3.c @@ -112,7 +112,7 @@ static void piix3_write_config(PCIDevice *dev, { pci_default_write_config(dev, address, val, len); if (ranges_overlap(address, len, PIIX_PIRQCA, 4)) { - PIIX3State *piix3 = PIIX3_PCI_DEVICE(dev); + PIIX3State *piix3 = PIIX3_ISA(dev); int pic_irq; pci_bus_fire_intx_routing_notifier(pci_get_bus(&piix3->dev)); @@ -145,7 +145,7 @@ static void piix3_write_config_xen(PCIDevice *dev, static void piix3_reset(DeviceState *dev) { - PIIX3State *d = PIIX3_PCI_DEVICE(dev); + PIIX3State *d = PIIX3_ISA(dev); uint8_t *pci_conf = d->dev.config; pci_conf[0x04] = 0x07; /* master, memory and I/O */ @@ -286,7 +286,7 @@ static const MemoryRegionOps rcr_ops = { static void pci_piix3_realize(PCIDevice *dev, Error **errp) { - PIIX3State *d = PIIX3_PCI_DEVICE(dev); + PIIX3State *d = PIIX3_ISA(dev); ISABus *isa_bus; isa_bus = isa_bus_new(DEVICE(d), pci_address_space(dev), @@ -349,7 +349,7 @@ static void pci_piix3_class_init(ObjectClass *klass, void *data) static void piix3_realize(PCIDevice *dev, Error **errp) { ERRP_GUARD(); - PIIX3State *piix3 = PIIX3_PCI_DEVICE(dev); + PIIX3State *piix3 = PIIX3_ISA(dev); PCIBus *pci_bus = pci_get_bus(dev); pci_piix3_realize(dev, errp); @@ -372,7 +372,7 @@ static void piix3_class_init(ObjectClass *klass, void *data) static void piix3_xen_realize(PCIDevice *dev, Error **errp) { ERRP_GUARD(); - PIIX3State *piix3 = PIIX3_PCI_DEVICE(dev); + PIIX3State *piix3 = PIIX3_ISA(dev); PCIBus *pci_bus = pci_get_bus(dev); pci_piix3_realize(dev, errp); @@ -399,7 +399,7 @@ static void piix3_xen_class_init(ObjectClass *klass, void *data) static const TypeInfo piix_isa_types[] = { { - .name = TYPE_PIIX3_PCI_DEVICE, + .name = TYPE_PIIX_ISA, .parent = TYPE_PCI_DEVICE, .instance_size = sizeof(PIIX3State), .class_init = pci_piix3_class_init, @@ -410,12 +410,12 @@ static const TypeInfo piix_isa_types[] = { { }, }, }, { - .name = TYPE_PIIX3_DEVICE, - .parent = TYPE_PIIX3_PCI_DEVICE, + .name = TYPE_PIIX3_ISA, + .parent = TYPE_PIIX_ISA, .class_init = piix3_class_init, }, { - .name = TYPE_PIIX3_XEN_DEVICE, - .parent = TYPE_PIIX3_PCI_DEVICE, + .name = TYPE_PIIX3_ISA_XEN, + .parent = TYPE_PIIX_ISA, .class_init = piix3_xen_class_init, } }; diff --git a/hw/isa/piix4.c b/hw/isa/piix4.c index ef24826993..8c51b523e5 100644 --- a/hw/isa/piix4.c +++ b/hw/isa/piix4.c @@ -56,7 +56,7 @@ struct PIIX4State { uint8_t rcr; }; -OBJECT_DECLARE_SIMPLE_TYPE(PIIX4State, PIIX4_PCI_DEVICE) +OBJECT_DECLARE_SIMPLE_TYPE(PIIX4State, PIIX4_ISA) static void piix4_set_irq(void *opaque, int irq_num, int level) { @@ -81,7 +81,7 @@ static void piix4_set_irq(void *opaque, int irq_num, int level) static void piix4_isa_reset(DeviceState *dev) { - PIIX4State *d = PIIX4_PCI_DEVICE(dev); + PIIX4State *d = PIIX4_ISA(dev); uint8_t *pci_conf = d->dev.config; pci_conf[0x04] = 0x07; // master, memory and I/O @@ -186,7 +186,7 @@ static const MemoryRegionOps piix4_rcr_ops = { static void piix4_realize(PCIDevice *dev, Error **errp) { - PIIX4State *s = PIIX4_PCI_DEVICE(dev); + PIIX4State *s = PIIX4_ISA(dev); PCIBus *pci_bus = pci_get_bus(dev); ISABus *isa_bus; qemu_irq *i8259_out_irq; @@ -251,7 +251,7 @@ static void piix4_realize(PCIDevice *dev, Error **errp) static void piix4_init(Object *obj) { - PIIX4State *s = PIIX4_PCI_DEVICE(obj); + PIIX4State *s = PIIX4_ISA(obj); object_initialize_child(obj, "rtc", &s->rtc, TYPE_MC146818_RTC); object_initialize_child(obj, "ide", &s->ide, TYPE_PIIX4_IDE); @@ -283,7 +283,7 @@ static void piix4_class_init(ObjectClass *klass, void *data) } static const TypeInfo piix4_info = { - .name = TYPE_PIIX4_PCI_DEVICE, + .name = TYPE_PIIX4_ISA, .parent = TYPE_PCI_DEVICE, .instance_size = sizeof(PIIX4State), .instance_init = piix4_init, diff --git a/hw/mips/malta.c b/hw/mips/malta.c index ec172b111a..5aefeba581 100644 --- a/hw/mips/malta.c +++ b/hw/mips/malta.c @@ -1255,7 +1255,7 @@ void mips_malta_init(MachineState *machine) /* Southbridge */ piix4 = pci_create_simple_multifunction(pci_bus, PIIX4_PCI_DEVFN, true, - TYPE_PIIX4_PCI_DEVICE); + TYPE_PIIX4_ISA); isa_bus = ISA_BUS(qdev_get_child_bus(DEVICE(piix4), "isa.0")); dev = DEVICE(object_resolve_path_component(OBJECT(piix4), "ide")); diff --git a/include/hw/southbridge/piix.h b/include/hw/southbridge/piix.h index a58bf13a41..71a82ef266 100644 --- a/include/hw/southbridge/piix.h +++ b/include/hw/southbridge/piix.h @@ -58,11 +58,11 @@ struct PIIX3State { MemoryRegion rcr_mem; }; -#define TYPE_PIIX3_PCI_DEVICE "pci-piix3" -#define TYPE_PIIX3_DEVICE "PIIX3" -#define TYPE_PIIX3_XEN_DEVICE "PIIX3-xen" -#define TYPE_PIIX4_PCI_DEVICE "piix4-isa" +#define TYPE_PIIX_ISA "pci-piix3" +#define TYPE_PIIX3_ISA "PIIX3" +#define TYPE_PIIX3_ISA_XEN "PIIX3-xen" +#define TYPE_PIIX4_ISA "piix4-isa" -OBJECT_DECLARE_SIMPLE_TYPE(PIIX3State, PIIX3_PCI_DEVICE) +OBJECT_DECLARE_SIMPLE_TYPE(PIIX3State, PIIX3_ISA) #endif -- 2.38.1 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 3/4] hw/isa/piix: Unify QOM type name of PIIX ISA function 2023-02-10 16:57 ` [PATCH 3/4] hw/isa/piix: Unify QOM type name of PIIX ISA function Philippe Mathieu-Daudé @ 2023-02-28 21:55 ` Bernhard Beschow 2023-02-28 22:33 ` Philippe Mathieu-Daudé 0 siblings, 1 reply; 10+ messages in thread From: Bernhard Beschow @ 2023-02-28 21:55 UTC (permalink / raw) To: qemu-devel, Philippe Mathieu-Daudé Cc: Eduardo Habkost, Thomas Huth, Michael S. Tsirkin, Richard Henderson, Hervé Poussineau, Marcel Apfelbaum, Paolo Bonzini, Aurelien Jarno Am 10. Februar 2023 16:57:53 UTC schrieb "Philippe Mathieu-Daudé" <philmd@linaro.org>: >Mechanical change doing: > > $ sed -i -e 's/PIIX4_PCI_DEVICE/PIIX4_ISA/g' $(git grep -l PIIX4_PCI_DEVICE) > $ sed -i -e 's/PIIX3_XEN_DEVICE/PIIX3_ISA_XEN/g' $(git grep -l PIIX3_XEN_DEVICE) > $ sed -i -e 's/PIIX3_DEVICE/PIIX3_ISA/g' $(git grep -l PIIX3_DEVICE) > $ sed -i -e 's/PIIX3_PCI_DEVICE/PIIX_ISA/g' $(git grep -l PIIX3_PCI_DEVICE) > >Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> >--- > hw/i386/pc_piix.c | 5 ++--- > hw/isa/piix3.c | 20 ++++++++++---------- > hw/isa/piix4.c | 10 +++++----- > hw/mips/malta.c | 2 +- > include/hw/southbridge/piix.h | 10 +++++----- > 5 files changed, 23 insertions(+), 24 deletions(-) > >diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c >index 7c48ba30e0..afef5ed115 100644 >--- a/hw/i386/pc_piix.c >+++ b/hw/i386/pc_piix.c >@@ -220,8 +220,7 @@ static void pc_init1(MachineState *machine, > if (pcmc->pci_enabled) { > PIIX3State *piix3; > PCIDevice *pci_dev; >- const char *type = xen_enabled() ? TYPE_PIIX3_XEN_DEVICE >- : TYPE_PIIX3_DEVICE; >+ const char *type = xen_enabled() ? TYPE_PIIX3_ISA_XEN : TYPE_PIIX3_ISA; > > pci_bus = i440fx_init(pci_type, > i440fx_host, >@@ -235,7 +234,7 @@ static void pc_init1(MachineState *machine, > pcms->bus = pci_bus; > > pci_dev = pci_create_simple_multifunction(pci_bus, -1, true, type); >- piix3 = PIIX3_PCI_DEVICE(pci_dev); >+ piix3 = PIIX3_ISA(pci_dev); > piix3->pic = x86ms->gsi; > piix3_devfn = piix3->dev.devfn; > isa_bus = ISA_BUS(qdev_get_child_bus(DEVICE(piix3), "isa.0")); >diff --git a/hw/isa/piix3.c b/hw/isa/piix3.c >index 0ee94a2313..38e0c269ae 100644 >--- a/hw/isa/piix3.c >+++ b/hw/isa/piix3.c >@@ -112,7 +112,7 @@ static void piix3_write_config(PCIDevice *dev, > { > pci_default_write_config(dev, address, val, len); > if (ranges_overlap(address, len, PIIX_PIRQCA, 4)) { >- PIIX3State *piix3 = PIIX3_PCI_DEVICE(dev); >+ PIIX3State *piix3 = PIIX3_ISA(dev); > int pic_irq; > > pci_bus_fire_intx_routing_notifier(pci_get_bus(&piix3->dev)); >@@ -145,7 +145,7 @@ static void piix3_write_config_xen(PCIDevice *dev, > > static void piix3_reset(DeviceState *dev) > { >- PIIX3State *d = PIIX3_PCI_DEVICE(dev); >+ PIIX3State *d = PIIX3_ISA(dev); > uint8_t *pci_conf = d->dev.config; > > pci_conf[0x04] = 0x07; /* master, memory and I/O */ >@@ -286,7 +286,7 @@ static const MemoryRegionOps rcr_ops = { > > static void pci_piix3_realize(PCIDevice *dev, Error **errp) > { >- PIIX3State *d = PIIX3_PCI_DEVICE(dev); >+ PIIX3State *d = PIIX3_ISA(dev); > ISABus *isa_bus; > > isa_bus = isa_bus_new(DEVICE(d), pci_address_space(dev), >@@ -349,7 +349,7 @@ static void pci_piix3_class_init(ObjectClass *klass, void *data) > static void piix3_realize(PCIDevice *dev, Error **errp) > { > ERRP_GUARD(); >- PIIX3State *piix3 = PIIX3_PCI_DEVICE(dev); >+ PIIX3State *piix3 = PIIX3_ISA(dev); > PCIBus *pci_bus = pci_get_bus(dev); > > pci_piix3_realize(dev, errp); >@@ -372,7 +372,7 @@ static void piix3_class_init(ObjectClass *klass, void *data) > static void piix3_xen_realize(PCIDevice *dev, Error **errp) > { > ERRP_GUARD(); >- PIIX3State *piix3 = PIIX3_PCI_DEVICE(dev); >+ PIIX3State *piix3 = PIIX3_ISA(dev); > PCIBus *pci_bus = pci_get_bus(dev); > > pci_piix3_realize(dev, errp); >@@ -399,7 +399,7 @@ static void piix3_xen_class_init(ObjectClass *klass, void *data) > > static const TypeInfo piix_isa_types[] = { > { >- .name = TYPE_PIIX3_PCI_DEVICE, >+ .name = TYPE_PIIX_ISA, > .parent = TYPE_PCI_DEVICE, > .instance_size = sizeof(PIIX3State), > .class_init = pci_piix3_class_init, >@@ -410,12 +410,12 @@ static const TypeInfo piix_isa_types[] = { > { }, > }, > }, { >- .name = TYPE_PIIX3_DEVICE, >- .parent = TYPE_PIIX3_PCI_DEVICE, >+ .name = TYPE_PIIX3_ISA, >+ .parent = TYPE_PIIX_ISA, > .class_init = piix3_class_init, > }, { >- .name = TYPE_PIIX3_XEN_DEVICE, >- .parent = TYPE_PIIX3_PCI_DEVICE, >+ .name = TYPE_PIIX3_ISA_XEN, >+ .parent = TYPE_PIIX_ISA, > .class_init = piix3_xen_class_init, > } > }; >diff --git a/hw/isa/piix4.c b/hw/isa/piix4.c >index ef24826993..8c51b523e5 100644 >--- a/hw/isa/piix4.c >+++ b/hw/isa/piix4.c >@@ -56,7 +56,7 @@ struct PIIX4State { > uint8_t rcr; > }; > >-OBJECT_DECLARE_SIMPLE_TYPE(PIIX4State, PIIX4_PCI_DEVICE) >+OBJECT_DECLARE_SIMPLE_TYPE(PIIX4State, PIIX4_ISA) > > static void piix4_set_irq(void *opaque, int irq_num, int level) > { >@@ -81,7 +81,7 @@ static void piix4_set_irq(void *opaque, int irq_num, int level) > > static void piix4_isa_reset(DeviceState *dev) > { >- PIIX4State *d = PIIX4_PCI_DEVICE(dev); >+ PIIX4State *d = PIIX4_ISA(dev); PIIX4State holds the state of the whole south bridge and not just the ISA function. I therefore tend to find PIIX4_ISA() slightly misleading... The same will apply to PIIX3 once it got modernized like PIIX4 got already. Best regards, Bernhard > uint8_t *pci_conf = d->dev.config; > > pci_conf[0x04] = 0x07; // master, memory and I/O >@@ -186,7 +186,7 @@ static const MemoryRegionOps piix4_rcr_ops = { > > static void piix4_realize(PCIDevice *dev, Error **errp) > { >- PIIX4State *s = PIIX4_PCI_DEVICE(dev); >+ PIIX4State *s = PIIX4_ISA(dev); > PCIBus *pci_bus = pci_get_bus(dev); > ISABus *isa_bus; > qemu_irq *i8259_out_irq; >@@ -251,7 +251,7 @@ static void piix4_realize(PCIDevice *dev, Error **errp) > > static void piix4_init(Object *obj) > { >- PIIX4State *s = PIIX4_PCI_DEVICE(obj); >+ PIIX4State *s = PIIX4_ISA(obj); > > object_initialize_child(obj, "rtc", &s->rtc, TYPE_MC146818_RTC); > object_initialize_child(obj, "ide", &s->ide, TYPE_PIIX4_IDE); >@@ -283,7 +283,7 @@ static void piix4_class_init(ObjectClass *klass, void *data) > } > > static const TypeInfo piix4_info = { >- .name = TYPE_PIIX4_PCI_DEVICE, >+ .name = TYPE_PIIX4_ISA, > .parent = TYPE_PCI_DEVICE, > .instance_size = sizeof(PIIX4State), > .instance_init = piix4_init, >diff --git a/hw/mips/malta.c b/hw/mips/malta.c >index ec172b111a..5aefeba581 100644 >--- a/hw/mips/malta.c >+++ b/hw/mips/malta.c >@@ -1255,7 +1255,7 @@ void mips_malta_init(MachineState *machine) > > /* Southbridge */ > piix4 = pci_create_simple_multifunction(pci_bus, PIIX4_PCI_DEVFN, true, >- TYPE_PIIX4_PCI_DEVICE); >+ TYPE_PIIX4_ISA); > isa_bus = ISA_BUS(qdev_get_child_bus(DEVICE(piix4), "isa.0")); > > dev = DEVICE(object_resolve_path_component(OBJECT(piix4), "ide")); >diff --git a/include/hw/southbridge/piix.h b/include/hw/southbridge/piix.h >index a58bf13a41..71a82ef266 100644 >--- a/include/hw/southbridge/piix.h >+++ b/include/hw/southbridge/piix.h >@@ -58,11 +58,11 @@ struct PIIX3State { > MemoryRegion rcr_mem; > }; > >-#define TYPE_PIIX3_PCI_DEVICE "pci-piix3" >-#define TYPE_PIIX3_DEVICE "PIIX3" >-#define TYPE_PIIX3_XEN_DEVICE "PIIX3-xen" >-#define TYPE_PIIX4_PCI_DEVICE "piix4-isa" >+#define TYPE_PIIX_ISA "pci-piix3" >+#define TYPE_PIIX3_ISA "PIIX3" >+#define TYPE_PIIX3_ISA_XEN "PIIX3-xen" >+#define TYPE_PIIX4_ISA "piix4-isa" > >-OBJECT_DECLARE_SIMPLE_TYPE(PIIX3State, PIIX3_PCI_DEVICE) >+OBJECT_DECLARE_SIMPLE_TYPE(PIIX3State, PIIX3_ISA) > > #endif ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 3/4] hw/isa/piix: Unify QOM type name of PIIX ISA function 2023-02-28 21:55 ` Bernhard Beschow @ 2023-02-28 22:33 ` Philippe Mathieu-Daudé 0 siblings, 0 replies; 10+ messages in thread From: Philippe Mathieu-Daudé @ 2023-02-28 22:33 UTC (permalink / raw) To: Bernhard Beschow, qemu-devel Cc: Eduardo Habkost, Thomas Huth, Michael S. Tsirkin, Richard Henderson, Hervé Poussineau, Marcel Apfelbaum, Paolo Bonzini, Aurelien Jarno On 28/2/23 22:55, Bernhard Beschow wrote: > > > Am 10. Februar 2023 16:57:53 UTC schrieb "Philippe Mathieu-Daudé" <philmd@linaro.org>: >> Mechanical change doing: >> >> $ sed -i -e 's/PIIX4_PCI_DEVICE/PIIX4_ISA/g' $(git grep -l PIIX4_PCI_DEVICE) >> $ sed -i -e 's/PIIX3_XEN_DEVICE/PIIX3_ISA_XEN/g' $(git grep -l PIIX3_XEN_DEVICE) >> $ sed -i -e 's/PIIX3_DEVICE/PIIX3_ISA/g' $(git grep -l PIIX3_DEVICE) >> $ sed -i -e 's/PIIX3_PCI_DEVICE/PIIX_ISA/g' $(git grep -l PIIX3_PCI_DEVICE) >> >> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> >> --- >> hw/i386/pc_piix.c | 5 ++--- >> hw/isa/piix3.c | 20 ++++++++++---------- >> hw/isa/piix4.c | 10 +++++----- >> hw/mips/malta.c | 2 +- >> include/hw/southbridge/piix.h | 10 +++++----- >> 5 files changed, 23 insertions(+), 24 deletions(-) >> -OBJECT_DECLARE_SIMPLE_TYPE(PIIX4State, PIIX4_PCI_DEVICE) >> +OBJECT_DECLARE_SIMPLE_TYPE(PIIX4State, PIIX4_ISA) >> >> static void piix4_set_irq(void *opaque, int irq_num, int level) >> { >> @@ -81,7 +81,7 @@ static void piix4_set_irq(void *opaque, int irq_num, int level) >> >> static void piix4_isa_reset(DeviceState *dev) >> { >> - PIIX4State *d = PIIX4_PCI_DEVICE(dev); >> + PIIX4State *d = PIIX4_ISA(dev); > > PIIX4State holds the state of the whole south bridge and not just the ISA function. I therefore tend to find PIIX4_ISA() slightly misleading... Not in the respin of your work: PIIX_ISA is simply the PCI-ISA bridge function #0, part of a new QOM PIIX chipset. One rationale is the address spaces are not part of the ISA function, but intrinsic part of the while chipset, shared between some PCI functions. Another is some functions don't depend on the ISA bridge to be usable. ^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 4/4] hw/isa/piix: Unify PIIX-ISA QOM type names using qdev aliases 2023-02-10 16:57 [PATCH 0/4] hw/isa/piix: Housekeeping QOM names / macros Philippe Mathieu-Daudé ` (2 preceding siblings ...) 2023-02-10 16:57 ` [PATCH 3/4] hw/isa/piix: Unify QOM type name of PIIX ISA function Philippe Mathieu-Daudé @ 2023-02-10 16:57 ` Philippe Mathieu-Daudé 2023-02-28 13:35 ` [PATCH 0/4] hw/isa/piix: Housekeeping QOM names / macros Philippe Mathieu-Daudé 4 siblings, 0 replies; 10+ messages in thread From: Philippe Mathieu-Daudé @ 2023-02-10 16:57 UTC (permalink / raw) To: qemu-devel Cc: Eduardo Habkost, Thomas Huth, Michael S. Tsirkin, Richard Henderson, Hervé Poussineau, Philippe Mathieu-Daudé, Aurelien Jarno, Marcel Apfelbaum, Paolo Bonzini, Daniel P. Berrangé Unify PIIX ISA (PCI function #0) as: pci-piix3 -> piix-isa (abstract base class) PIIX3 -> piix3-isa (PIIX3 implementation) PIIX3-xen -> piix3-isa-xen (PIIX3 implementation with Xen extensions) piix4-isa -> piix4-isa (PIIX4 implementation) Alias previous names in the QDevAlias table. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> --- include/hw/southbridge/piix.h | 6 +++--- softmmu/qdev-monitor.c | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/include/hw/southbridge/piix.h b/include/hw/southbridge/piix.h index 71a82ef266..cce65e8f44 100644 --- a/include/hw/southbridge/piix.h +++ b/include/hw/southbridge/piix.h @@ -58,9 +58,9 @@ struct PIIX3State { MemoryRegion rcr_mem; }; -#define TYPE_PIIX_ISA "pci-piix3" -#define TYPE_PIIX3_ISA "PIIX3" -#define TYPE_PIIX3_ISA_XEN "PIIX3-xen" +#define TYPE_PIIX_ISA "piix-isa" +#define TYPE_PIIX3_ISA "piix3-isa" +#define TYPE_PIIX3_ISA_XEN "piix3-isa-xen" #define TYPE_PIIX4_ISA "piix4-isa" OBJECT_DECLARE_SIMPLE_TYPE(PIIX3State, PIIX3_ISA) diff --git a/softmmu/qdev-monitor.c b/softmmu/qdev-monitor.c index b8d2c4dadd..820e7f52ad 100644 --- a/softmmu/qdev-monitor.c +++ b/softmmu/qdev-monitor.c @@ -72,6 +72,9 @@ static const QDevAlias qdev_alias_table[] = { { "ES1370", "es1370" }, /* -soundhw name */ { "ich9-ahci", "ahci" }, { "lsi53c895a", "lsi" }, + { "piix-isa", "pci-piix3" }, + { "piix3-isa", "PIIX3" }, + { "piix3-isa-xen", "PIIX3-xen" }, { "virtio-9p-device", "virtio-9p", QEMU_ARCH_VIRTIO_MMIO }, { "virtio-9p-ccw", "virtio-9p", QEMU_ARCH_VIRTIO_CCW }, { "virtio-9p-pci", "virtio-9p", QEMU_ARCH_VIRTIO_PCI }, -- 2.38.1 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 0/4] hw/isa/piix: Housekeeping QOM names / macros 2023-02-10 16:57 [PATCH 0/4] hw/isa/piix: Housekeeping QOM names / macros Philippe Mathieu-Daudé ` (3 preceding siblings ...) 2023-02-10 16:57 ` [PATCH 4/4] hw/isa/piix: Unify PIIX-ISA QOM type names using qdev aliases Philippe Mathieu-Daudé @ 2023-02-28 13:35 ` Philippe Mathieu-Daudé 4 siblings, 0 replies; 10+ messages in thread From: Philippe Mathieu-Daudé @ 2023-02-28 13:35 UTC (permalink / raw) To: qemu-devel, Alex Bennée Cc: Eduardo Habkost, Thomas Huth, Michael S. Tsirkin, Richard Henderson, Hervé Poussineau On 10/2/23 17:57, Philippe Mathieu-Daudé wrote: > - Use QOM macros > - Unify QOM type names > Philippe Mathieu-Daudé (4): > hw/southbridge/piix: Use OBJECT_DECLARE_SIMPLE_TYPE() macro > hw/isa/piix: Batch register QOM types using DEFINE_TYPES() macro > hw/isa/piix: Unify QOM type name of PIIX ISA function > hw/isa/piix: Unify PIIX-ISA QOM type names using qdev aliases Ping? ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2023-02-28 22:33 UTC | newest] Thread overview: 10+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2023-02-10 16:57 [PATCH 0/4] hw/isa/piix: Housekeeping QOM names / macros Philippe Mathieu-Daudé 2023-02-10 16:57 ` [PATCH 1/4] hw/southbridge/piix: Use OBJECT_DECLARE_SIMPLE_TYPE() macro Philippe Mathieu-Daudé 2023-02-28 21:35 ` Bernhard Beschow 2023-02-28 22:28 ` Philippe Mathieu-Daudé 2023-02-10 16:57 ` [PATCH 2/4] hw/isa/piix: Batch register QOM types using DEFINE_TYPES() macro Philippe Mathieu-Daudé 2023-02-10 16:57 ` [PATCH 3/4] hw/isa/piix: Unify QOM type name of PIIX ISA function Philippe Mathieu-Daudé 2023-02-28 21:55 ` Bernhard Beschow 2023-02-28 22:33 ` Philippe Mathieu-Daudé 2023-02-10 16:57 ` [PATCH 4/4] hw/isa/piix: Unify PIIX-ISA QOM type names using qdev aliases Philippe Mathieu-Daudé 2023-02-28 13:35 ` [PATCH 0/4] hw/isa/piix: Housekeeping QOM names / macros Philippe Mathieu-Daudé
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).