Re: [PATCH 12/41] hw/intc/arm_gicv3_its: Factor out CTE lookup sequence

2022-04-08 Thread Richard Henderson
On 4/8/22 07:15, Peter Maydell wrote: Factor out the sequence of looking up a CTE from an ICID including the validity and error checks. Signed-off-by: Peter Maydell --- I think process_movi() in particular is now a lot cleaner to read with all the error-checking factored out. --- hw/intc/arm_g

Re: [PATCH 11/41] hw/intc/arm_gicv3_its: Factor out "find ITE given devid, eventid"

2022-04-08 Thread Richard Henderson
On 4/8/22 07:15, Peter Maydell wrote: The operation of finding an interrupt table entry given a (DeviceID, EventID) pair is necessary in multiple different ITS commands. The process requires first using the DeviceID as an index into the device table to find the DTE, and then useng the EventID as

Re: [PATCH 10/41] hw/intc/arm_gicv3_its: Distinguish success and error cases of CMD_CONTINUE

2022-04-08 Thread Richard Henderson
On 4/8/22 07:15, Peter Maydell wrote: In the ItsCmdResult enum, we currently distinguish only CMD_STALL (failure, stall processing of the command queue) and CMD_CONTINUE (keep processing the queue), and we use the latter both for "there was a parameter error, go on to the next command" and "the c

Re: [PATCH 08/41] hw/intc/arm_gicv3_its: Implement VMAPI and VMAPTI

2022-04-08 Thread Richard Henderson
On 4/8/22 07:15, Peter Maydell wrote: + "%s: Doorbell 0x%x not 1023 and not a valid LPI\n", A little confusing for hex not decimal. Otherwise, Reviewed-by: Richard Henderson r~

[PATCH 16/16] target/arm: Enable FEAT_IESB for -cpu max

2022-04-08 Thread Richard Henderson
This feature is AArch64 only, and applies to physical SErrors, which QEMU does not implement, thus the feature is a nop. Signed-off-by: Richard Henderson --- target/arm/cpu64.c | 1 + 1 file changed, 1 insertion(+) diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c index 03c6707111..def0f1fdc

[PATCH 13/16] target/arm: Implement virtual SError exceptions

2022-04-08 Thread Richard Henderson
Virtual SError exceptions are raised by setting HCR_EL2.VSE, and are routed to EL1 just like other virtual exceptions. Signed-off-by: Richard Henderson --- target/arm/cpu.h | 2 ++ target/arm/internals.h | 8 target/arm/syndrome.h | 5 + target/arm/cpu.c | 38 +++

Re: [PATCH 09/41] hw/intc/arm_gicv3_its: Implement VMAPP

2022-04-08 Thread Richard Henderson
On 4/8/22 07:15, Peter Maydell wrote: Implement the GICv4 VMAPP command, which writes an entry to the vPE table. For GICv4.1 this command has extra fields in the command packet and additional behaviour. We define the 4.1-only fields with the FIELD macro, but only implement the GICv4.0 version of

[PATCH 09/16] target/arm: Enable FEAT_Debugv8p4 for -cpu max

2022-04-08 Thread Richard Henderson
This extension concerns changes to the External Debug interface, with Secure and Non-secure access to the debug registers, and all of it is outside the scope of QEMU. Indicating support for this is mandatory with FEAT_SEL2, which we do implement. Signed-off-by: Richard Henderson --- target/arm/

[PATCH 10/16] target/arm: Add isar_feature_{aa64,any}_ras

2022-04-08 Thread Richard Henderson
Add the aa64 predicate for detecting RAS support from id registers. We already have the aa32 version from the M-profile work. Add the 'any' predicate for testing both aa64 and aa32. Signed-off-by: Richard Henderson --- target/arm/cpu.h | 10 ++ 1 file changed, 10 insertions(+) diff --gi

[PATCH 14/16] target/arm: Implement ESB instruction

2022-04-08 Thread Richard Henderson
Check for and defer any pending virtual SError. Signed-off-by: Richard Henderson --- target/arm/helper.h| 1 + target/arm/a32.decode | 16 +- target/arm/t32.decode | 18 +++ target/arm/op_helper.c | 45 ++ target/

[PATCH 07/16] target/arm: Use field names for manipulating EL2 and EL3 modes

2022-04-08 Thread Richard Henderson
Use FIELD_DP{32,64} to manipulate id_pfr1 and id_aa64pfr0 during arm_cpu_realizefn. Signed-off-by: Richard Henderson --- target/arm/cpu.c | 22 +- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 5d4ca7a227..6521f350f9 1

[PATCH 11/16] target/arm: Add minimal RAS registers

2022-04-08 Thread Richard Henderson
Add only the system registers required to implement zero error records. This means we need to save state for ERRSELR, but all values are out of range, so none of the indexed error record registers need be implemented. Add the EL2 registers required for injecting virtual SError. Signed-off-by: Ri

[PATCH 08/16] target/arm: Enable FEAT_Debugv8p2 for -cpu max

2022-04-08 Thread Richard Henderson
The only portion of FEAT_Debugv8p2 that is relevant to QEMU is CONTEXTIDR_EL2, which is also conditionally implemented with FEAT_VHE. The rest of the debug extension concerns the External debug interface, which is outside the scope of QEMU. Signed-off-by: Richard Henderson --- target/arm/cpu.c

