Commit 4f64cb65 authored by Jean-Philippe Brucker's avatar Jean-Philippe Brucker Committed by Marc Zyngier

arm/arm64: KVM: Only allow 64bit hosts to build VGICv3

Hardware virtualisation of GICv3 is only supported by 64bit hosts for
the moment. Some VGICv3 bits are missing from the 32bit side, and this
patch allows to still be able to build 32bit hosts when CONFIG_ARM_GIC_V3
is selected.

To this end, we introduce a new option, CONFIG_KVM_ARM_VGIC_V3, that is
only enabled on the 64bit side. The selection is done unconditionally
because CONFIG_ARM_GIC_V3 is always enabled on arm64.
Reviewed-by: default avatarMarc Zyngier <marc.zyngier@arm.com>
Signed-off-by: default avatarJean-Philippe Brucker <jean-philippe.brucker@arm.com>
Signed-off-by: default avatarMarc Zyngier <marc.zyngier@arm.com>
parent 0b28f1db
...@@ -16,6 +16,9 @@ menuconfig VIRTUALIZATION ...@@ -16,6 +16,9 @@ menuconfig VIRTUALIZATION
if VIRTUALIZATION if VIRTUALIZATION
config KVM_ARM_VGIC_V3
bool
config KVM config KVM
bool "Kernel-based Virtual Machine (KVM) support" bool "Kernel-based Virtual Machine (KVM) support"
depends on OF depends on OF
...@@ -31,6 +34,7 @@ config KVM ...@@ -31,6 +34,7 @@ config KVM
select KVM_VFIO select KVM_VFIO
select HAVE_KVM_EVENTFD select HAVE_KVM_EVENTFD
select HAVE_KVM_IRQFD select HAVE_KVM_IRQFD
select KVM_ARM_VGIC_V3
---help--- ---help---
Support hosting virtualized guest machines. Support hosting virtualized guest machines.
......
...@@ -282,7 +282,7 @@ struct vgic_v2_cpu_if { ...@@ -282,7 +282,7 @@ struct vgic_v2_cpu_if {
}; };
struct vgic_v3_cpu_if { struct vgic_v3_cpu_if {
#ifdef CONFIG_ARM_GIC_V3 #ifdef CONFIG_KVM_ARM_VGIC_V3
u32 vgic_hcr; u32 vgic_hcr;
u32 vgic_vmcr; u32 vgic_vmcr;
u32 vgic_sre; /* Restored only, change ignored */ u32 vgic_sre; /* Restored only, change ignored */
...@@ -364,7 +364,7 @@ void kvm_vgic_set_phys_irq_active(struct irq_phys_map *map, bool active); ...@@ -364,7 +364,7 @@ void kvm_vgic_set_phys_irq_active(struct irq_phys_map *map, bool active);
int vgic_v2_probe(struct device_node *vgic_node, int vgic_v2_probe(struct device_node *vgic_node,
const struct vgic_ops **ops, const struct vgic_ops **ops,
const struct vgic_params **params); const struct vgic_params **params);
#ifdef CONFIG_ARM_GIC_V3 #ifdef CONFIG_KVM_ARM_VGIC_V3
int vgic_v3_probe(struct device_node *vgic_node, int vgic_v3_probe(struct device_node *vgic_node,
const struct vgic_ops **ops, const struct vgic_ops **ops,
const struct vgic_params **params); const struct vgic_params **params);
......
...@@ -2122,7 +2122,7 @@ static int init_vgic_model(struct kvm *kvm, int type) ...@@ -2122,7 +2122,7 @@ static int init_vgic_model(struct kvm *kvm, int type)
case KVM_DEV_TYPE_ARM_VGIC_V2: case KVM_DEV_TYPE_ARM_VGIC_V2:
vgic_v2_init_emulation(kvm); vgic_v2_init_emulation(kvm);
break; break;
#ifdef CONFIG_ARM_GIC_V3 #ifdef CONFIG_KVM_ARM_VGIC_V3
case KVM_DEV_TYPE_ARM_VGIC_V3: case KVM_DEV_TYPE_ARM_VGIC_V3:
vgic_v3_init_emulation(kvm); vgic_v3_init_emulation(kvm);
break; break;
...@@ -2284,7 +2284,7 @@ int kvm_vgic_addr(struct kvm *kvm, unsigned long type, u64 *addr, bool write) ...@@ -2284,7 +2284,7 @@ int kvm_vgic_addr(struct kvm *kvm, unsigned long type, u64 *addr, bool write)
block_size = KVM_VGIC_V2_CPU_SIZE; block_size = KVM_VGIC_V2_CPU_SIZE;
alignment = SZ_4K; alignment = SZ_4K;
break; break;
#ifdef CONFIG_ARM_GIC_V3 #ifdef CONFIG_KVM_ARM_VGIC_V3
case KVM_VGIC_V3_ADDR_TYPE_DIST: case KVM_VGIC_V3_ADDR_TYPE_DIST:
type_needed = KVM_DEV_TYPE_ARM_VGIC_V3; type_needed = KVM_DEV_TYPE_ARM_VGIC_V3;
addr_ptr = &vgic->vgic_dist_base; addr_ptr = &vgic->vgic_dist_base;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment