[PATCH v4 3/3] hw/arm: Connect STM32L4x5 EXTI to STM32L4x5 SoC

2023-12-28 Thread Inès Varhol
Signed-off-by: Arnaud Minier Signed-off-by: Inès Varhol --- hw/arm/Kconfig | 1 + hw/arm/stm32l4x5_soc.c | 56 -- include/hw/arm/stm32l4x5_soc.h | 3 ++ 3 files changed, 58 insertions(+), 2 deletions(-) diff --git a/hw/arm/Kconfig b/hw/a

[PATCH v4 1/3] hw/misc: Implement STM32L4x5 EXTI

2023-12-28 Thread Inès Varhol
Although very similar to the STM32F4xx EXTI, STM32L4x5 EXTI generates more than 32 event/interrupt requests and thus uses more registers than STM32F4xx EXTI which generates 23 event/interrupt requests. Signed-off-by: Arnaud Minier Signed-off-by: Inès Varhol --- hw/misc/Kconfig

[PATCH v5 0/3] Add device STM32L4x5 EXTI

2023-12-28 Thread Inès Varhol
ERRATUM : I mistakenly sent an incorrect version v4 of this patch. This version v5 rectifies the error and replaces the erroneous v4. All my apologies. Changes from v4 to v5: - update the documentation file Changes from v3 to v4: - add a test to check that irq trigger selection works correctly (`

[PATCH v5 3/3] hw/arm: Connect STM32L4x5 EXTI to STM32L4x5 SoC

2023-12-28 Thread Inès Varhol
Signed-off-by: Arnaud Minier Signed-off-by: Inès Varhol --- hw/arm/Kconfig | 1 + hw/arm/stm32l4x5_soc.c | 56 -- include/hw/arm/stm32l4x5_soc.h | 3 ++ 3 files changed, 58 insertions(+), 2 deletions(-) diff --git a/hw/arm/Kconfig b/hw/a

[PATCH v5 2/3] tests/qtest: Add STM32L4x5 EXTI QTest testcase

2023-12-28 Thread Inès Varhol
Signed-off-by: Arnaud Minier Signed-off-by: Inès Varhol --- tests/qtest/meson.build | 5 + tests/qtest/stm32l4x5_exti-test.c | 596 ++ 2 files changed, 601 insertions(+) create mode 100644 tests/qtest/stm32l4x5_exti-test.c diff --git a/tests/qtest/meson.

[PATCH v5 1/3] hw/misc: Implement STM32L4x5 EXTI

2023-12-28 Thread Inès Varhol
Although very similar to the STM32F4xx EXTI, STM32L4x5 EXTI generates more than 32 event/interrupt requests and thus uses more registers than STM32F4xx EXTI which generates 23 event/interrupt requests. Signed-off-by: Arnaud Minier Signed-off-by: Inès Varhol --- docs/system/arm/b-l475e-iot01a.rs

Re: [PATCH] q800: move dp8393x_prom memory region to Q800MachineState

2023-12-28 Thread Mark Cave-Ayland
On 28/12/2023 09:46, Philippe Mathieu-Daudé wrote: On 27/12/23 22:02, Mark Cave-Ayland wrote: There is no need to dynamically allocate the memory region from the heap. Signed-off-by: Mark Cave-Ayland ---   hw/m68k/q800.c | 7 +++   include/hw/m68k/q800.h | 1 +   2 files changed, 4

RE: [PATCH 2/3] ui/gtk: unblock pipeline only if fence hasn't been signaled yet

2023-12-28 Thread Kim, Dongwon
Hi Marc-André, I reviewed and realized these conditions won't be met in normal situations in given upstream code. But we've initially added those conditions in our internal code base for dev because we often had to call gd_hw_gl_flushed to forcefully unblock from HPD code (i.e. 'connectors' par

[PATCH 0/2] Adjust the output of x-query-virtio-status

2023-12-28 Thread Hyman Huang
This patchset is derived from the series: https://lore.kernel.org/qemu-devel/cover.1699793550.git.yong.hu...@smartx.com/ Please go to the link to see more background information. The following points are what we have done in the patchset: 1. Take the policy of adding human-readable output just in

[PATCH 1/2] qapi/virtio: Keep feature and status bits in the QMP output

2023-12-28 Thread Hyman Huang
Maintain the feature and status bits in the x-query-virtio-status output and, as usual, add human-readable output only in HMP. Applications may find it useful to compare features and status information directly. An upper application, for example, could use the QMP command x-query-virtio-status to

[PATCH 2/2] hmp: Drop unknown feature and status bits

2023-12-28 Thread Hyman Huang
The QMP command "x-query-virtio-status" outputs the full feature and status bit information, so there is no need to maintain it in the HMP output; drop it. Signed-off-by: Hyman Huang --- hw/virtio/virtio-hmp-cmds.c | 13 - 1 file changed, 13 deletions(-) diff --git a/hw/virtio/virti

[ANNOUNCE] QEMU 7.2.8 Stable released

2023-12-28 Thread Michael Tokarev
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Hi everyone, The QEMU v7.2.8 stable release is now available. You can grab the tarball from our download page here: https://www.qemu.org/download/#source https://download.qemu.org/qemu-7.2.8.tar.xz https://download.qemu.org/qemu-7.2.8.tar.x

[ANNOUNCE] QEMU 8.1.4 Stable released

2023-12-28 Thread Michael Tokarev
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Hi everyone, The QEMU v8.1.4 stable release is now available. You can grab the tarball from our download page here: https://www.qemu.org/download/#source https://download.qemu.org/qemu-8.1.4.tar.xz https://download.qemu.org/qemu-8.1.4.tar.x

Re: [PATCH] tcg/i386: use 8-bit OR or XOR for unsigned 8-bit immediates

2023-12-28 Thread Richard Henderson
On 12/28/23 23:05, Paolo Bonzini wrote: In the case where OR or XOR has an 8-bit immediate between 128 and 255, we can operate on a low-byte register and shorten the output by two or three bytes (two if a prefix byte is needed for REX.B). Signed-off-by: Paolo Bonzini --- tcg/i386/tcg-target.c

Re: [PATCH 01/22] target/i386: optimize computation of JL and JLE from flags

2023-12-28 Thread Richard Henderson
On 12/23/23 05:15, Paolo Bonzini wrote: Take advantage of the fact that there can be no 1 bits between SF and OF. If they were adjacent, you could sum SF and get a carry only if SF was already set. Then the value of OF in the sum is the XOR of OF itself, the carry (which is SF) and 0 (the value

Re: [PATCH 02/22] target/i386: speedup JO/SETO after MUL or IMUL

2023-12-28 Thread Richard Henderson
On 12/23/23 05:15, Paolo Bonzini wrote: OF is equal to the carry flag, so use the same CCPrepare. Signed-off-by: Paolo Bonzini --- target/i386/tcg/translate.c | 3 +++ 1 file changed, 3 insertions(+) Reviewed-by: Richard Henderson r~

Re: [PATCH 03/22] target/i386: remove unnecessary arguments from raise_interrupt

2023-12-28 Thread Richard Henderson
On 12/23/23 05:15, Paolo Bonzini wrote: is_int is always 1, and error_code is always zero. Signed-off-by: Paolo Bonzini --- target/i386/tcg/excp_helper.c | 7 +++ target/i386/tcg/helper-tcg.h | 3 +-- target/i386/tcg/misc_helper.c | 2 +- 3 files changed, 5 insertions(+), 7 deletions(-

Re: [PATCH 04/22] target/i386: remove unnecessary truncations

2023-12-28 Thread Richard Henderson
On 12/23/23 05:15, Paolo Bonzini wrote: gen_lea_v_seg (called by gen_add_A0_ds_seg) already zeroes any bits of s->A0 beyond s->aflag. It does so before summing the segment base and, if not in 64-bit mode, also after summing it. Signed-off-by: Paolo Bonzini --- target/i386/tcg/emit.c.inc | 4

Re: [PATCH 05/22] target/i386: clean up cpu_cc_compute_all

2023-12-28 Thread Richard Henderson
On 12/23/23 05:15, Paolo Bonzini wrote: cpu_cc_compute_all() has an argument that is always equal to CC_OP for historical reasons (dating back to commit a7812ae4123, "TCG variable type checking.", 2008-11-17, which added the argument to helper_cc_compute_all). It does not make sense for the a

Re: [PATCH 06/22] target/i386: document more deviations from the manual

2023-12-28 Thread Richard Henderson
On 12/23/23 05:15, Paolo Bonzini wrote: Signed-off-by: Paolo Bonzini --- target/i386/tcg/decode-new.c.inc | 12 1 file changed, 12 insertions(+) Reviewed-by: Richard Henderson diff --git a/target/i386/tcg/decode-new.c.inc b/target/i386/tcg/decode-new.c.inc index 2bdbb1bba

Re: [PATCH 08/22] target/i386: avoid trunc and ext for MULX and RORX

2023-12-28 Thread Richard Henderson
On 12/23/23 05:15, Paolo Bonzini wrote: Use _tl operations for 32-bit operands on 32-bit targets, and only go through trunc and extu ops for 64-bit targets. While the trunc/ext ops should be pretty much free after optimization, the optimizer also does not like having the same temporary used in m

Re: [PATCH 07/22] target/i386: reimplement check for validity of LOCK prefix

2023-12-28 Thread Richard Henderson
On 12/23/23 05:15, Paolo Bonzini wrote: The previous check erroneously allowed CMP to be modified with LOCK. Instead, tag explicitly the instructions that do support LOCK. Signed-off-by: Paolo Bonzini --- target/i386/tcg/decode-new.c.inc | 17 ++--- target/i386/tcg/decode-new.h

Re: [PATCH 09/22] target/i386: rename zext0/zext2 and make them closer to the manual

2023-12-28 Thread Richard Henderson
On 12/23/23 05:15, Paolo Bonzini wrote: X86_SPECIAL_ZExtOp0 and X86_SPECIAL_ZExtOp2 are poorly named; they are a hack that is needed by scalar insertion and extraction instructions, and not really related to zero extension: for PEXTR the zero extension is done by the generation functions, for PI

Re: [PATCH 10/22] target/i386: add X86_SPECIALs for MOVSX and MOVZX

2023-12-28 Thread Richard Henderson
On 12/23/23 05:15, Paolo Bonzini wrote: Usually the registers are just moved into s->T0 without much care for their operand size. However, in some cases we can get more efficient code if the operand fetching logic syncs with the emission function on what is nicer. All the current uses are mostl

Re: [PATCH 11/22] target/i386: do not decode string source/destination into decode->mem

2023-12-28 Thread Richard Henderson
On 12/23/23 05:15, Paolo Bonzini wrote: decode->mem is only used if one operand has has_ea == true. String operations will not use decode->mem and will load A0 on their own, because they are the only case of two memory operands in a single instruction. Signed-off-by: Paolo Bonzini --- target/

Re: [PATCH 13/22] target/i386: do not clobber T0 on string operations

2023-12-28 Thread Richard Henderson
On 12/23/23 05:15, Paolo Bonzini wrote: The new decoder would rather have the operand in T0 when expanding SCAS, rather than use R_EAX directly as gen_scas currently does. This makes SCAS more similar to CMP and SUB, in that CC_DST = T0 - T1. Signed-off-by: Paolo Bonzini --- target/i386/tcg/

Re: [PATCH 14/22] target/i386: split eflags computation out of gen_compute_eflags

2023-12-28 Thread Richard Henderson
On 12/23/23 05:15, Paolo Bonzini wrote: The new x86 decoder wants the gen_* functions to compute EFLAGS before writeback, which can be an issue for instructions with a memory destination such as ARPL or shifts. Extract code to compute the EFLAGS without clobbering CC_SRC, in case the memory writ

Re: [PATCH 15/22] target/i386: do not use s->tmp4 for push

2023-12-28 Thread Richard Henderson
On 12/23/23 05:15, Paolo Bonzini wrote: Just create a temporary for the occasion. Signed-off-by: Paolo Bonzini --- target/i386/tcg/translate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Reviewed-by: Richard Henderson r~

Re: [PATCH 16/22] target/i386: do not use s->tmp0 for jumps on ECX ==/!= 0

2023-12-28 Thread Richard Henderson
On 12/23/23 05:15, Paolo Bonzini wrote: Create a new temporary, to ease the register allocator's work. Creation of the temporary is pushed into gen_ext_tl, which also allows NULL as the first parameter now. Signed-off-by: Paolo Bonzini --- target/i386/tcg/translate.c | 9 ++--- 1 file ch

Re: [PATCH v3 2/2] linux-user: Fix openat() emulation to not modify atime

2023-12-28 Thread Shu-Chun Weng
Yup, reproduced on a system with glibc built with fortified source. Sending out version 4. On Thu, Dec 28, 2023 at 7:49 AM Helge Deller wrote: > On 12/8/23 23:42, Shu-Chun Weng wrote: > > Commit b8002058 strengthened openat()'s /proc detection by calling > > realpath(3) on the given path, which

[PATCH v4 0/2] linux-user: openat() fixes

2023-12-28 Thread Shu-Chun Weng
Since v3: - Fix build error: ignoring return value of 'readlink' declared with attribute 'warn_unused_result' [-Werror=unused-result] Since v2: - More robust handling of `readlink()` Since v1: - Eliminate static buffers in do_guest_openat() Shu-Chun Weng (2): linux-user: Define TARGET_O_

[PATCH v4 1/2] linux-user: Define TARGET_O_LARGEFILE for aarch64

2023-12-28 Thread Shu-Chun Weng
In 050a1ba, when moving the macros from preprocessor-guarding to file-based definition, TARGET_O_LARGEFILE appeared to have been accidentally left off. This may have correctness implication, but so far I was only confused by strace's output. Fixes: 050a1ba69a ("linux-user: move arm/aarch64/m68k f

[PATCH v4 2/2] linux-user: Fix openat() emulation to not modify atime

2023-12-28 Thread Shu-Chun Weng
Commit b8002058 strengthened openat()'s /proc detection by calling realpath(3) on the given path, which allows various paths and symlinks that points to the /proc file system to be intercepted correctly. Using realpath(3), though, has a side effect that it reads the symlinks along the way, and thu

Qemu setting "-cpu host" seems broken with Windows vms

2023-12-28 Thread xtec
I noticed something weird when using "-cpu host" with Windows vms. First, I always use it along with ",hv_passthrough" as well. First, performance: since some years ago, since prior to qemu 6.2 until latest 8.2, win10 and win11 vms always worked slower than expected. This could be noticed by co

Re: [PATCH 17/22] target/i386: extract gen_far_call/jmp, reordering temporaries

2023-12-28 Thread Richard Henderson
On 12/23/23 05:15, Paolo Bonzini wrote: Extract the code into new functions, and swap T0/T1 so that T0 corresponds to the first immediate in the instruction stream. Signed-off-by: Paolo Bonzini --- target/i386/tcg/translate.c | 90 - 1 file changed, 50 ins

Re: [PATCH 18/22] target/i386: prepare for implementation of STOS/SCAS in new decoder

2023-12-28 Thread Richard Henderson
On 12/23/23 05:15, Paolo Bonzini wrote: Do not use gen_op, and pull the load from the accumulator into disas_insn. Signed-off-by: Paolo Bonzini --- target/i386/tcg/translate.c | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) Reviewed-by: Richard Henderson r~

Re: [PATCH 19/22] target/i386: move operand load and writeback out of gen_cmovcc1

2023-12-28 Thread Richard Henderson
On 12/23/23 05:16, Paolo Bonzini wrote: Similar to gen_setcc1, make gen_cmovcc1 receive TCGv. This is more friendly to simultaneous implementation in the old and the new decoder. A small wart is that s->T0 of CMOV is currently the*second* argument (which would ordinarily be in T1). Therefore,

Re: [PATCH 21/22] target/i386: introduce flags writeback mechanism

2023-12-28 Thread Richard Henderson
On 12/23/23 05:16, Paolo Bonzini wrote: ALU instructions can write to both memory and flags. If the CC_SRC* and CC_DST locations have been written already when a memory access causes a fault, the value in CC_SRC* and CC_DST might be interpreted with the wrong CC_OP (the one that is in effect bef

Re: [PATCH 22/22] target/i386: implement CMPccXADD

2023-12-28 Thread Richard Henderson
On 12/23/23 05:16, Paolo Bonzini wrote: +case JCC_S: +cmp_lhs = s->T0, cmp_rhs = tcg_constant_tl(0); +break; I think you need an sextract here, when ot != full word size, same as JCC_O. Otherwise, Reviewed-by: Richard Henderson r~

Re: [PATCH v2 4/6] target/riscv: Add pointer masking tb flags

2023-12-28 Thread Richard Henderson
On 12/24/23 15:48, Alexey Baturo wrote: From: Alexey Baturo Signed-off-by: Alexey Baturo --- target/riscv/cpu.h| 15 +-- target/riscv/cpu_helper.c | 3 +++ target/riscv/translate.c | 5 + 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/target/ris

Re: [PATCH v2 3/6] target/riscv: Add helper functions to calculate current number of masked bits for pointer masking

2023-12-28 Thread Richard Henderson
On 12/24/23 15:48, Alexey Baturo wrote: From: Alexey Baturo Signed-off-by: Alexey Baturo --- target/riscv/cpu.h| 4 +++ target/riscv/cpu_helper.c | 54 +++ 2 files changed, 58 insertions(+) diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h i

Re: [PATCH v2 5/6] target/riscv: Update address modify functions to take into account pointer masking

2023-12-28 Thread Richard Henderson
On 12/24/23 15:48, Alexey Baturo wrote: From: Alexey Baturo Signed-off-by: Alexey Baturo --- target/riscv/translate.c | 23 +-- target/riscv/vector_helper.c | 10 ++ 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/target/riscv/translate.c b/t

[v2 2/5] target/riscv: Add cycle & instret privilege mode filtering properties

2023-12-28 Thread Atish Patra
From: Kaiwen Xue This adds the properties for ISA extension smcntrpmf. Patches implementing it will follow. Signed-off-by: Atish Patra Signed-off-by: Kaiwen Xue --- target/riscv/cpu.c | 3 ++- target/riscv/cpu_cfg.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/targ

[v2 4/5] target/riscv: Add cycle & instret privilege mode filtering support

2023-12-28 Thread Atish Patra
From: Kaiwen Xue QEMU only calculates dummy cycles and instructions, so there is no actual means to stop the icount in QEMU. Hence this patch merely adds the functionality of accessing the cfg registers, and cause no actual effects on the counting of cycle and instret counters. Signed-off-by: At

[v2 1/5] target/riscv: Fix the predicate functions for mhpmeventhX CSRs

2023-12-28 Thread Atish Patra
mhpmeventhX CSRs are available for RV32. The predicate function should check that first before checking sscofpmf extension. Fixes: 14664483457b ("target/riscv: Add sscofpmf extension support") Signed-off-by: Atish Patra --- target/riscv/csr.c | 67 ++

[v2 0/5] Add ISA extension smcntrpmf support

2023-12-28 Thread Atish Patra
This patch series adds the support for RISC-V ISA extension smcntrpmf (cycle and privilege mode filtering) [1]. It is based on Kevin's earlier work but improves it by actually implement privilege mode filtering by tracking the privilege mode switches. This enables the privilege mode filtering for m

[v2 3/5] target/riscv: Add cycle & instret privilege mode filtering definitions

2023-12-28 Thread Atish Patra
From: Kaiwen Xue This adds the definitions for ISA extension smcntrpmf. Signed-off-by: Kaiwen Xue Signed-off-by: Atish Patra --- target/riscv/cpu.c | 1 - target/riscv/cpu.h | 6 ++ target/riscv/cpu_bits.h | 29 + 3 files changed, 35 insertions(+),

[v2 5/5] target/riscv: Implement privilege mode filtering for cycle/instret

2023-12-28 Thread Atish Patra
Privilege mode filtering can also be emulated for cycle/instret by tracking host_ticks/icount during each privilege mode switch. This patch implements that for both cycle/instret and mhpmcounters. The first one requires Smcntrpmf while the other one requires Sscofpmf to be enabled. The cycle/instr

[v2 5/5] target/riscv: Implement privilege mode filtering for cycle/instret

2023-12-28 Thread Atish Patra
Privilege mode filtering can also be emulated for cycle/instret by tracking host_ticks/icount during each privilege mode switch. This patch implements that for both cycle/instret and mhpmcounters. The first one requires Smcntrpmf while the other one requires Sscofpmf to be enabled. The cycle/instr

[v2 3/5] target/riscv: Add cycle & instret privilege mode filtering definitions

2023-12-28 Thread Atish Patra
From: Kaiwen Xue This adds the definitions for ISA extension smcntrpmf. Signed-off-by: Kaiwen Xue Signed-off-by: Atish Patra --- target/riscv/cpu.c | 1 - target/riscv/cpu.h | 6 ++ target/riscv/cpu_bits.h | 29 + 3 files changed, 35 insertions(+),

[v2 1/5] target/riscv: Fix the predicate functions for mhpmeventhX CSRs

2023-12-28 Thread Atish Patra
mhpmeventhX CSRs are available for RV32. The predicate function should check that first before checking sscofpmf extension. Fixes: 14664483457b ("target/riscv: Add sscofpmf extension support") Signed-off-by: Atish Patra --- target/riscv/csr.c | 67 ++

[v2 0/5] Add ISA extension smcntrpmf support

2023-12-28 Thread Atish Patra
This patch series adds the support for RISC-V ISA extension smcntrpmf (cycle and privilege mode filtering) [1]. It is based on Kevin's earlier work but improves it by actually implement privilege mode filtering by tracking the privilege mode switches. This enables the privilege mode filtering for m

[v2 4/5] target/riscv: Add cycle & instret privilege mode filtering support

2023-12-28 Thread Atish Patra
From: Kaiwen Xue QEMU only calculates dummy cycles and instructions, so there is no actual means to stop the icount in QEMU. Hence this patch merely adds the functionality of accessing the cfg registers, and cause no actual effects on the counting of cycle and instret counters. Signed-off-by: At

[v2 2/5] target/riscv: Add cycle & instret privilege mode filtering properties

2023-12-28 Thread Atish Patra
From: Kaiwen Xue This adds the properties for ISA extension smcntrpmf. Patches implementing it will follow. Signed-off-by: Atish Patra Signed-off-by: Kaiwen Xue --- target/riscv/cpu.c | 3 ++- target/riscv/cpu_cfg.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/targ

Re: [PATCH v3 52/70] i386/tdx: handle TDG.VP.VMCALL

2023-12-28 Thread Xiaoyao Li
On 11/16/2023 1:58 AM, Daniel P. Berrangé wrote: On Wed, Nov 15, 2023 at 02:15:01AM -0500, Xiaoyao Li wrote: From: Isaku Yamahata For GetQuote, delegate a request to Quote Generation Service. Add property "quote-generation-socket" to tdx-guest, whihc is a property of type SocketAddress to spec

RE: [PATCH 1/3] ui/gtk: flush display pipeline before saving vmstate when blob=true

2023-12-28 Thread Kasireddy, Vivek
Hi, > > On Thu, Dec 14, 2023 at 8:26 AM Dongwon Kim > wrote: > > > > If the guest state is paused before it gets a response for the current > > scanout frame submission (resource-flush), it won't flush new frames > > after being restored as it still waits for the old response, which is > > accep

Re: [PATCH v3 2/2] target/i386: add control bits support for LAM

2023-12-28 Thread Xiaoyao Li
On 7/21/2023 4:08 PM, Binbin Wu wrote: LAM uses CR3[61] and CR3[62] to configure/enable LAM on user pointers. LAM uses CR4[28] to configure/enable LAM on supervisor pointers. For CR3 LAM bits, no additional handling needed: - TCG LAM is not supported for TCG of target-i386. helper_write_crN(

Re: [PATCH v3 1/2] target/i386: add support for LAM in CPUID enumeration

2023-12-28 Thread Xiaoyao Li
On 7/21/2023 4:07 PM, Binbin Wu wrote: From: Robert Hoo Linear Address Masking (LAM) is a new Intel CPU feature, which allows software to use of the untranslated address bits for metadata. The bit definition: CPUID.(EAX=7,ECX=1):EAX[26] Add CPUID definition for LAM. Note LAM feature is not s

[PATCH v3 2/9] target/loongarch: Define some kvm_arch interfaces

2023-12-28 Thread Tianrui Zhao
Define some functions in target/loongarch/kvm.c, such as kvm_arch_put_registers, kvm_arch_get_registers and kvm_arch_handle_exit, etc. which are needed by kvm/kvm-all.c. Now the most functions has no content and they will be implemented in the next patches. Signed-off-by: Tianrui Zhao Signed-off-

[PATCH v3 9/9] target/loongarch: Add loongarch kvm into meson build

2023-12-28 Thread Tianrui Zhao
Add kvm.c into meson.build to compile it when kvm is configed. Meanwhile in meson.build, we set the kvm_targets to loongarch64-softmmu when the cpu is loongarch. And fix the compiling error when config is enable-kvm,disable-tcg. Signed-off-by: Tianrui Zhao Signed-off-by: xianglai li Reviewed-by:

[PATCH v3 5/9] target/loongarch: Implement kvm_arch_init function

2023-12-28 Thread Tianrui Zhao
Implement the kvm_arch_init of loongarch, in the function, the KVM_CAP_MP_STATE cap is checked by kvm ioctl. Signed-off-by: Tianrui Zhao Signed-off-by: xianglai li Reviewed-by: Richard Henderson --- target/loongarch/kvm.c | 1 + 1 file changed, 1 insertion(+) diff --git a/target/loongarch/kvm

[PATCH v3 4/9] target/loongarch: Implement kvm get/set registers

2023-12-28 Thread Tianrui Zhao
Implement kvm_arch_get/set_registers interfaces, many regs can be get/set in the function, such as core regs, csr regs, fpu regs, mp state, etc. Signed-off-by: Tianrui Zhao Signed-off-by: xianglai li --- meson.build | 1 + target/loongarch/cpu.c| 3 + target/loonga

[PATCH v3 0/9] Add loongarch kvm accel support

2023-12-28 Thread Tianrui Zhao
The linux headers in this patch synchronized from linux kernel v6.7.0-rc7, and the loongarch kvm part of this patch series based on the header files. And the linux kernel has added the loongarch kvm support in master branch. This series add loongarch kvm support, mainly implement some interfaces u

[PATCH v3 7/9] target/loongarch: Implement kvm_arch_handle_exit

2023-12-28 Thread Tianrui Zhao
Implement kvm_arch_handle_exit for loongarch. In this function, the KVM_EXIT_LOONGARCH_IOCSR is handled, we read or write the iocsr address space by the addr, length and is_write argument in kvm_run. Signed-off-by: Tianrui Zhao Signed-off-by: xianglai li Reviewed-by: Richard Henderson --- targ

[PATCH v3 6/9] target/loongarch: Implement kvm_arch_init_vcpu

2023-12-28 Thread Tianrui Zhao
Implement kvm_arch_init_vcpu interface for loongarch, in this function, we register VM change state handler. And when VM state changes to running, the counter value should be put into kvm to keep consistent with kvm, and when state change to stop, counter value should be refreshed from kvm. Signed

[PATCH v3 3/9] target/loongarch: Supplement vcpu env initial when vcpu reset

2023-12-28 Thread Tianrui Zhao
Supplement vcpu env initial when vcpu reset, including init vcpu CSR_CPUID,CSR_TID to cpu->cpu_index. The two regs will be used in kvm_get/set_csr_ioctl. Signed-off-by: Tianrui Zhao Signed-off-by: xianglai li --- target/loongarch/cpu.c | 2 ++ target/loongarch/cpu.h | 2 +- 2 files changed, 3 i

[PATCH v3 1/9] linux-headers: Synchronize linux headers from linux v6.7.0-rc7

2023-12-28 Thread Tianrui Zhao
Use the scripts/update-linux-headers.sh to synchronize linux headers from linux v6.7.0-rc7. We mainly want to add the loongarch linux headers and then add the loongarch kvm support based on it. Signed-off-by: Tianrui Zhao --- include/standard-headers/drm/drm_fourcc.h | 2 + include/standar

[PATCH v3 8/9] target/loongarch: Implement set vcpu intr for kvm

2023-12-28 Thread Tianrui Zhao
Implement loongarch kvm set vcpu interrupt interface, when a irq is set in vcpu, we use the KVM_INTERRUPT ioctl to set intr into kvm. Signed-off-by: Tianrui Zhao Signed-off-by: xianglai li --- target/loongarch/cpu.c | 32 +++- target/loongarch/kvm.c

[PATCH 14/21] parallels: Make a loaded dirty bitmap persistent

2023-12-28 Thread Alexander Ivanov
After bitmap loading the bitmap is not persistent and is removed on image saving. Set bitmap persistence to true. Signed-off-by: Alexander Ivanov --- block/parallels-ext.c | 1 + 1 file changed, 1 insertion(+) diff --git a/block/parallels-ext.c b/block/parallels-ext.c index 033ca3ec3a..2a7ff6e3

[PATCH 15/21] parallels: Reverse a conditional in parallels_check_leak() to reduce indents

2023-12-28 Thread Alexander Ivanov
Let the function return a success code if a file size is not bigger than image_end_offset. Thus we can decrease indents in the next code block. Signed-off-by: Alexander Ivanov --- block/parallels.c | 72 +++ 1 file changed, 36 insertions(+), 36 deletio

[PATCH 09/21] parallels: Add a note about used bitmap in parallels_check_duplicate()

2023-12-28 Thread Alexander Ivanov
In parallels_check_duplicate() We use a bitmap for duplication detection. This bitmap is not related to used_bmap field in BDRVParallelsState. Add a comment about it to avoid confusion. Signed-off-by: Alexander Ivanov --- block/parallels.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-

[PATCH 04/21] parallels: Limit search in parallels_mark_used to the last marked claster

2023-12-28 Thread Alexander Ivanov
There is no necessity to search to the end of the bitmap. Limit the search area as cluster_index + count. Add cluster_end variable to avoid its calculation in a few places. Signed-off-by: Alexander Ivanov --- block/parallels.c | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff

[PATCH 13/21] parallels: Handle L1 entries equal to one

2023-12-28 Thread Alexander Ivanov
If all the bits in a dirty bitmap cluster are ones, the cluster shouldn't be written. Instead the corresponding L1 entry should be set to 1. Check if all bits in a memory region are ones and set 1 to L1 entries corresponding clusters filled with ones. Signed-off-by: Alexander Ivanov --- block/p

[PATCH 20/21] tests: Turned on 256, 299, 304 and block-status-cache for parallels format

2023-12-28 Thread Alexander Ivanov
These tests pass with parallels format. Add parallels to supporting formats for these tests. Signed-off-by: Alexander Ivanov --- tests/qemu-iotests/256 | 2 +- tests/qemu-iotests/299 | 2 +- tests/qemu-iotests/304 | 2 +- tests/qemu-

[PATCH 06/21] parallels: Move host clusters allocation to a separate function

2023-12-28 Thread Alexander Ivanov
For parallels images extensions we need to allocate host clusters without any connection to BAT. Move host clusters allocation code to parallels_allocate_host_clusters(). This function can be called not only from coroutines so all the *_co_* functions were replaced by corresponding wrappers. Sign

[PATCH 05/21] parallels: Add parallels_mark_unused() helper

2023-12-28 Thread Alexander Ivanov
Add a helper to set unused areas in the used bitmap. Signed-off-by: Alexander Ivanov --- block/parallels.c | 18 ++ block/parallels.h | 2 ++ 2 files changed, 20 insertions(+) diff --git a/block/parallels.c b/block/parallels.c index 4470519656..13726fb3d5 100644 --- a/block/par

[PATCH 18/21] parallels: Remove unnecessary data_end field

2023-12-28 Thread Alexander Ivanov
Since we have used bitmap, field data_end in BDRVParallelsState is redundant and can be removed. Add parallels_data_end() helper and remove data_end handling. Signed-off-by: Alexander Ivanov --- block/parallels.c | 33 + block/parallels.h | 1 - 2 files changed,

[PATCH 10/21] parallels: Create used bitmap even if checks needed

2023-12-28 Thread Alexander Ivanov
All the checks were fixed to work with used bitmap. Create used bitmap in parallels_open() even if need_check is true. Signed-off-by: Alexander Ivanov --- block/parallels.c | 10 -- 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/block/parallels.c b/block/parallels.c index

[PATCH 17/21] parallels: Check unused clusters in parallels_check_leak()

2023-12-28 Thread Alexander Ivanov
Since we have used bitmap, leak check is useless. Transform parallels_truncate_unused_clusters() to parallels_check_unused_clusters() helper and use it in leak check. Signed-off-by: Alexander Ivanov --- block/parallels.c | 121 +- 1 file changed, 67 in

[PATCH 11/21] parallels: Add dirty bitmaps saving

2023-12-28 Thread Alexander Ivanov
Now dirty bitmaps can be loaded but there is no their saving. Add code for dirty bitmap storage. Signed-off-by: Alexander Ivanov --- block/parallels-ext.c | 168 ++ block/parallels.c | 16 +++- block/parallels.h | 5 ++ 3 files changed, 187 inse

[PATCH 01/21] parallels: Set s->used_bmap to NULL in parallels_free_used_bitmap()

2023-12-28 Thread Alexander Ivanov
After used bitmap freeng s->used_bmap points to the freed memory. If we try to free used bitmap one more time it leads to double free error. Set s->used_bmap to NULL to exclude double free error. Signed-off-by: Alexander Ivanov Reviewed-by: Denis V. Lunev --- block/parallels.c | 1 + 1 file ch

[PATCH 19/21] tests: Add parallels images support to test 165

2023-12-28 Thread Alexander Ivanov
Use a different bitmap name for parallels images because their has own ID format, and can't contain an arbitrary string. Replace image reopen by shutdown/launch VM because parallels images doesn't support reopen. Signed-off-by: Alexander Ivanov --- tests/qemu-iotests/165 | 40 ++

[PATCH 21/21] tests: Add parallels format support to image-fleecing

2023-12-28 Thread Alexander Ivanov
Use a different bitmap name for parallels images because their has own ID format, and can't contain an arbitrary string. Replace hardcoded 'qcow2' format to iotests.imgfmt. Add 'parallels' to supported formats. Signed-off-by: Alexander Ivanov --- tests/qemu-iotests/tests/image-fleecing | 13 ++

[PATCH 02/21] parallels: Move inactivation code to a separate function

2023-12-28 Thread Alexander Ivanov
We are going to add parallels image extensions storage and need a separate function for inactivation code. Signed-off-by: Alexander Ivanov Reviewed-by: Denis V. Lunev --- block/parallels.c | 22 -- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/block/parallel

[PATCH 07/21] parallels: Set data_end value in parallels_check_leak()

2023-12-28 Thread Alexander Ivanov
In parallels_check_leak() we change file size but don't correct data_end field of BDRVParallelsState structure. Fix it. Signed-off-by: Alexander Ivanov --- block/parallels.c | 1 + 1 file changed, 1 insertion(+) diff --git a/block/parallels.c b/block/parallels.c index 658902ae51..8a6e2ba7ee 100

[PATCH 08/21] parallels: Recreate used bitmap in parallels_check_leak()

2023-12-28 Thread Alexander Ivanov
In parallels_check_leak() file can be truncated. In this case the used bitmap would not comply to the file. Recreate the bitmap after file truncation. Signed-off-by: Alexander Ivanov --- block/parallels.c | 8 1 file changed, 8 insertions(+) diff --git a/block/parallels.c b/block/paral

[PATCH 12/21] parallels: Let image extensions work in RW mode

2023-12-28 Thread Alexander Ivanov
Now we support extensions saving and can let to work with them in read-write mode. Signed-off-by: Alexander Ivanov --- block/parallels-ext.c | 4 block/parallels.c | 17 - 2 files changed, 4 insertions(+), 17 deletions(-) diff --git a/block/parallels-ext.c b/block/para

[PATCH 03/21] parallels: Make mark_used() a global function

2023-12-28 Thread Alexander Ivanov
We will need this function and a function for marking unused clusters (will be added in the next patch) in parallels-ext.c too. Let it be a global function parallels_mark_used(). Signed-off-by: Alexander Ivanov Reviewed-by: Denis V. Lunev --- block/parallels.c | 14 -- block/paralle

[PATCH 16/21] parallels: Truncate images on the last used cluster

2023-12-28 Thread Alexander Ivanov
On an image closing there can be unused clusters in the end of the image. Truncate these clusters and update data_end field. Signed-off-by: Alexander Ivanov --- block/parallels.c | 20 ++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/block/parallels.c b/block/p

Re: [PATCH] q800: move dp8393x_prom memory region to Q800MachineState

2023-12-28 Thread Philippe Mathieu-Daudé
On 27/12/23 22:02, Mark Cave-Ayland wrote: There is no need to dynamically allocate the memory region from the heap. Signed-off-by: Mark Cave-Ayland --- hw/m68k/q800.c | 7 +++ include/hw/m68k/q800.h | 1 + 2 files changed, 4 insertions(+), 4 deletions(-) @@ -406,13 +405,13

Re: [PATCH 01/21] parallels: Set s->used_bmap to NULL in parallels_free_used_bitmap()

2023-12-28 Thread Alexander Ivanov
Sorry, incorrect patch set, please ignore. On 12/28/23 10:41, Alexander Ivanov wrote: After used bitmap freeng s->used_bmap points to the freed memory. If we try to free used bitmap one more time it leads to double free error. Set s->used_bmap to NULL to exclude double free error. Signed-off-b

[PATCH v4 01/21] parallels: Set s->used_bmap to NULL in parallels_free_used_bitmap()

2023-12-28 Thread Alexander Ivanov
After used bitmap freeng s->used_bmap points to the freed memory. If we try to free used bitmap one more time it leads to double free error. Set s->used_bmap to NULL to exclude double free error. Signed-off-by: Alexander Ivanov Reviewed-by: Denis V. Lunev --- block/parallels.c | 1 + 1 file ch

[PATCH v4 07/21] parallels: Set data_end value in parallels_check_leak()

2023-12-28 Thread Alexander Ivanov
In parallels_check_leak() we change file size but don't correct data_end field of BDRVParallelsState structure. Fix it. Signed-off-by: Alexander Ivanov --- block/parallels.c | 1 + 1 file changed, 1 insertion(+) diff --git a/block/parallels.c b/block/parallels.c index 658902ae51..8a6e2ba7ee 100

[PATCH v4 03/21] parallels: Make mark_used() a global function

2023-12-28 Thread Alexander Ivanov
We will need this function and a function for marking unused clusters (will be added in the next patch) in parallels-ext.c too. Let it be a global function parallels_mark_used(). Signed-off-by: Alexander Ivanov Reviewed-by: Denis V. Lunev --- block/parallels.c | 14 -- block/paralle

[PATCH v4 00/21] parallels: Add full dirty bitmap support

2023-12-28 Thread Alexander Ivanov
Parallels format driver: * make some preparation * add dirty bitmap saving * make dirty bitmap RW * fix broken checks * refactor leak check * add parallels format support to several tests You could find these patches in my repo: https://github.com/AlexanderIvanov-Virtuozzo/qemu/tree/parallels-v4

[PATCH v4 16/21] parallels: Truncate images on the last used cluster

2023-12-28 Thread Alexander Ivanov
On an image closing there can be unused clusters in the end of the image. Truncate these clusters and update data_end field. Signed-off-by: Alexander Ivanov --- block/parallels.c | 20 ++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/block/parallels.c b/block/p

[PATCH v4 18/21] parallels: Remove unnecessary data_end field

2023-12-28 Thread Alexander Ivanov
Since we have used bitmap, field data_end in BDRVParallelsState is redundant and can be removed. Add parallels_data_end() helper and remove data_end handling. Signed-off-by: Alexander Ivanov --- block/parallels.c | 33 + block/parallels.h | 1 - 2 files changed,

[PATCH v4 15/21] parallels: Reverse a conditional in parallels_check_leak() to reduce indents

2023-12-28 Thread Alexander Ivanov
Let the function return a success code if a file size is not bigger than image_end_offset. Thus we can decrease indents in the next code block. Signed-off-by: Alexander Ivanov --- block/parallels.c | 72 +++ 1 file changed, 36 insertions(+), 36 deletio

[PATCH v4 06/21] parallels: Move host clusters allocation to a separate function

2023-12-28 Thread Alexander Ivanov
For parallels images extensions we need to allocate host clusters without any connection to BAT. Move host clusters allocation code to parallels_allocate_host_clusters(). This function can be called not only from coroutines so all the *_co_* functions were replaced by corresponding wrappers. Sign

[PATCH v4 08/21] parallels: Recreate used bitmap in parallels_check_leak()

2023-12-28 Thread Alexander Ivanov
In parallels_check_leak() file can be truncated. In this case the used bitmap would not comply to the file. Recreate the bitmap after file truncation. Signed-off-by: Alexander Ivanov --- block/parallels.c | 8 1 file changed, 8 insertions(+) diff --git a/block/parallels.c b/block/paral

  1   2   >