Bugfixes for 6.2.

-----BEGIN PGP SIGNATURE-----
 
 iQFIBAABCAAyFiEE8TM4V0tmI4mGbHaCv/vSX3jHroMFAmGXb2kUHHBib256aW5p
 QHJlZGhhdC5jb20ACgkQv/vSX3jHroNkQggArLP8V1vL9XW9LJ6v4UdO4dp78MRb
 mP5zZhzY6CZ9NnbLW3rtS8GLrQ7XJdHl4huVIckIF3HW+TOBas2gXOiyWdskZRFS
 UGSoeejj2RHmTzBKWZN77G/GB0ElyKt3wvXeCEx0F8yiJXZhkw6n6tp3U/lGnic3
 sJmniTBZ+m3GGtrAaEL11x8ITdtdGEE4uIhspqN8X0kU+WkSsklm8+GAORzMpWGq
 Fqo46dd1C+st1GvbDOnghltYOEPPyKE6pZYOnZwB8X8hi01Ex53wXBXl98G8r8rt
 qA6P0lc5Eh8E3M7xm+kJBw1XNSkxjQioJ1SElmQFW5w5rVtYVSDEsaL4MQ==
 =3kjz
 -----END PGP SIGNATURE-----

Merge tag 'for-upstream' of https://gitlab.com/bonzini/qemu into staging

Bugfixes for 6.2.

# gpg: Signature made Fri 19 Nov 2021 10:33:29 AM CET
# gpg:                using RSA key F13338574B662389866C7682BFFBD25F78C7AE83
# gpg:                issuer "pbonzini@redhat.com"
# gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>" [full]
# gpg:                 aka "Paolo Bonzini <pbonzini@redhat.com>" [full]

* tag 'for-upstream' of https://gitlab.com/bonzini/qemu:
  chardev/wctable: don't free the instance in wctablet_chr_finalize
  meson.build: Support ncurses on MacOS and OpenBSD
  docs: Spell QEMU all caps
  qtest/am53c974-test: add test for reset before transfer
  esp: ensure that async_len is reset to 0 during esp_hard_reset()
  nvmm: Fix support for stable version
  meson: fix botched compile check conversions

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
Richard Henderson 2021-11-19 17:16:57 +01:00
commit 8627edfb3f
16 changed files with 93 additions and 42 deletions

View File

@ -320,7 +320,6 @@ static void wctablet_chr_finalize(Object *obj)
TabletChardev *tablet = WCTABLET_CHARDEV(obj); TabletChardev *tablet = WCTABLET_CHARDEV(obj);
qemu_input_handler_unregister(tablet->hs); qemu_input_handler_unregister(tablet->hs);
g_free(tablet);
} }
static void wctablet_chr_open(Chardev *chr, static void wctablet_chr_open(Chardev *chr,

View File

@ -1,5 +1,5 @@
============ ============
Qemu modules QEMU modules
============ ============
.. kernel-doc:: include/qemu/module.h .. kernel-doc:: include/qemu/module.h

View File

@ -228,7 +228,7 @@ Emulated hardware state
Currently thanks to KVM work any access to IO memory is automatically Currently thanks to KVM work any access to IO memory is automatically
protected by the global iothread mutex, also known as the BQL (Big protected by the global iothread mutex, also known as the BQL (Big
Qemu Lock). Any IO region that doesn't use global mutex is expected to QEMU Lock). Any IO region that doesn't use global mutex is expected to
do its own locking. do its own locking.
However IO memory isn't the only way emulated hardware state can be However IO memory isn't the only way emulated hardware state can be

View File

@ -686,7 +686,7 @@ Rationale: hex numbers are hard to read in logs when there is no 0x prefix,
especially when (occasionally) the representation doesn't contain any letters especially when (occasionally) the representation doesn't contain any letters
and especially in one line with other decimal numbers. Number groups are allowed and especially in one line with other decimal numbers. Number groups are allowed
to not use '0x' because for some things notations like %x.%x.%x are used not to not use '0x' because for some things notations like %x.%x.%x are used not
only in Qemu. Also dumping raw data bytes with '0x' is less readable. only in QEMU. Also dumping raw data bytes with '0x' is less readable.
'#' printf flag '#' printf flag
--------------- ---------------

View File

@ -1,8 +1,8 @@
================= =================
Qemu UI subsystem QEMU UI subsystem
================= =================
Qemu Clipboard QEMU Clipboard
-------------- --------------
.. kernel-doc:: include/ui/clipboard.h .. kernel-doc:: include/ui/clipboard.h

View File

@ -1,4 +1,4 @@
Qemu supports the NBD protocol, and has an internal NBD client (see QEMU supports the NBD protocol, and has an internal NBD client (see
block/nbd.c), an internal NBD server (see blockdev-nbd.c), and an block/nbd.c), an internal NBD server (see blockdev-nbd.c), and an
external NBD server tool (see qemu-nbd.c). The common code is placed external NBD server tool (see qemu-nbd.c). The common code is placed
in nbd/*. in nbd/*.
@ -7,11 +7,11 @@ The NBD protocol is specified here:
https://github.com/NetworkBlockDevice/nbd/blob/master/doc/proto.md https://github.com/NetworkBlockDevice/nbd/blob/master/doc/proto.md
The following paragraphs describe some specific properties of NBD The following paragraphs describe some specific properties of NBD
protocol realization in Qemu. protocol realization in QEMU.
= Metadata namespaces = = Metadata namespaces =
Qemu supports the "base:allocation" metadata context as defined in the QEMU supports the "base:allocation" metadata context as defined in the
NBD protocol specification, and also defines an additional metadata NBD protocol specification, and also defines an additional metadata
namespace "qemu". namespace "qemu".

View File

@ -313,7 +313,7 @@ The fields of the bitmaps extension are:
The number of bitmaps contained in the image. Must be The number of bitmaps contained in the image. Must be
greater than or equal to 1. greater than or equal to 1.
Note: Qemu currently only supports up to 65535 bitmaps per Note: QEMU currently only supports up to 65535 bitmaps per
image. image.
4 - 7: Reserved, must be zero. 4 - 7: Reserved, must be zero.
@ -775,7 +775,7 @@ Structure of a bitmap directory entry:
2: extra_data_compatible 2: extra_data_compatible
This flags is meaningful when the extra data is This flags is meaningful when the extra data is
unknown to the software (currently any extra data is unknown to the software (currently any extra data is
unknown to Qemu). unknown to QEMU).
If it is set, the bitmap may be used as expected, extra If it is set, the bitmap may be used as expected, extra
data must be left as is. data must be left as is.
If it is not set, the bitmap must not be used, but If it is not set, the bitmap must not be used, but
@ -793,7 +793,7 @@ Structure of a bitmap directory entry:
17: granularity_bits 17: granularity_bits
Granularity bits. Valid values: 0 - 63. Granularity bits. Valid values: 0 - 63.
Note: Qemu currently supports only values 9 - 31. Note: QEMU currently supports only values 9 - 31.
Granularity is calculated as Granularity is calculated as
granularity = 1 << granularity_bits granularity = 1 << granularity_bits
@ -804,7 +804,7 @@ Structure of a bitmap directory entry:
18 - 19: name_size 18 - 19: name_size
Size of the bitmap name. Must be non-zero. Size of the bitmap name. Must be non-zero.
Note: Qemu currently doesn't support values greater than Note: QEMU currently doesn't support values greater than
1023. 1023.
20 - 23: extra_data_size 20 - 23: extra_data_size

View File

@ -123,7 +123,7 @@ Background info is here:
guest side with pci-bridge-seat guest side with pci-bridge-seat
------------------------------- -------------------------------
Qemu version 2.4 and newer has a new pci-bridge-seat device which QEMU version 2.4 and newer has a new pci-bridge-seat device which
can be used instead of pci-bridge. Just swap the device name in the can be used instead of pci-bridge. Just swap the device name in the
qemu command line above. The only difference between the two devices qemu command line above. The only difference between the two devices
is the pci id. We can match the pci id instead of the device path is the pci id. We can match the pci id instead of the device path

View File

@ -15,7 +15,7 @@ These are specified using a special URL syntax.
'iqn.2008-11.org.linux-kvm[:<name>]' but this can also be set from 'iqn.2008-11.org.linux-kvm[:<name>]' but this can also be set from
the command line or a configuration file. the command line or a configuration file.
Since version Qemu 2.4 it is possible to specify a iSCSI request Since version QEMU 2.4 it is possible to specify a iSCSI request
timeout to detect stalled requests and force a reestablishment of the timeout to detect stalled requests and force a reestablishment of the
session. The timeout is specified in seconds. The default is 0 which session. The timeout is specified in seconds. The default is 0 which
means no timeout. Libiscsi 1.15.0 or greater is required for this means no timeout. Libiscsi 1.15.0 or greater is required for this

View File

@ -20,13 +20,13 @@ report the same CPUID info to guest as on host for most of SGX CPUID. With
reporting the same CPUID guest is able to use full capacity of SGX, and KVM reporting the same CPUID guest is able to use full capacity of SGX, and KVM
doesn't need to emulate those info. doesn't need to emulate those info.
The guest's EPC base and size are determined by Qemu, and KVM needs Qemu to The guest's EPC base and size are determined by QEMU, and KVM needs QEMU to
notify such info to it before it can initialize SGX for guest. notify such info to it before it can initialize SGX for guest.
Virtual EPC Virtual EPC
~~~~~~~~~~~ ~~~~~~~~~~~
By default, Qemu does not assign EPC to a VM, i.e. fully enabling SGX in a VM By default, QEMU does not assign EPC to a VM, i.e. fully enabling SGX in a VM
requires explicit allocation of EPC to the VM. Similar to other specialized requires explicit allocation of EPC to the VM. Similar to other specialized
memory types, e.g. hugetlbfs, EPC is exposed as a memory backend. memory types, e.g. hugetlbfs, EPC is exposed as a memory backend.
@ -35,12 +35,12 @@ prior to realizing the vCPUs themselves, which occurs long before generic
devices are parsed and realized. This limitation means that EPC does not devices are parsed and realized. This limitation means that EPC does not
require -maxmem as EPC is not treated as {cold,hot}plugged memory. require -maxmem as EPC is not treated as {cold,hot}plugged memory.
Qemu does not artificially restrict the number of EPC sections exposed to a QEMU does not artificially restrict the number of EPC sections exposed to a
guest, e.g. Qemu will happily allow you to create 64 1M EPC sections. Be aware guest, e.g. QEMU will happily allow you to create 64 1M EPC sections. Be aware
that some kernels may not recognize all EPC sections, e.g. the Linux SGX driver that some kernels may not recognize all EPC sections, e.g. the Linux SGX driver
is hardwired to support only 8 EPC sections. is hardwired to support only 8 EPC sections.
The following Qemu snippet creates two EPC sections, with 64M pre-allocated The following QEMU snippet creates two EPC sections, with 64M pre-allocated
to the VM and an additional 28M mapped but not allocated:: to the VM and an additional 28M mapped but not allocated::
-object memory-backend-epc,id=mem1,size=64M,prealloc=on \ -object memory-backend-epc,id=mem1,size=64M,prealloc=on \
@ -54,7 +54,7 @@ to physical EPC. Because physical EPC is protected via range registers,
the size of the physical EPC must be a power of two (though software sees the size of the physical EPC must be a power of two (though software sees
a subset of the full EPC, e.g. 92M or 128M) and the EPC must be naturally a subset of the full EPC, e.g. 92M or 128M) and the EPC must be naturally
aligned. KVM SGX's virtual EPC is purely a software construct and only aligned. KVM SGX's virtual EPC is purely a software construct and only
requires the size and location to be page aligned. Qemu enforces the EPC requires the size and location to be page aligned. QEMU enforces the EPC
size is a multiple of 4k and will ensure the base of the EPC is 4k aligned. size is a multiple of 4k and will ensure the base of the EPC is 4k aligned.
To simplify the implementation, EPC is always located above 4g in the guest To simplify the implementation, EPC is always located above 4g in the guest
physical address space. physical address space.
@ -62,7 +62,7 @@ physical address space.
Migration Migration
~~~~~~~~~ ~~~~~~~~~
Qemu/KVM doesn't prevent live migrating SGX VMs, although from hardware's QEMU/KVM doesn't prevent live migrating SGX VMs, although from hardware's
perspective, SGX doesn't support live migration, since both EPC and the SGX perspective, SGX doesn't support live migration, since both EPC and the SGX
key hierarchy are bound to the physical platform. However live migration key hierarchy are bound to the physical platform. However live migration
can be supported in the sense if guest software stack can support recreating can be supported in the sense if guest software stack can support recreating
@ -76,7 +76,7 @@ CPUID
~~~~~ ~~~~~
Due to its myriad dependencies, SGX is currently not listed as supported Due to its myriad dependencies, SGX is currently not listed as supported
in any of Qemu's built-in CPU configuration. To expose SGX (and SGX Launch in any of QEMU's built-in CPU configuration. To expose SGX (and SGX Launch
Control) to a guest, you must either use ``-cpu host`` to pass-through the Control) to a guest, you must either use ``-cpu host`` to pass-through the
host CPU model, or explicitly enable SGX when using a built-in CPU model, host CPU model, or explicitly enable SGX when using a built-in CPU model,
e.g. via ``-cpu <model>,+sgx`` or ``-cpu <model>,+sgx,+sgxlc``. e.g. via ``-cpu <model>,+sgx`` or ``-cpu <model>,+sgx,+sgxlc``.
@ -101,7 +101,7 @@ controlled via -cpu are prefixed with "sgx", e.g.::
sgx2 sgx2
sgxlc sgxlc
The following Qemu snippet passes through the host CPU but restricts access to The following QEMU snippet passes through the host CPU but restricts access to
the provision and EINIT token keys:: the provision and EINIT token keys::
-cpu host,-sgx-provisionkey,-sgx-tokenkey -cpu host,-sgx-provisionkey,-sgx-tokenkey
@ -112,11 +112,11 @@ in hardware cannot be forced on via '-cpu'.
Virtualize SGX Launch Control Virtualize SGX Launch Control
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Qemu SGX support for Launch Control (LC) is passive, in the sense that it QEMU SGX support for Launch Control (LC) is passive, in the sense that it
does not actively change the LC configuration. Qemu SGX provides the user does not actively change the LC configuration. QEMU SGX provides the user
the ability to set/clear the CPUID flag (and by extension the associated the ability to set/clear the CPUID flag (and by extension the associated
IA32_FEATURE_CONTROL MSR bit in fw_cfg) and saves/restores the LE Hash MSRs IA32_FEATURE_CONTROL MSR bit in fw_cfg) and saves/restores the LE Hash MSRs
when getting/putting guest state, but Qemu does not add new controls to when getting/putting guest state, but QEMU does not add new controls to
directly modify the LC configuration. Similar to hardware behavior, locking directly modify the LC configuration. Similar to hardware behavior, locking
the LC configuration to a non-Intel value is left to guest firmware. Unlike the LC configuration to a non-Intel value is left to guest firmware. Unlike
host bios setting for SGX launch control(LC), there is no special bios setting host bios setting for SGX launch control(LC), there is no special bios setting
@ -126,7 +126,7 @@ creating VM with SGX.
Feature Control Feature Control
~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~
Qemu SGX updates the ``etc/msr_feature_control`` fw_cfg entry to set the SGX QEMU SGX updates the ``etc/msr_feature_control`` fw_cfg entry to set the SGX
(bit 18) and SGX LC (bit 17) flags based on their respective CPUID support, (bit 18) and SGX LC (bit 17) flags based on their respective CPUID support,
i.e. existing guest firmware will automatically set SGX and SGX LC accordingly, i.e. existing guest firmware will automatically set SGX and SGX LC accordingly,
assuming said firmware supports fw_cfg.msr_feature_control. assuming said firmware supports fw_cfg.msr_feature_control.

View File

@ -21,7 +21,7 @@ The second factor is materialized by a device implementing the U2F
protocol. In case of a USB U2F security key, it is a USB HID device protocol. In case of a USB U2F security key, it is a USB HID device
that implements the U2F protocol. that implements the U2F protocol.
In Qemu, the USB U2F key device offers a dedicated support of U2F, allowing In QEMU, the USB U2F key device offers a dedicated support of U2F, allowing
guest USB FIDO/U2F security keys operating in two possible modes: guest USB FIDO/U2F security keys operating in two possible modes:
pass-through and emulated. pass-through and emulated.

View File

@ -894,6 +894,7 @@ void esp_hard_reset(ESPState *s)
memset(s->wregs, 0, ESP_REGS); memset(s->wregs, 0, ESP_REGS);
s->tchi_written = 0; s->tchi_written = 0;
s->ti_size = 0; s->ti_size = 0;
s->async_len = 0;
fifo8_reset(&s->fifo); fifo8_reset(&s->fifo);
fifo8_reset(&s->cmdfifo); fifo8_reset(&s->cmdfifo);
s->dma = 0; s->dma = 0;

View File

@ -329,9 +329,7 @@ if not get_option('hax').disabled()
endif endif
endif endif
if targetos == 'netbsd' if targetos == 'netbsd'
if cc.has_header_symbol('nvmm.h', 'nvmm_cpu_stop', required: get_option('nvmm')) nvmm = cc.find_library('nvmm', required: get_option('nvmm'))
nvmm = cc.find_library('nvmm', required: get_option('nvmm'))
endif
if nvmm.found() if nvmm.found()
accelerators += 'CONFIG_NVMM' accelerators += 'CONFIG_NVMM'
endif endif
@ -681,6 +679,9 @@ iconv = not_found
curses = not_found curses = not_found
if have_system and not get_option('curses').disabled() if have_system and not get_option('curses').disabled()
curses_test = ''' curses_test = '''
#if defined(__APPLE__) || defined(__OpenBSD__)
#define _XOPEN_SOURCE_EXTENDED 1
#endif
#include <locale.h> #include <locale.h>
#include <curses.h> #include <curses.h>
#include <wchar.h> #include <wchar.h>
@ -704,7 +705,7 @@ if have_system and not get_option('curses').disabled()
endif endif
endforeach endforeach
msg = get_option('curses').enabled() ? 'curses library not found' : '' msg = get_option('curses').enabled() ? 'curses library not found' : ''
curses_compile_args = ['-DNCURSES_WIDECHAR'] curses_compile_args = ['-DNCURSES_WIDECHAR=1']
if curses.found() if curses.found()
if cc.links(curses_test, args: curses_compile_args, dependencies: [curses]) if cc.links(curses_test, args: curses_compile_args, dependencies: [curses])
curses = declare_dependency(compile_args: curses_compile_args, dependencies: [curses]) curses = declare_dependency(compile_args: curses_compile_args, dependencies: [curses])
@ -1553,8 +1554,6 @@ config_host_data.set('CONFIG_INOTIFY',
cc.has_header_symbol('sys/inotify.h', 'inotify_init')) cc.has_header_symbol('sys/inotify.h', 'inotify_init'))
config_host_data.set('CONFIG_INOTIFY1', config_host_data.set('CONFIG_INOTIFY1',
cc.has_header_symbol('sys/inotify.h', 'inotify_init1')) cc.has_header_symbol('sys/inotify.h', 'inotify_init1'))
config_host_data.set('CONFIG_IOVEC',
cc.has_header_symbol('sys/uio.h', 'struct iovec'))
config_host_data.set('CONFIG_MACHINE_BSWAP_H', config_host_data.set('CONFIG_MACHINE_BSWAP_H',
cc.has_header_symbol('machine/bswap.h', 'bswap32', cc.has_header_symbol('machine/bswap.h', 'bswap32',
prefix: '''#include <sys/endian.h> prefix: '''#include <sys/endian.h>
@ -1567,8 +1566,6 @@ config_host_data.set('CONFIG_SYSMACROS',
cc.has_header_symbol('sys/sysmacros.h', 'makedev')) cc.has_header_symbol('sys/sysmacros.h', 'makedev'))
config_host_data.set('HAVE_OPTRESET', config_host_data.set('HAVE_OPTRESET',
cc.has_header_symbol('getopt.h', 'optreset')) cc.has_header_symbol('getopt.h', 'optreset'))
config_host_data.set('HAVE_UTMPX',
cc.has_header_symbol('utmpx.h', 'struct utmpx'))
config_host_data.set('HAVE_IPPROTO_MPTCP', config_host_data.set('HAVE_IPPROTO_MPTCP',
cc.has_header_symbol('netinet/in.h', 'IPPROTO_MPTCP')) cc.has_header_symbol('netinet/in.h', 'IPPROTO_MPTCP'))
@ -1580,6 +1577,14 @@ config_host_data.set('HAVE_STRUCT_STAT_ST_ATIM',
cc.has_member('struct stat', 'st_atim', cc.has_member('struct stat', 'st_atim',
prefix: '#include <sys/stat.h>')) prefix: '#include <sys/stat.h>'))
# has_type
config_host_data.set('CONFIG_IOVEC',
cc.has_type('struct iovec',
prefix: '#include <sys/uio.h>'))
config_host_data.set('HAVE_UTMPX',
cc.has_type('struct utmpx',
prefix: '#include <utmpx.h>'))
config_host_data.set('CONFIG_EVENTFD', cc.links(''' config_host_data.set('CONFIG_EVENTFD', cc.links('''
#include <sys/eventfd.h> #include <sys/eventfd.h>
int main(void) { return eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC); }''')) int main(void) { return eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC); }'''))
@ -1621,7 +1626,7 @@ config_host_data.set('CONFIG_POSIX_MADVISE', cc.links(gnu_source_prefix + '''
#include <stddef.h> #include <stddef.h>
int main(void) { return posix_madvise(NULL, 0, POSIX_MADV_DONTNEED); }''')) int main(void) { return posix_madvise(NULL, 0, POSIX_MADV_DONTNEED); }'''))
config_host_data.set('CONFIG_PTHREAD_SETNAME_NP_W_TID', cc.links(''' config_host_data.set('CONFIG_PTHREAD_SETNAME_NP_W_TID', cc.links(gnu_source_prefix + '''
#include <pthread.h> #include <pthread.h>
static void *f(void *p) { return NULL; } static void *f(void *p) { return NULL; }
@ -1632,7 +1637,7 @@ config_host_data.set('CONFIG_PTHREAD_SETNAME_NP_W_TID', cc.links('''
pthread_setname_np(thread, "QEMU"); pthread_setname_np(thread, "QEMU");
return 0; return 0;
}''', dependencies: threads)) }''', dependencies: threads))
config_host_data.set('CONFIG_PTHREAD_SETNAME_NP_WO_TID', cc.links(''' config_host_data.set('CONFIG_PTHREAD_SETNAME_NP_WO_TID', cc.links(gnu_source_prefix + '''
#include <pthread.h> #include <pthread.h>
static void *f(void *p) { pthread_setname_np("QEMU"); return NULL; } static void *f(void *p) { pthread_setname_np("QEMU"); return NULL; }
@ -1668,8 +1673,10 @@ config_host_data.set('HAVE_MLOCKALL', cc.links(gnu_source_prefix + '''
have_l2tpv3 = false have_l2tpv3 = false
if not get_option('l2tpv3').disabled() and have_system if not get_option('l2tpv3').disabled() and have_system
have_l2tpv3 = (cc.has_header_symbol('sys/socket.h', 'struct mmsghdr') have_l2tpv3 = cc.has_type('struct mmsghdr',
and cc.has_header('linux/ip.h')) prefix: gnu_source_prefix + '''
#include <sys/socket.h>
#include <linux/ip.h>''')
endif endif
config_host_data.set('CONFIG_L2TPV3', have_l2tpv3) config_host_data.set('CONFIG_L2TPV3', have_l2tpv3)
@ -1695,7 +1702,7 @@ config_host_data.set('CONFIG_NETMAP', have_netmap)
# xfs headers will not try to redefine structs from linux headers # xfs headers will not try to redefine structs from linux headers
# if this macro is set. # if this macro is set.
config_host_data.set('HAVE_FSXATTR', cc.links(''' config_host_data.set('HAVE_FSXATTR', cc.links('''
#include <linux/fs.h>' #include <linux/fs.h>
struct fsxattr foo; struct fsxattr foo;
int main(void) { int main(void) {
return 0; return 0;

View File

@ -750,7 +750,11 @@ nvmm_vcpu_loop(CPUState *cpu)
nvmm_vcpu_pre_run(cpu); nvmm_vcpu_pre_run(cpu);
if (qatomic_read(&cpu->exit_request)) { if (qatomic_read(&cpu->exit_request)) {
#if NVMM_USER_VERSION >= 2
nvmm_vcpu_stop(vcpu); nvmm_vcpu_stop(vcpu);
#else
qemu_cpu_kick_self();
#endif
} }
/* Read exit_request before the kernel reads the immediate exit flag */ /* Read exit_request before the kernel reads the immediate exit flag */
@ -767,6 +771,7 @@ nvmm_vcpu_loop(CPUState *cpu)
switch (exit->reason) { switch (exit->reason) {
case NVMM_VCPU_EXIT_NONE: case NVMM_VCPU_EXIT_NONE:
break; break;
#if NVMM_USER_VERSION >= 2
case NVMM_VCPU_EXIT_STOPPED: case NVMM_VCPU_EXIT_STOPPED:
/* /*
* The kernel cleared the immediate exit flag; cpu->exit_request * The kernel cleared the immediate exit flag; cpu->exit_request
@ -775,6 +780,7 @@ nvmm_vcpu_loop(CPUState *cpu)
smp_wmb(); smp_wmb();
qcpu->stop = true; qcpu->stop = true;
break; break;
#endif
case NVMM_VCPU_EXIT_MEMORY: case NVMM_VCPU_EXIT_MEMORY:
ret = nvmm_handle_mem(mach, vcpu); ret = nvmm_handle_mem(mach, vcpu);
break; break;
@ -888,8 +894,12 @@ nvmm_ipi_signal(int sigcpu)
{ {
if (current_cpu) { if (current_cpu) {
struct qemu_vcpu *qcpu = get_qemu_vcpu(current_cpu); struct qemu_vcpu *qcpu = get_qemu_vcpu(current_cpu);
#if NVMM_USER_VERSION >= 2
struct nvmm_vcpu *vcpu = &qcpu->vcpu; struct nvmm_vcpu *vcpu = &qcpu->vcpu;
nvmm_vcpu_stop(vcpu); nvmm_vcpu_stop(vcpu);
#else
qcpu->stop = true;
#endif
} }
} }

View File

@ -223,6 +223,34 @@ static void test_inflight_cancel_ok(void)
qtest_quit(s); qtest_quit(s);
} }
static void test_reset_before_transfer_ok(void)
{
QTestState *s = qtest_init(
"-device am53c974,id=scsi "
"-device scsi-hd,drive=disk0 -drive "
"id=disk0,if=none,file=null-co://,format=raw -nodefaults");
qtest_outl(s, 0xcf8, 0x80001010);
qtest_outl(s, 0xcfc, 0xc000);
qtest_outl(s, 0xcf8, 0x80001004);
qtest_outw(s, 0xcfc, 0x01);
qtest_outl(s, 0xc007, 0x2500);
qtest_outl(s, 0xc00a, 0x410000);
qtest_outl(s, 0xc00a, 0x410000);
qtest_outw(s, 0xc00b, 0x0200);
qtest_outw(s, 0xc040, 0x03);
qtest_outw(s, 0xc009, 0x00);
qtest_outw(s, 0xc00b, 0x00);
qtest_outw(s, 0xc009, 0x00);
qtest_outw(s, 0xc00b, 0x00);
qtest_outw(s, 0xc009, 0x00);
qtest_outw(s, 0xc003, 0x1000);
qtest_outw(s, 0xc00b, 0x1000);
qtest_outl(s, 0xc00b, 0x9000);
qtest_outw(s, 0xc00b, 0x1000);
qtest_quit(s);
}
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
const char *arch = qtest_get_arch(); const char *arch = qtest_get_arch();
@ -248,6 +276,8 @@ int main(int argc, char **argv)
test_cancelled_request_ok); test_cancelled_request_ok);
qtest_add_func("am53c974/test_inflight_cancel_ok", qtest_add_func("am53c974/test_inflight_cancel_ok",
test_inflight_cancel_ok); test_inflight_cancel_ok);
qtest_add_func("am53c974/test_reset_before_transfer_ok",
test_reset_before_transfer_ok);
} }
return g_test_run(); return g_test_run();

View File

@ -38,6 +38,10 @@
#include "ui/input.h" #include "ui/input.h"
#include "sysemu/sysemu.h" #include "sysemu/sysemu.h"
#if defined(__APPLE__) || defined(__OpenBSD__)
#define _XOPEN_SOURCE_EXTENDED 1
#endif
/* KEY_EVENT is defined in wincon.h and in curses.h. Avoid redefinition. */ /* KEY_EVENT is defined in wincon.h and in curses.h. Avoid redefinition. */
#undef KEY_EVENT #undef KEY_EVENT
#include <curses.h> #include <curses.h>