Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp4051892pxb; Tue, 10 Nov 2020 06:52:35 -0800 (PST) X-Google-Smtp-Source: ABdhPJzUqDMcZl6nn0D95WkrvnV+HCXjOjqGnjp1jykcKOJeX5pAdXo8h2AsdS+6KqojFw8Tjd9j X-Received: by 2002:aa7:d787:: with SMTP id s7mr20554864edq.205.1605019955615; Tue, 10 Nov 2020 06:52:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605019955; cv=none; d=google.com; s=arc-20160816; b=pwac01ILTkBy92n2Hq9pwJi+iaNlYGsaa9QBq6De0x18YqaT7x2ZriVK9g8mTyf1HH XcIwskXlm/qy3QPZazpsyw/s6kg92OlsNh+GZ0lKuSjblFlWH75iLfT5NW1jEaRaCH9f dMyafCMuaj+dBV4Bn5j2JWiU+TM61MZ/kjxcgA+aVi2SoGbC7fHLBp7wx8iqn8Z5V2CP 35MJ3PtNY5Q2M5mE+us6v8S3O8OrxU9a6fahyN1hZjyqUCqmsNGmsoh40waLaAmKUij2 YweD3qL3pC45YLDElVeilsuvNr8JknWNISJWQaMOD/orgz4by/SZ9wtv2qHmsqcHocYo ITZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:user-agent:references:in-reply-to :subject:cc:to:from:date:content-transfer-encoding:mime-version :dkim-signature; bh=0nR3dglNmMaccppRGPAteEXe8umxg/RwQ9ZyE2nOUdc=; b=rHaJwfC4s73VKn2GfLXvAdJMMCiWVzdvD/VlYBfnF3GYGTXoLLD304ih4s5J34yrCC oP93m9+BK2OX6s4/MS3VlRCV675LxdJHezJLRntDTKvR+Pbqg03iBxty5QCGT9oj5l+v hokcX6JUAezXgBiFJTE0ovuPm2tb+uNLhaUmzTczFLZfiwGOPEYeCUEtEdSi0OPa/w8G bcVyG1aArxGMfnKzyFWkPg5lcea3HuXih0IGhiP/Ud3qnBR5WgDrcYwKg3e3s+kM+FS0 Jmy6qievQCau+Dj2vigEkiizyZ/oVA2oEM0IjJ8JUMY2zHZRxQTkAJG3A7YMO+K8TsSJ XKJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=i3wkBgX9; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id pv12si8321859ejb.613.2020.11.10.06.52.03; Tue, 10 Nov 2020 06:52:35 -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; dkim=pass header.i=@kernel.org header.s=default header.b=i3wkBgX9; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732430AbgKJOtl (ORCPT + 99 others); Tue, 10 Nov 2020 09:49:41 -0500 Received: from mail.kernel.org ([198.145.29.99]:46388 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730345AbgKJOtj (ORCPT ); Tue, 10 Nov 2020 09:49:39 -0500 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8D11E20797; Tue, 10 Nov 2020 14:49:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1605019777; bh=tAjZEoiovmaTc2l6i9NJyRkLG1+GRlxocckY4h/5Yxg=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=i3wkBgX9iavxZDnXWDNhXzMixHokeOy4gBqgZDdpKaCxGcI2nLdzs7BjRwjsniCVy gCu50ZbuVFLlxrxB6QHr6tcSZsyjkiYs76wXIhyfH6ddB4BEbZrrOKgGh+8khiNoDl Az+pEBY+tLQCa6zvQwHZSZ8OkUzJDpK/Qi6MHQfg= Received: from disco-boy.misterjones.org ([51.254.78.96] helo=www.loen.fr) by disco-boy.misterjones.org with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94) (envelope-from ) id 1kcUxj-009TgL-CD; Tue, 10 Nov 2020 14:49:35 +0000 MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Tue, 10 Nov 2020 14:49:35 +0000 From: Marc Zyngier To: David Brazdil Cc: kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, James Morse , Julien Thierry , Suzuki K Poulose , Catalin Marinas , Will Deacon , Dennis Zhou , Tejun Heo , Christoph Lameter , Mark Rutland , Lorenzo Pieralisi , Quentin Perret , Andrew Scull , Andrew Walbran , kernel-team@android.com Subject: Re: [PATCH v1 03/24] arm64: Move MAIR_EL1_SET to asm/memory.h In-Reply-To: <20201109113233.9012-4-dbrazdil@google.com> References: <20201109113233.9012-1-dbrazdil@google.com> <20201109113233.9012-4-dbrazdil@google.com> User-Agent: Roundcube Webmail/1.4.9 Message-ID: X-Sender: maz@kernel.org X-SA-Exim-Connect-IP: 51.254.78.96 X-SA-Exim-Rcpt-To: dbrazdil@google.com, kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, james.morse@arm.com, julien.thierry.kdev@gmail.com, suzuki.poulose@arm.com, catalin.marinas@arm.com, will@kernel.org, dennis@kernel.org, tj@kernel.org, cl@linux.com, mark.rutland@arm.com, lorenzo.pieralisi@arm.com, qperret@google.com, ascull@google.com, qwandor@google.com, kernel-team@android.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020-11-09 11:32, 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. > > Signed-off-by: David Brazdil > --- > arch/arm64/include/asm/memory.h | 13 +++++++++++++ > arch/arm64/mm/proc.S | 13 ------------- > 2 files changed, 13 insertions(+), 13 deletions(-) > > diff --git a/arch/arm64/include/asm/memory.h > b/arch/arm64/include/asm/memory.h > index cd61239bae8c..aca00737e771 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_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 \ If we are going to use this at EL2 directly, consider renaming it to MAIR_ELx_SET, as we do for other constants that are shared across exception levels. > + (MAIR_ATTRIDX(MAIR_ATTR_DEVICE_nGnRnE, MT_DEVICE_nGnRnE) | \ This creates an implicit dependency between sysreg.h and memory.h. Consider including asm/sysreg.h, assuming this doesn't create any circular dependency, or even move it to sysreg.h altogether. > + 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_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..25ff21b3a1c6 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 Thanks, M. -- Jazz is not dead. It just smells funny...