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=-11.3 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 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 2CBC3C5517A for ; Fri, 30 Oct 2020 08:24:11 +0000 (UTC) Received: from mm01.cs.columbia.edu (mm01.cs.columbia.edu [128.59.11.253]) by mail.kernel.org (Postfix) with ESMTP id 6DE3822253 for ; Fri, 30 Oct 2020 08:24:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="YIU+hAqz" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6DE3822253 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvmarm-bounces@lists.cs.columbia.edu Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id A29BB4B36F; Fri, 30 Oct 2020 04:24:09 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Authentication-Results: mm01.cs.columbia.edu (amavisd-new); dkim=softfail (fail, message has been altered) header.i=@kernel.org Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ibHUflEwyAtb; Fri, 30 Oct 2020 04:24:08 -0400 (EDT) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 960A54B38A; Fri, 30 Oct 2020 04:24:08 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id BED614B385 for ; Fri, 30 Oct 2020 04:24:07 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id f7i2J28rkw5f for ; Fri, 30 Oct 2020 04:24:06 -0400 (EDT) Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by mm01.cs.columbia.edu (Postfix) with ESMTPS id BF81E4B36F for ; Fri, 30 Oct 2020 04:24:06 -0400 (EDT) Received: from willie-the-truck (236.31.169.217.in-addr.arpa [217.169.31.236]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 797B922249; Fri, 30 Oct 2020 08:24:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604046245; bh=DMS3Pow1PsWdDZjc0sYpclAumQvYZCqVBrfrHHMP+kc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=YIU+hAqzrOuysVC0PXni/igSgrnyo5t8TQus7rLrDrrAYT/kKMLuQyHtF+IWqK2Zc nLqUz9XaPe3+KrnoL4dl2ZMQFbVJicoBjbdJsKM8HT4yeTyFBMPflp0mYN8sGQe+wd J9ZqKjc7+NIxNMKvvLKM1tsPmE+7EhziOabMXDlc= Date: Fri, 30 Oct 2020 08:24:01 +0000 From: Will Deacon To: Mark Rutland Subject: Re: [PATCHv2 3/3] arm64: cpufeature: upgrade hyp caps to final Message-ID: <20201030082400.GB32163@willie-the-truck> References: <20201026134931.28246-1-mark.rutland@arm.com> <20201026134931.28246-4-mark.rutland@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20201026134931.28246-4-mark.rutland@arm.com> User-Agent: Mutt/1.10.1 (2018-07-13) Cc: maz@kernel.org, kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org X-BeenThere: kvmarm@lists.cs.columbia.edu X-Mailman-Version: 2.1.14 Precedence: list List-Id: Where KVM/ARM decisions are made List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu On Mon, Oct 26, 2020 at 01:49:31PM +0000, Mark Rutland wrote: > We finalize caps before initializing kvm hyp code, and any use of > cpus_have_const_cap() in kvm hyp code generates redundant and > potentially unsound code to read the cpu_hwcaps array. > > A number of helper functions used in both hyp context and regular kernel > context use cpus_have_const_cap(), as some regular kernel code runs > before the capabilities are finalized. It's tedious and error-prone to > write separate copies of these for hyp and non-hyp code. > > So that we can avoid the redundant code, let's automatically upgrade > cpus_have_const_cap() to cpus_have_final_cap() when used in hyp context. > With this change, there's never a reason to access to cpu_hwcaps array > from hyp code, and we don't need to create an NVHE alias for this. > > This should have no effect on non-hyp code. > > Signed-off-by: Mark Rutland > Cc: David Brazdil > Cc: Marc Zyngier > Cc: Will Deacon > --- > arch/arm64/include/asm/cpufeature.h | 26 ++++++++++++++++++++++++-- > arch/arm64/include/asm/virt.h | 12 ------------ > arch/arm64/kernel/image-vars.h | 1 - > 3 files changed, 24 insertions(+), 15 deletions(-) [...] > diff --git a/arch/arm64/kernel/image-vars.h b/arch/arm64/kernel/image-vars.h > index 61684a5009148..c615b285ff5b3 100644 > --- a/arch/arm64/kernel/image-vars.h > +++ b/arch/arm64/kernel/image-vars.h > @@ -87,7 +87,6 @@ KVM_NVHE_ALIAS(__icache_flags); > /* Kernel symbols needed for cpus_have_final/const_caps checks. */ > KVM_NVHE_ALIAS(arm64_const_caps_ready); > KVM_NVHE_ALIAS(cpu_hwcap_keys); > -KVM_NVHE_ALIAS(cpu_hwcaps); Nice! Acked-by: Will Deacon Will _______________________________________________ kvmarm mailing list kvmarm@lists.cs.columbia.edu https://lists.cs.columbia.edu/mailman/listinfo/kvmarm 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=-11.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 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 D38D6C55179 for ; Fri, 30 Oct 2020 08:25:49 +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 4B1EB22228 for ; Fri, 30 Oct 2020 08:25:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="tr9AMTOK"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="YIU+hAqz" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4B1EB22228 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org 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:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject: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=bz6w9QfapV5sXZwZ2gJs8RU4eSIYEsBaWoqMmXL9ns8=; b=tr9AMTOKSAkkdMYb52v13mKr2 QOhxy3nfwQpPVYHwvUNmvYq7Pl8EFGttK3Tx3SqIe0t9LqL7mXDTvl/WexxE2de0baIB0EM/zy2/O pEMtvGjC+C9tyRKmxoBaRr+l6DEz7V27ygFmZcy/T72bSAJ0FETj6rnDIocL4HFe8miRp/WKoIb8s LJqmg6M3cx2TtZtITL776FUZZ0Y+xI2eI5z4aZs7ldVJzW88RCpJkmZwtRMxR9jrY6ekwG+GYUX9T 0YDHMT/VzWi4du8UjMWdUI/O/COG2wUrWgH+xxRLSuuIBB+CoiaAYUVhZ8Gs0H69AQHva/quaA++W LAPg6gW/A==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kYPhx-0004Ab-68; Fri, 30 Oct 2020 08:24:25 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kYPhe-00042N-9K for linux-arm-kernel@lists.infradead.org; Fri, 30 Oct 2020 08:24:22 +0000 Received: from willie-the-truck (236.31.169.217.in-addr.arpa [217.169.31.236]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 797B922249; Fri, 30 Oct 2020 08:24:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604046245; bh=DMS3Pow1PsWdDZjc0sYpclAumQvYZCqVBrfrHHMP+kc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=YIU+hAqzrOuysVC0PXni/igSgrnyo5t8TQus7rLrDrrAYT/kKMLuQyHtF+IWqK2Zc nLqUz9XaPe3+KrnoL4dl2ZMQFbVJicoBjbdJsKM8HT4yeTyFBMPflp0mYN8sGQe+wd J9ZqKjc7+NIxNMKvvLKM1tsPmE+7EhziOabMXDlc= Date: Fri, 30 Oct 2020 08:24:01 +0000 From: Will Deacon To: Mark Rutland Subject: Re: [PATCHv2 3/3] arm64: cpufeature: upgrade hyp caps to final Message-ID: <20201030082400.GB32163@willie-the-truck> References: <20201026134931.28246-1-mark.rutland@arm.com> <20201026134931.28246-4-mark.rutland@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20201026134931.28246-4-mark.rutland@arm.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201030_042406_461546_0A8531B0 X-CRM114-Status: GOOD ( 22.64 ) 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: maz@kernel.org, dbrazdil@google.com, kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org 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 Mon, Oct 26, 2020 at 01:49:31PM +0000, Mark Rutland wrote: > We finalize caps before initializing kvm hyp code, and any use of > cpus_have_const_cap() in kvm hyp code generates redundant and > potentially unsound code to read the cpu_hwcaps array. > > A number of helper functions used in both hyp context and regular kernel > context use cpus_have_const_cap(), as some regular kernel code runs > before the capabilities are finalized. It's tedious and error-prone to > write separate copies of these for hyp and non-hyp code. > > So that we can avoid the redundant code, let's automatically upgrade > cpus_have_const_cap() to cpus_have_final_cap() when used in hyp context. > With this change, there's never a reason to access to cpu_hwcaps array > from hyp code, and we don't need to create an NVHE alias for this. > > This should have no effect on non-hyp code. > > Signed-off-by: Mark Rutland > Cc: David Brazdil > Cc: Marc Zyngier > Cc: Will Deacon > --- > arch/arm64/include/asm/cpufeature.h | 26 ++++++++++++++++++++++++-- > arch/arm64/include/asm/virt.h | 12 ------------ > arch/arm64/kernel/image-vars.h | 1 - > 3 files changed, 24 insertions(+), 15 deletions(-) [...] > diff --git a/arch/arm64/kernel/image-vars.h b/arch/arm64/kernel/image-vars.h > index 61684a5009148..c615b285ff5b3 100644 > --- a/arch/arm64/kernel/image-vars.h > +++ b/arch/arm64/kernel/image-vars.h > @@ -87,7 +87,6 @@ KVM_NVHE_ALIAS(__icache_flags); > /* Kernel symbols needed for cpus_have_final/const_caps checks. */ > KVM_NVHE_ALIAS(arm64_const_caps_ready); > KVM_NVHE_ALIAS(cpu_hwcap_keys); > -KVM_NVHE_ALIAS(cpu_hwcaps); Nice! Acked-by: Will Deacon Will _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel