From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 20B2E10A09; Wed, 10 Jul 2024 15:34:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720625671; cv=none; b=MVVmCQaLtetginicKw8LW42BQsErQh1ZFDkKeF4pjIL6ilENDSwLEX29OPQKPmJZ756ycBKegmT5OSGylVRgPepOfgVX2yV02x89kFEcTsuq3qJCPW6ZScbOlkF+XwT02it6Rkw1uya1jEiIHin9ZPWqEHMnEB7mbwgLAayUDKE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720625671; c=relaxed/simple; bh=6PzCCON/Fm4+qkUpnMmXydMD9VtxdUaNuVJVRhkCw14=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=EgLXm7cP4Q8iKUvX/91diSOroFNUJ5oA9Rv388pTofHrFjs7SgzsvWBr6v69rH+slj2hlOkcrgNH0+qSCayu9sStpfu9lrEOcgksbGTYdJGfXYwNRCyOJo6j5yAPj8eB46+dKqv2ynFT2PDrs4lX+S44bzRmcFjtng9dh0Yo3AA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com 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 Precedence: bulk X-Mailing-List: linux-coco@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: 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 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