Received: by 10.213.65.68 with SMTP id h4csp648995imn; Tue, 27 Mar 2018 06:20:22 -0700 (PDT) X-Google-Smtp-Source: AG47ELvpqgdS1FMll/OOn/EC1UhlfmfTr855NYeIBpFqs+wQQc/29DeBCld18846r6NPMP1c/3sp X-Received: by 10.167.129.195 with SMTP id c3mr36708062pfn.14.1522156822050; Tue, 27 Mar 2018 06:20:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522156822; cv=none; d=google.com; s=arc-20160816; b=Ml/ca+Da8rneum4Sfx6MaPU4d7TboL/OWqSQJqb/+6QZqlJplUrES+KzkTZPzgDxQq ZjbmxBWDz+Tgn6AmbvmdHnCyfiBL54mNb7Dvm6GZNIAmFTkM6BGr59ich3rR6/iDqOE3 eENd673khxcQq4AdaveGnHco+Kq6ig8w9MhMskFYJweHfy3EH2BrX2aNFxhu58UHRNRW 7WS/EzsJHEHJlQr7tswzbAjp3a2mliSx4H3znQBgyPaP4hHa/2ZQnSzxtHyU13Fsn58M cUZHYqdOmOhd5IIwktxh2yhVJhMmAG/BaA5LGKeve2PzQIkW+X26q8vZPXbDSOPxuhem 5I8A== 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=kpnNqGMD/nkZIFCrnUMEdFwrySw0r2j7jYBq3GVAxlk=; b=gIMU6zuIelPfUxgexe2u5BPdi1T34yDQPABpDvJcL4IMuaWLIChIUzz5cIYHMxCjEF hcic9aMfMPpMFB+/vjjDHnGldcUBnUH/a6jBh85HZTLAZZeoL6aAPemNRoXL32QAZhH2 dfgKuHaRKwHhtbkvprOn3CyPCyyopYlsYFPy+AoGZTMG1YtXSnXewA6ldH7N2YHsrSH5 yn/Ox0IjWlL1hlnT4bJTm6I1euxR+prMyrtE0GnxBYROdN3L1HhCS+ylqCMTH2deKU9D 9E9GmI6ycDtDf9Ia/SMILbD1Usg3iLWGF49S+d+RLx4l79Mys+9oETjc1/Y0KatpdC4Y ce3A== 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 o12-v6si1256038plg.715.2018.03.27.06.20.07; Tue, 27 Mar 2018 06:20:22 -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 S1753122AbeC0NSh (ORCPT + 99 others); Tue, 27 Mar 2018 09:18:37 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:55206 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752897AbeC0NQx (ORCPT ); Tue, 27 Mar 2018 09:16:53 -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 B555880D; Tue, 27 Mar 2018 06:16:53 -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 0F6243F24A; Tue, 27 Mar 2018 06:16:50 -0700 (PDT) From: Suzuki K Poulose To: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, cdall@kernel.org, marc.zyngier@arm.com, punit.agrawal@arm.com, will.deacon@arm.com, catalin.marinas@arm.com, pbonzini@redhat.com, rkrcmar@redhat.com, ard.biesheuvel@linaro.org, peter.maydell@linaro.org, kristina.martsenko@arm.com, mark.rutland@arm.com, Suzuki K Poulose Subject: [kvmtool PATCH 18/17] kvmtool: Allow backends to run checks on the KVM device fd Date: Tue, 27 Mar 2018 14:15:28 +0100 Message-Id: <1522156531-28348-19-git-send-email-suzuki.poulose@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1522156531-28348-1-git-send-email-suzuki.poulose@arm.com> References: <1522156531-28348-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"); -- 1.9.1