From nobody Sun Feb 8 22:06:16 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) client-ip=63.128.21.74; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-74.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1585066546; cv=none; d=zohomail.com; s=zohoarc; b=f8P0soeVjaEFcAiKJY5SU5zD8SVz/rlLFC+TasQp0OUife6v6FRkuSlJwzBkDs4YFmTd62/4pvA2WGkPYD8ccHKf6abjvnTgaHCpKuxSH/REkdDk/qNhBsQOtm+++1OFB+vPbZsI8UBwsFsqVfq/DZHxviGkqaueu89RicBq0YA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585066546; h=Content-Type:Content-Transfer-Encoding:Cc: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=MnNlAVGSXP3vWMGBO7oi+8f8JNbpdDn1H+JytcbiTHw=; b=aLojrzN8g/BMymuy4itrOIbgpmRTvrShWsLP61HFI8EocLyYBCcKBDXtCPK8SfTigrlwCV+KATFCuWnTDwTYaywciaKa+fGw3r4bGH8Jv9DpnY/LWBVODMFuW6XgI7uF1LKze/4Wb3U3F4ZQ05Ga1uRmcSUaR0AWak+zfJudutk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-74.mimecast.com (us-smtp-delivery-74.mimecast.com [63.128.21.74]) by mx.zohomail.com with SMTPS id 1585066546809340.59519134311563; Tue, 24 Mar 2020 09:15:46 -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-26-tekbqRHXP32--VU37kxB1w-1; Tue, 24 Mar 2020 12:15:40 -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 28694DBA8; Tue, 24 Mar 2020 16:15: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 E6A231000322; Tue, 24 Mar 2020 16:15:34 +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 8ACAE86382; Tue, 24 Mar 2020 16:15:34 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02OGFR5d029531 for ; Tue, 24 Mar 2020 12:15:27 -0400 Received: by smtp.corp.redhat.com (Postfix) id 46D5E2063FEA; Tue, 24 Mar 2020 16:15:27 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast02.extmail.prod.ext.rdu2.redhat.com [10.11.55.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4218C2063FE7 for ; Tue, 24 Mar 2020 16:15:22 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id BE8268007CB for ; Tue, 24 Mar 2020 16:15:22 +0000 (UTC) Received: from mail-wr1-f67.google.com (mail-wr1-f67.google.com [209.85.221.67]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-488-LhOV8QTTP0ioD9UnWIMB6Q-1; Tue, 24 Mar 2020 12:15:14 -0400 Received: by mail-wr1-f67.google.com with SMTP id s1so22215504wrv.5 for ; Tue, 24 Mar 2020 09:15:14 -0700 (PDT) Received: from localhost.localdomain (public-gprs375156.centertel.pl. [37.47.96.181]) by smtp.gmail.com with ESMTPSA id r17sm762028wrx.46.2020.03.24.09.15.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Mar 2020 09:15:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585066545; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=MnNlAVGSXP3vWMGBO7oi+8f8JNbpdDn1H+JytcbiTHw=; b=A1/suXzOtHlEFfgc9WofXspEKkYXh2UM/LjOV2U2awEtR0/Y1ETEudTXkWOxfhO+mtPscW 5LPavaSC97mywqc+Q5iOFRThUouWxnhCWKF1dI1bvYI5XWnJ8NJFzuBGhYVMREaUWSo/IF TZeiGkba4MMTfnwU/easy3kqHZ56Zps= X-MC-Unique: tekbqRHXP32--VU37kxB1w-1 X-MC-Unique: LhOV8QTTP0ioD9UnWIMB6Q-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=GXD94sgVfh8einRzCjApLn5NTBvI7kbwsWC6p25sY1g=; b=cSOLd+sRyawlFBKVWRYjul3hwNiod/pdAl96vyHkoZBfv/ZKq97rnV932DDHt3XlPM v7sUEv+GL41yAgYPK9Tkpfn2dYjNPnUf02s8Y8cgwKwOYr8h1R/0CYpDkgs02iERld8/ s2k9Tw9VXkUqrZcpjVkJvNTHmqjzcMoi1ASly+uVr957vHRaaZkqHLHZZXKMejXJjQrH 3gL/Zi4jHRCrmQm8bQtUK0TZkU6zX0zba35ftIAiwViUbnXFi3ihwO+Dz6tVR3sBxwj/ 4MYMbIMVZL44xIZ5bjVW0rkdApg+xRfwW1nObeXZPIxQRCT12UQQDJpXEHXYto2RNlDf oC9w== X-Gm-Message-State: ANhLgQ2IwivSzB1lvaxxglO3AXEcVmewvtGFFTC7a7rTJUmlHw+keOAx BzYOFNVprvGy3Nq9p9m/sOXQ9YRuBGQ= X-Google-Smtp-Source: ADFU+vvZ17YNxVBk36Lfm+nsQrJApc1cEXP6H9v2CLvOlYWNLqoS47NUBy31OcsNkQu1uc2C7G8rLg== X-Received: by 2002:a5d:468c:: with SMTP id u12mr23569485wrq.394.1585066512853; Tue, 24 Mar 2020 09:15:12 -0700 (PDT) From: Rafael Fonseca To: libvir-list@redhat.com Subject: [PATCH 2/7] libxl: move video default logic to driver Date: Tue, 24 Mar 2020 17:14:31 +0100 Message-Id: <20200324161436.2138755-3-r4f4rfs@gmail.com> In-Reply-To: <20200324161436.2138755-1-r4f4rfs@gmail.com> References: <20200324161436.2138755-1-r4f4rfs@gmail.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 02OGFR5d029531 X-loop: libvir-list@redhat.com Cc: Rafael Fonseca 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 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" The logic setting a device default should be in the post parse function of individual driver code. Signed-off-by: Rafael Fonseca --- src/conf/domain_conf.c | 2 +- src/libxl/libxl_domain.c | 60 ++++++++++++++++++++++++---------------- 2 files changed, 37 insertions(+), 25 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 957989e848..04636e8694 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -15716,7 +15716,6 @@ virDomainVideoDefaultType(const virDomainDef *def) { switch ((virDomainVirtType)def->virtType) { case VIR_DOMAIN_VIRT_TEST: - case VIR_DOMAIN_VIRT_XEN: if (def->os.type =3D=3D VIR_DOMAIN_OSTYPE_XEN || def->os.type =3D=3D VIR_DOMAIN_OSTYPE_LINUX) return VIR_DOMAIN_VIDEO_TYPE_XEN; @@ -15737,6 +15736,7 @@ virDomainVideoDefaultType(const virDomainDef *def) return VIR_DOMAIN_VIDEO_TYPE_VGA; else return VIR_DOMAIN_VIDEO_TYPE_PARALLELS; + case VIR_DOMAIN_VIRT_XEN: case VIR_DOMAIN_VIRT_BHYVE: case VIR_DOMAIN_VIRT_QEMU: case VIR_DOMAIN_VIRT_KQEMU: diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c index e3da9f777d..cc53a765e1 100644 --- a/src/libxl/libxl_domain.c +++ b/src/libxl/libxl_domain.c @@ -315,31 +315,43 @@ libxlDomainDeviceDefPostParse(virDomainDeviceDefPtr d= ev, pcisrc->backend =3D VIR_DOMAIN_HOSTDEV_PCI_BACKEND_XEN; } =20 - if (dev->type =3D=3D VIR_DOMAIN_DEVICE_VIDEO && def->os.type =3D=3D VI= R_DOMAIN_OSTYPE_HVM) { - int dm_type =3D libxlDomainGetEmulatorType(def); - - switch (dev->data.video->type) { - case VIR_DOMAIN_VIDEO_TYPE_VGA: - case VIR_DOMAIN_VIDEO_TYPE_XEN: - if (dev->data.video->vram =3D=3D 0) { - if (dm_type =3D=3D LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN) - dev->data.video->vram =3D 16 * 1024; - else - dev->data.video->vram =3D 8 * 1024; - } - break; - case VIR_DOMAIN_VIDEO_TYPE_CIRRUS: - if (dev->data.video->vram =3D=3D 0) { - if (dm_type =3D=3D LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN) - dev->data.video->vram =3D 8 * 1024; - else - dev->data.video->vram =3D 4 * 1024; + if (dev->type =3D=3D VIR_DOMAIN_DEVICE_VIDEO) { + if (dev->data.video->type =3D=3D VIR_DOMAIN_VIDEO_TYPE_DEFAULT) { + if (def->os.type =3D=3D VIR_DOMAIN_OSTYPE_XEN || + def->os.type =3D=3D VIR_DOMAIN_OSTYPE_LINUX) + dev->data.video->type =3D VIR_DOMAIN_VIDEO_TYPE_XEN; + else if (ARCH_IS_PPC64(def->os.arch)) + dev->data.video->type =3D VIR_DOMAIN_VIDEO_TYPE_VGA; + else + dev->data.video->type =3D VIR_DOMAIN_VIDEO_TYPE_CIRRUS; + } + + if (def->os.type =3D=3D VIR_DOMAIN_OSTYPE_HVM) { + int dm_type =3D libxlDomainGetEmulatorType(def); + + switch (dev->data.video->type) { + case VIR_DOMAIN_VIDEO_TYPE_VGA: + case VIR_DOMAIN_VIDEO_TYPE_XEN: + if (dev->data.video->vram =3D=3D 0) { + if (dm_type =3D=3D LIBXL_DEVICE_MODEL_VERSION_QEMU= _XEN) + dev->data.video->vram =3D 16 * 1024; + else + dev->data.video->vram =3D 8 * 1024; + } + break; + case VIR_DOMAIN_VIDEO_TYPE_CIRRUS: + if (dev->data.video->vram =3D=3D 0) { + if (dm_type =3D=3D LIBXL_DEVICE_MODEL_VERSION_QEMU= _XEN) + dev->data.video->vram =3D 8 * 1024; + else + dev->data.video->vram =3D 4 * 1024; + } + break; + case VIR_DOMAIN_VIDEO_TYPE_QXL: + if (dev->data.video->vram =3D=3D 0) + dev->data.video->vram =3D 128 * 1024; + break; } - break; - case VIR_DOMAIN_VIDEO_TYPE_QXL: - if (dev->data.video->vram =3D=3D 0) - dev->data.video->vram =3D 128 * 1024; - break; } } =20 --=20 2.25.1