Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp973748imm; Wed, 26 Sep 2018 09:35:02 -0700 (PDT) X-Google-Smtp-Source: ACcGV631ZN2kBeusn5Ob4/rgG2Fkn38P1WcaHp5sbQLbxyXGr78GdpGoQ35O94WC6246d752Fqt9 X-Received: by 2002:a63:de05:: with SMTP id f5-v6mr4744489pgg.292.1537979702271; Wed, 26 Sep 2018 09:35:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537979702; cv=none; d=google.com; s=arc-20160816; b=kSZoaqp2RUgvJMz4zjO6k5Wro0mLNEI6d4ibKWaignKoU9cPn5iR25BEa5bK7yfjzv tT8c1eUdK3GWT/WFN4wJn6DVxqVUeZxs2gucE6jRAUKYCQOY916KvBusLT7JY+y3Q8b5 RPfrWESblGByhjjJ/soT+BfK7iOzeVbonOXo+Tbg+IXAEX3CzE+n4AxinrKK4PJZy4e+ sW7ZJvUnNWkKLnh9ZNdApOvOR5F4DTrRPoqfvVQkpR+HN5Am8wBUH+IINXwsTKB8ZFKs osz8W3fIlOqvADNNJ3JpcnRkPhfuaYBEoBfLFaELIzK+sKyaeYR8PizP6voT0j8PlKEq W4Cg== 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=OhoqesarkKEwpxlTIPdfHNIc/y9tMvsW4y/hrtUvPOc=; b=tSdbmcCrytB4rbf+RpN5Bb5+fF/8qRjJg/ii/N3RnQn76pS80Dzu482yLRujlwxFaC aURjTRHmgRUkx6rEBt8j3MLhCerMLc2nnUpeO1KO0ZBoIA79BiEdyTkEvWiH/Hm4XP8z iLrG7qC9kLBjebGNPujBxu9OiiyY2X+pCd1PMYWJqPEi0hMqVPxGWfp42cjgAvmTL1bM bwqS1a+ZVji1Yi3fFGOrRVabPGRUTBLZXESzXVDSgzi60HZ8/jp2RB1DlQ3T8+kZByVN DAtd7HBrR7nn6qjHCTMygeH2tz/z/OMUetHRWKdYZScOMJ0J+2J30EDCUXQJBdeFkfac UzCA== 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 h14-v6si5606002pgg.540.2018.09.26.09.34.46; Wed, 26 Sep 2018 09:35:02 -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 S1729090AbeIZWsH (ORCPT + 99 others); Wed, 26 Sep 2018 18:48:07 -0400 Received: from foss.arm.com ([217.140.101.70]:50192 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728476AbeIZWsF (ORCPT ); Wed, 26 Sep 2018 18:48:05 -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 2B77722BE; Wed, 26 Sep 2018 09:34:20 -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 AC0853F5B3; Wed, 26 Sep 2018 09:34:17 -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, suzuki.poulose@arm.com, will.deacon@arm.com, dave.martin@arm.com, peter.maydell@linaro.org, pbonzini@redhat.com, rkrcmar@redhat.com, julien.grall@arm.com, linux-kernel@vger.kernel.org Subject: [kvmtool PATCH v6 19/18] kvmtool: Allow backends to run checks on the KVM device fd Date: Wed, 26 Sep 2018 17:32:55 +0100 Message-Id: <20180926163258.20218-20-suzuki.poulose@arm.com> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180926163258.20218-1-suzuki.poulose@arm.com> References: <20180926163258.20218-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 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 1edacfd..dc3f0dd 100644 --- a/include/kvm/kvm.h +++ b/include/kvm/kvm.h @@ -135,6 +135,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 7de825a..0894778 100644 --- a/kvm.c +++ b/kvm.c @@ -373,6 +373,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.19.0