From patchwork Tue Nov 19 21:49:40 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Clark Laughlin X-Patchwork-Id: 21642 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yh0-f70.google.com (mail-yh0-f70.google.com [209.85.213.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 458A623A4E for ; Tue, 19 Nov 2013 21:51:49 +0000 (UTC) Received: by mail-yh0-f70.google.com with SMTP id l109sf1806982yhq.9 for ; Tue, 19 Nov 2013 13:51:48 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=SiJ4BVSGytGWkYamh1wbshgQNd/3vZuPSeocaPr7tUE=; b=K/gIIwOpNlglb0rL6td2Gauq0EZH0Rhhsd8JB3f5YdX6Ub2zYt7P2C3MRTOZ8v/kYu aPN3kt+rJUkxsRGl4q7l2RRBvjGMv9gsPOpkl/cciYl369g/Y+rxSnp0GfbbqeCVFLAJ ttPsOAqC6UqpMow5q//NcfDvwEte6IIb34DC+2kz0vpgxZ55YuSZIQMmwswzcCKE/CKg YZh1V6QHJih+9n2VLj0ZmoaVk4K7vbrS9Zm2woDMtAhGIF0jGiCepbr6H01b3BaSdwww 0bJJzm4MRXF+AC9YcLeG7oeGc4hAszW6gooZEFeQa0ZwdtVQvuTKA6fhMwmN8N9mRfjB b7cg== X-Gm-Message-State: ALoCoQliiWL7WMmNiyimLWkZU/dc4YmMVTHy7nKeHokGBhvBsP9e43K9nwWQZu6uscbkvY3xM+dg X-Received: by 10.236.147.18 with SMTP id s18mr15849742yhj.28.1384897908859; Tue, 19 Nov 2013 13:51:48 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.127.46 with SMTP id nd14ls605659qeb.19.gmail; Tue, 19 Nov 2013 13:51:48 -0800 (PST) X-Received: by 10.52.165.131 with SMTP id yy3mr3182548vdb.25.1384897908767; Tue, 19 Nov 2013 13:51:48 -0800 (PST) Received: from mail-vc0-f171.google.com (mail-vc0-f171.google.com [209.85.220.171]) by mx.google.com with ESMTPS id td8si8424134vdc.131.2013.11.19.13.51.48 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 19 Nov 2013 13:51:48 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.171 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.171; Received: by mail-vc0-f171.google.com with SMTP id lc6so5150001vcb.2 for ; Tue, 19 Nov 2013 13:51:48 -0800 (PST) X-Received: by 10.220.159.4 with SMTP id h4mr22564896vcx.1.1384897908666; Tue, 19 Nov 2013 13:51:48 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp309308vcz; Tue, 19 Nov 2013 13:51:48 -0800 (PST) X-Received: by 10.60.134.42 with SMTP id ph10mr390115oeb.76.1384897907952; Tue, 19 Nov 2013 13:51:47 -0800 (PST) Received: from mail-oa0-f54.google.com (mail-oa0-f54.google.com [209.85.219.54]) by mx.google.com with ESMTPS id bx5si15993710oec.78.2013.11.19.13.51.47 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 19 Nov 2013 13:51:47 -0800 (PST) Received-SPF: neutral (google.com: 209.85.219.54 is neither permitted nor denied by best guess record for domain of clark.laughlin@linaro.org) client-ip=209.85.219.54; Received: by mail-oa0-f54.google.com with SMTP id h16so3585478oag.41 for ; Tue, 19 Nov 2013 13:51:47 -0800 (PST) X-Received: by 10.182.44.134 with SMTP id e6mr27092781obm.14.1384897907003; Tue, 19 Nov 2013 13:51:47 -0800 (PST) Received: from localhost.localdomain (c-98-197-6-227.hsd1.tx.comcast.net. [98.197.6.227]) by mx.google.com with ESMTPSA id ee7sm40708092oeb.5.2013.11.19.13.51.45 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 19 Nov 2013 13:51:46 -0800 (PST) From: Clark Laughlin To: libvir-list@redhat.com Cc: crobinso@redhat.com, patches@linaro.org, Clark Laughlin Subject: [RESEND PATCH] qemu: Add support for virt machine type with virtio-mmio devices on armv7 Date: Tue, 19 Nov 2013 21:49:40 +0000 Message-Id: <1384897780-30589-1-git-send-email-clark.laughlin@linaro.org> X-Mailer: git-send-email 1.8.1.2 X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: clark.laughlin@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.171 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , These changes allow the correct virtio-blk-device and virtio-net-device devices to be used for the 'virt' machine type for armv7 rather than the PCI virtio devices. A test case was added to qemuxml2argvtest for this change. Signed-off-by: Clark Laughlin --- Resend with test case added --- src/qemu/qemu_command.c | 4 +- src/qemu/qemu_domain.c | 3 ++ .../qemuxml2argv-arm-virt-virtio.args | 14 +++++++ .../qemuxml2argv-arm-virt-virtio.xml | 45 ++++++++++++++++++++++ tests/qemuxml2argvtest.c | 5 +++ 5 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-arm-virt-virtio.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-arm-virt-virtio.xml diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 63e235d..901120e 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -1335,12 +1335,14 @@ cleanup: return ret; } + static int qemuDomainAssignARMVirtioMMIOAddresses(virDomainDefPtr def, virQEMUCapsPtr qemuCaps) { if (def->os.arch == VIR_ARCH_ARMV7L && - STRPREFIX(def->os.machine, "vexpress-") && + (STRPREFIX(def->os.machine, "vexpress-") || + STREQ(def->os.machine, "virt")) && virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_MMIO)) { qemuDomainPrimeVirtioDeviceAddresses( def, VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_MMIO); diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 81d0ba9..346fec3 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -797,6 +797,9 @@ qemuDomainDefaultNetModel(const virDomainDef *def) if (STREQ(def->os.machine, "versatilepb")) return "smc91c111"; + if (STREQ(def->os.machine, "virt")) + return "virtio"; + /* Incomplete. vexpress (and a few others) use this, but not all * arm boards */ return "lan9118"; diff --git a/tests/qemuxml2argvdata/qemuxml2argv-arm-virt-virtio.args b/tests/qemuxml2argvdata/qemuxml2argv-arm-virt-virtio.args new file mode 100644 index 0000000..5206ad8 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-arm-virt-virtio.args @@ -0,0 +1,14 @@ +LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \ +/usr/bin/qemu-system-arm -S -M virt -m 1024 -smp 1 -nographic \ +-nodefconfig -nodefaults -monitor unix:/tmp/test-monitor,server,nowait \ +-boot c -kernel /arm.kernel -initrd /arm.initrd -append \ +'console=ttyAMA0,115200n8 rw root=/dev/vda rootwait physmap.enabled=0' \ +-dtb /arm.dtb -device virtio-serial-device,id=virtio-serial0 -usb \ +-drive file=/arm.raw,if=none,id=drive-virtio-disk0 \ +-device virtio-blk-device,drive=drive-virtio-disk0,id=virtio-disk0 \ +-device virtio-net-device,vlan=0,id=net0,mac=52:54:00:09:a4:37 \ +-net user,vlan=0,name=hostnet0 -serial pty -chardev pty,id=charconsole1 \ +-device virtconsole,chardev=charconsole1,id=console1 \ +-device virtio-balloon-device,id=balloon0 \ +-object rng-random,id=rng0,filename=/dev/random \ +-device virtio-rng-device,rng=rng0 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-arm-virt-virtio.xml b/tests/qemuxml2argvdata/qemuxml2argv-arm-virt-virtio.xml new file mode 100644 index 0000000..913c96e --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-arm-virt-virtio.xml @@ -0,0 +1,45 @@ + + armtest + 496d7ea8-9739-544b-4ebd-ef08be936e6a + 1048576 + 1048576 + 1 + + hvm + /arm.kernel + /arm.initrd + /arm.dtb + console=ttyAMA0,115200n8 rw root=/dev/vda rootwait physmap.enabled=0 + + + + + + + + destroy + restart + restart + + /usr/bin/qemu-system-arm + + + + + + + + + + + + + + + + /dev/random + + + diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index b14e713..fde78bc 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1103,6 +1103,11 @@ mymain(void) QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE_VIRTIO_MMIO, QEMU_CAPS_DEVICE_VIRTIO_RNG, QEMU_CAPS_OBJECT_RNG_RANDOM); + DO_TEST("arm-virt-virtio", + QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DTB, + QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE_VIRTIO_MMIO, + QEMU_CAPS_DEVICE_VIRTIO_RNG, QEMU_CAPS_OBJECT_RNG_RANDOM); + virObjectUnref(driver.config); virObjectUnref(driver.caps); virObjectUnref(driver.xmlopt);