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 AE805C4345F for ; Wed, 1 May 2024 17:45:28 +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:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=GVICtLVJ+LsilOR3WW8/t+XJ/q8p5UQYYxqosgtzmes=; b=v3rvJdrbCVySmM NH5dnxbx64Y1V9NKAwcfiLS1qPBsBEo9IOh0EuOa2pKjmMDOZcvLB1BSWTsOsCw7KkuzcN0F6vBKl MnbvYLHu78feG/KlOj6//c0slVOrfaxGCQJQzdzzp8axLvZZ37RbiqF4Gn5On3gkMSLmJm5QigStl wuJl9P2RRH4o9yETWO34wB/UPrzcHRxrVeHTIh/RdCGQtZLMS7ViluiRr7qnsoG7M4AnHbTgPWnW4 8MMtJwpa2Ib4ZdWvcjf3x+KLtpxmu5PU9MvCgiRMuilPb+0SpTI/eskyaa1Sm2/mszoY4xpZAwEqO 8KdEFSHdWdZr6lfaqK7A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s2E17-0000000ALWq-1cp7; Wed, 01 May 2024 17:45:17 +0000 Received: from out-179.mta1.migadu.com ([2001:41d0:203:375::b3]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s2E13-0000000ALUO-1f7O for linux-arm-kernel@lists.infradead.org; Wed, 01 May 2024 17:45:15 +0000 Date: Wed, 1 May 2024 17:44:57 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1714585501; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=yAxXoSAOiKALcSFu1+/2BCFIL3wLdkpMncuKL1W3TJo=; b=qn+c0F665Sk77kK3B5mdxUqEtHqKl3MZeACqWVJ+gQf5n50w+/8GZ12SA2CNlT+flmMCNJ /HRFFsSToCB4gb8goHWJ3TdDYh1riID2ByVvcFFEWCWKR6OynSxxF2YPwgT4LpVBoCL67t rgGdNFGhfIOvh+uE1+c4FuR2qbNe2Mc= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Oliver Upton To: Will Deacon Cc: kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, Marc Zyngier Subject: Re: [PATCH 1/2] KVM: arm64: Fix hvhe/nvhe early alias parsing Message-ID: References: <20240501163400.15838-1-will@kernel.org> <20240501163400.15838-2-will@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20240501163400.15838-2-will@kernel.org> X-Migadu-Flow: FLOW_OUT X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240501_104513_731826_FBB390D4 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 On Wed, May 01, 2024 at 05:33:59PM +0100, Will Deacon wrote: > Booting a kernel with "arm64_sw.hvhe=1 kvm-arm.mode=nvhe" on the > command-line results in KVM initialising using hVHE, whereas one might > expect the latter option to override the former. > > Fix this by adding "arm64_sw.hvhe=0" to the alias expansion for > "kvm-arm.mode=nvhe". Hmm, I wonder if it'd be better to just evaluate the sanitised VH field in hvhe_possible(). Otherwise I worry about keeping aliases in sync when new command line options come along. This is similar to what we had before commit 35876f35f482 ("arm64: cpufeature: Add helper to test for CPU feature overrides") w/ the added use of the sanitised reg. Thoughts? diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c index 56583677c1f2..3bd5f00a8db3 100644 --- a/arch/arm64/kernel/cpufeature.c +++ b/arch/arm64/kernel/cpufeature.c @@ -2138,6 +2138,12 @@ static bool has_nested_virt_support(const struct arm64_cpu_capabilities *cap, static bool hvhe_possible(const struct arm64_cpu_capabilities *entry, int __unused) { + u64 val = read_sanitised_ftr_reg(SYS_ID_AA64MMFR1_EL1); + + /* No VHE? Then no hVHE for you either. */ + if (!SYS_FIELD_GET(ID_AA64MMFR1_EL1, VH, val)) + return false; + return arm64_test_sw_feature_override(ARM64_SW_FEATURE_OVERRIDE_HVHE); } -- Thanks, Oliver _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel