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=-12.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham 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 CD304C4363D for ; Wed, 7 Oct 2020 12:53:51 +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 5D85220789 for ; Wed, 7 Oct 2020 12:53:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="bswUHStl" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5D85220789 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=HEa8T8C1tPtumvWOcDu2Swn3ccJd50/YWHhiH+zynkg=; b=bswUHStlII563aSJ5xrF7Hp42I /TTX4Q7UsbFmV6h4E4BSUT2uysR2HRyHLm3RQXL+zyYj9EiaSDiF5Ag2EuPFj73pbQTgXGOni1IhT IWLBPrKBmf3qZCamkjOx2+eRgsiyINPK8EHYbsXJPGEcjWVNyUP+hJCg739v0Wf8xXhOXxQ08SHpG 6neBpWA4ge7Q5Lt/psx/j4M2gDFFzNks7AedXrwxK8kzg6mrL/qBxs5ZchQyKCsW9MDG5TWLfjp0p PdUomg44QxCdt2YPSM3xfw0vZJcW5XhNUS0uGhgkJX9WwbKeHw/SNSQ6NKKKIyi9PfqBFohQGzrfn sJByy+tw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kQ8vl-00049v-JS; Wed, 07 Oct 2020 12:52:29 +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 1kQ8vi-00048b-09 for linux-arm-kernel@lists.infradead.org; Wed, 07 Oct 2020 12:52:27 +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 5F3661042; Wed, 7 Oct 2020 05:52:23 -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 9511E3F66B; Wed, 7 Oct 2020 05:52:22 -0700 (PDT) From: Mark Rutland To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 0/3] arm64: kvm: avoid referencing cpu_hwcaps from hyp Date: Wed, 7 Oct 2020 13:52:08 +0100 Message-Id: <20201007125211.30043-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-20201007_085226_105350_74E3446F X-CRM114-Status: GOOD ( 12.48 ) 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()). Thees patches are based on the kvmarm next branch [1]. [1] git://git.kernel.org/pub/scm/linux/kernel/git/kvmarm/kvmarm.git next Thanks, Mark. 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