trivial patches for 2024-07-17
-----BEGIN PGP SIGNATURE----- iQEzBAABCAAdFiEEe3O61ovnosKJMUsicBtPaxppPlkFAmaXpakACgkQcBtPaxpp Plnvvwf8DdybFjyhAVmiG6+6WhB5s0hJhZRiWzUY6ieMbgPzCUgWzfr/pJh6q44x rw+aVfe2kf1ysycx3DjcJpucrC1rQD/qV6dB3IA1rxidBOZfCb8iZwoaB6yS9Epp 4uXIdfje4zO6oCMN17MTXvuQIEUK3ZHN0EQOs7vsA2d8/pHqBqRoixjz9KnKHlpk P6kyIXceZ4wLAtwFJqa/mBBRnpcSdaWuQpzpBsg1E3BXRXXfeuXJ8WmGp0kEOpzQ k7+2sPpuah2z7D+jNFBW0+3ZYDvO9Z4pomQ4al4w+DHDyWBF49WnnSdDSDbWwxI5 K0vUlsDVU8yTnIEgN8BL82F8eub5Ug== =ZYHJ -----END PGP SIGNATURE----- Merge tag 'pull-trivial-patches' of https://gitlab.com/mjt0k/qemu into staging trivial patches for 2024-07-17 # -----BEGIN PGP SIGNATURE----- # # iQEzBAABCAAdFiEEe3O61ovnosKJMUsicBtPaxppPlkFAmaXpakACgkQcBtPaxpp # Plnvvwf8DdybFjyhAVmiG6+6WhB5s0hJhZRiWzUY6ieMbgPzCUgWzfr/pJh6q44x # rw+aVfe2kf1ysycx3DjcJpucrC1rQD/qV6dB3IA1rxidBOZfCb8iZwoaB6yS9Epp # 4uXIdfje4zO6oCMN17MTXvuQIEUK3ZHN0EQOs7vsA2d8/pHqBqRoixjz9KnKHlpk # P6kyIXceZ4wLAtwFJqa/mBBRnpcSdaWuQpzpBsg1E3BXRXXfeuXJ8WmGp0kEOpzQ # k7+2sPpuah2z7D+jNFBW0+3ZYDvO9Z4pomQ4al4w+DHDyWBF49WnnSdDSDbWwxI5 # K0vUlsDVU8yTnIEgN8BL82F8eub5Ug== # =ZYHJ # -----END PGP SIGNATURE----- # gpg: Signature made Wed 17 Jul 2024 09:06:17 PM AEST # gpg: using RSA key 7B73BAD68BE7A2C289314B22701B4F6B1A693E59 # gpg: Good signature from "Michael Tokarev <mjt@tls.msk.ru>" [full] # gpg: aka "Michael Tokarev <mjt@debian.org>" [full] # gpg: aka "Michael Tokarev <mjt@corpit.ru>" [full] * tag 'pull-trivial-patches' of https://gitlab.com/mjt0k/qemu: meson: Update meson-buildoptions.sh backends/rng-random: Get rid of qemu_open_old() backends/iommufd: Get rid of qemu_open_old() backends/hostmem-epc: Get rid of qemu_open_old() hw/vfio/container: Get rid of qemu_open_old() hw/usb/u2f-passthru: Get rid of qemu_open_old() hw/usb/host-libusb: Get rid of qemu_open_old() hw/i386/sgx: Get rid of qemu_open_old() tests/avocado: Remove the non-working virtio_check_params test doc/net/l2tpv3: Update boolean fields' description to avoid short-form use target/hexagon/imported/mmvec: Fix superfluous trailing semicolon util/oslib-posix: Fix superfluous trailing semicolon hw/i386/x86: Fix superfluous trailing semicolon accel/kvm/kvm-all: Fix superfluous trailing semicolon README.rst: add the missing punctuations block/curl: rewrite http header parsing function Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
commit
d74ec4d7dd
@ -82,7 +82,7 @@ guidelines set out in the `style section
|
||||
the Developers Guide.
|
||||
|
||||
Additional information on submitting patches can be found online via
|
||||
the QEMU website
|
||||
the QEMU website:
|
||||
|
||||
* `<https://wiki.qemu.org/Contribute/SubmitAPatch>`_
|
||||
* `<https://wiki.qemu.org/Contribute/TrivialPatches>`_
|
||||
@ -102,7 +102,7 @@ requires a working 'git send-email' setup, and by default doesn't
|
||||
automate everything, so you may want to go through the above steps
|
||||
manually for once.
|
||||
|
||||
For installation instructions, please go to
|
||||
For installation instructions, please go to:
|
||||
|
||||
* `<https://github.com/stefanha/git-publish>`_
|
||||
|
||||
@ -159,7 +159,7 @@ Contact
|
||||
=======
|
||||
|
||||
The QEMU community can be contacted in a number of ways, with the two
|
||||
main methods being email and IRC
|
||||
main methods being email and IRC:
|
||||
|
||||
* `<mailto:qemu-devel@nongnu.org>`_
|
||||
* `<https://lists.nongnu.org/mailman/listinfo/qemu-devel>`_
|
||||
|
@ -3878,7 +3878,7 @@ static StatsList *add_kvmstat_entry(struct kvm_stats_desc *pdesc,
|
||||
/* Alloc and populate data list */
|
||||
stats = g_new0(Stats, 1);
|
||||
stats->name = g_strdup(pdesc->name);
|
||||
stats->value = g_new0(StatsValue, 1);;
|
||||
stats->value = g_new0(StatsValue, 1);
|
||||
|
||||
if ((pdesc->flags & KVM_STATS_UNIT_MASK) == KVM_STATS_UNIT_BOOLEAN) {
|
||||
stats->value->u.boolean = *stats_data;
|
||||
|
@ -29,10 +29,8 @@ sgx_epc_backend_memory_alloc(HostMemoryBackend *backend, Error **errp)
|
||||
return false;
|
||||
}
|
||||
|
||||
fd = qemu_open_old("/dev/sgx_vepc", O_RDWR);
|
||||
fd = qemu_open("/dev/sgx_vepc", O_RDWR, errp);
|
||||
if (fd < 0) {
|
||||
error_setg_errno(errp, errno,
|
||||
"failed to open /dev/sgx_vepc to alloc SGX EPC");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -77,9 +77,8 @@ bool iommufd_backend_connect(IOMMUFDBackend *be, Error **errp)
|
||||
int fd;
|
||||
|
||||
if (be->owned && !be->users) {
|
||||
fd = qemu_open_old("/dev/iommu", O_RDWR);
|
||||
fd = qemu_open("/dev/iommu", O_RDWR, errp);
|
||||
if (fd < 0) {
|
||||
error_setg_errno(errp, errno, "/dev/iommu opening failed");
|
||||
return false;
|
||||
}
|
||||
be->fd = fd;
|
||||
|
@ -75,10 +75,7 @@ static void rng_random_opened(RngBackend *b, Error **errp)
|
||||
error_setg(errp, QERR_INVALID_PARAMETER_VALUE,
|
||||
"filename", "a valid filename");
|
||||
} else {
|
||||
s->fd = qemu_open_old(s->filename, O_RDONLY | O_NONBLOCK);
|
||||
if (s->fd == -1) {
|
||||
error_setg_file_open(errp, errno, s->filename);
|
||||
}
|
||||
s->fd = qemu_open(s->filename, O_RDONLY | O_NONBLOCK, errp);
|
||||
}
|
||||
}
|
||||
|
||||
|
44
block/curl.c
44
block/curl.c
@ -210,37 +210,29 @@ static size_t curl_header_cb(void *ptr, size_t size, size_t nmemb, void *opaque)
|
||||
{
|
||||
BDRVCURLState *s = opaque;
|
||||
size_t realsize = size * nmemb;
|
||||
const char *header = (char *)ptr;
|
||||
const char *end = header + realsize;
|
||||
const char *accept_ranges = "accept-ranges:";
|
||||
const char *bytes = "bytes";
|
||||
const char *p = ptr;
|
||||
const char *end = p + realsize;
|
||||
const char *t = "accept-ranges : bytes "; /* A lowercase template */
|
||||
|
||||
if (realsize >= strlen(accept_ranges)
|
||||
&& g_ascii_strncasecmp(header, accept_ranges,
|
||||
strlen(accept_ranges)) == 0) {
|
||||
|
||||
char *p = strchr(header, ':') + 1;
|
||||
|
||||
/* Skip whitespace between the header name and value. */
|
||||
while (p < end && *p && g_ascii_isspace(*p)) {
|
||||
p++;
|
||||
}
|
||||
|
||||
if (end - p >= strlen(bytes)
|
||||
&& strncmp(p, bytes, strlen(bytes)) == 0) {
|
||||
|
||||
/* Check that there is nothing but whitespace after the value. */
|
||||
p += strlen(bytes);
|
||||
while (p < end && *p && g_ascii_isspace(*p)) {
|
||||
p++;
|
||||
}
|
||||
|
||||
if (p == end || !*p) {
|
||||
s->accept_range = true;
|
||||
/* check if header matches the "t" template */
|
||||
for (;;) {
|
||||
if (*t == ' ') { /* space in t matches any amount of isspace in p */
|
||||
if (p < end && g_ascii_isspace(*p)) {
|
||||
++p;
|
||||
} else {
|
||||
++t;
|
||||
}
|
||||
} else if (*t && p < end && *t == g_ascii_tolower(*p)) {
|
||||
++p, ++t;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!*t && p == end) { /* if we managed to reach ends of both strings */
|
||||
s->accept_range = true;
|
||||
}
|
||||
|
||||
return realsize;
|
||||
}
|
||||
|
||||
|
@ -157,10 +157,12 @@ SGXInfo *qmp_query_sgx_capabilities(Error **errp)
|
||||
{
|
||||
SGXInfo *info = NULL;
|
||||
uint32_t eax, ebx, ecx, edx;
|
||||
Error *local_err = NULL;
|
||||
|
||||
int fd = qemu_open_old("/dev/sgx_vepc", O_RDWR);
|
||||
int fd = qemu_open("/dev/sgx_vepc", O_RDWR, &local_err);
|
||||
if (fd < 0) {
|
||||
error_setg(errp, "SGX is not enabled in KVM");
|
||||
error_append_hint(&local_err, "SGX is not enabled in KVM");
|
||||
error_propagate(errp, local_err);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -242,7 +242,7 @@ static void x86_machine_get_pit(Object *obj, Visitor *v, const char *name,
|
||||
static void x86_machine_set_pit(Object *obj, Visitor *v, const char *name,
|
||||
void *opaque, Error **errp)
|
||||
{
|
||||
X86MachineState *x86ms = X86_MACHINE(obj);;
|
||||
X86MachineState *x86ms = X86_MACHINE(obj);
|
||||
|
||||
visit_type_OnOffAuto(v, name, &x86ms->pit, errp);
|
||||
}
|
||||
|
@ -1212,9 +1212,8 @@ static void usb_host_realize(USBDevice *udev, Error **errp)
|
||||
if (s->hostdevice) {
|
||||
int fd;
|
||||
s->needs_autoscan = false;
|
||||
fd = qemu_open_old(s->hostdevice, O_RDWR);
|
||||
fd = qemu_open(s->hostdevice, O_RDWR, errp);
|
||||
if (fd < 0) {
|
||||
error_setg_errno(errp, errno, "failed to open %s", s->hostdevice);
|
||||
return;
|
||||
}
|
||||
rc = usb_host_open(s, NULL, fd);
|
||||
|
@ -482,10 +482,8 @@ static void u2f_passthru_realize(U2FKeyState *base, Error **errp)
|
||||
return;
|
||||
#endif
|
||||
} else {
|
||||
fd = qemu_open_old(key->hidraw, O_RDWR);
|
||||
fd = qemu_open(key->hidraw, O_RDWR, errp);
|
||||
if (fd < 0) {
|
||||
error_setg(errp, "%s: Failed to open %s", TYPE_U2F_PASSTHRU,
|
||||
key->hidraw);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -600,9 +600,8 @@ static bool vfio_connect_container(VFIOGroup *group, AddressSpace *as,
|
||||
}
|
||||
}
|
||||
|
||||
fd = qemu_open_old("/dev/vfio/vfio", O_RDWR);
|
||||
fd = qemu_open("/dev/vfio/vfio", O_RDWR, errp);
|
||||
if (fd < 0) {
|
||||
error_setg_errno(errp, errno, "failed to open /dev/vfio/vfio");
|
||||
goto put_space_exit;
|
||||
}
|
||||
|
||||
@ -743,9 +742,8 @@ static VFIOGroup *vfio_get_group(int groupid, AddressSpace *as, Error **errp)
|
||||
group = g_malloc0(sizeof(*group));
|
||||
|
||||
snprintf(path, sizeof(path), "/dev/vfio/%d", groupid);
|
||||
group->fd = qemu_open_old(path, O_RDWR);
|
||||
group->fd = qemu_open(path, O_RDWR, errp);
|
||||
if (group->fd < 0) {
|
||||
error_setg_errno(errp, errno, "failed to open %s", path);
|
||||
goto free_group_exit;
|
||||
}
|
||||
|
||||
|
@ -3353,7 +3353,7 @@ SRST
|
||||
-device e1000,netdev=n1,mac=52:54:00:12:34:56 \\
|
||||
-netdev socket,id=n1,mcast=239.192.168.1:1102,localaddr=1.2.3.4
|
||||
|
||||
``-netdev l2tpv3,id=id,src=srcaddr,dst=dstaddr[,srcport=srcport][,dstport=dstport],txsession=txsession[,rxsession=rxsession][,ipv6=on|off][,udp=on|off][,cookie64][,counter][,pincounter][,txcookie=txcookie][,rxcookie=rxcookie][,offset=offset]``
|
||||
``-netdev l2tpv3,id=id,src=srcaddr,dst=dstaddr[,srcport=srcport][,dstport=dstport],txsession=txsession[,rxsession=rxsession][,ipv6=on|off][,udp=on|off][,cookie64=on|off][,counter=on|off][,pincounter=on|off][,txcookie=txcookie][,rxcookie=rxcookie][,offset=offset]``
|
||||
Configure a L2TPv3 pseudowire host network backend. L2TPv3 (RFC3931)
|
||||
is a popular protocol to transport Ethernet (and other Layer 2) data
|
||||
frames between two systems. It is present in routers, firewalls and
|
||||
@ -3368,7 +3368,7 @@ SRST
|
||||
``dst=dstaddr``
|
||||
destination address (mandatory)
|
||||
|
||||
``udp``
|
||||
``udp=on``
|
||||
select udp encapsulation (default is ip).
|
||||
|
||||
``srcport=srcport``
|
||||
@ -3377,7 +3377,7 @@ SRST
|
||||
``dstport=dstport``
|
||||
destination udp port.
|
||||
|
||||
``ipv6``
|
||||
``ipv6=on``
|
||||
force v6, otherwise defaults to v4.
|
||||
|
||||
``rxcookie=rxcookie``; \ ``txcookie=txcookie``
|
||||
@ -3385,7 +3385,7 @@ SRST
|
||||
Their function is mostly to prevent misconfiguration. By default
|
||||
they are 32 bit.
|
||||
|
||||
``cookie64``
|
||||
``cookie64=on``
|
||||
Set cookie size to 64 bit instead of the default 32
|
||||
|
||||
``counter=off``
|
||||
@ -3419,7 +3419,7 @@ SRST
|
||||
# launch QEMU instance - if your network has reorder or is very lossy add ,pincounter
|
||||
|
||||
|qemu_system| linux.img -device e1000,netdev=n1 \\
|
||||
-netdev l2tpv3,id=n1,src=4.2.3.1,dst=1.2.3.4,udp,srcport=16384,dstport=16384,rxsession=0xffffffff,txsession=0xffffffff,counter
|
||||
-netdev l2tpv3,id=n1,src=4.2.3.1,dst=1.2.3.4,udp=on,srcport=16384,dstport=16384,rxsession=0xffffffff,txsession=0xffffffff,counter=on
|
||||
|
||||
``-netdev vde,id=id[,sock=socketpath][,port=n][,group=groupname][,mode=octalmode]``
|
||||
Configure VDE backend to connect to PORT n of a vde switch running
|
||||
|
@ -83,7 +83,7 @@ meson_options_help() {
|
||||
printf "%s\n" ' (can be empty) [qemu]'
|
||||
printf "%s\n" ' --with-trace-file=VALUE Trace file prefix for simple backend [trace]'
|
||||
printf "%s\n" ' --x86-version=CHOICE tweak required x86_64 architecture version beyond'
|
||||
printf "%s\n" ' compiler default [1] (choices: 0/1/2/3)'
|
||||
printf "%s\n" ' compiler default [1] (choices: 0/1/2/3/4)'
|
||||
printf "%s\n" ''
|
||||
printf "%s\n" 'Optional features, enabled with --enable-FEATURE and'
|
||||
printf "%s\n" 'disabled with --disable-FEATURE, default is enabled if available'
|
||||
@ -166,6 +166,7 @@ meson_options_help() {
|
||||
printf "%s\n" ' qcow1 qcow1 image format support'
|
||||
printf "%s\n" ' qed qed image format support'
|
||||
printf "%s\n" ' qga-vss build QGA VSS support (broken with MinGW)'
|
||||
printf "%s\n" ' qpl Query Processing Library support'
|
||||
printf "%s\n" ' rbd Ceph block device driver'
|
||||
printf "%s\n" ' rdma Enable RDMA-based migration'
|
||||
printf "%s\n" ' replication replication support'
|
||||
@ -187,6 +188,7 @@ meson_options_help() {
|
||||
printf "%s\n" ' tools build support utilities that come with QEMU'
|
||||
printf "%s\n" ' tpm TPM support'
|
||||
printf "%s\n" ' u2f U2F emulation support'
|
||||
printf "%s\n" ' uadk UADK Library support'
|
||||
printf "%s\n" ' usb-redir libusbredir support'
|
||||
printf "%s\n" ' vde vde network backend support'
|
||||
printf "%s\n" ' vdi vdi image format support'
|
||||
@ -221,8 +223,6 @@ meson_options_help() {
|
||||
printf "%s\n" ' Xen PCI passthrough support'
|
||||
printf "%s\n" ' xkbcommon xkbcommon support'
|
||||
printf "%s\n" ' zstd zstd compression support'
|
||||
printf "%s\n" ' qpl Query Processing Library support'
|
||||
printf "%s\n" ' uadk UADK Library support'
|
||||
}
|
||||
_meson_option_parse() {
|
||||
case $1 in
|
||||
@ -440,6 +440,8 @@ _meson_option_parse() {
|
||||
--disable-qga-vss) printf "%s" -Dqga_vss=disabled ;;
|
||||
--enable-qom-cast-debug) printf "%s" -Dqom_cast_debug=true ;;
|
||||
--disable-qom-cast-debug) printf "%s" -Dqom_cast_debug=false ;;
|
||||
--enable-qpl) printf "%s" -Dqpl=enabled ;;
|
||||
--disable-qpl) printf "%s" -Dqpl=disabled ;;
|
||||
--enable-rbd) printf "%s" -Drbd=enabled ;;
|
||||
--disable-rbd) printf "%s" -Drbd=disabled ;;
|
||||
--enable-rdma) printf "%s" -Drdma=enabled ;;
|
||||
@ -501,6 +503,8 @@ _meson_option_parse() {
|
||||
--disable-tsan) printf "%s" -Dtsan=false ;;
|
||||
--enable-u2f) printf "%s" -Du2f=enabled ;;
|
||||
--disable-u2f) printf "%s" -Du2f=disabled ;;
|
||||
--enable-uadk) printf "%s" -Duadk=enabled ;;
|
||||
--disable-uadk) printf "%s" -Duadk=disabled ;;
|
||||
--enable-usb-redir) printf "%s" -Dusb_redir=enabled ;;
|
||||
--disable-usb-redir) printf "%s" -Dusb_redir=disabled ;;
|
||||
--enable-vde) printf "%s" -Dvde=enabled ;;
|
||||
@ -560,10 +564,6 @@ _meson_option_parse() {
|
||||
--disable-xkbcommon) printf "%s" -Dxkbcommon=disabled ;;
|
||||
--enable-zstd) printf "%s" -Dzstd=enabled ;;
|
||||
--disable-zstd) printf "%s" -Dzstd=disabled ;;
|
||||
--enable-qpl) printf "%s" -Dqpl=enabled ;;
|
||||
--disable-qpl) printf "%s" -Dqpl=disabled ;;
|
||||
--enable-uadk) printf "%s" -Duadk=enabled ;;
|
||||
--disable-uadk) printf "%s" -Duadk=disabled ;;
|
||||
*) return 1 ;;
|
||||
esac
|
||||
}
|
||||
|
@ -2855,7 +2855,7 @@ EXTINSN(V6_vscattermhw_add, "vscatter(Rt32,Mu2,Vvv32.w).h+=Vw32", ATTRIBS(A_EXT
|
||||
fVALIGN(RtV, element_size);
|
||||
fVFOREACH(32, i) {
|
||||
for(j = 0; j < 2; j++) {
|
||||
EA = RtV + fVALIGN(VvvV.v[j].uw[i],ALIGNMENT);;
|
||||
EA = RtV + fVALIGN(VvvV.v[j].uw[i],ALIGNMENT);
|
||||
fVLOG_VTCM_HALFWORD_INCREMENT_DV(EA,VvvV.v[j].uw[i],VwV,(2*i+j),i,j,ALIGNMENT,MuV);
|
||||
}
|
||||
}
|
||||
|
@ -1,143 +0,0 @@
|
||||
#
|
||||
# Test virtio-scsi and virtio-blk queue settings for all machine types
|
||||
#
|
||||
# Copyright (c) 2019 Virtuozzo International GmbH
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
import sys
|
||||
import os
|
||||
import re
|
||||
import logging
|
||||
|
||||
from qemu.machine import QEMUMachine
|
||||
from avocado_qemu import QemuSystemTest
|
||||
from avocado import skip
|
||||
|
||||
#list of machine types and virtqueue properties to test
|
||||
VIRTIO_SCSI_PROPS = {'seg_max_adjust': 'seg_max_adjust'}
|
||||
VIRTIO_BLK_PROPS = {'seg_max_adjust': 'seg-max-adjust'}
|
||||
|
||||
DEV_TYPES = {'virtio-scsi-pci': VIRTIO_SCSI_PROPS,
|
||||
'virtio-blk-pci': VIRTIO_BLK_PROPS}
|
||||
|
||||
VM_DEV_PARAMS = {'virtio-scsi-pci': ['-device', 'virtio-scsi-pci,id=scsi0'],
|
||||
'virtio-blk-pci': ['-device',
|
||||
'virtio-blk-pci,id=scsi0,drive=drive0',
|
||||
'-drive',
|
||||
'driver=null-co,id=drive0,if=none']}
|
||||
|
||||
|
||||
class VirtioMaxSegSettingsCheck(QemuSystemTest):
|
||||
@staticmethod
|
||||
def make_pattern(props):
|
||||
pattern_items = [r'{0} = \w+'.format(prop) for prop in props]
|
||||
return '|'.join(pattern_items)
|
||||
|
||||
def query_virtqueue(self, vm, dev_type_name):
|
||||
query_ok = False
|
||||
error = None
|
||||
props = None
|
||||
|
||||
output = vm.cmd('human-monitor-command',
|
||||
command_line = 'info qtree')
|
||||
props_list = DEV_TYPES[dev_type_name].values();
|
||||
pattern = self.make_pattern(props_list)
|
||||
res = re.findall(pattern, output)
|
||||
|
||||
if len(res) != len(props_list):
|
||||
props_list = set(props_list)
|
||||
res = set(res)
|
||||
not_found = props_list.difference(res)
|
||||
not_found = ', '.join(not_found)
|
||||
error = '({0}): The following properties not found: {1}'\
|
||||
.format(dev_type_name, not_found)
|
||||
else:
|
||||
query_ok = True
|
||||
props = dict()
|
||||
for prop in res:
|
||||
p = prop.split(' = ')
|
||||
props[p[0]] = p[1]
|
||||
return query_ok, props, error
|
||||
|
||||
def check_mt(self, mt, dev_type_name):
|
||||
mt['device'] = dev_type_name # Only for the debug() call.
|
||||
logger = logging.getLogger('machine')
|
||||
logger.debug(mt)
|
||||
with QEMUMachine(self.qemu_bin) as vm:
|
||||
vm.set_machine(mt["name"])
|
||||
vm.add_args('-nodefaults')
|
||||
for s in VM_DEV_PARAMS[dev_type_name]:
|
||||
vm.add_args(s)
|
||||
try:
|
||||
vm.launch()
|
||||
query_ok, props, error = self.query_virtqueue(vm, dev_type_name)
|
||||
except:
|
||||
query_ok = False
|
||||
error = sys.exc_info()[0]
|
||||
|
||||
if not query_ok:
|
||||
self.fail('machine type {0}: {1}'.format(mt['name'], error))
|
||||
|
||||
for prop_name, prop_val in props.items():
|
||||
expected_val = mt[prop_name]
|
||||
self.assertEqual(expected_val, prop_val)
|
||||
|
||||
@staticmethod
|
||||
def seg_max_adjust_enabled(mt):
|
||||
# machine types >= 5.0 should have seg_max_adjust = true
|
||||
# others seg_max_adjust = false
|
||||
mt = mt.split("-")
|
||||
|
||||
# machine types with one line name and name like pc-x.x
|
||||
if len(mt) <= 2:
|
||||
return False
|
||||
|
||||
# machine types like pc-<chip_name>-x.x[.x]
|
||||
ver = mt[2]
|
||||
ver = ver.split(".");
|
||||
|
||||
# versions >= 5.0 goes with seg_max_adjust enabled
|
||||
major = int(ver[0])
|
||||
|
||||
if major >= 5:
|
||||
return True
|
||||
return False
|
||||
|
||||
@skip("break multi-arch CI")
|
||||
def test_machine_types(self):
|
||||
# collect all machine types except 'none', 'isapc', 'microvm'
|
||||
with QEMUMachine(self.qemu_bin) as vm:
|
||||
vm.launch()
|
||||
machines = [m['name'] for m in vm.cmd('query-machines')]
|
||||
vm.shutdown()
|
||||
machines.remove('none')
|
||||
machines.remove('isapc')
|
||||
machines.remove('microvm')
|
||||
|
||||
for dev_type in DEV_TYPES:
|
||||
# create the list of machine types and their parameters.
|
||||
mtypes = list()
|
||||
for m in machines:
|
||||
if self.seg_max_adjust_enabled(m):
|
||||
enabled = 'true'
|
||||
else:
|
||||
enabled = 'false'
|
||||
mtypes.append({'name': m,
|
||||
DEV_TYPES[dev_type]['seg_max_adjust']: enabled})
|
||||
|
||||
# test each machine type for a device type
|
||||
for mt in mtypes:
|
||||
self.check_mt(mt, dev_type)
|
@ -263,7 +263,7 @@ int qemu_socketpair(int domain, int type, int protocol, int sv[2])
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
ret = socketpair(domain, type, protocol, sv);;
|
||||
ret = socketpair(domain, type, protocol, sv);
|
||||
if (ret == 0) {
|
||||
qemu_set_cloexec(sv[0]);
|
||||
qemu_set_cloexec(sv[1]);
|
||||
|
Loading…
Reference in New Issue
Block a user