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 36045CFC279 for ; Tue, 15 Oct 2024 09:27:58 +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=352SRJjo3ZKeSZ5hLBGziJiTo86fZAgrous4Trp4lZU=; b=oYOUJplVcJ8Te/b9S1OVNkwgbl Fc7x+82BIAu3pe5584cWWc8Vxuelnj4xAGxdZPL3Iq6VyzU6EBUSz25Dke/X40RsEZ1l6MiDkiA03 GOGyULcNRDNP+BR60vV+mPNYdmp+bLzRWxhTP38k1UJsfdjFr3f+NpekqYjAV0I9yaRiBPebhmDV/ daoCIPTKzHD65eRSQakwiCGnsvQBRizL/fY+HBzeHdwYPBj6w1wmybRy3AtgARTZSAPldXcTGOJG3 aWX8ypKHalh5959pWxFEpiMSNDS2HbuYBTB809PMiPjg29NEAlZ/lIORWjTsTz0C01wLlm4suaD5o ExJ9TioQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t0dqF-00000007hJt-19AL; Tue, 15 Oct 2024 09:27:47 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t0dXb-00000007dYB-1BVU for linux-arm-kernel@lists.infradead.org; Tue, 15 Oct 2024 09:08:32 +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 CBFCF1007; Tue, 15 Oct 2024 02:08:59 -0700 (PDT) Received: from [10.1.30.47] (e122027.cambridge.arm.com [10.1.30.47]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 076173F51B; Tue, 15 Oct 2024 02:08:25 -0700 (PDT) Message-ID: Date: Tue, 15 Oct 2024 10:08:24 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v6 03/11] arm64: realm: Query IPA size from the RMM To: Gavin Shan , kvm@vger.kernel.org, kvmarm@lists.linux.dev Cc: Catalin Marinas , Marc Zyngier , Will Deacon , 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 , Shanker Donthineni , Alper Gun , "Aneesh Kumar K . V" References: <20241004144307.66199-1-steven.price@arm.com> <20241004144307.66199-4-steven.price@arm.com> <2352629a-3742-45e9-a38f-196989918c9b@redhat.com> From: Steven Price Content-Language: en-GB In-Reply-To: <2352629a-3742-45e9-a38f-196989918c9b@redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241015_020831_386754_B33427A1 X-CRM114-Status: GOOD ( 16.76 ) 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 15/10/2024 04:55, Gavin Shan wrote: > On 10/5/24 12:42 AM, 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. >> >> Reviewed-by: Catalin Marinas >> Reviewed-by: Gavin Shan >> Co-developed-by: Suzuki K Poulose >> Signed-off-by: Suzuki K Poulose >> Signed-off-by: Steven Price >> --- >> Changes since v4: >>   * Make PROT_NS_SHARED check is_realm_world() to reduce impact on >>     non-CCA systems. >> 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 | 4 ++++ >>   arch/arm64/include/asm/rsi.h          | 2 +- >>   arch/arm64/kernel/rsi.c               | 8 ++++++++ >>   3 files changed, 13 insertions(+), 1 deletion(-) >> > > [...] > >> diff --git a/arch/arm64/kernel/rsi.c b/arch/arm64/kernel/rsi.c >> index 9bf757b4b00c..a6495a64d9bb 100644 >> --- a/arch/arm64/kernel/rsi.c >> +++ b/arch/arm64/kernel/rsi.c >> @@ -8,6 +8,11 @@ >>   #include >>   #include >>   +struct realm_config config; >> + > > Nit: I think this variable is file-scoped since it has a generic name. > In this case, 'static' is needed to match with the scope. Good spot - it should definitely be static. Thanks, Steve >> +unsigned long prot_ns_shared; >> +EXPORT_SYMBOL(prot_ns_shared); >> + >>   DEFINE_STATIC_KEY_FALSE_RO(rsi_present); >>   EXPORT_SYMBOL(rsi_present); >>   @@ -67,6 +72,9 @@ void __init arm64_rsi_init(void) >>           return; >>       if (!rsi_version_matches()) >>           return; >> +    if (WARN_ON(rsi_get_realm_config(&config))) >> +        return; >> +    prot_ns_shared = BIT(config.ipa_bits - 1); >>         arm64_rsi_setup_memory(); >>   > > Thanks, > Gavin >