Re: [PULL 15/47] include/exec/user: Set ABI_LLONG_ALIGNMENT to 4 for nios2

2023-08-08 Thread Michael Tokarev
15.07.2023 16:52, Richard Henderson wrote: Based on gcc's nios2.h setting BIGGEST_ALIGNMENT to 32 bits. Signed-off-by: Richard Henderson --- include/exec/user/abitypes.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/exec/user/abitypes.h b/include/exec/user/abi

Re: [RFC PATCH] hw/riscv: hart: allow other cpu instance

2023-08-08 Thread Nikita Shubin
Hello Deniel! On Mon, 2023-07-31 at 11:12 -0300, Daniel Henrique Barboza wrote: > > > > > > On 7/27/23 05:05, Nikita Shubin wrote: > > > > From: Nikita Shubin > > > > > > > > Allow using instances derivative from RISCVCPU > > > > > > > > Signed-off-by: Nikita Shubin > > > > --- > > > > Curre

Re: [PATCH] block-migration: Ensure we don't crash during migration cleanup

2023-08-08 Thread Claudio Fontana
added Kevin and Hanna for block, since this seems still untouched? Thanks, Claudio On 7/31/23 22:33, Fabiano Rosas wrote: > We can fail the blk_insert_bs() at init_blk_migration(), leaving the > BlkMigDevState without a dirty_bitmap and BlockDriverState. Account > for the possibly missing elemen

[PATCH for-8.2 0/3] pnv/lpc: Hook up xscoms for LPC

2023-08-08 Thread Joel Stanley
P8 used xscoms for accessing the LPC bus. In P9 the LPC bus was memory mapped, simplifying access, however the xscom registers remained. Some firmwares use this method on P9 and P10, so wire it up in qemu. The third patch is a hack that shows how to test this access method with skiboot. It should

[PATCH for-8.2 2/3] pnv/lpc: Hook up xscom region for P9/P10

2023-08-08 Thread Joel Stanley
>From P9 on the LPC bus is memory mapped. However the xscom access still is possible, so add it too. Signed-off-by: Joel Stanley --- include/hw/ppc/pnv_xscom.h | 6 ++ hw/ppc/pnv.c | 4 hw/ppc/pnv_lpc.c | 6 ++ 3 files changed, 16 insertions(+) diff --git a/

[PATCH for-8.2 1/3] pnv/lpc: Place mmio regs in their own memory region

2023-08-08 Thread Joel Stanley
The P9 and P10 models re-used the xscom_regs memory region for the mmio access, which is confusing. Add a separate memory region in preparation for enabling both xscom and mmio access. Signed-off-by: Joel Stanley --- include/hw/ppc/pnv_lpc.h | 3 ++- hw/ppc/pnv.c | 4 ++-- hw/ppc/pn

[PATCH for-8.2 3/3] HACK: pnv/lpc: Set up XSCOM dt for P9

2023-08-08 Thread Joel Stanley
To test qemu's model of the xscom interface, apply this patch to qemu and the following change to skiboot: --- a/hw/lpc.c +++ b/hw/lpc.c @@ -1266,7 +1266,7 @@ static void lpc_init_chip_p9(struct dt_node *opb_node) lpc = zalloc(sizeof(struct lpcm)); assert(lpc);

Re: [PATCH v2 00/12] tests: enable meson test timeouts to improve debuggability

2023-08-08 Thread Alex Bennée
Daniel P. Berrangé writes: > Perhaps the most painful of all the GitLab CI failures we see are > the enforced job timeouts: > >"ERROR: Job failed: execution took longer than 1h15m0s seconds" > >https://gitlab.com/qemu-project/qemu/-/jobs/4387047648 > > when that hits the CI log shows wh

[PATCH v3] target/riscv: don't read CSR in riscv_csrrw_do64

2023-08-08 Thread Nikita Shubin
From: Nikita Shubin As per ISA: "For CSRRWI, if rd=x0, then the instruction shall not read the CSR and shall not cause any of the side effects that might occur on a CSR read." trans_csrrwi() and trans_csrrw() call do_csrw() if rd=x0, do_csrw() calls riscv_csrrw_do64(), via helper_csrw() passing

Re: [PATCH for-8.1 v10 01/14] linux-user: Adjust task_unmapped_base for reserved_va

2023-08-08 Thread Alex Bennée
Richard Henderson writes: > Ensure that the chosen values for mmap_next_start and > task_unmapped_base are within the guest address space. > > Tested-by: Helge Deller > Reviewed-by: Akihiko Odaki > Signed-off-by: Richard Henderson > --- > linux-user/user-mmap.h | 18 +- > li

Re: [PATCH for-8.1 v10 02/14] linux-user: Define TASK_UNMAPPED_BASE in $guest/target_mman.h

2023-08-08 Thread Alex Bennée
Richard Henderson writes: > Provide default values that are as close as possible to the > values used by the guest's kernel. > > Tested-by: Helge Deller > Reviewed-by: Helge Deller > Reviewed-by: Akihiko Odaki > Signed-off-by: Richard Henderson Reviewed-by: Alex Bennée -- Alex Bennée Vi

[PATCH] linux-user/riscv: Use abi_ulong for target_ucontext

2023-08-08 Thread LIU Zhiwei
We should not use types dependend on host arch for target_ucontext. This bug is found when run rv32 applications. Signed-off-by: LIU Zhiwei --- linux-user/riscv/signal.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/linux-user/riscv/signal.c b/linux-user/riscv/signal.c

Re: [PATCH for-8.1 v10 04/14] linux-user: Use MAP_FIXED_NOREPLACE for initial image mmap

2023-08-08 Thread Alex Bennée
Richard Henderson writes: > Use this as extra protection for the guest mapping over > any qemu host mappings. > > Tested-by: Helge Deller > Reviewed-by: Helge Deller > Reviewed-by: Akihiko Odaki > Signed-off-by: Richard Henderson > --- > linux-user/elfload.c | 9 ++--- > 1 file changed

Re: [PATCH for-8.1 v10 05/14] linux-user: Use elf_et_dyn_base for ET_DYN with interpreter

2023-08-08 Thread Alex Bennée
Richard Henderson writes: > Follow the lead of the linux kernel in fs/binfmt_elf.c, > in which an ET_DYN executable which uses an interpreter > (usually a PIE executable) is loaded away from where the > interpreter itself will be loaded. > > Tested-by: Helge Deller > Reviewed-by: Helge Deller

Re: [PATCH] target/loongarch: Split fcc register to fcc0-7 in gdbstub

2023-08-08 Thread Jiajie Chen
On 2023/8/8 14:10, bibo mao wrote: I am not familiar with gdb, is there abi breakage? I do not know how gdb client works with gdb server with different versions. Not abi breakage, but gdb will complain: warning: while parsing target description (at line 1): Target description specified unk

Re: [PATCH RFC 1/1] tcg: Always pass the full write size to notdirty_write()

2023-08-08 Thread Ilya Leoshkevich
On Mon, 2023-08-07 at 11:21 -0700, Richard Henderson wrote: > On 8/7/23 06:56, Ilya Leoshkevich wrote: > > One of notdirty_write()'s responsibilities is detecting self- > > modifying > > code. Some functions pass the full size of a write to it, some pass > > 1. > > When a write to a code section be

Re: [PATCH 1/2] target/s390x: Use a 16-bit immediate in VREP

2023-08-08 Thread Ilya Leoshkevich
On Mon, 2023-08-07 at 20:27 +0300, Michael Tokarev wrote: > > On 07.08.23 19:02, Ilya Leoshkevich wrote: > ..>> None that I know of, but I thought this was still nice to have, > and at > > > the same time small enough to not cause any trouble. > > Ilya, do you have an idea why your messages don't

Re: [PATCH] target/loongarch: Split fcc register to fcc0-7 in gdbstub

2023-08-08 Thread Jiajie Chen
On 2023/8/8 17:55, Jiajie Chen wrote: On 2023/8/8 14:10, bibo mao wrote: I am not familiar with gdb, is there  abi breakage? I do not know how gdb client works with gdb server with different versions. There seemed no versioning in the process, but rather in-code xml validation. In gdb, the

Re: [PATCH for-8.1 v10 06/14] linux-user: Adjust initial brk when interpreter is close to executable

2023-08-08 Thread Alex Bennée
Richard Henderson writes: > From: Helge Deller > > While we attempt to load a ET_DYN executable far away from > TASK_UNMAPPED_BASE, we are not completely in control of the > address space layout. If the interpreter lands close to > the executable, leaving insufficient heap space, move brk. >

Re: [PATCH for-8.1 v10 07/14] linux-user: Do not adjust image mapping for host page size

2023-08-08 Thread Alex Bennée
Richard Henderson writes: > Remove TARGET_ELF_EXEC_PAGESIZE, and 3 other TARGET_ELF_PAGE* macros > based off of that. Rely on target_mmap to handle guest vs host page > size mismatch. > > Tested-by: Helge Deller > Reviewed-by: Helge Deller > Reviewed-by: Akihiko Odaki > Signed-off-by: Richa

Re: [RFC PATCH] hw/riscv: hart: allow other cpu instance

2023-08-08 Thread Daniel Henrique Barboza
On 8/8/23 04:56, Nikita Shubin wrote: Hello Deniel! On Mon, 2023-07-31 at 11:12 -0300, Daniel Henrique Barboza wrote: On 7/27/23 05:05, Nikita Shubin wrote: From: Nikita Shubin Allow using instances derivative from RISCVCPU Signed-off-by: Nikita Shubin --- Currently it is not possible

Re: [PATCH] linux-user/riscv: Use abi_ulong for target_ucontext

2023-08-08 Thread Daniel Henrique Barboza
On 8/8/23 06:34, LIU Zhiwei wrote: We should not use types dependend on host arch for target_ucontext. This bug is found when run rv32 applications. Signed-off-by: LIU Zhiwei --- Reviewed-by: Daniel Henrique Barboza linux-user/riscv/signal.c | 4 ++-- 1 file changed, 2 insertions(+)

Re: [PATCH for-8.1 v10 08/14] linux-user: Do not adjust zero_bss for host page size

2023-08-08 Thread Alex Bennée
Richard Henderson writes: > Rely on target_mmap to handle guest vs host page size mismatch. > > Tested-by: Helge Deller > Reviewed-by: Helge Deller > Reviewed-by: Akihiko Odaki > Signed-off-by: Richard Henderson > --- > linux-user/elfload.c | 54 +++-

