From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B39C5C3DA41 for ; Wed, 10 Jul 2024 15:35:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:In-Reply-To:From:References:Cc:To:Subject:MIME-Version:Date: Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=mMXrlpEsu6Rz4vG3GrLzlugYnpssuLCEQ3jlVLM4y3g=; b=QLFQWgBBkw+BZ3tJ1HMMe2zq2F fWOZdgzr4W0jeXUF0u9jGCMk6DCByPrTOIoXk3RWcGHcy54fpVoUsftGbFJDaGrpFtprjLoTYGywr dorJCE7OWh5Ln+quUB1KT1tCI35YCLHCpg61vfWljPo4/3Z2+AsylDnX82BZLGWPsXYPAMDdLfRl8 O2S1CVR6ksOf1GaGHZOWzQPBN9ZCTIbznk9DIpYBl8x+YeHoaIWzf/LEXHJM3cGFhb0cUDn61O8b7 08PsCYcU0kwzux30oP8Ai8bbvq5AM5+UICzzESG9ySuCvl9lkCgVQf1Y+gnHVtaco6UyL1GJ8DrrI gro2QSxg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sRZLW-0000000AyPY-2C7L; Wed, 10 Jul 2024 15:35:06 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sRZKw-0000000AyA4-1WlF for linux-arm-kernel@lists.infradead.org; Wed, 10 Jul 2024 15:34:31 +0000 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 4CFFE106F; Wed, 10 Jul 2024 08:34:54 -0700 (PDT) Received: from [10.57.8.115] (unknown [10.57.8.115]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 490933F766; Wed, 10 Jul 2024 08:34:21 -0700 (PDT) Message-ID: Date: Wed, 10 Jul 2024 16:34:15 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v4 04/15] arm64: realm: Query IPA size from the RMM To: Will Deacon Cc: kvm@vger.kernel.org, kvmarm@lists.linux.dev, Catalin Marinas , Marc Zyngier , James Morse , Oliver Upton , Suzuki K Poulose , Zenghui Yu , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Joey Gouly , Alexandru Elisei , Christoffer Dall , Fuad Tabba , linux-coco@lists.linux.dev, Ganapatrao Kulkarni References: <20240701095505.165383-1-steven.price@arm.com> <20240701095505.165383-5-steven.price@arm.com> <20240709105325.GF12978@willie-the-truck> From: Steven Price Content-Language: en-GB In-Reply-To: <20240709105325.GF12978@willie-the-truck> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240710_083430_499048_7B12E08B X-CRM114-Status: GOOD ( 14.40 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 09/07/2024 11:53, Will Deacon wrote: > On Mon, Jul 01, 2024 at 10:54:54AM +0100, Steven Price wrote: >> The top bit of the configured IPA size is used as an attribute to >> control whether the address is protected or shared. Query the >> configuration from the RMM to assertain which bit this is. >> >> Co-developed-by: Suzuki K Poulose >> Signed-off-by: Suzuki K Poulose >> Signed-off-by: Steven Price >> --- >> Changes since v2: >> * Drop unneeded extra brackets from PROT_NS_SHARED. >> * Drop the explicit alignment from 'config' as struct realm_config now >> specifies the alignment. >> --- >> arch/arm64/include/asm/pgtable-prot.h | 3 +++ >> arch/arm64/kernel/rsi.c | 8 ++++++++ >> 2 files changed, 11 insertions(+) >> >> diff --git a/arch/arm64/include/asm/pgtable-prot.h b/arch/arm64/include/asm/pgtable-prot.h >> index b11cfb9fdd37..6c29f3b32eba 100644 >> --- a/arch/arm64/include/asm/pgtable-prot.h >> +++ b/arch/arm64/include/asm/pgtable-prot.h >> @@ -70,6 +70,9 @@ >> #include >> >> extern bool arm64_use_ng_mappings; >> +extern unsigned long prot_ns_shared; >> + >> +#define PROT_NS_SHARED (prot_ns_shared) > > Since the _vast_ majority of Linux systems won't be running in a realm, > can we use a static key to avoid loading a constant each time? Fair enough, the following should do the trick: #define PROT_NS_SHARED (is_realm_world() ? prot_ns_shared : 0) Thanks, Steve