From patchwork Fri Aug 23 16:21:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 172120 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp886186ily; Fri, 23 Aug 2019 09:22:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqzN/1U+hmW/bwadViCEgpZqa+soNlDSVIZgjEPAc004RVCLeOR/gml+dduBaG15gnFvc8a7 X-Received: by 2002:aed:3f47:: with SMTP id q7mr5556097qtf.209.1566577357009; Fri, 23 Aug 2019 09:22:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566577357; cv=none; d=google.com; s=arc-20160816; b=PoWa8N2ijw36Hq9vMoM4giX73UbcKKl6GOwwBK7z5PCThaLbXJ7Wi9hT11OcDwSlKp 3FaL40OKlTHBUpC7Ohz9nQSqd54nkx9xGMVjHzbvUKP/Vn/KNx/U0RWFbrmYj8tl+3pS n8SqOaWZrVf4bsh4yXbbWkCni+rk1EHTP7LCqQL8XO5qmg7yiMMYa4la3qEt1RuUwmbU kgc7F3pESifDLb2XMiyXoPpNJUdUK1u8cVYYMp8nIx0mYQMj35xO5NgiXHQxQJOKdbwQ rwDPSpBnBn9614ZpFskTTZfrt2PbyU0S5BJYkSvd7YKH3n5DRWJ/YJAGIc4rRiPCdrlE 5T4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :cc:mime-version:references:in-reply-to:message-id:date:to:from :delivered-to; bh=CZSTzLxG3IIVlltJ0sS2ngM32kw/yJ4UpNGYx2Y0+nA=; b=Ao1fdiIll27Zv/KmS4BX/usTKOxJxEeZ9GzaNV6JbT5RKdmy0VZN3omBu1stvHK3DP XW9Yv91z8nbXuUMbKXAlf/WsT3cghI1Mq8lR6YXuyjxC8ZjETAek8Ci9xOIqkscefsNz Du+jYP2pFYZNYbPtXmIn6mATBlXesfzrP3hWNC2zI3QnHdHcRJXE2qKx0KwBY2q1sWhi vs7mN+W33c454k0ju8AGmOpw5UFT0vtmQImfVGOoL7APxr2EI3uYPqo204z0YnyjG8nP PLHpTVCLBWNwYd1NqEfoQEc66aunBcVLZeII8qC2TdLLSMktuJrGx6Jly9xWkvdLoM0T +1Rw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28]) by mx.google.com with ESMTPS id f43si2263467qte.71.2019.08.23.09.22.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Aug 2019 09:22:36 -0700 (PDT) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; Authentication-Results: mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BAC448BA01; Fri, 23 Aug 2019 16:22:35 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 93D155C1B5; Fri, 23 Aug 2019 16:22:35 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 5A76C24F3B; Fri, 23 Aug 2019 16:22:35 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x7NGMBpb006067 for ; Fri, 23 Aug 2019 12:22:11 -0400 Received: by smtp.corp.redhat.com (Postfix) id 7975160A9F; Fri, 23 Aug 2019 16:22:11 +0000 (UTC) Delivered-To: libvirt-list@redhat.com Received: from worklaptop.redhat.com (ovpn-122-169.rdu2.redhat.com [10.10.122.169]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0478860872; Fri, 23 Aug 2019 16:22:10 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Fri, 23 Aug 2019 12:21:56 -0400 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Subject: [libvirt] [PATCH v2 12/16] qemu: prepare domain for vhost-user GPU X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Fri, 23 Aug 2019 16:22:36 +0000 (UTC) From: Marc-André Lureau Call qemuExtVhostUserGPUPrepareDomain() to fill the domain with the location of the vhost-user binary to start. Signed-off-by: Marc-André Lureau Signed-off-by: Cole Robinson --- src/qemu/qemu_extdevice.c | 29 +++++++++++++++++++++++++++++ src/qemu/qemu_extdevice.h | 5 +++++ src/qemu/qemu_process.c | 4 ++++ 3 files changed, 38 insertions(+) diff --git a/src/qemu/qemu_extdevice.c b/src/qemu/qemu_extdevice.c index dc032aa60c..5c55aba006 100644 --- a/src/qemu/qemu_extdevice.c +++ b/src/qemu/qemu_extdevice.c @@ -21,6 +21,7 @@ #include #include "qemu_extdevice.h" +#include "qemu_vhost_user_gpu.h" #include "qemu_domain.h" #include "qemu_tpm.h" @@ -92,6 +93,34 @@ qemuExtDevicesInitPaths(virQEMUDriverPtr driver, } +/* + * qemuExtDevicesPrepareDomain: + * + * @driver: QEMU driver + * @vm: domain + * + * Code that modifies live XML of a domain which is about to start. + */ +int +qemuExtDevicesPrepareDomain(virQEMUDriverPtr driver, + virDomainObjPtr vm) +{ + int ret = 0; + size_t i; + + for (i = 0; i < vm->def->nvideos; i++) { + virDomainVideoDefPtr video = vm->def->videos[i]; + + if (video->type == VIR_DOMAIN_VIDEO_TYPE_VIRTIO && video->vhostuser) { + if ((ret = qemuExtVhostUserGPUPrepareDomain(driver, video) < 0)) + break; + } + } + + return ret; +} + + /* * qemuExtDevicesPrepareHost: * diff --git a/src/qemu/qemu_extdevice.h b/src/qemu/qemu_extdevice.h index 039b3e60dd..2412244d60 100644 --- a/src/qemu/qemu_extdevice.h +++ b/src/qemu/qemu_extdevice.h @@ -29,6 +29,11 @@ int qemuExtDeviceLogCommand(qemuDomainLogContextPtr logCtxt, ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3) ATTRIBUTE_RETURN_CHECK; +int qemuExtDevicesPrepareDomain(virQEMUDriverPtr driver, + virDomainObjPtr vm) + ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) + ATTRIBUTE_RETURN_CHECK; + int qemuExtDevicesPrepareHost(virQEMUDriverPtr driver, virDomainDefPtr def) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index c439f17011..ed767b0807 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -6358,6 +6358,10 @@ qemuProcessPrepareDomain(virQEMUDriverPtr driver, if (qemuFirmwareFillDomain(driver, vm, flags) < 0) goto cleanup; + VIR_DEBUG("Preparing external devices"); + if (qemuExtDevicesPrepareDomain(driver, vm) < 0) + goto cleanup; + for (i = 0; i < vm->def->nchannels; i++) { if (qemuDomainPrepareChannel(vm->def->channels[i], priv->channelTargetDir) < 0)