Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp229356imb; Thu, 28 Feb 2019 22:11:40 -0800 (PST) X-Google-Smtp-Source: APXvYqwxbIrmsXdcUPBtXXUKaPoDNAxpClI+Twq1UStHzGoPTIyJIPAsdt76Uf11WdLR66V6U839 X-Received: by 2002:a17:902:9341:: with SMTP id g1mr3803719plp.80.1551420700367; Thu, 28 Feb 2019 22:11:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551420700; cv=none; d=google.com; s=arc-20160816; b=IkNYjv0ENKZ+vXHUZrsAlvJnCyOTcKrVsYI5aJ4SOWAncPj6DSK0DB6xeKah77PjYy OvR1H/LI/kN2U8Ks9N/16s379OIV0KgSRRVZqIiiOMfcOCus0rxkBv8Te/rLN9VEKyDj NFRgK6URLNnjDnr7JmZClijSSNBPf+yvPvRBD44IM/AWZhUkfi0uSD3UOmeJ8SDzaI9U SJfW9AJpdrp6YsHqMOVLqnoBoSQ4jQ3aKvyFzOs8Ul/jyTvD8Q7QgPCpxhbAymvXjgfk XGrI0sFctghNvdnmtucT4uXQRJzVsD245BaxkWSJFwgoboCxLT9pbj4X1gBiUIrhW+ef GoIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=wF5RaTy5PwlE9X0EG16adRE0Cr2Ah0SKWvcGkdPoK4s=; b=rNaOlFI+f7jIchpxEHyBOx4A+HkaxGXi4OWm8lwA/vnjv+GQpmd3eFi2MC2ZoRMpaK W11iEZ2l/N4/EqeCCEdelTbTBnUdeQtS8M3npb3wGOf+84xQ38COaIruLB7TG5D5fIKW +NGexWdcNsLrjbdSirGhOTk9WspTmcH1/c6HwQww4RIb8dyL2sNPLYlE4k/oa05Y55DB fKY+7DITQHKX2QYhxwbaZlE6it1EIsNet42w4PqApe/Ku5CRcLaNIR5nN2+9I3AXoDkO nw3m/YP94lbtm2bHjHhz/KeO9Sl5caZbaeSTE/uFV8eYCQhvFPmAZMiaFgxzA81xl1zt OS0w== 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 c5si4188437pgw.179.2019.02.28.22.11.24; Thu, 28 Feb 2019 22:11:40 -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 S1727019AbfCAGKb (ORCPT + 99 others); Fri, 1 Mar 2019 01:10:31 -0500 Received: from foss.arm.com ([217.140.101.70]:58164 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725931AbfCAGKb (ORCPT ); Fri, 1 Mar 2019 01:10:31 -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 B95F3EBD; Thu, 28 Feb 2019 22:10:30 -0800 (PST) Received: from [10.162.0.144] (a075553-lin.blr.arm.com [10.162.0.144]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 1AF8E3F5C1; Thu, 28 Feb 2019 22:10:27 -0800 (PST) Subject: Re: [PATCH v6 2/6] arm64/kvm: preserve host MDCR_EL2 value To: Dave Martin 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 References: <1550568271-5319-1-git-send-email-amit.kachhap@arm.com> <1550568271-5319-3-git-send-email-amit.kachhap@arm.com> <20190221155101.GV3567@e103592.cambridge.arm.com> From: Amit Daniel Kachhap Message-ID: <4f97aeda-492b-acd2-8a41-340e8bb47240@arm.com> Date: Fri, 1 Mar 2019 11:40:25 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: <20190221155101.GV3567@e103592.cambridge.arm.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 2/21/19 9:21 PM, Dave Martin wrote: > 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. Agreed I will more information in 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. Yes this a potential issue. I will fix it in a separate patch. Thanks, Amit D > > This is probably non-urgent, since this is clearly not causing problems > for anyone today. > > [...] > > Cheers > ---Dave >