Received: by 2002:ac0:a679:0:0:0:0:0 with SMTP id p54csp615797imp; Thu, 21 Feb 2019 07:52:28 -0800 (PST) X-Google-Smtp-Source: AHgI3IYLEl8973UCLSMdtJ8je9ejuvxL+Im70EPQWvdOxNZXUkx9/exKacGK7SQ9/mYOjk9NEnGb X-Received: by 2002:a17:902:a40d:: with SMTP id p13mr32955295plq.144.1550764348421; Thu, 21 Feb 2019 07:52:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550764348; cv=none; d=google.com; s=arc-20160816; b=OQsWVBTKdWpJKqYf69Vta2qfT+sRnElOyM/qGEl90ekRkuF2NxMAwV765nXvsQ324m I9E+Af1aKihVMYRajndl0M8MQyb+7r0KEetOVOIUlLVBBFWPl2VeyTDH20/1OtajbrR6 BEMsbPVmdR5g53et9uKVLi0h9dGcoawoWl+pG9xTjPDVwuydmVF3YAlP/HQIGaxIAihG dUzGVV7kwq/ojvl2CG69Vb7Hefe8GT1GnsY2hnP+iIPoqV7inn/aZ/p1JhCIRvTWLgty ZU7IKZXxfvzQTRrb//VEKp94wcQ5qYxJMCov1fhLBhknZFHlAZu3Y77S447ve/Kgixvg H8og== 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=0oxAFt2VAkXb61bZC5w0J9W+bcq0/DCgsot1QIzXQVs=; b=a59uZB07BbiAPtLRuw9Tm1h/MyWHDvTN+fX08YKN1ZFcDq0kRALEo+4Q1i5LaJ7oBk 1uZt/ZFi48BXSTbye5C9RaZGYI9gC48k7Fwkp3krUCsSWa7jTi0HiHCiJDJTepx/3K6O vDZ26B7gR204gWc7wBVYGdGKYqENqTnjhuUcagCwZGkW9iIrATLhO0XuALnY9oguYLp6 +jaMDTTqB8igjugvQNryhAzKHZ0oa2QuBX/YxyowZRjs/J0ms6RTKRZzlCoqi+C01y7H Q62it7sdFNCe8/dUztoCZXlQlcv6hyeIiV3CSNLR1AJoeqtBLnvbJA10s2aur0vXlNif wv6Q== 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 v6si7569485pgr.191.2019.02.21.07.52.12; Thu, 21 Feb 2019 07:52:28 -0800 (PST) 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 S1728648AbfBUPvH (ORCPT + 99 others); Thu, 21 Feb 2019 10:51:07 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:46738 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726390AbfBUPvG (ORCPT ); Thu, 21 Feb 2019 10:51:06 -0500 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 F2B99A78; Thu, 21 Feb 2019 07:51:05 -0800 (PST) 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 106E43F5C1; Thu, 21 Feb 2019 07:51:03 -0800 (PST) Date: Thu, 21 Feb 2019 15:51:01 +0000 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 v6 2/6] arm64/kvm: preserve host MDCR_EL2 value Message-ID: <20190221155101.GV3567@e103592.cambridge.arm.com> References: <1550568271-5319-1-git-send-email-amit.kachhap@arm.com> <1550568271-5319-3-git-send-email-amit.kachhap@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1550568271-5319-3-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, Feb 19, 2019 at 02:54:27PM +0530, Amit Daniel Kachhap wrote: > Save host MDCR_EL2 value during kvm HYP initialisation and restore > after every switch from host to guest. There should not be any > change in functionality due to this. > > The value of mdcr_el2 is now stored in struct kvm_cpu_context as > both host and guest can now use this field in a common way. Is MDCR_EL2 somehow relevant to pointer auth? It's not entirely clear why this patch is here. If this is a cleanup to align the handling of this register with how HCR_EL2 is handled, it would be good to explain that in the commit message. > Signed-off-by: Amit Daniel Kachhap > Cc: Marc Zyngier > Cc: Mark Rutland > Cc: Christoffer Dall > Cc: kvmarm@lists.cs.columbia.edu > --- > arch/arm/include/asm/kvm_host.h | 1 - > arch/arm64/include/asm/kvm_host.h | 6 ++---- > arch/arm64/kvm/debug.c | 28 ++++++---------------------- > arch/arm64/kvm/hyp/switch.c | 17 ++++------------- > arch/arm64/kvm/hyp/sysreg-sr.c | 6 ++++++ > virt/kvm/arm/arm.c | 1 - > 6 files changed, 18 insertions(+), 41 deletions(-) > > diff --git a/arch/arm/include/asm/kvm_host.h b/arch/arm/include/asm/kvm_host.h > index 05706b4..704667e 100644 > --- a/arch/arm/include/asm/kvm_host.h > +++ b/arch/arm/include/asm/kvm_host.h > @@ -294,7 +294,6 @@ static inline void kvm_arch_vcpu_uninit(struct kvm_vcpu *vcpu) {} > static inline void kvm_arch_sched_in(struct kvm_vcpu *vcpu, int cpu) {} > static inline void kvm_arch_vcpu_block_finish(struct kvm_vcpu *vcpu) {} > > -static inline void kvm_arm_init_debug(void) {} > static inline void kvm_arm_setup_debug(struct kvm_vcpu *vcpu) {} > static inline void kvm_arm_clear_debug(struct kvm_vcpu *vcpu) {} > static inline void kvm_arm_reset_debug_ptr(struct kvm_vcpu *vcpu) {} > diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h > index 1b2e05b..2f1bb86 100644 > --- a/arch/arm64/include/asm/kvm_host.h > +++ b/arch/arm64/include/asm/kvm_host.h > @@ -205,6 +205,8 @@ struct kvm_cpu_context { > > /* HYP host/guest configuration */ > u64 hcr_el2; > + u32 mdcr_el2; > + ARMv8-A says MDCR_EL2 is a 64-bit register. Bits [63:20] are currently RES0, so this is probably not a big deal. But it would be better to make this 64-bit to prevent future accidents. It may be better to make that change in a separate patch. This is probably non-urgent, since this is clearly not causing problems for anyone today. [...] Cheers ---Dave