From patchwork Mon Jun 26 18:01:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 106380 Delivered-To: patch@linaro.org Received: by 10.140.101.48 with SMTP id t45csp282961qge; Mon, 26 Jun 2017 11:09:48 -0700 (PDT) X-Received: by 10.55.200.196 with SMTP id t65mr1973943qkl.240.1498500588944; Mon, 26 Jun 2017 11:09:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1498500588; cv=none; d=google.com; s=arc-20160816; b=h9RO7lRAyiHzfD8QRslLROkbRELc/FLNAJHP+Oz01J+UJPeIhOzvKRNRsLXSGrJmKw 8+yvaaAzuzpXkXMw4QJoQs6em1P14gYsfTlgd217YEJgqxDC4FVAH3d2cfSklhCXE8VJ 7PErJHrAv2zB5b3lytUFOjR8OuHMD0BaMNv/WN2+oZ/fvk7b/DmiglbqJl4zXeUTK262 53eMkoqzKfCVX5vltnzLsfhzomqSrwQ1PKHAICfIWCJ6ua7B4ls9GcV871VAXsptcvT5 QGSk6OjnVwn1hudJuGx8ThNitHuM77zLIAwhCv1vptGP4s33Q0pyr0LS9d9pM38QkGF2 2zJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:references:in-reply-to:references :in-reply-to:message-id:date:to:from:delivered-to:dkim-filter :dmarc-filter:arc-authentication-results; bh=Tzk78iur8NPaGLcXXMRpp+Wnrk11iEEACpFz9Kx5h5I=; b=VxbGpam7tm78p0+dMJrktkAcnOC5DOFOFrZphsVKfb6UcKHfssxXL2vVmj5jocAd/S gG3bbsvYR1+s/HMSJYoOHGPwU7un74ozhXTwnz0y0dUP2fFmySOZUboNO+FRVflj9bCG CCk8KL7ChvMu9I/ATXJjyEVK2MycnCepzFr+qNSwLUpsTIcM3gk62rELKxY+Av/m1aQb ouBCsVWf72lLBmHV7TvtBvG1lNUouJ+ayMmZ62eGRYLaIeD5OGj/tD4hhWg13S/HRAiy Ogq4VwbjrSIG84JK2YAq+0A8iXKnXLtRpGM/ZFmp4e3A0poNdYXW7RjlEs27a7Q5hbwm ARnQ== 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 f42si702463qki.128.2017.06.26.11.09.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 26 Jun 2017 11:09:48 -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-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 35F6F81241; Mon, 26 Jun 2017 18:09:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 35F6F81241 Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 35F6F81241 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 F2C455F90D; Mon, 26 Jun 2017 18:09:46 +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 9BBD7282; Mon, 26 Jun 2017 18:09:46 +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 v5QI3QAI008147 for ; Mon, 26 Jun 2017 14:03:26 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6BE896BF6C; Mon, 26 Jun 2017 18:03:26 +0000 (UTC) Delivered-To: libvir-list@redhat.com Received: from worklaptop.redhat.com (ovpn-117-115.phx2.redhat.com [10.3.117.115]) by smtp.corp.redhat.com (Postfix) with ESMTP id 77EBA18C70; Mon, 26 Jun 2017 18:03:23 +0000 (UTC) From: Cole Robinson To: libvir-list@redhat.com Date: Mon, 26 Jun 2017 14:01:53 -0400 Message-Id: <3755681e5042a9d88cc5f63217d96333e580a97c.1498499392.git.crobinso@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: cdall@linaro.org, drjones@redhat.com, riku.voipio@linaro.org, Andrea Bolognani Subject: [libvirt] [PATCH 12/12] qemu: Rename SupportsChardev to IsPlatformDevice 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: , MIME-Version: 1.0 Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Mon, 26 Jun 2017 18:09:48 +0000 (UTC) This is only used in qemu_command.c, so move it, and clarify that it's really about identifying if the serial config is a platform device or not. Signed-off-by: Cole Robinson --- src/qemu/qemu_capabilities.c | 31 ------------------------------- src/qemu/qemu_capabilities.h | 4 ---- src/qemu/qemu_command.c | 34 ++++++++++++++++++++++++++++++++-- 3 files changed, 32 insertions(+), 37 deletions(-) -- 2.13.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list Reviewed-by: Andrea Bolognani diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index a20f405c2..db9f9b8b1 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -5550,37 +5550,6 @@ virQEMUCapsCacheFree(virQEMUCapsCachePtr cache) bool -virQEMUCapsSupportsChardev(const virDomainDef *def, - virQEMUCapsPtr qemuCaps ATTRIBUTE_UNUSED, - virDomainChrDefPtr chr) -{ - if ((def->os.arch == VIR_ARCH_PPC) || ARCH_IS_PPC64(def->os.arch)) { - if (!qemuDomainIsPSeries(def)) - return false; - /* only pseries need -device spapr-vty with -chardev */ - if (chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL && - chr->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO) - return false; - return true; - } - - if ((def->os.arch == VIR_ARCH_ARMV7L) || - (def->os.arch == VIR_ARCH_AARCH64)) { - /* TARGET_TYPE_ISA here really means 'the default', which we - treat as whatever the built in platform serial device is on. - And for platform devices we can't use -chardev */ - if (chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL && - chr->targetType == VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA) - return false; - - return true; - } - - return true; -} - - -bool virQEMUCapsSupportsVmport(virQEMUCapsPtr qemuCaps, const virDomainDef *def) { diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index 829cbaadb..fb22815e9 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -525,10 +525,6 @@ int virQEMUCapsGetDefaultVersion(virCapsPtr caps, VIR_ENUM_DECL(virQEMUCaps); -bool virQEMUCapsSupportsChardev(const virDomainDef *def, - virQEMUCapsPtr qemuCaps, - virDomainChrDefPtr chr); - bool virQEMUCapsSupportsGICVersion(virQEMUCapsPtr qemuCaps, virDomainVirtType virtType, virGICVersion version); diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 3e82ca086..d6fd2f2b6 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -9101,6 +9101,36 @@ qemuBuildChrDeviceCommandLine(virCommandPtr cmd, } +static bool +qemuChrIsPlatformDevice(const virDomainDef *def, + virDomainChrDefPtr chr) +{ + if ((def->os.arch == VIR_ARCH_PPC) || ARCH_IS_PPC64(def->os.arch)) { + if (!qemuDomainIsPSeries(def)) + return true; + /* only pseries need -device spapr-vty with -chardev */ + if (chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL && + chr->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO) + return true; + return false; + } + + if ((def->os.arch == VIR_ARCH_ARMV7L) || + (def->os.arch == VIR_ARCH_AARCH64)) { + /* TARGET_TYPE_ISA here really means 'the default', which we + treat as whatever the built in platform serial device is on. + And for platform devices we can't use -chardev */ + if (chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL && + chr->targetType == VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA) + return true; + + return false; + } + + return false; +} + + static int qemuBuildSerialCommandLine(virLogManagerPtr logManager, virCommandPtr cmd, @@ -9136,8 +9166,8 @@ qemuBuildSerialCommandLine(virLogManagerPtr logManager, virCommandAddArg(cmd, devstr); VIR_FREE(devstr); - /* Use -chardev with -device if they are available */ - if (virQEMUCapsSupportsChardev(def, qemuCaps, serial)) { + /* If the device is not a platform device, build the devstr */ + if (!qemuChrIsPlatformDevice(def, serial)) { if (qemuBuildChrDeviceCommandLine(cmd, def, serial, qemuCaps) < 0) return -1; } else {