Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp710226pxu; Thu, 26 Nov 2020 09:39:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJxSiloOWlO8Th6UAbpeppUNme+EsEVFeIBBHEBe2at6Kwo8vENb36OOkguysb9L8DQ1Rer3 X-Received: by 2002:a17:906:1c87:: with SMTP id g7mr3692874ejh.37.1606412371556; Thu, 26 Nov 2020 09:39:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606412371; cv=none; d=google.com; s=arc-20160816; b=bpMhNnb4T/4JcAxxYvU6tJKUR/alrAQz5xwuV4nhqoQ6+ECS5rl2ilTCkzLoCyeVlp bSbLe5mIr19QDc5SqUZdJdSAdczD9l9lWGf9dVxtLncrhw+UQe5+EhIa+lE4kBoJqRJN eoSG7RqhPfF5LbuWq8vEc31WFgITUxngha7xMIV4UiAe+myhDCgYIU2lyizYVq8GgLqm jCcLo0hIgKpDwrqBiztBUWPDwM8zHWXAG9EmmPDrAJLs+5atHSHHWDy/u1RjhVerqiXp 0ucgi4s5SVi3DCUJMWDixntHoGKw83PsEgPjs3rJvaKK554v6P1Q7Vvk0SgSM0/PPlht ntHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=t4ks1YzCzEZBfP4YZYkLE7FQ0OsrBp+clObswHIL0y4=; b=HDNdqVuUG88cr6q0FOniRhe+Wk/AtqvC3Au1+9UHF66XjuPZE+qdBOXPuynynUyJ32 nZZvAVjsMPl48Lr7pY54O0PqAPxLStdWNj5ZKhDWPDC7gQHw+jdke4h4FPa5w3NgxTXb Iy8j8rT+btV3sVtQ+Vh+1K7NRRgy+/x7PjM17yZtvFFzNpNHAC6RGJLCtgyMSH9AQwhC rfTG/8+fqU6TDO6YAhLam9j9juvigoFVMMlaXnMzcbgLrarilqFNk/XRGx40oDh5elJ2 qLbR3jcw2kpLXFzTcpFNG/0VfbzWIkp5BtOEjf2MkPh4nbgwIDuFUR+WujXlEeJcyl/I WhSg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q12si3376206ejt.421.2020.11.26.09.39.08; Thu, 26 Nov 2020 09:39:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404073AbgKZRfm (ORCPT + 99 others); Thu, 26 Nov 2020 12:35:42 -0500 Received: from foss.arm.com ([217.140.110.172]:41610 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2403842AbgKZRfm (ORCPT ); Thu, 26 Nov 2020 12:35:42 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 6B2F331B; Thu, 26 Nov 2020 09:35:41 -0800 (PST) Received: from C02TD0UTHF1T.local (unknown [10.57.30.234]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B5C053F23F; Thu, 26 Nov 2020 09:35:37 -0800 (PST) Date: Thu, 26 Nov 2020 17:35:34 +0000 From: Mark Rutland To: David Brazdil Cc: kvmarm@lists.cs.columbia.edu, Jonathan Corbet , Catalin Marinas , Will Deacon , Marc Zyngier , James Morse , Julien Thierry , Suzuki K Poulose , Dennis Zhou , Tejun Heo , Christoph Lameter , Lorenzo Pieralisi , Sudeep Holla , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kernel-team@android.com Subject: Re: [PATCH v3 04/23] arm64: Move MAIR_EL1_SET to asm/memory.h Message-ID: <20201126173534.GE38486@C02TD0UTHF1T.local> References: <20201126155421.14901-1-dbrazdil@google.com> <20201126155421.14901-5-dbrazdil@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201126155421.14901-5-dbrazdil@google.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 26, 2020 at 03:54:02PM +0000, David Brazdil wrote: > KVM currently initializes MAIR_EL2 to the value of MAIR_EL1. In > preparation for initializing MAIR_EL2 before MAIR_EL1, move the constant > into a shared header file. Since it is used for EL1 and EL2, rename to > MAIR_ELx_SET. > > Signed-off-by: David Brazdil > --- > arch/arm64/include/asm/memory.h | 13 +++++++++++++ > arch/arm64/mm/proc.S | 15 +-------------- > 2 files changed, 14 insertions(+), 14 deletions(-) > > diff --git a/arch/arm64/include/asm/memory.h b/arch/arm64/include/asm/memory.h > index cd61239bae8c..54a22cb5b17b 100644 > --- a/arch/arm64/include/asm/memory.h > +++ b/arch/arm64/include/asm/memory.h > @@ -152,6 +152,19 @@ > #define MT_S2_FWB_NORMAL 6 > #define MT_S2_FWB_DEVICE_nGnRE 1 > > +/* > + * Default MAIR_ELx. MT_NORMAL_TAGGED is initially mapped as Normal memory and > + * changed during __cpu_setup to Normal Tagged if the system supports MTE. > + */ > +#define MAIR_ELx_SET \ > + (MAIR_ATTRIDX(MAIR_ATTR_DEVICE_nGnRnE, MT_DEVICE_nGnRnE) | \ > + MAIR_ATTRIDX(MAIR_ATTR_DEVICE_nGnRE, MT_DEVICE_nGnRE) | \ > + MAIR_ATTRIDX(MAIR_ATTR_DEVICE_GRE, MT_DEVICE_GRE) | \ > + MAIR_ATTRIDX(MAIR_ATTR_NORMAL_NC, MT_NORMAL_NC) | \ > + MAIR_ATTRIDX(MAIR_ATTR_NORMAL, MT_NORMAL) | \ > + MAIR_ATTRIDX(MAIR_ATTR_NORMAL_WT, MT_NORMAL_WT) | \ > + MAIR_ATTRIDX(MAIR_ATTR_NORMAL, MT_NORMAL_TAGGED)) Patch 7 initializes MAIR_EL2 with this directly rather than copying it from MAIR_EL1, which means that MT_NORMAL_TAGGED will never be tagged within the nVHE hyp code. Is that expected? I suspect it's worth a comment here (introduced in patch 7), just to make that clear. Otherwise this looks fine to me. Thanks, Mark. > + > #ifdef CONFIG_ARM64_4K_PAGES > #define IOREMAP_MAX_ORDER (PUD_SHIFT) > #else > diff --git a/arch/arm64/mm/proc.S b/arch/arm64/mm/proc.S > index 23c326a06b2d..e3b9aa372b96 100644 > --- a/arch/arm64/mm/proc.S > +++ b/arch/arm64/mm/proc.S > @@ -45,19 +45,6 @@ > #define TCR_KASAN_FLAGS 0 > #endif > > -/* > - * Default MAIR_EL1. MT_NORMAL_TAGGED is initially mapped as Normal memory and > - * changed during __cpu_setup to Normal Tagged if the system supports MTE. > - */ > -#define MAIR_EL1_SET \ > - (MAIR_ATTRIDX(MAIR_ATTR_DEVICE_nGnRnE, MT_DEVICE_nGnRnE) | \ > - MAIR_ATTRIDX(MAIR_ATTR_DEVICE_nGnRE, MT_DEVICE_nGnRE) | \ > - MAIR_ATTRIDX(MAIR_ATTR_DEVICE_GRE, MT_DEVICE_GRE) | \ > - MAIR_ATTRIDX(MAIR_ATTR_NORMAL_NC, MT_NORMAL_NC) | \ > - MAIR_ATTRIDX(MAIR_ATTR_NORMAL, MT_NORMAL) | \ > - MAIR_ATTRIDX(MAIR_ATTR_NORMAL_WT, MT_NORMAL_WT) | \ > - MAIR_ATTRIDX(MAIR_ATTR_NORMAL, MT_NORMAL_TAGGED)) > - > #ifdef CONFIG_CPU_PM > /** > * cpu_do_suspend - save CPU registers context > @@ -425,7 +412,7 @@ SYM_FUNC_START(__cpu_setup) > /* > * Memory region attributes > */ > - mov_q x5, MAIR_EL1_SET > + mov_q x5, MAIR_ELx_SET > #ifdef CONFIG_ARM64_MTE > /* > * Update MAIR_EL1, GCR_EL1 and TFSR*_EL1 if MTE is supported > -- > 2.29.2.454.gaff20da3a2-goog >