* [Qemu-devel] [PATCH] hw/arm/virt: mark timer in fdt as v8-compatible
@ 2014-09-26 13:09 hw.claudio
2014-10-09 14:41 ` Claudio Fontana
2014-10-09 17:00 ` Peter Maydell
0 siblings, 2 replies; 5+ messages in thread
From: hw.claudio @ 2014-09-26 13:09 UTC (permalink / raw)
To: Peter Maydell; +Cc: Claudio Fontana, qemu-devel
From: Claudio Fontana <claudio.fontana@huawei.com>
check if the first cpu is an armv8 cpu, and if so, put
arm,armv8-timer in the compatible string list.
Note that due to this check, this patch moves the creation
of the timer fdt node to after the cpu creation loop.
Signed-off-by: Claudio Fontana <claudio.fontana@huawei.com>
---
hw/arm/virt.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index 8c6b171..eeb3105 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -239,14 +239,23 @@ static void fdt_add_timer_nodes(const VirtBoardInfo *vbi)
* but for the GIC implementation provided by both QEMU and KVM
* they are edge-triggered.
*/
+ ARMCPU *armcpu;
uint32_t irqflags = GIC_FDT_IRQ_FLAGS_EDGE_LO_HI;
irqflags = deposit32(irqflags, GIC_FDT_IRQ_PPI_CPU_START,
GIC_FDT_IRQ_PPI_CPU_WIDTH, (1 << vbi->smp_cpus) - 1);
qemu_fdt_add_subnode(vbi->fdt, "/timer");
- qemu_fdt_setprop_string(vbi->fdt, "/timer",
- "compatible", "arm,armv7-timer");
+
+ armcpu = ARM_CPU(qemu_get_cpu(0));
+ if (arm_feature(&armcpu->env, ARM_FEATURE_V8)) {
+ const char compat[] = "arm,armv7-timer\0arm,armv8-timer";
+ qemu_fdt_setprop(vbi->fdt, "/timer", "compatible",
+ compat, sizeof(compat));
+ } else {
+ qemu_fdt_setprop_string(vbi->fdt, "/timer", "compatible",
+ "arm,armv7-timer");
+ }
qemu_fdt_setprop_cells(vbi->fdt, "/timer", "interrupts",
GIC_FDT_IRQ_TYPE_PPI, 13, irqflags,
GIC_FDT_IRQ_TYPE_PPI, 14, irqflags,
@@ -553,7 +562,6 @@ static void machvirt_init(MachineState *machine)
}
create_fdt(vbi);
- fdt_add_timer_nodes(vbi);
for (n = 0; n < smp_cpus; n++) {
ObjectClass *oc = cpu_class_by_name(TYPE_ARM_CPU, cpu_model);
@@ -577,6 +585,7 @@ static void machvirt_init(MachineState *machine)
object_property_set_bool(cpuobj, true, "realized", NULL);
}
+ fdt_add_timer_nodes(vbi);
fdt_add_cpu_nodes(vbi);
fdt_add_psci_node(vbi);
--
1.8.5.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] hw/arm/virt: mark timer in fdt as v8-compatible
2014-09-26 13:09 [Qemu-devel] [PATCH] hw/arm/virt: mark timer in fdt as v8-compatible hw.claudio
@ 2014-10-09 14:41 ` Claudio Fontana
2014-10-09 17:00 ` Peter Maydell
1 sibling, 0 replies; 5+ messages in thread
From: Claudio Fontana @ 2014-10-09 14:41 UTC (permalink / raw)
To: Peter Maydell; +Cc: Claudio Fontana, QEMU Developers
Hello Peter,
are you ok with this one?
Thanks,
Claudio
On 26 September 2014 15:09, <hw.claudio@gmail.com> wrote:
> From: Claudio Fontana <claudio.fontana@huawei.com>
>
> check if the first cpu is an armv8 cpu, and if so, put
> arm,armv8-timer in the compatible string list.
>
> Note that due to this check, this patch moves the creation
> of the timer fdt node to after the cpu creation loop.
>
> Signed-off-by: Claudio Fontana <claudio.fontana@huawei.com>
> ---
> hw/arm/virt.c | 15 ++++++++++++---
> 1 file changed, 12 insertions(+), 3 deletions(-)
>
> diff --git a/hw/arm/virt.c b/hw/arm/virt.c
> index 8c6b171..eeb3105 100644
> --- a/hw/arm/virt.c
> +++ b/hw/arm/virt.c
> @@ -239,14 +239,23 @@ static void fdt_add_timer_nodes(const VirtBoardInfo *vbi)
> * but for the GIC implementation provided by both QEMU and KVM
> * they are edge-triggered.
> */
> + ARMCPU *armcpu;
> uint32_t irqflags = GIC_FDT_IRQ_FLAGS_EDGE_LO_HI;
>
> irqflags = deposit32(irqflags, GIC_FDT_IRQ_PPI_CPU_START,
> GIC_FDT_IRQ_PPI_CPU_WIDTH, (1 << vbi->smp_cpus) - 1);
>
> qemu_fdt_add_subnode(vbi->fdt, "/timer");
> - qemu_fdt_setprop_string(vbi->fdt, "/timer",
> - "compatible", "arm,armv7-timer");
> +
> + armcpu = ARM_CPU(qemu_get_cpu(0));
> + if (arm_feature(&armcpu->env, ARM_FEATURE_V8)) {
> + const char compat[] = "arm,armv7-timer\0arm,armv8-timer";
> + qemu_fdt_setprop(vbi->fdt, "/timer", "compatible",
> + compat, sizeof(compat));
> + } else {
> + qemu_fdt_setprop_string(vbi->fdt, "/timer", "compatible",
> + "arm,armv7-timer");
> + }
> qemu_fdt_setprop_cells(vbi->fdt, "/timer", "interrupts",
> GIC_FDT_IRQ_TYPE_PPI, 13, irqflags,
> GIC_FDT_IRQ_TYPE_PPI, 14, irqflags,
> @@ -553,7 +562,6 @@ static void machvirt_init(MachineState *machine)
> }
>
> create_fdt(vbi);
> - fdt_add_timer_nodes(vbi);
>
> for (n = 0; n < smp_cpus; n++) {
> ObjectClass *oc = cpu_class_by_name(TYPE_ARM_CPU, cpu_model);
> @@ -577,6 +585,7 @@ static void machvirt_init(MachineState *machine)
>
> object_property_set_bool(cpuobj, true, "realized", NULL);
> }
> + fdt_add_timer_nodes(vbi);
> fdt_add_cpu_nodes(vbi);
> fdt_add_psci_node(vbi);
>
> --
> 1.8.5.3
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] hw/arm/virt: mark timer in fdt as v8-compatible
2014-09-26 13:09 [Qemu-devel] [PATCH] hw/arm/virt: mark timer in fdt as v8-compatible hw.claudio
2014-10-09 14:41 ` Claudio Fontana
@ 2014-10-09 17:00 ` Peter Maydell
2014-10-09 17:04 ` Peter Maydell
1 sibling, 1 reply; 5+ messages in thread
From: Peter Maydell @ 2014-10-09 17:00 UTC (permalink / raw)
To: Claudio Fontana; +Cc: Claudio Fontana, QEMU Developers
On 26 September 2014 14:09, <hw.claudio@gmail.com> wrote:
> From: Claudio Fontana <claudio.fontana@huawei.com>
>
> check if the first cpu is an armv8 cpu, and if so, put
> arm,armv8-timer in the compatible string list.
>
> Note that due to this check, this patch moves the creation
> of the timer fdt node to after the cpu creation loop.
>
> Signed-off-by: Claudio Fontana <claudio.fontana@huawei.com>
Applied to target-arm.next, thanks.
-- PMM
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] hw/arm/virt: mark timer in fdt as v8-compatible
2014-10-09 17:00 ` Peter Maydell
@ 2014-10-09 17:04 ` Peter Maydell
2014-10-10 9:02 ` Claudio Fontana
0 siblings, 1 reply; 5+ messages in thread
From: Peter Maydell @ 2014-10-09 17:04 UTC (permalink / raw)
To: Claudio Fontana; +Cc: Claudio Fontana, QEMU Developers
On 9 October 2014 18:00, Peter Maydell <peter.maydell@linaro.org> wrote:
> On 26 September 2014 14:09, <hw.claudio@gmail.com> wrote:
>> From: Claudio Fontana <claudio.fontana@huawei.com>
>>
>> check if the first cpu is an armv8 cpu, and if so, put
>> arm,armv8-timer in the compatible string list.
>>
>> Note that due to this check, this patch moves the creation
>> of the timer fdt node to after the cpu creation loop.
>>
>> Signed-off-by: Claudio Fontana <claudio.fontana@huawei.com>
>
> Applied to target-arm.next, thanks.
...except that on advice from one of our kernel folk I've
swapped the v8 compat string round so it reads
"arm,armv8-timer\0arm,armv7-timer"
to advertise the more specific compat first for v8.
-- PMM
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] hw/arm/virt: mark timer in fdt as v8-compatible
2014-10-09 17:04 ` Peter Maydell
@ 2014-10-10 9:02 ` Claudio Fontana
0 siblings, 0 replies; 5+ messages in thread
From: Claudio Fontana @ 2014-10-10 9:02 UTC (permalink / raw)
To: Peter Maydell, Claudio Fontana; +Cc: QEMU Developers
On 09.10.2014 19:04, Peter Maydell wrote:
> On 9 October 2014 18:00, Peter Maydell <peter.maydell@linaro.org> wrote:
>> On 26 September 2014 14:09, <hw.claudio@gmail.com> wrote:
>>> From: Claudio Fontana <claudio.fontana@huawei.com>
>>>
>>> check if the first cpu is an armv8 cpu, and if so, put
>>> arm,armv8-timer in the compatible string list.
>>>
>>> Note that due to this check, this patch moves the creation
>>> of the timer fdt node to after the cpu creation loop.
>>>
>>> Signed-off-by: Claudio Fontana <claudio.fontana@huawei.com>
>>
>> Applied to target-arm.next, thanks.
>
> ...except that on advice from one of our kernel folk I've
> swapped the v8 compat string round so it reads
> "arm,armv8-timer\0arm,armv7-timer"
> to advertise the more specific compat first for v8.
>
> -- PMM
>
Ok, thanks!
Claudio
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-10-10 9:02 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-26 13:09 [Qemu-devel] [PATCH] hw/arm/virt: mark timer in fdt as v8-compatible hw.claudio
2014-10-09 14:41 ` Claudio Fontana
2014-10-09 17:00 ` Peter Maydell
2014-10-09 17:04 ` Peter Maydell
2014-10-10 9:02 ` Claudio Fontana
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).