Re: [PATCH] target/loongarch: Split fcc register to fcc0-7 in gdbstub

2023-08-08 Thread bibo mao
I think that it is problem of loongarch gdb, rather qemu. If so, everytime when gdb changes register layout, qemu need modify. There should be compatible requirements between gdb client and gdb server. Tiezhu, what is your opition? Regards Bibo Mao 在 2023/8/8 18:03, Jiajie Chen 写道: > > On 2023

Re: [PATCH for-8.1 v10 09/14] linux-user: Use zero_bss for PT_LOAD with no file contents too

2023-08-08 Thread Alex Bennée
Richard Henderson writes: > If p_filesz == 0, then vaddr_ef == vaddr. We can reuse the > code in zero_bss rather than incompletely duplicating it in > load_elf_image. > > Tested-by: Helge Deller > Reviewed-by: Helge Deller > Reviewed-by: Akihiko Odaki > Signed-off-by: Richard Henderson Re

Re: [PATCH for-8.1 v10 11/14] linux-user: Remove duplicate CPU_LOG_PAGE from probe_guest_base

2023-08-08 Thread Alex Bennée
Richard Henderson writes: > The proper logging for probe_guest_base is in the main function. > There is no need to duplicate that in the subroutines. > > Signed-off-by: Richard Henderson Reviewed-by: Alex Bennée -- Alex Bennée Virtualisation Tech Lead @ Linaro

Re: [PATCH for-8.1 v10 12/14] linux-user: Consolidate guest bounds check in probe_guest_base

2023-08-08 Thread Alex Bennée
Richard Henderson writes: > The three sets of checks are identical, logically. > > Signed-off-by: Richard Henderson Reviewed-by: Alex Bennée -- Alex Bennée Virtualisation Tech Lead @ Linaro

Re: [PATCH v3 00/17] Support smp.clusters for x86

2023-08-08 Thread Jonathan Cameron via
On Fri, 4 Aug 2023 21:17:59 +0800 Zhao Liu wrote: > Hi Jonathan, > > On Tue, Aug 01, 2023 at 04:35:27PM +0100, Jonathan Cameron via wrote: > > > > > [snip] > > > > > > > ## New property: x-l2-cache-topo > > > > > > The property l2-cache-topo will be used to change the L2 cache topology >

[PATCH for-8.1] linux-user: Define real MAP_FIXED_NOREPLACE value

2023-08-08 Thread Akihiko Odaki
do_brk() assumes target_mmap() emulates MAP_FIXED_NOREPLACE even when the host does not support it. However, such emulation is not possible if MAP_FIXED_NOREPLACE is defined as zero. Define MAP_FIXED_NOREPLACE with the real value instead of zero if it is not defined. Fixes: e69e032d1a ("linux-use

[RFC PATCH 0/5] hw/arm: MPAM Emulation + PPTT cache description.

2023-08-08 Thread Jonathan Cameron via
Aim of this bit of emulation is to use it for testing James Morse's kernel tree - in particularly letting us poke the corner cases. Right now I'm not that focused on upstreaming this (too many other things in my backlog), but any feedback on the approach etc welcome and perhaps the PPTT part is use

[RFC PATCH 1/5] hw/acpi: Add PPTT cache descriptions

2023-08-08 Thread Jonathan Cameron via
Current PPTT tables generated by QEMU only provide information on CPU topology and neglect the description of Caches. This patch adds flexible definition of those caches and updates the table version to 3 to allow for the per CPU cache instance IDs needed for cross references from the MPAM table.

Re: [PATCH for-8.1 v10 04/14] linux-user: Use MAP_FIXED_NOREPLACE for initial image mmap

2023-08-08 Thread Akihiko Odaki
On 2023/08/08 18:43, Alex Bennée wrote: Richard Henderson writes: Use this as extra protection for the guest mapping over any qemu host mappings. Tested-by: Helge Deller Reviewed-by: Helge Deller Reviewed-by: Akihiko Odaki Signed-off-by: Richard Henderson --- linux-user/elfload.c | 9 +

[RFC PATCH 2/5] HACK: target/arm/tcg: Add some more caches to cpu=max

2023-08-08 Thread Jonathan Cameron via
Used to drive the MPAM cache intialization and to exercise more of the PPTT cache entry generation code. Perhaps a default L3 cache is acceptable for max? Signed-off-by: Jonathan Cameron --- target/arm/tcg/cpu64.c | 12 1 file changed, 12 insertions(+) diff --git a/target/arm/tcg/c

[RFC PATCH 3/5] target/arm: Add support for MPAM CPU registers

2023-08-08 Thread Jonathan Cameron via
It is common to support MPAM on CPU cores, but not in the rest of the system, so there is little disadvantage in always enabling these. Signed-off-by: Jonathan Cameron --- target/arm/cpu.h| 15 +++ target/arm/cpu.c| 10 +- target/arm/helper.c | 30

[RFC PATCH 4/5] hw/arm: Add MPAM emulation.

2023-08-08 Thread Jonathan Cameron via
Note this doesn't 'do' anything other than provide an introspection interface. The intent here is to support work on the Linux kernel support and for that a functional emulation of the interface is useful. Signed-off-by: Jonathan Cameron --- qapi/mpam.json | 78 qapi/qapi-schema

[RFC PATCH 5/5] hw/arm/virt: Add MPAM MSCs for memory controllers and caches.

2023-08-08 Thread Jonathan Cameron via
Allow sharing of MSC instances (using RIS) for memory controllers. Currently cached controllers are not using RIS (tend to be more in a system so more clever logic needed to auto allocate them). No DT support yet. The kernel bindings are considered unstable so premature to add too much on that fr

[PATCH v2 0/3] linux-user, configure: fix CPU canonicalization

2023-08-08 Thread Paolo Bonzini
The CPU model has to be canonicalized to what Meson wants in the cross file, to what Linux uses for its asm-$ARCH directories, and to what QEMU uses for its user-mode emulation host/$ARCH directories. Do all three in a single case statement, and check that the Linux and QEMU directories actually e

[PATCH v2 1/3] configure: fix detection for x32 linux-user

2023-08-08 Thread Paolo Bonzini
x32 uses the same signal handling fragments as x86_64, since host_arch is set to x86_64 when Meson runs. Remove the unnecessary forwarder and set the host_arch variable properly in configure. Reviewed-by: Richard Henderson Signed-off-by: Paolo Bonzini --- configure

[PATCH v2 3/3] configure: unify case statements for CPU canonicalization

2023-08-08 Thread Paolo Bonzini
The CPU model has to be canonicalized to what Meson wants in the cross file, to what Linux uses for its asm-$ARCH directories, and to what QEMU uses for its user-mode emulation host/$ARCH directories. Do all three in a single case statement, and check that the Linux and QEMU directories actually e

[PATCH v2 2/3] linux-user: cleanup unused linux-user/include/host directories

2023-08-08 Thread Paolo Bonzini
Alpha and 31-bit s390 lack the assembly fragment to handle signals occurring at the same time as system calls, so they cannot run linux-user emulation anymore. Drop the host-signal.h files for them. Signed-off-by: Paolo Bonzini --- linux-user/include/host/alpha/host-signal.h | 55 lin

Re: [PATCH 3/8] Introduced a new function to disconnect GPIO connections

2023-08-08 Thread lixianglai
Hi,Peter Maydell : On 7/28/23 8:38 PM, Peter Maydell wrote: On Thu, 20 Jul 2023 at 08:16, xianglai li wrote: It introduces a new function to unwire the vcpu<->exioi interrupts for the vcpu hot-(un)plug cases. Cc: Xiaojuan Yang Cc: Song Gao Cc: "Michael S. Tsirkin" Cc: Igor Mammedov Cc: A

Re: [PATCH 6/8] Add support of *unrealize* for loongarch cpu

2023-08-08 Thread lixianglai
Hi Igor Mammedov: On 7/28/23 9:23 PM, Igor Mammedov wrote: On Thu, 20 Jul 2023 15:15:11 +0800 xianglai li wrote: 1.Add the Unrealize function to the Loongarch CPU for cpu hot-(un)plug 2.Add CPU topology-related properties to the Loongarch CPU for cpu hot-(un)plug Cc: Xiaojuan Yang Cc: Song

Re: [PATCH 7/8] Update the ACPI table for the Loongarch CPU

2023-08-08 Thread lixianglai
Hi Igor Mammedov: On 7/28/23 9:26 PM, Igor Mammedov wrote: On Thu, 20 Jul 2023 15:15:12 +0800 xianglai li wrote: 1.Create a new GED device type for Loongarch, mount cpu_madt function to update the ACPI table madt changes should be its own patch Okay, I'll put the Madt-related changes int

Re: [PATCH 8/8] Turn on CPU hot-(un)plug customization for loongarch

2023-08-08 Thread lixianglai
Hi, Igor Mammedov: On 7/28/23 9:30 PM, Igor Mammedov wrote: On Thu, 20 Jul 2023 15:15:13 +0800 xianglai li wrote: Turn on CPU hot-(un)plug custom for loongarch in the configuration file Cc: Xiaojuan Yang Cc: Song Gao Cc: "Michael S. Tsirkin" Cc: Igor Mammedov Cc: Ani Sinha Cc: Paolo Bo

Re: [PATCH v2 2/3] linux-user: cleanup unused linux-user/include/host directories

2023-08-08 Thread Michael Tokarev
08.08.2023 15:03, Paolo Bonzini wrote: Alpha and 31-bit s390 lack the assembly fragment to handle signals occurring at the same time as system calls, so they cannot run linux-user emulation anymore. Drop the host-signal.h files for them. Signed-off-by: Paolo Bonzini --- linux-user/include/ho

Re: [PATCH v2 1/3] configure: fix detection for x32 linux-user

2023-08-08 Thread Michael Tokarev
08.08.2023 15:03, Paolo Bonzini wrote: x32 uses the same signal handling fragments as x86_64, since host_arch is set to x86_64 when Meson runs. Remove the unnecessary forwarder and set the host_arch variable properly in configure. Reviewed-by: Michael Tokarev /mjt

Re: [PATCH v2 3/3] configure: unify case statements for CPU canonicalization

2023-08-08 Thread Michael Tokarev
08.08.2023 15:03, Paolo Bonzini wrote: The CPU model has to be canonicalized to what Meson wants in the cross file, to what Linux uses for its asm-$ARCH directories, and to what QEMU uses for its user-mode emulation host/$ARCH directories. Do all three in a single case statement, and check that

Re: [PATCH for-8.2 v3 1/6] vfio/migration: Move from STOP_COPY to STOP in vfio_save_cleanup()

2023-08-08 Thread Jason Gunthorpe
On Tue, Aug 08, 2023 at 09:23:09AM +0300, Avihai Horon wrote: > > On 07/08/2023 18:53, Cédric Le Goater wrote: > > External email: Use caution opening links or attachments > > > > > > [ Adding Juan and Peter for their awareness ] > > > > On 8/2/23 10:14, Avihai Horon wrote: > > > Changing the d

Re: [PATCH v2 0/3] linux-user, configure: fix CPU canonicalization

2023-08-08 Thread Michael Tokarev
08.08.2023 15:03, Paolo Bonzini wrote: The CPU model has to be canonicalized to what Meson wants in the cross file, to what Linux uses for its asm-$ARCH directories, and to what QEMU uses for its user-mode emulation host/$ARCH directories. Do all three in a single case statement, and check that

Re: [PATCH v2 0/3] linux-user, configure: fix CPU canonicalization

2023-08-08 Thread Ilya Leoshkevich
On Tue, 2023-08-08 at 14:03 +0200, Paolo Bonzini wrote: > The CPU model has to be canonicalized to what Meson wants in the > cross > file, to what Linux uses for its asm-$ARCH directories, and to what > QEMU uses for its user-mode emulation host/$ARCH directories.  Do > all three in a single case s

[PULL v2] hw/nvme fixes

2023-08-08 Thread Klaus Jensen
From: Klaus Jensen Hi, There was a small typo in the last pull. This replaces it. The following changes since commit 0450cf08976f9036feaded438031b4cba94f6452: Merge tag 'fixes-pull-request' of https://gitlab.com/marcandre.lureau/qemu into staging (2023-08-07 13:55:00 -0700) are available i

[PATCH] Add support of callbacks after instructions to plugin api

2023-08-08 Thread Mikhail Tyutin
Initially, we can only call the callback BEFORE instructions. This commit adds the ability to insert the callback AFTER instructions. No callback call for control-flow instructions. Signed-off-by: Aleksandr Anenkov Signed-off-by: Mikhail Tyutin --- accel/tcg/plugin-gen.c | 25 ++

Re: [PATCH for-8.1 v10 04/14] linux-user: Use MAP_FIXED_NOREPLACE for initial image mmap

2023-08-08 Thread Alex Bennée
Akihiko Odaki writes: > On 2023/08/08 18:43, Alex Bennée wrote: >> Richard Henderson writes: >> >>> Use this as extra protection for the guest mapping over >>> any qemu host mappings. >>> >>> Tested-by: Helge Deller >>> Reviewed-by: Helge Deller >>> Reviewed-by: Akihiko Odaki >>> Signed-of

Re: [PATCH for-8.1 v10 04/14] linux-user: Use MAP_FIXED_NOREPLACE for initial image mmap

2023-08-08 Thread Akihiko Odaki
On 2023/08/08 22:48, Alex Bennée wrote: Akihiko Odaki writes: On 2023/08/08 18:43, Alex Bennée wrote: Richard Henderson writes: Use this as extra protection for the guest mapping over any qemu host mappings. Tested-by: Helge Deller Reviewed-by: Helge Deller Reviewed-by: Akihiko Odaki

[RFC v4 00/11] Native Library Calls

2023-08-08 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 v4 02/11] build: Implement libnative library and the build machinery for libnative

2023-08-08 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 v4 08/11] target/mips: Add support for native library calls

2023-08-08 Thread Yeqi Fu
This commit introduces support for native library calls on the mips target. When special instructions reserved for native calls are encountered, the code now performs address translation and generates the corresponding native call. Signed-off-by: Yeqi Fu --- configs/targets/mips-linux-user.mak

[RFC v4 06/11] tcg: Add tcg opcodes and helpers for native library calls

2023-08-08 Thread Yeqi Fu
This commit implements tcg opcodes and helpers for extracting and invoke native functions. Signed-off-by: Yeqi Fu --- accel/tcg/tcg-runtime.h | 22 ++ include/tcg/tcg-op-common.h | 11 +++ include/tcg/tcg.h | 9 +++ tcg/tcg-op.c| 140

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

2023-08-08 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| 71 - 4 files changed, 169 insertions(+), 10 deletions(-) create mod

[RFC v4 07/11] target/i386: Add support for native library calls

2023-08-08 Thread Yeqi Fu
This commit introduces support for native library calls on the i386 target. When special instructions reserved for native calls are encountered, the code now performs address translation and generates the corresponding native call. Signed-off-by: Yeqi Fu --- configs/targets/i386-linux-user.mak

[RFC v4 11/11] docs/user: Add doc for native library calls

2023-08-08 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 v4 05/11] linux-user/elfload: Add support for parsing symbols of native libraries.

2023-08-08 Thread Yeqi Fu
This commit addresses the need to parse symbols of native libraries. The base address of a shared library is determined by the dynamic linker. To simplify the process, we focus on the last three digits, which reside within the same page and remain unaffected by the base address. Signed-off-by: Yeq

[RFC v4 04/11] linux-user: Implement native-bypass option support

2023-08-08 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 v4 10/11] tests/tcg/multiarch: Add nativecall.c test

2023-08-08 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

[RFC v4 09/11] target/arm: Add support for native library calls

2023-08-08 Thread Yeqi Fu
This commit introduces support for native library calls on the arm target. When special instructions reserved for native calls are encountered, the code now performs address translation and generates the corresponding native call. Signed-off-by: Yeqi Fu --- configs/targets/aarch64-linux-user.mak

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

2023-08-08 Thread Yeqi Fu
Signed-off-by: Yeqi Fu --- configure | 57 +-- 1 file changed, 34 insertions(+), 23 deletions(-) diff --git a/configure b/configure index 2b41c49c0d..a076583141 100755 --- a/configure +++ b/configure @@ -1751,56 +1751,67 @@ if test "$ccache_cpp

Re: [PATCH RFC 1/1] tcg: Always pass the full write size to notdirty_write()

2023-08-08 Thread Richard Henderson
On 8/8/23 02:59, Ilya Leoshkevich wrote: On Mon, 2023-08-07 at 11:21 -0700, Richard Henderson wrote: IIRC there are some uses of probe_access_* that set size == 0. Should we adjust addr+size to cover the whole page for that case? That seems to be the intent, anyway. There is a comment that say

Re: [PATCH] linux-user/riscv: Use abi_ulong for target_ucontext

2023-08-08 Thread Richard Henderson
On 8/8/23 02:34, LIU Zhiwei wrote: We should not use types dependend on host arch for target_ucontext. This bug is found when run rv32 applications. Signed-off-by: LIU Zhiwei --- linux-user/riscv/signal.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) Reviewed-by: Richard Henders

Re: [PATCH for-8.1] linux-user: Define real MAP_FIXED_NOREPLACE value

2023-08-08 Thread Richard Henderson
On 8/8/23 04:52, Akihiko Odaki wrote: do_brk() assumes target_mmap() emulates MAP_FIXED_NOREPLACE even when the host does not support it. However, such emulation is not possible if MAP_FIXED_NOREPLACE is defined as zero. Define MAP_FIXED_NOREPLACE with the real value instead of zero if it is not

Re: [PATCH v3] hw/cxl: Fix CFMW config memory leak

2023-08-08 Thread Jonathan Cameron via
On Sat, 5 Aug 2023 08:46:29 +0300 Michael Tokarev wrote: > 31.05.2023 14:08, Jonathan Cameron via wrote: > > On Wed, 31 May 2023 09:51:43 +0200 > > Philippe Mathieu-Daudé wrote: > > > >> On 31/5/23 08:07, Li Zhijian wrote: > >>> Allocate targets and targets[n] resources when all sanity chec

Re: [PATCH] Add support of callbacks after instructions to plugin api

2023-08-08 Thread Richard Henderson
On 8/8/23 06:44, Mikhail Tyutin wrote: Initially, we can only call the callback BEFORE instructions. This commit adds the ability to insert the callback AFTER instructions. No callback call for control-flow instructions. You're going to miss whole categories of instructions, not just control-

[PATCH] vfio/pci: hide ROM BAR on SFC9220 10/40G Ethernet Controller PF

2023-08-08 Thread Laszlo Ersek
The Solarflare Communications SFC9220 NIC's physical function (PF) appears to expose an expansion ROM with the following characteristics: (1) Single-image ROM, with only a legacy BIOS image (no UEFI driver). Alex's rom-parser utility dumps it like this: > Valid ROM signature found @0h, PCIR offse

[PATCH for-8.1 v2] linux-user: Define real MAP_FIXED_NOREPLACE value

