Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp3811408imm; Mon, 17 Sep 2018 03:43:12 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbcUwXgnzWKxTkn1tYZsw37HXWTlGVBn6DovIz8c3bKqjjxwONAU2tKyISTeJ5j+I86vSwP X-Received: by 2002:a62:6948:: with SMTP id e69-v6mr25230619pfc.166.1537180992240; Mon, 17 Sep 2018 03:43:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537180992; cv=none; d=google.com; s=arc-20160816; b=n/k5Q/Hx54lJrwX6WTmK2Tk/kuud6+/csk8B9waKY5A6lyWEVHPtt8FaIeOGrZ/C3v 4qKNlinpd4D32ruIpbrTQ2HrZR8bSJgZHXhsW5UJMwwyCsI5q2NHIM/0axuH8zcQEULt kAedKHb/dW2Yha+WbNNDzAC2tBth1ryt4G2IzXTdpNBfB9cVuFRSCodkYItZdZdZjsdq +TejXuwycExfgS1F9ptjARKm8Q8e8IfgNkdPanPt+6wOFVw8MwIFbUe2w7VTE7DTgqcN 9CunmVrMDesWjLB0OEdVZwcszke8QTIJDp7UEfXwxKbv+Tvwi/fUBmLf0u6hGF7afy8a Qbuw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=ux9BZsDmrs950eI1A+e9Ds11+lC6oRud4nwAh6wVC9c=; b=oFS39cp0SXWqBHlZ8/DG8hzpYMIly+Df7InPYeH7JEoYQdfXwAJRVZ3jgz9WypfEUc zWs05Qb8O2Cc4i8JjTB6tJNDpRVA28Z2sos7kcZ5PTTp5TUsobj2itytV9u3fnX56EUt ZFN5hlPCIvbjeq4mSAJLfWFhp6r8s8cfzp2A33mNpOiX5PQCYTTkl1tzsG+uECF8VjJf y0QPQ4lTUO3GWkNCgCtZptdV+nAb5VER6sFi1V2T29Zp8bKDfxyDz1g6QZ+aTVxU41C2 q/C4uS1oVN530BObsKlppBT3SFZsjh+omYhaGsXXDAH/861GAzmx9U+p5KqPT+INxcuT yBPA== 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 z6-v6si14671340plo.503.2018.09.17.03.42.56; Mon, 17 Sep 2018 03:43:12 -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 S1728286AbeIQQJ1 (ORCPT + 99 others); Mon, 17 Sep 2018 12:09:27 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:56488 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728023AbeIQQJ0 (ORCPT ); Mon, 17 Sep 2018 12:09:26 -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 5784E80D; Mon, 17 Sep 2018 03:42:39 -0700 (PDT) Received: from en101.Emea.Arm.com (en101.emea.arm.com [10.4.13.23]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id D09E93F71F; Mon, 17 Sep 2018 03:42:36 -0700 (PDT) From: Suzuki K Poulose To: linux-arm-kernel@lists.infradead.org Cc: kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, marc.zyngier@arm.com, cdall@kernel.org, eric.auger@redhat.com, pbonzini@redhat.com, rkrcmar@redhat.com, will.deacon@arm.com, catalin.marinas@arm.com, james.morse@arm.com, dave.martin@arm.com, julien.grall@arm.com, linux-kernel@vger.kernel.org, suzuki.poulose@arm.com Subject: [PATCH v5 06/18] kvm: arm/arm64: Allow arch specific configurations for VM Date: Mon, 17 Sep 2018 11:41:28 +0100 Message-Id: <20180917104144.19188-7-suzuki.poulose@arm.com> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180917104144.19188-1-suzuki.poulose@arm.com> References: <20180917104144.19188-1-suzuki.poulose@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Allow the arch backends to perform VM specific initialisation. This will be later used to handle IPA size configuration and per-VM VTCR configuration on arm64. Cc: Marc Zyngier Cc: Christoffer Dall Signed-off-by: Suzuki K Poulose --- arch/arm/include/asm/kvm_host.h | 7 +++++++ arch/arm64/include/asm/kvm_host.h | 2 ++ arch/arm64/kvm/reset.c | 7 +++++++ virt/kvm/arm/arm.c | 5 +++-- 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/arch/arm/include/asm/kvm_host.h b/arch/arm/include/asm/kvm_host.h index 3ad482d2f1eb..72d46418e1ef 100644 --- a/arch/arm/include/asm/kvm_host.h +++ b/arch/arm/include/asm/kvm_host.h @@ -354,4 +354,11 @@ static inline void kvm_vcpu_put_sysregs(struct kvm_vcpu *vcpu) {} struct kvm *kvm_arch_alloc_vm(void); void kvm_arch_free_vm(struct kvm *kvm); +static inline int kvm_arm_config_vm(struct kvm *kvm, unsigned long type) +{ + if (type) + return -EINVAL; + return 0; +} + #endif /* __ARM_KVM_HOST_H__ */ diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h index 3d6d7336f871..b04280ae1be0 100644 --- a/arch/arm64/include/asm/kvm_host.h +++ b/arch/arm64/include/asm/kvm_host.h @@ -513,4 +513,6 @@ void kvm_vcpu_put_sysregs(struct kvm_vcpu *vcpu); struct kvm *kvm_arch_alloc_vm(void); void kvm_arch_free_vm(struct kvm *kvm); +int kvm_arm_config_vm(struct kvm *kvm, unsigned long type); + #endif /* __ARM64_KVM_HOST_H__ */ diff --git a/arch/arm64/kvm/reset.c b/arch/arm64/kvm/reset.c index e37c78bbe1ca..b0c07dab5cb3 100644 --- a/arch/arm64/kvm/reset.c +++ b/arch/arm64/kvm/reset.c @@ -133,3 +133,10 @@ int kvm_reset_vcpu(struct kvm_vcpu *vcpu) /* Reset timer */ return kvm_timer_vcpu_reset(vcpu); } + +int kvm_arm_config_vm(struct kvm *kvm, unsigned long type) +{ + if (type) + return -EINVAL; + return 0; +} diff --git a/virt/kvm/arm/arm.c b/virt/kvm/arm/arm.c index c92053bc3f96..327d0fd28380 100644 --- a/virt/kvm/arm/arm.c +++ b/virt/kvm/arm/arm.c @@ -120,8 +120,9 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type) { int ret, cpu; - if (type) - return -EINVAL; + ret = kvm_arm_config_vm(kvm, type); + if (ret) + return ret; kvm->arch.last_vcpu_ran = alloc_percpu(typeof(*kvm->arch.last_vcpu_ran)); if (!kvm->arch.last_vcpu_ran) -- 2.19.0