From patchwork Wed Jan 23 21:32:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 156417 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp1202236jaa; Wed, 23 Jan 2019 13:34:20 -0800 (PST) X-Google-Smtp-Source: ALg8bN7KDMXC+fBVnnbV+cJ33F/bu/QpbP5kWzrojWjBnU6sIU4tFf/Cj/fjllvjIATPaeVeYx+n X-Received: by 2002:ac8:2dc3:: with SMTP id q3mr4233996qta.178.1548279260323; Wed, 23 Jan 2019 13:34:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548279260; cv=none; d=google.com; s=arc-20160816; b=NjH2M0SbN1QTif9nhBDDyqTLt/QgUMWZ6dVgehSQlGbMuI4A+kkCg0nZ48VOW3YRpW CzNDe5+f2jJenrz9TVMDIp4RjukvUcqD8FIn2mBep3Ok4kJNaIQ17Ln3zIUDXbBmVFFF nU720RJBbB/i/ObxW0VkDw8tIroJqiewjDFcePDsmML/biTZyTf8iipZSH7OjNgzxFOi RtK9glfPpT/Oi3RewQUx07QpawZ1fdzpfJRPkPNWCDtvhHn8fP8puhsRMQp/d33RxRbG I1lA5ry8FGM29A1oFtsy4UDKNJy8IndhnfjJ7/Tt9UXDS+rRLninPNpRvXzg4TPM8ZAS UlUA== 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 :mime-version:references:in-reply-to:message-id:date:to:from :delivered-to; bh=YveCdWjdingCf0vEPdhg5pwC2FDdKByV75hl7fNaTdQ=; b=OPRWEsoCkG9o8dnPQKahLF0WfBC+Kd9jV/zuQEQ4NdGOeJHp+cwGElozH0x1bXSZUw UDswBU8b2e4ZNghGmIAyobBXkRcv4bC7iNJIiQQMm8sT4cfWPBmE51KV/gttKIgRJldK 8DfRX1/zF9VH1oE8uRW9XTAiggblLyBWREpz8MqkLt++TapKxjHfC8DtmyVLVNGVyOtn h4nBDLVa122Cs1sUrpgJRqonO0YyCCD06MsU1s6I3cgt4fTsP4htdPuYTwDSucaCrg2c ZkGMpnIMkeP25wS/VIy7I6ongdAE0CjN2YePVcg5goSlswr8U6FzeJqOAhY03q1XnSPg sUhg== 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 e186si8330989qkf.27.2019.01.23.13.34.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 Jan 2019 13:34:20 -0800 (PST) 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 288587EBC5; Wed, 23 Jan 2019 21:34:18 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DB4D86C1F1; Wed, 23 Jan 2019 21:34:17 +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 716B918033A1; Wed, 23 Jan 2019 21:34:17 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x0NLYF5k032670 for ; Wed, 23 Jan 2019 16:34:15 -0500 Received: by smtp.corp.redhat.com (Postfix) id 422B1BA9E; Wed, 23 Jan 2019 21:34:15 +0000 (UTC) Delivered-To: libvirt-list@redhat.com Received: from worklaptop.redhat.com (ovpn-120-34.rdu2.redhat.com [10.10.120.34]) by smtp.corp.redhat.com (Postfix) with ESMTP id A236065F72; Wed, 23 Jan 2019 21:34:13 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Wed, 23 Jan 2019 16:32:50 -0500 Message-Id: <3b52eb01e5c90f4c1ada71a5eefe63e5acd72c2e.1548278586.git.crobinso@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 22/25] qemu: Support input model=virtio-{non-}transitional 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.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Wed, 23 Jan 2019 21:34:18 +0000 (UTC) Add model handling for virtio transitional devices. Ex: ... * "virtio-transitional" maps to qemu "virtio-input-host-pci-transitional" * "virtio-non-transitional" maps to qemu "virtio-input-host-non-transitional" Signed-off-by: Cole Robinson --- src/qemu/qemu_command.c | 10 +++++++++- src/qemu/qemu_domain_address.c | 13 ++++++++++++- .../virtio-non-transitional.x86_64-3.1.0.args | 4 ++-- .../virtio-non-transitional.x86_64-latest.args | 4 ++-- .../virtio-transitional.x86_64-3.1.0.args | 7 +++---- .../virtio-transitional.x86_64-latest.args | 7 +++---- tests/qemuxml2xmloutdata/virtio-transitional.xml | 9 ++------- 7 files changed, 33 insertions(+), 21 deletions(-) -- 2.20.1 -- 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_command.c b/src/qemu/qemu_command.c index 9d64c7d7b0..a5c11956ed 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -516,8 +516,16 @@ qemuBuildVirtioDevStr(virBufferPtr buf, ntmodel_cap = QEMU_CAPS_DEVICE_VHOST_VSOCK_PCI_NON_TRANSITIONAL; break; - case VIR_DOMAIN_DEVICE_LEASE: case VIR_DOMAIN_DEVICE_INPUT: + if (device.data.input->type != VIR_DOMAIN_INPUT_TYPE_PASSTHROUGH) + return 0; + has_tmodel = device.data.input->model == VIR_DOMAIN_INPUT_MODEL_VIRTIO_TRANSITIONAL; + has_ntmodel = device.data.input->model == VIR_DOMAIN_INPUT_MODEL_VIRTIO_NON_TRANSITIONAL; + tmodel_cap = QEMU_CAPS_DEVICE_VIRTIO_INPUT_HOST_PCI_TRANSITIONAL; + ntmodel_cap = QEMU_CAPS_DEVICE_VIRTIO_INPUT_HOST_PCI_NON_TRANSITIONAL; + break; + + case VIR_DOMAIN_DEVICE_LEASE: case VIR_DOMAIN_DEVICE_SOUND: case VIR_DOMAIN_DEVICE_VIDEO: case VIR_DOMAIN_DEVICE_WATCHDOG: diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c index 4767b7aadc..7878d827de 100644 --- a/src/qemu/qemu_domain_address.c +++ b/src/qemu/qemu_domain_address.c @@ -919,7 +919,18 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDeviceDefPtr dev, case VIR_DOMAIN_DEVICE_INPUT: switch ((virDomainInputBus) dev->data.input->bus) { case VIR_DOMAIN_INPUT_BUS_VIRTIO: - return virtioFlags; + switch ((virDomainInputModel) dev->data.input->model) { + case VIR_DOMAIN_INPUT_MODEL_VIRTIO_TRANSITIONAL: + /* Transitional devices only work in conventional PCI slots */ + return pciFlags; + case VIR_DOMAIN_INPUT_MODEL_VIRTIO: + case VIR_DOMAIN_INPUT_MODEL_VIRTIO_NON_TRANSITIONAL: + case VIR_DOMAIN_INPUT_MODEL_DEFAULT: + return virtioFlags; + case VIR_DOMAIN_INPUT_MODEL_LAST: + break; + } + return 0; case VIR_DOMAIN_INPUT_BUS_PS2: case VIR_DOMAIN_INPUT_BUS_USB: diff --git a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args index 9130572abe..0f5de86315 100644 --- a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args +++ b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args @@ -42,8 +42,8 @@ fsdev=fsdev-fs0,mount_tag=fs1,bus=pci.1,addr=0x0 \ -netdev user,id=hostnet0 \ -device virtio-net-pci,disable-legacy=on,disable-modern=off,netdev=hostnet0,\ id=net0,mac=00:11:22:33:44:55,bus=pci.2,addr=0x0 \ --device virtio-input-host-pci,id=input0,evdev=/dev/input/event1234,bus=pci.7,\ -addr=0x0 \ +-device virtio-input-host-pci,disable-legacy=on,disable-modern=off,id=input0,\ +evdev=/dev/input/event1234,bus=pci.7,addr=0x0 \ -device vhost-scsi-pci,disable-legacy=on,disable-modern=off,\ wwpn=naa.5123456789abcde0,vhostfd=3,id=hostdev0,bus=pci.4,addr=0x0 \ -device virtio-balloon-pci,disable-legacy=on,disable-modern=off,id=balloon0,\ diff --git a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args index 8e0709816b..383b29f629 100644 --- a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args +++ b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args @@ -42,8 +42,8 @@ bus=pci.1,addr=0x0 \ -netdev user,id=hostnet0 \ -device virtio-net-pci-non-transitional,netdev=hostnet0,id=net0,\ mac=00:11:22:33:44:55,bus=pci.2,addr=0x0 \ --device virtio-input-host-pci,id=input0,evdev=/dev/input/event1234,bus=pci.7,\ -addr=0x0 \ +-device virtio-input-host-pci-non-transitional,id=input0,\ +evdev=/dev/input/event1234,bus=pci.7,addr=0x0 \ -device vhost-scsi-pci-non-transitional,wwpn=naa.5123456789abcde0,vhostfd=3,\ id=hostdev0,bus=pci.4,addr=0x0 \ -device virtio-balloon-pci-non-transitional,id=balloon0,bus=pci.5,addr=0x0 \ diff --git a/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args b/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args index 06fe70bb11..8046e5c102 100644 --- a/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args +++ b/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args @@ -27,7 +27,6 @@ file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ addr=0x1 \ -device pcie-pci-bridge,id=pci.2,bus=pci.1,addr=0x0 \ -device pcie-root-port,port=0x9,chassis=3,id=pci.3,bus=pcie.0,addr=0x1.0x1 \ --device pcie-root-port,port=0xa,chassis=4,id=pci.4,bus=pcie.0,addr=0x1.0x2 \ -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \ -device virtio-blk-pci,scsi=off,bus=pci.2,addr=0x3,drive=drive-virtio-disk0,\ id=virtio-disk0,bootindex=1 \ @@ -36,8 +35,8 @@ id=virtio-disk0,bootindex=1 \ -netdev user,id=hostnet0 \ -device virtio-net-pci,netdev=hostnet0,id=net0,mac=00:11:22:33:44:55,bus=pci.2,\ addr=0x2 \ --device virtio-input-host-pci,id=input0,evdev=/dev/input/event1234,bus=pci.3,\ -addr=0x0 \ +-device virtio-input-host-pci,id=input0,evdev=/dev/input/event1234,bus=pci.2,\ +addr=0x7 \ -device vhost-scsi-pci,wwpn=naa.5123456789abcde0,vhostfd=3,id=hostdev0,\ bus=pci.2,addr=0x4 \ -device virtio-balloon-pci,id=balloon0,bus=pci.2,addr=0x5 \ @@ -45,5 +44,5 @@ bus=pci.2,addr=0x4 \ -device virtio-rng-pci,rng=objrng0,id=rng0,bus=pci.2,addr=0x6 \ -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\ resourcecontrol=deny \ --device vhost-vsock-pci,id=vsock0,guest-cid=4,vhostfd=6789,bus=pci.2,addr=0x7 \ +-device vhost-vsock-pci,id=vsock0,guest-cid=4,vhostfd=6789,bus=pci.2,addr=0x8 \ -msg timestamp=on diff --git a/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args b/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args index 24b49e6009..410eb28f0a 100644 --- a/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args +++ b/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args @@ -27,7 +27,6 @@ file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ addr=0x1 \ -device pcie-pci-bridge,id=pci.2,bus=pci.1,addr=0x0 \ -device pcie-root-port,port=0x9,chassis=3,id=pci.3,bus=pcie.0,addr=0x1.0x1 \ --device pcie-root-port,port=0xa,chassis=4,id=pci.4,bus=pcie.0,addr=0x1.0x2 \ -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \ -device virtio-blk-pci-transitional,scsi=off,bus=pci.2,addr=0x3,\ drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \ @@ -37,8 +36,8 @@ bus=pci.2,addr=0x1 \ -netdev user,id=hostnet0 \ -device virtio-net-pci-transitional,netdev=hostnet0,id=net0,\ mac=00:11:22:33:44:55,bus=pci.2,addr=0x2 \ --device virtio-input-host-pci,id=input0,evdev=/dev/input/event1234,bus=pci.3,\ -addr=0x0 \ +-device virtio-input-host-pci-transitional,id=input0,\ +evdev=/dev/input/event1234,bus=pci.2,addr=0x7 \ -device vhost-scsi-pci-transitional,wwpn=naa.5123456789abcde0,vhostfd=3,\ id=hostdev0,bus=pci.2,addr=0x4 \ -device virtio-balloon-pci-transitional,id=balloon0,bus=pci.2,addr=0x5 \ @@ -47,5 +46,5 @@ id=hostdev0,bus=pci.2,addr=0x4 \ -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\ resourcecontrol=deny \ -device vhost-vsock-pci-transitional,id=vsock0,guest-cid=4,vhostfd=6789,\ -bus=pci.2,addr=0x7 \ +bus=pci.2,addr=0x8 \ -msg timestamp=on diff --git a/tests/qemuxml2xmloutdata/virtio-transitional.xml b/tests/qemuxml2xmloutdata/virtio-transitional.xml index b0da885c79..c944f0d9f8 100644 --- a/tests/qemuxml2xmloutdata/virtio-transitional.xml +++ b/tests/qemuxml2xmloutdata/virtio-transitional.xml @@ -39,11 +39,6 @@
- - - -
- @@ -56,7 +51,7 @@ -
+
@@ -73,7 +68,7 @@ -
+