Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp662085imm; Fri, 29 Jun 2018 04:25:40 -0700 (PDT) X-Google-Smtp-Source: ADUXVKL/c1j8I5l5kdxHpNObFMqeeJ9mb8kligqKEHg3ErrDtlcJNu5P0p/lTTHcsgtnU/a74NRT X-Received: by 2002:a17:902:c85:: with SMTP id 5-v6mr14531822plt.126.1530271540391; Fri, 29 Jun 2018 04:25:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530271540; cv=none; d=google.com; s=arc-20160816; b=d1J6j7JAAIsXoCa/RDpJH824SPqFXuMhqI4ian7Kv/vXbvBBCaQ106qBL8zSqTwkyc fk1iN5dLfOmKMISnfgwxnoctn3NS0kTJ+TMnoHQhWkHz74+Pqo7UW1pPluQ1GPx8H4X9 vYYcAPRkU8UgJgeL5R96qzTkS4VMwcbDdQWV658TEP4GWrvHQh9RqQK1uMUvXg8lst8r HNpoF674gmbl5U9RLUfthroXEpTCR4p1lDQFfIBeNTDat9vS10Fa3F+QZ4QaSUaq53KP IhvyFjrrJ9lae8YVDPfimUEjOIAU9Uh7DS47ojjmAwGaX/tvcx7Wzhf/Col1dtVsvFDw Kquw== 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:arc-authentication-results; bh=bBXyOEM+oNXqWQzY2LLDkE3KOd7jGKrced+23/T53sg=; b=E+t5O8t1s5Hh0s/JXXHWHS/E/tpCF7A9YFypcHJ0XOH5kWoxAPlpwbn4PfWTt1X5N7 TE1VQuCGVkRBPB1FUJ0neHBljniF9FKzof5jJpJnEYnmerUIDTX53id0ZuxE9Vh+LPI9 My7WVxBpXt0hcOC0wKjk5KVJkB4tGo+W1Uoe7iT9VMaqwfHUpMKgu6pzG6BpUJk9zGmH dj5T7KB5Phese5elffy9m2ru8S36maXc1us4x/UubCOFuWm9iUmAis9MdeLy0Eiq2Dz2 8mExfCN/KX9pNvVX4gq/RqBsMny757uY23zO8kkjUz7GLP3bGFmKcX6MAJQPzOyLgZVe Mjgw== 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 w1-v6si5973094pgw.546.2018.06.29.04.25.26; Fri, 29 Jun 2018 04:25:40 -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 S1755273AbeF2LSZ (ORCPT + 99 others); Fri, 29 Jun 2018 07:18:25 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:60352 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935971AbeF2LRK (ORCPT ); Fri, 29 Jun 2018 07:17:10 -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 1339A1684; Fri, 29 Jun 2018 04:17:10 -0700 (PDT) Received: from en101.cambridge.arm.com (en101.cambridge.arm.com [10.1.206.73]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id A78903F266; Fri, 29 Jun 2018 04:17:07 -0700 (PDT) From: Suzuki K Poulose To: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu, james.morse@arm.com, marc.zyngier@arm.com, cdall@kernel.org, eric.auger@redhat.com, julien.grall@arm.com, will.deacon@arm.com, catalin.marinas@arm.com, punit.agrawal@arm.com, qemu-devel@nongnu.org, Suzuki K Poulose Subject: [kvmtool test PATCH 21/24] kvmtool: Allow backends to run checks on the KVM device fd Date: Fri, 29 Jun 2018 12:15:41 +0100 Message-Id: <1530270944-11351-22-git-send-email-suzuki.poulose@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1530270944-11351-1-git-send-email-suzuki.poulose@arm.com> References: <1530270944-11351-1-git-send-email-suzuki.poulose@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Allow architectures to perform initialisation based on the KVM device fd ioctls, even before the VM is created. Signed-off-by: Suzuki K Poulose --- include/kvm/kvm.h | 4 ++++ kvm.c | 2 ++ 2 files changed, 6 insertions(+) diff --git a/include/kvm/kvm.h b/include/kvm/kvm.h index 90463b8..a036dd2 100644 --- a/include/kvm/kvm.h +++ b/include/kvm/kvm.h @@ -103,6 +103,10 @@ int kvm__get_sock_by_instance(const char *name); int kvm__enumerate_instances(int (*callback)(const char *name, int pid)); void kvm__remove_socket(const char *name); +#ifndef kvm__arch_init_hyp +static inline void kvm__arch_init_hyp(struct kvm *kvm) {} +#endif + void kvm__arch_set_cmdline(char *cmdline, bool video); void kvm__arch_init(struct kvm *kvm, const char *hugetlbfs_path, u64 ram_size); void kvm__arch_delete_ram(struct kvm *kvm); diff --git a/kvm.c b/kvm.c index f8f2fdc..b992e74 100644 --- a/kvm.c +++ b/kvm.c @@ -304,6 +304,8 @@ int kvm__init(struct kvm *kvm) goto err_sys_fd; } + kvm__arch_init_hyp(kvm); + kvm->vm_fd = ioctl(kvm->sys_fd, KVM_CREATE_VM, KVM_VM_TYPE); if (kvm->vm_fd < 0) { pr_err("KVM_CREATE_VM ioctl"); -- 2.7.4