Re: [PATCH] tests/qtest/netdev-socket: Avoid variable-length array in inet_get_free_port_multiple()

2023-08-25 Thread Laurent Vivier
On 8/24/23 18:45, Peter Maydell wrote: We use a variable-length array in inet_get_free_port_multiple(). This is only test code called at the start of a test, so switch to a heap allocation instead. The codebase has very few VLAs, and if we can get rid of them all we can make the compiler error o

Re: [PATCH 2/5] target/hppa: Add priviledge to MMU index conversion helpers

2023-08-25 Thread Philippe Mathieu-Daudé
On 24/8/23 23:04, del...@kernel.org wrote: From: Helge Deller Add two macros which convert priviledge level to/from MMU index: - PRIV_TO_MMU_IDX(priv) returns the MMU index for the given priviledge level - MMU_IDX_TO_PRIV(mmu_idx) returns the corresponding priviledge level for this

Re: [PATCH 1/5] target/hppa: Add missing PL1 and PL2 priviledge levels

2023-08-25 Thread Philippe Mathieu-Daudé
On 24/8/23 23:04, del...@kernel.org wrote: From: Helge Deller The hppa CPU has 4 priviledge levels (0-3). Mention the missing PL1 and PL2 levels, although the Linux kernel uses only 0 (KERNEL) and 3 (USER). Not sure about HP-UX. Signed-off-by: Helge Deller --- target/hppa/cpu.h | 3 +++ 1

Re: [PATCH v11 0/9] rutabaga_gfx + gfxstream

2023-08-25 Thread Alyssa Ross
Gurchetan Singh writes: > On Wed, Aug 23, 2023 at 4:07 AM Alyssa Ross wrote: > >> Gurchetan Singh writes: >> >> > - Official "release commits" issued for rutabaga_gfx_ffi, >> > gfxstream, aemu-base. For example, see crrev.com/c/4778941 >> > >> > - The release commits can make packaging easie

Re: [PATCH 3/5] target/hppa: Do not use hardcoded value for tlb_flush_*()

2023-08-25 Thread Philippe Mathieu-Daudé
On 24/8/23 23:04, del...@kernel.org wrote: From: Helge Deller Avoid using hardcoded values when calling the tlb_flush*() functions. Instead define the correct mask (HPPA_MMU_FLUSH_MASK) and use it. Skip flushing the MMU for physical addresses. Alternatively: Instead, define and use HPPA_MM

Re: [PATCH 4/5] target/hppa: Use privilege helper in hppa_get_physical_address()

2023-08-25 Thread Philippe Mathieu-Daudé
On 24/8/23 23:04, del...@kernel.org wrote: From: Helge Deller Convert hppa_get_physical_address() to use the privilege helper macro. Signed-off-by: Helge Deller --- target/hppa/mem_helper.c | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) Reviewed-by: Philippe Mathieu-Daudé

Re: [PATCH v3 06/13] docs/devel: simplify the minimal checklist

2023-08-25 Thread Philippe Mathieu-Daudé
Ping? On 5/7/23 13:44, Philippe Mathieu-Daudé wrote: Hi Alex, On 17/11/22 18:25, Alex Bennée wrote: The bullet points are quite long and contain process tips. Move those bits of the bullet to the relevant sections and link to them. Use a table for nicer formatting of the checklist. Signed-off

Re: [PATCH v2 2/2] softmmu/dirtylimit: Convert free to g_free

2023-08-25 Thread Philippe Mathieu-Daudé
On 25/8/23 04:32, alloc.yo...@outlook.com wrote: From: alloc Convert free to g_free to match g_new and g_malloc functions. Signed-off-by: alloc Fixes: cc2b33eab0 ("softmmu/dirtylimit: Implement vCPU dirtyrate calculation periodically") Fixes: baa609832e ("softmmu/dirtylimit: Implement vir

Re: [PATCH v2 09/12] gdbstub: remove unused user_ctx field

2023-08-25 Thread Philippe Mathieu-Daudé
On 24/8/23 18:39, Alex Bennée wrote: This was always NULL so drop it. Signed-off-by: Alex Bennée Acked-by: Ilya Leoshkevich --- gdbstub/gdbstub.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) Reviewed-by: Philippe Mathieu-Daudé

Re: [PATCH v2 11/12] gdbstub: replace global gdb_has_xml with a function

2023-08-25 Thread Philippe Mathieu-Daudé
On 24/8/23 18:39, Alex Bennée wrote: Try and make the self reported global hack a little less hackish by providing a query function instead. As gdb_has_xml was always set if we negotiated XML we can now use the presence of ->target_xml as the test instead. Signed-off-by: Alex Bennée --- gdbst

Re: [PATCH v2 12/12] gdbstub: move comment for gdb_register_coprocessor

2023-08-25 Thread Philippe Mathieu-Daudé
On 24/8/23 18:39, Alex Bennée wrote: Use proper kdoc style comments for this API function. Signed-off-by: Alex Bennée --- include/exec/gdbstub.h | 10 ++ gdbstub/gdbstub.c | 6 -- 2 files changed, 10 insertions(+), 6 deletions(-) Reviewed-by: Philippe Mathieu-Daudé

Re: [PATCH v3 11/11] machine: Improve error message when using default RAM backend id

2023-08-25 Thread David Hildenbrand
On 25.08.23 08:57, ThinerLogoer wrote: Hello, At 2023-08-23 23:34:11, "David Hildenbrand" wrote: For migration purposes, users might want to reuse the default RAM backend id, but specify a different memory backend. For example, to reuse "pc.ram" on q35, one has to set -machine q35,memory-

Re: [PATCH 07/12] target/ppc: Use generic hrev64_i64() in BRH / BSWAP16x8 opcodes

2023-08-25 Thread Nicholas Piggin
On Tue Aug 22, 2023 at 10:53 PM AEST, Philippe Mathieu-Daudé wrote: > Signed-off-by: Philippe Mathieu-Daudé > --- > target/ppc/translate.c | 10 +- > target/ppc/translate/vsx-impl.c.inc | 19 ++- > 2 files changed, 3 insertions(+), 26 deletions(-) > > diff --g

Re: [PATCH v2 01/12] gitlab: enable ccache for many build jobs

2023-08-25 Thread Philippe Mathieu-Daudé
On 24/8/23 18:38, Alex Bennée wrote: From: Daniel P. Berrangé The `ccache` tool can be very effective at reducing compilation times when re-running pipelines with only minor changes each time. For example a fresh 'build-system-fedora' job will typically take 20 minutes on the gitlab.com shared

Re: [PATCH v2 01/12] gitlab: enable ccache for many build jobs

2023-08-25 Thread Michael Tokarev
24.08.2023 19:38, Alex Bennée wrote: From: Daniel P. Berrangé The `ccache` tool can be very effective at reducing compilation times when re-running pipelines with only minor changes each time. For example a fresh 'build-system-fedora' job will typically take 20 minutes on the gitlab.com shared

Re: [PATCH 2/4] hw/net/rocker: Avoid variable length array

2023-08-25 Thread Francisco Iglesias
On [2023 Aug 24] Thu 16:32:22, Peter Maydell wrote: > Replace an on-stack variable length array in of_dpa_ig() with > a g_autofree heap allocation. > > The codebase has very few VLAs, and if we can get rid of them all we > can make the compiler error on new additions. This is a defensive > measur

Re: [PATCH 4/4] net/tap: Avoid variable-length array

2023-08-25 Thread Francisco Iglesias
On [2023 Aug 24] Thu 16:32:24, Peter Maydell wrote: > Use a heap allocation instead of a variable length array in > tap_receive_iov(). > > The codebase has very few VLAs, and if we can get rid of them all we > can make the compiler error on new additions. This is a defensive > measure against sec

Re: [PATCH 3/4] net/dump: Avoid variable length array

2023-08-25 Thread Francisco Iglesias
On [2023 Aug 24] Thu 16:32:23, Peter Maydell wrote: > Use a g_autofree heap allocation instead of a variable length > array in dump_receive_iov(). > > The codebase has very few VLAs, and if we can get rid of them all we > can make the compiler error on new additions. This is a defensive > measure

Re: [PATCH 00/12] tcg: Factor hrev{32,64}_{i32,i64,tl} out

2023-08-25 Thread Nicholas Piggin
On Tue Aug 22, 2023 at 10:40 PM AEST, Philippe Mathieu-Daudé wrote: > This series factor the "byteswap each halfword within a > 32/64-bit value" code duplication as generic helpers. > > Modulo the documentation added, there is a good negative > diff-stat, so I believe this is a win from a maintaina

Re: [PATCH for-8.1] hw/usb/hcd-xhci-pci: Fail if user requested MSIX but it can't be used

2023-08-25 Thread Philippe Mathieu-Daudé
Ping? On 19/7/23 16:17, Philippe Mathieu-Daudé wrote: Do not silently ignore the user request of using MSIX. Remove the TODO. Coverity reported this as CID 1508725. Signed-off-by: Philippe Mathieu-Daudé --- hw/usb/hcd-xhci-pci.c | 21 - 1 file changed, 16 insertions(+),

Re: [PATCH 2/2] io: follow coroutine AioContext in qio_channel_yield()

2023-08-25 Thread Daniel P . Berrangé
On Thu, Aug 24, 2023 at 02:26:42PM -0400, Stefan Hajnoczi wrote: > I've done most of the audit necessary to understand which AioContext is > used where. The call graph is large because qio_channel_yield() is used > internally by qio_channel_readv_full_all_eof(), > qio_channel_writev_full_all(), and

Re: [PATCH v3 4/6] hw/virtio/vhost-vdpa: Use target-agnostic qemu_target_page_mask()

2023-08-25 Thread Philippe Mathieu-Daudé
On 18/8/23 13:00, Philippe Mathieu-Daudé wrote: ping? On 10/7/23 11:49, Philippe Mathieu-Daudé wrote: Similarly to commit e414ed2c47 ("virtio-iommu: Use target-agnostic qemu_target_page_mask"), Replace the target-specific TARGET_PAGE_SIZE and TARGET_PAGE_MASK definitions by a call to the runtim

Re: [PATCH v2 01/12] gitlab: enable ccache for many build jobs

2023-08-25 Thread Daniel P . Berrangé
On Fri, Aug 25, 2023 at 10:46:29AM +0300, Michael Tokarev wrote: > 24.08.2023 19:38, Alex Bennée wrote: > > From: Daniel P. Berrangé > > > > The `ccache` tool can be very effective at reducing compilation times > > when re-running pipelines with only minor changes each time. For example > > a fre

Re: [PATCH] target/ppc: Flush inputs to zero with NJ in ppc_store_vscr

2023-08-25 Thread Nicholas Piggin
On Mon Aug 21, 2023 at 12:59 PM AEST, Richard Henderson wrote: > Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1779 > Signed-off-by: Richard Henderson Should go to qemu-stable I would say? Thanks for fixing. Reviewed-by: Nicholas Piggin > --- > target/ppc/cpu.c | 1 + > 1 file chan

Re: [RFC v2 PATCH] record-replay: support SMP target machine

2023-08-25 Thread Nicholas Piggin
On Tue Aug 22, 2023 at 2:44 PM AEST, Pavel Dovgalyuk wrote: > On 11.08.2023 04:47, Nicholas Piggin wrote: > > RR CPU switching is driven by timers and events so it is deterministic > > like everything else. Record a CPU switch event and use that to drive > > the CPU switch on replay. > > > > Signe

Re: [PATCH v2 01/12] gitlab: enable ccache for many build jobs

2023-08-25 Thread Philippe Mathieu-Daudé
On 25/8/23 09:46, Michael Tokarev wrote: 24.08.2023 19:38, Alex Bennée wrote: From: Daniel P. Berrangé The `ccache` tool can be very effective at reducing compilation times when re-running pipelines with only minor changes each time. For example a fresh 'build-system-fedora' job will typically

Re: [PATCH v2 01/12] gitlab: enable ccache for many build jobs

