Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3164831yba; Mon, 22 Apr 2019 21:47:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqzMUjCOmG3m6xi9pkJNJhiiw4X7j+W2nJdfAhzmIsruAVc/HxMYvOqkyl8vcsPUChyDSF7k X-Received: by 2002:a65:4482:: with SMTP id l2mr733238pgq.362.1555994822291; Mon, 22 Apr 2019 21:47:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555994822; cv=none; d=google.com; s=arc-20160816; b=z4tMvL35XmnYRiKyXA0NrouEfSz+aMwDXMItlllVMWowEIxR1UzKPlHNrX2T/ZVWiw XoBMdKCkYA2Sm96FbC023iGmsjh99h91Zk6yk2KF57L2X4GUwjbR5HY7W+tjtC2YUjre JmCEGZ9ANYB4OQur+0ZB5dHStSqdthFrMzE3qOFbJMW3zk5AopRYZLoyEWbZSEwUpa3I /o3/aFx/ag7aiWiOSCQKYoh2AeNGpOIaN1Y3i/qO5AcMHokroH61NL6Ble2VyqBHt4ZV esPoHS15Oi+FXZUAlpn0irkFGSxmUZ93XRhNJoOJTAbBlV/zF8Owv7wME4baClxFBuuN V0ww== 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=ZJsNoiLrgedascOvvgSHo1OQCeUnnMKbeiKALAoTn9g=; b=BeT3inFi4lFevxM3lQo440ebPDlOQS3cM3AK2dKdkvuwrS4LxKZqFkTZsgtsHXAO/2 HK6CWB9BDWnrIaAQSamZFGRYEFYu/oNh6UnIP7EXL46sTjp6yaSU4dVK+gZnWgnstACx HjgD9vFAK1hfGXrxoWQDFeWig+xvf8ehRaNRS9dERgp8NOALyCRCn+0DEFOzbTgGMGNA U5NxlQftYPvx2AaW5nIevxn1uV21IA5NcQ1JP6eTpn/D4/QqnriVzort+D21mvKAxdTn TrTyYB/BNML2hadzX/Pn1dMzW9IDv0322rrG25b69Ej+7RwDS0FuYxCzEKNXpLMI4py+ SusQ== 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 16si14863849pfh.244.2019.04.22.21.46.47; Mon, 22 Apr 2019 21:47:02 -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 S1728269AbfDWEnN (ORCPT + 99 others); Tue, 23 Apr 2019 00:43:13 -0400 Received: from foss.arm.com ([217.140.101.70]:48928 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726135AbfDWEnM (ORCPT ); Tue, 23 Apr 2019 00:43:12 -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 040F8A78; Mon, 22 Apr 2019 21:43:12 -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 BF22A3F557; Mon, 22 Apr 2019 21:43:07 -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 v10 4/5] KVM: arm64: Add capability to advertise ptrauth for guest Date: Tue, 23 Apr 2019 10:12:37 +0530 Message-Id: <1555994558-26349-5-git-send-email-amit.kachhap@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1555994558-26349-1-git-send-email-amit.kachhap@arm.com> References: <1555994558-26349-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 v9: * Fixed tab alignment issues [Dave Martin]. * Clarify the api documentation [Dave Martin]. Documentation/virtual/kvm/api.txt | 14 ++++++++++---- arch/arm64/kvm/reset.c | 5 +++++ include/uapi/linux/kvm.h | 2 ++ 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/Documentation/virtual/kvm/api.txt b/Documentation/virtual/kvm/api.txt index 32afe7f..fac1887 100644 --- a/Documentation/virtual/kvm/api.txt +++ b/Documentation/virtual/kvm/api.txt @@ -2763,13 +2763,19 @@ Possible features: - KVM_ARM_VCPU_PTRAUTH_ADDRESS: Enables Address Pointer authentication for arm64 only. - Both KVM_ARM_VCPU_PTRAUTH_ADDRESS and KVM_ARM_VCPU_PTRAUTH_GENERIC - must be requested or neither must be requested. + Depends on KVM_CAP_ARM_PTRAUTH_ADDRESS. + If KVM_CAP_ARM_PTRAUTH_ADDRESS and KVM_CAP_ARM_PTRAUTH_GENERIC are + both present, then both KVM_ARM_VCPU_PTRAUTH_ADDRESS and + KVM_ARM_VCPU_PTRAUTH_GENERIC must be requested or neither must be + requested. - KVM_ARM_VCPU_PTRAUTH_GENERIC: Enables Generic Pointer authentication for arm64 only. - Both KVM_ARM_VCPU_PTRAUTH_ADDRESS and KVM_ARM_VCPU_PTRAUTH_GENERIC - must be requested or neither must be requested. + Depends on KVM_CAP_ARM_PTRAUTH_GENERIC. + If KVM_CAP_ARM_PTRAUTH_ADDRESS and KVM_CAP_ARM_PTRAUTH_GENERIC are + both present, then both KVM_ARM_VCPU_PTRAUTH_ADDRESS and + KVM_ARM_VCPU_PTRAUTH_GENERIC must be requested or neither must be + requested. - 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 028d0c6..f0faf54 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