hw/cpu/a15mpcore: Use qemu_get_cpu() for generic timers
PATCH 1/1 hw/cpu/a15mpcore: Use qemu_get_cpu() for generic timers
This simplifies the loop and aids with refactoring of CPU list.
--- hw/cpu/a15mpcore.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
hw/cpu/a15mpcore.c +2 -3
@@ -50,7 +50,6 @@ static int a15mp_priv_init(SysBusDevice *dev)SysBusDevice *busdev;const char *gictype ="arm_gic" ;int i; -CPUState *cpu;if (kvm_irqchip_in_kernel ()) { gictype ="kvm-arm-gic" ;
@@ -72,8 +71,8 @@ static int a15mp_priv_init(SysBusDevice *dev)/* Wire the outputs from each CPU's generic timer to the * appropriate GIC PPI inputs */ -for (i =0 , cpu = first_cpu; i < s->num_cpu; i++, cpu = cpu->next_cpu) { -DeviceState *cpudev =DEVICE (cpu); +for (i =0 ; i < s->num_cpu; i++) { +DeviceState *cpudev =DEVICE (qemu_get_cpu (i));int ppibase = s->num_irq -32 + i *32 ;/* physical timer; we wire it up to the non-secure timer's ID, * since a real A15 always has TrustZone but QEMU doesn't.
Signature · 1 line
1.8.1.4
Am 21.08.2013 18:45, schrieb Andreas Färber:
Quoted 7 lines
This simplifies the loop and aids with refactoring of CPU list.
Requested-by Peter Maydell <[email protected]>Signed-off-by Andreas Färber <[email protected]>--- hw/cpu/a15mpcore.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
Seeing no objection or pick-up from PMM I've applied this to qom-cpu now, to move forward with CPU list refactoring.
https://github.com/afaerber/qemu-cpu/commits/qom-cpu
Andreas
Quoted 25 lines
hw/cpu/a15mpcore.c +2
-3@@ -50,7 +50,6 @@ static int a15mp_priv_init(SysBusDevice *dev)SysBusDevice *busdev;const char *gictype ="arm_gic" ;int i; -CPUState *cpu;if (kvm_irqchip_in_kernel ()) { gictype ="kvm-arm-gic" ;@@ -72,8 +71,8 @@ static int a15mp_priv_init(SysBusDevice *dev)/* Wire the outputs from each CPU's generic timer to the * appropriate GIC PPI inputs */ -for (i =0 , cpu = first_cpu; i < s->num_cpu; i++, cpu = cpu->next_cpu) { -DeviceState *cpudev =DEVICE (cpu); +for (i =0 ; i < s->num_cpu; i++) { +DeviceState *cpudev =DEVICE (qemu_get_cpu (i));int ppibase = s->num_irq -32 + i *32 ;/* physical timer; we wire it up to the non-secure timer's ID, * since a real A15 always has TrustZone but QEMU doesn't.
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
Quoted 11 lines · Andreas Färber
Am 21.08.2013 18:45, schrieb Andreas Färber:
Quoted 7 lines
This simplifies the loop and aids with refactoring of CPU list.
Requested-by Peter Maydell <[email protected]>Signed-off-by Andreas Färber <[email protected]>--- hw/cpu/a15mpcore.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)Seeing no objection or pick-up from PMM I've applied this to qom-cpu now, to move forward with CPU list refactoring.
I wasn't sure how this patch fit with your larger series that redoes the a15mpcore/gic/etc (which I think I'm still waiting for an applyable patch set so I can review it); I think I thought it was an apply-afterwards thing.
Anyway, I have no objection to it.
-- PMM
Am 28.08.2013 17:22, schrieb Peter Maydell:
Quoted 10 lines · Andreas Färber
Quoted 9 lines
Am 21.08.2013 18:45, schrieb Andreas Färber:
Quoted 7 lines
This simplifies the loop and aids with refactoring of CPU list.
Requested-by Peter Maydell <[email protected]>Signed-off-by Andreas Färber <[email protected]>--- hw/cpu/a15mpcore.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
Quoted 7 lines
Quoted 2 lines
Seeing no objection or pick-up from PMM I've applied this to qom-cpu now, to move forward with CPU list refactoring.
I wasn't sure how this patch fit with your larger series that redoes the a15mpcore/gic/etc (which I think I'm still waiting for an applyable patch set so I can review it); I think I thought it was an apply-afterwards thing.
This one needs to go before my qom-cpu-12 series to avoid the CPU loop ugliness. That's in my CPU tree, and seeing no objections I still need to test the p_greetings2.c sample for the CPU-removed case in linux-user and will then merge that before we get more CPU loops.
For the MPCore series in my ARM/Tegra tree you wanted an assert for object_initialize(). I am waiting for you to comment on my more invasive/complete series (last part being optional), which would then with any suggested changes go through my QOM tree before I add more uses of object_initialize() that would need to be converted.
Based on that I will respin the MPCore, virtio and other QOM series.
Quoted 1 line
Anyway, I have no objection to it.
Thanks, want me to add some *-by?
Andreas
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
Quoted 5 lines · Andreas Färber
For the MPCore series in my ARM/Tegra tree you wanted an assert for
object_initialize(). I am waiting for you to comment on my more invasive/complete series (last part being optional), which would then with any suggested changes go through my QOM tree before I add more uses ofobject_initialize()that would need to be converted.
Ah, OK. I'm moving house this week so probably won't get to detailed review til next week, but I think in general it looked OK. Having to pass "&X, sizeof(X)" in the most common case is a little unfortunate but I think the bus related code and so on convinced me it was necessary.
-- PMM
Am 28.08.2013 18:11, schrieb Peter Maydell:
Quoted 7 lines · Andreas Färber
Quoted 5 lines
For the MPCore series in my ARM/Tegra tree you wanted an assert for
object_initialize(). I am waiting for you to comment on my more invasive/complete series (last part being optional), which would then with any suggested changes go through my QOM tree before I add more uses ofobject_initialize()that would need to be converted.
Quoted 5 lines
Ah, OK. I'm moving house this week so probably won't get to detailed review til next week, but I think in general it looked OK. Having to pass "&X, sizeof(X)" in the most common case is a little unfortunate but I think the bus related code and so on convinced me it was necessary.
Yeah, it turned into more work than I expected ;) but there were at least two cases (still need to reply) where the macro-fied version would've checked the wrong thing and my patches are intentionally deviating from the usual pattern - main_system_bus and a sec_bus.
Thanks,
Andreas
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg