Re: [PATCH v2 09/13] vdpa net: block migration if the device has CVQ

2023-02-21 Thread Eugenio Perez Martin
On Wed, Feb 22, 2023 at 5:01 AM Jason Wang wrote: > > > 在 2023/2/8 17:42, Eugenio Pérez 写道: > > Devices with CVQ needs to migrate state beyond vq state. Leaving this > > to future series. > > > I may miss something but what is missed to support CVQ/MQ? > To restore all the device state set by

Re: [PATCH v2 07/13] vdpa: add vdpa net migration state notifier

2023-02-21 Thread Eugenio Perez Martin
On Wed, Feb 22, 2023 at 4:56 AM Jason Wang wrote: > > > 在 2023/2/8 17:42, Eugenio Pérez 写道: > > This allows net to restart the device backend to configure SVQ on it. > > > > Ideally, these changes should not be net specific. However, the vdpa net > > backend is the one with enough knowledge to

Re: [PATCH v3 21/24] gdbstub: only compile gdbstub twice for whole build

2023-02-21 Thread Richard Henderson
On 2/21/23 12:52, Alex Bennée wrote: -# and BSD? -specific_ss.add(when: 'CONFIG_LINUX_USER', if_true: files('user-target.c')) +# The user-target is specialised by the guest +specific_ss.add(when: 'CONFIG_USER_ONLY', if_true: files('user-target.c')) Looks like should be folded to patch 10. r~

Re: [PATCH v3 10/24] gdbstub: move chunks of user code into own files

2023-02-21 Thread Richard Henderson
On 2/21/23 12:52, Alex Bennée wrote: +# and BSD? +specific_ss.add(when: 'CONFIG_LINUX_USER', if_true: files('user-target.c')) Certainly and bsd. It had been compiled before you moved it. r~

Re: [PATCH v3 5/6] meson: prefer 'sphinx-build' to 'sphinx-build-3'

2023-02-21 Thread Markus Armbruster
John Snow writes: > On Tue, Feb 21, 2023, 1:50 AM Markus Armbruster wrote: > >> John Snow writes: >> >> > Once upon a time, "sphinx-build" on certain RPM platforms invoked >> > specifically a Python 2.x version, while "sphinx-build-3" was a distro >> > shim for the Python 3.x version. >> > >>

Re: [PATCH RESEND 04/18] i386/cpu: Fix number of addressable IDs in CPUID.04H

2023-02-21 Thread Zhao Liu
Hi Xiaoyao, Thanks, I've spent some time thinking about it here. On Mon, Feb 20, 2023 at 02:59:20PM +0800, Xiaoyao Li wrote: > Date: Mon, 20 Feb 2023 14:59:20 +0800 > From: Xiaoyao Li > Subject: Re: [PATCH RESEND 04/18] i386/cpu: Fix number of addressable IDs > in CPUID.04H > > On 2/13/2023

Re: [PATCH 3/5] bulk: Replace [g_]assert(0) -> g_assert_not_reached()

2023-02-21 Thread Richard Henderson
On 2/21/23 18:06, Thomas Huth wrote:   int postcopy_wake_shared(struct PostCopyFD *pcfd,    uint64_t client_addr,    RAMBlock *rb)   { -    assert(0); -    return -1; +    g_assert_not_reached();   }   #endif If we ever reconsider to allow

Re: [RFC v5 0/3] migration: reduce time of loading non-iterable vmstate

2023-02-21 Thread Chuang Xu
Hi, Peter On 2023/2/22 上午4:36, Peter Xu wrote: On 2023/2/21 上午11:38, Chuang Xu wrote: I think we need a memory_region_transaction_commit_force() to force commit some transactions when load vmstate. This function is designed like this: /*  * memory_region_transaction_commit_force() is

Re: [PATCH v1 3/6] kvm: Synchronize the backup bitmap in the last stage

2023-02-21 Thread Gavin Shan
On 2/22/23 10:58 AM, Peter Xu wrote: On Wed, Feb 22, 2023 at 10:44:07AM +1100, Gavin Shan wrote: Peter, could you please give some hints for me to understand the atomic and non-atomic update here? Ok, I will drop this part of changes in next revision with the assumption that we have atomic

Re: [PATCH v10 1/9] mm: Introduce memfd_restricted system call to create restricted user memory

2023-02-21 Thread Alexey Kardashevskiy
On 14/1/23 08:54, Sean Christopherson wrote: On Fri, Dec 02, 2022, Chao Peng wrote: The system call is currently wired up for x86 arch. Building on other architectures (except for arm64 for some reason) yields: CALL/.../scripts/checksyscalls.sh :1565:2: warning: #warning syscall

Re: [PATCH v1 5/6] hw/arm/virt: Enable backup bitmap for dirty ring

2023-02-21 Thread Gavin Shan
On 2/22/23 3:27 AM, Peter Maydell wrote: On Mon, 13 Feb 2023 at 00:40, Gavin Shan wrote: When KVM device "kvm-arm-gicv3" or "arm-its-kvm" is used, we have to enable the backup bitmap for the dirty ring. Otherwise, the migration will fail because those two devices are using the backup bitmap

[PATCH] plugin: fix clearing of plugin_mem_cbs before TB exit

2023-02-21 Thread Emilio Cota
Currently we are wrongly accessing plugin_tb->mem_helper at translation time from plugin_gen_disable_mem_helpers, which is called before generating a TB exit, e.g. with exit_tb. Recall that it is only during TB finalisation, i.e. when we go over the TB post-translation to inject or remove plugin

Re: [PATCH v2 13/13] vdpa: return VHOST_F_LOG_ALL in vhost-vdpa devices

2023-02-21 Thread Jason Wang
在 2023/2/8 17:42, Eugenio Pérez 写道: vhost-vdpa devices can return this features now that blockers have been set in case some features are not met. Expose VHOST_F_LOG_ALL only in that case. Signed-off-by: Eugenio Pérez --- Acked-by: Jason Wang Thanks hw/virtio/vhost-vdpa.c | 3 +--

Re: [PATCH 3/5] bulk: Replace [g_]assert(0) -> g_assert_not_reached()

2023-02-21 Thread Thomas Huth
On 22/02/2023 00.25, Philippe Mathieu-Daudé wrote: In order to avoid warnings such commit c0a6665c3c ("target/i386: Remove compilation errors when -Werror=maybe-uninitialized"), replace all assert(0) and g_assert(0) by g_assert_not_reached(). Remove any code following g_assert_not_reached().

Re: [PATCH v2 11/13] vdpa: block migration if dev does not have _F_SUSPEND

2023-02-21 Thread Jason Wang
在 2023/2/8 17:42, Eugenio Pérez 写道: Next patches enable devices to be migrated even if vdpa netdev has not been started with x-svq. However, not all devices are migratable, so we need to block migration if we detect that. Block vhost-vdpa device migration if it does not offer _F_SUSPEND and

Re: [PATCH v2 09/13] vdpa net: block migration if the device has CVQ

2023-02-21 Thread Jason Wang
在 2023/2/8 17:42, Eugenio Pérez 写道: Devices with CVQ needs to migrate state beyond vq state. Leaving this to future series. I may miss something but what is missed to support CVQ/MQ? Thanks Signed-off-by: Eugenio Pérez --- net/vhost-vdpa.c | 6 ++ 1 file changed, 6

Re: [PATCH v2 07/13] vdpa: add vdpa net migration state notifier

2023-02-21 Thread Jason Wang
在 2023/2/8 17:42, Eugenio Pérez 写道: This allows net to restart the device backend to configure SVQ on it. Ideally, these changes should not be net specific. However, the vdpa net backend is the one with enough knowledge to configure everything because of some reasons: * Queues might need to

Re: [PATCH 2/5] scripts/checkpatch.pl: Do not allow assert(0)

2023-02-21 Thread Thomas Huth
On 22/02/2023 00.25, Philippe Mathieu-Daudé wrote: Since commit 262a69f428 ("osdep.h: Prohibit disabling assert() in supported builds") we can not build QEMU with NDEBUG (or G_DISABLE_ASSERT) defined, thus 'assert(0)' always aborts QEMU. However some static analyzers / compilers doesn't notice

Re: [PATCH v2 04/13] vdpa: move vhost reset after get vring base

2023-02-21 Thread Jason Wang
On Tue, Feb 21, 2023 at 3:08 PM Eugenio Perez Martin wrote: > > On Tue, Feb 21, 2023 at 6:36 AM Jason Wang wrote: > > > > > > 在 2023/2/8 17:42, Eugenio Pérez 写道: > > > The function vhost.c:vhost_dev_stop calls vhost operation > > > vhost_dev_start(false). In the case of vdpa it totally reset and

Re: [PATCH v8 0/8] Introduce igb

2023-02-21 Thread Jason Wang
On Mon, Feb 20, 2023 at 3:04 PM Akihiko Odaki wrote: > > On 2023/02/20 16:01, Jason Wang wrote: > > > > 在 2023/2/6 20:30, Akihiko Odaki 写道: > >> Hi Jason, > >> > >> Let me remind that every patches in this series now has Reviewed-by: > >> or Acked-by: tag though I forgot to include tags the prior

Re: [PATCH v4 6/9] hw/i386/pc: Initialize ram_memory variable directly

2023-02-21 Thread Xiaoyao Li
On 2/14/2023 12:20 AM, Bernhard Beschow wrote: Going through pc_memory_init() seems quite complicated for a simple assignment. ... diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 5bde4533cc..00ba725656 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -143,6 +143,7 @@

[PATCH v3 06/25] target/arm: Update SCR and HCR for RME

2023-02-21 Thread Richard Henderson
Define the missing SCR and HCR bits, allow SCR_NSE and {SCR,HCR}_GPF to be set, and invalidate TLBs when NSE changes. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/cpu.h| 5 +++-- target/arm/helper.c | 10 -- 2 files changed, 11 insertions(+), 4

[PATCH v3 10/25] include/exec/memattrs: Add two bits of space to MemTxAttrs

2023-02-21 Thread Richard Henderson
We will need 2 bits to represent ARMSecurityState. Do not attempt to replace or widen secure, even though it logically overlaps the new field -- there are uses within e.g. hw/block/pflash_cfi01.c, which don't know anything specific about ARM. Reviewed-by: Peter Maydell Signed-off-by: Richard

[PATCH v3 15/25] target/arm: NSTable is RES0 for the RME EL3 regime

2023-02-21 Thread Richard Henderson
Test in_space instead of in_secure so that we don't switch out of Root space. Handle the output space change immediately, rather than try and combine the NSTable and NS bits later. Signed-off-by: Richard Henderson --- target/arm/ptw.c | 27 ++- 1 file changed, 14

[PATCH NOTFORMERGE v3 24/25] target/arm: Enable RME for -cpu max

2023-02-21 Thread Richard Henderson
Add a cpu property to set GPCCR_EL3.L0GPTSZ, for testing various possible configurations. Signed-off-by: Richard Henderson --- target/arm/cpu64.c | 37 + 1 file changed, 37 insertions(+) diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c index

[PATCH v3 07/25] target/arm: SCR_EL3.NS may be RES1

2023-02-21 Thread Richard Henderson
With RME, SEL2 must also be present to support secure state. The NS bit is RES1 if SEL2 is not present. Signed-off-by: Richard Henderson --- target/arm/helper.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/target/arm/helper.c b/target/arm/helper.c index 3650234c73..ae8b3f6a48 100644

[PATCH v3 04/25] target/arm: Rewrite check_s2_mmu_setup

2023-02-21 Thread Richard Henderson
Integrate neighboring code from get_phys_addr_lpae which computed starting level, as it is easier to validate when doing both at the same time. Mirror the checks at the start of AArch{64,32}.S2Walk, especially S2InvalidSL and S2InconsistentSL. This reverts 49ba115bb74, which was incorrect --

[PATCH v3 02/25] target/arm: Stub arm_hcr_el2_eff for m-profile

2023-02-21 Thread Richard Henderson
M-profile doesn't have HCR_EL2. While we could test features before each call, zero is a generally safe return value to disable the code in the caller. This test is required to avoid an assert in arm_is_secure_below_el3. Signed-off-by: Richard Henderson --- target/arm/helper.c | 3 +++ 1 file

[PATCH v3 18/25] target/arm: Use get_phys_addr_with_struct in S1_ptw_translate

2023-02-21 Thread Richard Henderson
Do not provide a fast-path for physical addresses, as those will need to be validated for GPC. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/ptw.c | 35 ++- 1 file changed, 14 insertions(+), 21 deletions(-) diff --git

[PATCH v3 05/25] target/arm: Add isar_feature_aa64_rme

2023-02-21 Thread Richard Henderson
Add the missing field for ID_AA64PFR0, and the predicate. Disable it if EL3 is forced off by the board or command-line. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/cpu.h | 6 ++ target/arm/cpu.c | 4 2 files changed, 10 insertions(+) diff --git

[PATCH v3 14/25] target/arm: Pipe ARMSecuritySpace through ptw.c

2023-02-21 Thread Richard Henderson
Add input and output space members to S1Translate. Set and adjust them in S1_ptw_translate, and the various points at which we drop secure state. Initialize the space in get_phys_addr; for now leave get_phys_addr_with_secure considering only secure vs non-secure spaces. Reviewed-by: Peter Maydell

[PATCH v3 12/25] target/arm: Introduce ARMMMUIdx_Phys_{Realm,Root}

2023-02-21 Thread Richard Henderson
With FEAT_RME, there are four physical address spaces. For now, just define the symbols, and mention them in the same spots as the other Phys indexes in ptw.c. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/cpu-param.h | 2 +- target/arm/cpu.h | 23

[PATCH v3 13/25] target/arm: Remove __attribute__((nonnull)) from ptw.c

2023-02-21 Thread Richard Henderson
This was added in 7e98e21c098 as part of a reorg in which one of the argument had been legally NULL, and this caught actual instances. Now that the reorg is complete, this serves little purpose. Signed-off-by: Richard Henderson --- target/arm/ptw.c | 6 ++ 1 file changed, 2 insertions(+),

[PATCH v3 03/25] target/arm: Diagnose incorrect usage of arm_is_secure subroutines

2023-02-21 Thread Richard Henderson
In several places we use arm_is_secure_below_el3 and arm_is_el3_or_mon separately from arm_is_secure. These functions make no sense for m-profile, and would indicate prior incorrect feature testing. Signed-off-by: Richard Henderson --- target/arm/cpu.h | 5 - 1 file changed, 4

[PATCH NOTFORMERGE v3 25/25] hw/arm/virt: Add some memory for Realm Management Monitor

2023-02-21 Thread Richard Henderson
This is arbitrary, but used by the Huawei TF-A test code. Signed-off-by: Richard Henderson --- include/hw/arm/virt.h | 2 ++ hw/arm/virt.c | 43 +++ 2 files changed, 45 insertions(+) diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h

[PATCH v3 17/25] target/arm: Handle no-execute for Realm and Root regimes

2023-02-21 Thread Richard Henderson
While Root and Realm may read and write data from other spaces, neither may execute from other pa spaces. This happens for Stage1 EL3, EL2, EL2&0, but stage2 EL1&0. Signed-off-by: Richard Henderson --- target/arm/ptw.c | 52 ++-- 1 file changed, 46

[PATCH v3 01/25] target/arm: Handle m-profile in arm_is_secure

2023-02-21 Thread Richard Henderson
Signed-off-by: Richard Henderson --- target/arm/cpu.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 12b1082537..7a2f804aeb 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -2426,6 +2426,9 @@ static inline bool

[PATCH v3 22/25] target/arm: Implement GPC exceptions

2023-02-21 Thread Richard Henderson
Handle GPC Fault types in arm_deliver_fault, reporting as either a GPC exception at EL3, or falling through to insn or data aborts at various exception levels. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/cpu.h| 1 + target/arm/internals.h | 27

[PATCH v3 09/25] target/arm: Introduce ARMSecuritySpace

2023-02-21 Thread Richard Henderson
Introduce both the enumeration and functions to retrieve the current state, and state outside of EL3. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/cpu.h| 89 ++--- target/arm/helper.c | 60 ++

[PATCH v3 16/25] target/arm: Handle Block and Page bits for security space

2023-02-21 Thread Richard Henderson
With Realm security state, bit 55 of a block or page descriptor during the stage2 walk becomes the NS bit; during the stage1 walk the bit 5 NS bit is RES0. With Root security state, bit 11 of the block or page descriptor during the stage1 walk becomes the NSE bit. Rather than collecting an NS

[PATCH v3 21/25] target/arm: Add GPC syndrome

2023-02-21 Thread Richard Henderson
The function takes the fields as filled in by the Arm ARM pseudocode for TakeGPCException. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/syndrome.h | 10 ++ 1 file changed, 10 insertions(+) diff --git a/target/arm/syndrome.h b/target/arm/syndrome.h index

[PATCH v3 08/25] target/arm: Add RME cpregs

2023-02-21 Thread Richard Henderson
This includes GPCCR, GPTBR, MFAR, the TLB flush insns PAALL, PAALLOS, RPALOS, RPAOS, and the cache flush insns CIPAPA and CIGDPAPA. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/cpu.h| 19 +++ target/arm/helper.c | 83

[PATCH v3 20/25] target/arm: Use get_phys_addr_with_struct for stage2

2023-02-21 Thread Richard Henderson
This fixes a bug in which we failed to initialize the result attributes properly after the memset. Signed-off-by: Richard Henderson --- target/arm/ptw.c | 11 +-- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/target/arm/ptw.c b/target/arm/ptw.c index

[PATCH v3 19/25] target/arm: Move s1_is_el0 into S1Translate

2023-02-21 Thread Richard Henderson
Instead of passing this to get_phys_addr_lpae, stash it in the S1Translate structure. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/ptw.c | 27 --- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/target/arm/ptw.c

[PATCH v3 23/25] target/arm: Implement the granule protection check

2023-02-21 Thread Richard Henderson
Place the check at the end of get_phys_addr_with_struct, so that we check all physical results. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/ptw.c | 249 +++ 1 file changed, 232 insertions(+), 17 deletions(-) diff --git

[PATCH v3 00/25] target/arm: Implement FEAT_RME

2023-02-21 Thread Richard Henderson
This is based on mainline, without any extra ARMv9-A dependencies which are still under development. This is good enough to pass all of the tests within https://github.com/Huawei/Huawei_CCA_QEMU Changes for v3: * Incorporate fix for m-profile arm_cpu_get_phys_page_attrs_debug, since

[PATCH v3 11/25] target/arm: Adjust the order of Phys and Stage2 ARMMMUIdx

2023-02-21 Thread Richard Henderson
It will be helpful to have ARMMMUIdx_Phys_* to be in the same relative order as ARMSecuritySpace enumerators. This requires the adjustment to the nstable check. While there, check for being in secure state rather than rely on clearing the low bit making no change to non-secure state. Reviewed-by:

[PULL v2 4/8] cpus: Make {start,end}_exclusive() recursive

2023-02-21 Thread Richard Henderson
From: Ilya Leoshkevich Currently dying to one of the core_dump_signal()s deadlocks, because dump_core_and_abort() calls start_exclusive() two times: first via stop_all_tasks(), and then via preexit_cleanup() -> qemu_plugin_user_exit(). There are a number of ways to solve this: resume after

[PULL v2 1/8] accel/tcg: Allow the second page of an instruction to be MMIO

2023-02-21 Thread Richard Henderson
If an instruction straddles a page boundary, and the first page was ram, but the second page was MMIO, we would abort. Handle this as if both pages are MMIO, by setting the ram_addr_t for the first page to -1. Reported-by: Sid Manning Reported-by: Jørgen Hansen Reviewed-by: Philippe

[PULL v2 5/8] linux-user/microblaze: Handle privileged exception

2023-02-21 Thread Richard Henderson
From: Ilya Leoshkevich Follow what kernel's full_exception() is doing. Reviewed-by: Richard Henderson Signed-off-by: Ilya Leoshkevich Message-Id: <20230214140829.45392-4-...@linux.ibm.com> Signed-off-by: Richard Henderson --- linux-user/microblaze/cpu_loop.c | 10 -- 1 file changed,

[PULL v2 2/8] linux-user/sparc: Raise SIGILL for all unhandled software traps

2023-02-21 Thread Richard Henderson
The linux kernel's trap tables vector all unassigned trap numbers to BAD_TRAP, which then raises SIGILL. Tested-by: Ilya Leoshkevich Reported-by: Ilya Leoshkevich Signed-off-by: Richard Henderson --- linux-user/sparc/cpu_loop.c | 8 1 file changed, 8 insertions(+) diff --git

[PULL v2 7/8] util/cacheflush: fix cache on windows-arm64

2023-02-21 Thread Richard Henderson
From: Pierrick Bouvier ctr_el0 access is privileged on this platform and fails as an illegal instruction. Windows does not offer a way to flush data cache from userspace, and only FlushInstructionCache is available in Windows API. The generic implementation of flush_idcache_range uses,

[PULL v2 6/8] target/microblaze: Add gdbstub xml

2023-02-21 Thread Richard Henderson
Mirroring the upstream gdb xml files, the two stack boundary registers are separated out. Reviewed-by: Edgar E. Iglesias Signed-off-by: Richard Henderson --- target/microblaze/cpu.h | 2 + target/microblaze/cpu.c | 7 ++- target/microblaze/gdbstub.c

Re: [PATCH] target/riscv/vector_helper.c: create vext_set_tail_elems_1s()

2023-02-21 Thread liweiwei
On 2023/2/22 02:45, Daniel Henrique Barboza wrote: Commit 752614cab8e6 ("target/riscv: rvv: Add tail agnostic for vector load / store instructions") added code to set the tail elements to 1 in the end of vext_ldst_stride(), vext_ldst_us(), vext_ldst_index() and vext_ldff(). Aside from a

[PULL v2 8/8] sysemu/os-win32: fix setjmp/longjmp on windows-arm64

2023-02-21 Thread Richard Henderson
From: Pierrick Bouvier Windows implementation of setjmp/longjmp is done in C:/WINDOWS/system32/ucrtbase.dll. Alas, on arm64, it seems to *always* perform stack unwinding, which crashes from generated code. By using alternative implementation built in mingw, we avoid doing stack unwinding and

[PULL v2 3/8] linux-user: Always exit from exclusive state in fork_end()

2023-02-21 Thread Richard Henderson
From: Ilya Leoshkevich fork()ed processes currently start with current_cpu->in_exclusive_context set, which is, strictly speaking, not correct, but does not cause problems (even assertion failures). With one of the next patches, the code begins to rely on this value, so fix it by always calling

[PULL v2 0/8] tcg patch queue

2023-02-21 Thread Richard Henderson
The following changes since commit 79b677d658d3d35e1e776826ac4abb28cdce69b8: Merge tag 'net-pull-request' of https://github.com/jasowang/qemu into staging (2023-02-21 11:28:31 +) are available in the Git repository at: https://gitlab.com/rth7680/qemu.git tags/pull-tcg-20230221 for you

Re: [PATCH 2/6] hw/cxl: rename mailbox return code type from ret_code to CXLRetCode

2023-02-21 Thread Ira Weiny
Jonathan Cameron wrote: > This enum typedef used to be local to one file, so having a generic > name wasn't a big problem even if it wasn't compliant with QEMU naming > conventions. Now it is in cxl_device.h to support use outside of > cxl-mailbox-utils.c rename it. Same comment as 1/6 but

Re: [PATCH 1/6] hw/cxl: Move enum ret_code definition to cxl_device.h

2023-02-21 Thread Ira Weiny
Jonathan Cameron wrote: > Needs tidy up and rename to something more generic now it is > in a header. I'm not opposed to this change and patch 2 but I don't see where CXLRetCode is being used outside of cxl-mailbox-utils.c in this series. Despite that reservation I think this is a good

Re: [PATCH 6/6] hw/cxl: Add clear poison mailbox command support.

2023-02-21 Thread Ira Weiny
Jonathan Cameron wrote: > Current implementation is very simple so many of the corner > cases do not exist (e.g. fragmenting larger poison list entries) > > Signed-off-by: Jonathan Cameron > --- > hw/cxl/cxl-mailbox-utils.c | 77 + > hw/mem/cxl_type3.c

Re: [PATCH 5/6] hw/cxl: Add poison injection via the mailbox.

2023-02-21 Thread Ira Weiny
Jonathan Cameron wrote: > Very simple implementation to allow testing of corresponding > kernel code. Note that for now we track each 64 byte section > independently. Whilst a valid implementation choice, it may > make sense to fuse entries so as to prove out more complex > corners of the kernel

Re: [PATCH v3 23/24] include: split target_long definition from cpu-defs

2023-02-21 Thread Richard Henderson
On 2/21/23 12:52, Alex Bennée wrote: While we will continue to include this via cpu-defs it is useful to be able to define this separately for 32 and 64 bit versions of an otherwise target independent compilation unit. Signed-off-by: Alex Bennée --- include/exec/cpu-defs.h| 19

Re: [PATCH 4/6] hw/cxl: QMP based poison injection support

2023-02-21 Thread Ira Weiny
Jonathan Cameron wrote: > Inject poison using qmp command cxl-inject-poison to add an entry to the > poison list. > > For now, the poison is not returned CXL.mem reads, but only via the > mailbox command Get Poison List. > > See CXL rev 3.0, sec 8.2.9.8.4.1 Get Poison list (Opcode 4300h) > >

Re: [PATCH v3 22/24] testing: probe gdb for supported architectures ahead of time

2023-02-21 Thread Richard Henderson
On 2/21/23 12:52, Alex Bennée wrote: Currently when we encounter a gdb that is old or not built with multiarch in mind we fail rather messily. Try and improve the situation by probing ahead of time and setting HOST_GDB_SUPPORTS_ARCH=y in the relevant tcg configs. We can then skip and give a more

Re: [PATCH v3 18/24] gdbstub: don't use target_ulong while handling registers

2023-02-21 Thread Richard Henderson
On 2/21/23 12:52, Alex Bennée wrote: This is a hangover from the original code. addr is misleading as it is only really a register id. While len will never exceed MAX_PACKET_LENGTH I've used size_t as that is what strlen returns. Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Richard

Re: [PATCH v3 11/24] gdbstub: rationalise signal mapping in softmmu

2023-02-21 Thread Richard Henderson
On 2/21/23 12:52, Alex Bennée wrote: We don't really need a table for mapping two symbols. Signed-off-by: Alex Bennée Suggested-by: Richard Henderson --- gdbstub/softmmu.c | 19 +++ 1 file changed, 7 insertions(+), 12 deletions(-) Reviewed-by: Richard Henderson r~

Re: [PATCH v3 09/24] gdbstub: move chunk of softmmu functionality to own file

2023-02-21 Thread Richard Henderson
On 2/21/23 12:52, Alex Bennée wrote: This is mostly code motion but a number of things needed to be done for this minimal patch set: - move shared structures to internals.h - splitting some functions into user and softmmu versions - fixing a few casting issues to keep softmmu common

Re: [PATCH 5/5] hw: Remove mentions of NDEBUG

2023-02-21 Thread Richard Henderson
On 2/21/23 13:25, Philippe Mathieu-Daudé wrote: Since commit 262a69f428 ("osdep.h: Prohibit disabling assert() in supported builds") 'NDEBUG' can not be defined. Signed-off-by: Philippe Mathieu-Daudé --- hw/scsi/mptsas.c | 2 -- hw/virtio/virtio.c | 2 -- 2 files changed, 4 deletions(-)

Re: [PATCH 4/5] block/vvfat: Remove pointless check of NDEBUG

2023-02-21 Thread Richard Henderson
On 2/21/23 13:25, Philippe Mathieu-Daudé wrote: Since commit 262a69f428 ("osdep.h: Prohibit disabling assert() in supported builds") 'NDEBUG' can not be defined, so '#ifndef NDEBUG' is dead code. Remove it. Signed-off-by: Philippe Mathieu-Daudé --- block/vvfat.c | 3 --- 1 file changed, 3

Re: [PATCH 2/5] scripts/checkpatch.pl: Do not allow assert(0)

2023-02-21 Thread Richard Henderson
On 2/21/23 13:25, Philippe Mathieu-Daudé wrote: Since commit 262a69f428 ("osdep.h: Prohibit disabling assert() in supported builds") we can not build QEMU with NDEBUG (or G_DISABLE_ASSERT) defined, thus 'assert(0)' always aborts QEMU. However some static analyzers / compilers doesn't notice

Re: [PATCH 3/5] bulk: Replace [g_]assert(0) -> g_assert_not_reached()

2023-02-21 Thread Richard Henderson
On 2/21/23 13:25, Philippe Mathieu-Daudé wrote: In order to avoid warnings such commit c0a6665c3c ("target/i386: Remove compilation errors when -Werror=maybe-uninitialized"), replace all assert(0) and g_assert(0) by g_assert_not_reached(). Remove any code following g_assert_not_reached(). See

Re: [PATCH v1 3/6] kvm: Synchronize the backup bitmap in the last stage

2023-02-21 Thread Peter Xu
Hi, Gavin, On Wed, Feb 22, 2023 at 10:44:07AM +1100, Gavin Shan wrote: > Peter, could you please give some hints for me to understand the atomic > and non-atomic update here? Ok, I will drop this part of changes in next > revision with the assumption that we have atomic update supported for >

Re: [PATCH v4 2/4] sysemu/os-win32: fix setjmp/longjmp on windows-arm64

2023-02-21 Thread Richard Henderson
On 2/21/23 05:30, Pierrick Bouvier wrote: Windows implementation of setjmp/longjmp is done in C:/WINDOWS/system32/ucrtbase.dll. Alas, on arm64, it seems to *always* perform stack unwinding, which crashes from generated code. By using alternative implementation built in mingw, we avoid doing

Re: [PATCH v4 1/4] util/cacheflush: fix cache on windows-arm64

2023-02-21 Thread Richard Henderson
On 2/21/23 05:30, Pierrick Bouvier wrote: ctr_el0 access is privileged on this platform and fails as an illegal instruction. Windows does not offer a way to flush data cache from userspace, and only FlushInstructionCache is available in Windows API. The generic implementation of

Re: [PATCH v1 3/6] kvm: Synchronize the backup bitmap in the last stage

2023-02-21 Thread Gavin Shan
On 2/22/23 4:46 AM, Peter Xu wrote: On Mon, Feb 13, 2023 at 08:39:22AM +0800, Gavin Shan wrote: In the last stage of live migration or memory slot removal, the backup bitmap needs to be synchronized when it has been enabled. Signed-off-by: Gavin Shan --- accel/kvm/kvm-all.c | 11

Re: [PATCH v4 4/4] target/ppc: fix warning with clang-15

2023-02-21 Thread Richard Henderson
On 2/21/23 12:30, Philippe Mathieu-Daudé wrote: On 21/2/23 16:30, Pierrick Bouvier wrote: When compiling for windows-arm64 using clang-15, it reports a sometimes uninitialized variable. This seems to be a false positive, as a default case guards switch expressions, preventing to return an

Re: [PATCH] hw/arm/virt: Prevent CPUs in one socket to span mutiple NUMA nodes

2023-02-21 Thread Gavin Shan
On 2/22/23 10:31 AM, Philippe Mathieu-Daudé wrote: On 22/2/23 00:12, Gavin Shan wrote: On 2/21/23 9:21 PM, Philippe Mathieu-Daudé wrote: On 21/2/23 10:21, Gavin Shan wrote: On 2/21/23 8:15 PM, Philippe Mathieu-Daudé wrote: On 21/2/23 09:53, Gavin Shan wrote: Linux kernel guest reports

Re: [PATCH] hw/arm/virt: Prevent CPUs in one socket to span mutiple NUMA nodes

2023-02-21 Thread Philippe Mathieu-Daudé
On 22/2/23 00:12, Gavin Shan wrote: On 2/21/23 9:21 PM, Philippe Mathieu-Daudé wrote: On 21/2/23 10:21, Gavin Shan wrote: On 2/21/23 8:15 PM, Philippe Mathieu-Daudé wrote: On 21/2/23 09:53, Gavin Shan wrote: Linux kernel guest reports warning when two CPUs in one socket have been associated

[PATCH 2/5] scripts/checkpatch.pl: Do not allow assert(0)

2023-02-21 Thread Philippe Mathieu-Daudé
Since commit 262a69f428 ("osdep.h: Prohibit disabling assert() in supported builds") we can not build QEMU with NDEBUG (or G_DISABLE_ASSERT) defined, thus 'assert(0)' always aborts QEMU. However some static analyzers / compilers doesn't notice NDEBUG can't be defined and emit warnings if code is

[PATCH 1/5] target/ppc: fix warning with clang-15

2023-02-21 Thread Philippe Mathieu-Daudé
From: Pierrick Bouvier When compiling for windows-arm64 using clang-15, it reports a sometimes uninitialized variable. This seems to be a false positive, as a default case guards switch expressions, preventing to return an uninitialized value, but clang seems unhappy with assert(0) definition.

[PATCH 0/5] bulk: Replace assert(0) -> g_assert_not_reached()

2023-02-21 Thread Philippe Mathieu-Daudé
Save contributors to post a patch each time clang produce a -Werror=maybe-uninitialized warning on assert(0). Replace by g_assert_not_reached()() and prohibit '[g_]assert(0)'. Remove NDEBUG. Philippe Mathieu-Daudé (4): scripts/checkpatch.pl: Do not allow assert(0) bulk: Replace [g_]assert(0)

[PATCH 5/5] hw: Remove mentions of NDEBUG

2023-02-21 Thread Philippe Mathieu-Daudé
Since commit 262a69f428 ("osdep.h: Prohibit disabling assert() in supported builds") 'NDEBUG' can not be defined. Signed-off-by: Philippe Mathieu-Daudé --- hw/scsi/mptsas.c | 2 -- hw/virtio/virtio.c | 2 -- 2 files changed, 4 deletions(-) diff --git a/hw/scsi/mptsas.c b/hw/scsi/mptsas.c

[PATCH 4/5] block/vvfat: Remove pointless check of NDEBUG

2023-02-21 Thread Philippe Mathieu-Daudé
Since commit 262a69f428 ("osdep.h: Prohibit disabling assert() in supported builds") 'NDEBUG' can not be defined, so '#ifndef NDEBUG' is dead code. Remove it. Signed-off-by: Philippe Mathieu-Daudé --- block/vvfat.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/block/vvfat.c

[PATCH 3/5] bulk: Replace [g_]assert(0) -> g_assert_not_reached()

2023-02-21 Thread Philippe Mathieu-Daudé
In order to avoid warnings such commit c0a6665c3c ("target/i386: Remove compilation errors when -Werror=maybe-uninitialized"), replace all assert(0) and g_assert(0) by g_assert_not_reached(). Remove any code following g_assert_not_reached(). See previous commit for rationale. Signed-off-by:

Re: [PATCH v1 2/6] migration: Add last stage indicator to global dirty log synchronization

2023-02-21 Thread Gavin Shan
On 2/22/23 4:36 AM, Peter Xu wrote: On Mon, Feb 13, 2023 at 08:39:21AM +0800, Gavin Shan wrote: The global dirty log synchronization is used when KVM and dirty ring are enabled. There is a particularity for ARM64 where the backup bitmap is used to track dirty pages in non-running-vcpu

Re: [PATCH v1 1/6] linux-headers: Update for dirty ring

2023-02-21 Thread Gavin Shan
On 2/22/23 3:30 AM, Peter Maydell wrote: On Mon, 13 Feb 2023 at 00:39, Gavin Shan wrote: Signed-off-by: Gavin Shan --- linux-headers/asm-arm64/kvm.h | 1 + linux-headers/linux/kvm.h | 2 ++ 2 files changed, 3 insertions(+) For this to be a non-RFC patch, this needs to be a proper

Re: [PATCH] hw/arm/virt: Prevent CPUs in one socket to span mutiple NUMA nodes

2023-02-21 Thread Gavin Shan
On 2/21/23 9:21 PM, Philippe Mathieu-Daudé wrote: On 21/2/23 10:21, Gavin Shan wrote: On 2/21/23 8:15 PM, Philippe Mathieu-Daudé wrote: On 21/2/23 09:53, Gavin Shan wrote: Linux kernel guest reports warning when two CPUs in one socket have been associated with different NUMA nodes, using the

[PATCH v3 17/24] gdbstub: fix address type of gdb_set_cpu_pc

2023-02-21 Thread Alex Bennée
The underlying call uses vaddr and the comms API uses unsigned long long which will always fit. We don't need to deal in target_ulong here. Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Signed-off-by: Alex Bennée --- gdbstub/gdbstub.c | 4 ++-- 1 file changed, 2

[PATCH v3 20/24] gdbstub: move syscall handling to new file

2023-02-21 Thread Alex Bennée
Our GDB syscall support is the last chunk of code that needs target specific support so move it to a new file. We take the opportunity to move the syscall state into its own singleton instance and add in a few helpers for the main gdbstub to interact with the module. I also moved the gdb_exit()

[PATCH v3 16/24] gdbstub: specialise stub_can_reverse

2023-02-21 Thread Alex Bennée
Currently we only support replay for softmmu mode so it is a constant false for user-mode. Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Signed-off-by: Alex Bennée --- v3 - rename gdb_stub_can_revers -> gdb_can_reverse --- gdbstub/internals.h | 1 + gdbstub/gdbstub.c

[PATCH v3 18/24] gdbstub: don't use target_ulong while handling registers

2023-02-21 Thread Alex Bennée
This is a hangover from the original code. addr is misleading as it is only really a register id. While len will never exceed MAX_PACKET_LENGTH I've used size_t as that is what strlen returns. Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Signed-off-by: Alex Bennée --- v3

[PATCH v3 14/24] gdbstub: specialise target_memory_rw_debug

2023-02-21 Thread Alex Bennée
The two implementations are different enough to encourage having a specialisation and we can move some of the softmmu only stuff out of gdbstub. Reviewed-by: Richard Henderson Signed-off-by: Alex Bennée --- gdbstub/internals.h | 19 gdbstub/gdbstub.c | 73

[PATCH v3 19/24] gdbstub: move register helpers into standalone include

2023-02-21 Thread Alex Bennée
These inline helpers are all used by target specific code so move them out of the general header so we don't needlessly pollute the rest of the API with target specific stuff. Note we have to include cpu.h in semihosting as it was relying on a side effect before. Reviewed-by: Taylor Simpson

[PATCH v3 21/24] gdbstub: only compile gdbstub twice for whole build

2023-02-21 Thread Alex Bennée
Now we have removed any target specific bits from the core gdbstub code we only need to build it twice. We have to jump a few meson hoops to manually define the CONFIG_USER_ONLY symbol but it seems to work. Signed-off-by: Alex Bennée --- v3 - also include user and softmmu bits in the library

[PATCH v3 22/24] testing: probe gdb for supported architectures ahead of time

2023-02-21 Thread Alex Bennée
Currently when we encounter a gdb that is old or not built with multiarch in mind we fail rather messily. Try and improve the situation by probing ahead of time and setting HOST_GDB_SUPPORTS_ARCH=y in the relevant tcg configs. We can then skip and give a more meaningful message if we don't run the

[PATCH v3 12/24] gdbstub: abstract target specific details from gdb_put_packet_binary

2023-02-21 Thread Alex Bennée
We unfortunately handle the checking of packet acknowledgement differently for user and softmmu modes. Abstract the user mode stuff behind gdb_got_immediate_ack with a stub for softmmu. Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Alex Bennée ---

[PATCH v3 23/24] include: split target_long definition from cpu-defs

2023-02-21 Thread Alex Bennée
While we will continue to include this via cpu-defs it is useful to be able to define this separately for 32 and 64 bit versions of an otherwise target independent compilation unit. Signed-off-by: Alex Bennée --- include/exec/cpu-defs.h| 19 + include/exec/target_long.h | 42

[PATCH v3 11/24] gdbstub: rationalise signal mapping in softmmu

2023-02-21 Thread Alex Bennée
We don't really need a table for mapping two symbols. Signed-off-by: Alex Bennée Suggested-by: Richard Henderson --- gdbstub/softmmu.c | 19 +++ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/gdbstub/softmmu.c b/gdbstub/softmmu.c index 864ecee38f..79674b8bea

[PATCH v3 15/24] gdbstub: introduce gdb_get_max_cpus

2023-02-21 Thread Alex Bennée
This is needed for handling vcont packets as the way of calculating max cpus vhanges between user and softmmu mode. Reviewed-by: Richard Henderson Signed-off-by: Alex Bennée --- v3 - rm out of date comment --- gdbstub/internals.h | 1 + gdbstub/gdbstub.c | 11 +--

[PATCH v3 24/24] gdbstub: split out softmmu/user specifics for syscall handling

2023-02-21 Thread Alex Bennée
Most of the syscall code is config agnostic aside from the size of target_ulong. In preparation for the next patch move the final bits of specialisation into the appropriate user and softmmu helpers. Signed-off-by: Alex Bennée --- gdbstub/internals.h | 5 + gdbstub/softmmu.c | 24

  1   2   3   4   >