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 X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6C294C2D0A3 for ; Mon, 26 Oct 2020 13:53:29 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EE55B2463C for ; Mon, 26 Oct 2020 13:53:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="ajP8Dd2o" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EE55B2463C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Owner; bh=L2TTIx4trbhsP8wIOZLRdhzqG+DKT3OV/GOqlsZNY+c=; b=ajP8Dd2o6ohhjgWsfx2hWeKSyQ Fm+yMfbX/7gTscJncgVs9EURdAAeALT+64NfraEpS9kxXz4K0cgJ8laIv9kYh45RbjyZ/jxwLsnXM SZKrTlZFAt8HjAv0s1OdZYlg7CYuGvqK+CjbqBp8itS2229s8NuabHMvW2aZYaDKEdrJmx3TVaBcj yeKFlGCFO1dwfLSJIB62Dcx8FjKVQ0GoJ43C60xeXbZWcARKnDE2US8ifi7TPD1HlTnoeNfzeB6t6 GEY1Vyw6tm11PwqYEBUadwPD6jXayzv/vqfucay4U0wWkkEqJwKjk8gWyiAma7DwDhLIHJH7quYXF 9cQIww2Q==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kX2tg-0006gl-6E; Mon, 26 Oct 2020 13:50:52 +0000 Received: from foss.arm.com ([217.140.110.172]) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kX2sW-0006DD-E0 for linux-arm-kernel@lists.infradead.org; Mon, 26 Oct 2020 13:49:41 +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 642A81042; Mon, 26 Oct 2020 06:49:39 -0700 (PDT) Received: from lakrids.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 73C0E3F68F; Mon, 26 Oct 2020 06:49:38 -0700 (PDT) From: Mark Rutland To: kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org Subject: [PATCHv2 0/3] arm64: kvm: avoid referencing cpu_hwcaps from hyp Date: Mon, 26 Oct 2020 13:49:28 +0000 Message-Id: <20201026134931.28246-1-mark.rutland@arm.com> X-Mailer: git-send-email 2.11.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201026_094940_609385_21AC896B X-CRM114-Status: GOOD ( 12.04 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, maz@kernel.org, dbrazdil@google.com, will@kernel.org MIME-Version: 1.0 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 In a few places we use cpus_have_const_cap() in hyp code, usually because this is hidden within a helper that's also used in regular kernel context. As cpus_have_const_cap() generates code to read the cpu_hwcaps array before capabilities are finalized, this means we generate some potentially-unsound references to regular kernel VAs, but this these are redundant as capabilities are finalized before we initialize the kvm hyp code. This series gets rid of the redundant code by automatically upgrading cpust_have_const_cap() to cpus_have_final_cap() when used in hyp code. This allows us to avoid creating an NVHE alias for the cpu_hwcaps array, so we can catch if we accidentally introduce an runtime reference to this (e.g. via cpus_have_cap()). Since v1 [1]: * Trivial rebase to v5.10-rc1 [1] https://lore.kernel.org/r/20201007125211.30043-1-mark.rutland@arm.com Mark Rutland (3): arm64: kvm: factor out is_{vhe,nvhe}_hyp_code() arm64: cpufeature: reorder cpus_have_{const,final}_cap() arm64: cpufeature: upgrade hyp caps to final arch/arm64/include/asm/cpufeature.h | 40 ++++++++++++++++++++++++++++--------- arch/arm64/include/asm/virt.h | 9 ++++----- arch/arm64/kernel/image-vars.h | 1 - 3 files changed, 35 insertions(+), 15 deletions(-) -- 2.11.0 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel