[Stable-8.0.3 00/54] Patch Round-up for stable 8.0.3, freeze on 2023-07-06

2023-06-26 Thread Michael Tokarev
The following patches are queued for QEMU stable v8.0.3: https://gitlab.com/qemu-project/qemu/-/commits/staging-8.0 Patch freeze is 2023-07-06, and the release is planned for 2023-07-08: https://wiki.qemu.org/Planning/8.0 Please respond here or CC qemu-sta...@nongnu.org on any additional pa

[Stable-7.2.4 41/43] vhost: release memory_listener object in error path

2023-06-26 Thread Michael Tokarev
From: Prasad Pandit vhost_dev_start function does not release memory_listener object in case of an error. This may crash the guest when vhost is unable to set memory table: stack trace of thread 125653: Program terminated with signal SIGSEGV, Segmentation fault #0 memory_listener_register

[Stable-7.2.4 30/43] aspeed/hace: Initialize g_autofree pointer

2023-06-26 Thread Michael Tokarev
From: Cédric Le Goater As mentioned in docs/devel/style.rst "Automatic memory deallocation": * Variables declared with g_auto* MUST always be initialized, otherwise the cleanup function will use uninitialized stack memory This avoids QEMU to coredump when running the "hash test" command under

[Stable-7.2.4 27/43] target/ppc: Fix nested-hv HEAI delivery

2023-06-26 Thread Michael Tokarev
From: Nicholas Piggin ppc hypervisors turn HEAI interrupts into program interrupts injected into the guest that executed the illegal instruction, if the hypervisor doesn't handle it some other way. The nested-hv implementation failed to account for this HEAI->program conversion. The virtual hype

[Stable-7.2.4 20/43] s390x/tcg: Fix CPU address returned by STIDP

2023-06-26 Thread Michael Tokarev
From: Ilya Leoshkevich In qemu-user-s390x, /proc/cpuinfo contains: processor 0: version = 00, identification = 00, machine = 8561 processor 1: version = 00, identification = 40, machine = 8561 The highest nibble is supposed to contain the CPU address, but it's off by

[Stable-8.0.3 38/54] aspeed/hace: Initialize g_autofree pointer

2023-06-26 Thread Michael Tokarev
From: Cédric Le Goater As mentioned in docs/devel/style.rst "Automatic memory deallocation": * Variables declared with g_auto* MUST always be initialized, otherwise the cleanup function will use uninitialized stack memory This avoids QEMU to coredump when running the "hash test" command under

[Stable-7.2.4 28/43] target/ppc: Fix PMU hflags calculation

2023-06-26 Thread Michael Tokarev
From: Nicholas Piggin Some of the PMU hflags bits can go out of synch, for example a store to MMCR0 with PMCjCE=1 fails to update hflags correctly and results in hflags mismatch: qemu: fatal: TCG hflags mismatch (current:0x2408003d rebuilt:0x240a003d) This can be reproduced by running perf on

[Stable-8.0.3 28/54] hw/xen: Fix broken check for invalid state in xs_be_open()

2023-06-26 Thread Michael Tokarev
From: David Woodhouse Coverity points out that if (!s && !s->impl) isn't really what we intended to do here. CID 1508131. Fixes: 032475127225 ("hw/xen: Add emulated implementation of XenStore operations") Signed-off-by: David Woodhouse Reviewed-by: Paul Durrant Reviewed-by: Peter Maydell Mes

[Stable-7.2.4 40/43] target/hppa: Update to SeaBIOS-hppa version 8

2023-06-26 Thread Michael Tokarev
From: Helge Deller Update SeaBIOS-hppa to version 8. Fixes: - boot of HP-UX with SMP, and - reboot of Linux and HP-UX with SMP Enhancements: - show qemu version in boot menu - adds exit menu entry in boot menu to quit emulation - allow to trace PCD_CHASSIS codes & machine run status Signed-off

[Stable-7.2.4 16/43] target/s390x: Fix LOCFHR taking the wrong half of R2

2023-06-26 Thread Michael Tokarev
From: Ilya Leoshkevich LOCFHR should write top-to-top, but QEMU erroneously writes bottom-to-top. Fixes: 45aa9aa3b773 ("target/s390x: Implement load-on-condition-2 insns") Cc: qemu-sta...@nongnu.org Reported-by: Mikhail Mitskevich Closes: https://gitlab.com/qemu-project/qemu/-/issues/1668 Signe

[Stable-7.2.4 14/43] target/s390x: Fix LCBB overwriting the top 32 bits

2023-06-26 Thread Michael Tokarev
From: Ilya Leoshkevich LCBB is supposed to overwrite only the bottom 32 bits, but QEMU erroneously overwrites the entire register. Fixes: 6d9303322ed9 ("s390x/tcg: Implement LOAD COUNT TO BLOCK BOUNDARY") Cc: qemu-sta...@nongnu.org Signed-off-by: Ilya Leoshkevich Message-Id: <20230526181240.142

[Stable-7.2.4 25/43] vnc: move assert in vnc_worker_thread_loop