2023-08-08 Thread Akihiko Odaki
do_brk() assumes target_mmap() emulates MAP_FIXED_NOREPLACE even when the host does not support it. However, such emulation is not possible if MAP_FIXED_NOREPLACE is defined as zero. Define MAP_FIXED_NOREPLACE with the real value instead of zero if it is not defined. Fixes: e69e032d1a ("linux-use

Re: [PATCH for-8.1 v10 04/14] linux-user: Use MAP_FIXED_NOREPLACE for initial image mmap

2023-08-08 Thread Alex Bennée
Akihiko Odaki writes: > On 2023/08/08 22:48, Alex Bennée wrote: >> Akihiko Odaki writes: >> >>> On 2023/08/08 18:43, Alex Bennée wrote: Richard Henderson writes: > Use this as extra protection for the guest mapping over > any qemu host mappings. > > Tested-by: Helge

[PATCH 1/2] hw/nvme: fix null pointer access in directive receive

2023-08-08 Thread Klaus Jensen
From: Klaus Jensen nvme_directive_receive() does not check if an endurance group has been configured (set) prior to testing if flexible data placement is enabled or not. Fix this. Cc: qemu-sta...@nongnu.org Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1815 Fixes: 73064edfb864 ("hw/nv

[PATCH 2/2] hw/nvme: fix null pointer access in ruh update

2023-08-08 Thread Klaus Jensen
From: Klaus Jensen The Reclaim Unit Update operation in I/O Management Receive does not verify the presence of a configured endurance group prior to accessing it. Fix this. Cc: qemu-sta...@nongnu.org Fixes: 73064edfb864 ("hw/nvme: flexible data placement emulation") Signed-off-by: Klaus Jensen

[PATCH 0/2] hw/nvme: two fixes

2023-08-08 Thread Klaus Jensen
From: Klaus Jensen Fix two potential accesses to null pointers. Klaus Jensen (2): hw/nvme: fix null pointer access in directive receive hw/nvme: fix null pointer access in ruh update hw/nvme/ctrl.c | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) -- 2.41.0

Re: [PATCH] Add support of callbacks after instructions to plugin api

2023-08-08 Thread Alex Bennée
Mikhail Tyutin writes: > Initially, we can only call the callback BEFORE instructions. This > commit adds the ability to insert the callback AFTER instructions. What is the use case for this? Because: > > + > +/* Stop translation if translate_insn so indicated. */ > +if (d

Re: [PATCH for-8.1] linux-user: Define real MAP_FIXED_NOREPLACE value

2023-08-08 Thread Akihiko Odaki
On 2023/08/08 23:42, Richard Henderson wrote: On 8/8/23 04:52, Akihiko Odaki wrote: do_brk() assumes target_mmap() emulates MAP_FIXED_NOREPLACE even when the host does not support it. However, such emulation is not possible if MAP_FIXED_NOREPLACE is defined as zero. Define MAP_FIXED_NOREPLACE w

Re: [PATCH for-8.1 v10 01/14] linux-user: Adjust task_unmapped_base for reserved_va

2023-08-08 Thread Richard Henderson
On 8/8/23 02:10, Alex Bennée wrote: One thing I'm slightly confused by is the ELF_ET_DYN_BASE can be above this (or sometimes the same). Should the mapping of ELF segments be handled with mmap_next_start? I assume once mmap_next_start meets the mappings for the ELF segments we skip over until we

[PATCH] util: Delete a check for IA-64

2023-08-08 Thread Akihiko Odaki
HOST_IA64 will never be defined since IA-64 host is no longer supported. Signed-off-by: Akihiko Odaki --- util/oslib-posix.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/util/oslib-posix.c b/util/oslib-posix.c index 760390b31e..f7adb36dfb 100644 --- a/util/oslib-posix.

[PATCH] thunk: Delete checks for old host definitions

2023-08-08 Thread Akihiko Odaki
Alpha, IA-64, and PA-RISC hosts are no longer supported. Signed-off-by: Akihiko Odaki --- include/exec/user/thunk.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/include/exec/user/thunk.h b/include/exec/user/thunk.h index 300a840d58..d9c131ec80 100644 --- a/include/exec/u

Re: [PATCH] util: Delete a check for IA-64

2023-08-08 Thread Peter Maydell
On Tue, 8 Aug 2023 at 16:21, Akihiko Odaki wrote: > > HOST_IA64 will never be defined since IA-64 host is no longer supported. > > Signed-off-by: Akihiko Odaki > --- > util/oslib-posix.c | 5 + > 1 file changed, 1 insertion(+), 4 deletions(-) > > diff --git a/util/oslib-posix.c b/util/oslib-

Re: [PATCH] thunk: Delete checks for old host definitions

2023-08-08 Thread Peter Maydell
On Tue, 8 Aug 2023 at 16:23, Akihiko Odaki wrote: > > Alpha, IA-64, and PA-RISC hosts are no longer supported. > > Signed-off-by: Akihiko Odaki > --- > include/exec/user/thunk.h | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/include/exec/user/thunk.h b/include/exec/us

Re: [PATCH for-8.1 v10 01/14] linux-user: Adjust task_unmapped_base for reserved_va

2023-08-08 Thread Helge Deller
Hi Richard, On 8/7/23 18:36, Richard Henderson wrote: Ensure that the chosen values for mmap_next_start and task_unmapped_base are within the guest address space. Tested-by: Helge Deller Reviewed-by: Akihiko Odaki Signed-off-by: Richard Henderson I've tested this whole series for quite som

Re: [PATCH] vfio/pci: hide ROM BAR on SFC9220 10/40G Ethernet Controller PF

2023-08-08 Thread Alex Williamson
On Tue, 8 Aug 2023 16:59:16 +0200 Laszlo Ersek wrote: > The Solarflare Communications SFC9220 NIC's physical function (PF) appears > to expose an expansion ROM with the following characteristics: > > (1) Single-image ROM, with only a legacy BIOS image (no UEFI driver). > Alex's rom-parser utili

Re: [PATCH 09/24] target/tricore: Replace gen_cond_w with tcg_gen_negsetcond_tl

2023-08-08 Thread Bastian Koppelmann
On Mon, Aug 07, 2023 at 08:11:28PM -0700, Richard Henderson wrote: > Signed-off-by: Richard Henderson > --- > target/tricore/translate.c | 16 ++-- > 1 file changed, 6 insertions(+), 10 deletions(-) > > diff --git a/target/tricore/translate.c b/target/tricore/translate.c > index 1947

RE: [PATCH] Add support of callbacks after instructions to plugin api

2023-08-08 Thread Mikhail Tyutin
> On 8/8/23 06:44, Mikhail Tyutin wrote: > > Initially, we can only call the callback BEFORE instructions. This commit > > adds the ability to insert the callback AFTER instructions. > > > > No callback call for control-flow instructions. > > You're going to miss whole categories of instructions,

[RFC v1 0/3] Initial support for SPDM

2023-08-08 Thread Alistair Francis
The Security Protocol and Data Model (SPDM) Specification defines messages, data objects, and sequences for performing message exchanges over a variety of transport and physical media. - https://www.dmtf.org/sites/default/files/standards/documents/DSP0274_1.3.0.pdf This series is a very initial

[RFC v1 3/3] hw: nvme: ctrl: Process SPDM requests

2023-08-08 Thread Alistair Francis
Signed-off-by: Alistair Francis --- hw/nvme/ctrl.c | 15 +++ 1 file changed, 15 insertions(+) diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c index ec3d5d3c29..a299dc7175 100644 --- a/hw/nvme/ctrl.c +++ b/hw/nvme/ctrl.c @@ -206,6 +206,11 @@ #include "hw/pci/pcie_sriov.h" #include "mig

[RFC v1 2/3] hw: nvme: ctrl: Initial support for DOE

2023-08-08 Thread Alistair Francis
Signed-off-by: Alistair Francis --- hw/nvme/nvme.h| 4 include/hw/pci/pcie_doe.h | 1 + hw/nvme/ctrl.c| 20 3 files changed, 25 insertions(+) diff --git a/hw/nvme/nvme.h b/hw/nvme/nvme.h index 209e8f5b4c..e0918516e3 100644 --- a/hw/nvme/nvme.h

[RFC v1 1/3] subprojects: libspdm: Initial support

2023-08-08 Thread Alistair Francis
Signed-off-by: Alistair Francis --- meson.build | 78 +++ .gitmodules | 3 ++ meson_options.txt | 3 ++ scripts/meson-buildoptions.sh | 3 ++ subprojects/.gitignore| 1 + subprojects/libspdm.wrap | 5

Re: [PATCH 02/24] tcg: Use tcg_gen_negsetcond_*

2023-08-08 Thread Peter Maydell
On Tue, 8 Aug 2023 at 04:13, Richard Henderson wrote: > > Signed-off-by: Richard Henderson > --- > tcg/tcg-op-gvec.c | 6 ++ > tcg/tcg-op.c | 6 ++ > 2 files changed, 4 insertions(+), 8 deletions(-) > > diff --git a/tcg/tcg-op-gvec.c b/tcg/tcg-op-gvec.c > index a062239804..e260a07c6

Re: [PATCH for-8.1 v10 08/14] linux-user: Do not adjust zero_bss for host page size

2023-08-08 Thread Richard Henderson
On 8/8/23 04:38, Alex Bennée wrote: -if (host_start < host_map_start) { -memset((void *)host_start, 0, host_map_start - host_start); +if (align_bss < end_bss) { +abi_long err = target_mmap(align_bss, end_bss - align_bss, prot, + MAP_FIXED

[PATCH 1/2] block: minimize bs->reqs_lock section in tracked_request_end()

2023-08-08 Thread Stefan Hajnoczi
Signed-off-by: Stefan Hajnoczi --- block/io.c | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/block/io.c b/block/io.c index 055fcf7438..85d5176256 100644 --- a/block/io.c +++ b/block/io.c @@ -593,8 +593,14 @@ static void coroutine_fn tracked_request_end(BdrvTrackedRequ

cpu/i386: update xsave components after CPUID filtering

2023-08-08 Thread Huanyu Zhai
From: NikoZHAI On i386 platform, CPUID data are setup through three consecutive steps: CPU model definition, expansion and filtering. XSAVE components are enabled during the expansion stage, by checking if they are enabled in CPUID. However, it is still probable that some XSAVE features will be

Re: [PATCH 02/24] tcg: Use tcg_gen_negsetcond_*

2023-08-08 Thread Richard Henderson
On 8/8/23 08:55, Peter Maydell wrote: On Tue, 8 Aug 2023 at 04:13, Richard Henderson wrote: Signed-off-by: Richard Henderson --- tcg/tcg-op-gvec.c | 6 ++ tcg/tcg-op.c | 6 ++ 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/tcg/tcg-op-gvec.c b/tcg/tcg-op-gvec.c

[PATCH 0/2] block: change reqs_lock to QemuMutex

2023-08-08 Thread Stefan Hajnoczi
As part of the ongoing multi-queue QEMU block layer work, I found that CoMutex reqs_lock scales poorly when more IOThreads are added. These patches double IOPS in the 4 IOThreads randread benchmark that I have been running with my out-of-tree virtio-blk-iothread-vq-mapping branch (https://gitlab.co

Re: [PATCH for-8.1] linux-user: Define real MAP_FIXED_NOREPLACE value

2023-08-08 Thread Richard Henderson
On 8/8/23 08:16, Akihiko Odaki wrote: Which supported hosts do not define this value?  Can we simply remove the fallback? glibc didn't have this defined until 2.28. The older releases still maintained are 2.26, and 2.27, according to: https://sourceware.org/glibc/wiki/Release Thanks for di

Re: [PATCH for-8.1 v10 13/14] linux-user: Rewrite fixed probe_guest_base

2023-08-08 Thread Alex Bennée
Richard Henderson writes: > Create a set of subroutines to collect a set of guest addresses, > all of which must be mappable on the host. Use this within the > renamed pgb_fixed subroutine to validate the user's choice of > guest_base specified by the -B command-line option. > > Signed-off-by:

  1   2   3   >