Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp4365307ybl; Sat, 21 Dec 2019 05:20:31 -0800 (PST) X-Google-Smtp-Source: APXvYqxzYJ1kaJ89/RGmqF4C4SgVtoDexXIAMdcPfg0t4ROkOFmKKNc02QJPyorHapgM6eI8x69X X-Received: by 2002:aca:c256:: with SMTP id s83mr5215014oif.57.1576934431331; Sat, 21 Dec 2019 05:20:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576934431; cv=none; d=google.com; s=arc-20160816; b=dO32NfrOikjhVwJjgQ/sv5CQQtqLCtyb5xbFJMbKSm3DDGtzf12exaRXsD+ip7NJt4 yqHMv5EQdqsLc4mE3pUUn7zkK9RiG0eUPVes7MkwE931s8c1rzyMC9jTuwMgYEp1JelN 9kytdlfvtEsxtTSn1f+LjRqPwO6Y+1MdSzDgElJnrImKs8SJuq/ryIOJ4ijJDWXKaA8W mD3blRcO8ns/KpYgHCQrhGhKXuA6UMqeqnJPVqHef/COt4zzp2n+w4KscWoEwNsaW4sE Uoo+U05cd8AeFi5wNZMywq0XPCeG0dI3PPucICIKtCpHLpWFk4txt1IKNFB0fgsrCN0n C62g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=pKvZHFnwqScz9bZG0eOO5+abObU9nQgnaLA+u6usSxs=; b=p8UBvqZ+Bgyh53B2aiXruGwZ1vN4LT9BwWmAzGbytZFY3ShnUbVUzMb65EePMHAPZj CRiMut/2Wo//Gto3EqXXne50hubw+v9Uf8VbJ1gnldg0WpPcUw0UyYeMdVLffCjaTMbA WFErm3EsbvtYK1EL6TH4Hdo7eE1ksIlN6fDGC63bkL9s0LE47SOaFjkyWnfDKbR8xPyR OK29NjrbeC3fmTN+4x4zdXoyEDmhEWqLYsXLJr85RIOmYcCC2Fj3iNzEf0jXytv3e29h 4WECFbScnCe88RjaknkUibKq09YHUrx1i71+A5OIkKVKV/LI8prossEFyPzouCmKmlBf /bEw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q9si6267907oif.92.2019.12.21.05.20.19; Sat, 21 Dec 2019 05:20:31 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726867AbfLUNTk (ORCPT + 99 others); Sat, 21 Dec 2019 08:19:40 -0500 Received: from inca-roads.misterjones.org ([213.251.177.50]:48178 "EHLO inca-roads.misterjones.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726182AbfLUNTk (ORCPT ); Sat, 21 Dec 2019 08:19:40 -0500 Received: from 78.163-31-62.static.virginmediabusiness.co.uk ([62.31.163.78] helo=why) by cheepnis.misterjones.org with esmtpsa (TLSv1.2:AES256-GCM-SHA384:256) (Exim 4.80) (envelope-from ) id 1iiefS-00035I-DI; Sat, 21 Dec 2019 14:19:38 +0100 Date: Sat, 21 Dec 2019 13:19:36 +0000 From: Marc Zyngier To: Andrew Murray Cc: will@kernel.org, Catalin Marinas , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Sudeep Holla , kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v2 03/18] arm64: KVM: define SPE data structure for each vcpu Message-ID: <20191221131936.21fa2dfa@why> In-Reply-To: <20191220143025.33853-4-andrew.murray@arm.com> References: <20191220143025.33853-1-andrew.murray@arm.com> <20191220143025.33853-4-andrew.murray@arm.com> Organization: Approximate X-Mailer: Claws Mail 3.17.4 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 62.31.163.78 X-SA-Exim-Rcpt-To: andrew.murray@arm.com, will@kernel.org, catalin.marinas@arm.com, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, sudeep.holla@arm.com, kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on cheepnis.misterjones.org); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 20 Dec 2019 14:30:10 +0000 Andrew Murray wrote: > From: Sudeep Holla > > In order to support virtual SPE for guest, so define some basic structs. > This features depends on host having hardware with SPE support. > > Since we can support this only on ARM64, add a separate config symbol > for the same. > > Signed-off-by: Sudeep Holla > [ Add irq_level, rename irq to irq_num for kvm_spe ] > Signed-off-by: Andrew Murray > --- > arch/arm64/include/asm/kvm_host.h | 2 ++ > arch/arm64/kvm/Kconfig | 7 +++++++ > include/kvm/arm_spe.h | 19 +++++++++++++++++++ > 3 files changed, 28 insertions(+) > create mode 100644 include/kvm/arm_spe.h > > diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h > index c61260cf63c5..f5dcff912645 100644 > --- a/arch/arm64/include/asm/kvm_host.h > +++ b/arch/arm64/include/asm/kvm_host.h > @@ -35,6 +35,7 @@ > #include > #include > #include > +#include > > #define KVM_MAX_VCPUS VGIC_V3_MAX_CPUS > > @@ -302,6 +303,7 @@ struct kvm_vcpu_arch { > struct vgic_cpu vgic_cpu; > struct arch_timer_cpu timer_cpu; > struct kvm_pmu pmu; > + struct kvm_spe spe; > > /* > * Anything that is not used directly from assembly code goes > diff --git a/arch/arm64/kvm/Kconfig b/arch/arm64/kvm/Kconfig > index a475c68cbfec..af5be2c57dcb 100644 > --- a/arch/arm64/kvm/Kconfig > +++ b/arch/arm64/kvm/Kconfig > @@ -35,6 +35,7 @@ config KVM > select HAVE_KVM_EVENTFD > select HAVE_KVM_IRQFD > select KVM_ARM_PMU if HW_PERF_EVENTS > + select KVM_ARM_SPE if (HW_PERF_EVENTS && ARM_SPE_PMU) > select HAVE_KVM_MSI > select HAVE_KVM_IRQCHIP > select HAVE_KVM_IRQ_ROUTING > @@ -61,6 +62,12 @@ config KVM_ARM_PMU > Adds support for a virtual Performance Monitoring Unit (PMU) in > virtual machines. > > +config KVM_ARM_SPE > + bool > + ---help--- > + Adds support for a virtual Statistical Profiling Extension(SPE) in > + virtual machines. > + > config KVM_INDIRECT_VECTORS > def_bool KVM && (HARDEN_BRANCH_PREDICTOR || HARDEN_EL2_VECTORS) > > diff --git a/include/kvm/arm_spe.h b/include/kvm/arm_spe.h > new file mode 100644 > index 000000000000..48d118fdb174 > --- /dev/null > +++ b/include/kvm/arm_spe.h > @@ -0,0 +1,19 @@ > +// SPDX-License-Identifier: GPL-2.0 > +/* > + * Copyright (C) 2019 ARM Ltd. > + */ > + > +#ifndef __ASM_ARM_KVM_SPE_H > +#define __ASM_ARM_KVM_SPE_H > + > +#include > +#include I don't believe these are required at this stage. > + > +struct kvm_spe { > + int irq_num; 'irq' was the right name *if* this represents a Linux irq. If this instead represents a guest PPI, then it should be named 'intid'. In either case, please document what this represents. > + bool ready; /* indicates that SPE KVM instance is ready for use */ > + bool created; /* SPE KVM instance is created, may not be ready yet */ > + bool irq_level; What does this represent? The state of the interrupt on the host? The guest? Something else? Also, please consider grouping related fields together. > +}; If you've added a config option that controls the selection of the SPE feature, why doesn't this result in an empty structure when it isn't selected? > + > +#endif /* __ASM_ARM_KVM_SPE_H */ Thanks, M. -- Jazz is not dead. It just smells funny...