[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 35/36] hw/arm/virt: kvm: allow gicv3 by default if v2 cannot work
From: |
Peter Maydell |
Subject: |
[PULL 35/36] hw/arm/virt: kvm: allow gicv3 by default if v2 cannot work |
Date: |
Thu, 12 Mar 2020 16:44:58 +0000 |
From: Eric Auger <address@hidden>
At the moment if the end-user does not specify the gic-version along
with KVM acceleration, v2 is set by default. However most of the
systems now have GICv3 and sometimes they do not support GICv2
compatibility.
This patch keeps the default v2 selection in all cases except
in the KVM accelerated mode when either
- the host does not support GICv2 in-kernel emulation or
- number of VCPUS exceeds 8.
Those cases did not work anyway so we do not break any compatibility.
Now we get v3 selected in such a case.
Signed-off-by: Eric Auger <address@hidden>
Reported-by: Dr. David Alan Gilbert <address@hidden>
Reviewed-by: Andrew Jones <address@hidden>
Message-id: address@hidden
Signed-off-by: Peter Maydell <address@hidden>
---
hw/arm/virt.c | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index 90966580a3d..94f93dda54f 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -1543,6 +1543,8 @@ static void virt_set_memmap(VirtMachineState *vms)
*/
static void finalize_gic_version(VirtMachineState *vms)
{
+ unsigned int max_cpus = MACHINE(vms)->smp.max_cpus;
+
if (kvm_enabled()) {
int probe_bitmap;
@@ -1582,7 +1584,20 @@ static void finalize_gic_version(VirtMachineState *vms)
}
return;
case VIRT_GIC_VERSION_NOSEL:
- vms->gic_version = VIRT_GIC_VERSION_2;
+ if ((probe_bitmap & KVM_ARM_VGIC_V2) && max_cpus <= GIC_NCPU) {
+ vms->gic_version = VIRT_GIC_VERSION_2;
+ } else if (probe_bitmap & KVM_ARM_VGIC_V3) {
+ /*
+ * in case the host does not support v2 in-kernel emulation or
+ * the end-user requested more than 8 VCPUs we now default
+ * to v3. In any case defaulting to v2 would be broken.
+ */
+ vms->gic_version = VIRT_GIC_VERSION_3;
+ } else if (max_cpus > GIC_NCPU) {
+ error_report("host only supports in-kernel GICv2 emulation "
+ "but more than 8 vcpus are requested");
+ exit(1);
+ }
break;
case VIRT_GIC_VERSION_2:
case VIRT_GIC_VERSION_3:
--
2.20.1
- [PULL 20/36] hw/arm/allwinner-h3: add EMAC ethernet device, (continued)
- [PULL 20/36] hw/arm/allwinner-h3: add EMAC ethernet device, Peter Maydell, 2020/03/12
- [PULL 23/36] hw/arm/allwinner: add RTC device support, Peter Maydell, 2020/03/12
- [PULL 28/36] tests/boot_linux_console: Test booting NetBSD via U-Boot on OrangePi PC, Peter Maydell, 2020/03/12
- [PULL 31/36] hw/arm/virt: Introduce VirtGICType enum type, Peter Maydell, 2020/03/12
- [PULL 22/36] hw/arm/allwinner-h3: add SDRAM controller device, Peter Maydell, 2020/03/12
- [PULL 19/36] hw/arm/allwinner: add SD/MMC host controller, Peter Maydell, 2020/03/12
- [PULL 27/36] tests/boot_linux_console: Add a SLOW test booting Ubuntu on OrangePi PC, Peter Maydell, 2020/03/12
- [PULL 33/36] target/arm/kvm: Let kvm_arm_vgic_probe() return a bitmap, Peter Maydell, 2020/03/12
- [PULL 30/36] hw/arm/virt: Document 'max' value in gic-version property description, Peter Maydell, 2020/03/12
- [PULL 34/36] hw/arm/virt: kvm: Restructure finalize_gic_version(), Peter Maydell, 2020/03/12
- [PULL 35/36] hw/arm/virt: kvm: allow gicv3 by default if v2 cannot work,
Peter Maydell <=
- [PULL 29/36] docs: add Orange Pi PC document, Peter Maydell, 2020/03/12
- [PULL 32/36] hw/arm/virt: Introduce finalize_gic_version(), Peter Maydell, 2020/03/12
- [PULL 36/36] target/arm: kvm: Inject events at the last stage of sync, Peter Maydell, 2020/03/12
- Re: [PULL 00/36] target-arm queue, Peter Maydell, 2020/03/12