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 87FD8302CD5; Thu, 9 Apr 2026 14:09:11 +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=1775743753; cv=none; b=APtCYi22vrao4OQaCPsbfl3Ced7UYmkMAwGtLrLXjaLcluLkUtTtSyVNLtXFENARh/g+ov3KzOjyGxDrtHCpytek/b2lXypJV+DgkV+xU6cgL/ESytoDB9l/JIj+JLGU6nhsa1G3eKiEfyfjBXnwujiNeu3Oe0MTzscb2T4S8Hs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775743753; c=relaxed/simple; bh=ipsSLoMfiPqYFIbUKTrfChsu5vns0/lAN8ULtLYM75Y=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ZO0LaCL/G48ywYE7wvoousdKTcGoXSA2gKuK9mFykfFOKPXSQAFQijAOxvPumix9qXCLc3buMoDKrfH2Iu6oJmWvXYWCFX3FMMK+gTUHdJYfaC7SoyJ2XglZBB0znHihA0Yr4Q3yN85kcBPWOmlQ49ZtQdFufonl0U1nxL66HDw= 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; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b=sv1jHw2M; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b="sv1jHw2M" 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 67300328E; Thu, 9 Apr 2026 07:09:04 -0700 (PDT) Received: from arm.com (usa-sjc-mx-foss1.foss.arm.com [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 73AF13F632; Thu, 9 Apr 2026 07:09:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1775743750; bh=ipsSLoMfiPqYFIbUKTrfChsu5vns0/lAN8ULtLYM75Y=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=sv1jHw2MnnzhZ95ZAtsy9ohqi0q0sg1raSFQx/D6Sc5yebvU6+mk44j5jcp2D4bp3 ATO69PDQQiFKd9MZtDbzDQqM4+w8ktvn2NUL4sT400bYAKEpXXSG0RFrMumBZxBfCs zCd5yijVGGncEZrFYCl3JX5qrICdlR/kARi3old4= Date: Thu, 9 Apr 2026 15:09:05 +0100 From: Catalin Marinas To: Suzuki K Poulose Cc: Ryan Roberts , Will Deacon , "David Hildenbrand (Arm)" , Dev Jain , Yang Shi , Jinjiang Tu , Kevin Brodsky , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH v2 1/3] arm64: mm: Fix rodata=full block mapping support for realm guests Message-ID: References: <20260330161705.3349825-1-ryan.roberts@arm.com> <20260330161705.3349825-2-ryan.roberts@arm.com> <1db93bd3-cb47-445b-b8ca-6de6f04b41cc@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Thu, Apr 09, 2026 at 10:38:03AM +0100, Suzuki K Poulose wrote: > On 07/04/2026 18:21, Catalin Marinas wrote: > > a166563e7ec3 ("arm64: mm: support large block mapping when rodata=full") > > introduced force_pte_mapping() but it just copied the logic in the > > existing can_set_direct_map(). Looking at the linear_map_requires_bbml2 > > assignment, we get (!is_realm_world() && is_realm_world()) and it > > cancels out, no effect on it but we don't get pte mappings either (even > > if we don't have BBML2). > > Yep, that's right. > > > > I think we need at least some safety checks: > > > > 1. BBML2_NOABORT support on the boot CPU - continue with the existing > > logic (as per Ryan's series) > > > > 2. !system_supports_bbml2_noabort() - split in > > linear_map_maybe_split_to_ptes(). This does not currently happen > > because linear_map_requires_bbml2 may be false in the absence of > > rodata=full. Not sure how to fix this without some variable telling > > us how the linear map was mapped. The requires_bbml2 flag doesn't > > > > 3. Panic in arm64_rsi_init() if !BBML2_NOABORT on the boot CPU _and_ we > > have block mappings already. People can avoid it with rodata=full > > It looks like this will be a common case :-( > > > > > 4. If (3) is a common case, a better alternative is to rewrite the > > linear map sometime after arm64_rsi_init() but before we call > > split_kernel_leaf_mapping(). > > We will explore this route. > > The other option is to move the RSI detection (and the PSCI probe) > earlier to be able to make better decisions early on. I will play with > that a bit too. I thought we could reuse linear_map_split_to_ptes() but this function assumes that the primary CPU supports BBML2_NOABORT. To do this live, we'd have to clone the active kernel pgtable hierarchy, switch to it and then continue with the splitting. kasan_init_shadow() does a bit of this but not fully as it only cares about the shadow mapping. Hmm, maybe probing the RSI early is easier ;). -- Catalin