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 2927CC27C53 for ; Wed, 12 Jun 2024 10:59:42 +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=z2EQwKfLvpDulqiWZaKLpveeq9xBAija4J7nqwcd4Hc=; b=oRKB8vgCjuYu4Z8MouaCcgGxjR zyQH9KWwXKzpAGi1RGjVDCDsWbBFjp+sTAog8qdKAkc2GHx5f/zEqplPhqS0aoVnQqr1EnLFz7J5X br3xM48nXZdO5MXypIvRjz0FI8oc6kRphmqA2XmJ61Qf3cmdk9HR+tY0v1zg8Ra4pQe3aPS5JrgpC 5G+QmP2eAECqI+hY0LGFZ+X+0zCQ+KowHycHqKTUVI8fuP/OrsNTatdgZdUF5Ierjn5i9xGH0iBxA wC+DammEqcPN7XVjJipgnQbXAKtB1fM6D1qpo5b3cj/rZB8mUn8KWFAMvkM7gtiNOkw7pvItdDn6F JTdnJa/A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHLhU-0000000CMr2-2FNG; Wed, 12 Jun 2024 10:59:32 +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 1sHLhR-0000000CMq3-1yNc for linux-arm-kernel@lists.infradead.org; Wed, 12 Jun 2024 10:59: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 9FA281595; Wed, 12 Jun 2024 03:59:50 -0700 (PDT) Received: from [10.57.72.20] (unknown [10.57.72.20]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C2D073F73B; Wed, 12 Jun 2024 03:59:23 -0700 (PDT) Message-ID: <3301ddd8-f088-48e3-bfac-460891698eac@arm.com> Date: Wed, 12 Jun 2024 11:59:22 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3 02/14] arm64: Detect if in a realm and set RIPAS RAM Content-Language: en-GB To: Jean-Philippe Brucker , Steven Price Cc: kvm@vger.kernel.org, kvmarm@lists.linux.dev, Catalin Marinas , Marc Zyngier , Will Deacon , James Morse , Oliver Upton , 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: <20240605093006.145492-1-steven.price@arm.com> <20240605093006.145492-3-steven.price@arm.com> <20240612104023.GB4602@myrica> From: Suzuki K Poulose In-Reply-To: <20240612104023.GB4602@myrica> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240612_035929_597399_9EBB29DC X-CRM114-Status: GOOD ( 20.99 ) 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 12/06/2024 11:40, Jean-Philippe Brucker wrote: > On Wed, Jun 05, 2024 at 10:29:54AM +0100, Steven Price wrote: >> From: Suzuki K Poulose >> >> Detect that the VM is a realm guest by the presence of the RSI >> interface. >> >> If in a realm then all memory needs to be marked as RIPAS RAM initially, >> the loader may or may not have done this for us. To be sure iterate over >> all RAM and mark it as such. Any failure is fatal as that implies the >> RAM regions passed to Linux are incorrect - which would mean failing >> later when attempting to access non-existent RAM. >> >> Signed-off-by: Suzuki K Poulose >> Co-developed-by: Steven Price >> Signed-off-by: Steven Price > >> +static bool rsi_version_matches(void) >> +{ >> + unsigned long ver_lower, ver_higher; >> + unsigned long ret = rsi_request_version(RSI_ABI_VERSION, >> + &ver_lower, >> + &ver_higher); > > There is a regression on QEMU TCG (in emulation mode, not running under KVM): > > qemu-system-aarch64 -M virt -cpu max -kernel Image -nographic > > This doesn't implement EL3 or EL2, so SMC is UNDEFINED (DDI0487J.a R_HMXQS), > and we end up with an undef instruction exception. So this patch would > also break hardware that only implements EL1 (I don't know if it exists). Thanks for the report, Could we not check ID_AA64PFR0_EL1.EL3 >= 0 ? I think we do this for kvm-unit-tests, we need the same here. Suzuki > > The easiest fix is to detect the SMC conduit through the PSCI node in DT. > SMCCC helpers already do this, but we can't use them this early in the > boot. I tested adding an early probe to the PSCI driver to check this, see > attached patches. > > Note that we do need to test the conduit after finding a PSCI node, > because even though it doesn't implement EL2 in this configuration, QEMU > still accepts PSCI HVCs in order to support SMP. > > Thanks, > Jean >