From patchwork Thu Jan 2 10:42:56 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: PranavkumarSawargaonkar X-Patchwork-Id: 22862 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pa0-f72.google.com (mail-pa0-f72.google.com [209.85.220.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id B57E7202E2 for ; Thu, 2 Jan 2014 10:43:26 +0000 (UTC) Received: by mail-pa0-f72.google.com with SMTP id rd3sf45142132pab.3 for ; Thu, 02 Jan 2014 02:43:25 -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=bg4f51w7Z27HRN/keVAFU7xbPR1ICpBEQcHUb48bqS0=; b=CESQT3rGLkHuF1D/an2F+uLQqiU3aaS4RFheQCuipDHQcRjlxR7aYa6CRQO7Fq8fHx Gzj0gMEDqqy+tXMKUuEKUSGsC6SnsrPn32fkkt8kMGdh8sFXcEHN6A1Y/GG7RjQG5jeO yJwHJx9fUBzvrox7eEklJTUAOKxmM/0vU8xW2HBHfKuafIE1J8NGN5GmCKmwCZTlO2cw hBov7f22hd0ZA45Jf6H3Ag7FOxvTbkVaszZomuE+3h+5E4SbJYOArsVjXOna4bIwbWP4 2shiKIMNwkpFScK/4caaSrCHMx9hvZ034Jf+6M40CVBVwqUN448WbWut1C+ET4KwdS5c NdVg== X-Gm-Message-State: ALoCoQmfOCtUkaUrdfXA7KmvtmIIs6n7Xa7TunuybkWpggU354QTOzNoWtd0o6x2b1LXoxN3xC6U X-Received: by 10.68.104.163 with SMTP id gf3mr33039649pbb.7.1388659405681; Thu, 02 Jan 2014 02:43:25 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.15.70 with SMTP id v6ls4496525qec.47.gmail; Thu, 02 Jan 2014 02:43:25 -0800 (PST) X-Received: by 10.58.49.67 with SMTP id s3mr28866ven.75.1388659405508; Thu, 02 Jan 2014 02:43:25 -0800 (PST) Received: from mail-ve0-f170.google.com (mail-ve0-f170.google.com [209.85.128.170]) by mx.google.com with ESMTPS id we7si22542118vcb.7.2014.01.02.02.43.25 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 02 Jan 2014 02:43:25 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.170 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.170; Received: by mail-ve0-f170.google.com with SMTP id oy12so7306590veb.29 for ; Thu, 02 Jan 2014 02:43:25 -0800 (PST) X-Received: by 10.220.248.202 with SMTP id mh10mr91232vcb.70.1388659405402; Thu, 02 Jan 2014 02:43:25 -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.59.13.131 with SMTP id ey3csp762363ved; Thu, 2 Jan 2014 02:43:24 -0800 (PST) X-Received: by 10.68.130.39 with SMTP id ob7mr87841189pbb.63.1388659404193; Thu, 02 Jan 2014 02:43:24 -0800 (PST) Received: from mail-pa0-f41.google.com (mail-pa0-f41.google.com [209.85.220.41]) by mx.google.com with ESMTPS id ob10si42108227pbb.247.2014.01.02.02.43.23 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 02 Jan 2014 02:43:24 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.41 is neither permitted nor denied by best guess record for domain of pranavkumar@linaro.org) client-ip=209.85.220.41; Received: by mail-pa0-f41.google.com with SMTP id lf10so14488720pab.28 for ; Thu, 02 Jan 2014 02:43:23 -0800 (PST) X-Received: by 10.66.140.40 with SMTP id rd8mr88100089pab.119.1388659403505; Thu, 02 Jan 2014 02:43:23 -0800 (PST) Received: from pnqlab006.amcc.com ([182.73.239.130]) by mx.google.com with ESMTPSA id ic7sm100928499pbc.29.2014.01.02.02.43.19 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 02 Jan 2014 02:43:22 -0800 (PST) From: Pranavkumar Sawargaonkar To: libvirt-list@redhat.com Cc: crobinso@redhat.com, berrange@redhat.com, patches@apm.com, patches@linaro.org, Pranavkumar Sawargaonkar , Anup Patel Subject: [PATCH V3] AArch64: Porting of armv7l conditons to run qemu for aarch64. Date: Thu, 2 Jan 2014 16:12:56 +0530 Message-Id: <1388659376-9167-1-git-send-email-pranavkumar@linaro.org> X-Mailer: git-send-email 1.7.9.5 X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: pranavkumar@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.170 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: , AArch64 qemu has similar behavior as armv7l, like use of mmio etc. This patch adds similar bypass checks what we have for armv7l to aarch64. E.g. we are enabling mmio transport for Nicdev. Making addDefaultUSB and addDefaultMemballoon to false etc. V3: - Adding missing domain rng schema for aarcg64 and test case in testutilsqemu.c which was causing test suite failure while running make check. V2: - Added testcase to qemuxml2argvtest as suggested during review comments of V1. V1: - Initial patch. Signed-off-by: Anup Patel Signed-off-by: Pranavkumar Sawargaonkar --- docs/schemas/domaincommon.rng | 19 +++++++++ src/qemu/qemu_capabilities.c | 2 +- src/qemu/qemu_command.c | 8 ++-- src/qemu/qemu_domain.c | 4 ++ .../qemuxml2argv-aarch64-virt-virtio.args | 14 ++++++ .../qemuxml2argv-aarch64-virt-virtio.xml | 45 ++++++++++++++++++++ tests/qemuxml2argvtest.c | 5 +++ tests/testutilsqemu.c | 30 +++++++++++++ 8 files changed, 123 insertions(+), 4 deletions(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-virtio.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-virtio.xml diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index be32c6b..86a60c9 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -305,6 +305,7 @@ + hvm @@ -432,6 +433,24 @@ + + + + + + aarch64 + + + + + + + [a-zA-Z0-9_\.\-]+ + + + + + diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 4f64f87..ed182e0 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -2917,7 +2917,7 @@ virQEMUCapsSupportsChardev(virDomainDefPtr def, !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) return false; - if (def->os.arch != VIR_ARCH_ARMV7L) + if ((def->os.arch != VIR_ARCH_ARMV7L) && (def->os.arch != VIR_ARCH_AARCH64)) return true; /* This may not be true for all ARM machine types, but at least diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index d723dc8..2c66718 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -427,7 +427,8 @@ qemuDomainSupportsNicdev(virDomainDefPtr def, return false; /* non-virtio ARM nics require legacy -net nic */ - if (def->os.arch == VIR_ARCH_ARMV7L && + if (((def->os.arch == VIR_ARCH_ARMV7L) || + (def->os.arch == VIR_ARCH_AARCH64)) && net->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_MMIO) return false; @@ -1340,7 +1341,8 @@ static int qemuDomainAssignARMVirtioMMIOAddresses(virDomainDefPtr def, virQEMUCapsPtr qemuCaps) { - if (def->os.arch == VIR_ARCH_ARMV7L && + if (((def->os.arch == VIR_ARCH_ARMV7L) || + (def->os.arch == VIR_ARCH_AARCH64)) && (STRPREFIX(def->os.machine, "vexpress-") || STREQ(def->os.machine, "virt")) && virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_MMIO)) { @@ -1872,7 +1874,7 @@ cleanup: static bool qemuDomainSupportsPCI(virDomainDefPtr def) { - if (def->os.arch != VIR_ARCH_ARMV7L) + if ((def->os.arch != VIR_ARCH_ARMV7L) && (def->os.arch != VIR_ARCH_AARCH64)) return true; if (STREQ(def->os.machine, "versatilepb")) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index e964c75..c947e2e 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -727,6 +727,10 @@ qemuDomainDefPostParse(virDomainDefPtr def, addDefaultUSB = false; addDefaultMemballoon = false; break; + case VIR_ARCH_AARCH64: + addDefaultUSB = false; + addDefaultMemballoon = false; + break; case VIR_ARCH_ALPHA: case VIR_ARCH_PPC: diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-virtio.args b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-virtio.args new file mode 100644 index 0000000..afd6e41 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-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-aarch64 -S -M virt -m 1024 -smp 1 -nographic \ +-nodefconfig -nodefaults -monitor unix:/tmp/test-monitor,server,nowait \ +-boot c -kernel /aarch64.kernel -initrd /aarch64.initrd -append \ +'earlyprintk console=ttyAMA0,115200n8 rw root=/dev/vda rootwait' \ +-dtb /aarch64.dtb -device virtio-serial-device,id=virtio-serial0 -usb \ +-drive file=/aarch64.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-aarch64-virt-virtio.xml b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-virtio.xml new file mode 100644 index 0000000..184b62c --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-virtio.xml @@ -0,0 +1,45 @@ + + aarch64test + 496d7ea8-9739-544b-4ebd-ef08be936e8b + 1048576 + 1048576 + 1 + + hvm + /aarch64.kernel + /aarch64.initrd + /aarch64.dtb + earlyprintk console=ttyAMA0,115200n8 rw root=/dev/vda rootwait + + + + + + + + destroy + restart + restart + + /usr/bin/qemu-system-aarch64 + + + + + + + + + + + + + + + + /dev/random + + + diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 847e96f..e451387 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1301,6 +1301,11 @@ mymain(void) QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE_VIRTIO_MMIO, QEMU_CAPS_DEVICE_VIRTIO_RNG, QEMU_CAPS_OBJECT_RNG_RANDOM); + DO_TEST("aarch64-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); + DO_TEST("kvm-pit-device", QEMU_CAPS_KVM_PIT_TICK_POLICY); DO_TEST("kvm-pit-delay", QEMU_CAPS_NO_KVM_PIT); DO_TEST("kvm-pit-device", QEMU_CAPS_NO_KVM_PIT, diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c index 92433ef..44e7e9d 100644 --- a/tests/testutilsqemu.c +++ b/tests/testutilsqemu.c @@ -175,6 +175,33 @@ error: return -1; } +static int testQemuAddAARCH64Guest(virCapsPtr caps) +{ + static const char *machines[] = { "virt"}; + virCapsGuestMachinePtr *capsmachines = NULL; + virCapsGuestPtr guest; + + capsmachines = virCapabilitiesAllocMachines(machines, + ARRAY_CARDINALITY(machines)); + if (!capsmachines) + goto error; + + guest = virCapabilitiesAddGuest(caps, "hvm", VIR_ARCH_AARCH64, + "/usr/bin/qemu-system-aarch64", NULL, + ARRAY_CARDINALITY(machines), + capsmachines); + if (!guest) + goto error; + + if (!virCapabilitiesAddGuestDomain(guest, "qemu", NULL, NULL, 0, NULL)) + goto error; + + return 0; + +error: + virCapabilitiesFreeMachines(capsmachines, ARRAY_CARDINALITY(machines)); + return -1; +} virCapsPtr testQemuCapsInit(void) { virCapsPtr caps; @@ -303,6 +330,9 @@ virCapsPtr testQemuCapsInit(void) { if (testQemuAddArmGuest(caps)) goto cleanup; + if (testQemuAddAARCH64Guest(caps)) + goto cleanup; + if (virTestGetDebug()) { char *caps_str;