various easy cleanups
cover various easy cleanups
various easy patchs added while coding around:
- remove old comments
- add/remove includes
- use TYPE_ names when available
- use ARRAY_SIZE() macro
Philippe Mathieu-Daudé (11):
hw/net: removed obsolete comments
hw/pci: define msi_nonbroken in pci-stub
hw/misc: add missing includes
ide/ahci: add missing includes
hw/mips: add missing include
hw/arm: removed unnecessary include
hw/arm: use defined type name instead of hard-coded string. hw/sparc: use ARRAY_SIZE() macro
target/sparc: fix DEBUG_MMU DPRINTF() arguments
register: display register prefix (name) since it is available
MAINTAINERS: self-appoint me as reviewer of the Register API
MAINTAINERS | 1 + hw/arm/armv7m.c | 4 ++-- hw/arm/exynos4210.c | 4 ++-- hw/arm/highbank.c | 11 +++++++---- hw/arm/realview.c | 6 ++++-- hw/arm/vexpress.c | 6 ++++-- hw/arm/xilinx_zynq.c | 14 ++++++++------ hw/core/register.c | 8 ++++---- hw/net/pcnet-pci.c | 10 ---------- hw/pci/pci-stub.c | 3 +++ hw/sparc64/sun4u.c | 2 +- include/hw/arm/arm.h | 1 - include/hw/ide/ahci.h | 2 ++ include/hw/mips/mips.h | 1 + include/hw/misc/unimp.h | 3 +++ target/sparc/ldst_helper.c | 4 ++-- 16 files changed, 44 insertions(+), 36 deletions(-)
Signature · 1 line
2.11.0
PATCH 1/11 hw/net: removed obsolete comments
--- hw/net/pcnet-pci.c | 10 ---------- 1 file changed, 10 deletions(-)
hw/net/pcnet-pci.c +0 -10
@@ -38,14 +38,6 @@#include "pcnet.h" -//#define PCNET_DEBUG -//#define PCNET_DEBUG_IO -//#define PCNET_DEBUG_BCR -//#define PCNET_DEBUG_CSR -//#define PCNET_DEBUG_RMD -//#define PCNET_DEBUG_TMD -//#define PCNET_DEBUG_MATCH -#define TYPE_PCI_PCNET "pcnet"#define PCI_PCNET (obj) \
@@ -239,8 +231,6 @@ static const VMStateDescription vmstate_pci_pcnet = { } }; -/* PCI interface */ -static const MemoryRegionOps pcnet_mmio_ops = { .old_mmio = { .read = { pcnet_mmio_readb, pcnet_mmio_readw, pcnet_mmio_readl },
Signature · 1 line
2.11.0
Re: [Qemu-devel] [PATCH 01/11] hw/net: removed obsolete comments
Quoted 11 lines · Philippe Mathieu-Daudé
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/net/pcnet-pci.c | 10 ---------- 1 file changed, 10 deletions(-)hw/net/pcnet-pci.c +0
-0@@ -38,14 +38,6 @@
hw/net/pcnet-pci.c line 48
Quoted 10 lines
hw/net/pcnet-pci.c +0
-8#include "pcnet.h" -//#define PCNET_DEBUG -//#define PCNET_DEBUG_IO -//#define PCNET_DEBUG_BCR -//#define PCNET_DEBUG_CSR -//#define PCNET_DEBUG_RMD -//#define PCNET_DEBUG_TMD -//#define PCNET_DEBUG_MATCH -
I guess - although I notice there are some #if 0's in the file that could be converted to proper non-bitrotting debug prints or removed as well.
hw/net/pcnet-pci.c static const VMStateDescription vmstate_pci_pcnet = { · line 243
Quoted 9 lines
hw/net/pcnet-pci.c +0
-2#define TYPE_PCI_PCNET "pcnet"#define PCI_PCNET (obj) \@@ -239,8 +231,6 @@ static const VMStateDescription vmstate_pci_pcnet = { } }; -/* PCI interface */ -
Was this intentional?
hw/net/pcnet-pci.c static const VMStateDescription vmstate_pci_pcnet = { · line 236
Quoted 3 lines
hw/net/pcnet-pci.c +0
-0static const MemoryRegionOps pcnet_mmio_ops = { .old_mmio = { .read = { pcnet_mmio_readb, pcnet_mmio_readw, pcnet_mmio_readl },
--
Alex Bennée
RFC PATCH 2/11 hw/pci: define msi_nonbroken in pci-stub
In reply to Philippe Mathieu-DaudéThis field is accessed in hw/intc/arm_gicv[23*].c
--- hw/pci/pci-stub.c | 3 +++ 1 file changed, 3 insertions(+)
hw/pci/pci-stub.c +3 -0
@@ -24,6 +24,9 @@#include "qapi/qmp/qerror.h" #include "hw/pci/pci.h" #include "qmp-commands.h" +#include "hw/pci/msi.h" + +bool msi_nonbroken;PciInfoList *qmp_query_pci (Error **errp) {
Signature · 1 line
2.11.0
Re: [Qemu-devel] [RFC PATCH 02/11] hw/pci: define msi_nonbroken in pci-stub
Quoted 1 line · Philippe Mathieu-Daudé
This field is accessed in hw/intc/arm_gicv[23*].c
default-configs/arm-softmmu.mak sets CONFIG_PCI, so this should not be necessary, I think. Otherwise, you should extend your patch description, to elaborate on what you're trying to do here.
Thomas
Re: [Qemu-devel] [RFC PATCH 02/11] hw/pci: define msi_nonbroken in pci-stub
Hi Thomas,
Quoted 8 lines · Thomas Huth
Quoted 1 line · Philippe Mathieu-Daudé
This field is accessed in hw/intc/arm_gicv[23*].c
default-configs/arm-softmmu.mak sets
CONFIG_PCI, so this should not be necessary, I think. Otherwise, you should extend your patch description, to elaborate on what you're trying to do here.Thomas
Sure, I'm willing to add basic support for the TI Hercules MCU which is a big endian SoC (without PCI support).
I'm using the following config:
$ cat default-configs/armeb-softmmu.mak # Default configuration for armeb-softmmu CONFIG_ECC=y CONFIG_SERIAL=y CONFIG_PTIMER=y CONFIG_SD=y CONFIG_SSI=y #CONFIG_USB=y CONFIG_PLATFORM_BUS=y CONFIG_ARM_V7M=y CONFIG_ARM_GIC=y CONFIG_ARM_TIMER=y CONFIG_PL011=y CONFIG_PL022=y CONFIG_PL031=y CONFIG_PL041=y CONFIG_PL050=y CONFIG_PL061=y CONFIG_PL080=y CONFIG_PL181=y CONFIG_PL190=y CONFIG_PL310=y CONFIG_PL330=y CONFIG_BITBANG_I2C=y CONFIG_GPIO_KEY=y CONFIG_HERCULES=y
I had to modify default-configs/arm-softmmu.mak to restrict a bit hw/arm/Makefile.objs, see:
https://github.com/qemu/qemu/compare/master...philmd:armeb_wip
In this branch I run:
$ ../configure --target-list=armeb-softmmu && make -j [...] LINK armeb-softmmu/qemu-system-armeb ../hw/intc/arm_gicv2m.o: In function `gicv2m_realize': qemu/hw/intc/arm_gicv2m.c:154: undefined reference to `msi_nonbroken' ../hw/intc/arm_gicv3_its_common.o: In function `gicv3_its_init_mmio': qemu/hw/intc/arm_gicv3_its_common.c:110: undefined reference to `msi_nonbroken' collect2: error: ld returned 1 exit status Makefile:201: recipe for target 'qemu-system-armeb' failed make[1]: *** [qemu-system-armeb] Error 1 Makefile:327: recipe for target 'subdir-armeb-softmmu' failed make: *** [subdir-armeb-softmmu] Error 2
This MCU does not use a GIC so I can also remove it, but this error seems odd to me.
As I understand the 'msi_nonbroken' is a kludge (there is no intrinsic relationship between PCI/MSI and this particular interrupt controller). Since it is declared as extern in "hw/pci/msi.h" why not define it in pci-stub?
Regards,
Phil.
Re: [Qemu-arm] [Qemu-devel] [RFC PATCH 02/11] hw/pci: define msi_nonbroken in pci-stub
Hi Philippe,
Quoted 10 lines · Philippe Mathieu-Daudé
Hi Thomas,
Quoted 7 lines · Thomas Huth
Quoted 1 line · Philippe Mathieu-Daudé
This field is accessed in hw/intc/arm_gicv[23*].c
default-configs/arm-softmmu.mak sets
CONFIG_PCI, so this should not be necessary, I think. Otherwise, you should extend your patch description, to elaborate on what you're trying to do here.
Quoted 8 lines
Quoted 1 line
Thomas
Sure, I'm willing to add basic support for the TI Hercules MCU which is a big endian SoC (without PCI support).
I'm using the following config:
$ cat default-configs/armeb-softmmu.mak
$ cat default-configs/armeb-softmmu.mak cat: default-configs/armeb-softmmu.mak: No such file or directory
... so you're planning for a new armeb config file here? That's the kind of information that I was missing in the patch description.
[...]
Quoted 4 lines
As I understand the '
msi_nonbroken' is a kludge (there is no intrinsic relationship between PCI/MSI and this particular interrupt controller). Since it is declared as extern in "hw/pci/msi.h" why not define it in pci-stub?
Sure, your patch is fine, IMHO it just lacks some rationale in its description.
Thomas
PATCH 3/11 hw/misc: add missing includes
In reply to Philippe Mathieu-Daudé--- include/hw/misc/unimp.h | 3 +++ 1 file changed, 3 insertions(+)
include/hw/misc/unimp.h +3 -0
@@ -8,6 +8,9 @@#ifndef HW_MISC_UNIMP_H #define HW_MISC_UNIMP_H +#include "qemu/osdep.h" +#include "hw/sysbus.h" +#define TYPE_UNIMPLEMENTED_DEVICE "unimplemented-device"/**
Signature · 1 line
2.11.0
Re: [Qemu-devel] [PATCH 03/11] hw/misc: add missing includes
Quoted 10 lines · Philippe Mathieu-Daudé
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- include/hw/misc/unimp.h | 3 +++ 1 file changed, 3 insertions(+)include/hw/misc/unimp.h +0
-0
include/hw/misc/unimp.h line 11
Quoted 4 lines
include/hw/misc/unimp.h +1
-0@@ -8,6 +8,9 @@#ifndef HW_MISC_UNIMP_H #define HW_MISC_UNIMP_H +#include "qemu/osdep.h"
NACK. .h files should not include osdep.h, because the .c file that is using the .h file should have already done so. This is mentioned in HACKING.
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
Re: [Qemu-devel] [PATCH 03/11] hw/misc: add missing includes
Quoted 14 lines · Eric Blake
Quoted 13 lines · Philippe Mathieu-Daudé
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- include/hw/misc/unimp.h | 3 +++ 1 file changed, 3 insertions(+)include/hw/misc/unimp.h +0
-0@@ -8,6 +8,9 @@#ifndef HW_MISC_UNIMP_H #define HW_MISC_UNIMP_H
Quoted 5 lines
include/hw/misc/unimp.h line 11
Quoted 1 line
include/hw/misc/unimp.h +1
-0+#include "qemu/osdep.h" NACK. .h files should not include
osdep.h, because the .c file that is using the .h file should have already done so. This is mentioned in HACKING.
Ok! Indeed my .c doesn't include osdep.h, sorry for the noise.
Re: [Qemu-devel] [PATCH 03/11] hw/misc: add missing includes
Hi Eric,
Quoted 15 lines · Philippe Mathieu-Daudé
Quoted 14 lines · Eric Blake
Quoted 13 lines · Philippe Mathieu-Daudé
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- include/hw/misc/unimp.h | 3 +++ 1 file changed, 3 insertions(+)include/hw/misc/unimp.h +0
-0@@ -8,6 +8,9 @@#ifndef HW_MISC_UNIMP_H #define HW_MISC_UNIMP_H
Quoted 7 lines
Quoted 5 lines
include/hw/misc/unimp.h line 11
Quoted 1 line
include/hw/misc/unimp.h +1
-0+#include "qemu/osdep.h" NACK. .h files should not include
osdep.h, because the .c file that is using the .h file should have already done so. This is mentioned in HACKING.Ok! Indeed my .c doesn't include
osdep.h, sorry for the noise.
I attentively read the HACKING after a good night's sleep.
What about the other include, "hw/sysbus.h"?
The inlined function create_unimplemented_device() calls sysbus_mmio_map_overlap(). Anyone willing to use "hw/misc/unimp.h" will get a compilation failure if he does not include "hw/sysbus.h" and I don't think it belongs to "qemu/osdep.h".
Regards,
Phil.
Re: [Qemu-devel] [PATCH 03/11] hw/misc: add missing includes
Quoted 5 lines · Philippe Mathieu-Daudé
What about the other include, "
hw/sysbus.h"?
The inlined functioncreate_unimplemented_device()callssysbus_mmio_map_overlap(). Anyone willing to use "hw/misc/unimp.h" will get a compilation failure if he does not include "hw/sysbus.h" and I don't think it belongs to "qemu/osdep.h".
That one's probably okay.
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
Re: [Qemu-devel] [PATCH 03/11] hw/misc: add missing includes
In reply to Eric BlakeQuoted 13 lines · Eric Blake
Quoted 13 lines
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- include/hw/misc/unimp.h | 3 +++ 1 file changed, 3 insertions(+)include/hw/misc/unimp.h +0
-0@@ -8,6 +8,9 @@#ifndef HW_MISC_UNIMP_H #define HW_MISC_UNIMP_H
Quoted 5 lines
include/hw/misc/unimp.h line 11
Quoted 1 line
include/hw/misc/unimp.h +1
-0+#include "qemu/osdep.h" NACK. .h files should not include
osdep.h, because the .c file that is using the .h file should have already done so. This is mentioned in HACKING.
I'm not sure this kind of mistake happens often enough, but it might worth add a such test in checkpatch.pl (easier to say than to implement :p)
Re: [Qemu-devel] [PATCH 03/11] hw/misc: add missing includes
Quoted 2 lines · Philippe Mathieu-Daudé
I'm not sure this kind of mistake happens often enough, but it might worth add a such test in checkpatch.pl (easier to say than to implement :p)
It doesn't run automatically, but you can run scripts/clean-includes on your new files to remove unneeded includes and add osdep.h if it's missing.
thanks
-- PMM
PATCH 4/11 ide/ahci: add missing includes
In reply to Philippe Mathieu-Daudéqemu/include/hw/ide/ahci.h:260:16: error: field ‘sglist’ has incomplete type
QEMUSGList sglist;
^~~~~~
/qemu/include/hw/ide/ahci.h:272:5: error: unknown type name ‘IDEDMA’
IDEDMA dma;
^~~~~~
qemu/include/hw/ide/ahci.h:273:5: error: unknown type name ‘IDEBus’
IDEBus port;
^~~~~~
qemu/include/hw/ide/ahci.h:305:15: error: field ‘parent_obj’ has incomplete type
PCIDevice parent_obj;
^~~~~~~~~~--- include/hw/ide/ahci.h | 2 ++ 1 file changed, 2 insertions(+)
include/hw/ide/ahci.h +2 -0
@@ -25,6 +25,8 @@#define HW_IDE_AHCI_H #include "hw/sysbus.h" +#include "hw/ide/internal.h" +#include "sysemu/dma.h" #define AHCI_MEM_BAR_SIZE 0x1000#define AHCI_MAX_PORTS 32
Signature · 1 line
2.11.0
Re: [Qemu-devel] [PATCH 04/11] ide/ahci: add missing includes
Quoted 3 lines · Philippe Mathieu-Daudé
qemu/include/hw/ide/ahci.h:260:16: error: field ‘sglist’ has incomplete typeQEMUSGList sglist; ^~~~~~
What are you doing to get this compilation error (configure options, platform, compiler, etc)? I can't reproduce it. Is it something that pops up later when you remove includes from somewhere else, and you're just pre-emptively adding includes here to allow removal of includes later?
Quoted 29 lines
/qemu/include/hw/ide/ahci.h:272:5: error: unknown type name ‘IDEDMA’
IDEDMA dma; ^~~~~~ qemu/include/hw/ide/ahci.h:273:5: error: unknown type name ‘IDEBus’ IDEBus port; ^~~~~~ qemu/include/hw/ide/ahci.h:305:15: error: field ‘parent_obj’ has incomplete type PCIDevice parent_obj; ^~~~~~~~~~Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- include/hw/ide/ahci.h | 2 ++ 1 file changed, 2 insertions(+)include/hw/ide/ahci.h +2
-0@@ -25,6 +25,8 @@#define HW_IDE_AHCI_H #include "hw/sysbus.h" +#include "hw/ide/internal.h" +#include "sysemu/dma.h" #define AHCI_MEM_BAR_SIZE 0x1000#define AHCI_MAX_PORTS 32
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
Re: [Qemu-devel] [PATCH 04/11] ide/ahci: add missing includes
Quoted 10 lines · Eric Blake
Quoted 3 lines · Philippe Mathieu-Daudé
qemu/include/hw/ide/ahci.h:260:16: error: field ‘sglist’ has incomplete typeQEMUSGList sglist; ^~~~~~What are you doing to get this compilation error (configure options, platform, compiler, etc)? I can't reproduce it. Is it something that pops up later when you remove includes from somewhere else, and you're just pre-emptively adding includes here to allow removal of includes later?
"What he said," but if I had to guess, Philippe is testing that each header can be compiled separately.
Quoted 29 lines
Quoted 28 lines
/qemu/include/hw/ide/ahci.h:272:5: error: unknown type name ‘IDEDMA’
IDEDMA dma; ^~~~~~ qemu/include/hw/ide/ahci.h:273:5: error: unknown type name ‘IDEBus’ IDEBus port; ^~~~~~ qemu/include/hw/ide/ahci.h:305:15: error: field ‘parent_obj’ has incomplete type PCIDevice parent_obj; ^~~~~~~~~~Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- include/hw/ide/ahci.h | 2 ++ 1 file changed, 2 insertions(+)include/hw/ide/ahci.h +1
-0@@ -25,6 +25,8 @@#define HW_IDE_AHCI_H #include "hw/sysbus.h" +#include "hw/ide/internal.h">> +#include "sysemu/dma.h"#define AHCI_MEM_BAR_SIZE 0x1000#define AHCI_MAX_PORTS 32
cover ide/ahci: add missing includes
Hi Eric, John.
The patch 07/11 "hw/arm: use defined type name instead of hard-coded string." triggered this problem.
I split the previous series to only include the 2 commits involved to reproduce.
As you will see, calxeda_init() from highbank.c uses the sysbus type name "sysbus-ahci" which is already defined in "hw/ide/ahci.h" as TYPE_SYSBUS_AHCI. As mentioned in HACKING highbank.c first include is "qemu/osdep.h". However compiling highbank.c fails (as reported in patch "04/11" commit comments).
I don't think appropriate to include "hw/ide/internal.h" and "sysemu/dma.h" in highbank.c. Eventually another source including "hw/ide/ahci.h" will hit the same error.
Do you see another place where those includes should go?
I think I did a mistake sending these both patchs in a series thinking they were unrelated, I should have send them altogether, my bad :/
Regards,
Phil.
Philippe Mathieu-Daudé (2):
arm/highbank: use defined type name instead of hard-coded string ide/ahci: add missing includes
hw/arm/highbank.c | 3 ++- include/hw/ide/ahci.h | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-)
Signature · 1 line
2.11.0
RFC PATCH 1/2 arm/highbank: use defined type name instead of hard-coded string
--- hw/arm/highbank.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
hw/arm/highbank.c +2 -1
@@ -31,6 +31,7 @@#include "exec/address-spaces.h" #include "qemu/error-report.h" #include "hw/char/pl011.h" +#include "hw/ide/ahci.h" #define SMP_BOOT_ADDR 0x100#define SMP_BOOT_REG 0x40
@@ -341,7 +342,7 @@ static void calxeda_init(MachineState *machine, enum cxmachines machine_id)sysbus_create_simple ("pl031" ,0xfff35000 , pic[19 ]);sysbus_create_simple ("pl022" ,0xfff39000 , pic[23 ]); -sysbus_create_simple ("sysbus-ahci" ,0xffe08000 , pic[83 ]); +sysbus_create_simple (TYPE_SYSBUS_AHCI ,0xffe08000 , pic[83 ]);if (nd_table[0 ].used) {qemu_check_nic_model (&nd_table[0 ],"xgmac" );
Signature · 1 line
2.11.0
Re: [Qemu-devel] [RFC PATCH 1/2] arm/highbank: use defined type name instead of hard-coded string
Quoted 19 lines · Philippe Mathieu-Daudé
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/arm/highbank.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)hw/arm/highbank.c +1
-0@@ -31,6 +31,7 @@#include "exec/address-spaces.h" #include "qemu/error-report.h" #include "hw/char/pl011.h" +#include "hw/ide/ahci.h" #define SMP_BOOT_ADDR 0x100#define SMP_BOOT_REG 0x40
hw/arm/highbank.c static void calxeda_init(MachineState *machine, enum cxmachines machine_id) · line 348
Quoted 8 lines
hw/arm/highbank.c +1
-1@@ -341,7 +342,7 @@ static void calxeda_init(MachineState *machine, enum cxmachines machine_id)sysbus_create_simple ("pl031" ,0xfff35000 , pic[19 ]);sysbus_create_simple ("pl022" ,0xfff39000 , pic[23 ]); -sysbus_create_simple ("sysbus-ahci" ,0xffe08000 , pic[83 ]); +sysbus_create_simple (TYPE_SYSBUS_AHCI ,0xffe08000 , pic[83 ]);if (nd_table[0 ].used) {qemu_check_nic_model (&nd_table[0 ],"xgmac" );
This patch is fine, I took a stab at fixing the include issues in a separate series. Try it all out and let me know.
--js
Re: [Qemu-devel] [RFC PATCH 1/2] arm/highbank: use defined type name instead of hard-coded string
Quoted 2 lines · John Snow
This patch is fine, I took a stab at fixing the include issues in a separate series. Try it all out and let me know.
Thank John, your series does fix my include issues :)
RFC PATCH 2/2 ide/ahci: add missing includes
In reply to Philippe Mathieu-Daudé CC arm-softmmu/hw/arm/highbank.o
In file included from qemu/hw/arm/highbank.c:34:0:qemu/include/hw/ide/ahci.h:260:16: error: field ‘sglist’ has incomplete type
QEMUSGList sglist;
^~~~~~
/qemu/include/hw/ide/ahci.h:272:5: error: unknown type name ‘IDEDMA’
IDEDMA dma;
^~~~~~
qemu/include/hw/ide/ahci.h:273:5: error: unknown type name ‘IDEBus’
IDEBus port;
^~~~~~
qemu/include/hw/ide/ahci.h:305:15: error: field ‘parent_obj’ has incomplete type
PCIDevice parent_obj;
^~~~~~~~~~qemu/rules.mak:69: recipe for target 'hw/arm/highbank.o' failed make[1]: *** [hw/arm/highbank.o] Error 1
make: *** [subdir-arm-softmmu] Error 2
--- include/hw/ide/ahci.h | 2 ++ 1 file changed, 2 insertions(+)
include/hw/ide/ahci.h +2 -0
@@ -25,6 +25,8 @@#define HW_IDE_AHCI_H #include "hw/sysbus.h" +#include "hw/ide/internal.h" +#include "sysemu/dma.h" #define AHCI_MEM_BAR_SIZE 0x1000#define AHCI_MAX_PORTS 32
Signature · 1 line
2.11.0
PATCH 5/11 hw/mips: add missing include
In reply to Philippe Mathieu-Daudé--- include/hw/mips/mips.h | 1 + 1 file changed, 1 insertion(+)
include/hw/mips/mips.h +1 -0
@@ -6,6 +6,7 @@#define INITRD_PAGE_MASK (~((1 << 16) - 1))#include "exec/memory.h" +#include "hw/irq.h" /* gt64xxx.c */ PCIBus *gt64120_register (qemu_irq *pic);
Signature · 1 line
2.11.0
Re: [Qemu-devel] [PATCH 05/11] hw/mips: add missing include
Quoted 10 lines · Philippe Mathieu-Daudé
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- include/hw/mips/mips.h | 1 + 1 file changed, 1 insertion(+)include/hw/mips/mips.h +0
-0
include/hw/mips/mips.h line 12
Quoted 7 lines
include/hw/mips/mips.h +1
-0@@ -6,6 +6,7 @@#define INITRD_PAGE_MASK (~((1 << 16) - 1))#include "exec/memory.h" +#include "hw/irq.h" /* gt64xxx.c */ PCIBus *gt64120_register (qemu_irq *pic);
Signature · 2 lines
Aurelien Jarno GPG: 4096R/1DDD8C9B [email protected] http://www.aurel32.net
Michael Tokarev
AppliedRe: [Qemu-devel] [Qemu-trivial] [PATCH 05/11] hw/mips: add missing include
In reply to Philippe Mathieu-DaudéApplied to -trivial, thanks!
/mjt
PATCH 6/11 hw/arm: removed unnecessary include
In reply to Philippe Mathieu-Daudé"exec/memory.h" already includes it.
--- include/hw/arm/arm.h | 1 - 1 file changed, 1 deletion(-)
include/hw/arm/arm.h +0 -1
@@ -14,7 +14,6 @@#include "exec/memory.h" #include "target/arm/cpu-qom.h" #include "hw/irq.h" -#include "qemu/notify.h" typedef enum { ARM_ENDIANNESS_UNKNOWN = 0,
Signature · 1 line
2.11.0
Re: [Qemu-devel] [PATCH 06/11] hw/arm: removed unnecessary include
Quoted 1 line · Philippe Mathieu-Daudé
"
exec/memory.h" already includes it.
I think this sort of include cleanups isn't really necessary. For a regular include file, it's better to include it if the .c file in question uses definitions from there, no matter if other .h files include that header already or not.
Thanks,
/mjt
Quoted 18 lines
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- include/hw/arm/arm.h | 1 - 1 file changed, 1 deletion(-)include/hw/arm/arm.h +0
-1@@ -14,7 +14,6 @@#include "exec/memory.h" #include "target/arm/cpu-qom.h" #include "hw/irq.h" -#include "qemu/notify.h" typedef enum { ARM_ENDIANNESS_UNKNOWN = 0,
Re: [Qemu-arm] [PATCH 06/11] hw/arm: removed unnecessary include
Quoted 4 lines · Michael Tokarev
Quoted 1 line · Philippe Mathieu-Daudé
"
exec/memory.h" already includes it.I think this sort of include cleanups isn't really necessary.
Some are useful ;)
Quoted 3 lines
For a regular include file, it's better to include it if the .c file in question uses definitions from there, no matter if other .h files include that header already or not.
Ok. This one was incorrect anyway :( thank for the review!
Quoted 24 lines
Thanks,
/mjt
Quoted 18 lines
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- include/hw/arm/arm.h | 1 - 1 file changed, 1 deletion(-)include/hw/arm/arm.h +0
-1@@ -14,7 +14,6 @@#include "exec/memory.h" #include "target/arm/cpu-qom.h" #include "hw/irq.h" -#include "qemu/notify.h" typedef enum { ARM_ENDIANNESS_UNKNOWN = 0,
PATCH 8/11 hw/sparc: use ARRAY_SIZE() macro
In reply to Philippe Mathieu-Daudé--- hw/sparc64/sun4u.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/sparc64/sun4u.c +1 -1
@@ -214,7 +214,7 @@ static void isa_irq_handler(void *opaque, int n, int level)qemu_irq *irqs = opaque;int ivec; -assert (n <16 ); +assert (n <ARRAY_SIZE (isa_irq_to_ivec)); ivec = isa_irq_to_ivec[n];EBUS_DPRINTF ("Set ISA IRQ %d level %d -> ivec 0x%x\n" , n, level, ivec);if (ivec) {
Signature · 1 line
2.11.0
Re: [Qemu-devel] [PATCH 08/11] hw/sparc: use ARRAY_SIZE() macro
Quoted 10 lines · Philippe Mathieu-Daudé
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/sparc64/sun4u.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)hw/sparc64/sun4u.c +0
-0
hw/sparc64/sun4u.c static void isa_irq_handler(void *opaque, int n, int level) · line 220
Quoted 8 lines
hw/sparc64/sun4u.c +1
-1@@ -214,7 +214,7 @@ static void isa_irq_handler(void *opaque, int n, int level)qemu_irq *irqs = opaque;int ivec; -assert (n <16 ); +assert (n <ARRAY_SIZE (isa_irq_to_ivec)); ivec = isa_irq_to_ivec[n];EBUS_DPRINTF ("Set ISA IRQ %d level %d -> ivec 0x%x\n" , n, level, ivec);if (ivec) {
--
Alex Bennée
Michael Tokarev
AppliedRe: [Qemu-devel] [PATCH 08/11] hw/sparc: use ARRAY_SIZE() macro
In reply to Philippe Mathieu-DaudéApplied to -trivial, thanks!
/mjt
PATCH 9/11 target/sparc: fix DEBUG_MMU DPRINTF() arguments
In reply to Philippe Mathieu-Daudéinvalid since 96df2bc99f9
--- target/sparc/ldst_helper.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
target/sparc/ldst_helper.c +2 -2
@@ -1631,7 +1631,7 @@ void helper_st_asi(CPUSPARCState *env, target_ulong addr, target_ulong val,if (oldreg != env->immu.mmuregs[reg]) {DPRINTF_MMU ("immu change reg[%d]: 0x%016" PRIx64" -> 0x%016" - PRIx64"\n" , reg, oldreg, env->immuregs[reg]); + PRIx64"\n" , reg, oldreg, env->immu.mmuregs[reg]); }#ifdef DEBUG_MMU dump_mmu (stdout, fprintf, env);
@@ -1715,7 +1715,7 @@ void helper_st_asi(CPUSPARCState *env, target_ulong addr, target_ulong val,if (oldreg != env->dmmu.mmuregs[reg]) {DPRINTF_MMU ("dmmu change reg[%d]: 0x%016" PRIx64" -> 0x%016" - PRIx64"\n" , reg, oldreg, env->dmmuregs[reg]); + PRIx64"\n" , reg, oldreg, env->dmmu.mmuregs[reg]); }#ifdef DEBUG_MMU dump_mmu (stdout, fprintf, env);
Signature · 1 line
2.11.0
Re: [Qemu-devel] [PATCH 09/11] target/sparc: fix DEBUG_MMU DPRINTF() arguments
Quoted 12 lines · Philippe Mathieu-Daudé
invalid since
96df2bc99f9Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- target/sparc/ldst_helper.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)target/sparc/ldst_helper.c +0
-0
target/sparc/ldst_helper.c void helper_st_asi(CPUSPARCState *env, target_ulong addr, target_ulong val, · line 1634
Quoted 5 lines
target/sparc/ldst_helper.c +1
-1@@ -1631,7 +1631,7 @@ void helper_st_asi(CPUSPARCState *env, target_ulong addr, target_ulong val,if (oldreg != env->immu.mmuregs[reg]) {DPRINTF_MMU ("immu change reg[%d]: 0x%016" PRIx64" -> 0x%016" - PRIx64"\n" , reg, oldreg, env->immuregs[reg]); + PRIx64"\n" , reg, oldreg, env->immu.mmuregs[reg]);
Please take this opportunity to fix the broken definitions of DPRINTF_MMU() and friends so that they don't bit-rot when not defined. There are plenty of other examples of re-writing broken #defines to instead favor an if (0) { printf(...) } to benefit from -Wformat checking even when the debugging is disabled.
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
Re: [Qemu-devel] [PATCH 09/11] target/sparc: fix DEBUG_MMU DPRINTF() arguments
Quoted 14 lines · Eric Blake
Quoted 13 lines · Philippe Mathieu-Daudé
invalid since
96df2bc99f9Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- target/sparc/ldst_helper.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)target/sparc/ldst_helper.c +0
-0@@ -1631,7 +1631,7 @@ void helper_st_asi(CPUSPARCState *env, target_ulong addr, target_ulong val,
Quoted 10 lines
target/sparc/ldst_helper.c void helper_st_asi(CPUSPARCState *env, target_ulong addr, target_ulong val, · line 1634
Quoted 4 lines
target/sparc/ldst_helper.c +1
-1if (oldreg != env->immu.mmuregs[reg]) {DPRINTF_MMU ("immu change reg[%d]: 0x%016" PRIx64" -> 0x%016" - PRIx64"\n" , reg, oldreg, env->immuregs[reg]); + PRIx64"\n" , reg, oldreg, env->immu.mmuregs[reg]);Please take this opportunity to fix the broken definitions of
DPRINTF_MMU()and friends so that they don't bit-rot when not defined. There are plenty of other examples of re-writing broken #defines to instead favor an if (0) { printf(...) } to benefit from -Wformat checking even when the debugging is disabled.
Sure, will do it.
PATCH 10/11 register: display register prefix (name) since it is available
In reply to Philippe Mathieu-Daudé--- hw/core/register.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
hw/core/register.c +4 -4
@@ -195,8 +195,8 @@ void register_write_memory(void *opaque, hwaddr addr, }if (!reg) { -qemu_log_mask (LOG_GUEST_ERROR ,"Write to unimplemented register at " \ -"address: %#" PRIx64"\n" , addr); +qemu_log_mask (LOG_GUEST_ERROR ,"%s: write to unimplemented register " \ +"at address: %#" PRIx64"\n" , reg_array->prefix, addr);return ; }
@@ -224,8 +224,8 @@ uint64_t register_read_memory(void *opaque, hwaddr addr, }if (!reg) { -qemu_log_mask (LOG_GUEST_ERROR ,"Read to unimplemented register at " \ -"address: %#" PRIx64"\n" , addr); +qemu_log_mask (LOG_GUEST_ERROR ,"%s: read to unimplemented register " \ +"at address: %#" PRIx64"\n" , reg_array->prefix, addr);return 0 ; }
Signature · 1 line
2.11.0
Re: [Qemu-devel] [PATCH 10/11] register: display register prefix (name) since it is available
Quoted 1 line · Philippe Mathieu-Daudé
Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Thanks,
Alistair
Quoted 34 lines
--- hw/core/register.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)hw/core/register.c +4
-5@@ -195,8 +195,8 @@ void register_write_memory(void *opaque, hwaddr addr, }if (!reg) { -qemu_log_mask (LOG_GUEST_ERROR ,"Write to unimplemented register at " \ -"address: %#" PRIx64"\n" , addr); +qemu_log_mask (LOG_GUEST_ERROR ,"%s: write to unimplemented register " \ +"at address: %#" PRIx64"\n" , reg_array->prefix, addr);return ; }@@ -224,8 +224,8 @@ uint64_t register_read_memory(void *opaque, hwaddr addr, }if (!reg) { -qemu_log_mask (LOG_GUEST_ERROR ,"Read to unimplemented register at " \ -"address: %#" PRIx64"\n" , addr); +qemu_log_mask (LOG_GUEST_ERROR ,"%s: read to unimplemented register " \ +"at address: %#" PRIx64"\n" , reg_array->prefix, addr);return 0 ; } --2.11.0
Michael Tokarev
AppliedRe: [Qemu-devel] [PATCH 10/11] register: display register prefix (name) since it is available
In reply to Philippe Mathieu-Daudéapplied to -trivial, thanks!
/mjt
PATCH 11/11 MAINTAINERS: self-appoint me as reviewer of the Register API
In reply to Philippe Mathieu-Daudé--- MAINTAINERS | 1 + 1 file changed, 1 insertion(+)
MAINTAINERS +1 -0
@@ -1431,6 +1431,7 @@ T: git git://repo.or.cz/qemu/armbru.git qapi-next Register API M: Alistair Francis <[email protected]> +R: Philippe Mathieu-Daudé <[email protected]> S: Maintained F: hw/core/register.c F: include/hw/register.h
Signature · 1 line
2.11.0
Quoted 19 lines · Philippe Mathieu-Daudé
various easy patchs added while coding around:
- remove old comments
- add/remove includes
- useTYPE_names when available
- useARRAY_SIZE()macroPhilippe Mathieu-Daudé (11):
hw/net: removed obsolete comments
hw/pci: definemsi_nonbrokenin pci-stub
hw/misc: add missing includes
ide/ahci: add missing includes
hw/mips: add missing include
hw/arm: removed unnecessary include
hw/arm: use defined type name instead of hard-coded string. hw/sparc: useARRAY_SIZE()macro
target/sparc: fixDEBUG_MMUDPRINTF()arguments
register: display register prefix (name) since it is available
MAINTAINERS: self-appoint me as reviewer of the Register API
Quoted 1 line
From this set, I've applied 4 patches:
[PATCH 05/11] hw/mips: add missing include
[PATCH 06/11] hw/arm: removed unnecessary include
[PATCH 08/11] hw/sparc: use ARRAY_SIZE() macro
[PATCH 10/11] register: display register prefix (name) since it is available
Thanks,
/mjt