Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp6455yba; Thu, 11 Apr 2019 20:22:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqxF5BfVMMBjBzhYkl3E5prK6I/2ohxQQtTm+wT9RGDXbLWdGB6oWwtp0rrnp/SFGounwoZf X-Received: by 2002:a63:d1f:: with SMTP id c31mr50089447pgl.353.1555039339529; Thu, 11 Apr 2019 20:22:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555039339; cv=none; d=google.com; s=arc-20160816; b=rpOW7nmyQ/lBdq5cOAu1KPDq7bNy6ZEdxb35uWYCz6TPMhgHUd0IuwSamCRHNcexMr dtRSaEI1eS5QOcMxkKbS1x5EFAfxpw8vd1Mhic695BSO9AkuqYCwXzj5JU9PLlPlZ14p rGWOuhUaQSANQ8vBPwFQjIgNrASt6W1Znk46iqXm1mr/7WcnxG0L6blAcj8YIRXQQ6T7 I+Z4eU09JMqv02bFn80BLTpmmjCDo32V6VMt2mEemirAQDWUlFmlsiCNL63zH4Vgawuw m9tCKPN8eklFXbB+mCpTJWahYPwxNc8A0sBbjtifNTyVuUT44tSMD5dzhs9oJJ0VLdy1 pzTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=hskdPtJ/jWnGindm/iFZc1cUTHZSFhhrpomX40PywAA=; b=A/pD4XwbO4XN9nWzpy3GnEQwU5HuF219zdlNd9XNRfj5tV1OwE0QTT1/9UFDuIrAtZ whHuFdmQbzPf5faHn/yr4p815aiGKouGCzGsJc5mqr29CjeM8+eE8vc3sJc5r22JMsPT MFJaihNHrpPTjwJm1xNEuoilNpQlnLDsPqjy38yS22N9fjkjMDwkKpVpSxDfFgOx5bPz XDQiQumURshcYu3ebpYRZk+oZAErdxufa2EKq0bbya+xpq4tDkj6m2AYg9YAQUT1TBah t71myDmM38xuNj56utaB+Xs2d/lE5+4t52AeZN8MLWYPWX3lzy4r9omGxPNNTON0tSRx 00zQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n3si38350698plb.58.2019.04.11.20.22.03; Thu, 11 Apr 2019 20:22:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726884AbfDLDVM (ORCPT + 99 others); Thu, 11 Apr 2019 23:21:12 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:52612 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726640AbfDLDVL (ORCPT ); Thu, 11 Apr 2019 23:21:11 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id D043215AD; Thu, 11 Apr 2019 20:21:10 -0700 (PDT) Received: from a075553-lin.blr.arm.com (a075553-lin.blr.arm.com [10.162.0.144]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 91E183F59C; Thu, 11 Apr 2019 20:21:06 -0700 (PDT) From: Amit Daniel Kachhap To: linux-arm-kernel@lists.infradead.org Cc: Christoffer Dall , Marc Zyngier , Catalin Marinas , Will Deacon , Andrew Jones , Dave Martin , Ramana Radhakrishnan , kvmarm@lists.cs.columbia.edu, Kristina Martsenko , linux-kernel@vger.kernel.org, Amit Daniel Kachhap , Mark Rutland , James Morse , Julien Thierry Subject: [PATCH v9 4/5] KVM: arm64: Add capability to advertise ptrauth for guest Date: Fri, 12 Apr 2019 08:50:35 +0530 Message-Id: <1555039236-10608-5-git-send-email-amit.kachhap@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1555039236-10608-1-git-send-email-amit.kachhap@arm.com> References: <1555039236-10608-1-git-send-email-amit.kachhap@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch advertises the capability of two cpu feature called address pointer authentication and generic pointer authentication. These capabilities depend upon system support for pointer authentication and VHE mode. The current arm64 KVM partially implements pointer authentication and support of address/generic authentication are tied together. However, separate ABI requirements for both of them is added so that any future isolated implementation will not require any ABI changes. Signed-off-by: Amit Daniel Kachhap Cc: Mark Rutland Cc: Marc Zyngier Cc: Christoffer Dall Cc: kvmarm@lists.cs.columbia.edu --- Changes since v8: * Keep the capability check same for the 2 vcpu ptrauth features. [Dave Martin] Documentation/virtual/kvm/api.txt | 2 ++ arch/arm64/kvm/reset.c | 5 +++++ include/uapi/linux/kvm.h | 2 ++ 3 files changed, 9 insertions(+) diff --git a/Documentation/virtual/kvm/api.txt b/Documentation/virtual/kvm/api.txt index 9d202f4..56021d0 100644 --- a/Documentation/virtual/kvm/api.txt +++ b/Documentation/virtual/kvm/api.txt @@ -2756,9 +2756,11 @@ Possible features: - KVM_ARM_VCPU_PTRAUTH_ADDRESS: Enables Address Pointer authentication for the CPU and supported only on arm64 architecture. Must be requested if KVM_ARM_VCPU_PTRAUTH_GENERIC is also requested. + Depends on KVM_CAP_ARM_PTRAUTH_ADDRESS. - KVM_ARM_VCPU_PTRAUTH_GENERIC: Enables Generic Pointer authentication for the CPU and supported only on arm64 architecture. Must be requested if KVM_ARM_VCPU_PTRAUTH_ADDRESS is also requested. + Depends on KVM_CAP_ARM_PTRAUTH_GENERIC. - KVM_ARM_VCPU_SVE: Enables SVE for the CPU (arm64 only). Depends on KVM_CAP_ARM_SVE. diff --git a/arch/arm64/kvm/reset.c b/arch/arm64/kvm/reset.c index d13406b..be657f6 100644 --- a/arch/arm64/kvm/reset.c +++ b/arch/arm64/kvm/reset.c @@ -101,6 +101,11 @@ int kvm_arch_vm_ioctl_check_extension(struct kvm *kvm, long ext) case KVM_CAP_ARM_SVE: r = system_supports_sve(); break; + case KVM_CAP_ARM_PTRAUTH_ADDRESS: + case KVM_CAP_ARM_PTRAUTH_GENERIC: + r = has_vhe() && system_supports_address_auth() && + system_supports_generic_auth(); + break; default: r = 0; } diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h index 1d56444..4dc34f8 100644 --- a/include/uapi/linux/kvm.h +++ b/include/uapi/linux/kvm.h @@ -989,6 +989,8 @@ struct kvm_ppc_resize_hpt { #define KVM_CAP_MANUAL_DIRTY_LOG_PROTECT 166 #define KVM_CAP_HYPERV_CPUID 167 #define KVM_CAP_ARM_SVE 168 +#define KVM_CAP_ARM_PTRAUTH_ADDRESS 169 +#define KVM_CAP_ARM_PTRAUTH_GENERIC 170 #ifdef KVM_CAP_IRQ_ROUTING -- 2.7.4