Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3735990yba; Tue, 23 Apr 2019 08:46:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqy1Pr/WhcwV/LBQYv5xnFjOavtJlvjqqBSy67qJXf+j4Lff+31MV9C/FVj/BwmkZPxpYcjE X-Received: by 2002:a62:2541:: with SMTP id l62mr5324662pfl.243.1556034417163; Tue, 23 Apr 2019 08:46:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556034417; cv=none; d=google.com; s=arc-20160816; b=bYXvxzDAU+yjyZk4cl08fWXDmaL5J/kWWpDFKOgc+K473/grdmZF3aY4xBebn1lG4c 5EoF72slRlwOf09humulU5krTpUQRvghqC72KxNyvKnt0rnn9YST3S4J7WAUKhMkMqYJ BwyEZxOkYowxIOkMHsjSZUr7fMNQ7y85dxOi/cDe7H7Bprkwpx17LyHnHgnVdTTw/wiJ 8uKVbwGUFQRdChWvNjfOqgiS4frbktFgEo0CPMUS9gAdAty76L+8DKQtfA/haJxv/crt CVMo/JgQDtAmqWlanypA+b88PnKdw4wmpBL9euESoYqG1Iv0zk/AT3LIqckhuvYs7Rp6 wk6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=8HrRH6pGMDYLhp18O9vvX39YyicGxyx4jiCqc7RKWC0=; b=nDkSlBMgSF+3N4JyLL02hA2QZg/tlNIgLwbcpM1xMuRqe3N7X6D6pgEQo/DytgCsta DWjwS6Of3o4BDrsM4yHv2H/3KkUB3HhPjy4wht7UDhXT2SfolBif3s8s1Em4Obn5jpJO I8r+/LcpiJLgC58xRelxP50JxefA4BDjUAWyWzAcMZk6PDRs7BSixVtYpjGTRU1eqwHK SW7s7umGD8Nj2IHnMX0qzBRe65pIxvgMxokujTKum1b15iSafKzV9b2VoOEbTXKYEi9U 8Jljr7by8om2Qa6xg4U06Uhr0TppxFRGE6qfRTIVY54i0PhHEMASFKkK1y6uV2l+cVMP 1ggQ== 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 126si1071419pgb.424.2019.04.23.08.46.41; Tue, 23 Apr 2019 08:46:57 -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 S1728440AbfDWPoY (ORCPT + 99 others); Tue, 23 Apr 2019 11:44:24 -0400 Received: from foss.arm.com ([217.140.101.70]:58458 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727761AbfDWPoY (ORCPT ); Tue, 23 Apr 2019 11:44:24 -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 A913080D; Tue, 23 Apr 2019 08:44:23 -0700 (PDT) Received: from e103592.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id EC0C83F5AF; Tue, 23 Apr 2019 08:44:21 -0700 (PDT) Date: Tue, 23 Apr 2019 16:44:19 +0100 From: Dave Martin To: Amit Daniel Kachhap Cc: linux-arm-kernel@lists.infradead.org, Marc Zyngier , Catalin Marinas , Will Deacon , Kristina Martsenko , kvmarm@lists.cs.columbia.edu, Ramana Radhakrishnan , linux-kernel@vger.kernel.org Subject: Re: [PATCH v10 1/5] KVM: arm64: Add a vcpu flag to control ptrauth for guest Message-ID: <20190423154419.GL3567@e103592.cambridge.arm.com> References: <1555994558-26349-1-git-send-email-amit.kachhap@arm.com> <1555994558-26349-2-git-send-email-amit.kachhap@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1555994558-26349-2-git-send-email-amit.kachhap@arm.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 23, 2019 at 10:12:34AM +0530, Amit Daniel Kachhap wrote: > A per vcpu flag is added to check if pointer authentication is > enabled for the vcpu or not. This flag may be enabled according to > the necessary user policies and host capabilities. > > This patch also adds a helper to check the flag. > > Reviewed-by: Dave Martin > Signed-off-by: Amit Daniel Kachhap > Cc: Mark Rutland > Cc: Marc Zyngier > Cc: Christoffer Dall > Cc: kvmarm@lists.cs.columbia.edu > --- > Changes since v9: > > * Added ptrauth cpufeature static check in vcpu_has_ptrauth [Marc Zyngier]. > > arch/arm64/include/asm/kvm_host.h | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h > index 7a096fd..7ccac42 100644 > --- a/arch/arm64/include/asm/kvm_host.h > +++ b/arch/arm64/include/asm/kvm_host.h > @@ -355,10 +355,15 @@ struct kvm_vcpu_arch { > #define KVM_ARM64_HOST_SVE_ENABLED (1 << 4) /* SVE enabled for EL0 */ > #define KVM_ARM64_GUEST_HAS_SVE (1 << 5) /* SVE exposed to guest */ > #define KVM_ARM64_VCPU_SVE_FINALIZED (1 << 6) /* SVE config completed */ > +#define KVM_ARM64_GUEST_HAS_PTRAUTH (1 << 7) /* PTRAUTH exposed to guest */ > > #define vcpu_has_sve(vcpu) (system_supports_sve() && \ > ((vcpu)->arch.flags & KVM_ARM64_GUEST_HAS_SVE)) > > +#define vcpu_has_ptrauth(vcpu) ((system_supports_address_auth() || \ > + system_supports_generic_auth()) && \ Come to think of it, should this be system_supports_address_auth() _&&_ system_supports_generic_auth()? It won't make a functional difference today though, since today kvm_vcpu_enable_ptrauth() won't set KVM_ARM64_GUEST_HAS_PTRAUTH without system_supports_address_auth() and system_supports_generic_auth() both true. With || here, we won't have to change this if supporting the two auth types independently in the future though. Either way, my Reviewed-by stands. Cheers ---Dave