[PATCH 06/16] target/arm: Annotate arm_max_initfn with FEAT identifiers

2022-04-08 Thread Richard Henderson
Update the legacy feature names to the current names. Provide feature names for id changes that were not marked. Sort the field updates into increasing bitfield order. Signed-off-by: Richard Henderson --- target/arm/cpu64.c | 96 ++-- target/arm/cpu_tcg.

[PATCH 05/16] target/arm: Split out arm32_max_features

2022-04-08 Thread Richard Henderson
Share the code to set AArch32 max features so that we no longer have code drift between qemu{-system,}-{arm,aarch64}. Signed-off-by: Richard Henderson --- target/arm/internals.h | 2 + target/arm/cpu64.c | 51 + target/arm/cpu_tcg.c | 121 ++--

[PATCH 04/16] target/arm: Set ID_DFR0.PerfMon for qemu-system-arm -cpu max

2022-04-08 Thread Richard Henderson
We set this for qemu-system-aarch64, but failed to do so for the strictly 32-bit emulation. Fixes: 3bec78447a9 ("target/arm: Provide ARMv8.4-PMU in '-cpu max'") Signed-off-by: Richard Henderson --- target/arm/cpu_tcg.c | 4 1 file changed, 4 insertions(+) diff --git a/target/arm/cpu_tcg.c

[PATCH 15/16] target/arm: Enable FEAT_RAS for -cpu max

2022-04-08 Thread Richard Henderson
Signed-off-by: Richard Henderson --- target/arm/cpu64.c | 1 + target/arm/cpu_tcg.c | 1 + 2 files changed, 2 insertions(+) diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c index f20fb6d9e1..03c6707111 100644 --- a/target/arm/cpu64.c +++ b/target/arm/cpu64.c @@ -801,6 +801,7 @@ static void

[PATCH 03/16] target/arm: Update qemu-system-arm -cpu max to cortex-a57

2022-04-08 Thread Richard Henderson
Instead of starting with cortex-a15 and adding v8 features to a v7 cpu, begin with a v8 cpu stripped of its aarch64 features. This fixes the long-standing to-do where we only enabled v8 features for user-only. Signed-off-by: Richard Henderson --- target/arm/cpu_tcg.c | 134 ++

[PATCH 01/16] target/arm: Add isar predicates for FEAT_Debugv8p2

2022-04-08 Thread Richard Henderson
Signed-off-by: Richard Henderson --- target/arm/cpu.h | 15 +++ 1 file changed, 15 insertions(+) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 23879de5fa..9c456ff23a 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -4026,6 +4026,11 @@ static inline bool isar_feature_a

[PATCH 00/16] target/arm: Implement features Debugv8p4, RAS, IESB

2022-04-08 Thread Richard Henderson
I'm implementing the non-JTAG portion of FEAT_Debugv8p2, which is just making sure that CONTEXTIDR_EL2 is present, even if VHE is not enabled. Then Debugv8p4 is a trivial extension that only touches the JTAG interface, so turn that on too. I've got some cleanups to the setting of isar features fo

[PATCH 12/16] target/arm: Enable SCR and HCR bits for RAS

2022-04-08 Thread Richard Henderson
Enable writes to the TERR and TEA bits when RAS is enabled. These bits are otherwise RES0. Signed-off-by: Richard Henderson --- target/arm/helper.c | 9 + 1 file changed, 9 insertions(+) diff --git a/target/arm/helper.c b/target/arm/helper.c index 01f8558fca..2f6b02af7e 100644 --- a/tar

[PATCH 02/16] target/arm: Adjust definition of CONTEXTIDR_EL2

2022-04-08 Thread Richard Henderson
This register is present for either VHE or Debugv8p2, and is RES0 from EL3 when EL2 is not present. Move the definition out of vhe_reginfo and provide a fallback for missing EL2. Signed-off-by: Richard Henderson --- target/arm/helper.c | 25 + 1 file changed, 21 insertio

Re: [PATCH 1/3] docs/vhost-user: Clarifications for VHOST_USER_ADD/REM_MEM_REG

2022-04-08 Thread Raphael Norwitz
On Thu, Apr 07, 2022 at 03:36:55PM +0200, Kevin Wolf wrote: > The specification for VHOST_USER_ADD/REM_MEM_REG messages is unclear > in several points, which has led to clients having incompatible > implementations. This changes the specification to be more explicit > about them: > > * VHOST_USER_

Re: [PATCH 07/41] hw/intc/arm_gicv3_its: Implement GITS_BASER2 for GICv4

2022-04-08 Thread Richard Henderson
On 4/8/22 07:15, Peter Maydell wrote: The GICv4 defines a new in-guest-memory table for the ITS: this is the vPE table. Implement the new GITS_BASER2 register which the guest uses to tell the ITS where the vPE table is located, including the decode of the register fields into the TableDesc struc

Re: [PATCH 3/3] vhost-user: Don't pass file descriptor for VHOST_USER_REM_MEM_REG

2022-04-08 Thread Raphael Norwitz
On Thu, Apr 07, 2022 at 03:36:57PM +0200, Kevin Wolf wrote: > The spec clarifies now that QEMU should not send a file descriptor in a > request to remove a memory region. Change it accordingly. > > For libvhost-user, this is a bug fix that makes it compatible with > rust-vmm's implementation that

Re: [PATCH 2/3] libvhost-user: Fix extra vu_add/rem_mem_reg reply

2022-04-08 Thread Raphael Norwitz
On Thu, Apr 07, 2022 at 03:36:56PM +0200, Kevin Wolf wrote: > Outside of postcopy mode, neither VHOST_USER_ADD_MEM_REG nor > VHOST_USER_REM_MEM_REG are supposed to send a reply unless explicitly > requested with the need_reply flag. Their current implementation always > sends a reply, even if it is

Re: [PATCH 06/41] hw/intc/arm_gicv3_its: Factor out "is intid a valid LPI ID?"

2022-04-08 Thread Richard Henderson
On 4/8/22 07:15, Peter Maydell wrote: In process_mapti() we check interrupt IDs to see whether they are in the valid LPI range. Factor this out into its own utility function, as we're going to want it elsewhere too for GICv4. Signed-off-by: Peter Maydell --- hw/intc/arm_gicv3_its.c | 10 +

Re: [PATCH 05/41] target/arm/cpu.c: ignore VIRQ and VFIQ if no EL2

2022-04-08 Thread Richard Henderson
On 4/8/22 07:15, Peter Maydell wrote: In a GICv3, it is impossible for the GIC to deliver a VIRQ or VFIQ to the CPU unless the CPU has EL2, because VIRQ and VFIQ are only configurable via EL2-only system registers. Moreover, in our implementation we were only calculating and updating the state o

Re: [PATCH 04/41] hw/intc/arm_gicv3: Report correct PIDR0 values for ID registers

2022-04-08 Thread Richard Henderson
On 4/8/22 07:15, Peter Maydell wrote: We use the common function gicv3_idreg() to supply the CoreSight ID register values for the GICv3 for the copies of these ID registers in the distributor, redistributor and ITS register frames. This isn't quite correct, because while most of the register val

Re: [PATCH 03/41] hw/intc/arm_gicv3: Insist that redist region capacity matches CPU count

2022-04-08 Thread Richard Henderson
On 4/8/22 07:15, Peter Maydell wrote: Boards using the GICv3 need to configure it with both the total number of CPUs and also the sizes of all the memory regions which contain redistributors (one redistributor per CPU). At the moment the GICv3 checks that the number of CPUs specified is not too

Re: [PATCH 02/41] hw/intc/arm_gicv3: Sanity-check num-cpu property

2022-04-08 Thread Richard Henderson
On 4/8/22 07:15, Peter Maydell wrote: In the GICv3 code we implicitly rely on there being at least one CPU and thus at least one redistributor and CPU interface. Sanity-check that the property the board code sets is not zero. Signed-off-by: Peter Maydell --- Doing this would be a board code err

Re: [PATCH 01/41] hw/intc/arm_gicv3_its: Add missing blank line

2022-04-08 Thread Richard Henderson
On 4/8/22 07:15, Peter Maydell wrote: In commit b6f96009acc we split do_process_its_cmd() from process_its_cmd(), but forgot the usual blank line between function definitions. Add it. Signed-off-by: Peter Maydell --- hw/intc/arm_gicv3_its.c | 1 + 1 file changed, 1 insertion(+) Reviewed-by

[PATCH] hw/dma: fix crash caused by race condition

2022-04-08 Thread Tong Zhang
assert(dbs->acb) is meant to check the return value of io_func per documented in commit 6bee44ea34 ("dma: the passed io_func does not return NULL"). However, there is a chance that after calling aio_context_release(dbs->ctx); the dma_blk_cb function is called before the assertion and dbs->acb is se

Re: [PATCH v5 00/13] KVM: mm: fd-based approach for supporting KVM guest private memory

2022-04-08 Thread Vishal Annapurve
On Mon, Mar 28, 2022 at 10:17 AM Andy Lutomirski wrote: > > On Thu, Mar 10, 2022 at 6:09 AM Chao Peng wrote: > > > > This is the v5 of this series which tries to implement the fd-based KVM > > guest private memory. The patches are based on latest kvm/queue branch > > commit: > > > > d5089416b7f

Re: [PATCH v2 1/2] pcie: Don't try triggering a LSI when not defined

2022-04-08 Thread Daniel Henrique Barboza
On 4/8/22 10:13, Frederic Barrat wrote: This patch skips [de]asserting a LSI interrupt if the device doesn't have any LSI defined. Doing so would trigger an assert in pci_irq_handler(). The PCIE root port implementation in qemu requests a LSI (INTA), but a subclass may want to change that beh

Re: [PATCH v2 2/2] ppc/pnv: Remove LSI on the PCIE host bridge

2022-04-08 Thread Daniel Henrique Barboza
On 4/8/22 10:13, Frederic Barrat wrote: The phb3/phb4/phb5 root ports inherit from the default PCIE root port implementation, which requests a LSI interrupt (#INTA). On real hardware (POWER8/POWER9/POWER10), there is no such LSI. This patch corrects it so that it matches the hardware. As a co

Re: [PATCH v2 2/3] qapi: nbd-export: allow select bitmaps by node/name pair

2022-04-08 Thread Vladimir Sementsov-Ogievskiy
17.03.2022 00:28, Eric Blake wrote: +++ b/qapi/block-export.json @@ -6,6 +6,7 @@ ## { 'include': 'sockets.json' } +{ 'include': 'block-core.json' } Hmm. Does this extra inclusion negatively impact qemu-storage-daemon, since that is why we created block-export.json in the first place (to

Re: [PATCH v1] hw/ppc: change indentation to spaces from TABs

2022-04-08 Thread Daniel Henrique Barboza
On 4/6/22 07:08, Bin Meng wrote: On Tue, Apr 5, 2022 at 10:36 PM Guo Zhi wrote: There are still some files in the QEMU PPC code base that use TABs for indentation instead of using spaces. The TABs should be replaced so that we have a consistent coding style. If this patch is applied, iss

Re: [PATCH v5 04/13] mm/shmem: Restrict MFD_INACCESSIBLE memory against RLIMIT_MEMLOCK

2022-04-08 Thread David Hildenbrand
On 08.04.22 19:56, Sean Christopherson wrote: > On Thu, Apr 07, 2022, Andy Lutomirski wrote: >> >> On Thu, Apr 7, 2022, at 9:05 AM, Sean Christopherson wrote: >>> On Thu, Mar 10, 2022, Chao Peng wrote: Since page migration / swapping is not supported yet, MFD_INACCESSIBLE memory behave li

Re: [PATCH v5 04/13] mm/shmem: Restrict MFD_INACCESSIBLE memory against RLIMIT_MEMLOCK

2022-04-08 Thread Sean Christopherson
On Thu, Apr 07, 2022, Andy Lutomirski wrote: > > On Thu, Apr 7, 2022, at 9:05 AM, Sean Christopherson wrote: > > On Thu, Mar 10, 2022, Chao Peng wrote: > >> Since page migration / swapping is not supported yet, MFD_INACCESSIBLE > >> memory behave like longterm pinned pages and thus should be accou

Re: [PATCH v5 05/13] KVM: Extend the memslot to support fd-based private memory

2022-04-08 Thread Sean Christopherson
On Fri, Apr 08, 2022, Chao Peng wrote: > On Mon, Mar 28, 2022 at 09:56:33PM +, Sean Christopherson wrote: > > struct kvm_userspace_memory_region_ext { > > #ifdef __KERNEL__ > > Is this #ifndef? As I think anonymous struct is only for kernel? Doh, yes, I inverted that. > Thanks, > Chao > > >

Re: [PATCH 1/3] vhost: Refactor vhost_reset_device() in VhostOps

2022-04-08 Thread Si-Wei Liu
On 4/8/2022 1:38 AM, Michael Qiu wrote: 在 2022/4/7 15:35, Jason Wang 写道: 在 2022/4/2 下午1:14, Michael Qiu 写道: On 2022/4/2 10:38, Jason Wang wrote: 在 2022/4/1 下午7:06, Michael Qiu 写道: Currently in vhost framwork, vhost_reset_device() is misnamed. Actually, it should be vhost_reset_owner(

[RFC PATCH 2/4] hw/9pfs: Update 'local' file system backend driver to support Windows

2022-04-08 Thread Bin Meng
From: Guohuai Shi Extend the 9p local file system backend driver to support Windows, including open, read, write, close, rename, remove, etc. Symbolic link, link, chmod, renameat, unlinkat and extended attribute are not supported due to limitations on Windows host. Signed-off-by: Guohuai Shi S

[RFC PATCH 4/4] meson.build: Turn on virtfs for Windows host

2022-04-08 Thread Bin Meng
From: Guohuai Shi Enable virtfs configuration option for Windows host. Signed-off-by: Guohuai Shi Signed-off-by: Bin Meng --- meson.build | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/meson.build b/meson.build index 861de93c4f..a609a9e98f 100644 --- a/meson.b

[RFC PATCH 3/4] fsdev: Enable 'local' file system driver backend for Windows

2022-04-08 Thread Bin Meng
From: Guohuai Shi Only 'local' file system driver will be supported for Windows host. 'proxy' or 'synth' are not supported. Signed-off-by: Guohuai Shi Signed-off-by: Bin Meng --- fsdev/qemu-fsdev.c | 2 ++ fsdev/meson.build | 1 + 2 files changed, 3 insertions(+) diff --git a/fsdev/qemu-fs

[RFC PATCH 0/4] 9pfs: Add 9pfs support for Windows host

2022-04-08 Thread Bin Meng
At present there is no Windows support for 9p file system. This series adds initial Windows support for 9p file system. Only 'local' file system driver backend is supported. security_model should be 'none' due to limitations on Windows host. Example command line to test: "-fsdev local,path=c:\

[PATCH 1/2] python/machine.py: upgrade vm.command() method

2022-04-08 Thread Vladimir Sementsov-Ogievskiy
The method is not popular, we prefer use vm.qmp() and then check success by hand.. But that's not optimal. To simplify movement to vm.command() support same interface improvements like in vm.qmp() and rename to shorter vm.cmd(). Signed-off-by: Vladimir Sementsov-Ogievskiy --- python/qemu/machine

[PATCH v1 13/15] plugins: extend execlog to filter matches

2022-04-08 Thread Alex Bennée
Sometimes the whole execlog is just two much so add the ability to filter by instruction opcode or address. [AJB: this shows for example .qemu-system-aarch64 -display none -serial mon:stdio \ -M virt -cpu max \ -semihosting-config enable=on \ -kernel ./tests/tcg/aarch64-softmmu/memory-s

[RFC PATCH 1/4] fsdev: Add missing definitions for Windows in file-op-9p.h

2022-04-08 Thread Bin Meng
From: Guohuai Shi Add uid_t, gid_t and struct statfs definitions, which are currently missing from Windows headers, but are required when we add 9p file system support for Windows in later patches. Signed-off-by: Guohuai Shi Signed-off-by: Bin Meng --- fsdev/file-op-9p.h | 33 +++

[RFC 0/2] introduce QEMUMachind.cmd()

2022-04-08 Thread Vladimir Sementsov-Ogievskiy
Hi all! I always dreamed about getting rid of pattern result = self.vm.qmp(...) self.assert_qmp(result, 'return', {}) Here is a suggestion to switch to self.vm.cmd(...) pattern instead. I'm not sure we really want to update so many tests. May be just commit patch 01, and use new i

[PATCH v1 10/15] cputlb: add tracepoints for TB invalidation

2022-04-08 Thread Alex Bennée
Signed-off-by: Alex Bennée --- accel/tcg/translate-all.c | 2 ++ accel/tcg/trace-events| 1 + 2 files changed, 3 insertions(+) diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index e9f1cc179d..b0009177b9 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.

[RFC PATCH for-7.1] Remove the slirp submodule (and only compile with an external libslirp)

2022-04-08 Thread Thomas Huth
QEMU 7.1 won't support Ubuntu 18.04 anymore, so the last big important distro that did not have a pre-packaged libslirp has been dismissed. All other major distros seem to have a libslirp package in their distribution already - according to repology.org: Fedora 34: 4.4.0 CentOS 8 (RHEL

[PATCH v1 05/15] accel/tcg: add tb_invalidate_phy_pages_fast tracepoint

2022-04-08 Thread Alex Bennée
These events can be very expensive for the translator so lets add a tracepoint to help with debugging what might be causing them. Clean up the comments while we are at it. Signed-off-by: Alex Bennée --- accel/tcg/translate-all.c | 15 +++ accel/tcg/trace-events| 1 + 2 files cha

[PATCH v1 15/15] accel/tcg: add heuristic to invalidate al TBs in a page [hack!]

2022-04-08 Thread Alex Bennée
This is a dumb attempt to reduce to the execution time of UEFI booted kernels and almost certainly not what the final solution should be. The problem is if we have generated JIT code from running firmware we can spend a lot of time carefully invalidating every TB in a page when the kernel that eve

[PATCH v1 09/15] cputlb: add tracepoints for the protect/unprotect helpers

2022-04-08 Thread Alex Bennée
This helps track when pages are tagged for detecting code changes. Signed-off-by: Alex Bennée --- accel/tcg/cputlb.c | 14 ++ accel/tcg/trace-events | 3 +++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index 35797cea49.

[PATCH v1 12/15] tests/tcg: add memory-sve test for aarch64

2022-04-08 Thread Alex Bennée
This will be helpful in debugging problems with tracking SVE memory accesses via the TCG plugins system. Signed-off-by: Alex Bennée Cc: Robert Henry Cc: Aaron Lindsay --- tests/tcg/aarch64/Makefile.softmmu-target | 7 +++ tests/tcg/aarch64/system/boot.S | 3 ++- 2 files changed,

[PATCH v1 14/15] plugins: Assert mmu_idx in range before use in qemu_plugin_get_hwaddr

2022-04-08 Thread Alex Bennée
From: Richard Henderson Coverity reports out-of-bound accesses here. This should be a false positive due to how the index is decoded from MemOpIdx. Fixes: Coverity CID 1487201 Signed-off-by: Richard Henderson Reviewed-by: Damien Hedde Message-Id: <20220401190233.329360-1-richard.hender...@lin

[PATCH v1 01/15] tests/avocado: update aarch64_virt test to exercise -cpu max

2022-04-08 Thread Alex Bennée
The Fedora 29 kernel is quite old and importantly fails when running in LPA2 scenarios. As it's not really exercising much of the CPU space replace it with a custom 5.16.12 kernel with all the architecture options turned on. There is a minimal buildroot initramfs included in the kernel which has a

[PATCH v1 06/15] monitor: expose monitor_puts to rest of code

2022-04-08 Thread Alex Bennée
This helps us construct strings elsewhere before echoing to the monitor. It avoids having to jump through hoops like: monitor_printf(mon, "%s", s->str); Signed-off-by: Alex Bennée --- include/monitor/monitor.h | 1 + monitor/monitor-internal.h | 1 - 2 files changed, 1 insertion(+), 1 deleti

[PATCH v1 11/15] accel/tcg: add tb_invalidate_phys_page_range tracepoint

2022-04-08 Thread Alex Bennée
This gives a little more insight into what is going on as we invalidate a range of TBs. Signed-off-by: Alex Bennée --- accel/tcg/translate-all.c | 9 + accel/tcg/trace-events| 1 + 2 files changed, 10 insertions(+) diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c i

[PATCH v1 08/15] disas: use result of ->read_memory_func

2022-04-08 Thread Alex Bennée
This gets especially confusing if you start plugging in host addresses from a trace and you wonder why the output keeps changing. Report when read_memory_func fails instead of blindly disassembling the buffer contents. Signed-off-by: Alex Bennée --- disas.c | 20 ++--- disas/cap

[PATCH v1 04/15] accel/tcg: move trace events to correct location

2022-04-08 Thread Alex Bennée
Signed-off-by: Alex Bennée --- accel/tcg/cputlb.c | 2 +- accel/tcg/trace-events | 4 trace-events | 4 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index 2035b2ac0a..35797cea49 100644 --- a/accel/tcg/cputlb.c +++ b

[PATCH v1 03/15] docs/devel: drop :hidden: and :includehidden: tags

2022-04-08 Thread Alex Bennée
This was confusing and in the case of qtest was hiding the details of the qgraph sub-document in the qtest pages. Signed-off-by: Alex Bennée --- docs/devel/index-api.rst | 1 - docs/devel/index-build.rst | 3 +-- docs/devel/index-internals.rst | 1 - docs/devel/index-process.rst | 1

[PATCH v1 00/15] testing, docs, tracepoints and cputlb hacks

2022-04-08 Thread Alex Bennée
Hi, In anticipation of the tree re-opening soon I thought flush the current state of my maintainer trees. We have a change for testing, a couple of documentation updates, some refactoring of disassembly handling and additional tracepoints for diagnosing cputlb issues. There is also a hack for spee

[PATCH v1 02/15] docs/devel: add some notes on the binfmt-image-debian targets

2022-04-08 Thread Alex Bennée
We document some of this on the wiki but lets move it into our official developer notes documentation. Signed-off-by: Alex Bennée Cc: Paolo Bonzini --- v2 - fix some trailing ws --- docs/devel/testing.rst | 38 ++ 1 file changed, 38 insertions(+) diff --g

[PATCH v1 07/15] disas: generalise plugin_printf and use for monitor_disas

2022-04-08 Thread Alex Bennée
Rather than assembling our output piecemeal lets use the same approach as the plugin disas interface to build the disassembly string before printing it. Signed-off-by: Alex Bennée --- disas.c | 23 +++ 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/disas.c b/d

Re: [PATCH] plugins: Assert mmu_idx in range before use in qemu_plugin_get_hwaddr

2022-04-08 Thread Alex Bennée
Richard Henderson writes: > Coverity reports out-of-bound accesses here. This should be a > false positive due to how the index is decoded from MemOpIdx. > > Fixes: Coverity CID 1487201 > Signed-off-by: Richard Henderson Queued to plugins/next, thanks. -- Alex Bennée

[PATCH] target/riscv/pmp: fix NAPOT range computation overflow

2022-04-08 Thread Nicolas Pitre
There is an overflow with the current code where a pmpaddr value of 0x1fff is decoded as sa=0 and ea=0 whereas it should be sa=0 and ea=0x. Fix that by simplifying the computation. There is in fact no need for ctz64() nor special case for -1 to achieve proper results. Signed-off-by

[RFC PATCH v2] tests/qtest: attempt to enable tests for virtio-gpio (!working)

2022-04-08 Thread Alex Bennée
We don't have a virtio-gpio implementation in QEMU and only support a vhost-user backend. The QEMU side of the code is minimal so it should be enough to instantiate the device and pass some vhost-user messages over the control socket. To do this we hook into the existing vhost-user-test code and ju

Re: Support for x86_64 on aarch64 emulation

2022-04-08 Thread Richard Henderson
On 4/8/22 05:21, Redha Gouicem wrote: We are working on support for x86_64 emulation on aarch64, mainly related to memory ordering issues. We first wanted to know what the community thinks about our proposal, and its chance of getting merged one day. Note that we worked with qemu-user, so there

Re: Procedures adding new CPUs in sbsa-ref

2022-04-08 Thread Peter Maydell
On Fri, 8 Apr 2022 at 15:59, Itaru Kitayama wrote: > I'd like to add a64fx cpu to the sbsa-ref board, if there's a quick and dirty > way of completing that, advice from the maintainers is greatly appreciated. I have cc'd the sbsa-ref maintainers (as listed in the MAINTAINERS file). However, I'm

Re: [PATCH v4 7/7] iotests: copy-before-write: add cases for cbw-timeout option

2022-04-08 Thread Hanna Reitz
On 07.04.22 15:27, Vladimir Sementsov-Ogievskiy wrote: Add two simple test-cases: timeout failure with break-snapshot-on-cbw-error behavior and similar with break-guest-write-on-cbw-error behavior. Signed-off-by: Vladimir Sementsov-Ogievskiy --- tests/qemu-iotests/tests/copy-before-write|

Re: [PATCH v4 3/7] iotests: add copy-before-write: on-cbw-error tests

2022-04-08 Thread Hanna Reitz
On 07.04.22 15:27, Vladimir Sementsov-Ogievskiy wrote: Add tests for new option of copy-before-write filter: on-cbw-error. Note that we use QEMUMachine instead of VM class, because in further commit we'll want to use throttling which doesn't work with -accel qtest used by VM. We also touch pyli

Support for x86_64 on aarch64 emulation

2022-04-08 Thread Redha Gouicem
We are working on support for x86_64 emulation on aarch64, mainly related to memory ordering issues. We first wanted to know what the community thinks about our proposal, and its chance of getting merged one day. Note that we worked with qemu-user, so there may be issues in system mode that we mis

Re: [PATCH v9 09/11] 9p: darwin: Implement compatibility for mknodat

2022-04-08 Thread Greg Kurz
On Fri, 08 Apr 2022 15:52:25 +0200 Christian Schoenebeck wrote: > On Sonntag, 27. Februar 2022 23:35:20 CEST Will Cohen wrote: > > From: Keno Fischer > > > > Darwin does not support mknodat. However, to avoid race conditions > > with later setting the permissions, we must avoid using mknod on >

Procedures adding new CPUs in sbsa-ref

2022-04-08 Thread Itaru Kitayama
Hi, I'd like to add a64fx cpu to the sbsa-ref board, if there's a quick and dirty way of completing that, advice from the maintainers is greatly appreciated. Thanks, Itaru.

Re: [PATCH] x86: Implement Linear Address Masking support

2022-04-08 Thread Richard Henderson
On 4/7/22 08:27, Kirill A. Shutemov wrote: The fast path does not clear the bits, so you enter the slow path before you get to clearing the bits. You've lost most of the advantage of the tlb already. Sorry for my ignorance, but what do you mean by fast path here? My understanding is that it i

[PATCH 41/41] hw/arm/virt: Support TCG GICv4

2022-04-08 Thread Peter Maydell
Add support for the TCG GICv4 to the virt board. For the board, the GICv4 is very similar to the GICv3, with the only difference being the size of the redistributor frame. The changes here are thus: * calculating virt_redist_capacity correctly for GICv4 * changing various places which were "if GI

Re: [PATCH 00/41] arm: Implement GICv4

2022-04-08 Thread Peter Maydell
On Fri, 8 Apr 2022 at 15:15, Peter Maydell wrote: > > This patchset implements emulation of GICv4 in our TCG GIC and ITS > models, and makes the virt board use it where appropriate. > Tested with a Linux kernel passing through a virtio-blk device > to an inner Linux VM with KVM/QEMU. (NB that to

[PATCH 35/41] hw/intc/arm_gicv3_redist: Implement gicv3_redist_vinvall()

2022-04-08 Thread Peter Maydell
Implement the gicv3_redist_vinvall() function (previously left as a stub). This function handles the work of a VINVALL command: it must invalidate any cached information associated with a specific vCPU. Signed-off-by: Peter Maydell --- hw/intc/arm_gicv3_redist.c | 8 +++- 1 file changed, 7

[PATCH 36/41] hw/intc/arm_gicv3_redist: Implement gicv3_redist_inv_vlpi()

2022-04-08 Thread Peter Maydell
Implement the function gicv3_redist_inv_vlpi(), which was previously left as a stub. This is the function that does the work of the INV command for a virtual interrupt. Signed-off-by: Peter Maydell --- hw/intc/arm_gicv3_redist.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff

[PATCH 40/41] hw/arm/virt: Abstract out calculation of redistributor region capacity

2022-04-08 Thread Peter Maydell
In several places in virt.c we calculate the number of redistributors that fit in a region of our memory map, which is the size of the region divided by the size of a single redistributor frame. For GICv4, the redistributor frame is a different size from that for GICv3. Abstract out the calculation

[PATCH 29/41] hw/intc/arm_gicv3_redist: Recalculate hppvlpi on VPENDBASER writes

2022-04-08 Thread Peter Maydell
The guest uses GICR_VPENDBASER to tell the redistributor when it is scheduling or descheduling a vCPU. When it writes and changes the VALID bit from 0 to 1, it is scheduling a vCPU, and we must update our view of the current highest priority pending vLPI from the new Pending and Configuration tabl

[PATCH 34/41] hw/intc/arm_gicv3_redist: Implement gicv3_redist_mov_vlpi()

2022-04-08 Thread Peter Maydell
Implement the gicv3_redist_mov_vlpi() function (previously left as a stub). This function handles the work of a VMOVI command: it marks the vLPI not-pending on the source and pending on the destination. Signed-off-by: Peter Maydell --- hw/intc/arm_gicv3_redist.c | 20 ++-- 1 fil

[PATCH 39/41] hw/arm/virt: Use VIRT_GIC_VERSION_* enum values in create_gic()

2022-04-08 Thread Peter Maydell
Everywhere we need to check which GIC version we're using, we look at vms->gic_version and use the VIRT_GIC_VERSION_* enum values, except in create_gic(), which copies vms->gic_version into a local 'int' variable and makes direct comparisons against values 2 and 3. For consistency, change this fun

[PATCH 31/41] hw/intc/arm_gicv3_redist: Implement gicv3_redist_process_vlpi()

2022-04-08 Thread Peter Maydell
Implement the function gicv3_redist_process_vlpi(), which was left as just a stub earlier. This function deals with being handed a VLPI by the ITS. It must set the bit in the pending table. If the vCPU is currently resident we must recalculate the highest priority pending vLPI; otherwise we may

[PATCH 38/41] hw/intc/arm_gicv3: Allow 'revision' property to be set to 4

2022-04-08 Thread Peter Maydell
Now that we have implemented all the GICv4 requirements, relax the error-checking on the GIC object's 'revision' property to allow a TCG GIC to be a GICv4, whilst still constraining the KVM GIC to GICv3. Our 'revision' property doesn't consider the possibility of wanting to specify the minor versi

[PATCH 28/41] hw/intc/arm_gicv3_redist: Factor out "update hpplpi for all LPIs" logic

2022-04-08 Thread Peter Maydell
Factor out the common part of gicv3_redist_update_lpi_only() into a new function update_for_all_lpis(), which does a full rescan of an LPI Pending table and sets the specified PendingIrq struct with the highest priority pending enabled LPI it finds. Signed-off-by: Peter Maydell --- hw/intc/arm_g

[PATCH 37/41] hw/intc/arm_gicv3: Update ID and feature registers for GICv4

2022-04-08 Thread Peter Maydell
Update the various GIC ID and feature registers for GICv4: * PIDR2 [7:4] is the GIC architecture revision * GICD_TYPER.DVIS is 1 to indicate direct vLPI injection support * GICR_TYPER.VLPIS is 1 to indicate redistributor support for vLPIs * GITS_TYPER.VIRTUAL is 1 to indicate vLPI support * GI

[PATCH 32/41] hw/intc/arm_gicv3_redist: Implement gicv3_redist_vlpi_pending()

2022-04-08 Thread Peter Maydell
Implement the function gicv3_redist_vlpi_pending(), which was previously left as a stub. This is the function that is called by the CPU interface when it changes the state of a vLPI. It's similar to gicv3_redist_process_vlpi(), but we know that the vCPU is definitely resident on the redistributor

[PATCH 24/41] hw/intc/arm_gicv3_cpuif: Split "update vIRQ/vFIQ" from gicv3_cpuif_virt_update()

2022-04-08 Thread Peter Maydell
The function gicv3_cpuif_virt_update() currently sets all of vIRQ, vFIQ and the maintenance interrupt. This implies that it has to be used quite carefully -- as the comment notes, setting the maintenance interrupt will typically cause the GIC code to be re-entered recursively. For handling vLPIs,

[PATCH 33/41] hw/intc/arm_gicv3_redist: Use set_pending_table_bit() in mov handling

2022-04-08 Thread Peter Maydell
We can use our new set_pending_table_bit() utility function in gicv3_redist_mov_lpi() to clear the bit in the source pending table, rather than doing the "load, clear bit, store" ourselves. Signed-off-by: Peter Maydell --- hw/intc/arm_gicv3_redist.c | 9 + 1 file changed, 1 insertion(+),

[PATCH 30/41] hw/intc/arm_gicv3_redist: Factor out "update bit in pending table" code

2022-04-08 Thread Peter Maydell
Factor out the code which sets a single bit in an LPI pending table. We're going to need this for handling vLPI tables, not just the physical LPI table. Signed-off-by: Peter Maydell --- hw/intc/arm_gicv3_redist.c | 49 +++--- 1 file changed, 30 insertions(+), 19 d

[PATCH 22/41] hw/intc/arm_gicv3: Implement GICv4's new redistributor frame

2022-04-08 Thread Peter Maydell
The GICv4 extends the redistributor register map -- where GICv3 had two 64KB frames per CPU, GICv4 has four frames. Add support for the extra frame by using a new gicv3_redist_size() function in the places in the GIC implementation which currently use a fixed constant size for the redistributor reg

[PATCH 27/41] hw/intc/arm_gicv3_redist: Factor out "update hpplpi for one LPI" logic

2022-04-08 Thread Peter Maydell
Currently the functions which update the highest priority pending LPI information by looking at the LPI Pending and Configuration tables are hard-coded to use the physical LPI tables addressed by GICR_PENDBASER and GICR_PROPBASER. To support virtual LPIs we will need to do essentially the same job

[PATCH 19/41] hw/intc/arm_gicv3_its: Implement INV for virtual interrupts

2022-04-08 Thread Peter Maydell
Implement the ITS side of the handling of the INV command for virtual interrupts; as usual this calls into a redistributor function which we leave as a stub to fill in later. Signed-off-by: Peter Maydell --- hw/intc/gicv3_internal.h | 9 + hw/intc/arm_gicv3_its.c| 16 +

[PATCH 14/41] hw/intc/arm_gicv3_its: Handle virtual interrupts in process_its_cmd()

2022-04-08 Thread Peter Maydell
For GICv4, interrupt table entries read by process_its_cmd() may indicate virtual LPIs which are to be directly injected into a VM. Implement the ITS side of the code for handling this. This is similar to the existing handling of physical LPIs, but instead of looking up a collection ID in a collec

[PATCH 26/41] hw/intc/arm_gicv3_cpuif: Don't recalculate maintenance irq unnecessarily

2022-04-08 Thread Peter Maydell
The maintenance interrupt state depends only on: * ICH_HCR_EL2 * ICH_LR_EL2 * ICH_VMCR_EL2 fields VENG0 and VENG1 Now we have a separate function that updates only the vIRQ and vFIQ lines, use that in places that only change state that affects vIRQ and vFIQ but not the maintenance interrupt. S

[PATCH 16/41] hw/intc/arm_gicv3_its: Implement VMOVP

2022-04-08 Thread Peter Maydell
Implement the GICv4 VMOVP command, which updates an entry in the vPE table to change its rdbase field. This command is unique in the ITS command set because its effects must be propagated to all the other ITSes connected to the same GIC as the ITS which executes the VMOVP command. The GICv4 spec a

[PATCH 25/41] hw/intc/arm_gicv3_cpuif: Support vLPIs

2022-04-08 Thread Peter Maydell
The CPU interface changes to support vLPIs are fairly minor: in the parts of the code that currently look at the list registers to determine the highest priority pending virtual interrupt, we must also look at the highest priority pending vLPI. To do this we change hppvi_index() to check the vLPI a

  1   2   >