All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] hw/arm/virt-acpi-build: Present the GICR structure properly for GICv4
@ 2022-08-12  2:20 Zenghui Yu via
  2022-08-12 10:25 ` Peter Maydell
  0 siblings, 1 reply; 2+ messages in thread
From: Zenghui Yu via @ 2022-08-12  2:20 UTC (permalink / raw)
  To: qemu-devel, qemu-arm
  Cc: peter.maydell, shannon.zhaosl, wanghaibin.wang, Zenghui Yu

With the introduction of the new TCG GICv4, build_madt() is badly broken
as we do not present any GIC Redistributor structure in MADT for GICv4
guests, so that they have no idea about where the Redistributor
register frames are. This fixes a Linux guest crash at boot time with
ACPI enabled and '-machine gic-version=4'.

While at it, let's convert the remaining hard coded gic_version into
enumeration VIRT_GIC_VERSION_2 for consistency.

Signed-off-by: Zenghui Yu <yuzenghui@huawei.com>
---
 hw/arm/virt-acpi-build.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
index 449fab0080..9b3aee01bf 100644
--- a/hw/arm/virt-acpi-build.c
+++ b/hw/arm/virt-acpi-build.c
@@ -732,7 +732,7 @@ build_madt(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
         uint32_t pmu_interrupt = arm_feature(&armcpu->env, ARM_FEATURE_PMU) ?
                                              PPI(VIRTUAL_PMU_IRQ) : 0;
 
-        if (vms->gic_version == 2) {
+        if (vms->gic_version == VIRT_GIC_VERSION_2) {
             physical_base_address = memmap[VIRT_GIC_CPU].base;
             gicv = memmap[VIRT_GIC_VCPU].base;
             gich = memmap[VIRT_GIC_HYP].base;
@@ -762,7 +762,7 @@ build_madt(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
         build_append_int_noprefix(table_data, armcpu->mp_affinity, 8);
     }
 
-    if (vms->gic_version == 3) {
+    if (vms->gic_version != VIRT_GIC_VERSION_2) {
         build_append_gicr(table_data, memmap[VIRT_GIC_REDIST].base,
                                       memmap[VIRT_GIC_REDIST].size);
         if (virt_gicv3_redist_region_count(vms) == 2) {
-- 
2.33.0



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] hw/arm/virt-acpi-build: Present the GICR structure properly for GICv4
  2022-08-12  2:20 [PATCH] hw/arm/virt-acpi-build: Present the GICR structure properly for GICv4 Zenghui Yu via
@ 2022-08-12 10:25 ` Peter Maydell
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Maydell @ 2022-08-12 10:25 UTC (permalink / raw)
  To: Zenghui Yu; +Cc: qemu-devel, qemu-arm, shannon.zhaosl, wanghaibin.wang

On Fri, 12 Aug 2022 at 03:20, Zenghui Yu <yuzenghui@huawei.com> wrote:
>
> With the introduction of the new TCG GICv4, build_madt() is badly broken
> as we do not present any GIC Redistributor structure in MADT for GICv4
> guests, so that they have no idea about where the Redistributor
> register frames are. This fixes a Linux guest crash at boot time with
> ACPI enabled and '-machine gic-version=4'.
>
> While at it, let's convert the remaining hard coded gic_version into
> enumeration VIRT_GIC_VERSION_2 for consistency.
>
> Signed-off-by: Zenghui Yu <yuzenghui@huawei.com>

Oops, I missed the ACPI side of things when I added GICv4
support :-(

Crash-on-boot seems like a bug worth fixing for rc3...



Applied to target-arm.next, thanks.

-- PMM


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-08-12 10:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-12  2:20 [PATCH] hw/arm/virt-acpi-build: Present the GICR structure properly for GICv4 Zenghui Yu via
2022-08-12 10:25 ` Peter Maydell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.