diff mbox series

[2/6] KVM: arm64: pkvm: Disable GICv2 support

Message ID 20211208152300.2478542-3-qperret@google.com (mailing list archive)
State New, archived
Headers show
Series KVM: arm64: Miscellaneous pkvm fixes | expand

Commit Message

Quentin Perret Dec. 8, 2021, 3:22 p.m. UTC
GICv2 requires having device mappings in guests and the hypervisor,
which is incompatible with the current pKVM EL2 page ownership model
which only covers memory. While it would be desirable to support pKVM
with GICv2, this will require a lot more work, so let's make the
current assumption clear until then.

Co-developed-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Quentin Perret <qperret@google.com>
---
 arch/arm64/kvm/vgic/vgic-v2.c | 5 +++++
 arch/arm64/kvm/vgic/vgic-v3.c | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

Comments

Will Deacon Dec. 8, 2021, 5:44 p.m. UTC | #1
On Wed, Dec 08, 2021 at 03:22:55PM +0000, Quentin Perret wrote:
> GICv2 requires having device mappings in guests and the hypervisor,
> which is incompatible with the current pKVM EL2 page ownership model
> which only covers memory. While it would be desirable to support pKVM
> with GICv2, this will require a lot more work, so let's make the
> current assumption clear until then.
> 
> Co-developed-by: Marc Zyngier <maz@kernel.org>
> Signed-off-by: Marc Zyngier <maz@kernel.org>
> Signed-off-by: Quentin Perret <qperret@google.com>
> ---
>  arch/arm64/kvm/vgic/vgic-v2.c | 5 +++++
>  arch/arm64/kvm/vgic/vgic-v3.c | 2 +-
>  2 files changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm64/kvm/vgic/vgic-v2.c b/arch/arm64/kvm/vgic/vgic-v2.c
> index 95a18cec14a3..8e337a0d7817 100644
> --- a/arch/arm64/kvm/vgic/vgic-v2.c
> +++ b/arch/arm64/kvm/vgic/vgic-v2.c
> @@ -345,6 +345,11 @@ int vgic_v2_probe(const struct gic_kvm_info *info)
>  	int ret;
>  	u32 vtr;
>  
> +	if (is_protected_kvm_enabled()) {
> +		kvm_err("GICv2 not supported in protected mode\n");
> +		return -ENXIO;
> +	}
> +
>  	if (!info->vctrl.start) {
>  		kvm_err("GICH not present in the firmware table\n");
>  		return -ENXIO;
> diff --git a/arch/arm64/kvm/vgic/vgic-v3.c b/arch/arm64/kvm/vgic/vgic-v3.c
> index 04f62c4b07fb..debad4e6e6c9 100644
> --- a/arch/arm64/kvm/vgic/vgic-v3.c
> +++ b/arch/arm64/kvm/vgic/vgic-v3.c
> @@ -651,7 +651,7 @@ int vgic_v3_probe(const struct gic_kvm_info *info)
>  	} else if (!PAGE_ALIGNED(info->vcpu.start)) {
>  		pr_warn("GICV physical address 0x%llx not page aligned\n",
>  			(unsigned long long)info->vcpu.start);
> -	} else {
> +	} else if (kvm_get_mode() != KVM_MODE_PROTECTED) {
>  		kvm_vgic_global_state.vcpu_base = info->vcpu.start;
>  		kvm_vgic_global_state.can_emulate_gicv2 = true;
>  		ret = kvm_register_vgic_device(KVM_DEV_TYPE_ARM_VGIC_V2);

Acked-by: Will Deacon <will@kernel.org>

Will
diff mbox series

Patch

diff --git a/arch/arm64/kvm/vgic/vgic-v2.c b/arch/arm64/kvm/vgic/vgic-v2.c
index 95a18cec14a3..8e337a0d7817 100644
--- a/arch/arm64/kvm/vgic/vgic-v2.c
+++ b/arch/arm64/kvm/vgic/vgic-v2.c
@@ -345,6 +345,11 @@  int vgic_v2_probe(const struct gic_kvm_info *info)
 	int ret;
 	u32 vtr;
 
+	if (is_protected_kvm_enabled()) {
+		kvm_err("GICv2 not supported in protected mode\n");
+		return -ENXIO;
+	}
+
 	if (!info->vctrl.start) {
 		kvm_err("GICH not present in the firmware table\n");
 		return -ENXIO;
diff --git a/arch/arm64/kvm/vgic/vgic-v3.c b/arch/arm64/kvm/vgic/vgic-v3.c
index 04f62c4b07fb..debad4e6e6c9 100644
--- a/arch/arm64/kvm/vgic/vgic-v3.c
+++ b/arch/arm64/kvm/vgic/vgic-v3.c
@@ -651,7 +651,7 @@  int vgic_v3_probe(const struct gic_kvm_info *info)
 	} else if (!PAGE_ALIGNED(info->vcpu.start)) {
 		pr_warn("GICV physical address 0x%llx not page aligned\n",
 			(unsigned long long)info->vcpu.start);
-	} else {
+	} else if (kvm_get_mode() != KVM_MODE_PROTECTED) {
 		kvm_vgic_global_state.vcpu_base = info->vcpu.start;
 		kvm_vgic_global_state.can_emulate_gicv2 = true;
 		ret = kvm_register_vgic_device(KVM_DEV_TYPE_ARM_VGIC_V2);