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 E6009C4332F for ; Thu, 20 Oct 2022 09:25:32 +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=+6Hx6Pi1m/J3KVcW4nJgUiBJRxmlK4NUlYQmxbuHYX0=; b=AvqwzizGyFCCPk iXYpMAdfXzAqt7J1KkqP9hy+Nogo37C73Ms/JFc+Av7NVw+rljaxIHjPgBHM9XP2FX01572l2COr6 5Xs8j4DvYPK3MKODG8DmPXnKiasjJ8c4lYupU1O6eriG+eGtHFqUSMwiuIvd1EXkd09O+b2+LQ7AQ 5esUO21qDhJiregbvcnJPE7sE3wS7gCOPtgfZVgkRSIqqLxp2ukflF2VlO+Yty8b1iC7mCHFWFG// cUX5sQllSMgGevB154/OTzT5TgKKd/IsCSfqu6C+rg4wbU4T1p1vLv/nVyhAyQJGMoCJ9n5Sl6wD5 /lrJ0pD0+n3CI+XyB1wA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1olRmg-00CuPg-SW; Thu, 20 Oct 2022 09:24:15 +0000 Received: from ams.source.kernel.org ([145.40.68.75]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1olRfF-00Cp6s-M8 for linux-arm-kernel@lists.infradead.org; Thu, 20 Oct 2022 09:16:35 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 488ECB82682; Thu, 20 Oct 2022 09:16:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 08E24C433C1; Thu, 20 Oct 2022 09:16:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1666257391; bh=2eNqWN4PbAgzkaOx6mNpZevPq0uMwSWGGxKeEeSAMyo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=u3dS9ql0M8AGPz8g57P+rjNfF/9WYQmyolI4TQYa+m6GGzENYzt6eAoprJqWEjumX T9i/iwyoegWahWQwezcNs/wNgutLxy+U1JZhoElpzqVPT1dUS03dQTVkpLvl/zPHSL 06m6zDRJhXTmWP1aR3+XDLPM3PP5cjKv4BGDr++Pl5xjADtzQHdYiXVcg9nMQs0bAv TY5DnzkHVoDhpse6crIaWsjxJatc2Tmz0gkhiLO+NELUtkMmqLN/uS8txuOTJqYXde UWO8wTNNkwRK6CyRu0LpGReyKLK0J6ncys8pZB8Fx+UJCZV5otroQLMdg9gSXUrGMJ 1O9ad/acRILog== Received: from sofa.misterjones.org ([185.219.108.64] helo=valley-girl.lan) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1olRWc-000Buf-Ku; Thu, 20 Oct 2022 10:07:38 +0100 From: Marc Zyngier To: , , kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: James Morse , Suzuki K Poulose , Alexandru Elisei , Oliver Upton , Quentin Perret , Will Deacon , Fuad Tabba Subject: [PATCH 16/17] arm64: Allow arm64_sw.hvhe on command line Date: Thu, 20 Oct 2022 10:07:26 +0100 Message-Id: <20221020090727.3669908-17-maz@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221020090727.3669908-1-maz@kernel.org> References: <20221020090727.3669908-1-maz@kernel.org> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: kvmarm@lists.cs.columbia.edu, kvmarm@lists.linux.dev, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, james.morse@arm.com, suzuki.poulose@arm.com, alexandru.elisei@arm.com, oliver.upton@linux.dev, qperret@google.com, will@kernel.org, tabba@google.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221020_021633_905156_9A60710F X-CRM114-Status: GOOD ( 13.65 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add the arm64_sw.hvhe=1 option to force the use of the hVHE mode in the hypervisor code only. This enables the hVHE mode of operation when using KVM on VHE hardware. Signed-off-by: Marc Zyngier --- arch/arm64/kernel/idreg-override.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/arch/arm64/kernel/idreg-override.c b/arch/arm64/kernel/idreg-override.c index 4e8ef5e05db7..7f3d7835ceaa 100644 --- a/arch/arm64/kernel/idreg-override.c +++ b/arch/arm64/kernel/idreg-override.c @@ -137,11 +137,22 @@ static const struct ftr_set_desc smfr0 __initconst = { }, }; +static bool __init hvhe_filter(u64 val) +{ + u64 mmfr1 = read_sysreg(id_aa64mmfr1_el1); + + return (val == 1 && + lower_32_bits(__boot_status) == BOOT_CPU_MODE_EL2 && + cpuid_feature_extract_unsigned_field(mmfr1, + ID_AA64MMFR1_EL1_VH_SHIFT)); +} + static const struct ftr_set_desc sw_features __initconst = { .name = "arm64_sw", .override = &arm64_sw_feature_override, .fields = { FIELD("nokaslr", ARM64_SW_FEATURE_OVERRIDE_NOKASLR, NULL), + FIELD("hvhe", ARM64_SW_FEATURE_OVERRIDE_HVHE, hvhe_filter), {} }, }; -- 2.34.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel