From patchwork Fri Jan 27 11:27:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Price X-Patchwork-Id: 13118430 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 E33D2C38142 for ; Fri, 27 Jan 2023 11:36:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=RYuGMBaObqxKtx0D7AcXyCCnqdTTM4famTt91gwVd3k=; b=tgCQbBLKf+XU5A MDdhiSGhTMdUipKZ2wGVlerY8TeUwtMW9IebGP0c1zcpEtHkgNwJn8ls7PtsK4fpu2B+wlXF53Rpd sFYxnBUWyOTmaxYUXtjmNddgXfQ0PAe7GCb0b++Ih6HRUNoXHiws2MTvi9bj7D2ovYzGluyTxvB19 AMXM3P2CMxKg1K8g1i/mbtS5L+RBy4NEzG9D+I2gHfnKSCH12cQDnP28FiJF4LQ4Mgd50yYQhjlJO kQ2sq624FfQEDh7xnSMltZ+FAfG8ujANlAk7QMAZaDBhP3L2SuNbBgU/UT0s+d6XDEFUb1q8ieks9 2BgqRxeYmMq/TQsTVY+w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pLN0r-00EAQe-6w; Fri, 27 Jan 2023 11:35:21 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pLMuW-00E7Px-8Y for linux-arm-kernel@lists.infradead.org; Fri, 27 Jan 2023 11:28:50 +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 649FC1692; Fri, 27 Jan 2023 03:29:29 -0800 (PST) Received: from e122027.cambridge.arm.com (e122027.cambridge.arm.com [10.1.35.16]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 265293F64C; Fri, 27 Jan 2023 03:28:45 -0800 (PST) From: Steven Price To: kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org Cc: Steven Price , Catalin Marinas , Ard Biesheuvel , Marc Zyngier , Will Deacon , Suzuki K Poulose , James Morse , Oliver Upton , Zenghui Yu , linux-kernel@vger.kernel.org, Joey Gouly , Alexandru Elisei , Christoffer Dall , Fuad Tabba , linux-coco@lists.linux.dev Subject: [RFC PATCH 14/14] HACK: Accept prototype RSI version Date: Fri, 27 Jan 2023 11:27:58 +0000 Message-Id: <20230127112758.37891-15-steven.price@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230127112758.37891-1-steven.price@arm.com> References: <20230127112248.136810-1-suzuki.poulose@arm.com> <20230127112758.37891-1-steven.price@arm.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230127_032848_417188_2776C80C X-CRM114-Status: GOOD ( 11.28 ) 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 The upstream RMM currently advertises the major version of an internal prototype (v12.0) rather than the expected version from the RMM architecture specification (v1.0). Add a config option to enable support for the prototype RSI v12.0. Signed-off-by: Steven Price --- arch/arm64/include/asm/rsi_smc.h | 2 ++ arch/arm64/kernel/rsi.c | 5 +++++ arch/arm64/kvm/Kconfig | 8 ++++++++ 3 files changed, 15 insertions(+) diff --git a/arch/arm64/include/asm/rsi_smc.h b/arch/arm64/include/asm/rsi_smc.h index bc0cdd83f164..baf07f905353 100644 --- a/arch/arm64/include/asm/rsi_smc.h +++ b/arch/arm64/include/asm/rsi_smc.h @@ -29,6 +29,8 @@ #define RSI_ABI_VERSION ((RSI_ABI_VERSION_MAJOR << 16) | \ RSI_ABI_VERSION_MINOR) +#define RSI_LEGACY_ABI_VERSION 0xc0000 + #define RSI_ABI_VERSION_GET_MAJOR(_version) ((_version) >> 16) #define RSI_ABI_VERSION_GET_MINOR(_version) ((_version) & 0xFFFF) diff --git a/arch/arm64/kernel/rsi.c b/arch/arm64/kernel/rsi.c index 1cc292826f2b..45b26f23e706 100644 --- a/arch/arm64/kernel/rsi.c +++ b/arch/arm64/kernel/rsi.c @@ -41,6 +41,11 @@ static bool rsi_version_matches(void) RSI_ABI_VERSION_GET_MAJOR(ver), RSI_ABI_VERSION_GET_MINOR(ver)); +#ifdef CONFIG_RME_USE_PROTOTYPE_HACKS + if (ver == RSI_LEGACY_ABI_VERSION) + return true; +#endif + return (ver >= RSI_ABI_VERSION && RSI_ABI_VERSION_GET_MAJOR(ver) == RSI_ABI_VERSION_MAJOR); } diff --git a/arch/arm64/kvm/Kconfig b/arch/arm64/kvm/Kconfig index 05da3c8f7e88..13858a5047fd 100644 --- a/arch/arm64/kvm/Kconfig +++ b/arch/arm64/kvm/Kconfig @@ -58,6 +58,14 @@ config NVHE_EL2_DEBUG If unsure, say N. +config RME_USE_PROTOTYPE_HACKS + bool "Allow RMM prototype version numbers" + default y + help + For compatibility with the the current RMM code allow versions + numbers from a prototype implementation as well as the expected + version number from the RMM specification. + config PROTECTED_NVHE_STACKTRACE bool "Protected KVM hypervisor stacktraces" depends on NVHE_EL2_DEBUG