Re: [PATCH v21 00/13] Add LoongArch linux-user emulation support

2022-07-03 Thread Richard Henderson
On 7/4/22 09:27, gaosong wrote: Hi, Richard On 2022/7/3 下午4:59, Richard Henderson wrote: Hi.  This is Song Gao's v20 [1], with patch 2 extensively rewritten so that it handles lock_user properly.  It compiles, but I need to update the docker image we produced last year so that I can properly

Re: [PATCH v2 00/11] Fix bugs for LoongArch virt machine

2022-07-03 Thread Richard Henderson
On 7/1/22 15:03, Xiaojuan Yang wrote: This series fix some bugs for LoongArch virt machine. Including RTC device emulation, ECFG reg emulation, timer clear function, and IPI device function, etc. Xiaojuan Yang (11): hw/rtc/ls7a_rtc: Fix uninitialied bugs and toymatch writing function

Re: [PATCH 11/11] hw/intc/loongarch_ipi: Fix mail send and any send function

2022-07-03 Thread Richard Henderson
On 7/1/22 15:04, Xiaojuan Yang wrote: By the document of ipi mailsend device, byte is written only when the mask bit is 0. The original code discards mask bit and overwrite the data always, this patch fixes the issue. Signed-off-by: Xiaojuan Yang --- hw/intc/loongarch_ipi.c | 45

Re: [PATCH 10/11] hw/intc/loongarch_ipi: Fix ipi device access of 64bits

2022-07-03 Thread Richard Henderson
On 7/1/22 15:04, Xiaojuan Yang wrote: +static const MemoryRegionOps loongarch_ipi64_ops = { +.write = loongarch_ipi_writeq, +.impl.min_access_size = 8, +.impl.max_access_size = 8, +.valid.min_access_size = 4, +.valid.max_access_size = 8, +.endianness =

Re: [PATCH 08/11] target/loongarch: Fix the meaning of ECFG reg's VS field

2022-07-03 Thread Richard Henderson
On 7/1/22 15:04, Xiaojuan Yang wrote: By the manual of LoongArch CSR, the VS field(18:16 bits) of ECFG reg means that the number of instructions between each exception entry is 2^VS. Is it a typo in the manual that says "2VS", i.e. multiplication? If so, Reviewed-by: Richard Henderson r~

Re: [PATCH] hw/intc: loongarch_pch_msi: Fix msi vector convertion

2022-07-03 Thread Richard Henderson
On 7/1/22 08:37, Mao Bibo wrote: Loongarch pch msi intc connects to extioi controller, the range of irq number is 64-255. Here adds irqbase property for loongarch pch msi controller, we can get irq offset from view of pch_msi controller with the method: msi vector (from view of upper extioi

Re: [PATCH 07/11] hw/rtc/ls7a_rtc: Fix 'calculate' spelling errors

2022-07-03 Thread Richard Henderson
On 7/1/22 15:04, Xiaojuan Yang wrote: Fix 'calculate' spelling errors. Signed-off-by: Xiaojuan Yang Reviewed-by: Richard Henderson r~

Re: [PATCH 06/11] hw/rtc/ls7a_rtc: Use tm struct pointer as arguments in toy_time_to_val()

2022-07-03 Thread Richard Henderson
On 7/1/22 15:04, Xiaojuan Yang wrote: Use pointer as arguments in toy_time_to_val() instead of struct tm. Signed-off-by: Xiaojuan Yang --- hw/rtc/ls7a_rtc.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) Reviewed-by: Richard Henderson r~

Re: [PATCH 09/11] target/loongarch: Add lock when writing timer clear reg

2022-07-03 Thread Richard Henderson
On 7/1/22 15:04, Xiaojuan Yang wrote: There is such error info when running linux kernel: tcg_handle_interrupt: assertion failed: (qemu_mutex_iothread_locked()). calling stack: #0 in raise () at /lib64/libc.so.6 #1 in abort () at /lib64/libc.so.6 #2 in

Re: [PATCH 02/11] hw/rtc/ls7a_rtc: Fix timer call back function

2022-07-03 Thread Richard Henderson
On 7/1/22 15:03, Xiaojuan Yang wrote: Replace qemu_irq_pulse with qemu_irq_raise in ls7a_timer_cb function to keep consistent with hardware behavior when raise irq. Signed-off-by: Xiaojuan Yang Reviewed-by: Richard Henderson r~

Re: [PATCH 05/11] hw/rtc/ls7a_rtc: Fix rtc enable and disable function

2022-07-03 Thread Richard Henderson
On 7/1/22 15:04, Xiaojuan Yang wrote: Fix ls7a rtc enable and disable function. When rtc disabled, it do not support to read or write, but the real time is still continue, so we need not neither save the time nor update the rtc offset. Signed-off-by: Xiaojuan Yang --- hw/rtc/ls7a_rtc.c | 60

Re: [PATCH 01/11] hw/rtc/ls7a_rtc: Fix uninitialied bugs and toymatch writing function

2022-07-03 Thread Richard Henderson
On 7/1/22 15:03, Xiaojuan Yang wrote: 1. Initialize the tm struct in toymatch_write() and ls7a_toy_start() to fix uninitialized bugs. 2. Fix toymatch_val_to_time function. By the document, when we calculate the expiration year, we should first get current year, and replace the 0-5

Re: [PATCH 03/11] hw/rtc/ls7a_rtc: Remove unimplemented device in realized function

2022-07-03 Thread Richard Henderson
On 7/1/22 15:03, Xiaojuan Yang wrote: Remove the unimplemented device when realized ls7a RTC, as it is not uesd. Signed-off-by: Xiaojuan Yang --- hw/rtc/ls7a_rtc.c | 1 - 1 file changed, 1 deletion(-) Reviewed-by: Richard Henderson r~

Re: [PATCH v5 07/12] net: stream: add unix socket

2022-07-03 Thread Markus Armbruster
Laurent Vivier writes: > On 30/06/2022 11:28, Dr. David Alan Gilbert wrote: >> * Laurent Vivier (lviv...@redhat.com) wrote: >>> Signed-off-by: Laurent Vivier >>> Reviewed-by: Stefano Brivio >>> --- >>> net/stream.c| 106 +--- >>>

Re: [RFC PATCH v4 10/11] qemu-sockets: introduce socket_uri()

2022-07-03 Thread Markus Armbruster
Laurent Vivier writes: > On 29/06/2022 13:26, Markus Armbruster wrote: >> Laurent Vivier writes: >> >>> Format a string URI from a SocketAddress. >>> >>> Original code from hmp-cmds.c:SocketAddress_to_str() >>> >>> Replace 'tcp:' by 'inet:' (because 'inet' can be also 'udp'). >> >> This one's

Re: [PULL 14/15] qdev: Base object creation on QDict rather than QemuOpts

2022-07-03 Thread Markus Armbruster
Peter Maydell writes: > On Fri, 15 Oct 2021 at 16:01, Kevin Wolf wrote: >> QDicts are both what QMP natively uses and what the keyval parser >> produces. Going through QemuOpts isn't useful for either one, so switch >> the main device creation function to QDicts. By sharing more code with >>

Re: [PATCH v21 00/13] Add LoongArch linux-user emulation support

2022-07-03 Thread gaosong
Hi, Richard On 2022/7/3 下午4:59, Richard Henderson wrote: Hi. This is Song Gao's v20 [1], with patch 2 extensively rewritten so that it handles lock_user properly. It compiles, but I need to update the docker image we produced last year so that I can properly test this. In the meantime, Song,

Re: [PATCH v2] hw/nvme: Use ioeventfd to handle doorbell updates

2022-07-03 Thread Jinhao Fan
at 12:04 AM, Keith Busch wrote: > On Thu, Jun 30, 2022 at 11:22:31AM +0800, Jinhao Fan wrote: >> +static int nvme_init_sq_ioeventfd(NvmeSQueue *sq) >> +{ >> +NvmeCtrl *n = sq->ctrl; >> +uint16_t offset = sq->sqid << 3; >> +int ret; >> + >> +ret = event_notifier_init(>notifier,

[PATCH v3] hw/nvme: Use ioeventfd to handle doorbell updates

2022-07-03 Thread Jinhao Fan
Add property "ioeventfd" which is enabled by default. When this is enabled, updates on the doorbell registers will cause KVM to signal an event to the QEMU main loop to handle the doorbell updates. Therefore, instead of letting the vcpu thread run both guest VM and IO emulation, we now use the

Re: [PATCH v2 03/11] goldfish_rtc: Add endianness property

2022-07-03 Thread Anup Patel
On Mon, Jul 4, 2022 at 2:59 AM Stafford Horne wrote: > > Add an endianness property to allow configuring the RTC as either > native, little or big endian. > > Cc: Laurent Vivier > Signed-off-by: Stafford Horne Looks good to me. Reviewed-by: Anup Patel Regards, Anup > --- >

[PATCH v2 1/1] qga: add command 'guest-get-cpustats'

2022-07-03 Thread zhenwei pi
A vCPU thread always reaches 100% utilization when: - guest uses idle=poll - disable HLT vm-exit - enable MWAIT Add new guest agent command 'guest-get-cpustats' to get guest CPU statistics, we can know the guest workload and how busy the CPU is. Signed-off-by: zhenwei pi ---

[PATCH v2 0/1] qga: add command 'guest-get-cpustats'

2022-07-03 Thread zhenwei pi
v1 -> v2: - Konstantin & Marc-André pointed out that the structure 'GuestCpuStats' is too *linux style*, so re-define it to 'GuestLinuxCpuStats', and use an union type of 'GuestCpuStats'. - Modify comment info from 'man proc', also add linux version infomation. - Test sscanf return value by

Re: [PATCH v9 1/2] target/riscv: Update [m|h]tinst CSR in riscv_cpu_do_interrupt()

2022-07-03 Thread dramforever
On 7/4/22 10:17, Alistair Francis wrote: > On Thu, Jun 30, 2022 at 4:13 PM Anup Patel wrote: >> We should write transformed instruction encoding of the trapped >> instruction in [m|h]tinst CSR at time of taking trap as defined >> by the RISC-V privileged specification v1.12. >> >> Reviewed-by:

Re: [PATCH v9 1/2] target/riscv: Update [m|h]tinst CSR in riscv_cpu_do_interrupt()

2022-07-03 Thread Alistair Francis
On Thu, Jun 30, 2022 at 4:13 PM Anup Patel wrote: > > We should write transformed instruction encoding of the trapped > instruction in [m|h]tinst CSR at time of taking trap as defined > by the RISC-V privileged specification v1.12. > > Reviewed-by: Alistair Francis > Signed-off-by: Anup Patel

Re: [PATCH v5 07/10] block: Implement bdrv_{pread, pwrite, pwrite_zeroes}() using generated_co_wrapper

2022-07-03 Thread Alberto Faria
On Thu, Jun 23, 2022 at 10:47 PM Eric Blake wrote: > I did not get through all of the callers (you are right, there ARE a > lot), but the ones I checked, particularly in block/qcow2-*.c, appear > to handle -EIO just fine. > > I did notice, however, that qcow2-bitmap.c:free_bitmap_clusters() >

Re: [PATCH 00/18] Make block-backend-io.h API more consistent

2022-07-03 Thread Alberto Faria
On Sat, Jul 2, 2022 at 3:12 PM Paolo Bonzini wrote: > Alberto, does this need a rebase? This applies cleanly on "[PATCH v5 00/10] Implement bdrv_{pread,pwrite,pwrite_sync,pwrite_zeroes}() using generated_co_wrapper" [1], which applies cleanly to master. Alberto [1]

Re: [RFC 4/8] Fix some direct calls from non-coroutine_fn to coroutine_fn

2022-07-03 Thread Alberto Faria
On Sat, Jul 2, 2022 at 3:13 PM Paolo Bonzini wrote: > These functions should be coroutine_fn (all coroutine entry points > should be). Thanks, I see now that you fixed this in [1]. Alberto [1] https://patchew.org/QEMU/20220509103019.215041-1-pbonz...@redhat.com/

[PATCH v2 11/11] docs/system: openrisc: Add OpenRISC documentation

2022-07-03 Thread Stafford Horne
Signed-off-by: Stafford Horne --- docs/system/openrisc/cpu-features.rst | 15 ++ docs/system/openrisc/emulation.rst| 17 +++ docs/system/openrisc/or1k-sim.rst | 43 docs/system/openrisc/virt.rst | 50 +++ docs/system/target-openrisc.rst

[PATCH v2 10/11] hw/openrisc: virt: pass random seed to fdt

2022-07-03 Thread Stafford Horne
From: "Jason A. Donenfeld" If the FDT contains /chosen/rng-seed, then the Linux RNG will use it to initialize early. Set this using the usual guest random number generation function. This is confirmed to successfully initialize the RNG on Linux 5.19-rc2. Cc: Stafford Horne Signed-off-by: Jason

[PATCH v2 08/11] target/openrisc: Enable MTTCG

2022-07-03 Thread Stafford Horne
This patch enables multithread TCG for OpenRISC. Since the or1k shared syncrhonized timer can be updated from each vCPU via helpers we use a mutex to synchronize updates. Signed-off-by: Stafford Horne --- configs/targets/or1k-softmmu.mak | 1 + hw/openrisc/cputimer.c | 17

[PATCH v2 09/11] target/openrisc: Interrupt handling fixes

2022-07-03 Thread Stafford Horne
When running SMP systems we sometimes were seeing lockups where IPI interrupts were being raised by never handled. This looks to be caused by 2 issues in the openrisc interrupt handling logic. 1. After clearing an interrupt the openrisc_cpu_set_irq handler will always clear PICSR. This is

[PATCH v2 04/11] hw/openrisc: Add the OpenRISC virtual machine

2022-07-03 Thread Stafford Horne
This patch adds the OpenRISC virtual machine 'virt' for OpenRISC. This platform allows for a convenient CI platform for toolchain, software ports and the OpenRISC linux kernel port. Much of this has been sourced from the m68k and riscv virt platforms. The platform provides: - OpenRISC SMP with

[PATCH v2 06/11] hw/openrisc: Initialize timer time at startup

2022-07-03 Thread Stafford Horne
The last_clk time was initialized at zero, this means when we calculate the first delta we will calculate 0 vs current time which could cause unnecessary hops. Initialize last_clk to the qemu clock on initialization. Signed-off-by: Stafford Horne --- hw/openrisc/cputimer.c | 1 + 1 file

[PATCH v2 07/11] target/openrisc: Add interrupted CPU to log

2022-07-03 Thread Stafford Horne
When we are tracing it's helpful to know which CPU's are getting interrupted, att that detail to the log line. Signed-off-by: Stafford Horne --- target/openrisc/interrupt.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/target/openrisc/interrupt.c

[PATCH v2 05/11] hw/openrisc: Add PCI bus support to virt

2022-07-03 Thread Stafford Horne
This is mostly borrowed from xtensa and riscv as examples. The create_pcie_irq_map swizzle function is almost and exact copy but here we use a single cell interrupt, possibly we can make this generic. Signed-off-by: Stafford Horne --- hw/openrisc/Kconfig | 3 + hw/openrisc/virt.c | 160

[PATCH v2 03/11] goldfish_rtc: Add endianness property

2022-07-03 Thread Stafford Horne
Add an endianness property to allow configuring the RTC as either native, little or big endian. Cc: Laurent Vivier Signed-off-by: Stafford Horne --- hw/rtc/goldfish_rtc.c | 46 --- include/hw/rtc/goldfish_rtc.h | 2 ++ 2 files changed, 39 insertions(+),

[PATCH v2 00/11] OpenRISC Virtual Machine

2022-07-03 Thread Stafford Horne
Hello, This is the OpenRISC Virtual Machine plaform which we are now using for OpenRISC CI such as the wireguard testing that Jason has been working on. The first few patches help get OpenRISC QEMU ready for the virtual machine. There is one bug fix for GDB debugging there too. Next we have the

[PATCH v2 02/11] target/openrisc: Fix memory reading in debugger

2022-07-03 Thread Stafford Horne
In commit f0655423ca ("target/openrisc: Reorg tlb lookup") data and instruction TLB reads were combined. This, broke debugger reads where we first tried to map using the data tlb then fall back to the instruction tlb. This patch replicates this logic by first requesting a PAGE_READ protection

[PATCH v2 01/11] hw/openrisc: Split re-usable boot time apis out to boot.c

2022-07-03 Thread Stafford Horne
These will be shared with the virt platform. Reviewed-by: Richard Henderson Signed-off-by: Stafford Horne --- hw/openrisc/boot.c | 117 + hw/openrisc/meson.build| 1 + hw/openrisc/openrisc_sim.c | 106 ++---

[PATCH] target/ppc: Fix MPC8555 and MPC8560 core type to e500v1

2022-07-03 Thread Pali Rohár
Commit 80d11f4467c4 ("Add definitions for Freescale PowerPC implementations") changed core type of MPC8555 and MPC8560 from e500v1 to e500v2. But both MPC8555 and MPC8560 have just e500v1 cores, there are no features of e500v2 cores. It can be verified by reading NXP documentations:

[PATCH v21 11/13] target/loongarch: Adjust functions and structure to support user-mode

2022-07-03 Thread Richard Henderson
From: Song Gao Some functions and member of the structure are different with softmmu-mode So we need adjust them to support user-mode. Signed-off-by: Song Gao Signed-off-by: Xiaojuan Yang Reviewed-by: Richard Henderson Message-Id: <20220624031049.1716097-12-gaos...@loongson.cn>

[PATCH v21 07/13] target/loongarch: remove badaddr from CPULoongArch

2022-07-03 Thread Richard Henderson
From: Song Gao We can use CSR_BADV to replace badaddr. Signed-off-by: Song Gao Signed-off-by: Xiaojuan Yang Reviewed-by: Richard Henderson Message-Id: <20220624031049.1716097-8-gaos...@loongson.cn> Signed-off-by: Richard Henderson --- target/loongarch/cpu.h | 2 --

[PATCH v21 01/13] linux-user: Add LoongArch generic header files

2022-07-03 Thread Richard Henderson
From: Song Gao This includes: - sockbits.h - target_errno_defs.h - target_fcntl.h - termbits.h - target_resource.h - target_structs.h Signed-off-by: Song Gao Signed-off-by: Xiaojuan Yang Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: WANG Xuerui Message-Id:

Re: [PATCH 5/5] target/arm: Correctly implement Feat_DoubleLock

2022-07-03 Thread Richard Henderson
On 7/3/22 14:27, Peter Maydell wrote: On Sat, 2 Jul 2022 at 15:19, Richard Henderson wrote: On 7/1/22 01:11, Peter Maydell wrote: +static inline bool isar_feature_any_doublelock(const ARMISARegisters *id) +{ +/* + * We can't just OR together the aa32 and aa64 checks, because + *

[PATCH v21 00/13] Add LoongArch linux-user emulation support

2022-07-03 Thread Richard Henderson
Hi. This is Song Gao's v20 [1], with patch 2 extensively rewritten so that it handles lock_user properly. It compiles, but I need to update the docker image we produced last year so that I can properly test this. In the meantime, Song, can you please test this? r~ [1]

[PATCH v21 13/13] target/loongarch: Update README

2022-07-03 Thread Richard Henderson
From: Song Gao Add linux-user emulation introduction Signed-off-by: Song Gao Signed-off-by: Xiaojuan Yang Reviewed-by: Richard Henderson Message-Id: <20220624031049.1716097-14-gaos...@loongson.cn> Signed-off-by: Richard Henderson --- target/loongarch/README | 39

[PATCH v21 08/13] target/loongarch: Fix missing update CSR_BADV

2022-07-03 Thread Richard Henderson
From: Song Gao loongarch_cpu_do_interrupt() should update CSR_BADV for some EXCCODE. Signed-off-by: Song Gao Signed-off-by: Xiaojuan Yang Reviewed-by: Richard Henderson Message-Id: <20220624031049.1716097-9-gaos...@loongson.cn> Signed-off-by: Richard Henderson --- target/loongarch/cpu.c |

[PATCH 62/62] target/arm: Implement FEAT_HAFDBS

2022-07-03 Thread Richard Henderson
Perform the atomic update for hardware management of the access flag and the dirty bit. A limitation of the implementation so far is that the page table must itself be writable. This is allowed because it is CONSTRAINED UNPREDICTABLE whether any atomic update happens at all. Any implementation

[PATCH v21 12/13] default-configs: Add loongarch linux-user support

2022-07-03 Thread Richard Henderson
From: Song Gao This patch adds loongarch64 linux-user default configs file. Signed-off-by: Song Gao Signed-off-by: Xiaojuan Yang Reviewed-by: Richard Henderson Reviewed-by: WANG Xuerui Message-Id: <20220624031049.1716097-13-gaos...@loongson.cn> Signed-off-by: Richard Henderson ---

[PATCH v21 04/13] linux-user: Add LoongArch syscall support

2022-07-03 Thread Richard Henderson
From: Song Gao Signed-off-by: Song Gao Signed-off-by: Xiaojuan Yang Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20220624031049.1716097-5-gaos...@loongson.cn> Signed-off-by: Richard Henderson --- linux-user/loongarch64/syscall_nr.h | 312

[PATCH 59/62] target/arm: Fix fault reporting in get_phys_addr_lpae

2022-07-03 Thread Richard Henderson
Always overriding fi->type was incorrect, as we would not properly propagate the fault type from S1_ptw_translate, or arm_ldq_ptw. Simplify things by providing a new label for reporting a translation fault. For other faults, store into fi directly. Signed-off-by: Richard Henderson ---

[PATCH v21 09/13] target/loongarch: Fix helper_asrtle_d/asrtgt_d raise wrong exception

2022-07-03 Thread Richard Henderson
From: Song Gao Raise EXCCODE_BCE instead of EXCCODE_ADEM for helper_asrtle_d/asrtgt_d. Signed-off-by: Song Gao Signed-off-by: Xiaojuan Yang Reviewed-by: Richard Henderson Message-Id: <20220624031049.1716097-10-gaos...@loongson.cn> Signed-off-by: Richard Henderson --- target/loongarch/cpu.c

[PATCH 58/62] target/arm: Remove loop from get_phys_addr_lpae

2022-07-03 Thread Richard Henderson
The unconditional loop was used both to iterate over levels and to control parsing of attributes. Use an explicit goto in both cases. While this appears less clean for iterating over levels, we will need to jump back into the middle of this loop for atomic updates, which is even uglier.

[PATCH v21 03/13] linux-user: Add LoongArch elf support

2022-07-03 Thread Richard Henderson
From: Song Gao Signed-off-by: Song Gao Signed-off-by: Xiaojuan Yang Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20220624031049.1716097-4-gaos...@loongson.cn> Signed-off-by: Richard Henderson --- linux-user/loongarch64/target_elf.h | 12

[PATCH v21 06/13] scripts: add loongarch64 binfmt config

2022-07-03 Thread Richard Henderson
From: Song Gao Signed-off-by: Song Gao Signed-off-by: Xiaojuan Yang Reviewed-by: Richard Henderson Message-Id: <20220624031049.1716097-7-gaos...@loongson.cn> Signed-off-by: Richard Henderson --- scripts/qemu-binfmt-conf.sh | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff

[PATCH v21 02/13] linux-user: Add LoongArch signal support

2022-07-03 Thread Richard Henderson
From: Song Gao Signed-off-by: Song Gao Signed-off-by: Xiaojuan Yang Message-Id: <20220624031049.1716097-3-gaos...@loongson.cn> [rth: Rework extctx frame allocation and locking; Properly read/write fcc from signal frame.] Signed-off-by: Richard Henderson ---

[PATCH 57/62] target/arm: Add ARMFault_UnsuppAtomicUpdate

2022-07-03 Thread Richard Henderson
This fault type is to be used with FEAT_HAFDBS when the guest enables hw updates, but places the tables in memory where atomic updates are unsupported. Signed-off-by: Richard Henderson --- target/arm/internals.h | 4 1 file changed, 4 insertions(+) diff --git a/target/arm/internals.h

[PATCH 49/62] target/arm: Use bool consistently for get_phys_addr subroutines

2022-07-03 Thread Richard Henderson
The return type of the functions is already bool, but in a few instances we used an integer type with the return statement. Signed-off-by: Richard Henderson --- target/arm/ptw.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/target/arm/ptw.c b/target/arm/ptw.c index

Re: [PATCH 5/5] target/arm: Correctly implement Feat_DoubleLock

2022-07-03 Thread Peter Maydell
On Sat, 2 Jul 2022 at 15:19, Richard Henderson wrote: > > On 7/1/22 01:11, Peter Maydell wrote: > > +static inline bool isar_feature_any_doublelock(const ARMISARegisters *id) > > +{ > > +/* > > + * We can't just OR together the aa32 and aa64 checks, because > > + * if there is no

[PATCH 61/62] target/arm: Consider GP an attribute in get_phys_addr_lpae

2022-07-03 Thread Richard Henderson
Both GP and DBM are in the upper attribute block. Extend the computation of attrs to include them, then simplify the setting of guarded. Signed-off-by: Richard Henderson --- target/arm/ptw.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/target/arm/ptw.c

[PATCH 46/62] target/arm: Use softmmu tlbs for page table walking

2022-07-03 Thread Richard Henderson
So far, limit the change to S1_ptw_translate, arm_ldl_ptw, and arm_ldq_ptw. Use probe_access_extra to find the host address, and if so use a host load. If the probe fails, we've got our fault info already. On the off chance that page tables are not in RAM, continue to use the address_space_ld*

Re: [PATCH v4 01/45] target/arm: Handle SME in aarch64_cpu_dump_state

2022-07-03 Thread Richard Henderson
On 7/1/22 15:41, Peter Maydell wrote: On Tue, 28 Jun 2022 at 05:25, Richard Henderson wrote: Dump SVCR, plus use the correct access check for Streaming Mode. Signed-off-by: Richard Henderson --- Reviewed-by: Peter Maydell Dumping the actual ZA storage seems like it would be more

[PATCH 45/62] target/arm: Move ARMMMUIdx_Stage2 to a real tlb mmu_idx

2022-07-03 Thread Richard Henderson
We had been marking this ARM_MMU_IDX_NOTLB, move it to a real tlb. Flush the tlb when invalidating stage 1+2 translations. Signed-off-by: Richard Henderson --- target/arm/cpu-param.h | 2 +- target/arm/cpu.h | 20 +++- target/arm/helper.c| 4 +++- 3 files changed, 15

[PATCH 56/62] target/arm: Move S1_ptw_translate outside arm_ld[lq]_ptw

2022-07-03 Thread Richard Henderson
Separate S1 translation from the actual lookup. Will enable lpae hardware updates. Signed-off-by: Richard Henderson --- target/arm/ptw.c | 83 +--- 1 file changed, 44 insertions(+), 39 deletions(-) diff --git a/target/arm/ptw.c b/target/arm/ptw.c

[PATCH 55/62] target/arm: Move be test for regime into S1TranslateResult

2022-07-03 Thread Richard Henderson
Hoist this test out of arm_ld[lq]_ptw into S1_ptw_translate. Signed-off-by: Richard Henderson --- target/arm/ptw.c | 14 ++ 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/target/arm/ptw.c b/target/arm/ptw.c index 32937ec7db..b5105a2e92 100644 --- a/target/arm/ptw.c

[PATCH 53/62] target/arm: Extract HA and HD in aa64_va_parameters

2022-07-03 Thread Richard Henderson
Signed-off-by: Richard Henderson --- target/arm/internals.h | 2 ++ target/arm/helper.c| 8 +++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/target/arm/internals.h b/target/arm/internals.h index 1bbe4d950e..f2a421972e 100644 --- a/target/arm/internals.h +++

[PATCH 44/62] target/arm: Add ARMMMUIdx_Phys_{S,NS}

2022-07-03 Thread Richard Henderson
Not yet used, but add mmu indexes for 1-1 mapping to physical addresses. Signed-off-by: Richard Henderson --- target/arm/cpu-param.h | 2 +- target/arm/cpu.h | 4 target/arm/ptw.c | 9 + 3 files changed, 14 insertions(+), 1 deletion(-) diff --git

[PATCH v21 10/13] target/loongarch: remove unused include hw/loader.h

2022-07-03 Thread Richard Henderson
From: Song Gao Signed-off-by: Song Gao Signed-off-by: Xiaojuan Yang Reviewed-by: Richard Henderson Message-Id: <20220624031049.1716097-11-gaos...@loongson.cn> Signed-off-by: Richard Henderson --- target/loongarch/cpu.c | 1 - 1 file changed, 1 deletion(-) diff --git

[PATCH 51/62] target/arm: Add ptw_idx argument to S1_ptw_translate

2022-07-03 Thread Richard Henderson
Hoist the computation of the mmu_idx for the ptw up to get_phys_addr_with_secure and get_phys_addr_twostage. This removes the duplicate check for stage2 disabled from the middle of the walk, performing it only once. Pass ptw_idx through get_phys_addr_{v5,v6,lpae} and arm_{ldl,ldq}_ptw.

[PATCH v21 05/13] linux-user: Add LoongArch cpu_loop support

2022-07-03 Thread Richard Henderson
From: Song Gao Signed-off-by: Song Gao Signed-off-by: Xiaojuan Yang Reviewed-by: Richard Henderson Message-Id: <20220624031049.1716097-6-gaos...@loongson.cn> Signed-off-by: Richard Henderson --- linux-user/loongarch64/target_cpu.h | 34 ++ linux-user/loongarch64/cpu_loop.c | 96

[PATCH 42/62] target/arm: Split out get_phys_addr_disabled

2022-07-03 Thread Richard Henderson
Signed-off-by: Richard Henderson --- target/arm/ptw.c | 138 +-- 1 file changed, 74 insertions(+), 64 deletions(-) diff --git a/target/arm/ptw.c b/target/arm/ptw.c index 43a82c3c7f..0f4b9b0166 100644 --- a/target/arm/ptw.c +++ b/target/arm/ptw.c @@

[PATCH 54/62] target/arm: Split out S1TranslateResult type

2022-07-03 Thread Richard Henderson
Consolidate the results of S1_ptw_translate in one struct. Signed-off-by: Richard Henderson --- target/arm/ptw.c | 60 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/target/arm/ptw.c b/target/arm/ptw.c index

[PATCH 50/62] target/arm: Only use ARMMMUIdx_Stage1* for two-stage translation

2022-07-03 Thread Richard Henderson
If stage2 is disabled, we do not need to adjust mmu_idx. Below, we'll use get_phys_addr_lpae and not recurse. Adjust regime_is_user so that it can be used for E10_0. Signed-off-by: Richard Henderson --- target/arm/ptw.c | 9 + 1 file changed, 1 insertion(+), 8 deletions(-) diff --git

[PATCH 41/62] target/arm: Fix ATS12NSO* from S PL1

2022-07-03 Thread Richard Henderson
This has been broken since arm_hcr_el2_eff gained a check for "el2 enabled" for Secure EL2. Signed-off-by: Richard Henderson --- target/arm/ptw.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/target/arm/ptw.c b/target/arm/ptw.c index a760ab86c5..43a82c3c7f 100644

[PATCH 43/62] target/arm: Reorg get_phys_addr_disabled

2022-07-03 Thread Richard Henderson
Use a switch. Do not apply memattr or shareability for Stage2 translations. Make sure to apply HCR_{DC,DCT} only to Regime_EL10, per the pseudocode in AArch64.S1DisabledOutput. Signed-off-by: Richard Henderson --- target/arm/ptw.c | 115 +++ 1 file

Re: [PATCH V8 27/39] vfio-pci: cpr part 1 (fd and dma)

2022-07-03 Thread Peng Liang
On 6/15/2022 10:52 PM, Steve Sistare wrote: > Enable vfio-pci devices to be saved and restored across an exec restart > of qemu. > > At vfio creation time, save the value of vfio container, group, and device > descriptors in cpr state. > > In the container pre_save handler, suspend the use of

[PATCH 48/62] target/arm: Split out get_phys_addr_twostage

2022-07-03 Thread Richard Henderson
Signed-off-by: Richard Henderson --- target/arm/ptw.c | 182 +-- 1 file changed, 96 insertions(+), 86 deletions(-) diff --git a/target/arm/ptw.c b/target/arm/ptw.c index 84d72ac249..993f015904 100644 --- a/target/arm/ptw.c +++ b/target/arm/ptw.c @@

[PATCH 40/62] target/arm: Pass HCR to attribute subroutines.

2022-07-03 Thread Richard Henderson
These subroutines did not need ENV for anything except retrieving the effective value of HCR anyway. We have computed the effective value of HCR in the callers, and this will be especially important for interpreting HCR in a non-current security state. Signed-off-by: Richard Henderson ---

[PATCH 60/62] target/arm: Don't shift attrs in get_phys_addr_lpae

2022-07-03 Thread Richard Henderson
Leave the upper and lower attributes in the place they originate from in the descriptor. Shifting them around is confusing, since one cannot read the bit numbers out of the manual. Also, new attributes have been added which would alter the shifts. Signed-off-by: Richard Henderson ---

[PATCH 37/62] target/arm: Hoist read of *is_secure in S1_ptw_translate

2022-07-03 Thread Richard Henderson
Rename the argument to is_secure_ptr, and introduce a local variable is_secure with the value. We only write back to the pointer toward the end of the function. Signed-off-by: Richard Henderson --- target/arm/ptw.c | 25 ++--- 1 file changed, 14 insertions(+), 11

[PATCH 47/62] target/arm: Hoist check for disabled stage2 translation.

2022-07-03 Thread Richard Henderson
If stage2 translation is disabled, E1&0 translation is just a single stage. Use the complete single stage path rather than breaking out of the middle of the two stage path. Signed-off-by: Richard Henderson --- target/arm/ptw.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-)

[PATCH 38/62] target/arm: Fix S2 disabled check in S1_ptw_translate

2022-07-03 Thread Richard Henderson
Pass the correct stage2 mmu_idx to regime_translation_disabled, which we computed afterward. Signed-off-by: Richard Henderson --- target/arm/ptw.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/target/arm/ptw.c b/target/arm/ptw.c index 12288ac365..12b6c2c98b 100644 ---

[PATCH 34/62] target/arm: Reorg regime_translation_disabled

2022-07-03 Thread Richard Henderson
Use a switch on mmu_idx for the a-profile indexes, instead of three different if's vs regime_el and arm_mmu_idx_is_stage1_of_2. Signed-off-by: Richard Henderson --- target/arm/ptw.c | 32 +--- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git

[PATCH 52/62] target/arm: Add isar predicates for FEAT_HAFDBS

2022-07-03 Thread Richard Henderson
The MMFR1 field may indicate support for hardware update of access flag alone, or access flag and dirty bit. Signed-off-by: Richard Henderson --- target/arm/cpu.h | 10 ++ 1 file changed, 10 insertions(+) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index e5e3084ec9..6484abcf1f

[PATCH 31/62] target/arm: Merge regime_is_secure into get_phys_addr

2022-07-03 Thread Richard Henderson
This is the last use of regime_is_secure; remove it entirely before changing the layout of ARMMMUIdx. Signed-off-by: Richard Henderson --- target/arm/internals.h | 42 target/arm/ptw.c | 44 -- 2 files

[PATCH 32/62] target/arm: Add is_secure parameter to do_ats_write

2022-07-03 Thread Richard Henderson
Use get_phys_addr_with_secure directly. This is the one place where the value of is_secure may not equal arm_is_secure(env). Signed-off-by: Richard Henderson --- target/arm/helper.c | 19 ++- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/target/arm/helper.c

[PATCH 29/62] target/arm: Add is_secure parameter to v7m_read_half_insn

2022-07-03 Thread Richard Henderson
Remove the use of regime_is_secure from v7m_read_half_insn. As it happens, both callers pass true, but that is a detail of v7m_handle_execute_nsc we need not expose to the callee. Signed-off-by: Richard Henderson --- target/arm/m_helper.c | 9 - 1 file changed, 4 insertions(+), 5

[PATCH 30/62] target/arm: Add TBFLAG_M32.SECURE

2022-07-03 Thread Richard Henderson
Remove the use of regime_is_secure from arm_tr_init_disas_context. Instead, provide the value of v8m_secure directly from tb_flags. Rather than use regime_is_secure, use the env->v7m.secure directly, as per arm_mmu_idx_el. Signed-off-by: Richard Henderson --- target/arm/cpu.h | 2 ++

[PATCH 26/62] target/arm: Add is_secure parameter to regime_translation_disabled

2022-07-03 Thread Richard Henderson
Remove the use of regime_is_secure from regime_translation_disabled. This fixes a bug in S1_ptw_translate and get_phys_addr where we had passed ARMMMUIdx_Stage2 and not ARMMMUIdx_Stage2_S to determine if Stage2 is disabled, affecting FEAT_SEL2. Signed-off-by: Richard Henderson ---

[PATCH 39/62] target/arm: Remove env argument from combined_attrs_fwb

2022-07-03 Thread Richard Henderson
This value is unused. Signed-off-by: Richard Henderson --- target/arm/ptw.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/target/arm/ptw.c b/target/arm/ptw.c index 12b6c2c98b..93c533e60d 100644 --- a/target/arm/ptw.c +++ b/target/arm/ptw.c @@ -2168,8 +2168,7 @@ static

[PATCH 28/62] target/arm: Split out get_phys_addr_with_secure

2022-07-03 Thread Richard Henderson
Retain the existing get_phys_addr interface using the security state derived from mmu_idx. Signed-off-by: Richard Henderson --- target/arm/internals.h | 6 ++ target/arm/ptw.c | 21 +++-- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git

[PATCH 16/62] target/arm: Use GetPhysAddrResult in pmsav8_mpu_lookup

2022-07-03 Thread Richard Henderson
Signed-off-by: Richard Henderson --- target/arm/internals.h | 11 +-- target/arm/m_helper.c | 16 +++- target/arm/ptw.c | 20 +--- 3 files changed, 21 insertions(+), 26 deletions(-) diff --git a/target/arm/internals.h b/target/arm/internals.h index

[PATCH 25/62] target/arm: Add is_secure parameter to get_phys_addr_pmsav7

2022-07-03 Thread Richard Henderson
Remove the use of regime_is_secure from get_phys_addr_pmsav7 Signed-off-by: Richard Henderson --- target/arm/ptw.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/target/arm/ptw.c b/target/arm/ptw.c index b883826643..33fa8f094b 100644 --- a/target/arm/ptw.c +++

[PATCH 36/62] target/arm: Introduce arm_hcr_el2_eff_secstate

2022-07-03 Thread Richard Henderson
For page walking, we may require HCR for a security state that is not "current". Signed-off-by: Richard Henderson --- target/arm/cpu.h| 20 +--- target/arm/helper.c | 11 --- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/target/arm/cpu.h

[PATCH 27/62] target/arm: Add is_secure parameter to get_phys_addr_pmsav5

2022-07-03 Thread Richard Henderson
Remove the use of regime_is_secure from get_phys_addr_pmsav5. Signed-off-by: Richard Henderson --- target/arm/ptw.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/target/arm/ptw.c b/target/arm/ptw.c index 8313a2d74a..340f73997a 100644 --- a/target/arm/ptw.c +++

[PATCH 22/62] target/arm: Add secure parameter to get_phys_addr_pmsav8

2022-07-03 Thread Richard Henderson
Remove the use of regime_is_secure from get_phys_addr_pmsav8. Since we already had a local variable named secure, use that. Signed-off-by: Richard Henderson --- target/arm/ptw.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/target/arm/ptw.c b/target/arm/ptw.c index

[PATCH 14/62] target/arm: Use GetPhysAddrResult in get_phys_addr_pmsav7

2022-07-03 Thread Richard Henderson
Signed-off-by: Richard Henderson --- target/arm/ptw.c | 36 +--- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/target/arm/ptw.c b/target/arm/ptw.c index f2e429574d..4b69ecb1b9 100644 --- a/target/arm/ptw.c +++ b/target/arm/ptw.c @@ -1509,17

[PATCH 35/62] target/arm: Drop secure check for HCR.TGE vs SCTLR_EL1.M

2022-07-03 Thread Richard Henderson
The effect of TGE does not only apply to non-secure state, now that Secure EL2 exists. Signed-off-by: Richard Henderson --- target/arm/ptw.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/arm/ptw.c b/target/arm/ptw.c index 8b80716e38..f76a8e931a 100644 ---

[PATCH 24/62] target/arm: Add is_secure parameter to get_phys_addr_lpae

2022-07-03 Thread Richard Henderson
Remove the use of regime_is_secure from get_phys_addr_lpae. Signed-off-by: Richard Henderson --- target/arm/ptw.c | 20 ++-- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/target/arm/ptw.c b/target/arm/ptw.c index 23cfccce6c..b883826643 100644 ---

[PATCH 21/62] target/arm: Add is_secure parameter to get_phys_addr_v6

2022-07-03 Thread Richard Henderson
Remove the use of regime_is_secure from get_phys_addr_v6. Signed-off-by: Richard Henderson --- target/arm/ptw.c | 11 +-- 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/target/arm/ptw.c b/target/arm/ptw.c index 1bef9c6c60..d424dec729 100644 --- a/target/arm/ptw.c +++

  1   2   >