From nobody Mon Feb 9 09:15:30 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1633620862; cv=none; d=zohomail.com; s=zohoarc; b=I+ls6hDYXbZSvn4C3XF9hddHVx3sGdVnr+jHCe/owinmixalQ3ptDZoRVBjTYSYfeIctm1LwAyH65bMBULk/e/vcp8k1MOIXnpWSnVC1PDG9jAGDFtm/BFcQv12SJSnWS7ry46WJHBxnUGsrYY1fEkmaoEOu/WQJbgVIF5BMnyA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633620862; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=MeAwHdFVVBWiB1b+Ca7rWf0hqMJsrBXDUnGLbFv/hm0=; b=QFiOfaSlL/mjpQN5KDkACLYLU/Ceq9id/4D8loOEBYkMuU1s1kXempLPlJWVngEZdEpclu1B9PLp8PFv4vzLE33WwqngB4dXQfcadC6Zq62YK0mnum9z3Hwqs1QiZUc04VeWdfmu5hKV0acj/CzURVU85Vtab+Ow2hj4yEP8CGQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1633620862079798.0365908239438; Thu, 7 Oct 2021 08:34:22 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-3-zxVHkLM-OCGMQu49XgRuAA-1; Thu, 07 Oct 2021 11:34:19 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 946081A230B9; Thu, 7 Oct 2021 15:27:21 +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 711E712ADA0E; Thu, 7 Oct 2021 15:27:21 +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 3FD5A4EA30; Thu, 7 Oct 2021 15:27:21 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 197FJFw3023876 for ; Thu, 7 Oct 2021 11:19:15 -0400 Received: by smtp.corp.redhat.com (Postfix) id CCF315D6BA; Thu, 7 Oct 2021 15:19:15 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.5]) by smtp.corp.redhat.com (Postfix) with ESMTP id 35ECB5D6D5 for ; Thu, 7 Oct 2021 15:19:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633620861; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=MeAwHdFVVBWiB1b+Ca7rWf0hqMJsrBXDUnGLbFv/hm0=; b=iEFdRSG20i6W2xv5KfEJoX7qWUa7fPGI3BMrQ0Qg5lzUo6LNLaxWXgcEIjh439ImL+9/Ve l2xFvtagkKPGSgo78aYOGKGp88BCm9DBUBcvkERgTno+e0eODobl9QXeXhgDabQd5esBUr CjioSuo/GjKbdSB+p0vPusYIHhdZli8= X-MC-Unique: zxVHkLM-OCGMQu49XgRuAA-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 037/103] qemuDeviceVideoGetModel: Clarify 'virtio' argument Date: Thu, 7 Oct 2021 17:17:25 +0200 Message-Id: <1336a02316abc8908666c783e1ef768588fe295d.1633619630.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com 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.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1633620864032100001 Content-Type: text/plain; charset="utf-8" The 'virito' argument was misleadingly implying that it's true for all virtio devices, but that's not the case. 'virtio-vga(-gl)' is a virtio device but doesn't accept the usual bus-dependant suffix. Add a comment for 'qemuDeviceVideoGetModel' and another boolean 'virtioBusSuffix' which carries the above meaning so that the 'virtio' argument can be fixed (it will be used later). Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_command.c | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index f185e3a53c..3c468ab0a4 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -4291,16 +4291,28 @@ qemuBuildSoundCommandLine(virCommand *cmd, } +/** + * qemuDeviceVideoGetModel: + * @qemuCaps: qemu capabilities + * @video: video device definition + * @virtio: the returned video device is a 'virtio' device + * @virtioBusSuffix: the returned device needs to get the bus-suffix + * + * Returns the model fo the device for @video and @qemuCaps. @virtio and + * @virtioBusSuffix are filled with the corresponding flags. + */ static const char * qemuDeviceVideoGetModel(virQEMUCaps *qemuCaps, const virDomainVideoDef *video, - bool *virtio) + bool *virtio, + bool *virtioBusSuffix) { const char *model =3D NULL; bool primaryVga =3D false; virTristateSwitch accel3d =3D VIR_TRISTATE_SWITCH_ABSENT; *virtio =3D false; + *virtioBusSuffix =3D false; if (video->accel) accel3d =3D video->accel->accel3d; @@ -4318,6 +4330,7 @@ qemuDeviceVideoGetModel(virQEMUCaps *qemuCaps, } else { model =3D "vhost-user-gpu"; *virtio =3D true; + *virtioBusSuffix =3D true; } } else { if (primaryVga) { @@ -4340,6 +4353,9 @@ qemuDeviceVideoGetModel(virQEMUCaps *qemuCaps, model =3D "virtio-vga-gl"; else model =3D "virtio-vga"; + + *virtio =3D true; + *virtioBusSuffix =3D false; break; case VIR_DOMAIN_VIDEO_TYPE_BOCHS: model =3D "bochs-display"; @@ -4367,7 +4383,9 @@ qemuDeviceVideoGetModel(virQEMUCaps *qemuCaps, model =3D "virtio-gpu-gl"; else model =3D "virtio-gpu"; + *virtio =3D true; + *virtioBusSuffix =3D true; break; case VIR_DOMAIN_VIDEO_TYPE_DEFAULT: case VIR_DOMAIN_VIDEO_TYPE_VGA: @@ -4406,14 +4424,15 @@ qemuBuildDeviceVideoStr(const virDomainDef *def, const char *model =3D NULL; virTristateSwitch accel3d =3D VIR_TRISTATE_SWITCH_ABSENT; bool virtio =3D false; + bool virtioBusSuffix =3D false; if (video->accel) accel3d =3D video->accel->accel3d; - if (!(model =3D qemuDeviceVideoGetModel(qemuCaps, video, &virtio))) + if (!(model =3D qemuDeviceVideoGetModel(qemuCaps, video, &virtio, &vir= tioBusSuffix))) return NULL; - if (virtio) { + if (virtioBusSuffix) { if (qemuBuildVirtioDevStr(&buf, model, qemuCaps, VIR_DOMAIN_DEVICE_VIDEO, video) < 0) { return NULL; --=20 2.31.1