From patchwork Thu May 23 10:34:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 164977 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp1995084ili; Thu, 23 May 2019 03:36:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqyXkhXwYXKx7NtFsqeLgEFvt2oq8UW+izBUCbqREIZaRxAYc04z5QASKtcvsClJ2PvSdRbQ X-Received: by 2002:a17:902:8d96:: with SMTP id v22mr21689823plo.282.1558607795396; Thu, 23 May 2019 03:36:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558607795; cv=none; d=google.com; s=arc-20160816; b=IMkalOrPzgF3S+1o+Ugwu0eDBTRhu2UHRpQtloYiRJ0xpATjXgNloLxbErxX62fvQo i9japHEh0+o39BDkMsF9ak/1qal7n/Wpe260rEqVCu5y4jO3HIuO5Y0jPVEZaH0MviES hMjANb3oRufa9D61d4Nrxy7pLiQNtvl/KkIE/SxDlxgXjG71b8WSVaWXWFQtR+zf01sz AGZe5bL981LfiE7ge6Zs3wHcRnzvxf7z290/iyNA7pIcfR6traYPyYIRDeibp+UHvEBI h20GwQZKoge1GFT7lu0qjpH890rWtMgsSsYuMPAOJ+O6p8PDo7P5e04gw1GLpttaDRFw vLDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=2LCobnWhM2g9sVrjY325P+xFJG2hG4MK3Ml0vdh+RUY=; b=igXjqOu5slbQd3WSva96xNdx41tzORLdqZTSuo2Lhu97VDPWyPUPZ4qfPvwCWtES0O Ado3hVv9q+exK93IQTdb5A3FgdjY8Tw2djnlbV4Rsu5QYoWLFWckibY9FYWI6MYbPJ63 6I00DlANoTi74SDnvlS+ez2cyUhJ6pGk6nAaRmCjJ2T3dWdQck9obkT87pfGonwToRRp v4xqbJe4QG99DYZksoduQgU2umPk4pM560++Bhxi8M4RJW+3bFvpUuvhYZXfRDqx8RKO VKocosFgxaSNIzwxUJPim1xWRFSNVGmO7bjie8uMXmiKbPodWQomBEXjbVRJ5OKjB7JC 1+lg== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d126si27488399pgc.46.2019.05.23.03.36.35; Thu, 23 May 2019 03:36:35 -0700 (PDT) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730559AbfEWKfd (ORCPT + 30 others); Thu, 23 May 2019 06:35:33 -0400 Received: from foss.arm.com ([217.140.101.70]:43046 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730499AbfEWKfa (ORCPT ); Thu, 23 May 2019 06:35:30 -0400 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 560BA341; Thu, 23 May 2019 03:35:30 -0700 (PDT) Received: from usa.arm.com (e107155-lin.cambridge.arm.com [10.1.196.42]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 427FE3F718; Thu, 23 May 2019 03:35:28 -0700 (PDT) From: Sudeep Holla To: kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org Cc: Sudeep Holla , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Christoffer Dall , Marc Zyngier , James Morse , Suzuki K Pouloze , Catalin Marinas , Will Deacon , Julien Thierry Subject: [PATCH v2 04/15] arm64: KVM: define SPE data structure for each vcpu Date: Thu, 23 May 2019 11:34:51 +0100 Message-Id: <20190523103502.25925-5-sudeep.holla@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190523103502.25925-1-sudeep.holla@arm.com> References: <20190523103502.25925-1-sudeep.holla@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- arch/arm64/include/asm/kvm_host.h | 2 ++ arch/arm64/kvm/Kconfig | 7 +++++++ include/kvm/arm_spe.h | 18 ++++++++++++++++++ 3 files changed, 27 insertions(+) create mode 100644 include/kvm/arm_spe.h -- 2.17.1 diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h index 2a8d3f8ca22c..611a4884fb6c 100644 --- a/arch/arm64/include/asm/kvm_host.h +++ b/arch/arm64/include/asm/kvm_host.h @@ -46,6 +46,7 @@ #include #include #include +#include #define KVM_MAX_VCPUS VGIC_V3_MAX_CPUS @@ -304,6 +305,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 a67121d419a2..3e178894ddd8 100644 --- a/arch/arm64/kvm/Kconfig +++ b/arch/arm64/kvm/Kconfig @@ -33,6 +33,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 @@ -57,6 +58,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..8c96bdfad6ac --- /dev/null +++ b/include/kvm/arm_spe.h @@ -0,0 +1,18 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (C) 2018 ARM Ltd. + */ + +#ifndef __ASM_ARM_KVM_SPE_H +#define __ASM_ARM_KVM_SPE_H + +#include +#include + +struct kvm_spe { + int irq; + bool ready; /* indicates that SPE KVM instance is ready for use */ + bool created; /* SPE KVM instance is created, may not be ready yet */ +}; + +#endif /* __ASM_ARM_KVM_SPE_H */