2023-06-26 Thread Michael Tokarev
From: Anastasia Belova job may be NULL if queue->exit is true. Check it before dereference job. Fixes: f31f9c1080 ("vnc: add magic cookie to VncState") Signed-off-by: Anastasia Belova Reviewed-by: Michael Tokarev Signed-off-by: Michael Tokarev (cherry picked from commit bdfca8a22f41e7ad47fd2d

[Stable-7.2.4 34/43] hw/timer/nrf51_timer: Don't lose time when timer is queried in tight loop

2023-06-26 Thread Michael Tokarev
From: Peter Maydell The nrf51_timer has a free-running counter which we implement using the pattern of using two fields (update_counter_ns, counter) to track the last point at which we calculated the counter value, and the counter value at that time. Then we can find the current counter value by

[Stable-7.2.4 07/43] ui/sdl2: fix surface_gl_update_texture: Assertion 'gls' failed

2023-06-26 Thread Michael Tokarev
From: Marc-André Lureau Before sdl2_gl_update() is called, sdl2_gl_switch() may decide to destroy the console window and its associated shaders. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1644 Fixes: c84ab0a500a8 ("ui/console: optionally update after gfx switch") Signed-off-by: Mar

[Stable-7.2.4 19/43] tests/tcg/s390x: Test single-stepping SVC

2023-06-26 Thread Michael Tokarev
From: Ilya Leoshkevich Add a small test to prevent regressions. Signed-off-by: Ilya Leoshkevich Acked-by: Alex Bennée Message-Id: <20230510230213.330134-3-...@linux.ibm.com> Signed-off-by: Thomas Huth (cherry picked from commit be4a4cb429617a8b6893733b37b6203e4b7bf35b) Signed-off-by: Michael

[Stable-7.2.4 43/43] vhost-vdpa: do not cleanup the vdpa/vhost-net structures if peer nic is present

2023-06-26 Thread Michael Tokarev
From: Ani Sinha When a peer nic is still attached to the vdpa backend, it is too early to free up the vhost-net and vdpa structures. If these structures are freed here, then QEMU crashes when the guest is being shut down. The following call chain would result in an assertion failure since the poi

[Stable-7.2.4 26/43] target/ppc: Fix lqarx to set cpu_reserve

2023-06-26 Thread Michael Tokarev
From: Nicholas Piggin lqarx does not set cpu_reserve, which causes stqcx. to never succeed. Cc: qemu-sta...@nongnu.org Fixes: 94bf2658676 ("target/ppc: Use atomic load for LQ and LQARX") Fixes: 57b38ffd0c6 ("target/ppc: Use tcg_gen_qemu_{ld,st}_i128 for LQARX, LQ, STQ") Signed-off-by: Nicholas

[Stable-8.0.3 31/54] 9pfs: prevent opening special files (CVE-2023-2861)

2023-06-26 Thread Michael Tokarev
From: Christian Schoenebeck The 9p protocol does not specifically define how server shall behave when client tries to open a special file, however from security POV it does make sense for 9p server to prohibit opening any special file on host side in general. A sane Linux 9p client for instance w

[Stable-7.2.4 22/43] qga: Fix suspend on Linux guests without systemd

2023-06-26 Thread Michael Tokarev
From: Mark Somerville Allow the Linux guest agent to attempt each of the suspend methods (systemctl, pm-* and writing to /sys) in turn. Prior to this guests without systemd failed to suspend due to `guest_suspend` returning early regardless of the return value of `systemd_supports_mode`. Signed

[Stable-7.2.4 00/43] Patch Round-up for stable 7.2.4, freeze on 2023-07-06

2023-06-26 Thread Michael Tokarev
The following patches are queued for QEMU stable v7.2.4: https://gitlab.com/qemu-project/qemu/-/commits/staging-7.2 Patch freeze is 2023-07-06, and the release is planned for 2023-07-08: https://wiki.qemu.org/Planning/7.2 Please respond here or CC qemu-sta...@nongnu.org on any additional pa

[Stable-7.2.4 18/43] linux-user/s390x: Fix single-stepping SVC

2023-06-26 Thread Michael Tokarev
From: Ilya Leoshkevich Currently single-stepping SVC executes two instructions. The reason is that EXCP_DEBUG for the SVC instruction itself is masked by EXCP_SVC. Fix by re-raising EXCP_DEBUG. Signed-off-by: Ilya Leoshkevich Message-Id: <20230510230213.330134-2-...@linux.ibm.com> Signed-off-by

[Stable-7.2.4 17/43] tests/tcg/s390x: Test LOCFHR

2023-06-26 Thread Michael Tokarev
From: Ilya Leoshkevich Add a small test to prevent regressions. Cc: qemu-sta...@nongnu.org Signed-off-by: Ilya Leoshkevich Message-Id: <20230526181240.1425579-5-...@linux.ibm.com> Reviewed-by: Richard Henderson Reviewed-by: David Hildenbrand Signed-off-by: Thomas Huth (cherry picked from com

Re: [PATCH V1 2/3] migration: fix suspended runstate

2023-06-26 Thread Peter Xu
On Mon, Jun 26, 2023 at 02:27:32PM -0400, Peter Xu wrote: > On Fri, Jun 23, 2023 at 02:25:05PM -0400, Steven Sistare wrote: > > On 6/21/2023 4:28 PM, Peter Xu wrote: > > > On Wed, Jun 21, 2023 at 03:15:42PM -0400, Steven Sistare wrote: > > >> On 6/20/2023 5:46 PM, Peter Xu wrote: > > >>> On Thu, Ju

[Stable-7.2.4 37/43] target/hppa: Fix OS reboot issues

2023-06-26 Thread Michael Tokarev
From: Helge Deller When the OS triggers a reboot, the reset helper function sends a qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET) together with an EXCP_HLT exception to halt the CPUs. So, at reboot when initializing the CPUs again, make sure to set all instruction pointers to the firmwar

[Stable-7.2.4 39/43] target/hppa: New SeaBIOS-hppa version 7

2023-06-26 Thread Michael Tokarev
From: Helge Deller Update SeaBIOS-hppa to version 7 which fixes a boot problem with Debian-12 install CD images. The problem with Debian-12 is, that the ramdisc got bigger than what the firmware could load in one call to the LSI scsi driver. Signed-off-by: Helge Deller (cherry picked from comm

[Stable-7.2.4 24/43] hw/remote: Fix vfu_cfg trace offset format

2023-06-26 Thread Michael Tokarev
From: Mattias Nissler The printed offset value is prefixed with 0x, but was actually printed in decimal. To spare others the confusion, adjust the format specifier to hexadecimal. Signed-off-by: Mattias Nissler Reviewed-by: Jagannathan Raman Reviewed-by: Philippe Mathieu-Daudé Signed-off-by:

[Stable-7.2.4 35/43] host-utils: Avoid using __builtin_subcll on buggy versions of Apple Clang

2023-06-26 Thread Michael Tokarev
From: Peter Maydell We use __builtin_subcll() to do a 64-bit subtract with borrow-in and borrow-out when the host compiler supports it. Unfortunately some versions of Apple Clang have a bug in their implementation of this intrinsic which means it returns the wrong value. The effect is that a QE

[Stable-7.2.4 23/43] 9pfs: prevent opening special files (CVE-2023-2861)

2023-06-26 Thread Michael Tokarev
From: Christian Schoenebeck The 9p protocol does not specifically define how server shall behave when client tries to open a special file, however from security POV it does make sense for 9p server to prohibit opening any special file on host side in general. A sane Linux 9p client for instance w

[Stable-7.2.4 33/43] hw/intc/allwinner-a10-pic: Handle IRQ levels other than 0 or 1

2023-06-26 Thread Michael Tokarev
From: Peter Maydell In commit 2c5fa0778c3b430 we fixed an endianness bug in the Allwinner A10 PIC model; however in the process we introduced a regression. This is because the old code was robust against the incoming 'level' argument being something other than 0 or 1, whereas the new code was not

Re: [PATCH] ui/gtk: set the area of the scanout texture correctly

2023-06-26 Thread Kim, Dongwon
Hi Marc-André Lureau, On 6/26/2023 4:56 AM, Marc-André Lureau wrote: Hi On Wed, Jun 21, 2023 at 11:53 PM Dongwon Kim wrote: x and y offsets and width and height of the scanout texture is not correctly configured in case guest scanout frame is dmabuf. Cc: Gerd Hoffmann

Re: [PATCH 07/26] qemu-keymap: properly check return from xkb_keymap_mod_get_index

2023-06-26 Thread Alex Bennée
Peter Maydell writes: > On Fri, 23 Jun 2023 at 13:21, Alex Bennée wrote: >> >> We can return XKB_MOD_INVALID which rightly gets flagged by sanitisers >> as an overly wide shift attempt. >> >> Signed-off-by: Alex Bennée > > Same comments as on the first version of this patch: > looks OK code-w

[PATCH v2 5/6] tests/tcg: add mechanism to handle plugin arguments

2023-06-26 Thread Alex Bennée
We recently missed a regression that should have been picked up by check-tcg. This was because the libmem plugin is effectively a NOP if the user doesn't specify the type to use. Rather than changing the default behaviour add an additional expansion so we can take this into account in future. Mes

[PATCH v2 2/6] gitlab: ensure coverage job also publishes meson log

2023-06-26 Thread Alex Bennée
From: Daniel P. Berrangé The coverage job wants to publish a coverage report on success, but the tests might fail and in that case we need the meson logs for debugging. Signed-off-by: Daniel P. Berrangé Reviewed-by: Richard Henderson Message-Id: <20230623122100.1640995-3-alex.ben...@linaro.org

[PATCH v2 1/6] gitlab: explicit set artifacts publishing criteria

2023-06-26 Thread Alex Bennée
From: Daniel P. Berrangé If not set explicitly, gitlab assumes 'when: on_success" as the publishing criteria for artifacts. This is reasonable if the artifact is an output deliverable of the job. This is useless if the artifact is a log file to be used for debugging job failures. This change mak

[PATCH v2 4/6] docs/devel: remind developers to run CI container pipeline when updating images

2023-06-26 Thread Alex Bennée
From: Ani Sinha When new dependencies and packages are added to containers, its important to run CI container generation pipelines on gitlab to make sure that there are no obvious conflicts between packages that are being added and those that are already present. Running CI container pipelines wi

[PATCH v2 6/6] qemu-keymap: properly check return from xkb_keymap_mod_get_index

2023-06-26 Thread Alex Bennée
We can return XKB_MOD_INVALID which rightly gets flagged by sanitisers as an overly wide shift attempt. Signed-off-by: Alex Bennée --- qemu-keymap.c | 24 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/qemu-keymap.c b/qemu-keymap.c index 229866e004..8c80f

[PATCH v2 3/6] gitlab: reduce testing scope of check-gcov

2023-06-26 Thread Alex Bennée
This keeps timing out on gitlab due to some qtests taking a long time. As this is just ensuring the gcov machinery is working and not attempting to be comprehensive lets skip qtest in this run. Message-Id: <20230623122100.1640995-4-alex.ben...@linaro.org> Reviewed-by: Richard Henderson Signed-off

[PATCH v2 0/6] maintainer omnibus: testing, fuzz, plugins, documentation

2023-06-26 Thread Alex Bennée
As softfreeze is fast approaching I thought it would be work combining my various trees into an omnibus series to ease the review and merging. The testing updates exposed a number of latent leaks that confused the oss-fuzz jobs (hence the test-fuzz addition to help debug that). This also includes

Re: [PATCH v2] piix: fix regression during unplug in Xen HVM domUs

2023-06-26 Thread Olaf Hering
I need advice on how to debug this. One thing that stands out is uhci_irq(). It reads a u16 from the USBSTS register. On the qemu side, this read is served from bmdma_read. Since the read size is 2, the result is ~0, and uhci_irq() turns the controller off. In other words, memory_region_ops_read

Re: [PATCH 1/5] throttle: introduce enum ThrottleTimerType

2023-06-26 Thread Alberto Garcia
On Sun 25 Jun 2023 04:56:27 PM +08, zhenwei pi wrote: > Use enum ThrottleTimerType instead of number index. > +typedef enum { > +THROTTLE_TIMER_READ = 0, > +THROTTLE_TIMER_WRITE, > +THROTTLE_TIMER_MAX > +} ThrottleTimerType; If you're doing this I suppose you could also change 'bool i

Re: [PATCH 2/5] test-throttle: use enum ThrottleTimerType

2023-06-26 Thread Alberto Garcia
On Sun 25 Jun 2023 04:56:28 PM +08, zhenwei pi wrote: > Use enum ThrottleTimerType instead in the throttle test codes. > > Signed-off-by: zhenwei pi Reviewed-by: Alberto Garcia Berto

Re: [PATCH 5/5] cryptodev: use NULL throttle timer cb for read direction

2023-06-26 Thread Alberto Garcia
On Sun 25 Jun 2023 04:56:31 PM +08, zhenwei pi wrote: > Operations on a crytpodev are considered as *write* only, the callback > of read direction is never invoked. Use NULL instead of an unreachable > path(cryptodev_backend_throttle_timer_cb on read direction). > > Signed-off-by: zhenwei pi Revi

Re: [PATCH 4/5] test-throttle: test read only and write only

2023-06-26 Thread Alberto Garcia
On Sun 25 Jun 2023 04:56:30 PM +08, zhenwei pi wrote: > Signed-off-by: zhenwei pi Reviewed-by: Alberto Garcia Berto

Re: [PATCH 3/5] throttle: support read-only and write-only

2023-06-26 Thread Alberto Garcia
On Sun 25 Jun 2023 04:56:29 PM +08, zhenwei pi wrote: > void throttle_timers_attach_aio_context(ThrottleTimers *tt, > AioContext *new_context) > { > -tt->timers[THROTTLE_TIMER_READ] = > -aio_timer_new(new_context, tt->clock_type, SCALE_NS, > -

Re: [PULL 10/30] ppc/spapr: H_ENTER_NESTED should restore host XER ca field

2023-06-26 Thread Cédric Le Goater
On 6/26/23 14:26, Michael Tokarev wrote: 26.06.2023 08:56, Cédric Le Goater wrote: From: Nicholas Piggin Fix missing env->ca restore when going from L2 back to the host. Fixes: 120f738a467 ("spapr: implement nested-hv capability for the virtual hypervisor") Reviewed-by: Harsh Prateek Bora S

[PATCH v2 01/26] gitlab: explicit set artifacts publishing criteria

2023-06-26 Thread Alex Bennée
From: Daniel P. Berrangé If not set explicitly, gitlab assumes 'when: on_success" as the publishing criteria for artifacts. This is reasonable if the artifact is an output deliverable of the job. This is useless if the artifact is a log file to be used for debugging job failures. This change mak

[PATCH v2 00/26] maintainer omnibus: testing, fuzz, plugins, documentation

2023-06-26 Thread Alex Bennée
As softfreeze is fast approaching I thought it would be work combining my various trees into an omnibus series to ease the review and merging. The testing updates exposed a number of latent leaks that confused the oss-fuzz jobs (hence the test-fuzz addition to help debug that). This also includes

[PATCH v2 02/26] gitlab: ensure coverage job also publishes meson log

2023-06-26 Thread Alex Bennée
From: Daniel P. Berrangé The coverage job wants to publish a coverage report on success, but the tests might fail and in that case we need the meson logs for debugging. Signed-off-by: Daniel P. Berrangé Reviewed-by: Richard Henderson Message-Id: <20230623122100.1640995-3-alex.ben...@linaro.org

[PATCH v2 13/26] tests/lcitool: add an explicit gcc-native package

2023-06-26 Thread Alex Bennée
We need a native compiler to build the hexagon codegen tools. In our current images we already have a gcc as a side effect of a broken dependency between gcovr and lcov but this will be fixed when we move to bookworm. See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=987818 for details. Update

[PATCH v2 09/26] tests/docker: add test-fuzz

2023-06-26 Thread Alex Bennée
Running the fuzzer requires some hoop jumping and some problems only show up in containers. This basically replicates the build-oss-fuzz job from our CI so we can run in the same containers we use in CI. Signed-off-by: Alex Bennée --- tests/docker/test-fuzz | 28 1 f

[PATCH v2 10/26] Makefile: add lcitool-refresh to UNCHECKED_GOALS

2023-06-26 Thread Alex Bennée
This is yet another make target you usually run in the top level of the source directory. Message-Id: <20230623122100.1640995-12-alex.ben...@linaro.org> Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Alex Bennée --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git

[PATCH v2 05/26] tests/tcg: add mechanism to handle plugin arguments

2023-06-26 Thread Alex Bennée
We recently missed a regression that should have been picked up by check-tcg. This was because the libmem plugin is effectively a NOP if the user doesn't specify the type to use. Rather than changing the default behaviour add an additional expansion so we can take this into account in future. Mes

[PATCH v2 16/26] tests/avocado: update firmware to enable sbsa-ref/max

2023-06-26 Thread Alex Bennée
From: Marcin Juszkiewicz Update prebuilt firmware images to have TF-A with FEAT_FGT support enabled. This allowed us to enable test for "max" cpu in sbsa-ref machine. Signed-off-by: Marcin Juszkiewicz Message-Id: <20230530152240.79160-1-marcin.juszkiew...@linaro.org> Signed-off-by: Alex Bennée

[PATCH v2 12/26] tests/lcitool: Bump fedora container versions

2023-06-26 Thread Alex Bennée
From: Erik Skultety Fedora 37 -> 38 Signed-off-by: Erik Skultety Acked-by: Richard Henderson Message-Id: <20230623122100.1640995-14-alex.ben...@linaro.org> Message-Id: [AJB: Dropped alpine (in prev commit), reflow commit msg] Signed-off-by: Alex Bennée --- tests/docker/dockerfiles/fedora-w

[PATCH v2 04/26] docs/devel: remind developers to run CI container pipeline when updating images

2023-06-26 Thread Alex Bennée
From: Ani Sinha When new dependencies and packages are added to containers, its important to run CI container generation pipelines on gitlab to make sure that there are no obvious conflicts between packages that are being added and those that are already present. Running CI container pipelines wi

[PATCH v2 07/26] scripts/oss-fuzz: add a suppression for keymap

2023-06-26 Thread Alex Bennée
When updating to the latest fedora the santizer found more leaks inside xkbmap: FAILED: pc-bios/keymaps/ar /builds/stsquad/qemu/build-oss-fuzz/qemu-keymap -f pc-bios/keymaps/ar -l ara = ==3604==ERROR: LeakSanitizer: detected m

[PATCH v2 15/26] tests/docker: convert riscv64-cross to lcitool

2023-06-26 Thread Alex Bennée
We still need to base this on Debian Sid until riscv64 is promoted to a release architecture (or another distro provides a full cross compile target). We use the new qemu-minimal project description to avoid bringing in all the extra dependencies because every extra package is another chance for si

[PATCH v2 06/26] qemu-keymap: properly check return from xkb_keymap_mod_get_index

2023-06-26 Thread Alex Bennée
We can return XKB_MOD_INVALID which rightly gets flagged by sanitisers as an overly wide shift attempt. Signed-off-by: Alex Bennée --- qemu-keymap.c | 24 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/qemu-keymap.c b/qemu-keymap.c index 229866e004..8c80f

[PATCH v2 03/26] gitlab: reduce testing scope of check-gcov

2023-06-26 Thread Alex Bennée
This keeps timing out on gitlab due to some qtests taking a long time. As this is just ensuring the gcov machinery is working and not attempting to be comprehensive lets skip qtest in this run. Message-Id: <20230623122100.1640995-4-alex.ben...@linaro.org> Reviewed-by: Richard Henderson Signed-off

[PATCH v2 11/26] tests/lcitool: update to latest version

2023-06-26 Thread Alex Bennée
We need this for the riscv64 and gcc-native mappings. As the older alpine release has been dropped from the mappings we also need to bump the version of alpine we use. Message-Id: <20230623122100.1640995-13-alex.ben...@linaro.org> Acked-by: Richard Henderson Signed-off-by: Alex Bennée --- tests

[PATCH v4 17/19] target/riscv: update multi-letter extension KVM properties

2023-06-26 Thread Daniel Henrique Barboza
We're now ready to update the multi-letter extensions status for KVM. kvm_riscv_update_cpu_cfg_isa_ext() is called called during vcpu creation time to verify which user options changes host defaults (via the 'user_set' flag) and tries to write them back to KVM. Failure to commit a change to KVM i

[PATCH v4 14/19] target/riscv/kvm.c: add multi-letter extension KVM properties

2023-06-26 Thread Daniel Henrique Barboza
Let's add KVM user properties for the multi-letter extensions that KVM currently supports: zicbom, zicboz, zihintpause, zbb, ssaia, sstc, svinval and svpbmt. As with MISA extensions, we're using the KVMCPUConfig type to hold information about the state of each extension. However, multi-letter exte

[PATCH v2 14/26] tests/lcitool: introduce qemu-minimal

2023-06-26 Thread Alex Bennée
This is a very bare bones set of dependencies for a minimal build of QEMU. This will be useful for minimal cross-compile sanity check based on things like Debian Sid where stuff isn't always in sync. Message-Id: <20230623122100.1640995-16-alex.ben...@linaro.org> Signed-off-by: Alex Bennée --- v2

[PATCH v2 08/26] tests/qtests: clean-up and fix leak in generic_fuzz

2023-06-26 Thread Alex Bennée
An update to the clang tooling detects more issues with the code including a memory leak from the g_string_new() allocation. Clean up the code with g_autoptr and use ARRAY_SIZE while we are at it. Signed-off-by: Alex Bennée --- tests/qtest/fuzz/generic_fuzz.c | 11 --- 1 file changed, 4

[PATCH v4 04/19] target/riscv/cpu.c: restrict 'mimpid' value

2023-06-26 Thread Daniel Henrique Barboza
Following the same logic used with 'mvendorid' let's also restrict 'mimpid' for named CPUs. Generic CPUs keep setting the value freely. Note that we're getting rid of the default RISCV_CPU_MARCHID value. The reason is that this is not a good default since it's dynamic, changing with with every QEM

[PATCH v4 12/19] target/riscv: add KVM specific MISA properties

2023-06-26 Thread Daniel Henrique Barboza
Using all TCG user properties in KVM is tricky. First because KVM supports only a small subset of what TCG provides, so most of the cpu->cfg flags do nothing for KVM. Second, and more important, we don't have a way of telling if any given value is an user input or not. For TCG this has a small imp

[PATCH v4 00/19] target/riscv, KVM: fixes and enhancements

2023-06-26 Thread Daniel Henrique Barboza
Hi, This version has a change requested by Andrew in patch 16. All patches aside from patch 16 are acked/reviewed. Changes from v3: - patch 16: - error out with a "extension is not available with KVM" - v3 link: https://lists.gnu.org/archive/html/qemu-devel/2023-06/msg04575.html Daniel Henri

[PATCH v4 03/19] target/riscv/cpu.c: restrict 'mvendorid' value

2023-06-26 Thread Daniel Henrique Barboza
We're going to change the handling of mvendorid/marchid/mimpid by the KVM driver. Since these are always present in all CPUs let's put the same validation for everyone. It doesn't make sense to allow 'mvendorid' to be different than it is already set in named (vendor) CPUs. Generic (dynamic) CPUs

[PATCH v4 05/19] target/riscv/cpu.c: restrict 'marchid' value

2023-06-26 Thread Daniel Henrique Barboza
'marchid' shouldn't be set to a different value as previously set for named CPUs. For all other CPUs it shouldn't be freely set either - the spec requires that 'marchid' can't have the MSB (most significant bit) set and every other bit set to zero, i.e. 0x8000 is an invalid 'marchid' value for

[PATCH v4 13/19] target/riscv/kvm.c: update KVM MISA bits

2023-06-26 Thread Daniel Henrique Barboza
Our design philosophy with KVM properties can be resumed in two main decisions based on KVM interface availability and what the user wants to do: - if the user disables an extension that the host KVM module doesn't know about (i.e. it doesn't implement the kvm_get_one_reg() interface), keep bootin

[PATCH v2 24/26] docs/devel: split qom-api reference into new file

2023-06-26 Thread Alex Bennée
Lets try and keep the overview of the sub-system digestible by splitting the core API stuff into a separate file. As QOM and QDEV work together we should also try and enumerate the qdev_ functions. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Alex Bennée Message-Id: <20230619171437.357374-

[PATCH v2 19/26] plugins: update lockstep to use g_memdup2

2023-06-26 Thread Alex Bennée
The old g_memdup is deprecated, use the replacement. Message-Id: <20230623122100.1640995-21-alex.ben...@linaro.org> Reviewed-by: Richard Henderson Signed-off-by: Alex Bennée --- contrib/plugins/lockstep.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/plugins/lockst

[PATCH v2 21/26] include/migration: mark vmstate_register() as a legacy function

2023-06-26 Thread Alex Bennée
Mention that QOM-ified devices already have support for registering the description. Reviewed-by: Juan Quintela Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Acked-by: Peter Xu Signed-off-by: Alex Bennée Message-Id: <20230619171437.357374-3-alex.ben...@linaro.org> --- in

[PATCH v4 15/19] target/riscv/cpu.c: remove priv_ver check from riscv_isa_string_ext()

2023-06-26 Thread Daniel Henrique Barboza
riscv_isa_string_ext() is being used by riscv_isa_string(), which is then used by boards to retrieve the 'riscv,isa' string to be written in the FDT. All this happens after riscv_cpu_realize(), meaning that we're already past riscv_cpu_validate_set_extensions() and, more important, riscv_cpu_disabl

[PATCH v4 19/19] target/riscv/kvm.c: read/write (cbom|cboz)_blocksize in KVM

2023-06-26 Thread Daniel Henrique Barboza
If we don't set a proper cbom_blocksize|cboz_blocksize in the FDT the Linux Kernel will fail to detect the availability of the CBOM/CBOZ extensions, regardless of the contents of the 'riscv,isa' DT prop. The FDT is being written using the cpu->cfg.cbom|z_blocksize attributes, so let's expose them

[PATCH v4 07/19] target/riscv: read marchid/mimpid in kvm_riscv_init_machine_ids()

2023-06-26 Thread Daniel Henrique Barboza
Allow 'marchid' and 'mimpid' to also be initialized in kvm_riscv_init_machine_ids(). After this change, the handling of mvendorid/marchid/mimpid for the 'host' CPU type will be equal to what we already have for TCG named CPUs, i.e. the user is not able to set these values to a different val than t

[PATCH v4 18/19] target/riscv/kvm.c: add kvmconfig_get_cfg_addr() helper

2023-06-26 Thread Daniel Henrique Barboza
There are 2 places in which we need to get a pointer to a certain property of the cpu->cfg struct based on property offset. Next patch will add a couple more. Create a helper to avoid repeating this code over and over. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Andrew Jones --- target

[PATCH v2 20/26] docs/devel: add some front matter to the devel index

2023-06-26 Thread Alex Bennée
Give an overview of the most useful bits of the devel documentation to read depending on what the developer wants to do. Reviewed-by: Peter Maydell Reviewed-by: Richard Henderson Signed-off-by: Alex Bennée Message-Id: <20230619171437.357374-2-alex.ben...@linaro.org> --- v2 - removed excessiv

[PATCH v2 22/26] include/hw/qdev-core: fixup kerneldoc annotations

2023-06-26 Thread Alex Bennée
Fix up the kerneldoc markup and start documenting the various fields in QDEV related structures. This involved: - moving overall description to a DOC: comment at top - fixing various markup issues for types and structures - adding missing Return: statements - adding some typedefs to hide QLIST

[PATCH v4 10/19] target/riscv/kvm.c: init 'misa_ext_mask' with scratch CPU

2023-06-26 Thread Daniel Henrique Barboza
At this moment we're retrieving env->misa_ext during kvm_arch_init_cpu(), leaving env->misa_ext_mask behind. We want to set env->misa_ext_mask, and we want to set it as early as possible. The reason is that we're going to use it in the validation process of the KVM MISA properties we're going to a

[PATCH v2 23/26] docs/devel/qom.rst: Correct code style

2023-06-26 Thread Alex Bennée
From: Philippe Mathieu-Daudé Per commit 067109a11c ("docs/devel: mention the spacing requirement for QOM"): For a storage structure the first declaration should always be called “parent_obj” and for a class structure the first member should always be called “parent_class” Adapt the QOM rS

[PATCH v4 11/19] target/riscv/cpu: add misa_ext_info_arr[]

2023-06-26 Thread Daniel Henrique Barboza
Next patch will add KVM specific user properties for both MISA and multi-letter extensions. For MISA extensions we want to make use of what is already available in misa_ext_cfgs[] to avoid code repetition. misa_ext_info_arr[] array will hold name and description for each MISA extension that misa_e

[PATCH v4 09/19] linux-headers: Update to v6.4-rc1

2023-06-26 Thread Daniel Henrique Barboza
Update to commit ac9a78681b92 ("Linux 6.4-rc1"). Signed-off-by: Daniel Henrique Barboza Acked-by: Alistair Francis --- include/standard-headers/linux/const.h| 2 +- include/standard-headers/linux/virtio_blk.h | 18 +++ .../standard-headers/linux/virtio_config.h| 6 +++ inclu

[PATCH v4 06/19] target/riscv: use KVM scratch CPUs to init KVM properties

2023-06-26 Thread Daniel Henrique Barboza
Certain validations, such as the validations done for the machine IDs (mvendorid/marchid/mimpid), are done before starting the CPU. Non-dynamic (named) CPUs tries to match user input with a preset default. As it is today we can't prefetch a KVM default for these cases because we're only able to rea

[PATCH v2 18/26] plugins: fix memory leak while parsing options

2023-06-26 Thread Alex Bennée
It was hard to track down this leak as it was an internal allocation by glib and the backtraces did not give much away. The autofree was freeing the allocation with g_free() but not taking care of the individual strings. They should have been freed with g_strfreev() instead. Searching the glib sou

[PATCH v4 08/19] target/riscv: handle mvendorid/marchid/mimpid for KVM CPUs

2023-06-26 Thread Daniel Henrique Barboza
After changing user validation for mvendorid/marchid/mimpid to guarantee that the value is validated on user input time, coupled with the work in fetching KVM default values for them by using a scratch CPU, we're certain that the values in cpu->cfg.(mvendorid|marchid|mimpid) are already good to be

[PATCH v4 16/19] target/riscv/cpu.c: create KVM mock properties

2023-06-26 Thread Daniel Henrique Barboza
KVM-specific properties are being created inside target/riscv/kvm.c. But at this moment we're gathering all the remaining properties from TCG and adding them as is when running KVM. This creates a situation where non-KVM properties are setting flags to 'true' due to its default settings (e.g. Zawr

[PATCH v2 25/26] docs/devel: introduce some key concepts for QOM development

2023-06-26 Thread Alex Bennée
Using QOM correctly is increasingly important to maintaining a modern code base. However the current documentation skips some important concepts before launching into a simple example. Lets: - at least mention properties - mention TYPE_OBJECT and TYPE_DEVICE - talk about why we have realize/

[PATCH v4 02/19] hw/riscv/virt.c: skip 'mmu-type' FDT if satp mode not set

2023-06-26 Thread Daniel Henrique Barboza
The absence of a satp mode in riscv_host_cpu_init() is causing the following error: $ sudo ./qemu/build/qemu-system-riscv64 -machine virt,accel=kvm \ -m 2G -smp 1 -nographic -snapshot \ -kernel ./guest_imgs/Image \ -initrd ./guest_imgs/rootfs_kvm_riscv64.img \ -append "earlycon=s

[PATCH v2 26/26] tests/plugin: Remove duplicate insn log from libinsn.so

2023-06-26 Thread Alex Bennée
From: Richard Henderson This is a perfectly natural occurrence for x86 "rep movb", where the "rep" prefix forms a counted loop of the one insn. During the tests/tcg/multiarch/memory test, this logging is triggered over 35 times. Within the context of cross-i386-tci build, which is already s

[PATCH v4 01/19] target/riscv: skip features setup for KVM CPUs

2023-06-26 Thread Daniel Henrique Barboza
As it is today it's not possible to use '-cpu host' if the RISC-V host has RVH enabled. This is the resulting error: $ sudo ./qemu/build/qemu-system-riscv64 \ -machine virt,accel=kvm -m 2G -smp 1 \ -nographic -snapshot -kernel ./guest_imgs/Image \ -initrd ./guest_imgs/rootfs_kvm_riscv

[PATCH v2 17/26] plugins: force slow path when plugins instrument memory ops

2023-06-26 Thread Alex Bennée
The lack of SVE memory instrumentation has been an omission in plugin handling since it was introduced. Fortunately we can utilise the probe_* functions to force all all memory access to follow the slow path. We do this by checking the access type and presence of plugin memory callbacks and if set

Re: [PULL 10/30] ppc/spapr: H_ENTER_NESTED should restore host XER ca field

2023-06-26 Thread Nicholas Piggin
On Tue Jun 27, 2023 at 7:45 AM AEST, Cédric Le Goater wrote: > On 6/26/23 14:26, Michael Tokarev wrote: > > 26.06.2023 08:56, Cédric Le Goater wrote: > >> From: Nicholas Piggin > >> > >> Fix missing env->ca restore when going from L2 back to the host. > >> > >> Fixes: 120f738a467 ("spapr: implemen

[PATCH 04/16] target/riscv: Restrict 'rv128' machine to TCG accelerator

2023-06-26 Thread Philippe Mathieu-Daudé
We only build for 32/64-bit hosts, so TCG is required for 128-bit targets. Signed-off-by: Philippe Mathieu-Daudé --- target/riscv/cpu.c | 12 +--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 175dbc9826..7f281cdcf6 100644 ---

[PATCH 06/16] target/riscv: Restrict riscv_cpu_do_interrupt() to sysemu

2023-06-26 Thread Philippe Mathieu-Daudé
riscv_cpu_do_interrupt() is not reachable on user emulation. Signed-off-by: Philippe Mathieu-Daudé --- target/riscv/cpu.h| 5 +++-- target/riscv/cpu_helper.c | 7 ++- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h index 83a9a965

[PATCH 03/16] target/riscv: Restrict sysemu specific header to user emulation

2023-06-26 Thread Philippe Mathieu-Daudé
Signed-off-by: Philippe Mathieu-Daudé --- target/riscv/cpu.c| 8 +--- target/riscv/cpu_helper.c | 2 ++ target/riscv/csr.c| 2 ++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 4035fe0e62..175dbc9826 100644 --- a/ta

[PATCH 08/16] target/riscv: Move TCG-specific cpu_get_tb_cpu_state() to tcg/cpu.c

2023-06-26 Thread Philippe Mathieu-Daudé
Signed-off-by: Philippe Mathieu-Daudé --- target/riscv/cpu_helper.c| 83 -- target/riscv/tcg/cpu.c | 97 target/riscv/tcg/meson.build | 1 + 3 files changed, 98 insertions(+), 83 deletions(-) create mode 100644 target/ri

[PATCH 12/16] target/riscv: Expose riscv_cpu_pending_to_irq() from cpu_helper.c

2023-06-26 Thread Philippe Mathieu-Daudé
We want to extract TCG/sysemu-specific code from cpu_helper.c, but some functions call riscv_cpu_pending_to_irq(). Expose the prototype in "internals.h". Signed-off-by: Philippe Mathieu-Daudé --- target/riscv/internals.h | 4 target/riscv/cpu_helper.c | 6 +++--- 2 files changed, 7 inserti

[PATCH 10/16] target/riscv: Extract TCG-specific code from debug.c

2023-06-26 Thread Philippe Mathieu-Daudé
Extract TCG-specific code from debug.c to tcg/sysemu/debug.c, restrict the prototypes to TCG, adapt meson rules. Signed-off-by: Philippe Mathieu-Daudé --- target/riscv/debug.h| 2 + target/riscv/debug.c| 148 - target/riscv/tcg/sysemu/deb

[PATCH 07/16] target/riscv: Move TCG-specific files to target/riscv/tcg/

2023-06-26 Thread Philippe Mathieu-Daudé
Move TCG-specific files to the a new 'tcg' sub-directory. Add stubs for riscv_cpu_[get/set]_fflags and riscv_raise_exception(). Adapt meson rules. Signed-off-by: Philippe Mathieu-Daudé --- target/riscv/{ => tcg}/XVentanaCondOps.decode | 0 target/riscv/{ => tcg}/insn16.decode | 0 tar

<    1   2   3   4   5   6   >