hw/mips/gt64120: Minor fixes
cover hw/mips/gt64120: Minor fixes
Trivial fixes extracted from another series which became too big, so I prefer to send them in a previous step.
(This is a resend for Zoltan).
Philippe Mathieu-Daudé (6):
hw/mips/gt64xxx: Initialize ISD I/O memory region in DeviceRealize() hw/mips/gt64xxx: Simplify ISD MemoryRegion read/write handlers hw/mips/gt64xxx: Fix typos in qemu_log_mask() formats hw/mips/gt64xxx: Rename trace events related to interrupt registers hw/mips/gt64xxx: Trace accesses to ISD registers hw/mips/gt64xxx: Let the GT64120 manage the lower 512MiB hole
hw/mips/gt64xxx_pci.c | 67 +++++++++++++++++++++++++++---------------- hw/mips/malta.c | 7 ----- hw/mips/trace-events | 6 ++-- 3 files changed, 47 insertions(+), 33 deletions(-)
Signature · 1 line
2.26.2
PATCH RESEND 1/6 hw/mips/gt64xxx: Initialize ISD I/O memory region in DeviceRealize()
The ISD I/O region belongs to the TYPE_GT64120_PCI_HOST_BRIDGE, so initialize it before it is realized, not after. Rename the region as 'gt64120-isd' so it is clearer to realize it belongs to the GT64120 in the memory tree view.
--- hw/mips/gt64xxx_pci.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
hw/mips/gt64xxx_pci.c +9 -2
@@ -1196,6 +1196,14 @@ static void gt64120_reset(DeviceState *dev)gt64120_pci_mapping (s); } +static void gt64120_realize (DeviceState *dev,Error **errp) +{ +GT64120State *s =GT64120_PCI_HOST_BRIDGE (dev); + +memory_region_init_io (&s->ISD_mem,OBJECT (dev), &isd_mem_ops, s, +"gt64120-isd" ,0x1000 ); +} +PCIBus *gt64120_register (qemu_irq *pic) {GT64120State *d;
@@ -1214,8 +1222,6 @@ PCIBus *gt64120_register(qemu_irq *pic)get_system_io (), PCI_DEVFN(18, 0), 4, TYPE_PCI_BUS);sysbus_realize_and_unref (SYS_BUS_DEVICE (dev), &error_fatal); -memory_region_init_io (&d->ISD_mem,OBJECT (dev), &isd_mem_ops, d, -"isd-mem" ,0x1000 );pci_create_simple (phb->bus,PCI_DEVFN (0 ,0 ),"gt64120_pci" );return phb->bus;
@@ -1270,6 +1276,7 @@ static void gt64120_class_init(ObjectClass *klass, void *data)DeviceClass *dc =DEVICE_CLASS (klass);set_bit (DEVICE_CATEGORY_BRIDGE , dc->categories); + dc->realize = gt64120_realize; dc->reset = gt64120_reset; dc->vmsd = &vmstate_gt64120; }
Signature · 1 line
2.26.2
Re: [PATCH RESEND 1/6] hw/mips/gt64xxx: Initialize ISD I/O memory region in DeviceRealize()
Quoted 6 lines · Philippe Mathieu-Daudé
The ISD I/O region belongs to the
TYPE_GT64120_PCI_HOST_BRIDGE, so initialize it before it is realized, not after. Rename the region as 'gt64120-isd' so it is clearer to realize it belongs to the GT64120 in the memory tree view.Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Quoted 41 lines
---
hw/mips/gt64xxx_pci.c| 11 +++++++++--1 file changed, 9 insertions(+), 2 deletions(-)hw/mips/gt64xxx_pci.c +9
-2@@ -1196,6 +1196,14 @@ static void gt64120_reset(DeviceState *dev)gt64120_pci_mapping (s); } +static void gt64120_realize (DeviceState *dev,Error **errp) +{ +GT64120State *s =GT64120_PCI_HOST_BRIDGE (dev); + +memory_region_init_io (&s->ISD_mem,OBJECT (dev), &isd_mem_ops, s, +"gt64120-isd" ,0x1000 ); +} +PCIBus *gt64120_register (qemu_irq *pic) {GT64120State *d;@@ -1214,8 +1222,6 @@ PCIBus *gt64120_register(qemu_irq *pic)get_system_io (), PCI_DEVFN(18, 0), 4, TYPE_PCI_BUS);sysbus_realize_and_unref (SYS_BUS_DEVICE (dev), &error_fatal); -memory_region_init_io (&d->ISD_mem,OBJECT (dev), &isd_mem_ops, d, -"isd-mem" ,0x1000 );pci_create_simple (phb->bus,PCI_DEVFN (0 ,0 ),"gt64120_pci" );return phb->bus;@@ -1270,6 +1276,7 @@ static void gt64120_class_init(ObjectClass *klass, void *data)DeviceClass *dc =DEVICE_CLASS (klass);set_bit (DEVICE_CATEGORY_BRIDGE , dc->categories); + dc->realize = gt64120_realize; dc->reset = gt64120_reset; dc->vmsd = &vmstate_gt64120; }
PATCH RESEND 2/6 hw/mips/gt64xxx: Simplify ISD MemoryRegion read/write handlers
In reply to Philippe Mathieu-DaudéThe ISD MemoryRegion is implemented for 32-bit accesses. Simplify it by setting the MemoryRegionOps::impl min/max access size fields.
Since the region is registered with a size of 0x1000 bytes, we can remove the hwaddr mask.
--- hw/mips/gt64xxx_pci.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
hw/mips/gt64xxx_pci.c +6 -4
@@ -385,13 +385,12 @@ static void gt64120_writel(void *opaque, hwaddr addr, {GT64120State *s = opaque;PCIHostState *phb =PCI_HOST_BRIDGE (s); -uint32_t saddr; +uint32_t saddr = addr >>2 ;if (!(s->regs[GT_CPU ] &0x00001000 )) { val =bswap32 (val); } - saddr = (addr &0xfff ) >>2 ;switch (saddr) {/* CPU Configuration */
@@ -695,9 +694,8 @@ static uint64_t gt64120_readl(void *opaque,GT64120State *s = opaque;PCIHostState *phb =PCI_HOST_BRIDGE (s);uint32_t val; -uint32_t saddr; +uint32_t saddr = addr >>2 ; - saddr = (addr &0xfff ) >>2 ;switch (saddr) {/* CPU Configuration */
@@ -976,6 +974,10 @@ static const MemoryRegionOps isd_mem_ops = { .read = gt64120_readl, .write = gt64120_writel, .endianness = DEVICE_NATIVE_ENDIAN, + .impl = { + .min_access_size = 4, + .max_access_size = 4, + }, };static int gt64120_pci_map_irq (PCIDevice *pci_dev,int irq_num)
Signature · 1 line
2.26.2
Re: [PATCH RESEND 2/6] hw/mips/gt64xxx: Simplify ISD MemoryRegion read/write handlers
Quoted 8 lines · Philippe Mathieu-Daudé
The ISD MemoryRegion is implemented for 32-bit accesses. Simplify it by setting the
MemoryRegionOps::implmin/max access size fields.Since the region is registered with a size of
0x1000bytes, we can remove the hwaddr mask.Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Quoted 46 lines
---
hw/mips/gt64xxx_pci.c| 10 ++++++----1 file changed, 6 insertions(+), 4 deletions(-)hw/mips/gt64xxx_pci.c +6
-4@@ -385,13 +385,12 @@ static void gt64120_writel(void *opaque, hwaddr addr, {GT64120State *s = opaque;PCIHostState *phb =PCI_HOST_BRIDGE (s); -uint32_t saddr; +uint32_t saddr = addr >>2 ;if (!(s->regs[GT_CPU ] &0x00001000 )) { val =bswap32 (val); } - saddr = (addr &0xfff ) >>2 ;switch (saddr) {/* CPU Configuration */ @@ -695,9 +694,8 @@ static uint64_t gt64120_readl(void *opaque,GT64120State *s = opaque;PCIHostState *phb =PCI_HOST_BRIDGE (s);uint32_t val; -uint32_t saddr; +uint32_t saddr = addr >>2 ; - saddr = (addr &0xfff ) >>2 ;switch (saddr) {/* CPU Configuration */ @@ -976,6 +974,10 @@ static const MemoryRegionOps isd_mem_ops = { .read = gt64120_readl, .write = gt64120_writel, .endianness = DEVICE_NATIVE_ENDIAN, + .impl = { + .min_access_size = 4, + .max_access_size = 4, + }, };static int gt64120_pci_map_irq (PCIDevice *pci_dev,int irq_num)
PATCH RESEND 3/6 hw/mips/gt64xxx: Fix typos in qemu_log_mask() formats
In reply to Philippe Mathieu-DaudéFix the following typos:
- GT_PCI1_CFGDATA is not a timer register but a PCI one,
- zero-padding flag is out of the format
--- hw/mips/gt64xxx_pci.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
hw/mips/gt64xxx_pci.c +10 -10
@@ -463,7 +463,7 @@ static void gt64120_writel(void *opaque, hwaddr addr,/* Read-only registers, do nothing */ qemu_log_mask (LOG_GUEST_ERROR ,"gt64120: Read-only register write " -"reg:0x03%x size:%u value:0x%0*" PRIx64"\n" , +"reg:0x%03x size:%u value:0x%0*" PRIx64"\n" , saddr <<2 , size, size <<1 , val);break ;
@@ -473,7 +473,7 @@ static void gt64120_writel(void *opaque, hwaddr addr,/* Read-only registers, do nothing */ qemu_log_mask (LOG_GUEST_ERROR ,"gt64120: Read-only register write " -"reg:0x03%x size:%u value:0x%0*" PRIx64"\n" , +"reg:0x%03x size:%u value:0x%0*" PRIx64"\n" , saddr <<2 , size, size <<1 , val);break ;
@@ -515,7 +515,7 @@ static void gt64120_writel(void *opaque, hwaddr addr,/* Not implemented */ qemu_log_mask (LOG_UNIMP ,"gt64120: Unimplemented device register write " -"reg:0x03%x size:%u value:0x%0*" PRIx64"\n" , +"reg:0x%03x size:%u value:0x%0*" PRIx64"\n" , saddr <<2 , size, size <<1 , val);break ;
@@ -528,7 +528,7 @@ static void gt64120_writel(void *opaque, hwaddr addr,/* Read-only registers, do nothing */ qemu_log_mask (LOG_GUEST_ERROR ,"gt64120: Read-only register write " -"reg:0x03%x size:%u value:0x%0*" PRIx64"\n" , +"reg:0x%03x size:%u value:0x%0*" PRIx64"\n" , saddr <<2 , size, size <<1 , val);break ;
@@ -565,7 +565,7 @@ static void gt64120_writel(void *opaque, hwaddr addr,/* Not implemented */ qemu_log_mask (LOG_UNIMP ,"gt64120: Unimplemented DMA register write " -"reg:0x03%x size:%u value:0x%0*" PRIx64"\n" , +"reg:0x%03x size:%u value:0x%0*" PRIx64"\n" , saddr <<2 , size, size <<1 , val);break ;
@@ -578,7 +578,7 @@ static void gt64120_writel(void *opaque, hwaddr addr,/* Not implemented */ qemu_log_mask (LOG_UNIMP ,"gt64120: Unimplemented timer register write " -"reg:0x03%x size:%u value:0x%0*" PRIx64"\n" , +"reg:0x%03x size:%u value:0x%0*" PRIx64"\n" , saddr <<2 , size, size <<1 , val);break ;
@@ -621,8 +621,8 @@ static void gt64120_writel(void *opaque, hwaddr addr,case GT_PCI1_CFGDATA :/* not implemented */ qemu_log_mask (LOG_UNIMP , -"gt64120: Unimplemented timer register write " -"reg:0x03%x size:%u value:0x%0*" PRIx64"\n" , +"gt64120: Unimplemented PCI register write " +"reg:0x%03x size:%u value:0x%0*" PRIx64"\n" , saddr <<2 , size, size <<1 , val);break ;case GT_PCI0_CFGADDR :
@@ -682,7 +682,7 @@ static void gt64120_writel(void *opaque, hwaddr addr,default :qemu_log_mask (LOG_GUEST_ERROR ,"gt64120: Illegal register write " -"reg:0x03%x size:%u value:0x%0*" PRIx64"\n" , +"reg:0x%03x size:%u value:0x%0*" PRIx64"\n" , saddr <<2 , size, size <<1 , val);break ; }
@@ -958,7 +958,7 @@ static uint64_t gt64120_readl(void *opaque, val = s->regs[saddr];qemu_log_mask (LOG_GUEST_ERROR ,"gt64120: Illegal register read " -"reg:0x03%x size:%u value:0x%0*x\n" , +"reg:0x%03x size:%u value:0x%0*x\n" , saddr <<2 , size, size <<1 , val);break ; }
Signature · 1 line
2.26.2
Re: [PATCH RESEND 3/6] hw/mips/gt64xxx: Fix typos in qemu_log_mask() formats
Quoted 6 lines · Philippe Mathieu-Daudé
Fix the following typos:
-GT_PCI1_CFGDATAis not a timer register but a PCI one,
- zero-padding flag is out of the formatFixes 641ca2bfcd5 ("hw/mips/gt64xxx_pci: Use qemu_log_mask() instead of debug printf()")Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Quoted 92 lines
---
hw/mips/gt64xxx_pci.c| 20 ++++++++++----------1 file changed, 10 insertions(+), 10 deletions(-)hw/mips/gt64xxx_pci.c +10
-10@@ -463,7 +463,7 @@ static void gt64120_writel(void *opaque, hwaddr addr,/* Read-only registers, do nothing */ qemu_log_mask (LOG_GUEST_ERROR ,"gt64120: Read-only register write " -"reg:0x03%x size:%u value:0x%0*" PRIx64"\n" , +"reg:0x%03x size:%u value:0x%0*" PRIx64"\n" , saddr <<2 , size, size <<1 , val);break ;@@ -473,7 +473,7 @@ static void gt64120_writel(void *opaque, hwaddr addr,/* Read-only registers, do nothing */ qemu_log_mask (LOG_GUEST_ERROR ,"gt64120: Read-only register write " -"reg:0x03%x size:%u value:0x%0*" PRIx64"\n" , +"reg:0x%03x size:%u value:0x%0*" PRIx64"\n" , saddr <<2 , size, size <<1 , val);break ;@@ -515,7 +515,7 @@ static void gt64120_writel(void *opaque, hwaddr addr,/* Not implemented */ qemu_log_mask (LOG_UNIMP ,"gt64120: Unimplemented device register write " -"reg:0x03%x size:%u value:0x%0*" PRIx64"\n" , +"reg:0x%03x size:%u value:0x%0*" PRIx64"\n" , saddr <<2 , size, size <<1 , val);break ;@@ -528,7 +528,7 @@ static void gt64120_writel(void *opaque, hwaddr addr,/* Read-only registers, do nothing */ qemu_log_mask (LOG_GUEST_ERROR ,"gt64120: Read-only register write " -"reg:0x03%x size:%u value:0x%0*" PRIx64"\n" , +"reg:0x%03x size:%u value:0x%0*" PRIx64"\n" , saddr <<2 , size, size <<1 , val);break ;@@ -565,7 +565,7 @@ static void gt64120_writel(void *opaque, hwaddr addr,/* Not implemented */ qemu_log_mask (LOG_UNIMP ,"gt64120: Unimplemented DMA register write " -"reg:0x03%x size:%u value:0x%0*" PRIx64"\n" , +"reg:0x%03x size:%u value:0x%0*" PRIx64"\n" , saddr <<2 , size, size <<1 , val);break ;@@ -578,7 +578,7 @@ static void gt64120_writel(void *opaque, hwaddr addr,/* Not implemented */ qemu_log_mask (LOG_UNIMP ,"gt64120: Unimplemented timer register write " -"reg:0x03%x size:%u value:0x%0*" PRIx64"\n" , +"reg:0x%03x size:%u value:0x%0*" PRIx64"\n" , saddr <<2 , size, size <<1 , val);break ;@@ -621,8 +621,8 @@ static void gt64120_writel(void *opaque, hwaddr addr,case GT_PCI1_CFGDATA :/* not implemented */ qemu_log_mask (LOG_UNIMP , -"gt64120: Unimplemented timer register write " -"reg:0x03%x size:%u value:0x%0*" PRIx64"\n" , +"gt64120: Unimplemented PCI register write " +"reg:0x%03x size:%u value:0x%0*" PRIx64"\n" , saddr <<2 , size, size <<1 , val);break ;case GT_PCI0_CFGADDR :@@ -682,7 +682,7 @@ static void gt64120_writel(void *opaque, hwaddr addr,default :qemu_log_mask (LOG_GUEST_ERROR ,"gt64120: Illegal register write " -"reg:0x03%x size:%u value:0x%0*" PRIx64"\n" , +"reg:0x%03x size:%u value:0x%0*" PRIx64"\n" , saddr <<2 , size, size <<1 , val);break ; }@@ -958,7 +958,7 @@ static uint64_t gt64120_readl(void *opaque, val = s->regs[saddr];qemu_log_mask (LOG_GUEST_ERROR ,"gt64120: Illegal register read " -"reg:0x03%x size:%u value:0x%0*x\n" , +"reg:0x%03x size:%u value:0x%0*x\n" , saddr <<2 , size, size <<1 , val);break ; }
PATCH RESEND 4/6 hw/mips/gt64xxx: Rename trace events related to interrupt registers
In reply to Philippe Mathieu-DaudéWe want to trace all register accesses. First rename the current gt64120_read / gt64120_write events with '_intreg' suffix, as they are restricted to interrupt registers.
--- hw/mips/gt64xxx_pci.c | 16 ++++++++-------- hw/mips/trace-events | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-)
hw/mips/gt64xxx_pci.c +8 -8
@@ -642,19 +642,19 @@ static void gt64120_writel(void *opaque, hwaddr addr,/* not really implemented */ s->regs[saddr] = ~(~(s->regs[saddr]) | ~(val &0xfffffffe )); s->regs[saddr] |= !!(s->regs[saddr] &0xfffffffe ); -trace_gt64120_write ("INTRCAUSE" , size, val); +trace_gt64120_write_intreg ("INTRCAUSE" , size, val);break ;case GT_INTRMASK : s->regs[saddr] = val &0x3c3ffffe ; -trace_gt64120_write ("INTRMASK" , size, val); +trace_gt64120_write_intreg ("INTRMASK" , size, val);break ;case GT_PCI0_ICMASK : s->regs[saddr] = val &0x03fffffe ; -trace_gt64120_write ("ICMASK" , size, val); +trace_gt64120_write_intreg ("ICMASK" , size, val);break ;case GT_PCI0_SERR0MASK : s->regs[saddr] = val &0x0000003f ; -trace_gt64120_write ("SERR0MASK" , size, val); +trace_gt64120_write_intreg ("SERR0MASK" , size, val);break ;/* Reserved when only PCI_0 is configured. */
@@ -929,19 +929,19 @@ static uint64_t gt64120_readl(void *opaque,/* Interrupts */ case GT_INTRCAUSE : val = s->regs[saddr]; -trace_gt64120_read ("INTRCAUSE" , size, val); +trace_gt64120_read_intreg ("INTRCAUSE" , size, val);break ;case GT_INTRMASK : val = s->regs[saddr]; -trace_gt64120_read ("INTRMASK" , size, val); +trace_gt64120_read_intreg ("INTRMASK" , size, val);break ;case GT_PCI0_ICMASK : val = s->regs[saddr]; -trace_gt64120_read ("ICMASK" , size, val); +trace_gt64120_read_intreg ("ICMASK" , size, val);break ;case GT_PCI0_SERR0MASK : val = s->regs[saddr]; -trace_gt64120_read ("SERR0MASK" , size, val); +trace_gt64120_read_intreg ("SERR0MASK" , size, val);break ;/* Reserved when only PCI_0 is configured. */
hw/mips/trace-events +2 -2
@@ -1,4 +1,4 @@ # gt64xxx_pci.c -gt64120_read(const char *regname, unsigned size, uint64_t value) "gt64120 read %s size:%u value:0x%08" PRIx64 -gt64120_write(const char *regname, unsigned size, uint64_t value) "gt64120 write %s size:%u value:0x%08" PRIx64 +gt64120_read_intreg(const char *regname, unsigned size, uint64_t value) "gt64120 read %s size:%u value:0x%08" PRIx64 +gt64120_write_intreg(const char *regname, unsigned size, uint64_t value) "gt64120 write %s size:%u value:0x%08" PRIx64 gt64120_isd_remap(uint64_t from_length, uint64_t from_addr, uint64_t to_length, uint64_t to_addr) "ISD: 0x%08" PRIx64 "@0x%08" PRIx64 " -> 0x%08" PRIx64 "@0x%08" PRIx64
Signature · 1 line
2.26.2
Re: [PATCH RESEND 4/6] hw/mips/gt64xxx: Rename trace events related to interrupt registers
Quoted 5 lines · Philippe Mathieu-Daudé
We want to trace all register accesses. First rename the current
gt64120_read/gt64120_writeevents with '_intreg' suffix, as they are restricted to interrupt registers.Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Quoted 69 lines
---
hw/mips/gt64xxx_pci.c| 16 ++++++++--------
hw/mips/trace-events | 4 ++--2 files changed, 10 insertions(+), 10 deletions(-)hw/mips/gt64xxx_pci.c +8
-8@@ -642,19 +642,19 @@ static void gt64120_writel(void *opaque, hwaddr addr,/* not really implemented */ s->regs[saddr] = ~(~(s->regs[saddr]) | ~(val &0xfffffffe )); s->regs[saddr] |= !!(s->regs[saddr] &0xfffffffe ); -trace_gt64120_write ("INTRCAUSE" , size, val); +trace_gt64120_write_intreg ("INTRCAUSE" , size, val);break ;case GT_INTRMASK : s->regs[saddr] = val &0x3c3ffffe ; -trace_gt64120_write ("INTRMASK" , size, val); +trace_gt64120_write_intreg ("INTRMASK" , size, val);break ;case GT_PCI0_ICMASK : s->regs[saddr] = val &0x03fffffe ; -trace_gt64120_write ("ICMASK" , size, val); +trace_gt64120_write_intreg ("ICMASK" , size, val);break ;case GT_PCI0_SERR0MASK : s->regs[saddr] = val &0x0000003f ; -trace_gt64120_write ("SERR0MASK" , size, val); +trace_gt64120_write_intreg ("SERR0MASK" , size, val);break ;/* Reserved when only PCI_0 is configured. */ @@ -929,19 +929,19 @@ static uint64_t gt64120_readl(void *opaque,/* Interrupts */ case GT_INTRCAUSE : val = s->regs[saddr]; -trace_gt64120_read ("INTRCAUSE" , size, val); +trace_gt64120_read_intreg ("INTRCAUSE" , size, val);break ;case GT_INTRMASK : val = s->regs[saddr]; -trace_gt64120_read ("INTRMASK" , size, val); +trace_gt64120_read_intreg ("INTRMASK" , size, val);break ;case GT_PCI0_ICMASK : val = s->regs[saddr]; -trace_gt64120_read ("ICMASK" , size, val); +trace_gt64120_read_intreg ("ICMASK" , size, val);break ;case GT_PCI0_SERR0MASK : val = s->regs[saddr]; -trace_gt64120_read ("SERR0MASK" , size, val); +trace_gt64120_read_intreg ("SERR0MASK" , size, val);break ;/* Reserved when only PCI_0 is configured. */ hw/mips/trace-events +2
-2@@ -1,4 +1,4 @@ # gt64xxx_pci.c -gt64120_read(const char *regname, unsigned size, uint64_t value) "gt64120 read %s size:%u value:0x%08" PRIx64 -gt64120_write(const char *regname, unsigned size, uint64_t value) "gt64120 write %s size:%u value:0x%08" PRIx64 +gt64120_read_intreg(const char *regname, unsigned size, uint64_t value) "gt64120 read %s size:%u value:0x%08" PRIx64 +gt64120_write_intreg(const char *regname, unsigned size, uint64_t value) "gt64120 write %s size:%u value:0x%08" PRIx64
gt64120_isd_remap(uint64_t from_length, uint64_t from_addr, uint64_t to_length, uint64_t to_addr)"ISD: 0x%08" PRIx64 "@0x%08" PRIx64 " -> 0x%08" PRIx64 "@0x%08" PRIx64
PATCH RESEND 5/6 hw/mips/gt64xxx: Trace accesses to ISD registers
In reply to Philippe Mathieu-DaudéTrace all accesses to Internal Space Decode (ISD) registers.
--- hw/mips/gt64xxx_pci.c | 2 ++ hw/mips/trace-events | 2 ++ 2 files changed, 4 insertions(+)
hw/mips/gt64xxx_pci.c +2 -0
@@ -387,6 +387,7 @@ static void gt64120_writel(void *opaque, hwaddr addr,PCIHostState *phb =PCI_HOST_BRIDGE (s);uint32_t saddr = addr >>2 ; +trace_gt64120_write (addr, val);if (!(s->regs[GT_CPU ] &0x00001000 )) { val =bswap32 (val); }
@@ -966,6 +967,7 @@ static uint64_t gt64120_readl(void *opaque,if (!(s->regs[GT_CPU ] &0x00001000 )) { val =bswap32 (val); } +trace_gt64120_read (addr, val);return val; }
hw/mips/trace-events +2 -0
@@ -1,4 +1,6 @@ # gt64xxx_pci.c +gt64120_read(uint64_t addr, uint64_t value) "gt64120 read 0x%03"PRIx64" value:0x%08" PRIx64 +gt64120_write(uint64_t addr, uint64_t value) "gt64120 write 0x%03"PRIx64" value:0x%08" PRIx64 gt64120_read_intreg(const char *regname, unsigned size, uint64_t value) "gt64120 read %s size:%u value:0x%08" PRIx64 gt64120_write_intreg(const char *regname, unsigned size, uint64_t value) "gt64120 write %s size:%u value:0x%08" PRIx64 gt64120_isd_remap(uint64_t from_length, uint64_t from_addr, uint64_t to_length, uint64_t to_addr) "ISD: 0x%08" PRIx64 "@0x%08" PRIx64 " -> 0x%08" PRIx64 "@0x%08" PRIx64
Signature · 1 line
2.26.2
Re: [PATCH RESEND 5/6] hw/mips/gt64xxx: Trace accesses to ISD registers
Quoted 3 lines · Philippe Mathieu-Daudé
Trace all accesses to Internal Space Decode (ISD) registers.
Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Quoted 37 lines
---
hw/mips/gt64xxx_pci.c| 2 ++
hw/mips/trace-events | 2 ++2 files changed, 4 insertions(+)hw/mips/gt64xxx_pci.c +2
-0@@ -387,6 +387,7 @@ static void gt64120_writel(void *opaque, hwaddr addr,PCIHostState *phb =PCI_HOST_BRIDGE (s);uint32_t saddr = addr >>2 ; +trace_gt64120_write (addr, val);if (!(s->regs[GT_CPU ] &0x00001000 )) { val =bswap32 (val); }@@ -966,6 +967,7 @@ static uint64_t gt64120_readl(void *opaque,if (!(s->regs[GT_CPU ] &0x00001000 )) { val =bswap32 (val); } +trace_gt64120_read (addr, val);return val; }hw/mips/trace-events +2
-0@@ -1,4 +1,6 @@ # gt64xxx_pci.c +gt64120_read(uint64_t addr, uint64_t value) "gt64120 read 0x%03"PRIx64" value:0x%08" PRIx64 +gt64120_write(uint64_t addr, uint64_t value) "gt64120 write 0x%03"PRIx64" value:0x%08" PRIx64
gt64120_read_intreg(const char *regname, unsigned size, uint64_t value)"gt64120 read %s size:%u value:0x%08" PRIx64gt64120_write_intreg(const char *regname, unsigned size, uint64_t value)"gt64120 write %s size:%u value:0x%08" PRIx64gt64120_isd_remap(uint64_t from_length, uint64_t from_addr, uint64_t to_length, uint64_t to_addr)"ISD: 0x%08" PRIx64 "@0x%08" PRIx64 " -> 0x%08" PRIx64 "@0x%08" PRIx64
Re: [PATCH RESEND 5/6] hw/mips/gt64xxx: Trace accesses to ISD registers
In reply to Philippe Mathieu-DaudéQuoted 21 lines · Philippe Mathieu-Daudé
Trace all accesses to Internal Space Decode (ISD) registers.
Signed-off-by Philippe Mathieu-Daudé <[email protected]>---
hw/mips/gt64xxx_pci.c| 2 ++
hw/mips/trace-events | 2 ++2 files changed, 4 insertions(+)hw/mips/gt64xxx_pci.c +1
-0@@ -387,6 +387,7 @@ static void gt64120_writel(void *opaque, hwaddr addr,PCIHostState *phb =PCI_HOST_BRIDGE (s);uint32_t saddr = addr >>2 ; +trace_gt64120_write (addr, val);if (!(s->regs[GT_CPU ] &0x00001000 )) { val =bswap32 (val); }
hw/mips/gt64xxx_pci.c static uint64_t gt64120_readl(void *opaque, · line 970
Quoted 4 lines
hw/mips/gt64xxx_pci.c +1
-0@@ -966,6 +967,7 @@ static uint64_t gt64120_readl(void *opaque,if (!(s->regs[GT_CPU ] &0x00001000 )) { val =bswap32 (val); } +trace_gt64120_read (addr, val);
There are a few other places where logs use saddr << 2 instead of addr so for consistency you might consider either changing those too or use saddr << 2 here as well. (Reviewed-by still stands either way.)
Regards,
BALATON Zoltan
Quoted 15 lines
hw/mips/gt64xxx_pci.c +0
-0return val; }hw/mips/trace-events +2
-0@@ -1,4 +1,6 @@ # gt64xxx_pci.c +gt64120_read(uint64_t addr, uint64_t value) "gt64120 read 0x%03"PRIx64" value:0x%08" PRIx64 +gt64120_write(uint64_t addr, uint64_t value) "gt64120 write 0x%03"PRIx64" value:0x%08" PRIx64
gt64120_read_intreg(const char *regname, unsigned size, uint64_t value)"gt64120 read %s size:%u value:0x%08" PRIx64gt64120_write_intreg(const char *regname, unsigned size, uint64_t value)"gt64120 write %s size:%u value:0x%08" PRIx64gt64120_isd_remap(uint64_t from_length, uint64_t from_addr, uint64_t to_length, uint64_t to_addr)"ISD: 0x%08" PRIx64 "@0x%08" PRIx64 " -> 0x%08" PRIx64 "@0x%08" PRIx64
PATCH RESEND 6/6 hw/mips/gt64xxx: Let the GT64120 manage the lower 512MiB hole
In reply to Philippe Mathieu-DaudéPer the comment in the Malta board, the [0x0000.0000-0x2000.0000] range is decoded by the GT64120, so move the "empty_slot" there.
--- hw/mips/gt64xxx_pci.c | 8 ++++++++ hw/mips/malta.c | 7 ------- 2 files changed, 8 insertions(+), 7 deletions(-)
hw/mips/gt64xxx_pci.c +8 -0
@@ -29,6 +29,7 @@#include "hw/mips/mips.h" #include "hw/pci/pci.h" #include "hw/pci/pci_host.h" +#include "hw/misc/empty_slot.h" #include "hw/southbridge/piix.h" #include "migration/vmstate.h" #include "hw/intc/i8259.h"
@@ -1206,6 +1207,13 @@ static void gt64120_realize(DeviceState *dev, Error **errp)memory_region_init_io (&s->ISD_mem,OBJECT (dev), &isd_mem_ops, s,"gt64120-isd" ,0x1000 ); + +/* +* The whole address space decoded by the GT-64120A doesn't generate +* exception when accessing invalid memory. Create an empty slot to +* emulate this feature. +*/ +empty_slot_init ("GT64120" ,0 ,0x20000000 ); }PCIBus *gt64120_register (qemu_irq *pic)
hw/mips/malta.c +0 -7
@@ -56,7 +56,6 @@#include "sysemu/runstate.h" #include "qapi/error.h" #include "qemu/error-report.h" -#include "hw/misc/empty_slot.h" #include "sysemu/kvm.h" #include "hw/semihosting/semihost.h" #include "hw/mips/cps.h"
@@ -1396,12 +1395,6 @@ void mips_malta_init(MachineState *machine)/* Northbridge */ pci_bus =gt64120_register (s->i8259); -/* -* The whole address space decoded by the GT-64120A doesn't generate -* exception when accessing invalid memory. Create an empty slot to -* emulate this feature. -*/ -empty_slot_init ("GT64120" ,0 ,0x20000000 );/* Southbridge */ dev =piix4_create (pci_bus, &isa_bus, &smbus);
Signature · 1 line
2.26.2
Re: [PATCH RESEND 6/6] hw/mips/gt64xxx: Let the GT64120 manage the lower 512MiB hole
Quoted 2 lines · Philippe Mathieu-Daudé
Per the comment in the Malta board, the [0x0000.0000-0x2000.0000] range is decoded by the GT64120, so move the "
empty_slot" there.
I don't know anything about it to be able to review but is this a feature of the GT64120 chip (in which case the change is correct) or the Malta board (in which case this might make the GT64120 model board specific that may not matter much as there's nothing else using it now).
Regards,
BALATON Zoltan
Quoted 58 lines
Signed-off-by Philippe Mathieu-Daudé <[email protected]>---
hw/mips/gt64xxx_pci.c| 8 ++++++++hw/mips/malta.c| 7 -------2 files changed, 8 insertions(+), 7 deletions(-)hw/mips/gt64xxx_pci.c +8
-0@@ -29,6 +29,7 @@#include "hw/mips/mips.h" #include "hw/pci/pci.h" #include "hw/pci/pci_host.h" +#include "hw/misc/empty_slot.h" #include "hw/southbridge/piix.h" #include "migration/vmstate.h" #include "hw/intc/i8259.h" @@ -1206,6 +1207,13 @@ static void gt64120_realize(DeviceState *dev, Error **errp)memory_region_init_io (&s->ISD_mem,OBJECT (dev), &isd_mem_ops, s,"gt64120-isd" ,0x1000 ); + +/* +* The whole address space decoded by the GT-64120A doesn't generate +* exception when accessing invalid memory. Create an empty slot to +* emulate this feature. +*/ +empty_slot_init ("GT64120" ,0 ,0x20000000 ); }PCIBus *gt64120_register (qemu_irq *pic)hw/mips/malta.c +0
-7@@ -56,7 +56,6 @@#include "sysemu/runstate.h" #include "qapi/error.h" #include "qemu/error-report.h" -#include "hw/misc/empty_slot.h" #include "sysemu/kvm.h" #include "hw/semihosting/semihost.h" #include "hw/mips/cps.h" @@ -1396,12 +1395,6 @@ void mips_malta_init(MachineState *machine)/* Northbridge */ pci_bus =gt64120_register (s->i8259); -/* -* The whole address space decoded by the GT-64120A doesn't generate -* exception when accessing invalid memory. Create an empty slot to -* emulate this feature. -*/ -empty_slot_init ("GT64120" ,0 ,0x20000000 );/* Southbridge */ dev =piix4_create (pci_bus, &isa_bus, &smbus);
Re: [PATCH RESEND 6/6] hw/mips/gt64xxx: Let the GT64120 manage the lower 512MiB hole
Quoted 8 lines · BALATON Zoltan
Quoted 2 lines · Philippe Mathieu-Daudé
Per the comment in the Malta board, the [0x0000.0000-0x2000.0000] range is decoded by the GT64120, so move the "
empty_slot" there.I don't know anything about it to be able to review but is this a feature of the GT64120 chip (in which case the change is correct) or the Malta board (in which case this might make the GT64120 model board specific that may not matter much as there's nothing else using it now).
As this is board-specific, I'll improve the description. Let's ignore this patch for now.
Thank you for the previous reviews :)
Phil.
Quoted 5 lines · Philippe Mathieu-Daudé
Trivial fixes extracted from another series which became too big, so I prefer to send them in a previous step.
(This is a resend for Zoltan).
Quoted 7 lines
Philippe Mathieu-Daudé (6):
hw/mips/gt64xxx: Initialize ISD I/O memory region inDeviceRealize()hw/mips/gt64xxx: Simplify ISD MemoryRegion read/write handlers hw/mips/gt64xxx: Fix typos inqemu_log_mask()formats hw/mips/gt64xxx: Rename trace events related to interrupt registers hw/mips/gt64xxx: Trace accesses to ISD registers hw/mips/gt64xxx: Let the GT64120 manage the lower 512MiB hole
Thanks, patches 1-5 applied to mips-next.