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 07D6CC52D6F for ; Fri, 2 Aug 2024 15:45:10 +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:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=hKqtoVPEMhXA0dmpZvfJ/qR83VINuecSZwpPtUTzC1o=; b=29fESg3SsDfPNVZbDStYWupSUX /u1be/wY3PmKOaD61ThnaI+tI4OQB1zS+mRASzfX3B2uqFkZ48GKAkjavct0MpC7dhUAB032qfdfm CD8J4MlDJh1HIbXSLl6aTB4QNg1p/LZnvT7N7G21wQ5n4BPc/Qk1ccOLUR+XOJW4KKPxVENvSsS6g uOo++BRny/U6jafl2A2LY6gNR/p21dyZqypPJOQK0YLVy5+Yntz1WTO96L7W+fGcDB/xww3ZJRUXj P+aW6Kwnk45ynkvKrB+U/V7lBrvjK5Xk7mquWes+Vj24vHC74QLQ85MTSXaikMGOkUVIR+IP2odjW Z8kF0dVg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sZuSf-00000009KT4-2ZeH; Fri, 02 Aug 2024 15:44:57 +0000 Received: from sin.source.kernel.org ([2604:1380:40e1:4800::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sZuSA-00000009KIk-0mCA for linux-arm-kernel@lists.infradead.org; Fri, 02 Aug 2024 15:44:27 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 4E08BCE1B28; Fri, 2 Aug 2024 15:44:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6262FC32782; Fri, 2 Aug 2024 15:44:19 +0000 (UTC) Date: Fri, 2 Aug 2024 16:44:16 +0100 From: Catalin Marinas To: "Aneesh Kumar K.V" Cc: Will Deacon , linux-arm-kernel@lists.infradead.org, Sudeep Holla , Lorenzo Pieralisi , Suzuki Poulose , Steven Price , Oliver Upton , Marc Zyngier , linux-coco@lists.linux.dev Subject: Re: [PATCH 1/6] firmware/smccc: Call arch-specific hook on discovering KVM services Message-ID: References: <20240730151113.1497-1-will@kernel.org> <20240730151113.1497-2-will@kernel.org> <20240731155045.GA3296@willie-the-truck> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240802_084426_425970_18B75B74 X-CRM114-Status: GOOD ( 21.69 ) 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 Wed, Jul 31, 2024 at 09:26:31PM +0530, Aneesh Kumar K.V wrote: > Aneesh Kumar K.V writes: > > Will Deacon writes: > >> On Wed, Jul 31, 2024 at 08:11:16PM +0530, Aneesh Kumar K.V wrote: > >>> Will Deacon writes: > >>> > diff --git a/drivers/firmware/smccc/kvm_guest.c b/drivers/firmware/smccc/kvm_guest.c > >>> > index 89a68e7eeaa6..f3319be20b36 100644 > >>> > --- a/drivers/firmware/smccc/kvm_guest.c > >>> > +++ b/drivers/firmware/smccc/kvm_guest.c > >>> > @@ -39,6 +39,8 @@ void __init kvm_init_hyp_services(void) > >>> > > >>> > pr_info("hypervisor services detected (0x%08lx 0x%08lx 0x%08lx 0x%08lx)\n", > >>> > res.a3, res.a2, res.a1, res.a0); > >>> > + > >>> > + kvm_arch_init_hyp_services(); > >>> > } > >>> > > >>> > >>> That is a bit late to detect RMM? One of the requirements is to > >>> figure out the pgprot_t flags for early_ioremap so that "earlycon" will > >>> work (by mapping the address as shared alias). To do that we need to > >>> make an RSI call to detect PROT_NS_SHARED mask as below. > >>> > >>> if (rsi_get_realm_config(&config)) > >>> return; > >>> prot_ns_shared = BIT(config.ipa_bits - 1); > >> > >> Why can't the earlycon MMIO address just have that high bit set? > >> > >> I think it's horribly fragile to try detecting all of this stuff before > >> we're allowed to touch the console. We don't even bother with pKVM -- > >> it's the guest firmware's responsibility to MMIO_GUARD the UART if it > >> detects a debuggable payload. > > > > To mark something shared, we need to know the mask value which is > > returned via rsi_get_realm_config() call. > > I guess you are suggesting to leave it to firmware to set up the device > tree "reg-offset" with shared bit set? As you know, we've been through these options internally and we concluded not to encode this information in the DT for various reasons. Personally I don't like this IPA split but that's too late to change it now in the RMM spec. -- Catalin