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=-8.5 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED,USER_AGENT_MUTT 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 470B6C4360F for ; Thu, 4 Apr 2019 07:53:33 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 189DB20882 for ; Thu, 4 Apr 2019 07:53:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="kLqn2AYn" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 189DB20882 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-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=bombadil.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=1NEfTbpm/Met28+vkoIxBRKxuT8eVgz48S75qjYn2C8=; b=kLqn2AYnVIIxTL XvLIfGv4kVfTt4Ha+F9nD1dPP79nVRENW6gMCf3h/9VytdTniUhYTs70bJXu3neTExpRKPz4k4X1Y 8ShaVRCYvhm8j8y5abM7kztYPIYJM7vZbpr5nDtdUDLqadl7LNM6/1Zt3f/pPzwPGeam0zjVKQWyU ZO/aWZvnwtQLniTcgP7NU3ID2gI/93jxj9EjqBtLE8WbA6WH2OeDNtFFqeerQFRrTBlMgEhHtc+uZ joJNLvu+grnqD2JS5/b5xyl51JDVLqxFZGRGa95OAZ4o3GGEo0cW8U6lEkgsUUMDq8+R9KBpZrYJL i9y6p+uhZO3+trlqn+NA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hBxBh-0003zu-D6; Thu, 04 Apr 2019 07:53:29 +0000 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70] helo=foss.arm.com) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hBxBe-0003zZ-CS for linux-arm-kernel@lists.infradead.org; Thu, 04 Apr 2019 07:53:27 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id EDF3980D; Thu, 4 Apr 2019 00:53:23 -0700 (PDT) Received: from e103592.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 02C4F3F68F; Thu, 4 Apr 2019 00:53:21 -0700 (PDT) Date: Thu, 4 Apr 2019 08:53:19 +0100 From: Dave Martin To: Marc Zyngier Subject: Re: [PATCH v7 09/27] KVM: arm64: Add a vcpu flag to control SVE visibility for the guest Message-ID: <20190404075317.GW3567@e103592.cambridge.arm.com> References: <1553864452-15080-1-git-send-email-Dave.Martin@arm.com> <1553864452-15080-10-git-send-email-Dave.Martin@arm.com> <20190403191413.5s6o4jruuijrdtgg@kamzik.brq.redhat.com> <86k1ga4fy3.wl-marc.zyngier@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <86k1ga4fy3.wl-marc.zyngier@arm.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190404_005326_432797_93817EA2 X-CRM114-Status: GOOD ( 24.74 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew Jones , Christoffer Dall , Ard Biesheuvel , Catalin Marinas , Will Deacon , Okamoto Takayuki , Zhang Lei , Julien Grall , kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Apr 04, 2019 at 04:17:24AM +0100, Marc Zyngier wrote: > On Wed, 03 Apr 2019 20:14:13 +0100, > Andrew Jones wrote: > > = > > On Fri, Mar 29, 2019 at 01:00:34PM +0000, Dave Martin wrote: > > > Since SVE will be enabled or disabled on a per-vcpu basis, a flag > > > is needed in order to track which vcpus have it enabled. > > > = > > > This patch adds a suitable flag and a helper for checking it. > > > = > > > Signed-off-by: Dave Martin > > > Reviewed-by: Alex Benn=E9e > > > Tested-by: zhang.lei > > > --- > > > arch/arm64/include/asm/kvm_host.h | 4 ++++ > > > 1 file changed, 4 insertions(+) > > > = > > > diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/a= sm/kvm_host.h > > > index 6d10100..ad4f7f0 100644 > > > --- a/arch/arm64/include/asm/kvm_host.h > > > +++ b/arch/arm64/include/asm/kvm_host.h > > > @@ -328,6 +328,10 @@ struct kvm_vcpu_arch { > > > #define KVM_ARM64_FP_HOST (1 << 2) /* host FP regs loaded */ > > > #define KVM_ARM64_HOST_SVE_IN_USE (1 << 3) /* backup for host TIF_SV= E */ > > > #define KVM_ARM64_HOST_SVE_ENABLED (1 << 4) /* SVE enabled for EL0 */ > > > +#define KVM_ARM64_GUEST_HAS_SVE (1 << 5) /* SVE exposed to guest */ > > > + > > > +#define vcpu_has_sve(vcpu) (system_supports_sve() && \ > > > + ((vcpu)->arch.flags & KVM_ARM64_GUEST_HAS_SVE)) > > = > > We shouldn't need the system_supports_sve() here. vcpu->arch.flags can > > only have the KVM_ARM64_GUEST_HAS_SVE flag set when system_supports_sve= () > > is true, and it can't change later. > = > This is a performance optimisation. system_supports_sve() results in a > static key being emitted, and that avoids a number of loads on the > fast path for non-SVE systems (which is likely to be the absolute > majority for the foreseeable future). Exactly so. The same applies to many of the other call sites for system_supports_sve(). Cheers ---Dave _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel