Misc patches for 2018-05-09
Subsystems (3)
The following changes since commit cc8f8ba754bba17eea9791d67b572eb26e30b4ce:
Merge remote-tracking branch 'remotes/ehabkost/tags/machine-next-pull-request' into staging (2018-05-08 15:25:17 +0100)
are available in the git repository at:
git://github.com/bonzini/qemu.git tags/for-upstream
for you to fetch changes up to 3c128df2ec239f5c1abd0aa59254c433a779a347:
rename included C files to foo.inc.c, remove osdep.h (2018-05-09 00:13:41 +0200)
----------------------------------------------------------------
* Don't silently truncate extremely long words in the command line
* bump min required glib library version to 2.42
* dtc configure fixes
* MemoryRegionCache second try
* Deprecated option removal
* add support for Hyper-V reenlightenment MSRs
----------------------------------------------------------------
Cédric Le Goater (1):
cpus: tcg: fix never exiting loop on unplug
Daniel P. Berrangé (5):
accel: use g_strsplit for parsing accelerator names
opts: don't silently truncate long parameter keys
opts: don't silently truncate long option values
qemu-doc: provide details of supported build platforms
glib: bump min required glib library version to 2.42
David Hildenbrand (1):
pc-dimm: fix error messages if no slots were defined
Jan Kiszka (1):
build: Silence dtc directory creation
Markus Armbruster (1):
cpus: Fix event order on resume of stopped guest
Olaf Hering (1):
configure: recognize more rpmbuild macros
Paolo Bonzini (8):
qom: allow object_get_canonical_path_component without parent
memdev: remove "id" property
exec: move memory access declarations to a common header, inline *_phys functions
exec: small changes to flatview_do_translate
exec: extract address_space_translate_iommu, fix page_mask corner case
exec: reintroduce MemoryRegion caching
target/i386: sev: fix memory leaks
rename included C files to foo.inc.c, remove osdep.h
Peter Xu (2):
checkpatch.pl: add common glib defines to typelist
qemu-thread: always keep the posix wrapper layer
Philippe Mathieu-Daudé (3):
configure: Really use local libfdt if the system one is too old
configure: Display if libfdt is from system or git
shippable: Remove Debian 8 libfdt kludge
Roman Kagan (1):
update-linux-headers: drop hyperv.h
Thomas Huth (5):
qemu-options: Mark -virtioconsole as deprecated
qemu-options: Remove remainders of the -tdf option
qemu-options: Bail out on unsupported options instead of silently ignoring them
qemu-options: Remove deprecated -no-kvm-pit-reinjection
qemu-options: Remove deprecated -no-kvm-irqchip
Vitaly Kuznetsov (1):
i386/kvm: add support for Hyper-V reenlightenment MSRs
.shippable.yml | 8 -
Makefile | 2 +-
accel/accel.c | 16 +-
backends/hostmem.c | 26 --
configure | 23 +-
cpus.c | 18 +-
docs/devel/testing.rst | 4 +-
exec.c | 242 ++++++++++++----
hw/i386/multiboot.c | 33 ++-
hw/mem/pc-dimm.c | 9 +-
include/exec/cpu-all.h | 79 +++--
include/exec/memory-internal.h | 3 +
include/exec/memory.h | 209 +++++++-------
include/exec/memory_ldst.inc.h | 71 +++++
include/exec/memory_ldst_cached.inc.h | 108 +++++++
include/exec/memory_ldst_phys.inc.h | 147 ++++++++++
include/glib-compat.h | 319 ---------------------
include/qemu-common.h | 2 +-
include/qemu/option.h | 3 +-
include/qom/object.h | 1 +
include/sysemu/hostmem.h | 1 -
memory.c | 4 +-
memory_ldst.inc.c | 126 --------
numa.c | 2 +-
os-posix.c | 6 +-
os-win32.c | 4 +-
qemu-doc.texi | 83 +++++-
qemu-options.hx | 15 +-
qom/object.c | 5 +-
qom/object_interfaces.c | 6 -
rules.mak | 2 +-
scripts/checkpatch.pl | 28 ++
scripts/update-linux-headers.sh | 6 -
target/cris/translate.c | 2 +-
.../cris/{translate_v10.c => translate_v10.inc.c} | 0
target/i386/cpu.c | 4 +-
target/i386/cpu.h | 4 +
target/i386/hyperv-proto.h | 9 +-
target/i386/kvm.c | 39 ++-
target/i386/machine.c | 24 ++
target/i386/sev.c | 32 ++-
target/mips/translate.c | 2 +-
.../{translate_init.c => translate_init.inc.c} | 0
target/ppc/int_helper.c | 2 +-
target/ppc/{mfrom_table.c => mfrom_table.inc.c} | 0
target/ppc/translate.c | 2 +-
.../ppc/{translate_init.c => translate_init.inc.c} | 1 -
tests/docker/dockerfiles/centos6.docker | 30 --
tests/docker/dockerfiles/min-glib.docker | 8 -
tests/test-qemu-opts.c | 18 --
tests/test-qmp-event.c | 2 +-
tests/tpm-emu.h | 4 +-
tests/vhost-user-test.c | 4 +-
trace/simple.c | 6 +-
ui/vnc-enc-zrle.c | 22 +-
ui/{vnc-enc-zrle-template.c => vnc-enc-zrle.inc.c} | 0
util/qemu-option.c | 150 +++++-----
util/qemu-thread-posix.c | 33 +--
vl.c | 24 +-
59 files changed, 1040 insertions(+), 993 deletions(-)
create mode 100644 include/exec/memory_ldst.inc.h
create mode 100644 include/exec/memory_ldst_cached.inc.h
create mode 100644 include/exec/memory_ldst_phys.inc.h
rename target/cris/{translate_v10.c => translate_v10.inc.c} (100%)
rename target/mips/{translate_init.c => translate_init.inc.c} (100%)
rename target/ppc/{mfrom_table.c => mfrom_table.inc.c} (100%)
rename target/ppc/{translate_init.c => translate_init.inc.c} (99%)
delete mode 100644 tests/docker/dockerfiles/centos6.docker
delete mode 100644 tests/docker/dockerfiles/min-glib.docker
rename ui/{vnc-enc-zrle-template.c => vnc-enc-zrle.inc.c} (100%)Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 01/30] configure: recognize more rpmbuild macros
From: Olaf Hering <[email protected]>
Extend the list of recognized, but ignored options from rpms %configure macro. This fixes build on hosts running SUSE Linux.
Message-Id: <[email protected]>
--- configure | 2 ++ 1 file changed, 2 insertions(+)
configure +2 -0
@@ -964,6 +964,8 @@ for opt do ;; --firmwarepath=*) firmwarepath="$optarg" ;; + --host=*|--build=*|\ + --disable-dependency-tracking|\ --sbindir=*|--sharedstatedir=*|\ --oldincludedir=*|--datarootdir=*|--infodir=*|--localedir=*|\ --htmldir=*|--dvidir=*|--pdfdir=*|--psdir=*)
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 02/30] cpus: Fix event order on resume of stopped guest
In reply to Paolo BonziniFrom: Markus Armbruster <[email protected]>
When resume of a stopped guest immediately runs into block device errors, the BLOCK_IO_ERROR event is sent before the RESUME event.
Reproducer:
1. Create a scratch image
$ dd if=/dev/zero of=scratch.img bs=1M count=100
Size doesn't actually matter.
2. Prepare blkdebug configuration:
$ cat >blkdebug.conf <<EOF [inject-error] event = "write_aio" errno = "5" EOF
Note that errno 5 is EIO.
3. Run a guest with an additional scratch disk, i.e. with additional
arguments
-drive if=none,id=scratch-drive,format=raw,werror=stop,file=blkdebug:blkdebug.conf:scratch.img -device virtio-blk-pci,id=scratch,drive=scratch-drive
The blkdebug part makes all writes to the scratch drive fail with EIO. The werror=stop pauses the guest on write errors.
4. Connect to the QMP socket e.g. like this:
$ socat UNIX:/your/qmp/socket READLINE,history=$HOME/.qmp_history,prompt='QMP> '
Issue QMP command 'qmp_capabilities':
QMP> { "execute": "qmp_capabilities" }
5. Boot the guest.
6. In the guest, write to the scratch disk, e.g. like this:
# dd if=/dev/zero of=/dev/vdb count=1
Do double-check the device specified with of= is actually the scratch device!
7. Issue QMP command 'cont':
QMP> { "execute": "cont" }
After step 6, I get a BLOCK_IO_ERROR event followed by a STOP event. Good.
After step 7, I get BLOCK_IO_ERROR, then RESUME, then STOP. Not so good; I'd expect RESUME, then BLOCK_IO_ERROR, then STOP.
The funny event order confuses libvirt: virsh -r domstate DOMAIN --reason reports "paused (unknown)" rather than "paused (I/O error)".
The culprit is vm_prepare_start().
/* Ensure that a STOP/RESUME pair of events is emitted if a
* vmstop request was pending. The BLOCK_IO_ERROR event, for
* example, according to documentation is always followed by
* the STOP event.
*/
if (runstate_is_running()) {
qapi_event_send_stop(&error_abort);
res = -1;
} else {
replay_enable_events();
cpu_enable_ticks();
runstate_set(RUN_STATE_RUNNING);
vm_state_notify(1, RUN_STATE_RUNNING);
}
/* We are sending this now, but the CPUs will be resumed shortly later */
qapi_event_send_resume(&error_abort);
return res;When resuming a stopped guest, we take the else branch before we get to sending RESUME. vm_state_notify() runs virtio_vmstate_change(), among other things. This restarts I/O, triggering the BLOCK_IO_ERROR event.
Reshuffle vm_prepare_start() to send the RESUME event earlier.
Fixes RHBZ 1566153.
Message-Id: <[email protected]>
--- cpus.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
cpus.c +8 -8
@@ -2043,7 +2043,6 @@ int vm_stop(RunState state)int vm_prepare_start (void ) {RunState requested; -int res =0 ;qemu_vmstop_requested (&requested);if (runstate_is_running () && requested ==RUN_STATE__MAX ) {
@@ -2057,17 +2056,18 @@ int vm_prepare_start(void)*/ if (runstate_is_running ()) {qapi_event_send_stop (&error_abort); - res =-1 ; - }else { -replay_enable_events (); -cpu_enable_ticks (); -runstate_set (RUN_STATE_RUNNING ); -vm_state_notify (1 ,RUN_STATE_RUNNING ); +qapi_event_send_resume (&error_abort); +return -1 ; }/* We are sending this now, but the CPUs will be resumed shortly later */ qapi_event_send_resume (&error_abort); -return res; + +replay_enable_events (); +cpu_enable_ticks (); +runstate_set (RUN_STATE_RUNNING ); +vm_state_notify (1 ,RUN_STATE_RUNNING ); +return 0 ; }void vm_start (void )
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 03/30] cpus: tcg: fix never exiting loop on unplug
In reply to Paolo BonziniFrom: Cédric Le Goater <[email protected]>
Commit 9b0605f9837b ("cpus: tcg: unregister thread with RCU, fix exiting of loop on unplug") changed the exit condition of the loop in the vCPU thread function but forgot to remove the beginning 'while (1)' statement. The resulting code :
while (1) {
...
} while (!cpu->unplug || cpu_can_run(cpu));is a sequence of two distinct two while() loops, the first not exiting in case of an unplug event.
Remove the first while (1) to fix CPU unplug.
Message-Id: <[email protected]>
--- cpus.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
cpus.c +1 -1
@@ -1648,7 +1648,7 @@ static void *qemu_tcg_cpu_thread_fn(void *arg)/* process any pending work */ cpu->exit_request =1 ; -while (1 ) { + do { if (cpu_can_run(cpu)) { int r; qemu_mutex_unlock_iothread();
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 04/30] checkpatch.pl: add common glib defines to typelist
In reply to Paolo BonziniFrom: Peter Xu <[email protected]>
Otherwise it can warn this:
ERROR: space prohibited between function name and open parenthesis '('
When with things like this:
typedef gboolean (*it_tree_iterator)(ITValue start, ITValue end);
Message-Id: <[email protected]>
--- scripts/checkpatch.pl | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)
scripts/checkpatch.pl +28 -0
@@ -265,8 +265,36 @@ our @typeList = ( qr{${Ident}_handler_fn}, qr{target_(?:u)?long}, qr{hwaddr}, + # external libraries qr{xml${Ident}}, qr{xendevicemodel_handle}, + # Glib definitions + qr{gchar}, + qr{gshort}, + qr{glong}, + qr{gint}, + qr{gboolean}, + qr{guchar}, + qr{gushort}, + qr{gulong}, + qr{guint}, + qr{gfloat}, + qr{gdouble}, + qr{gpointer}, + qr{gconstpointer}, + qr{gint8}, + qr{guint8}, + qr{gint16}, + qr{guint16}, + qr{gint32}, + qr{guint32}, + qr{gint64}, + qr{guint64}, + qr{gsize}, + qr{gssize}, + qr{goffset}, + qr{gintptr}, + qr{guintptr}, ); # This can be modified by sub possible. Since it can be empty, be careful
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 05/30] qom: allow object_get_canonical_path_component without parent
In reply to Paolo BonziniJust return NULL; any callers that cause a change in behavior would have caused an assertion failure before, so this is safe.
--- include/qom/object.h | 1 + qom/object.c | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-)
include/qom/object.h +1 -0
@@ -1302,6 +1302,7 @@ Object *object_get_internal_root(void);* * Returns: The final component in the object's canonical path. The canonical * path is the path within the composition tree starting from the root. +* %NULL if the object doesn't have a parent (and thus a canonical path). */ gchar *object_get_canonical_path_component (Object *obj);
qom/object.c +3 -2
@@ -1644,8 +1644,9 @@ gchar *object_get_canonical_path_component(Object *obj)ObjectProperty *prop =NULL ;GHashTableIter iter; -g_assert (obj); -g_assert (obj->parent !=NULL ); +if (obj->parent ==NULL ) { +return NULL ; + }g_hash_table_iter_init (&iter, obj->parent->properties);while (g_hash_table_iter_next (&iter,NULL , (gpointer *)&prop)) {
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 06/30] memdev: remove "id" property
In reply to Paolo BonziniThe "id" property is unnecessary and can be replaced simply with object_get_canonical_path_component. This patch mostly undoes commit e1ff3c67e8 ("monitor: fix qmp/hmp query-memdev not reporting IDs of memory backends", 2017-01-12).
--- backends/hostmem.c | 26 -------------------------- include/sysemu/hostmem.h | 1 - numa.c | 2 +- qom/object_interfaces.c | 6 ------ 4 files changed, 1 insertion(+), 34 deletions(-)
backends/hostmem.c +0 -26
@@ -369,24 +369,6 @@ host_memory_backend_can_be_deleted(UserCreatable *uc) } } -static char *get_id (Object *o,Error **errp) -{ -HostMemoryBackend *backend =MEMORY_BACKEND (o); - -return g_strdup (backend->id); -} - -static void set_id (Object *o,const char *str,Error **errp) -{ -HostMemoryBackend *backend =MEMORY_BACKEND (o); - -if (backend->id) { -error_setg (errp,"cannot change property value" ); -return ; - } - backend->id =g_strdup (str); -} -static bool host_memory_backend_get_share (Object *o,Error **errp) {HostMemoryBackend *backend =MEMORY_BACKEND (o);
@@ -434,18 +416,11 @@ host_memory_backend_class_init(ObjectClass *oc, void *data) &HostMemPolicy_lookup, host_memory_backend_get_policy, host_memory_backend_set_policy, &error_abort); -object_class_property_add_str (oc,"id" , get_id, set_id, &error_abort);object_class_property_add_bool (oc,"share" , host_memory_backend_get_share, host_memory_backend_set_share, &error_abort); } -static void host_memory_backend_finalize (Object *o) -{ -HostMemoryBackend *backend =MEMORY_BACKEND (o); -g_free (backend->id); -} -static const TypeInfo host_memory_backend_info = { .name =TYPE_MEMORY_BACKEND , .parent =TYPE_OBJECT ,
@@ -454,7 +429,6 @@ static const TypeInfo host_memory_backend_info = { .class_init = host_memory_backend_class_init, .instance_size = sizeof(HostMemoryBackend), .instance_init = host_memory_backend_init, - .instance_finalize = host_memory_backend_finalize, .interfaces = (InterfaceInfo []) { {TYPE_USER_CREATABLE }, { }
include/sysemu/hostmem.h +0 -1
@@ -52,7 +52,6 @@ struct HostMemoryBackend {Object parent;/* protected */ -char *id;uint64_t size;bool merge, dump;bool prealloc, force_prealloc, is_mapped, share;
numa.c +1 -1
@@ -580,7 +580,7 @@ static int query_memdev(Object *obj, void *opaque) m->value =g_malloc0 (sizeof (*m->value)); - m->value->id =object_property_get_str (obj,"id" ,NULL ); + m->value->id =object_get_canonical_path_component (obj); m->value->has_id = !!m->value->id; m->value->size = object_property_get_uint(obj, "size",
qom/object_interfaces.c +0 -6
@@ -65,12 +65,6 @@ Object *user_creatable_add_type(const char *type, const char *id,assert (qdict); obj =object_new (type); -if (object_property_find (obj,"id" ,NULL )) { -object_property_set_str (obj, id,"id" , &local_err); -if (local_err) { - goto out; - } - }visit_start_struct (v,NULL ,NULL ,0 , &local_err);if (local_err) { goto out;
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 08/30] exec: small changes to flatview_do_translate
In reply to Paolo BonziniPrepare for extracting the IOMMU part to a separate function. Mostly cosmetic; the only semantic change is that, if there is more than one cascaded IOMMU and the second one fails to translate, *plen_out is now adjusted according to the page mask of the first IOMMU.
--- exec.c | 33 ++++++++++++++------------------- 1 file changed, 14 insertions(+), 19 deletions(-)
exec.c +14 -19
@@ -476,6 +476,7 @@ address_space_translate_internal(AddressSpaceDispatch *d, hwaddr addr, hwaddr *x* would tell. It can be @NULL if we don't care about it. * @is_write: whether the translation operation is for write * @is_mmio: whether this can be MMIO, set true if it can +* @target_as: the address space targeted by the IOMMU * * This function is called from RCU critical section */
@@ -495,14 +496,14 @@ static MemoryRegionSection flatview_do_translate(FlatView *fv,hwaddr page_mask = (hwaddr)(-1 );hwaddr plen = (hwaddr)(-1 ); -if (plen_out) { - plen = *plen_out; +if (!plen_out) { + plen_out = &plen; }for (;;) { section =address_space_translate_internal ( -flatview_to_dispatch (fv), addr, &addr, - &plen, is_mmio); +flatview_to_dispatch (fv), addr, xlat, + plen_out, is_mmio); iommu_mr =memory_region_get_iommu (section->mr);if (!iommu_mr) {
@@ -510,35 +511,29 @@ static MemoryRegionSection flatview_do_translate(FlatView *fv, } imrc =memory_region_get_iommu_class_nocheck (iommu_mr); + addr = *xlat; iotlb = imrc->translate (iommu_mr, addr, is_write ?IOMMU_WO :IOMMU_RO ); - addr = ((iotlb.translated_addr & ~iotlb.addr_mask) - | (addr & iotlb.addr_mask)); - page_mask &= iotlb.addr_mask; - plen =MIN (plen, (addr | iotlb.addr_mask) - addr +1 );if (!(iotlb.perm & (1 << is_write))) { goto translate_fail; } + addr = ((iotlb.translated_addr & ~iotlb.addr_mask) + | (addr & iotlb.addr_mask)); + page_mask &= iotlb.addr_mask; + *plen_out =MIN (*plen_out, (addr | iotlb.addr_mask) - addr +1 ); fv =address_space_to_flatview (iotlb.target_as); *target_as = iotlb.target_as; } - *xlat = addr; - -if (page_mask == (hwaddr)(-1 )) { -/* Not behind an IOMMU, use default page size. */ - page_mask = ~TARGET_PAGE_MASK ; - } -if (page_mask_out) { +if (page_mask == (hwaddr)(-1 )) { +/* Not behind an IOMMU, use default page size. */ + page_mask = ~TARGET_PAGE_MASK ; + } *page_mask_out = page_mask; } -if (plen_out) { - *plen_out = plen; - } -return *section; translate_fail:
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 09/30] exec: extract address_space_translate_iommu, fix page_mask corner case
In reply to Paolo BonziniThis will be used to process IOMMUs in a MemoryRegionCache. This includes a small bugfix, in that the returned page_mask is now correctly -1 if the IOMMU memory region maps the entire address space directly. Previously, address_space_get_iotlb_entry would return ~TARGET_PAGE_MASK.
--- exec.c | 110 ++++++++++++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 75 insertions(+), 35 deletions(-)
exec.c +75 -35
@@ -462,6 +462,70 @@ address_space_translate_internal(AddressSpaceDispatch *d, hwaddr addr, hwaddr *x }/** +* address_space_translate_iommu - translate an address through an IOMMU +* memory region and then through the target address space. +* +* @iommu_mr: the IOMMU memory region that we start the translation from +* @addr: the address to be translated through the MMU +* @xlat: the translated address offset within the destination memory region. +* It cannot be %NULL. +* @plen_out: valid read/write length of the translated address. It +* cannot be %NULL. +* @page_mask_out: page mask for the translated address. This +* should only be meaningful for IOMMU translated +* addresses, since there may be huge pages that this bit +* would tell. It can be %NULL if we don't care about it. +* @is_write: whether the translation operation is for write +* @is_mmio: whether this can be MMIO, set true if it can +* @target_as: the address space targeted by the IOMMU +* +* This function is called from RCU critical section. It is the common +* part of flatview_do_translate and address_space_translate_cached. +*/ +static MemoryRegionSection address_space_translate_iommu (IOMMUMemoryRegion *iommu_mr, +hwaddr *xlat, +hwaddr *plen_out, +hwaddr *page_mask_out, +bool is_write, +bool is_mmio, +AddressSpace **target_as) +{ +MemoryRegionSection *section; +hwaddr page_mask = (hwaddr)-1 ; + +do { +hwaddr addr = *xlat; +IOMMUMemoryRegionClass *imrc =memory_region_get_iommu_class_nocheck (iommu_mr); +IOMMUTLBEntry iotlb = imrc->translate (iommu_mr, addr, is_write ? +IOMMU_WO :IOMMU_RO ); + +if (!(iotlb.perm & (1 << is_write))) { + goto unassigned; + } + + addr = ((iotlb.translated_addr & ~iotlb.addr_mask) + | (addr & iotlb.addr_mask)); + page_mask &= iotlb.addr_mask; + *plen_out =MIN (*plen_out, (addr | iotlb.addr_mask) - addr +1 ); + *target_as = iotlb.target_as; + + section =address_space_translate_internal ( +address_space_to_dispatch (iotlb.target_as), addr, xlat, + plen_out, is_mmio); + + iommu_mr =memory_region_get_iommu (section->mr); + }while (unlikely (iommu_mr)); + +if (page_mask_out) { + *page_mask_out = page_mask; + } +return *section; + +unassigned: +return (MemoryRegionSection ) { .mr = &io_mem_unassigned }; +} + +/** * flatview_do_translate - translate an address in FlatView * * @fv: the flat view that we want to translate on
@@ -489,55 +553,31 @@ static MemoryRegionSection flatview_do_translate(FlatView *fv,bool is_mmio, AddressSpace **target_as) { - IOMMUTLBEntry iotlb; MemoryRegionSection *section;IOMMUMemoryRegion *iommu_mr; -IOMMUMemoryRegionClass *imrc; -hwaddr page_mask = (hwaddr)(-1 );hwaddr plen = (hwaddr)(-1 );if (!plen_out) { plen_out = &plen; } -for (;;) { - section =address_space_translate_internal ( -flatview_to_dispatch (fv), addr, xlat, - plen_out, is_mmio); - - iommu_mr =memory_region_get_iommu (section->mr); -if (!iommu_mr) { -break ; - } - imrc =memory_region_get_iommu_class_nocheck (iommu_mr); - - addr = *xlat; - iotlb = imrc->translate (iommu_mr, addr, is_write ? -IOMMU_WO :IOMMU_RO ); -if (!(iotlb.perm & (1 << is_write))) { - goto translate_fail; - } + section =address_space_translate_internal ( +flatview_to_dispatch (fv), addr, xlat, + plen_out, is_mmio); - addr = ((iotlb.translated_addr & ~iotlb.addr_mask) - | (addr & iotlb.addr_mask)); - page_mask &= iotlb.addr_mask; - *plen_out =MIN (*plen_out, (addr | iotlb.addr_mask) - addr +1 ); - fv =address_space_to_flatview (iotlb.target_as); - *target_as = iotlb.target_as; + iommu_mr =memory_region_get_iommu (section->mr); +if (unlikely (iommu_mr)) { +return address_space_translate_iommu (iommu_mr, xlat, + plen_out, page_mask_out, + is_write, is_mmio, + target_as); } -if (page_mask_out) { -if (page_mask == (hwaddr)(-1 )) { -/* Not behind an IOMMU, use default page size. */ - page_mask = ~TARGET_PAGE_MASK ; - } - *page_mask_out = page_mask; +/* Not behind an IOMMU, use default page size. */ + *page_mask_out = ~TARGET_PAGE_MASK ; }return *section; - -translate_fail: -return (MemoryRegionSection ) { .mr = &io_mem_unassigned }; }/* Called from RCU critical section */
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 10/30] exec: reintroduce MemoryRegion caching
In reply to Paolo BonziniMemoryRegionCache was reverted to "normal" address_space_* operations for 2.9, due to lack of support for IOMMUs. Reinstate the optimizations, caching only the IOMMU translation at address_cache_init but not the IOMMU lookup and target AddressSpace translation are not cached; now that MemoryRegionCache supports IOMMUs, it becomes more widely applicable too.
The inlined fast path is defined in memory_ldst_cached.inc.h, while the slow path uses memory_ldst.inc.c as before. The smaller fast path causes a little code size reduction in MemoryRegionCache users:
hw/virtio/virtio.o text size before: 32373
hw/virtio/virtio.o text size after: 31941
--- exec.c | 121 ++++++++++++++++++++++++++++++---- include/exec/cpu-all.h | 6 +- include/exec/memory-internal.h | 3 + include/exec/memory.h | 58 ++++++++++++++-- include/exec/memory_ldst_cached.inc.h | 108 ++++++++++++++++++++++++++++++ memory.c | 4 +- 6 files changed, 280 insertions(+), 20 deletions(-) create mode 100644 include/exec/memory_ldst_cached.inc.h
exec.c +109 -12
@@ -3641,33 +3641,130 @@ int64_t address_space_cache_init(MemoryRegionCache *cache, hwaddr len, bool is_write) { - cache->len = len; - cache->as = as; - cache->xlat = addr; -return len; +AddressSpaceDispatch *d; +hwaddr l; +MemoryRegion *mr; + +assert (len >0 ); + + l = len; + cache->fv =address_space_get_flatview (as); + d =flatview_to_dispatch (cache->fv); + cache->mrs = *address_space_translate_internal (d, addr, &cache->xlat, &l, true); + + mr = cache->mrs.mr; +memory_region_ref (mr); +if (memory_access_is_direct (mr, is_write)) { + l =flatview_extend_translation (cache->fv, addr, len, mr, + cache->xlat, l, is_write); + cache->ptr =qemu_ram_ptr_length (mr->ram_block, cache->xlat, &l, true); + }else { + cache->ptr =NULL ; + } + + cache->len = l; + cache->is_write = is_write; +return l; }void address_space_cache_invalidate (MemoryRegionCache *cache,hwaddr addr,hwaddr access_len) { +assert (cache->is_write); +if (likely (cache->ptr)) { +invalidate_and_set_dirty (cache->mrs.mr, addr + cache->xlat, access_len); + } }void address_space_cache_destroy (MemoryRegionCache *cache) { - cache->as =NULL ; +if (!cache->mrs.mr) { +return ; + } + +if (xen_enabled ()) { +xen_invalidate_map_cache_entry (cache->ptr); + } +memory_region_unref (cache->mrs.mr); +flatview_unref (cache->fv); + cache->mrs.mr =NULL ; + cache->fv =NULL ; +} + +/* Called from RCU critical section. This function has the same +* semantics as address_space_translate, but it only works on a +* predefined range of a MemoryRegion that was mapped with +* address_space_cache_init. +*/ +static inline MemoryRegion *address_space_translate_cached ( +MemoryRegionCache *cache,hwaddr addr,hwaddr *xlat, +hwaddr *plen,bool is_write) +{ +MemoryRegionSection section; +MemoryRegion *mr; +IOMMUMemoryRegion *iommu_mr; +AddressSpace *target_as; + +assert (!cache->ptr); + *xlat = addr + cache->xlat; + + mr = cache->mrs.mr; + iommu_mr =memory_region_get_iommu (mr); +if (!iommu_mr) { +/* MMIO region. */ +return mr; + } + + section =address_space_translate_iommu (iommu_mr, xlat, plen, +NULL , is_write, true, + &target_as); +return section.mr; +} + +/* Called from RCU critical section. address_space_read_cached uses this +* out of line function when the target is an MMIO or IOMMU region. +*/ +void +address_space_read_cached_slow (MemoryRegionCache *cache,hwaddr addr, +void *buf,int len) +{ +hwaddr addr1, l; +MemoryRegion *mr; + + l = len; + mr =address_space_translate_cached (cache, addr, &addr1, &l, false); +flatview_read_continue (cache->fv, + addr,MEMTXATTRS_UNSPECIFIED , buf, len, + addr1, l, mr); +} + +/* Called from RCU critical section. address_space_write_cached uses this +* out of line function when the target is an MMIO or IOMMU region. +*/ +void +address_space_write_cached_slow (MemoryRegionCache *cache,hwaddr addr, +const void *buf,int len) +{ +hwaddr addr1, l; +MemoryRegion *mr; + + l = len; + mr =address_space_translate_cached (cache, addr, &addr1, &l, true); +flatview_write_continue (cache->fv, + addr,MEMTXATTRS_UNSPECIFIED , buf, len, + addr1, l, mr); }#define ARG1_DECL MemoryRegionCache *cache#define ARG1 cache -#define SUFFIX _cached -#define TRANSLATE (addr, ...) \ - address_space_translate(cache->as, cache->xlat + (addr), __VA_ARGS__) -#define IS_DIRECT (mr, is_write) true -#define MAP_RAM (mr, ofs) qemu_map_ram_ptr((mr)->ram_block, ofs) +#define SUFFIX _cached_slow +#define TRANSLATE (...) address_space_translate_cached(cache, __VA_ARGS__) +#define IS_DIRECT (mr, is_write) memory_access_is_direct(mr, is_write) +#define MAP_RAM (mr, ofs) (cache->ptr + (ofs - cache->xlat))#define INVALIDATE (mr, ofs, len) invalidate_and_set_dirty(mr, ofs, len) -#define RCU_READ_LOCK () rcu_read_lock() -#define RCU_READ_UNLOCK () rcu_read_unlock() +#define RCU_READ_LOCK () ((void)0) +#define RCU_READ_UNLOCK () ((void)0)#include "memory_ldst.inc.c" /* virtual memory access for debug (includes writing to ROM) */
include/exec/cpu-all.h +5 -1
@@ -175,7 +175,7 @@ extern unsigned long reserved_va;#define TARGET_ENDIANNESS #include "exec/memory_ldst.inc.h" -#define SUFFIX _cached +#define SUFFIX _cached_slow#define ARG1 cache#define ARG1_DECL MemoryRegionCache *cache#define TARGET_ENDIANNESS
@@ -193,6 +193,10 @@ static inline void stl_phys_notdirty(AddressSpace *as, hwaddr addr, uint32_t val#define TARGET_ENDIANNESS #include "exec/memory_ldst_phys.inc.h" +/* Inline fast path for direct RAM access. */ +#define ENDIANNESS +#include "exec/memory_ldst_cached.inc.h" +#define SUFFIX _cached#define ARG1 cache#define ARG1_DECL MemoryRegionCache *cache
include/exec/memory-internal.h +3 -0
@@ -31,6 +31,9 @@ static inline AddressSpaceDispatch *address_space_to_dispatch(AddressSpace *as)return flatview_to_dispatch (address_space_to_flatview (as)); } +FlatView *address_space_get_flatview (AddressSpace *as); +void flatview_unref (FlatView *view); +extern const MemoryRegionOps unassigned_mem_ops; bool memory_region_access_valid(MemoryRegion *mr, hwaddr addr,
include/exec/memory.h +53 -5
96 lines not on this page · raw message
include/exec/memory_ldst_cached.inc.h new file +108 -0
108 lines not on this page · raw message
memory.c +2 -2
@@ -298,7 +298,7 @@ static bool flatview_ref(FlatView *view)return atomic_fetch_inc_nonzero (&view->ref) >0 ; } -static void flatview_unref (FlatView *view) +void flatview_unref (FlatView *view) {if (atomic_fetch_dec (&view->ref) ==1 ) {trace_flatview_destroy_rcu (view, view->root);
@@ -822,7 +822,7 @@ static void address_space_add_del_ioeventfds(AddressSpace *as, } } -static FlatView *address_space_get_flatview (AddressSpace *as) +FlatView *address_space_get_flatview (AddressSpace *as) {FlatView *view;
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 12/30] update-linux-headers: drop hyperv.h
In reply to Paolo BonziniFrom: Roman Kagan <[email protected]>
As of mainline linux commit 5a485803221777013944cbd1a7cd5c62efba3ffa "x86/hyper-v: move hyperv.h out of uapi" by Vitaly Kuznetsov, no linux uapi header includes it, so we no longer need to create a stub for it.
Message-Id: <[email protected]>
--- scripts/update-linux-headers.sh | 6 ------ 1 file changed, 6 deletions(-)
scripts/update-linux-headers.sh +0 -6
@@ -118,9 +118,6 @@ for arch in $ARCHLIST; do cp "$tmpdir/include/asm/unistd-common.h" "$output/linux-headers/asm-arm/" fi if [ $arch = x86 ]; then - cat <<-EOF >"$output/include/standard-headers/asm-x86/hyperv.h" - /* this is a temporary placeholder until kvm_para.h stops including it */ -EOF cp "$tmpdir/include/asm/unistd_32.h" "$output/linux-headers/asm-x86/" cp "$tmpdir/include/asm/unistd_x32.h" "$output/linux-headers/asm-x86/" cp "$tmpdir/include/asm/unistd_64.h" "$output/linux-headers/asm-x86/"
@@ -144,9 +141,6 @@ else cp "$linux/COPYING" "$output/linux-headers" fi -cat <<EOF >$output/linux-headers/asm-x86/hyperv.h -#include "standard-headers/asm-x86/hyperv.h" -EOF cat <<EOF >$output/linux-headers/linux/virtio_config.h #include "standard-headers/linux/virtio_config.h" EOF
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 11/30] qemu-thread: always keep the posix wrapper layer
In reply to Paolo BonziniFrom: Peter Xu <[email protected]>
We will conditionally have a wrapper layer depending on whether the host has the PTHREAD_SETNAME capability. It complicates stuff. Let's keep the wrapper there; we opt out the pthread_setname_np() call only.
Message-Id: <[email protected]>
--- util/qemu-thread-posix.c | 33 +++++++++++++-------------------- 1 file changed, 13 insertions(+), 20 deletions(-)
util/qemu-thread-posix.c +13 -20
@@ -482,7 +482,6 @@ static void __attribute__((constructor)) qemu_thread_atexit_init(void) } -#ifdef CONFIG_PTHREAD_SETNAME_NP typedef struct { void *(*start_routine)(void *); void *arg;
@@ -495,16 +494,18 @@ static void *qemu_thread_start(void *args)void *(*start_routine)(void *) = qemu_thread_args->start_routine;void *arg = qemu_thread_args->arg; +#ifdef CONFIG_PTHREAD_SETNAME_NP /* Attempt to set the threads name; note that this is for debug, so * we're not going to fail if we can't set it. */ -pthread_setname_np (pthread_self (), qemu_thread_args->name); +if (name_threads && qemu_thread_args->name) { +pthread_setname_np (pthread_self (), qemu_thread_args->name); + } +#endif g_free (qemu_thread_args->name);g_free (qemu_thread_args);return start_routine (arg); } -#endif - void qemu_thread_create(QemuThread *thread, const char *name, void *(*start_routine)(void*),
@@ -513,6 +514,7 @@ void qemu_thread_create(QemuThread *thread, const char *name,sigset_t set, oldset;int err;pthread_attr_t attr; +QemuThreadArgs *qemu_thread_args; err =pthread_attr_init (&attr);if (err) {
@@ -527,22 +529,13 @@ void qemu_thread_create(QemuThread *thread, const char *name,sigfillset (&set);pthread_sigmask (SIG_SETMASK , &set, &oldset); -#ifdef CONFIG_PTHREAD_SETNAME_NP -if (name_threads) { -QemuThreadArgs *qemu_thread_args; - qemu_thread_args =g_new0 (QemuThreadArgs,1 ); - qemu_thread_args->name =g_strdup (name); - qemu_thread_args->start_routine = start_routine; - qemu_thread_args->arg = arg; - - err =pthread_create (&thread->thread, &attr, - qemu_thread_start, qemu_thread_args); - } else -#endif - { - err =pthread_create (&thread->thread, &attr, - start_routine, arg); - } + qemu_thread_args =g_new0 (QemuThreadArgs,1 ); + qemu_thread_args->name =g_strdup (name); + qemu_thread_args->start_routine = start_routine; + qemu_thread_args->arg = arg; + + err =pthread_create (&thread->thread, &attr, + qemu_thread_start, qemu_thread_args);if (err)error_exit (err, __func__);
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 07/30] exec: move memory access declarations to a common header, inline *_phys functions
In reply to Paolo BonziniFor now, this reduces the text size very slightly due to the newly-added inlining:
text size before: 9301965
text size after: 9300645
Later, however, the declarations in include/exec/memory_ldst.inc.h will be reused for the MemoryRegionCache slow path functions.
--- include/exec/cpu-all.h | 75 +++++++----------- include/exec/memory.h | 153 +++++++++++------------------------- include/exec/memory_ldst.inc.h | 71 +++++++++++++++++ include/exec/memory_ldst_phys.inc.h | 147 ++++++++++++++++++++++++++++++++++ memory_ldst.inc.c | 126 ----------------------------- 5 files changed, 292 insertions(+), 280 deletions(-) create mode 100644 include/exec/memory_ldst.inc.h create mode 100644 include/exec/memory_ldst_phys.inc.h
include/exec/cpu-all.h +30 -45
@@ -168,51 +168,36 @@ extern unsigned long reserved_va;#else #include "exec/hwaddr.h" -uint32_t lduw_phys (AddressSpace *as,hwaddr addr); -uint32_t ldl_phys (AddressSpace *as,hwaddr addr); -uint64_t ldq_phys (AddressSpace *as,hwaddr addr); -void stl_phys_notdirty (AddressSpace *as,hwaddr addr,uint32_t val); -void stw_phys (AddressSpace *as,hwaddr addr,uint32_t val); -void stl_phys (AddressSpace *as,hwaddr addr,uint32_t val); -void stq_phys (AddressSpace *as,hwaddr addr,uint64_t val); - -uint32_t address_space_lduw (AddressSpace *as,hwaddr addr, -MemTxAttrs attrs,MemTxResult *result); -uint32_t address_space_ldl (AddressSpace *as,hwaddr addr, -MemTxAttrs attrs,MemTxResult *result); -uint64_t address_space_ldq (AddressSpace *as,hwaddr addr, -MemTxAttrs attrs,MemTxResult *result); -void address_space_stl_notdirty (AddressSpace *as,hwaddr addr,uint32_t val, -MemTxAttrs attrs,MemTxResult *result); -void address_space_stw (AddressSpace *as,hwaddr addr,uint32_t val, -MemTxAttrs attrs,MemTxResult *result); -void address_space_stl (AddressSpace *as,hwaddr addr,uint32_t val, -MemTxAttrs attrs,MemTxResult *result); -void address_space_stq (AddressSpace *as,hwaddr addr,uint64_t val, -MemTxAttrs attrs,MemTxResult *result); - -uint32_t lduw_phys_cached (MemoryRegionCache *cache,hwaddr addr); -uint32_t ldl_phys_cached (MemoryRegionCache *cache,hwaddr addr); -uint64_t ldq_phys_cached (MemoryRegionCache *cache,hwaddr addr); -void stl_phys_notdirty_cached (MemoryRegionCache *cache,hwaddr addr,uint32_t val); -void stw_phys_cached (MemoryRegionCache *cache,hwaddr addr,uint32_t val); -void stl_phys_cached (MemoryRegionCache *cache,hwaddr addr,uint32_t val); -void stq_phys_cached (MemoryRegionCache *cache,hwaddr addr,uint64_t val); - -uint32_t address_space_lduw_cached (MemoryRegionCache *cache,hwaddr addr, -MemTxAttrs attrs,MemTxResult *result); -uint32_t address_space_ldl_cached (MemoryRegionCache *cache,hwaddr addr, -MemTxAttrs attrs,MemTxResult *result); -uint64_t address_space_ldq_cached (MemoryRegionCache *cache,hwaddr addr, -MemTxAttrs attrs,MemTxResult *result); -void address_space_stl_notdirty_cached (MemoryRegionCache *cache,hwaddr addr, -uint32_t val,MemTxAttrs attrs,MemTxResult *result); -void address_space_stw_cached (MemoryRegionCache *cache,hwaddr addr,uint32_t val, -MemTxAttrs attrs,MemTxResult *result); -void address_space_stl_cached (MemoryRegionCache *cache,hwaddr addr,uint32_t val, -MemTxAttrs attrs,MemTxResult *result); -void address_space_stq_cached (MemoryRegionCache *cache,hwaddr addr,uint64_t val, -MemTxAttrs attrs,MemTxResult *result); + +#define SUFFIX +#define ARG1 as +#define ARG1_DECL AddressSpace *as +#define TARGET_ENDIANNESS +#include "exec/memory_ldst.inc.h" + +#define SUFFIX _cached +#define ARG1 cache +#define ARG1_DECL MemoryRegionCache *cache +#define TARGET_ENDIANNESS +#include "exec/memory_ldst.inc.h" + +static inline void stl_phys_notdirty (AddressSpace *as,hwaddr addr,uint32_t val) +{ +address_space_stl_notdirty (as, addr, val, +MEMTXATTRS_UNSPECIFIED ,NULL ); +} + +#define SUFFIX +#define ARG1 as +#define ARG1_DECL AddressSpace *as +#define TARGET_ENDIANNESS +#include "exec/memory_ldst_phys.inc.h" + +#define SUFFIX _cached +#define ARG1 cache +#define ARG1_DECL MemoryRegionCache *cache +#define TARGET_ENDIANNESS +#include "exec/memory_ldst_phys.inc.h" #endif /* page related stuff */
include/exec/memory.h +44 -109
171 lines not on this page · raw message
include/exec/memory_ldst.inc.h new file +71 -0
71 lines not on this page · raw message
include/exec/memory_ldst_phys.inc.h new file +147 -0
147 lines not on this page · raw message
memory_ldst.inc.c +0 -126
180 lines not on this page · raw message
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 13/30] accel: use g_strsplit for parsing accelerator names
In reply to Paolo BonziniFrom: Daniel P. Berrangé <[email protected]>
Instead of re-using the get_opt_name() method from QemuOpts to split a string on ':', just use g_strsplit().
Message-Id: <[email protected]>
--- accel/accel.c | 16 +++++++--------- include/qemu/option.h | 1 - util/qemu-option.c | 3 ++- 3 files changed, 9 insertions(+), 11 deletions(-)
accel/accel.c +7 -9
@@ -70,8 +70,8 @@ static int accel_init_machine(AccelClass *acc, MachineState *ms)void configure_accelerator (MachineState *ms) { -const char *accel, *p; -char buf[10 ]; +const char *accel; +char **accel_list, **tmp;int ret;bool accel_initialised = false;bool init_failed = false;
@@ -83,13 +83,10 @@ void configure_accelerator(MachineState *ms) accel ="tcg" ; } - p = accel; -while (!accel_initialised && *p !='\0' ) { -if (*p ==':' ) { - p++; - } - p =get_opt_name (buf,sizeof (buf), p,':' ); - acc =accel_find (buf); + accel_list =g_strsplit (accel,":" ,0 ); + +for (tmp = accel_list; !accel_initialised && tmp && *tmp; tmp++) { + acc =accel_find (*tmp);if (!acc) {continue ; }
@@ -107,6 +104,7 @@ void configure_accelerator(MachineState *ms) accel_initialised = true; } } +g_strfreev (accel_list);if (!accel_initialised) {if (!init_failed) {
include/qemu/option.h +0 -1
@@ -28,7 +28,6 @@#include "qemu/queue.h" -const char *get_opt_name (char *buf,int buf_size,const char *p,char delim);const char *get_opt_value (char *buf,int buf_size,const char *p); void parse_option_size(const char *name, const char *value,
util/qemu-option.c +2 -1
@@ -49,7 +49,8 @@* The return value is the position of the delimiter/zero byte after the option * name in p. */ -const char *get_opt_name (char *buf,int buf_size,const char *p,char delim) +static const char *get_opt_name (char *buf,int buf_size,const char *p, +char delim) {char *q;
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 14/30] opts: don't silently truncate long parameter keys
In reply to Paolo BonziniFrom: Daniel P. Berrangé <[email protected]>
The existing QemuOpts parsing code uses a fixed size 128 byte buffer for storing the parameter keys. If a key exceeded this size it was silently truncate and no error reported to the user. This behaviour was reasonable & harmless because traditionally the key names are all statically declared, and it was known that no code was declaring a key longer than 127 bytes. This assumption, however, ceased to be valid once the block layer added support for dot-separate compound keys. This syntax allows for keys that can be arbitrarily long, limited only by the number of block drivers you can stack up. With this usage, silently truncating the key name can never lead to correct behaviour.
Hopefully such truncation would turn into an error, when the block code then tried to extract options later, but there's no guarantee that will happen. It is conceivable that an option specified by the user may be truncated and then ignored. This could have serious consequences, possibly even leading to security problems if the ignored option set a security relevant parameter.
If the operating system didn't limit the user's argv when spawning QEMU, the code should honour whatever length arguments were given without imposing its own length restrictions. This patch thus changes the code to use a heap allocated buffer for storing the keys during parsing, lifting the arbitrary length restriction.
Message-Id: <[email protected]>
--- tests/test-qemu-opts.c | 18 ------------------ util/qemu-option.c | 44 ++++++++++++++++++++++---------------------- 2 files changed, 22 insertions(+), 40 deletions(-)
tests/test-qemu-opts.c +0 -18
@@ -459,8 +459,6 @@ static void test_opts_parse(void) {Error *err =NULL ;QemuOpts *opts; -char long_key[129 ]; -char *params;/* Nothing */ opts =qemu_opts_parse (&opts_list_03,"" , false, &error_abort);
@@ -471,22 +469,6 @@ static void test_opts_parse(void) g_assert_cmpuint(opts_count(opts), ==, 1); g_assert_cmpstr(qemu_opt_get(opts, ""), ==, "val"); -/* Long key */ -memset (long_key,'a' ,127 ); - long_key[127 ] ='z' ; - long_key[128 ] =0 ; - params =g_strdup_printf ("%s=v" , long_key); - opts =qemu_opts_parse (&opts_list_03, params +1 ,NULL , &error_abort); - g_assert_cmpuint(opts_count(opts), ==, 1); - g_assert_cmpstr(qemu_opt_get(opts, long_key + 1), ==, "v"); - -/* Overlong key gets truncated */ - opts =qemu_opts_parse (&opts_list_03, params,NULL , &error_abort); -g_assert (opts_count (opts) ==1 ); - long_key[127 ] =0 ; - g_assert_cmpstr(qemu_opt_get(opts, long_key), ==, "v"); -g_free (params); -/* Multiple keys, last one wins */ opts =qemu_opts_parse (&opts_list_03,"a=1,b=2,,x,a=3" , false, &error_abort);
util/qemu-option.c +22 -22
90 lines not on this page · raw message
Signature · 1 line
1.8.3.1
Re: [Qemu-devel] [PULL 14/30] opts: don't silently truncate long parameter keys
Quoted 1 line · Paolo Bonzini
From: Daniel P. Berrangé <[email protected]>
Here the accent is right ^
Quoted 18 lines
The existing QemuOpts parsing code uses a fixed size 128 byte buffer for storing the parameter keys. If a key exceeded this size it was silently truncate and no error reported to the user. This behaviour was reasonable & harmless because traditionally the key names are all statically declared, and it was known that no code was declaring a key longer than 127 bytes. This assumption, however, ceased to be valid once the block layer added support for dot-separate compound keys. This syntax allows for keys that can be arbitrarily long, limited only by the number of block drivers you can stack up. With this usage, silently truncating the key name can never lead to correct behaviour.
Hopefully such truncation would turn into an error, when the block code then tried to extract options later, but there's no guarantee that will happen. It is conceivable that an option specified by the user may be truncated and then ignored. This could have serious consequences, possibly even leading to security problems if the ignored option set a security relevant parameter.
Quoted 7 lines
If the operating system didn't limit the user's argv when spawning QEMU, the code should honour whatever length arguments were given without imposing its own length restrictions. This patch thus changes the code to use a heap allocated buffer for storing the keys during parsing, lifting the arbitrary length restriction.
Signed-off-by Daniel P. Berrangé <[email protected]>
But this one got mojibaked -------^
Thomas
[Qemu-devel] [PULL 15/30] opts: don't silently truncate long option values
In reply to Paolo BonziniFrom: Daniel P. Berrangé <[email protected]>
The existing QemuOpts parsing code uses a fixed size 1024 byte buffer for storing the option values. If a value exceeded this size it was silently truncated and no error reported to the user. Long option values is not a common scenario, but it is conceivable that they will happen. eg if the user has a very deeply nested filesystem it would be possible to come up with a disk path that was > 1024 bytes. Most of the time if such data was silently truncated, the user would get an error about opening a non-existant disk. If they're unlucky though, QEMU might use a completely different disk image from another VM, which could be considered a security issue. Another example program was in using the -smbios command line arg with very large data blobs. In this case the silent truncation will be providing semantically incorrect data to the guest OS for SMBIOS tables.
If the operating system didn't limit the user's argv when spawning QEMU, the code should honour whatever length arguments were given without imposing its own length restrictions. This patch thus changes the code to use a heap allocated buffer for storing the values during parsing, lifting the arbitrary length restriction.
Message-Id: <[email protected]>
--- hw/i386/multiboot.c | 33 +++++++++------ include/qemu/option.h | 2 +- util/qemu-option.c | 111 +++++++++++++++++++++++++++----------------------- 3 files changed, 81 insertions(+), 65 deletions(-)
hw/i386/multiboot.c +21 -12
@@ -291,12 +291,16 @@ int load_multiboot(FWCfgState *fw_cfg, cmdline_len =strlen (kernel_filename) +1 ; cmdline_len +=strlen (kernel_cmdline) +1 ;if (initrd_filename) { -const char *r = initrd_filename; +const char *r =get_opt_value (initrd_filename,NULL ); cmdline_len +=strlen (r) +1 ; mbs.mb_mods_avail =1 ; -while (*(r =get_opt_value (NULL ,0 , r))) { - mbs.mb_mods_avail++; - r++; +while (1 ) { + mbs.mb_mods_avail++; + r =get_opt_value (r,NULL ); +if (!*r) { +break ; + } + r++; } }
@@ -313,7 +317,8 @@ int load_multiboot(FWCfgState *fw_cfg,if (initrd_filename) {const char *next_initrd; -char not_last, tmpbuf[strlen (initrd_filename) +1 ]; +char not_last; +char *one_file =NULL ; mbs.offset_mods = mbs.mb_buf_size;
@@ -322,24 +327,26 @@ int load_multiboot(FWCfgState *fw_cfg,int mb_mod_length;uint32_t offs = mbs.mb_buf_size; - next_initrd =get_opt_value (tmpbuf,sizeof (tmpbuf), initrd_filename); + next_initrd =get_opt_value (initrd_filename, &one_file); not_last = *next_initrd;/* if a space comes after the module filename, treat everything after that as parameters */ -hwaddr c =mb_add_cmdline (&mbs, tmpbuf); -if ((next_space =strchr (tmpbuf,' ' ))) +hwaddr c =mb_add_cmdline (&mbs, one_file); + next_space =strchr (one_file,' ' ); +if (next_space) { *next_space ='\0' ; -mb_debug ("multiboot loading module: %s" , tmpbuf); - mb_mod_length =get_image_size (tmpbuf); + } +mb_debug ("multiboot loading module: %s" , one_file); + mb_mod_length =get_image_size (one_file);if (mb_mod_length <0 ) { -error_report ("Failed to open file '%s'" , tmpbuf); +error_report ("Failed to open file '%s'" , one_file);exit (1 ); } mbs.mb_buf_size =TARGET_PAGE_ALIGN (mb_mod_length + mbs.mb_buf_size); mbs.mb_buf =g_realloc (mbs.mb_buf, mbs.mb_buf_size); -load_image (tmpbuf, (unsigned char *)mbs.mb_buf + offs); +load_image (one_file, (unsigned char *)mbs.mb_buf + offs);mb_add_mod (&mbs, mbs.mb_buf_phys + offs, mbs.mb_buf_phys + offs + mb_mod_length, c);
@@ -347,6 +354,8 @@ int load_multiboot(FWCfgState *fw_cfg, (char *)mbs.mb_buf + offs, (char *)mbs.mb_buf + offs + mb_mod_length, c); initrd_filename = next_initrd+1 ; +g_free (one_file); + one_file =NULL ; }while (not_last); }
include/qemu/option.h +1 -1
@@ -28,7 +28,7 @@#include "qemu/queue.h" -const char *get_opt_value (char *buf,int buf_size,const char *p); +const char *get_opt_value (const char *p,char **value);void parse_option_size (const char *name,const char *value,uint64_t *ret,Error **errp);
util/qemu-option.c +59 -52
230 lines not on this page · raw message
Signature · 1 line
1.8.3.1
Re: [Qemu-devel] [PULL 15/30] opts: don't silently truncate long option values
Quoted 16 lines · Paolo Bonzini
From: Daniel P. Berrangé <[email protected]>
The existing QemuOpts parsing code uses a fixed size 1024 byte buffer for storing the option values. If a value exceeded this size it was silently truncated and no error reported to the user. Long option values is not a common scenario, but it is conceivable that they will happen. eg if the user has a very deeply nested filesystem it would be possible to come up with a disk path that was > 1024 bytes. Most of the time if such data was silently truncated, the user would get an error about opening a non-existant disk. If they're unlucky though, QEMU might use a completely different disk image from another VM, which could be considered a security issue. Another example program was in using the -smbios command line arg with very large data blobs. In this case the silent truncation will be providing semantically incorrect data to the guest OS for SMBIOS tables.
Quoted 5 lines
If the operating system didn't limit the user's argv when spawning QEMU, the code should honour whatever length arguments were given without imposing its own length restrictions. This patch thus changes the code to use a heap allocated buffer for storing the values during parsing, lifting the arbitrary length restriction.
Hi; Coverity doesn't like this change (CID1391003):
Quoted 4 lines
util/qemu-option.c +0
-0@@ -70,25 +70,37 @@ static const char *get_opt_name(const char *p, char **option, char delim)* delimiter is fixed to be comma which starts a new option. To specify an
util/qemu-option.c static const char *get_opt_name(const char *p, char **option, char delim) · line 78
Quoted 10 lines
util/qemu-option.c +5
-2* option value that contains commas, double each comma. */ -const char *get_opt_value (char *buf,int buf_size,const char *p) +const char *get_opt_value (const char *p,char **value) { -char *q; +size_t capacity =0 , length; +const char *offset; + + *value =NULL ;
Here we write to *value, so value must be non-NULL, and within the loop the only place we write to value it can't become NULL either (g_renew can't fail)...
Quoted 7 lines
util/qemu-option.c +5
-1+while (1 ) { + offset =strchr (p,',' ); +if (!offset) { + offset = p +strlen (p); + } - q = buf;
util/qemu-option.c static const char *get_opt_name(const char *p, char **option, char delim) · line 89
Quoted 10 lines
util/qemu-option.c +5
-5-while (*p !='\0' ) { -if (*p ==',' ) { -if (*(p +1 ) !=',' ) -break ; - p++; + length = offset - p; +if (*offset !='\0' && *(offset +1 ) ==',' ) { + length++; + } +if (value) {
...so this check for whether value is NULL can never be true.
Quoted 12 lines
util/qemu-option.c +8
-3+ *value =g_renew (char, *value, capacity + length +1 ); +strncpy (*value + capacity, p, length); + (*value)[capacity + length] ='\0' ; + } + capacity += length; +if (*offset =='\0' || + *(offset +1 ) !=',' ) { +break ; } -if (q && (q - buf) < buf_size -1 ) - *q++ = *p; - p++;
util/qemu-option.c static const char *get_opt_name(const char *p, char **option, char delim) · line 105
Quoted 10 lines
util/qemu-option.c +3
-3+ + p += (offset - p) +2 ; } -if (q) - *q ='\0' ; -return p; +return offset; }
thanks
-- PMM
Re: [Qemu-devel] [PULL 15/30] opts: don't silently truncate long option values
Quoted 35 lines · Peter Maydell
Quoted 16 lines · Paolo Bonzini
From: Daniel P. Berrangé <[email protected]>
The existing QemuOpts parsing code uses a fixed size 1024 byte buffer for storing the option values. If a value exceeded this size it was silently truncated and no error reported to the user. Long option values is not a common scenario, but it is conceivable that they will happen. eg if the user has a very deeply nested filesystem it would be possible to come up with a disk path that was > 1024 bytes. Most of the time if such data was silently truncated, the user would get an error about opening a non-existant disk. If they're unlucky though, QEMU might use a completely different disk image from another VM, which could be considered a security issue. Another example program was in using the -smbios command line arg with very large data blobs. In this case the silent truncation will be providing semantically incorrect data to the guest OS for SMBIOS tables.
Quoted 5 lines
If the operating system didn't limit the user's argv when spawning QEMU, the code should honour whatever length arguments were given without imposing its own length restrictions. This patch thus changes the code to use a heap allocated buffer for storing the values during parsing, lifting the arbitrary length restriction.
Hi; Coverity doesn't like this change (CID1391003):
Quoted 10 lines
util/qemu-option.c +1
-2@@ -70,25 +70,37 @@ static const char *get_opt_name(const char *p, char **option, char delim)* delimiter is fixed to be comma which starts a new option. To specify an * option value that contains commas, double each comma. */ -const char *get_opt_value (char *buf,int buf_size,const char *p) +const char *get_opt_value (const char *p,char **value) { -char *q;
Quoted 8 lines
util/qemu-option.c static const char *get_opt_name(const char *p, char **option, char delim) · line 78
Quoted 4 lines
util/qemu-option.c +4
-0+size_t capacity =0 , length; +const char *offset; + + *value =NULL ;Here we write to *value, so value must be non-NULL, and within the loop the only place we write to value it can't become NULL either (
g_renewcan't fail)...
Oh, real bug ! This should have been
if (value) {
*value = NULL;
}because multiboot.c passes in NULL for this parameter.
Unless we decide to rewrite multiboot.c to avoid that instead, since all other callers pass non-NULL.
Quoted 39 lines
Quoted 8 lines
util/qemu-option.c +5
-1+while (1 ) { + offset =strchr (p,',' ); +if (!offset) { + offset = p +strlen (p); + } - q = buf;util/qemu-option.c static const char *get_opt_name(const char *p, char **option, char delim) · line 89
Quoted 10 lines
util/qemu-option.c +5
-5-while (*p !='\0' ) { -if (*p ==',' ) { -if (*(p +1 ) !=',' ) -break ; - p++; + length = offset - p; +if (*offset !='\0' && *(offset +1 ) ==',' ) { + length++; + } +if (value) {...so this check for whether value is NULL can never be true.
Quoted 18 lines
util/qemu-option.c +10
-5+ *value =g_renew (char, *value, capacity + length +1 ); +strncpy (*value + capacity, p, length); + (*value)[capacity + length] ='\0' ; + } + capacity += length; +if (*offset =='\0' || + *(offset +1 ) !=',' ) { +break ; } -if (q && (q - buf) < buf_size -1 ) - *q++ = *p; - p++; + + p += (offset - p) +2 ; } -if (q) - *q ='\0' ;
Quoted 8 lines
util/qemu-option.c static const char *get_opt_name(const char *p, char **option, char delim) · line 105
Quoted 4 lines
util/qemu-option.c +1
-1-return p; +return offset; }thanks
-- PMM
Regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
[Qemu-devel] [PULL 16/30] target/i386: sev: fix memory leaks
In reply to Paolo BonziniReported by Coverity.
--- target/i386/sev.c | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-)
target/i386/sev.c +17 -15
@@ -430,7 +430,8 @@ static int sev_get_pdh_info(int fd, guchar **pdh, size_t *pdh_len, guchar **cert_chain, size_t *cert_chain_len) { - guchar *pdh_data, *cert_chain_data; + guchar *pdh_data = NULL; +guchar *cert_chain_data =NULL ;struct sev_user_data_pdh_cert_export export = {};int err, r;
@@ -471,8 +472,9 @@ e_free:SevCapability *sev_get_capabilities (void ) { -SevCapability *cap; -guchar *pdh_data, *cert_chain_data; +SevCapability *cap =NULL ; +guchar *pdh_data =NULL ; +guchar *cert_chain_data =NULL ;size_t pdh_len =0 , cert_chain_len =0 ;uint32_t ebx;int fd;
@@ -486,7 +488,7 @@ sev_get_capabilities(void)if (sev_get_pdh_info (fd, &pdh_data, &pdh_len, &cert_chain_data, &cert_chain_len)) { -return NULL ; + goto out; } cap =g_new0 (SevCapability,1 );
@@ -502,9 +504,9 @@ sev_get_capabilities(void)*/ cap->reduced_phys_bits =1 ; +out:g_free (pdh_data);g_free (cert_chain_data); -close (fd);return cap; }
@@ -530,7 +532,7 @@ sev_launch_start(SEVState *s) {gsize sz;int ret =1 ; -int fw_error; +int fw_error, rc;QSevGuestInfo *sev = s->sev_info;struct kvm_sev_launch_start *start;guchar *session =NULL , *dh_cert =NULL ;
@@ -543,7 +545,7 @@ sev_launch_start(SEVState *s) &error_abort);if (sev->session_file) {if (sev_read_file_base64 (sev->session_file, &session, &sz) <0 ) { -return 1 ; + goto out; } start->session_uaddr = (unsigned long )session; start->session_len = sz;
@@ -551,18 +553,18 @@ sev_launch_start(SEVState *s)if (sev->dh_cert_file) {if (sev_read_file_base64 (sev->dh_cert_file, &dh_cert, &sz) <0 ) { -return 1 ; + goto out; } start->dh_uaddr = (unsigned long )dh_cert; start->dh_len = sz; }trace_kvm_sev_launch_start (start->policy, session, dh_cert); - ret =sev_ioctl (s->sev_fd,KVM_SEV_LAUNCH_START , start, &fw_error); -if (ret <0 ) { + rc =sev_ioctl (s->sev_fd,KVM_SEV_LAUNCH_START , start, &fw_error); +if (rc <0 ) {error_report ("%s: LAUNCH_START ret=%d fw_error=%d '%s'" , __func__, ret, fw_error,fw_error_to_str (fw_error)); -return 1 ; + goto out; } object_property_set_int(OBJECT(sev), start->handle, "handle",
@@ -570,12 +572,13 @@ sev_launch_start(SEVState *s)sev_set_guest_state (SEV_STATE_LAUNCH_UPDATE ); s->handle = start->handle; s->policy = start->policy; + ret =0 ; +out:g_free (start);g_free (session);g_free (dh_cert); - -return 0 ; +return ret; } static int
@@ -712,7 +715,7 @@ sev_guest_init(const char *id)uint32_t host_cbitpos;struct sev_user_data_status status = {}; - s =g_new0 (SEVState,1 ); + sev_state = s =g_new0 (SEVState,1 ); s->sev_info =lookup_sev_guest_info (id);if (!s->sev_info) { error_report("%s: '%s' is not a valid '%s' object",
@@ -720,7 +723,6 @@ sev_guest_init(const char *id) goto err; } - sev_state = s; s->state =SEV_STATE_UNINIT ;host_cpuid (0x8000001F ,0 ,NULL , &ebx,NULL ,NULL );
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 17/30] qemu-options: Mark -virtioconsole as deprecated
In reply to Paolo BonziniFrom: Thomas Huth <[email protected]>
The qemu-doc already states that this option is only maintained for backward compatibility and "-device virtconsole" should be used instead. So let's take the next step and mark this option officially as deprecated.
Message-Id: <[email protected]>
--- qemu-doc.texi | 5 +++++ qemu-options.hx | 5 +---- vl.c | 2 ++ 3 files changed, 8 insertions(+), 4 deletions(-)
qemu-doc.texi +5 -0
@@ -2931,6 +2931,11 @@ The @code{-localtime} option has been replaced by @code{-rtc base=localtime}. The @code{-startdate} option has been replaced by @code{-rtc base=@var{date}}. +@subsection -virtioconsole (since 2.13.0) + +Option @option{-virtioconsole} has been replaced by +@option{-device virtconsole}. + @section qemu-img command line arguments @subsection convert -s (since 2.0.0)
qemu-options.hx +1 -4
@@ -3675,10 +3675,7 @@ STEXI @item -virtioconsole @var{c} @findex -virtioconsole Set virtio console. - -This option is maintained for backward compatibility. - -Please use @code{-device virtconsole} for the new way of invocation. +This option is deprecated, please use @option{-device virtconsole} instead. ETEXI DEF("show-cursor", 0, QEMU_OPTION_show_cursor, \
vl.c +2 -0
@@ -3587,6 +3587,8 @@ int main(int argc, char **argv, char **envp) }break ;case QEMU_OPTION_virtiocon: +warn_report ("This option is deprecated, " +"use '-device virtconsole' instead" );add_device_config (DEV_VIRTCON , optarg); default_virtcon =0 ;if (strncmp (optarg,"mon:" ,4 ) ==0 ) {
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 18/30] qemu-options: Remove remainders of the -tdf option
In reply to Paolo BonziniFrom: Thomas Huth <[email protected]>
The -tdf options has been removed with d07aa197c5a1556449361a0cbb5108e2, but apparently I forgot to remove the corresponding two lines from qemu-options.hx, so this option is still "available" and just silently ignored. Kill it now for good.
Message-Id: <[email protected]>
--- qemu-options.hx | 3 --- 1 file changed, 3 deletions(-)
qemu-options.hx +0 -3
@@ -3921,9 +3921,6 @@ DEF("no-kvm-pit-reinjection", 0, QEMU_OPTION_no_kvm_pit_reinjection, HXCOMM Deprecated by -machine kernel_irqchip=on|off property DEF("no-kvm-irqchip", 0, QEMU_OPTION_no_kvm_irqchip, "", QEMU_ARCH_I386) -HXCOMM Deprecated (ignored) -DEF("tdf", 0, QEMU_OPTION_tdf,"", QEMU_ARCH_ALL) - DEF("msg", HAS_ARG, QEMU_OPTION_msg, "-msg timestamp[=on|off]\n" " change the format of messages\n"
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 19/30] qemu-options: Bail out on unsupported options instead of silently ignoring them
In reply to Paolo BonziniFrom: Thomas Huth <[email protected]>
The dangling remainder of the -tdf option revealed a deficiency in our option parsing: Options that have been declared, but are not supported in the switch-case statement in vl.c and not handled in the OS-specifc os_parse_cmd_args() functions are currently silently ignored. We should rather tell the users that they specified something that we can not handle, so let's print an error message and exit instead.
Message-Id: <[email protected]>
--- include/qemu-common.h | 2 +- os-posix.c | 6 +++++- os-win32.c | 4 ++-- vl.c | 5 ++++- 4 files changed, 12 insertions(+), 5 deletions(-)
include/qemu-common.h +1 -1
@@ -137,7 +137,7 @@ char *qemu_find_file(int type, const char *name);/* OS specific functions */ void os_setup_early_signal_handling (void );char *os_find_datadir (void ); -void os_parse_cmd_args (int index,const char *optarg); +int os_parse_cmd_args (int index,const char *optarg);#include "qemu/module.h"
os-posix.c +5 -1
@@ -165,7 +165,7 @@ static bool os_parse_runas_uid_gid(const char *optarg)* Parse OS specific command line options. * return 0 if option handled, -1 otherwise */ -void os_parse_cmd_args (int index,const char *optarg) +int os_parse_cmd_args (int index,const char *optarg) {switch (index) {#ifdef CONFIG_SLIRP
@@ -199,7 +199,11 @@ void os_parse_cmd_args(int index, const char *optarg)fips_set_state (true);break ;#endif +default : +return -1 ; } + +return 0 ; }static void change_process_uid (void )
os-win32.c +2 -2
@@ -93,9 +93,9 @@ void os_set_line_buffering(void)* Parse OS specific command line options. * return 0 if option handled, -1 otherwise */ -void os_parse_cmd_args (int index,const char *optarg) +int os_parse_cmd_args (int index,const char *optarg) { -return ; +return -1 ; }int qemu_create_pidfile (const char *filename)
vl.c +4 -1
@@ -4033,7 +4033,10 @@ int main(int argc, char **argv, char **envp) }break ;default : -os_parse_cmd_args (popt->index, optarg); +if (os_parse_cmd_args (popt->index, optarg)) { +error_report ("Option not supported in this build" ); +exit (1 ); + } } } }
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 20/30] qemu-options: Remove deprecated -no-kvm-pit-reinjection
In reply to Paolo BonziniFrom: Thomas Huth <[email protected]>
Deprecated since the beginning when it was added for compatibility with the ancient qemu-kvm fork of QEMU, and it even printed out the deprecation warning since right from the start (i.e. QEMU v1.3.0), so it's really time to remove this now.
Message-Id: <[email protected]>
--- qemu-doc.texi | 5 ----- qemu-options.hx | 4 ---- vl.c | 12 ------------ 3 files changed, 21 deletions(-)
qemu-doc.texi +0 -5
@@ -2786,11 +2786,6 @@ which is the default. @section System emulator command line arguments -@subsection -no-kvm-pit-reinjection (since 1.3.0) - -The ``-no-kvm-pit-reinjection'' argument is now a -synonym for setting ``-global kvm-pit.lost_tick_policy=discard''. - @subsection -no-kvm-irqchip (since 1.3.0) The ``-no-kvm-irqchip'' argument is now a synonym for
qemu-options.hx +0 -4
@@ -3914,10 +3914,6 @@ ETEXI HXCOMM Deprecated by -machine accel=tcg property DEF("no-kvm", 0, QEMU_OPTION_no_kvm, "", QEMU_ARCH_I386) -HXCOMM Deprecated by kvm-pit driver properties -DEF("no-kvm-pit-reinjection", 0, QEMU_OPTION_no_kvm_pit_reinjection, - "", QEMU_ARCH_I386) - HXCOMM Deprecated by -machine kernel_irqchip=on|off property DEF("no-kvm-irqchip", 0, QEMU_OPTION_no_kvm_irqchip, "", QEMU_ARCH_I386)
vl.c +0 -12
@@ -3696,18 +3696,6 @@ int main(int argc, char **argv, char **envp) olist =qemu_find_opts ("machine" );qemu_opts_parse_noisily (olist,"accel=tcg" , false);break ; -case QEMU_OPTION_no_kvm_pit_reinjection: { -static GlobalProperty kvm_pit_lost_tick_policy = { - .driver ="kvm-pit" , - .property ="lost_tick_policy" , - .value ="discard" , - }; - -warn_report ("deprecated, replaced by " -"-global kvm-pit.lost_tick_policy=discard" ); -qdev_prop_register_global (&kvm_pit_lost_tick_policy); -break ; - }case QEMU_OPTION_accel: accel_opts =qemu_opts_parse_noisily (qemu_find_opts ("accel" ), optarg, true);
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 21/30] qemu-options: Remove deprecated -no-kvm-irqchip
In reply to Paolo BonziniFrom: Thomas Huth <[email protected]>
We've never documented this option in our qemu-doc, so apart from the users that already used the old qemu-kvm fork before, most users should not be aware of this option at all. It's been marked as deprecated in the source code for a long time already, and officially marked as deprecated in the documentation since QEMU v2.10, so it should be fine to remove this now.
Message-Id: <[email protected]>
--- qemu-doc.texi | 5 ----- qemu-options.hx | 3 --- vl.c | 5 ----- 3 files changed, 13 deletions(-)
qemu-doc.texi +0 -5
@@ -2786,11 +2786,6 @@ which is the default. @section System emulator command line arguments -@subsection -no-kvm-irqchip (since 1.3.0) - -The ``-no-kvm-irqchip'' argument is now a synonym for -setting ``-machine kernel_irqchip=off''. - @subsection -no-kvm (since 1.3.0) The ``-no-kvm'' argument is now a synonym for setting
qemu-options.hx +0 -3
@@ -3914,9 +3914,6 @@ ETEXI HXCOMM Deprecated by -machine accel=tcg property DEF("no-kvm", 0, QEMU_OPTION_no_kvm, "", QEMU_ARCH_I386) -HXCOMM Deprecated by -machine kernel_irqchip=on|off property -DEF("no-kvm-irqchip", 0, QEMU_OPTION_no_kvm_irqchip, "", QEMU_ARCH_I386) - DEF("msg", HAS_ARG, QEMU_OPTION_msg, "-msg timestamp[=on|off]\n" " change the format of messages\n"
vl.c +0 -5
@@ -3138,11 +3138,6 @@ int main(int argc, char **argv, char **envp)exit (1 ); }switch (popt->index) { -case QEMU_OPTION_no_kvm_irqchip: { - olist =qemu_find_opts ("machine" ); -qemu_opts_parse_noisily (olist,"kernel_irqchip=off" , false); -break ; - }case QEMU_OPTION_cpu:/* hw initialization will check this */ cpu_model = optarg;
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 22/30] qemu-doc: provide details of supported build platforms
In reply to Paolo BonziniFrom: Daniel P. Berrangé <[email protected]>
Describe the policy the project uses to decide which OS are supported as build platforms. This will:
- Allow maintainers to determine when the minimum version of a 3rd party piece of software can be increased without negatively impacting supported platforms.
- Allow tailoring of CI environments to match the intended supported build platforms.
Message-Id: <[email protected]>
--- qemu-doc.texi | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+)
qemu-doc.texi +68 -0
@@ -39,6 +39,7 @@ * QEMU User space emulator:: * Implementation notes:: * Deprecated features:: +* Supported build platforms:: * License:: * Index:: @end menu
@@ -2976,6 +2977,73 @@ The ``xlnx-zcu102'' machine has the same features and capabilites in QEMU. In order to prevent QEMU from automatically opening an image's backing chain, use ``"backing": null'' instead. +@node Supported build platforms +@appendix Supported build platforms + +QEMU aims to support building and executing on multiple host OS platforms. +This appendix outlines which platforms are the major build targets. These +platforms are used as the basis for deciding upon the minimum required +versions of 3rd party software QEMU depends on. The supported platforms +are the targets for automated testing performed by the project when patches +are submitted for review, and tested before and after merge. + +If a platform is not listed here, it does not imply that QEMU won't work. +If an unlisted platform has comparable software versions to a listed platform, +there is every expectation that it will work. Bug reports are welcome for +problems encountered on unlisted platforms unless they are clearly older +vintage than what is described here. + +Note that when considering software versions shipped in distros as support +targets, QEMU considers only the version number, and assumes the features in +that distro match the upstream release with the same version. In other words, +if a distro backports extra features to the software in their distro, QEMU +upstream code will not add explicit support for those backports, unless the +feature is auto-detectable in a manner that works for the upstream releases +too. + +The Repology site @url{https://repology.org} is a useful resource to identify +currently shipped versions of software in various operating systems, though +it does not cover all distros listed below. + +@section Linux OS + +For distributions with frequent, short-lifetime releases, the project will +aim to support all versions that are not end of life by their respective +vendors. For the purposes of identifying supported software versions, the +project will look at Fedora, Ubuntu, and openSUSE distros. Other short- +lifetime distros will be assumed to ship similar software versions. + +For distributions with long-lifetime releases, the project will aim to support +the most recent major version at all times. Support for the previous major +version will be dropped 2 years after the new major version is released. For +the purposes of identifying supported software versions, the project will look +at RHEL, Debian, Ubuntu LTS, and SLES distros. Other long-lifetime distros will +be assumed to ship similar software versions. + +@section Windows + +The project supports building with current versions of the MinGW toolchain, +hosted on Linux. + +@section macOS + +The project supports building with the two most recent versions of macOS, with +the current homebrew package set available. + +@section FreeBSD + +The project aims to support the all the versions which are not end of life. + +@section NetBSD + +The project aims to support the most recent major version at all times. Support +for the previous major version will be dropped 2 years after the new major +version is released. + +@section OpenBSD + +The project aims to support the all the versions which are not end of life. + @node License @appendix License
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 23/30] glib: bump min required glib library version to 2.42
In reply to Paolo BonziniFrom: Daniel P. Berrangé <[email protected]>
Per supported platforms doc, the various min glib on relevant distros is:
RHEL-7: 2.50.3
Debian (Stretch): 2.50.3
Debian (Jessie): 2.42.1
OpenBSD (Ports): 2.54.3
FreeBSD (Ports): 2.50.3
OpenSUSE Leap 15: 2.54.3
Ubuntu (Xenial): 2.48.0
macOS (Homebrew): 2.56.0
This suggests that a minimum glib of 2.42 is a reasonable target
Message-Id: <[email protected]>
--- configure | 6 +- docs/devel/testing.rst | 4 +- include/glib-compat.h | 319 ------------------------------- tests/docker/dockerfiles/centos6.docker | 30 --- tests/docker/dockerfiles/min-glib.docker | 8 - tests/test-qmp-event.c | 2 +- tests/tpm-emu.h | 4 +- tests/vhost-user-test.c | 4 +- trace/simple.c | 6 +- 9 files changed, 11 insertions(+), 372 deletions(-) delete mode 100644 tests/docker/dockerfiles/centos6.docker delete mode 100644 tests/docker/dockerfiles/min-glib.docker
configure +1 -5
@@ -3394,11 +3394,7 @@ fi ########################################## # glib support probe -if test "$mingw32" = yes; then - glib_req_ver=2.30 -else - glib_req_ver=2.22 -fi +glib_req_ver=2.42 glib_modules=gthread-2.0 if test "$modules" = yes; then glib_modules="$glib_modules gmodule-export-2.0"
docs/devel/testing.rst +2 -2
@@ -297,9 +297,9 @@ the container, with parameters defined by the make target): .. code:: - make docker-test-build@min-glib + make docker-test-build@centos7 -This will create a container instance using the ``min-glib`` image (the image +This will create a container instance using the ``centos7`` image (the image is downloaded and initialized automatically), in which the ``test-build`` job is executed.
include/glib-compat.h +0 -319
335 lines not on this page · raw message
tests/docker/dockerfiles/centos6.docker deleted +0 -30
@@ -1,30 +0,0 @@ -FROM centos:6 -RUN yum install -y epel-release centos-release-xen -ENV PACKAGES \ - bison \ - bzip2-devel \ - ccache \ - csnappy-devel \ - flex \ - g++ \ - gcc \ - gettext \ - git \ - glib2-devel \ - libepoxy-devel \ - libfdt-devel \ - librdmacm-devel \ - lzo-devel \ - make \ - mesa-libEGL-devel \ - mesa-libgbm-devel \ - pixman-devel \ - SDL-devel \ - spice-glib-devel \ - spice-server-devel \ - tar \ - vte-devel \ - xen-devel \ - zlib-devel -RUN yum install -y $PACKAGES -RUN rpm -q $PACKAGES | sort > /packages.txt
tests/docker/dockerfiles/min-glib.docker deleted +0 -8
@@ -1,8 +0,0 @@ -FROM centos:6 -RUN yum install -y \ - tar gettext git make gcc g++ \ - zlib-devel SDL-devel pixman-devel \ - epel-release -RUN yum install -y libfdt-devel ccache -RUN yum downgrade -y http://vault.centos.org/6.0/os/x86_64/Packages/glib2-2.22.5-5.el6.x86_64.rpm -RUN yum install -y http://vault.centos.org/6.0/os/x86_64/Packages/glib2-devel-2.22.5-5.el6.x86_64.rpm
tests/test-qmp-event.c +1 -1
@@ -32,7 +32,7 @@ typedef struct QDictCmpData { } QDictCmpData;TestEventData *test_event_data; -static CompatGMutex test_event_lock; +static GMutex test_event_lock;/* Only compares bool, int, string */ static
tests/tpm-emu.h +2 -2
@@ -24,8 +24,8 @@ struct tpm_hdr { }QEMU_PACKED ; typedef struct TestState { - CompatGMutex data_mutex; - CompatGCond data_cond; + GMutex data_mutex; + GCond data_cond; SocketAddress *addr; QIOChannel *tpm_ioc; GThread *emu_tpm_thread;
tests/vhost-user-test.c +2 -2
@@ -150,8 +150,8 @@ typedef struct TestServer {int fds_num;int fds[VHOST_MEMORY_MAX_NREGIONS ];VhostUserMemory memory; -CompatGMutex data_mutex; -CompatGCond data_cond; +GMutex data_mutex; +GCond data_cond;int log_fd;uint64_t rings;bool test_fail;
trace/simple.c +3 -3
@@ -36,9 +36,9 @@* Trace records are written out by a dedicated thread. The thread waits for * records to become available, writes them out, and then waits again. */ -static CompatGMutex trace_lock; -static CompatGCond trace_available_cond; -static CompatGCond trace_empty_cond; +static GMutex trace_lock; +static GCond trace_available_cond; +static GCond trace_empty_cond;static bool trace_available;static bool trace_writeout_enabled;
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 24/30] i386/kvm: add support for Hyper-V reenlightenment MSRs
In reply to Paolo BonziniFrom: Vitaly Kuznetsov <[email protected]>
KVM recently gained support for Hyper-V Reenlightenment MSRs which are required to make KVM-on-Hyper-V enable TSC page clocksource to its guests when INVTSC is not passed to it (and it is not passed by default in Qemu as it effectively blocks migration).
Message-Id: <[email protected]>
--- target/i386/cpu.c | 4 +++- target/i386/cpu.h | 4 ++++ target/i386/hyperv-proto.h | 9 ++++++++- target/i386/kvm.c | 39 ++++++++++++++++++++++++++++++++++++++- target/i386/machine.c | 24 ++++++++++++++++++++++++ 5 files changed, 77 insertions(+), 3 deletions(-)
target/i386/cpu.c +3 -1
@@ -416,7 +416,8 @@ static FeatureWordInfo feature_word_info[FEATURE_WORDS] = {NULL /* hv_vpindex_access */ ,NULL /* hv_msr_reset_access */ ,NULL /* hv_msr_stats_access */ ,NULL /* hv_reftsc_access */ ,NULL /* hv_msr_idle_access */ ,NULL /* hv_msr_frequency_access */ , -NULL ,NULL ,NULL ,NULL , +NULL /* hv_msr_debug_access */ ,NULL /* hv_msr_reenlightenment_access */ , +NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL , NULL, NULL, NULL, NULL,
@@ -4770,6 +4771,7 @@ static Property x86_cpu_properties[] = {DEFINE_PROP_BOOL ("hv-synic" ,X86CPU , hyperv_synic, false),DEFINE_PROP_BOOL ("hv-stimer" ,X86CPU , hyperv_stimer, false),DEFINE_PROP_BOOL ("hv-frequencies" ,X86CPU , hyperv_frequencies, false), +DEFINE_PROP_BOOL ("hv-reenlightenment" ,X86CPU , hyperv_reenlightenment, false),DEFINE_PROP_BOOL ("check" ,X86CPU , check_cpuid, true),DEFINE_PROP_BOOL ("enforce" ,X86CPU , enforce_cpuid, false), DEFINE_PROP_BOOL("kvm", X86CPU, expose_kvm, true),
target/i386/cpu.h +4 -0
@@ -1174,6 +1174,9 @@ typedef struct CPUX86State {uint64_t msr_hv_synic_sint[HV_SINT_COUNT ];uint64_t msr_hv_stimer_config[HV_STIMER_COUNT ];uint64_t msr_hv_stimer_count[HV_STIMER_COUNT ]; +uint64_t msr_hv_reenlightenment_control; +uint64_t msr_hv_tsc_emulation_control; +uint64_t msr_hv_tsc_emulation_status;uint64_t msr_rtit_ctrl;uint64_t msr_rtit_status;
@@ -1297,6 +1300,7 @@ struct X86CPU {bool hyperv_synic;bool hyperv_stimer;bool hyperv_frequencies; +bool hyperv_reenlightenment;bool check_cpuid;bool enforce_cpuid;bool expose_kvm;
target/i386/hyperv-proto.h +8 -1
@@ -35,7 +35,7 @@#define HV_RESET_AVAILABLE (1u << 7)#define HV_REFERENCE_TSC_AVAILABLE (1u << 9)#define HV_ACCESS_FREQUENCY_MSRS (1u << 11) - +#define HV_ACCESS_REENLIGHTENMENTS_CONTROL (1u << 13)/* * HV_CPUID_FEATURES.EDX bits
@@ -130,6 +130,13 @@#define HV_CRASH_CTL_NOTIFY (1ull << 63)/* +* Reenlightenment notification MSRs +*/ +#define HV_X64_MSR_REENLIGHTENMENT_CONTROL 0x40000106 +#define HV_X64_MSR_TSC_EMULATION_CONTROL 0x40000107 +#define HV_X64_MSR_TSC_EMULATION_STATUS 0x40000108 + +/* * Hypercall status code */ #define HV_STATUS_SUCCESS 0
target/i386/kvm.c +38 -1
@@ -90,6 +90,7 @@ static bool has_msr_hv_runtime;static bool has_msr_hv_synic;static bool has_msr_hv_stimer;static bool has_msr_hv_frequencies; +static bool has_msr_hv_reenlightenment;static bool has_msr_xss;static bool has_msr_spec_ctrl;static bool has_msr_smi_count;
@@ -583,7 +584,8 @@ static bool hyperv_enabled(X86CPU *cpu) cpu->hyperv_vpindex || cpu->hyperv_runtime || cpu->hyperv_synic || - cpu->hyperv_stimer); + cpu->hyperv_stimer || + cpu->hyperv_reenlightenment); }static int kvm_arch_set_tsc_khz (CPUState *cs)
@@ -669,6 +671,16 @@ static int hyperv_handle_properties(CPUState *cs) } env->features[FEAT_HYPERV_EDX ] |=HV_GUEST_CRASH_MSR_AVAILABLE ; } +if (cpu->hyperv_reenlightenment) { +if (!has_msr_hv_reenlightenment) { +fprintf (stderr, +"Hyper-V Reenlightenment MSRs " +"(requested by 'hv-reenlightenment' cpu flag) " +"are not supported by kernel\n" ); +return -ENOSYS ; + } + env->features[FEAT_HYPERV_EAX ] |=HV_ACCESS_REENLIGHTENMENTS_CONTROL ; + } env->features[FEAT_HYPERV_EDX ] |=HV_CPU_DYNAMIC_PARTITIONING_AVAILABLE ;if (cpu->hyperv_reset) {if (!has_msr_hv_reset) {
@@ -1215,6 +1227,9 @@ static int kvm_get_supported_msrs(KVMState *s)case HV_X64_MSR_TSC_FREQUENCY : has_msr_hv_frequencies = true;break ; +case HV_X64_MSR_REENLIGHTENMENT_CONTROL : + has_msr_hv_reenlightenment = true; +break ;case MSR_IA32_SPEC_CTRL : has_msr_spec_ctrl = true;break ;
@@ -1778,6 +1793,14 @@ static int kvm_put_msrs(X86CPU *cpu, int level)kvm_msr_entry_add (cpu,HV_X64_MSR_REFERENCE_TSC , env->msr_hv_tsc); } +if (cpu->hyperv_reenlightenment) { +kvm_msr_entry_add (cpu,HV_X64_MSR_REENLIGHTENMENT_CONTROL , + env->msr_hv_reenlightenment_control); +kvm_msr_entry_add (cpu,HV_X64_MSR_TSC_EMULATION_CONTROL , + env->msr_hv_tsc_emulation_control); +kvm_msr_entry_add (cpu,HV_X64_MSR_TSC_EMULATION_STATUS , + env->msr_hv_tsc_emulation_status); + } }if (cpu->hyperv_vapic) { kvm_msr_entry_add(cpu, HV_X64_MSR_APIC_ASSIST_PAGE,
@@ -2140,6 +2163,11 @@ static int kvm_get_msrs(X86CPU *cpu)if (cpu->hyperv_time) {kvm_msr_entry_add (cpu,HV_X64_MSR_REFERENCE_TSC ,0 ); } +if (cpu->hyperv_reenlightenment) { +kvm_msr_entry_add (cpu,HV_X64_MSR_REENLIGHTENMENT_CONTROL ,0 ); +kvm_msr_entry_add (cpu,HV_X64_MSR_TSC_EMULATION_CONTROL ,0 ); +kvm_msr_entry_add (cpu,HV_X64_MSR_TSC_EMULATION_STATUS ,0 ); + }if (has_msr_hv_crash) {int j;
@@ -2397,6 +2425,15 @@ static int kvm_get_msrs(X86CPU *cpu) env->msr_hv_stimer_count[(index -HV_X64_MSR_STIMER0_COUNT )/2 ] = msrs[i].data;break ; +case HV_X64_MSR_REENLIGHTENMENT_CONTROL : + env->msr_hv_reenlightenment_control = msrs[i].data; +break ; +case HV_X64_MSR_TSC_EMULATION_CONTROL : + env->msr_hv_tsc_emulation_control = msrs[i].data; +break ; +case HV_X64_MSR_TSC_EMULATION_STATUS : + env->msr_hv_tsc_emulation_status = msrs[i].data; +break ;case MSR_MTRRdefType: env->mtrr_deftype = msrs[i].data;break ;
target/i386/machine.c +24 -0
@@ -713,6 +713,29 @@ static const VMStateDescription vmstate_msr_hyperv_stimer = { } }; +static bool hyperv_reenlightenment_enable_needed (void *opaque) +{ +X86CPU *cpu = opaque; +CPUX86State *env = &cpu->env; + +return env->msr_hv_reenlightenment_control !=0 || + env->msr_hv_tsc_emulation_control !=0 || + env->msr_hv_tsc_emulation_status !=0 ; +} + +static const VMStateDescription vmstate_msr_hyperv_reenlightenment = { + .name ="cpu/msr_hyperv_reenlightenment" , + .version_id =1 , + .minimum_version_id =1 , + .needed = hyperv_reenlightenment_enable_needed, + .fields = (VMStateField []) { +VMSTATE_UINT64 (env.msr_hv_reenlightenment_control,X86CPU ), +VMSTATE_UINT64 (env.msr_hv_tsc_emulation_control,X86CPU ), +VMSTATE_UINT64 (env.msr_hv_tsc_emulation_status,X86CPU ), +VMSTATE_END_OF_LIST () + } +}; +static bool avx512_needed (void *opaque) {X86CPU *cpu = opaque;
@@ -1005,6 +1028,7 @@ VMStateDescription vmstate_x86_cpu = { &vmstate_msr_hyperv_runtime, &vmstate_msr_hyperv_synic, &vmstate_msr_hyperv_stimer, + &vmstate_msr_hyperv_reenlightenment, &vmstate_avx512, &vmstate_xss, &vmstate_tsc_khz,
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 25/30] configure: Really use local libfdt if the system one is too old
In reply to Paolo BonziniFrom: Philippe Mathieu-Daudé <[email protected]>
QEMU requires libfdt version >= 1.4.2.
If the host has an older libfdt installed, the configure script will use a (git cloned) local version.
Example with Debian 8:
$ dpkg-query --showformat='${Version}\n' --show libfdt-dev
1.4.0+dfsg-1
$ ./configure
[...]
fdt support yes # from git submodule 'dtc'If this case occurs, the linker will have 2 different libfdt available in the library search path. The default behavior is to search the system path first, then the local path.
Even if the configure script noticed the libfdt is too old and clone a more recent locally, when linking the system library is selected first, and the link process eventually fails:
LINK mips64el-softmmu/qemu-system-mips64el
../hw/core/loader-fit.o: In function `load_fit':
/root/src/github.com/philmd/qemu/hw/core/loader-fit.c:278: undefined reference to fdt_first_subnode' /root/src/github.com/philmd/qemu/hw/core/loader-fit.c:286: undefined reference to fdt_next_subnode' /root/src/github.com/philmd/qemu/hw/core/loader-fit.c:277: undefined reference to `fdt_first_subnode'
collect2: error: ld returned 1 exit status
Makefile:201: recipe for target 'qemu-system-mips64el' failed
make[1]: *** [qemu-system-mips64el] Error 1
QEMU already uses a kludge to enforce local CFLAGS before system ones for libpixman and libfdt, add a similar kludge for the LDFLAGS to enforce using the local libfdt.
Message-Id: <[email protected]>
--- configure | 6 +++++- rules.mak | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-)
configure +5 -1
@@ -3800,7 +3800,8 @@ EOF symlink "$source_path/dtc/scripts" "dtc/scripts" fi fdt_cflags="-I\$(SRC_PATH)/dtc/libfdt" - fdt_libs="-L\$(BUILD_DIR)/dtc/libfdt $fdt_libs" + fdt_ldflags="-L\$(BUILD_DIR)/dtc/libfdt" + fdt_libs="$fdt_libs" elif test "$fdt" = "yes" ; then # Not a git build & no libfdt found, prompt for system install error_exit "DTC (libfdt) version >= 1.4.2 not present." \
@@ -5742,6 +5743,7 @@ echo_version() { # prepend pixman and ftd flags after all config tests are done QEMU_CFLAGS="$pixman_cflags $fdt_cflags $QEMU_CFLAGS" +QEMU_LDFLAGS="$fdt_ldflags $QEMU_LDFLAGS" libs_softmmu="$pixman_libs $libs_softmmu" echo "Install prefix $prefix"
@@ -5772,6 +5774,7 @@ echo "ARFLAGS $ARFLAGS" echo "CFLAGS $CFLAGS" echo "QEMU_CFLAGS $QEMU_CFLAGS" echo "LDFLAGS $LDFLAGS" +echo "QEMU_LDFLAGS $QEMU_LDFLAGS" echo "make $make" echo "install $install" echo "python $python"
@@ -6706,6 +6709,7 @@ else fi echo "LDFLAGS=$LDFLAGS" >> $config_host_mak echo "LDFLAGS_NOPIE=$LDFLAGS_NOPIE" >> $config_host_mak +echo "QEMU_LDFLAGS=$QEMU_LDFLAGS" >> $config_host_mak echo "LD_REL_FLAGS=$LD_REL_FLAGS" >> $config_host_mak echo "LD_I386_EMULATION=$ld_i386_emulation" >> $config_host_mak echo "LIBS+=$LIBS" >> $config_host_mak
rules.mak +1 -1
@@ -73,7 +73,7 @@ expand-objs = $(strip $(sort $(filter %.o,$1)) \ # must link with the C++ compiler, not the plain C compiler. LINKPROG = $(or $(CXX),$(CC)) -LINK = $(call quiet-command, $(LINKPROG) $(QEMU_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ \ +LINK = $(call quiet-command, $(LINKPROG) $(QEMU_LDFLAGS) $(QEMU_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ \ $(call process-archive-undefs, $1) \ $(version-obj-y) $(call extract-libs,$1) $(LIBS),"LINK","$(TARGET_DIR)$@")
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 26/30] configure: Display if libfdt is from system or git
In reply to Paolo BonziniFrom: Philippe Mathieu-Daudé <[email protected]>
The configure script outputs "yes" regardless which libfdt is used:
./configure
[...]
fdt support yes
Sometimes you can have both system and local git version available, change the configure script to display which library got selected:
debian8$ dpkg-query --showformat='${Version}\n' --show libfdt-dev
1.4.0+dfsg-1 debian8$ ./configure
[...]
fdt support git
Message-Id: <[email protected]>
--- configure | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
configure +4 -5
@@ -3785,15 +3785,14 @@ int main(void) { fdt_first_subnode(0, 0); return 0; } EOF if compile_prog "" "$fdt_libs" ; then # system DTC is good - use it - fdt=yes + fdt=system else # have GIT checkout, so activate dtc submodule if test -e "${source_path}/.git" ; then git_submodules="${git_submodules} dtc" fi if test -d "${source_path}/dtc/libfdt" || test -e "${source_path}/.git" ; then - fdt=yes - dtc_internal="yes" + fdt=git mkdir -p dtc if [ "$pwd_is_source_path" != "y" ] ; then symlink "$source_path/dtc/Makefile" "dtc/Makefile"
@@ -6334,7 +6333,7 @@ fi if test "$preadv" = "yes" ; then echo "CONFIG_PREADV=y" >> $config_host_mak fi -if test "$fdt" = "yes" ; then +if test "$fdt" != "no" ; then echo "CONFIG_FDT=y" >> $config_host_mak fi if test "$membarrier" = "yes" ; then
@@ -7136,7 +7135,7 @@ echo "QEMU_CFLAGS+=$cflags" >> $config_target_mak done # for target in $targets -if [ "$dtc_internal" = "yes" ]; then +if [ "$fdt" = "git" ]; then echo "config-host.h: subdir-dtc" >> $config_host_mak fi if [ "$capstone" = "git" -o "$capstone" = "internal" ]; then
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 27/30] shippable: Remove Debian 8 libfdt kludge
In reply to Paolo BonziniFrom: Philippe Mathieu-Daudé <[email protected]>
This kludge was added in a825ca06137, but a cleaner and more generic fix is now available (see ##COMMIT_CONFIGURE_LIBFDT_LDFLAGS_SHA##).
Message-Id: <[email protected]>
--- .shippable.yml | 8 -------- 1 file changed, 8 deletions(-)
.shippable.yml +0 -8
@@ -35,13 +35,5 @@ build: options: "-e HOME=/root" ci: - unset CC - # some targets require newer up to date packages, for example TARGET_LIST matching - # aarch64*-softmmu|arm*-softmmu|ppc*-softmmu|microblaze*-softmmu|mips64el-softmmu) - # see the configure script: - # error_exit "DTC (libfdt) version >= 1.4.2 not present. Your options:" - # " (1) Preferred: Install the DTC (libfdt) devel package" - # " (2) Fetch the DTC submodule, using:" - # " git submodule update --init dtc" - - dpkg --compare-versions `dpkg-query --showformat='${Version}' --show libfdt-dev` ge 1.4.2 || git submodule update --init dtc - ./configure ${QEMU_CONFIGURE_OPTS} --target-list=${TARGET_LIST} - make -j$(($(getconf _NPROCESSORS_ONLN) + 1))
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 28/30] build: Silence dtc directory creation
In reply to Paolo BonziniFrom: Jan Kiszka <[email protected]>
Align with other mkdir calls.
Message-Id: <[email protected]>
Message-Id: <[email protected]>
--- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +1 -1
@@ -485,7 +485,7 @@ subdir-dtc: .git-submodule-status dtc/libfdt dtc/tests $(call quiet-command,$(MAKE) $(DTC_MAKE_ARGS) CPPFLAGS="$(DTC_CPPFLAGS)" CFLAGS="$(DTC_CFLAGS)" LDFLAGS="$(LDFLAGS)" ARFLAGS="$(ARFLAGS)" CC="$(CC)" AR="$(AR)" LD="$(LD)" $(SUBDIR_MAKEFLAGS) libfdt/libfdt.a,) dtc/%: .git-submodule-status - mkdir -p $@ + @mkdir -p $@ # Overriding CFLAGS causes us to lose defines added in the sub-makefile. # Not overriding CFLAGS leads to mis-matches between compilation modes.
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 29/30] pc-dimm: fix error messages if no slots were defined
In reply to Paolo BonziniFrom: David Hildenbrand <[email protected]>
If no slots were defined we try to allocate an empty bitmap, which fails.
Message-Id: <[email protected]>
--- hw/mem/pc-dimm.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
hw/mem/pc-dimm.c +8 -1
@@ -118,9 +118,16 @@ static int pc_dimm_slot2bitmap(Object *obj, void *opaque)int pc_dimm_get_free_slot (const int *hint,int max_slots,Error **errp) { -unsigned long *bitmap =bitmap_new (max_slots); +unsigned long *bitmap;int slot =0 ; +if (max_slots <=0 ) { +error_setg (errp,"no slots where allocated, please specify " +"the 'slots' option" ); +return slot; + } + + bitmap =bitmap_new (max_slots);object_child_foreach (qdev_get_machine (), pc_dimm_slot2bitmap, bitmap);/* check if requested slot is not occupied */
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 30/30] rename included C files to foo.inc.c, remove osdep.h
In reply to Paolo Bonziniosdep.h is only needed for files that are compiled directly. Remove it from included C source files, and rename them to *.inc.c so that scripts/clean-includes knows to skip them.
---
target/cris/translate.c | 2 +-
.../cris/{translate_v10.c => translate_v10.inc.c} | 0
target/mips/translate.c | 2 +-
.../{translate_init.c => translate_init.inc.c} | 0
target/ppc/int_helper.c | 2 +-
target/ppc/{mfrom_table.c => mfrom_table.inc.c} | 0
target/ppc/translate.c | 2 +-
.../ppc/{translate_init.c => translate_init.inc.c} | 1 -
ui/vnc-enc-zrle.c | 22 +++++++++++-----------
ui/{vnc-enc-zrle-template.c => vnc-enc-zrle.inc.c} | 0
10 files changed, 15 insertions(+), 16 deletions(-)
rename target/cris/{translate_v10.c => translate_v10.inc.c} (100%)
rename target/mips/{translate_init.c => translate_init.inc.c} (100%)
rename target/ppc/{mfrom_table.c => mfrom_table.inc.c} (100%)
rename target/ppc/{translate_init.c => translate_init.inc.c} (99%)
rename ui/{vnc-enc-zrle-template.c => vnc-enc-zrle.inc.c} (100%)target/cris/translate.c +1 -1
@@ -3047,7 +3047,7 @@ static unsigned int crisv32_decoder(CPUCRISState *env, DisasContext *dc)return insn_len; } -#include "translate_v10.c" +#include "translate_v10.inc.c" /* * Delay slots on QEMU/CRIS.
target/cris/translate_v10.inc.c renamed from target/cris/translate_v10.c +0 -0
target/mips/translate.c +1 -1
@@ -20499,7 +20499,7 @@ void mips_tcg_init(void) "fcr31"); } -#include "translate_init.c" +#include "translate_init.inc.c" void cpu_mips_realize_env (CPUMIPSState *env) {
target/mips/translate_init.inc.c renamed from target/mips/translate_init.c +0 -0
target/ppc/int_helper.c +1 -1
@@ -379,7 +379,7 @@ target_ulong helper_divso(CPUPPCState *env, target_ulong arg1,target_ulong helper_602_mfrom (target_ulong arg) {if (likely (arg <602 )) { -#include "mfrom_table.c" +#include "mfrom_table.inc.c" return mfrom_ROM_table[arg]; }else {return 0 ;
target/ppc/mfrom_table.inc.c renamed from target/ppc/mfrom_table.c +0 -0
target/ppc/translate.c +1 -1
@@ -6991,7 +6991,7 @@ GEN_HANDLER2_E(trechkpt, "trechkpt", 0x1F, 0x0E, 0x1F, 0x03FFF800, \ };#include "helper_regs.h" -#include "translate_init.c" +#include "translate_init.inc.c" /*****************************************************************************/ /* Misc PowerPC helpers */
target/ppc/translate_init.inc.c renamed from target/ppc/translate_init.c +0 -1
@@ -18,7 +18,6 @@* License along with this library; if not, see <http://www.gnu.org/licenses/>. */ -#include "qemu/osdep.h" #include "disas/bfd.h" #include "exec/gdbstub.h" #include "kvm_ppc.h"
ui/vnc-enc-zrle.c +11 -11
@@ -199,56 +199,56 @@ static void zrle_write_u8(VncState *vs, uint8_t value)#define ZRLE_BPP 8#define ZYWRLE_ENDIAN ENDIAN_NO -#include "vnc-enc-zrle-template.c" +#include "vnc-enc-zrle.inc.c" #undef ZRLE_BPP#define ZRLE_BPP 15#undef ZYWRLE_ENDIAN#define ZYWRLE_ENDIAN ENDIAN_LITTLE -#include "vnc-enc-zrle-template.c" +#include "vnc-enc-zrle.inc.c" #undef ZYWRLE_ENDIAN#define ZYWRLE_ENDIAN ENDIAN_BIG -#include "vnc-enc-zrle-template.c" +#include "vnc-enc-zrle.inc.c" #undef ZRLE_BPP#define ZRLE_BPP 16#undef ZYWRLE_ENDIAN#define ZYWRLE_ENDIAN ENDIAN_LITTLE -#include "vnc-enc-zrle-template.c" +#include "vnc-enc-zrle.inc.c" #undef ZYWRLE_ENDIAN#define ZYWRLE_ENDIAN ENDIAN_BIG -#include "vnc-enc-zrle-template.c" +#include "vnc-enc-zrle.inc.c" #undef ZRLE_BPP#define ZRLE_BPP 32#undef ZYWRLE_ENDIAN#define ZYWRLE_ENDIAN ENDIAN_LITTLE -#include "vnc-enc-zrle-template.c" +#include "vnc-enc-zrle.inc.c" #undef ZYWRLE_ENDIAN#define ZYWRLE_ENDIAN ENDIAN_BIG -#include "vnc-enc-zrle-template.c" +#include "vnc-enc-zrle.inc.c" #define ZRLE_COMPACT_PIXEL 24a#undef ZYWRLE_ENDIAN#define ZYWRLE_ENDIAN ENDIAN_LITTLE -#include "vnc-enc-zrle-template.c" +#include "vnc-enc-zrle.inc.c" #undef ZYWRLE_ENDIAN#define ZYWRLE_ENDIAN ENDIAN_BIG -#include "vnc-enc-zrle-template.c" +#include "vnc-enc-zrle.inc.c" #undef ZRLE_COMPACT_PIXEL#define ZRLE_COMPACT_PIXEL 24b#undef ZYWRLE_ENDIAN#define ZYWRLE_ENDIAN ENDIAN_LITTLE -#include "vnc-enc-zrle-template.c" +#include "vnc-enc-zrle.inc.c" #undef ZYWRLE_ENDIAN#define ZYWRLE_ENDIAN ENDIAN_BIG -#include "vnc-enc-zrle-template.c" +#include "vnc-enc-zrle.inc.c" #undef ZRLE_COMPACT_PIXEL#undef ZRLE_BPP
ui/vnc-enc-zrle.inc.c renamed from ui/vnc-enc-zrle-template.c +0 -0
Signature · 1 line
1.8.3.1
Quoted 21 lines · Paolo Bonzini
The following changes since commit
cc8f8ba754bba17eea9791d67b572eb26e30b4ce:Merge remote-tracking branch 'remotes/ehabkost/tags/machine-next-pull-request' into staging (2018-05-08 15:25:17 +0100)
are available in the git repository at:
git://github.com/bonzini/qemu.gittags/for-upstreamfor you to fetch changes up to
3c128df2ec239f5c1abd0aa59254c433a779a347:rename included C files to
foo.inc.c, removeosdep.h(2018-05-09 00:13:41 +0200)----------------------------------------------------------------
* Don't silently truncate extremely long words in the command line
* bump min required glib library version to 2.42
* dtc configure fixes
* MemoryRegionCache second try
* Deprecated option removal
* add support for Hyper-V reenlightenment MSRs
Quoted 1 line
----------------------------------------------------------------
Some of my build setups barf on the new glib version requirement:
* my aarch64 build host (a gcc compile farm machine which is running Ubuntu 14.04.5 LTS and has glib 2.40.2)
* my windows cross compile setups (which have glib 2.34.3)
The latter could probably be fixed, but it will be a pain because gtk.org don't distribute prebuilt glib &c zipfiles usable for cross compile any more. For the former, that LTS is apparently still in support for another year.
thanks
-- PMM
Quoted 10 lines · Peter Maydell
Some of my build setups barf on the new glib version requirement:
* my aarch64 build host (a gcc compile farm machine which is running Ubuntu 14.04.5 LTS and has glib 2.40.2)
* my windows cross compile setups (which have glib 2.34.3)The latter could probably be fixed, but it will be a pain because gtk.org don't distribute prebuilt glib &c zipfiles usable for cross compile any more. For the former, that LTS is apparently still in support for another year.
Fair enough. I suppose that for now we can still uniformly bump up to 2.34, which is enough to remove all compatibility shims except for a couple.
I'll resend the pull request without that part.
Thanks,
Paolo
Quoted 12 lines · Paolo Bonzini
Quoted 10 lines · Peter Maydell
Some of my build setups barf on the new glib version requirement:
* my aarch64 build host (a gcc compile farm machine which is running Ubuntu 14.04.5 LTS and has glib 2.40.2)
* my windows cross compile setups (which have glib 2.34.3)The latter could probably be fixed, but it will be a pain because gtk.org don't distribute prebuilt glib &c zipfiles usable for cross compile any more. For the former, that LTS is apparently still in support for another year.
Quoted 4 lines
Fair enough. I suppose that for now we can still uniformly bump up to 2.34, which is enough to remove all compatibility shims except for a couple.
I'll resend the pull request without that part.
Thanks. If somebody has a recipe for doing mingw32/w64 cross builds on Ubuntu hosts with a newer glib then I can look at updating that bit of my build setup...
-- PMM
Quoted 22 lines · Peter Maydell
Quoted 21 lines · Paolo Bonzini
The following changes since commit
cc8f8ba754bba17eea9791d67b572eb26e30b4ce:Merge remote-tracking branch 'remotes/ehabkost/tags/machine-next-pull-request' into staging (2018-05-08 15:25:17 +0100)
are available in the git repository at:
git://github.com/bonzini/qemu.gittags/for-upstreamfor you to fetch changes up to
3c128df2ec239f5c1abd0aa59254c433a779a347:rename included C files to
foo.inc.c, removeosdep.h(2018-05-09 00:13:41 +0200)----------------------------------------------------------------
* Don't silently truncate extremely long words in the command line
* bump min required glib library version to 2.42
* dtc configure fixes
* MemoryRegionCache second try
* Deprecated option removal
* add support for Hyper-V reenlightenment MSRs
Quoted 6 lines
Quoted 1 line
----------------------------------------------------------------
Some of my build setups barf on the new glib version requirement:
* my aarch64 build host (a gcc compile farm machine which is running Ubuntu 14.04.5 LTS and has glib 2.40.2)
That is expected - per the policy we only aim to support the most recent, and most recent but one for 2 years overlap. Since LTS releases are two years apart, this basically means always just 2 most recent LTS releases for Ubuntu. Since we Ubuntu 18.04 LTS came out last month, we don't need to continue 14.04 LTS
Quoted 1 line
* my windows cross compile setups (which have glib 2.34.3)
Presumably you're using a Debian host for that ?
The debian-win64-cross.docker job seems to pull in packages from
deb http://pkg.mxe.cc/repos/apt/debian jessie main
And mxe claims to have glib 2.54
Alternativel Fedora has new mingw packags too
Quoted 4 lines
The latter could probably be fixed, but it will be a pain because gtk.org don't distribute prebuilt glib &c zipfiles usable for cross compile any more. For the former, that LTS is apparently still in support for another year.
Regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
Quoted 11 lines · Daniel P. Berrangé
Quoted 4 lines · Peter Maydell
Some of my build setups barf on the new glib version requirement:
* my aarch64 build host (a gcc compile farm machine which is running Ubuntu 14.04.5 LTS and has glib 2.40.2)
That is expected - per the policy we only aim to support the most recent, and most recent but one for 2 years overlap. Since LTS releases are two years apart, this basically means always just 2 most recent LTS releases for Ubuntu. Since we Ubuntu 18.04 LTS came out last month, we don't need to continue 14.04 LTS
...well, I could ask the GCC compile farm admins what their upgrade plans are, but I don't particularly see the need to impose load on a volunteer set of admins when the distro they're running is still supported for another year. And I don't want to drop aarch64 from my build test set.
Quoted 3 lines
Quoted 1 line
* my windows cross compile setups (which have glib 2.34.3)
Presumably you're using a Debian host for that ?
Ubuntu.
Quoted 5 lines
The debian-win64-cross.docker job seems to pull in packages from
deb http://pkg.mxe.cc/repos/apt/debian jessie main
And mxe claims to have glib 2.54
Thanks, I will have a look at this. (They seem to have tarballs as well as debian packages.)
-- PMM
Quoted 13 lines · Peter Maydell
Quoted 11 lines · Daniel P. Berrangé
Quoted 4 lines · Peter Maydell
Some of my build setups barf on the new glib version requirement:
* my aarch64 build host (a gcc compile farm machine which is running Ubuntu 14.04.5 LTS and has glib 2.40.2)
That is expected - per the policy we only aim to support the most recent, and most recent but one for 2 years overlap. Since LTS releases are two years apart, this basically means always just 2 most recent LTS releases for Ubuntu. Since we Ubuntu 18.04 LTS came out last month, we don't need to continue 14.04 LTS
Quoted 5 lines
...well, I could ask the GCC compile farm admins what their upgrade plans are, but I don't particularly see the need to impose load on a volunteer set of admins when the distro they're running is still supported for another year. And I don't want to drop aarch64 from my build test set.
Ah ok, I didn't realize you weren't in control of the OS version. 2.40.2 is not too old, so we can accomodate that without significant problems.
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
* my windows cross compile setups (which have glib 2.34.3)
Presumably you're using a Debian host for that ?
Ubuntu.
Quoted 8 lines
Quoted 5 lines
The debian-win64-cross.docker job seems to pull in packages from
deb http://pkg.mxe.cc/repos/apt/debian jessie main
And mxe claims to have glib 2.54
Thanks, I will have a look at this. (They seem to have tarballs as well as debian packages.)
Ok, let me know if that works out, and if so, I'll repost min glib patches setting it to 2.40.2 to allow for the aarch64 build host.
Regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|