2023-08-25 Thread Thomas Huth
On 25/08/2023 10.34, Philippe Mathieu-Daudé wrote: ... __FILE__ is used by assert() family, some DEBUG_PRINTF(), but mainly by "qapi/error.h", so all error_setg*() calls. This has been bugging me since quite some time, since if you build the same QEMU in different paths (usually on different mac

Re: [PATCH 17/24] xen: spelling fixes

2023-08-25 Thread David Woodhouse
On Wed, 2023-08-23 at 22:00 +0300, Michael Tokarev wrote: > 23.08.2023 21:38, David Woodhouse wrote: > > On Wed, 2023-08-23 at 09:53 +0300, Michael Tokarev wrote: > > > > > >   include/hw/xen/interface/arch-x86/xen-x86_64.h | 2 +- > > >   include/hw/xen/interface/arch-x86/xen.h    | 2 +- > > >

Re: [RFC] Proposal of QEMU PCI Endpoint test environment

2023-08-25 Thread Shunsuke Mie
On 2023/08/23 15:09, Manivannan Sadhasivam wrote: On Fri, Aug 18, 2023 at 10:46:02PM +0900, Shunsuke Mie wrote: Hi all, We are proposing to add a new test syste to Linux for PCIe Endpoint. That can be run on QEMU without real hardware. At present, partially we have confirmed that pci-epf-test

Re: [PATCH v3 11/11] machine: Improve error message when using default RAM backend id

2023-08-25 Thread Markus Armbruster
David Hildenbrand writes: > On 25.08.23 08:57, ThinerLogoer wrote: >> Hello, >> >> At 2023-08-23 23:34:11, "David Hildenbrand" wrote: >>> For migration purposes, users might want to reuse the default RAM >>> backend id, but specify a different memory backend. >>> >>> For example, to reuse "pc.r

Re: [PATCH v3 11/11] machine: Improve error message when using default RAM backend id

2023-08-25 Thread David Hildenbrand
On 25.08.23 11:10, Markus Armbruster wrote: David Hildenbrand writes: On 25.08.23 08:57, ThinerLogoer wrote: Hello, At 2023-08-23 23:34:11, "David Hildenbrand" wrote: For migration purposes, users might want to reuse the default RAM backend id, but specify a different memory backend. For

Re: [PATCH v2 01/12] gitlab: enable ccache for many build jobs

2023-08-25 Thread Michael Tokarev
25.08.2023 11:34, Philippe Mathieu-Daudé wrote: ... __FILE__ is used by assert() family, some DEBUG_PRINTF(), but mainly by "qapi/error.h", so all error_setg*() calls. This has been bugging me since quite some time, since if you build the same QEMU in different paths (usually on different machin

[PATCH] fix leaks found wtih fuzzing

2023-08-25 Thread Dmitry Frolov
It is true, that there is no problem during runtime from the first sight, because the memmory is lost just before qemu exits. Nevertheless, this change is necessary, because AddressSanitizer is not able to recognize this situation and produces crash-report (which is false-positive in fact). Lots of

Re: [PATCH RESEND v5 19/26] target/ppc: Remove references to gdb_has_xml

2023-08-25 Thread Nicholas Piggin
On Fri Aug 18, 2023 at 1:36 PM AEST, Akihiko Odaki wrote: > GDB has XML support since 6.7 which was released in 2007. > It's time to remove support for old GDB versions without XML support. These 3 patches might be better to go ahead in a preparation series with "remove support for gdb 6.7" in the

Re: [PATCH v3 11/11] machine: Improve error message when using default RAM backend id

2023-08-25 Thread Markus Armbruster
David Hildenbrand writes: > On 25.08.23 11:10, Markus Armbruster wrote: >> David Hildenbrand writes: >> >>> On 25.08.23 08:57, ThinerLogoer wrote: Hello, At 2023-08-23 23:34:11, "David Hildenbrand" wrote: > For migration purposes, users might want to reuse the default RAM >>

Re: [PATCH v3 11/11] machine: Improve error message when using default RAM backend id

2023-08-25 Thread David Hildenbrand
On 25.08.23 11:56, Markus Armbruster wrote: David Hildenbrand writes: On 25.08.23 11:10, Markus Armbruster wrote: David Hildenbrand writes: On 25.08.23 08:57, ThinerLogoer wrote: Hello, At 2023-08-23 23:34:11, "David Hildenbrand" wrote: For migration purposes, users might want to reuse

Re: [PATCH] i386/xen: Ignore VCPU_SSHOTTMR_future flag in set_singleshot_timer()

2023-08-25 Thread Paul Durrant
On 23/08/2023 12:58, David Woodhouse wrote: From: David Woodhouse Upstream Xen now ignores this flag¹, since the only guest kernel ever to use it was buggy. ¹ https://xenbits.xen.org/gitweb/?p=xen.git;a=commitdiff;h=19c6cbd909 Signed-off-by: David Woodhouse --- We do take an argument to emul

Re: [PATCH v3 11/11] machine: Improve error message when using default RAM backend id

2023-08-25 Thread David Hildenbrand
On 25.08.23 11:59, David Hildenbrand wrote: On 25.08.23 11:56, Markus Armbruster wrote: David Hildenbrand writes: On 25.08.23 11:10, Markus Armbruster wrote: David Hildenbrand writes: On 25.08.23 08:57, ThinerLogoer wrote: Hello, At 2023-08-23 23:34:11, "David Hildenbrand" wrote: For

Re: [POC 2/2] add test exposing AHCI reset issue

2023-08-25 Thread Fiona Ebner
Am 24.08.23 um 15:38 schrieb Fiona Ebner: > Fails without the previous commit "hw/ide: reset: cancel async DMA > operation before reseting state". > > I haven't ever written such a test before, but I wanted something to > expose the problem more easily. It hardcodes the behavior that the > pending

[RFC v5 00/10] Native Library Calls

2023-08-25 Thread Yeqi Fu
Executing a program under QEMU's user mode subjects the entire program, including all library calls, to translation. It's important to understand that many of these library functions are optimized specifically for the guest architecture. Therefore, their translation might not yield the most efficie

[RFC v5 04/10] linux-user: Implement native-bypass option support

2023-08-25 Thread Yeqi Fu
This commit implements the -native-bypass support in linux-user. The native_calls_enabled() function can be true only when the '-native-bypass' option is given. Signed-off-by: Yeqi Fu --- include/native/native.h | 9 + linux-user/main.c | 38 ++

[RFC v5 02/10] build: Implement libnative library and the build machinery for libnative

2023-08-25 Thread Yeqi Fu
This commit implements a shared library, where native functions are rewritten as special instructions. At runtime, user programs load the shared library, and special instructions are executed when native functions are called. Signed-off-by: Yeqi Fu --- Makefile| 2 +

[RFC v5 01/10] build: Implement logic for sharing cross-building config files

2023-08-25 Thread Yeqi Fu
Since both TCG tests and libnative libraries require cross-building, the config files for cross-building, config_target_mak, are now saved in the cross-build directory for sharing. This allows TCG tests and libnative libraries to use these config files through symbolic links when cross-building con

[RFC v5 03/10] linux-user: Implement envlist_appendenv and add tests for envlist

2023-08-25 Thread Yeqi Fu
Signed-off-by: Yeqi Fu --- include/qemu/envlist.h| 13 ++ tests/unit/meson.build| 1 + tests/unit/test-envlist.c | 94 +++ util/envlist.c| 67 +++- 4 files changed, 165 insertions(+), 10 deletions(-) create mode

[RFC v5 06/10] target/i386: Add support for native library calls

2023-08-25 Thread Yeqi Fu
This commit introduces support for native library calls on the i386 target. When encountering special instructions reserved for native calls, this commit extracts the function name and generates the corresponding native call. Signed-off-by: Yeqi Fu --- configs/targets/i386-linux-user.mak | 1

[RFC v5 10/10] docs/user: Add doc for native library calls

2023-08-25 Thread Yeqi Fu
Signed-off-by: Yeqi Fu --- docs/user/index.rst| 1 + docs/user/native_calls.rst | 90 ++ 2 files changed, 91 insertions(+) create mode 100644 docs/user/native_calls.rst diff --git a/docs/user/index.rst b/docs/user/index.rst index 782d27cda2..d3fc9b7a

[RFC v5 07/10] target/mips: Add support for native library calls

2023-08-25 Thread Yeqi Fu
This commit introduces support for native library calls on the mips target. When encountering special instructions reserved for native calls, this commit extracts the function name and generates the corresponding native call. Signed-off-by: Yeqi Fu --- configs/targets/mips-linux-user.mak | 1

[RFC v5 05/10] tcg: Add tcg opcodes and helpers for native library calls

2023-08-25 Thread Yeqi Fu
This commit implements tcg opcodes and helpers for native library calls. A table is used to store the parameter types and return value types for each native library function. In terms of types, only three types are of real concern: the two base sizes int and intptr_t, and if the value is a pointer,

[RFC v5 08/10] target/arm: Add support for native library calls

2023-08-25 Thread Yeqi Fu
This commit introduces support for native library calls on the arm target. When encountering special instructions reserved for native calls, this commit extracts the function name and generates the corresponding native call. Signed-off-by: Yeqi Fu --- configs/targets/aarch64-linux-user.mak | 1

[RFC v5 09/10] tests/tcg/multiarch: Add nativecall.c test

2023-08-25 Thread Yeqi Fu
Introduce a new test for native calls to ensure their functionality. The process involves cross-compiling the test cases, building them as dynamically linked binaries, and running these binaries which necessitates the addition of the appropriate interpreter prefix. Signed-off-by: Yeqi Fu --- tes

Re: Failing avocado tests in CI (was: Re: [PULL 00/24] tcg + linux-user queue for 8.1-rc3)

2023-08-25 Thread Philippe Mathieu-Daudé
On 24/8/23 18:23, Michael Tokarev wrote: 24.08.2023 18:31, Alex Bennée wrote: .. which bisects to:    commit f7eaf9d702efdd02481d5f1c25f7d8e0ffb64c6e (HEAD, refs/bisect/bad)    Author: Richard Henderson    Date:   Tue Aug 1 10:46:03 2023 -0700    accel/tcg: Do not issue misaligned i/o

Re: Failing avocado tests in CI (was: Re: [PULL 00/24] tcg + linux-user queue for 8.1-rc3)

2023-08-25 Thread Philippe Mathieu-Daudé
On 24/8/23 20:31, Richard Henderson wrote: On 8/24/23 08:31, Alex Bennée wrote: It's some sort of timing issue, which sometimes goes away when re-run. I was re-running tests *a lot* in order to get them to go green while running the 8.1 release. There is a definite regression point for the tes

Re: [Qemu PATCH v2 9/9] hw/mem/cxl_type3: Add dpa range validation for accesses to dc regions

2023-08-25 Thread Jonathan Cameron via
On Thu, 24 Aug 2023 13:49:00 -0700 Fan Ni wrote: > On Mon, Aug 07, 2023 at 09:53:42AM +0100, Jonathan Cameron wrote: > > On Tue, 25 Jul 2023 18:39:56 + > > Fan Ni wrote: > > > > > From: Fan Ni > > > > > > Not all dpa range in the dc regions is valid to access until an extent > > > coverin

[PATCH] fix leaks found wtih fuzzing

2023-08-25 Thread Dmitry Frolov
It is true, that there is no problem during runtime from the first sight, because the memory is lost just before qemu exits. Nevertheless, this change is necessary, because AddressSanitizer is not able to recognize this situation and produces crash-report (which is false-positive in fact). Lots of

[RFC PATCH 1/3] cpu: Add new API cpu_type_by_name

2023-08-25 Thread LIU Zhiwei
cpu_type_by_name is used to get the cpu type name from the command line -cpu. Currently it is only used by parse_cpu_option. In the next patch, it will be used by other cpu query functions. Signed-off-by: LIU Zhiwei --- cpu.c | 31 +++ 1 file changed, 19 insertions(+

[RFC PATCH 2/3] target/riscv: Add API list_cpu_props

2023-08-25 Thread LIU Zhiwei
This API used for output current configuration for one specified CPU. Currently only RISC-V frontend implements this API. Signed-off-by: LIU Zhiwei --- cpu.c | 8 include/exec/cpu-common.h | 1 + target/riscv/cpu.c| 10 ++ target/riscv/cpu.h

[RFC PATCH 3/3] softmmu/vl: Add qemu_cpu_opts QemuOptsList

2023-08-25 Thread LIU Zhiwei
This make the cpu works the similar way like the -device option. For device option, """ ./qemu-system-riscv64 -device e1000,help e1000 options: acpi-index=- (default: 0) addr= - Slot and optional function number, example: 06.0 or 06 (default: -1) autonegotiation= - on/off (de

[RFC PATCH 0/3] Add API for list cpu extensions

2023-08-25 Thread LIU Zhiwei
Some times we want to know what is the really mean of one cpu option. For example, in RISC-V, we usually specify a cpu in this way: -cpu rv64,v=on If we don't look into the source code, we can't get the ISA extensions of this -cpu command line. In this patch set, we add one list_cpu_props API for

[PATCH v4 0/6] Complete i.MX6UL and i.MX7 processor for bare metal application.

2023-08-25 Thread Jean-Christophe Dubois
This patch adds a few unimplemented TZ devices (TZASC and CSU) to i.MX6UL and i.MX7 processors to avoid bare metal application to experiment "bus error" when acccessing these devices. It also adds some internal memory segments (OCRAM) to the i.MX7 to allow bare metal application to use them. Last

[PATCH v4 1/6] Remove i.MX7 IOMUX GPR device from i.MX6UL

2023-08-25 Thread Jean-Christophe Dubois
i.MX7 IOMUX GPR device is not equivalent to i.MX6UL IOMUXC GPR device. In particular, register 22 is not present on i.MX6UL and this is actualy The only register that is really emulated in the i.MX7 IOMUX GPR device. Note: The i.MX6UL code is actually also implementing the IOMUX GPR device as an u

[PATCH v4 4/6] Refactor i.MX7 processor code

2023-08-25 Thread Jean-Christophe Dubois
* Add Addr and size definition for all i.MX7 devices in i.MX7 header file. * Use those newly defined named constants whenever possible. * Standardize the way we init a familly of unimplemented devices - SAI - PWM - CAN * Add/rework few comments Signed-off-by: Jean-Christophe Dubois --- hw/

[PATCH v4 2/6] Refactor i.MX6UL processor code

2023-08-25 Thread Jean-Christophe Dubois
* Add Addr and size definition for most i.MX6UL devices in i.MX6UL header file. * Use those newly defined named constants whenever possible. * Standardize the way we init a familly of unimplemented devices - SAI - PWM - CAN * Add/rework few comments Signed-off-by: Jean-Christophe Dubois ---

[PATCH v4 6/6] Add i.MX7 SRC device implementation

2023-08-25 Thread Jean-Christophe Dubois
The SRC device is normally used to start the secondary CPU. When running Linux directly, QEMU is emulating a PSCI interface that UBOOT is installing at boot time and therefore the fact that the SRC device is unimplemented is hidden as Qemu respond directly to PSCI requets without using the SRC dev

[PATCH v4 5/6] Add i.MX7 missing TZ devices and memory regions

2023-08-25 Thread Jean-Christophe Dubois
* Add TZASC as unimplemented device. - Allow bare metal application to access this (unimplemented) device * Add CSU as unimplemented device. - Allow bare metal application to access this (unimplemented) device * Add various memory segments - OCRAM - OCRAM EPDC - OCRAM PXP - OCRAM S -

[PATCH v4 3/6] Add i.MX6UL missing devices.

2023-08-25 Thread Jean-Christophe Dubois
* Add TZASC as unimplemented device. - Allow bare metal application to access this (unimplemented) device * Add CSU as unimplemented device. - Allow bare metal application to access this (unimplemented) device * Add 4 missing PWM devices Signed-off-by: Jean-Christophe Dubois Reviewed-by: Phil

Re: [PATCH] fix leaks found wtih fuzzing

2023-08-25 Thread Michael Tokarev
25.08.2023 14:58, Dmitry Frolov wrote: It is true, that there is no problem during runtime from the first sight, because the memory is lost just before qemu exits. Nevertheless, this change is necessary, because AddressSanitizer is not able to recognize this situation and produces crash-report (w

[PATCH 00/20] riscv: split TCG/KVM accelerators from cpu.c

2023-08-25 Thread Daniel Henrique Barboza
Based-on: 20230824221440.484675-1-dbarb...@ventanamicro.com ("[PATCH RESEND v8 00/20] riscv: 'max' CPU, detect user choice in TCG") Hi, The idea of this work was hinted at during a review [1] where Phil mentioned that we should handle TCG specific constraints in AccelCPUClass::cpu_realizefn(). Wh

[PATCH 09/20] target/riscv/cpu.c: mark extensions arrays as 'const'

2023-08-25 Thread Daniel Henrique Barboza
We'll need to export these arrays to the accelerator classes in the next patches. Mark them as 'const' now to minimize changes in the future. Note that 'riscv_cpu_options' will also be exported, but can't be marked as 'const', because the properties are changed via qdev_property_add_static(). Sig

[PATCH 06/20] target/riscv: add 'max_features' CPU flag

2023-08-25 Thread Daniel Henrique Barboza
The 'max' CPU type is being configured during init() time by enabling all relevant extensions. Instead of checking for 'max' CPU to enable all extensions, add a new CPU cfg flag 'max_features' that can be used by any CPU during its cpu_init() function. We'll check for it during post_init() time to

[PATCH 02/20] target/riscv: move riscv_cpu_realize_tcg() to TCG::cpu_realizefn()

2023-08-25 Thread Daniel Henrique Barboza
riscv_cpu_realize_tcg() was added to allow TCG cpus to have a different realize() path during the common riscv_cpu_realize(), making it a good choice to start moving TCG exclusive code to tcg-cpu.c. Rename it to tcg_cpu_realizefn() and assign it as a implementation of accel::cpu_realizefn(). tcg_c

[PATCH 13/20] target/riscv/kvm: refactor kvm_riscv_init_user_properties()

2023-08-25 Thread Daniel Henrique Barboza
The function is doing way more than just init user properties. We would also like to use the 'user_extension_properties' class property, as the TCG driver is already using, to decide whether KVM should expose user properties or not. Rename kvm_riscv_init_user_properties() to riscv_init_kvm_registe

[PATCH 04/20] target/riscv: move riscv_tcg_ops to tcg-cpu.c

2023-08-25 Thread Daniel Henrique Barboza
Move the remaining of riscv_tcg_ops now that we have a working realize() implementation. Signed-off-by: Daniel Henrique Barboza --- target/riscv/cpu.c | 58 - target/riscv/cpu.h | 4 --- target/riscv/tcg/tcg-cpu.c | 59

[PATCH 12/20] target/riscv: move KVM only files to kvm subdir

2023-08-25 Thread Daniel Henrique Barboza
Move the files to a 'kvm' dir to promote more code separation between accelerators and making our lives easier supporting build options such as --disable-tcg. Rename kvm.c to kvm-cpu.c to keep it in line with its TCG counterpart. Signed-off-by: Daniel Henrique Barboza --- hw/riscv/virt.c

[PATCH 19/20] target/riscv: add 'tcg_supported' class property

2023-08-25 Thread Daniel Henrique Barboza
This property indicates if a CPU supports TCG acceleration. All CPUs but the 'host' CPU supports it. The error in tcg_cpu_realizefn() can now be made generic in case more non-TCG CPUs are added in the future. Signed-off-by: Daniel Henrique Barboza --- target/riscv/cpu-qom.h | 1 + target/r

[PATCH 11/20] target/riscv: introduce KVM AccelCPUClass

2023-08-25 Thread Daniel Henrique Barboza
Add a KVM accelerator class like we did with TCG. The difference is that, at least for now, we won't be using a realize() implementation for this accelerator. We'll start by assiging kvm_riscv_cpu_add_kvm_properties(), renamed to kvm_cpu_instance_init(), as a 'cpu_instance_init' implementation. Ch

[PATCH 01/20] target/riscv: introduce TCG AccelCPUClass

2023-08-25 Thread Daniel Henrique Barboza
target/riscv/cpu.c needs to handle all possible accelerators (TCG and KVM at this moment) during both init() and realize() time. This forces us to resort to a lot of "if tcg" and "if kvm" throughout the code, which isn't wrong, but can get cluttered over time. Splitting acceleration specific code f

[PATCH 16/20] target/riscv/tcg: move riscv_cpu_add_misa_properties() to tcg-cpu.c

2023-08-25 Thread Daniel Henrique Barboza
All code related to MISA TCG properties is also moved. At this point, all TCG properties handling is done in tcg-cpu.c, all KVM properties handling is done in kvm-cpu.c. Signed-off-by: Daniel Henrique Barboza --- target/riscv/cpu.c | 89 -- target/ris

[PATCH 14/20] target/riscv/kvm: do not use riscv_cpu_add_misa_properties()

2023-08-25 Thread Daniel Henrique Barboza
riscv_cpu_add_misa_properties() is being used to fill the missing KVM MISA properties but it is a TCG helper that was adapted to do so. We'll move it to tcg-cpu.c in the next patches, meaning that KVM needs to fill the remaining MISA properties on its own. Do not use riscv_cpu_add_misa_properties(

Re: [sdl-qemu] [PATCH] fix leaks found wtih fuzzing

2023-08-25 Thread Alexey Khoroshilov
On 25.08.2023 12:29, Dmitry Frolov wrote: > It is true, that there is no problem during runtime > from the first sight, because the memmory is lost just > before qemu exits. Nevertheless, this change is necessary, > because AddressSanitizer is not able to recognize this > situation and produces cra

[PATCH 18/20] target/riscv/cpu: move priv spec functions to tcg-cpu.c

2023-08-25 Thread Daniel Henrique Barboza
Priv spec validation is TCG specific. Move it to the TCG accel class. Signed-off-by: Daniel Henrique Barboza --- target/riscv/cpu.c | 39 -- target/riscv/cpu.h | 2 -- target/riscv/tcg/tcg-cpu.c | 39 ++ 3 f

[PATCH 03/20] target/riscv: move riscv_cpu_validate_set_extensions() to tcg-cpu.c

2023-08-25 Thread Daniel Henrique Barboza
This function is the core of the RISC-V validations for TCG CPUs, and it has a lot going on. Functions in cpu.c were made public to allow them to be used by the KVM accelerator class later on. 'cpu_cfg_ext_get_min_version()' is notably hard to move it to another file due to its dependency with isa

[PATCH 20/20] target/riscv: add 'kvm_supported' class property

2023-08-25 Thread Daniel Henrique Barboza
This follows the same idea of 'tcg_support' property added in the previous patch. Note that we're now implementing the 'cpu_realizefn' for the KVMAccel class since this verification is done in realize() time. Supporting vendor CPUs with KVM is not possible. We rely on the extension support of the

[PATCH 10/20] target/riscv: move riscv_cpu_add_kvm_properties() to kvm.c

2023-08-25 Thread Daniel Henrique Barboza
We'll introduce the KVM accelerator class with a 'cpu_instance_init' implementation that is going to be invoked during the common riscv_cpu_post_init() (via accel_cpu_instance_init()). This instance_init will execute KVM exclusive code that TCG doesn't care about, such as adding KVM specific proper

[PATCH 07/20] target/riscv/cpu.c: add .instance_post_init()

2023-08-25 Thread Daniel Henrique Barboza
All generic CPUs call riscv_cpu_add_user_properties(). The 'max' CPU calls riscv_init_max_cpu_extensions(). Both can be moved to a common instance_post_init() callback, implemented in riscv_cpu_post_init(), called by all CPUs. The call order then becomes: riscv_cpu_init() -> cpu_init() of each CPU

[PATCH 15/20] target/riscv/tcg: introduce tcg_cpu_instance_init()

2023-08-25 Thread Daniel Henrique Barboza
tcg_cpu_instance_init() will be the 'cpu_instance_init' impl for the TCG accelerator. It'll be called from within riscv_cpu_post_init(), via accel_cpu_instance_init(), similar to what happens with KVM. In fact, to preserve behavior, the implementation will be similar to what riscv_cpu_post_init() a

[PATCH 05/20] target/riscv/cpu.c: add 'user_extension_properties' class prop

2023-08-25 Thread Daniel Henrique Barboza
We want to use a post_init hook to call the cpu_instance_init callback from each accelerator, moving repetitive code from the cpu_init() functions to be handled by the accelerator class. But first we need to ensure that we don't change behavior - vendor CPUs shouldn't expose user properties, generi

[PATCH 08/20] target/riscv: move 'host' CPU declaration to kvm.c

2023-08-25 Thread Daniel Henrique Barboza
This CPU only exists if we're compiling with KVM so move it to the kvm specific file. While we're at it, change its class_init() to enable the user_extensions_flag class property, sparing us from having to execute riscv_cpu_add_user_properties() by hand and letting the post_init() hook do the work.

[PATCH 17/20] target/riscv/cpu.c: export isa_edata_arr[]

2023-08-25 Thread Daniel Henrique Barboza
This array will be read by the TCG accel class, allowing it to handle priv spec verifications on its own. The array will remain here in cpu.c because it's also used by the riscv,isa string function. To export it we'll make it constant and finish it with an empty element since ARRAY_SIZE() won't wo

[PATCH v2 01/16] vhost: Rework memslot filtering and fix "used_memslot" tracking

2023-08-25 Thread David Hildenbrand
Having multiple vhost devices, some filtering out fd-less memslots and some not, can mess up the "used_memslot" accounting. Consequently our "free memslot" checks become unreliable and we might run out of free memslots at runtime later. An example sequence which can trigger a potential issue that

[PATCH v2 08/16] memory-device: Track required and actually used memslots in DeviceMemoryState

2023-08-25 Thread David Hildenbrand
Let's track how many memslots are required by plugged memory devices and how many are currently actually getting used by plugged memory devices. "required - used" is the number of reserved memslots. For now, the number of used and required memslots is always equal, and there are no reservations. T

[PATCH v2 15/16] memory, vhost: Allow for marking memory device memory regions unmergeable

2023-08-25 Thread David Hildenbrand
Let's allow for marking memory regions unmergeable, to teach flatview code and vhost to not merge adjacent aliases to the same memory region into a larger memory section; instead, we want separate aliases to stay separate such that we can atomically map/unmap aliases without affecting other aliases

[PATCH v2 00/16] virtio-mem: Expose device memory through multiple memslots

2023-08-25 Thread David Hildenbrand
Quoting from patch #14: Having large virtio-mem devices that only expose little memory to a VM is currently a problem: we map the whole sparse memory region into the guest using a single memslot, resulting in one gigantic memslot in KVM. KVM allocates metadata for the whole memslot

[PATCH v2 13/16] memory: Clarify mapping requirements for RamDiscardManager

2023-08-25 Thread David Hildenbrand
We really only care about the RAM memory region not being mapped into an address space yet as long as we're still setting up the RamDiscardManager. Once mapped into an address space, memory notifiers would get notified about such a region and any attempts to modify the RamDiscardManager would be wr

[PATCH v2 02/16] vhost: Remove vhost_backend_can_merge() callback

2023-08-25 Thread David Hildenbrand
Checking whether the memory regions are equal is sufficient: if they are equal, then most certainly the contained fd is equal. The whole vhost-user memslot handling is suboptimal and overly complicated. We shouldn't have to lookup a RAM memory regions we got notified about in vhost_user_get_mr_dat

[PATCH v2 07/16] stubs: Rename qmp_memory_device.c to memory_device.c

2023-08-25 Thread David Hildenbrand
We want to place non-qmp stubs in there, so let's rename it. While at it, put it into the MAINTAINERS file under "Memory devices". Signed-off-by: David Hildenbrand --- MAINTAINERS| 1 + stubs/{qmp_memory_device.c => memory_device.c} | 0 stubs/meson.build

[PATCH v2 04/16] kvm: Return number of free memslots

2023-08-25 Thread David Hildenbrand
Let's return the number of free slots instead of only checking if there is a free slot. While at it, check all address spaces, which will also consider SMM under x86 correctly. Make the stub return UINT_MAX, such that we can call the function unconditionally. This is a preparation for memory devi

[PATCH v2 05/16] vhost: Return number of free memslots

2023-08-25 Thread David Hildenbrand
Let's return the number of free slots instead of only checking if there is a free slot. Required to support memory devices that consume multiple memslots. This is a preparation for memory devices that consume multiple memslots. Signed-off-by: David Hildenbrand --- hw/mem/memory-device.c| 2

[PATCH v2 14/16] virtio-mem: Expose device memory via multiple memslots if enabled

2023-08-25 Thread David Hildenbrand
Having large virtio-mem devices that only expose little memory to a VM is currently a problem: we map the whole sparse memory region into the guest using a single memslot, resulting in one gigantic memslot in KVM. KVM allocates metadata for the whole memslot, which can result in quite some memory w

[PATCH v2 06/16] memory-device: Support memory devices with multiple memslots

2023-08-25 Thread David Hildenbrand
We want to support memory devices that have a memory region container as device memory region that maps multiple RAM memory regions. Let's start by supporting memory devices that statically map multiple RAM memory regions and, thereby, consume multiple memslots. We already have one device that use

[PATCH v2 09/16] memory-device, vhost: Support memory devices that dynamically consume memslots

2023-08-25 Thread David Hildenbrand
We want to support memory devices that have a dynamically managed memory region container as device memory region. This device memory region maps multiple RAM memory subregions (e.g., aliases to the same RAM memory region), whereby these subregions can be (un)mapped on demand. Each RAM subregion w

  1   2   >