[PATCH] hw/arm/smmu-common: Remove the repeated ttb field

2025-02-20 Thread JianChunfu
SMMUTransCfg->ttb is never used in QEMU, TT base address can be accessed by SMMUTransCfg->tt[i]->ttb. Signed-off-by: JianChunfu --- include/hw/arm/smmu-common.h | 1 - 1 file changed, 1 deletion(-) diff --git a/include/hw/arm/smmu-common.h b/include/hw/arm/smmu-common.h index d1a4a6455..e5ad55b

[PATCH v2] hw/arm/smmu: Add invalidating function of config data

2025-02-20 Thread JianChunfu
Uniform the removal judgement of g_hash_table_foreach_remove(), previous name seems to perform the actual action while it just returns a Boolean. Signed-off-by: JianChunfu --- v2: - move smmuv3_invalidate_ste() to smmu_hash_remove_by_sid_range() - add function smmu_configs_inv_sid_range() v1:

[PATCH] hw/i386: introduce x86_firmware_reconfigure api

2025-02-20 Thread Ani Sinha
Normally, there is no need to perform firmware reconfiguration once the virtal machine has started. Hence, currently ovmf firmware parsing happens only once. However, if the firmware changes betweeen boots then reconfiguration needs to happen again. Firmware can change if for example the guest brin

Re: [PATCH v3 14/14] scripts/ghes_inject: add a script to generate GHES error inject

2025-02-20 Thread Mauro Carvalho Chehab
Em Wed, 05 Feb 2025 09:16:53 +0100 Markus Armbruster escreveu: > Mauro Carvalho Chehab writes: > > > Using the QMP GHESv2 API requires preparing a raw data array > > containing a CPER record. > > > > Add a helper script with subcommands to prepare such data. > > > > Currently, only ARM Processo

Re: [PATCH 4/4] target/arm: Retry pushing CPER error if necessary

2025-02-20 Thread Gavin Shan
On 2/20/25 3:55 AM, Igor Mammedov wrote: On Fri, 14 Feb 2025 14:16:35 +1000 Gavin Shan wrote: The error -1 is returned if the previously reported CPER error hasn't been claimed. The virtual machine is terminated due to abort(). It's conflicting to the ideal behaviour that the affected vCPU ret

[PATCH 1/5] hw/pci: Basic support for PCI power management

2025-02-20 Thread Alex Williamson
The memory and IO BARs for devices are only accessible in the D0 power state. In other power states the PCI spec defines that the device should respond to TLPs and messages with an Unsupported Request response. The closest we can come to emulating this behavior is to consider the BARs as unmapped

Re: [PATCH] vhost-user: Silence unsupported VHOST_USER_PROTOCOL_F_RARP error

2025-02-20 Thread Jason Wang
On Fri, Feb 21, 2025 at 4:46 AM Michael S. Tsirkin wrote: > > On Thu, Feb 20, 2025 at 09:00:04PM +0100, Stefano Brivio wrote: > > On Thu, 20 Feb 2025 13:21:33 -0500 > > "Michael S. Tsirkin" wrote: > > > > > On Thu, Feb 20, 2025 at 05:59:10PM +0100, Stefano Brivio wrote: > > > > On Thu, 20 Feb 202

Re: [PATCH] target/loongarch/gdbstub: Fix gdbstub incorrectly handling register R32

2025-02-20 Thread bibo mao
Queued in loongarch-next with title and changelog changed as follows: target/loongarch/gdbstub: Fix gdbstub incorrectly handling some registers Write operation with R32 (orig_a0) and R34 (CSR_BADV) is discarded on Regards Bibo Mao On 2025/2/18 上午11:20, Bibo Mao wrote: Write operation with R3

Re: [PATCH] vdpa: Allow vDPA to work on big-endian machine

2025-02-20 Thread Konstantin Shkolnyy
On 2/20/2025 09:57, Michael S. Tsirkin wrote: On Tue, Feb 11, 2025 at 10:19:23AM -0600, Konstantin Shkolnyy wrote: Add .set_vnet_le() function that always returns success, assuming that vDPA h/w always implements LE data format. Otherwise, QEMU disables vDPA and outputs the message: "backend doe

RE: [PATCH v3 04/28] hw/arm/aspeed: Rename IRQ table and machine name for AST2700 A0

2025-02-20 Thread Jamin Lin
Hi Cedric, > Cc: Troy Lee > Subject: Re: [PATCH v3 04/28] hw/arm/aspeed: Rename IRQ table and machine > name for AST2700 A0 > > On 2/13/25 04:35, Jamin Lin wrote: > > Currently, AST2700 SoC only supports A0. To support AST2700 A1, rename > > its IRQ table and machine name. > > > > Signed-off-by:

Re: [RFC 1/2] system/memory: Allow creating IOMMU mappings from RAM discard populate notifiers

2025-02-20 Thread Chenyi Qiang
On 2/21/2025 3:39 AM, David Hildenbrand wrote: > On 20.02.25 17:13, Jean-Philippe Brucker wrote: >> For Arm CCA we'd like the guest_memfd discard notifier to call the IOMMU >> notifiers and create e.g. VFIO mappings. The default VFIO discard >> notifier isn't sufficient for CCA because the DMA a

[RESEND PATCH] hw/sensors: Add temperature SI705x sensor

2025-02-20 Thread Ilya Chichkov
Add SI705x temperature sensor with I2C interface and allow setting temperature, VDD status and measurement resolution through properties. This commit adds support for interfacing with it and implements functionality for sensor's commands. Datasheet: https://www.integrated-circuit.com/pdf/502/391/4

[PATCH] migration: Fix UAF for incoming migration on MigrationState

2025-02-20 Thread Peter Xu
On the incoming migration side, QEMU uses a coroutine to load all the VM states. Inside, it may reference MigrationState on global states like migration capabilities, parameters, error state, shared mutexes and more. However there's nothing yet to make sure MigrationState won't get destroyed (e.g

[PATCH 2/2] pvg: add option to configure it out

2025-02-20 Thread Paolo Bonzini
... and also to require it (--enable-pvg). While at it, unify the dependency() call for pvg and metal, which simplifies the logic a bit. Note that all other Apple frameworks are either required or always-present, therefore do not add them to the summary in the same way as PVG. Signed-off-by: Pao

[PATCH 1/2] pvg: do not enable it on cross-architecture targets

2025-02-20 Thread Paolo Bonzini
PVG is not cross-architecture; the PVG guest drivers with x86-64 macOS do not give useful results with the aarch64 macOS host PVG framework, and vice versa. To express this repurpose CONFIG_MAC_PVG, making it true only if the target has the same architecture as the host. Furthermore, remove apple

[PATCH 0/2] pvg: clean up Kconfig

2025-02-20 Thread Paolo Bonzini
Do not enable Apple ParavirtualizedGraphics on cross-architecture targets, where it is not supported by the drivers, and add an option to configure it out just like most others external dependencies. Only compile-tested on non-Mac for now, but CI is in progress. Paolo Paolo Bonzini (2): pvg: d

Re: [PATCH 0/4] testing/next (aarch64 virt gpu tests)

2025-02-20 Thread Peter Maydell
On Wed, 19 Feb 2025 at 15:00, Alex Bennée wrote: > > Hi, > > As I was looking at the native context patches I realised our existing > GPU testing is a little sparse. I took the opportunity to split the > test from the main virt test and then extend it to exercise the 3 > current display modes (vir

Re: [PATCH v6 2/4] migration: enable multifd and postcopy together

2025-02-20 Thread Fabiano Rosas
Prasad Pandit writes: > Hello, > > On Wed, 19 Feb 2025 at 22:53, Fabiano Rosas wrote: >> I don't see anything stopping postcopy_start() from being called in the >> source in relation to multifd recv threads being setup in the >> destination. So far it seems possible that the source is opening th

Re: [PATCH 0/4] testing/next (aarch64 virt gpu tests)

2025-02-20 Thread Peter Maydell
On Thu, 20 Feb 2025 at 11:29, Peter Maydell wrote: > > On Wed, 19 Feb 2025 at 15:00, Alex Bennée wrote: > > > > Hi, > > > > As I was looking at the native context patches I realised our existing > > GPU testing is a little sparse. I took the opportunity to split the > > test from the main virt te

Re: [PATCH v3 00/23] hw/uefi: add uefi variable service

2025-02-20 Thread Ilias Apalodimas
Hi Alex, Ard, Gerd, Thanks for roping me in, On Thu, 13 Feb 2025 at 12:13, Ard Biesheuvel wrote: > > On Thu, 13 Feb 2025 at 11:11, Alexander Graf wrote: > > > > > > On 13.02.25 10:41, Ard Biesheuvel wrote: > > > On Tue, 11 Feb 2025 at 10:23, Gerd Hoffmann wrote: > > >> This patch adds a virtua

Re: [PATCH] Kconfig: Extract CONFIG_USB_CHIPIDEA from CONFIG_IMX

2025-02-20 Thread Peter Maydell
On Sun, 9 Feb 2025 at 10:36, Bernhard Beschow wrote: > > TYPE_CHIPIDEA models an IP block which is also used in TYPE_ZYNQ_MACHINE which > itself is not an IMX device. CONFIG_ZYNQ selects CONFIG_USB_EHCI_SYSBUS while > TYPE_CHIPIDEA is a separate compilation unit, so only works by accident if > CON

Re: [PATCH v2] target/arm: Fix signed integer overflow undefined behavior.

2025-02-20 Thread Peter Maydell
On Wed, 19 Feb 2025 at 16:55, Stephen Longfield wrote: > > The problem is internal to t32_expandimm_imm, the imm intermediate > immediate value. > > It's extracted via: int imm = extract32(x, 0, 8);, so the value will be > between 0-255 > > It is then multiplied by one of 1, 0x00010001, 0x01000100

Re: [PATCH] migration: Fix UAF for incoming migration on MigrationState

2025-02-20 Thread Fabiano Rosas
Peter Xu writes: > On the incoming migration side, QEMU uses a coroutine to load all the VM > states. Inside, it may reference MigrationState on global states like > migration capabilities, parameters, error state, shared mutexes and more. > > However there's nothing yet to make sure MigrationSt

Re: [PATCH v5 0/8] mulate Intel RDT features needed to mount ResCtrl in Linux

2025-02-20 Thread Michael S. Tsirkin
On Fri, Dec 13, 2024 at 05:26:37PM +, Hendrik Wuethrich wrote: > From: Hendrik Wüthrich > > The aim of this patch series is to emulate Intel RDT features in order > to make testing of the linux Resctrl subsystem possible with Qemu. > > A branch with the patches applied can be found at: > htt

Re: [PATCH v2 04/11] rust/qemu-api: Add wrappers to run futures in QEMU

2025-02-20 Thread Kevin Wolf
Am 20.02.2025 um 07:35 hat Zhao Liu geschrieben: > > +/// Use QEMU's event loops to run a Rust [`Future`] to completion and > > return its result. > > +/// > > +/// This function must be called in coroutine context. If the future isn't > > ready yet, it yields. > > +pub fn qemu_co_run_future(futu

Re: [PATCH] docs/about: Change notes on x86 machine type deprecation into a general one

2025-02-20 Thread Michael S. Tsirkin
On Thu, Jan 16, 2025 at 10:59:10AM +, Daniel P. Berrangé wrote: > On Thu, Jan 16, 2025 at 09:19:20AM +, Daniel P. Berrangé wrote: > > On Thu, Jan 16, 2025 at 09:48:50AM +0100, Philippe Mathieu-Daudé wrote: > > > On 16/1/25 07:46, Thomas Huth wrote: > > > > We now have a general note about v

Re: [PATCH v3 1/3] hw/cxl/cxl-mailbox-utils: Add support for Media operations discovery commands cxl r3.2 (8.2.10.9.5.3)

2025-02-20 Thread Jonathan Cameron via
On Thu, 20 Feb 2025 10:57:22 +0530 Vinayak Holikatti wrote: > CXL spec 3.2 section 8.2.10.9.5.3 describes media operations commands. > CXL devices supports media operations discovery command. > > Signed-off-by: Vinayak Holikatti Hi Vinayak, Rather than go around again, I've applied this to my

Re: [PATCH RESEND] i386: Only configure HPET firmware info when HPET is enabled

2025-02-20 Thread Michael S. Tsirkin
On Tue, Jan 21, 2025 at 10:01:21PM +0800, Zhao Liu wrote: > At present, the hpet_cfg is written unconditionally since 40ac17cd56eb > ("pass info about hpets to seabios.]"), because it concerns ACPI HPET is > created unconditionally. > > But that fact has changed since 51124bbfd2ea ("i386: acpi: Do

Re: [PATCH v5 03/17] hw/ssi: Make flash size a property in NPCM7XX FIU

2025-02-20 Thread Peter Maydell
On Wed, 19 Feb 2025 at 18:46, Hao Wu wrote: > > This allows different FIUs to have different flash sizes, useful > in NPCM8XX which has multiple different sized FIU modules. > > Reviewed-by: Peter Maydell > Signed-off-by: Hao Wu > Reviewed-by: Philippe Mathieu-Daude > @@ -543,6 +554,7 @@ stati

Re: [PATCH] docs/about: Change notes on x86 machine type deprecation into a general one

2025-02-20 Thread Thomas Huth
On 20/02/2025 15.59, Michael S. Tsirkin wrote: On Thu, Jan 16, 2025 at 10:59:10AM +, Daniel P. Berrangé wrote: On Thu, Jan 16, 2025 at 09:19:20AM +, Daniel P. Berrangé wrote: On Thu, Jan 16, 2025 at 09:48:50AM +0100, Philippe Mathieu-Daudé wrote: On 16/1/25 07:46, Thomas Huth wrote: W

Re: [PATCH v3] hw/cxl/cxl-mailbox-utils: CXL CCI Get/Set alert config commands implmented as per CXL Specification 3.2 section 8.2.10.9.3

2025-02-20 Thread Jonathan Cameron via
On Tue, 18 Feb 2025 10:58:00 +0530 Sweta Kumari wrote: Title is a bit long so I cut it after commands. > 1)get alert configuration(Opcode 4201h) > 2)set alert configuration(Opcode 4202h) > > The patch is generated against the Johnathan's tree > https://gitlab.com/jic23/qemu.git and branch cxl-2

Re: [PATCH 0/5] accel/tcg: Clean cpu_memory_rw_debug() up

2025-02-20 Thread Philippe Mathieu-Daudé
On 17/2/25 14:06, Philippe Mathieu-Daudé wrote: Philippe Mathieu-Daudé (5): accel/accel-cpu-target.h: Include missing 'cpu.h' header accel/tcg: Include missing bswap headers in user-exec.c accel/tcg: Take mmap lock in the whole cpu_memory_rw_debug() function accel/tcg: Avoid using lo

Re: [PATCH] migration: Fix UAF for incoming migration on MigrationState

2025-02-20 Thread Peter Xu
On Thu, Feb 20, 2025 at 11:06:12AM -0300, Fabiano Rosas wrote: > Peter Xu writes: > > > On the incoming migration side, QEMU uses a coroutine to load all the VM > > states. Inside, it may reference MigrationState on global states like > > migration capabilities, parameters, error state, shared m

Re: [PATCH] hw/virtio/vhost: Disable IOTLB callbacks when IOMMU gets disabled

2025-02-20 Thread Michael S. Tsirkin
On Fri, Jan 31, 2025 at 10:55:26AM +0100, Eric Auger wrote: > > I tested [PATCH] virtio: Remove virtio devices on device_shutdown() > https://lore.kernel.org/all/20240808075141.3433253-1-kirill.shute...@linux.intel.com/ > > and it fixes my issue > > Eric To make sure, we are dropping this in f

Re: [PATCH v5 0/8] mulate Intel RDT features needed to mount ResCtrl in Linux

2025-02-20 Thread Hendrik Wüthrich
On Thu, Feb 20, 2025 at 3:50 PM Michael S. Tsirkin wrote: > > On Fri, Dec 13, 2024 at 05:26:37PM +, Hendrik Wuethrich wrote: > > From: Hendrik Wüthrich > > > > The aim of this patch series is to emulate Intel RDT features in order > > to make testing of the linux Resctrl subsystem possible wi

Re: [PATCH] qom: Use command line syntax for default values in help

2025-02-20 Thread Michael S. Tsirkin
On Fri, Feb 07, 2025 at 02:53:43PM +0900, Akihiko Odaki wrote: > object_property_help() uses the conventional command line syntax instead > of the JSON syntax. In particular, > - Key-value pairs are written in the command line syntax. > - bool description passed to the function says on/off instead

Re: [PATCH v5 1/8] i386: Add Intel RDT device and State to config.

2025-02-20 Thread Jonathan Cameron via
On Fri, 13 Dec 2024 17:26:38 + Hendrik Wuethrich wrote: > From: ‪Hendrik Wüthrich > > Change config to show RDT, add minimal code to the rdt.c module to make > sure things still compile. > > Signed-off-by: Hendrik Wüthrich Hi, A few drive by comments. > --- > hw/i386/Kconfig | 4

Re: [PATCH v5 4/4] virtio: Convert feature properties to OnOffAuto

2025-02-20 Thread Michael S. Tsirkin
On Sat, Feb 08, 2025 at 04:51:10PM +0900, Akihiko Odaki wrote: > Some features are not always available with vhost. Legacy features are > not available with vp_vdpa in particular. virtio devices used to disable > them when not available even if the corresponding properties were > explicitly set to

Re: [PATCH v3 3/3] hw/cxl/cxl-mailbox-utils: Add support for Media operations Sanitize and Write Zeros commands cxl r3.2(8.2.10.9.5.3)

2025-02-20 Thread Jonathan Cameron via
On Thu, 20 Feb 2025 10:57:24 +0530 Vinayak Holikatti wrote: > CXL spec 3.2 section 8.2.10.9.5.3 describes media operations commands. > CXL devices supports media operations Sanitize and Write zero command. > > Signed-off-by: Vinayak Holikatti Another one where I made some minor tweaks whilst a

Re: [PATCH 0/4] testing/next (aarch64 virt gpu tests)

2025-02-20 Thread Alex Bennée
Peter Maydell writes: > On Wed, 19 Feb 2025 at 15:00, Alex Bennée wrote: >> >> Hi, >> >> As I was looking at the native context patches I realised our existing >> GPU testing is a little sparse. I took the opportunity to split the >> test from the main virt test and then extend it to exercise th

Re: [RFC 0/2] hw/vfio/pci: Prevent BARs from being dma mapped in d3hot state

2025-02-20 Thread Alex Williamson
On Thu, 20 Feb 2025 08:07:23 -0700 Alex Williamson wrote: > On Thu, 20 Feb 2025 11:45:35 +0100 > Eric Auger wrote: > > > Hi Alex, > > > > On 2/20/25 11:31 AM, Eric Auger wrote: > > > > > > Hi Alex, > > > > > > On 2/19/25 10:19 PM, Alex Williamson wrote: > > >> On Wed, 19 Feb 2025 11:58

Re: [PATCH v4 14/24] hw/uefi: add var-service-json.c + qapi for NV vars.

2025-02-20 Thread Markus Armbruster
Gerd Hoffmann writes: > Define qapi schema for the uefi variable store state. > > Use it and the generated visitor helper functions to store persistent > (EFI_VARIABLE_NON_VOLATILE) variables in JSON format on disk. > > Signed-off-by: Gerd Hoffmann [...] > diff --git a/qapi/meson.build b/qapi/

Re: [PATCH] hw/i386/amd_iommu: Don't leak memory in amdvi_update_iotlb()

2025-02-20 Thread Alejandro Jimenez
+ Suravee On 2/17/25 02:26, Philippe Mathieu-Daudé wrote: On 31/7/24 19:00, Peter Maydell wrote: In amdvi_update_iotlb() we will only put a new entry in the hash table if to_cache.perm is not IOMMU_NONE.  However we allocate the memory for the new AMDVIIOTLBEntry and for the hash table key rega

Re: [PATCH 2/2] [NOT-FOR-MERGE] Add qtest for migration over RDMA

2025-02-20 Thread Peter Xu
On Thu, Feb 20, 2025 at 05:40:38PM +0800, Li Zhijian wrote: > On 19/02/2025 22:11, Peter Xu wrote: > > then > > in the test it tries to detect rdma link and fetch the ip only > It should work without root permission if we just*detect* and*fetch ip*. > > Do you also mean we c

Re: [PATCH] migration: Fix UAF for incoming migration on MigrationState

2025-02-20 Thread Fabiano Rosas
Peter Xu writes: > On Thu, Feb 20, 2025 at 11:06:12AM -0300, Fabiano Rosas wrote: >> Peter Xu writes: >> >> > On the incoming migration side, QEMU uses a coroutine to load all the VM >> > states. Inside, it may reference MigrationState on global states like >> > migration capabilities, paramet

Re: [PATCH] vdpa: Allow vDPA to work on big-endian machine

2025-02-20 Thread Michael S. Tsirkin
On Tue, Feb 11, 2025 at 10:19:23AM -0600, Konstantin Shkolnyy wrote: > Add .set_vnet_le() function that always returns success, assuming that > vDPA h/w always implements LE data format. Otherwise, QEMU disables vDPA and > outputs the message: > "backend does not support LE vnet headers; falling ba

Re: [PATCH] hw/virtio/vhost: Disable IOTLB callbacks when IOMMU gets disabled

2025-02-20 Thread Eric Auger
Hi Michael, On 2/20/25 4:25 PM, Michael S. Tsirkin wrote: > On Fri, Jan 31, 2025 at 10:55:26AM +0100, Eric Auger wrote: >> I tested [PATCH] virtio: Remove virtio devices on device_shutdown() >> https://lore.kernel.org/all/20240808075141.3433253-1-kirill.shute...@linux.intel.com/ >> >> and it fixe

Re: [PATCH] migration: Fix UAF for incoming migration on MigrationState

2025-02-20 Thread Juraj Marcin
On 2025-02-20 11:06, Fabiano Rosas wrote: > Peter Xu writes: > > > On the incoming migration side, QEMU uses a coroutine to load all the VM > > states. Inside, it may reference MigrationState on global states like > > migration capabilities, parameters, error state, shared mutexes and more. > >

Re: [PATCH v2 0/3] CXL CCI Log Commands implementation

2025-02-20 Thread Jonathan Cameron via
On Tue, 18 Feb 2025 14:27:28 +0530 Arpit Kumar wrote: > CXL CCI log commands implmented as per CXL Specification 3.2 8.2.10.5 > 1) get_log_capabilities (Opcode 0402h) > 2) clear_log (Opcode 0403h) > 3) populate_log (Opcode 0404h) > > This v2 patch addresses the feedback from the v1 patch and inc

Re: [PATCH] docs/cxl: Add serial number for persistent-memdev

2025-02-20 Thread Jonathan Cameron via
On Mon, 17 Feb 2025 19:20:39 +0800 Yuquan Wang wrote: > Add serial number parameter in the cxl persistent examples. > > Signed-off-by: Yuquan Wang Looks good. I've queued it up on my gitlab staging tree, but Michael if you want to pick this one directly that's fine as well. I should be pushin

[PATCH 3/3] target/riscv/kvm: reset all available KVM CSRs in kvm_reset()

2025-02-20 Thread Daniel Henrique Barboza
Explictly reset env->mstatus and env->sie. Add a comment about env->mip being read/written into KVM 'sip' CSR. We're also not read/writing 'scounteren' which is available in the KVM UAPI. Add it in kvm_reset() and get/put_regs_csr(). Signed-off-by: Daniel Henrique Barboza --- target/riscv/kvm/k

[PATCH 2/3] target/riscv/kvm: use env->sie to read/write 'sie' CSR

2025-02-20 Thread Daniel Henrique Barboza
Using env->sie is clearer than using env->mie. Signed-off-by: Daniel Henrique Barboza --- target/riscv/kvm/kvm-cpu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/riscv/kvm/kvm-cpu.c b/target/riscv/kvm/kvm-cpu.c index 484b6afe7c..fea03f3657 100644 --- a/target/ri

[PATCH 0/3] target/riscv/kvm: reset time changes

2025-02-20 Thread Daniel Henrique Barboza
Hi, These patches were done in the context of gitlab #2573 [1]. The gitlab entry per se will probably be closed as a guest software bug, but while working on it I noticed that we're writing a TCG-initialized env->mstatus in KVM. This is happening because riscv_cpu_reset_hold() is doing all TCG re

[PATCH 1/3] target/riscv/cpu: ignore TCG init for KVM CPUs in reset_hold

2025-02-20 Thread Daniel Henrique Barboza
riscv_cpu_reset_hold() does a lot of TCG-related initializations that aren't relevant for KVM, but nevertheless are impacting the reset state of KVM vcpus. When running a KVM guest, kvm_riscv_reset_vcpu() is called at the end of reset_hold(). At that point env->mstatus is initialized to a non-zero

[RFC 2/2] target/arm/kvm-rme: Add DMA remapping for the shared memory region

2025-02-20 Thread Jean-Philippe Brucker
In Arm CCA, the guest-physical address space is split in half. The top half represents memory shared between guest and host, and the bottom half is private to the guest. From QEMU's point of view, the two halves are merged into a single region, and pages within this region are either shared or priv

[RFC 0/2] arm: Add DMA remapping for CCA

2025-02-20 Thread Jean-Philippe Brucker
These two patches will be included in the series that adds support for Arm CCA guests to QEMU, which isn't ready to be merged [1], but I'm sending them as RFC first to seek advice about the best way to implement this. There is a breaking change to CCA guests, where DMA addresses now have the "shar

[RFC 1/2] system/memory: Allow creating IOMMU mappings from RAM discard populate notifiers

2025-02-20 Thread Jean-Philippe Brucker
For Arm CCA we'd like the guest_memfd discard notifier to call the IOMMU notifiers and create e.g. VFIO mappings. The default VFIO discard notifier isn't sufficient for CCA because the DMA addresses need a translation (even without vIOMMU). At the moment: * guest_memfd_state_change() calls the pop

Re: [PATCH v5 00/17] hw/arm: Add NPCM8XX Support

2025-02-20 Thread Peter Maydell
On Wed, 19 Feb 2025 at 18:46, Hao Wu wrote: > > Changes since v4: > > 1. Bump vmstate versions on NPCM CLK and GCR modules. > 2. Remove "hw/boards.h" include in npcm8xx.h and add it in npcm8xx*.c > 3. Use cpu_to_le32 instead of tswap32 in npcm8xx.c > I've applied this to target-arm.next with the

[PULL 29/41] hw/misc: Move NPCM7XX GCR to NPCM GCR

2025-02-20 Thread Peter Maydell
From: Hao Wu A lot of NPCM7XX and NPCM8XX GCR modules share the same code, this commit moves the NPCM7XX GCR to NPCM GCR for these properties. Reviewed-by: Peter Maydell Signed-off-by: Hao Wu Message-id: 20250219184609.1839281-6-wuhao...@google.com Signed-off-by: Peter Maydell --- include/hw

[PULL 12/41] target/arm: Remove CP_ACCESS_TRAP handling

2025-02-20 Thread Peter Maydell
There are no longer any uses of CP_ACCESS_TRAP in access functions, because we have converted them all to use either CP_ACCESS_TRAP_EL1 or CP_ACCESS_TRAP_UNCATEGORIZED, as appropriate. Remove the handling of bare CP_ACCESS_TRAP from the access_check_cp_reg() helper, so that it now asserts if an acc

[PULL 04/41] target/arm: Report correct syndrome for UNDEFINED LOR sysregs when NS=0

2025-02-20 Thread Peter Maydell
The pseudocode for the accessors for the LOR sysregs says they are UNDEFINED if SCR_EL3.NS is 0. We were reporting the wrong syndrome value here; use CP_ACCESS_TRAP_UNCATEGORIZED. Cc: qemu-sta...@nongnu.org Fixes: 2d7137c10faf ("target/arm: Implement the ARMv8.1-LOR extension") Signed-off-by: Pete

[PULL 02/41] target/arm: Report correct syndrome for UNDEFINED AT ops with wrong NSE, NS

2025-02-20 Thread Peter Maydell
R_NYXTL says that these AT insns should be UNDEFINED if they would operate on an EL lower than EL3 and SCR_EL3.{NSE,NS} is set to the Reserved {1, 0}. We were incorrectly reporting them with the wrong syndrome; use CP_ACCESS_TRAP_UNCATEGORIZED so they are reported as UNDEFINED. Cc: qemu-sta...@non

[PULL 22/41] hw/cpu/arm_mpcore: Remove default values for GIC external IRQs

2025-02-20 Thread Peter Maydell
From: Philippe Mathieu-Daudé Implicit default values are often hard to figure out, better be explicit. Now that all boards explicitly set the number of GIC external IRQs, remove the default values (displaying an error message if it is out of range). Signed-off-by: Philippe Mathieu-Daudé Reviewe

[PULL 31/41] hw/misc: Add support for NPCM8XX GCR

2025-02-20 Thread Peter Maydell
From: Hao Wu Reviewed-by: Peter Maydell Signed-off-by: Hao Wu Message-id: 20250219184609.1839281-8-wuhao...@google.com Signed-off-by: Peter Maydell --- include/hw/misc/npcm_gcr.h | 6 +- hw/misc/npcm_gcr.c | 133 - 2 files changed, 134 insertions(

[PULL 30/41] hw/misc: Add nr_regs and cold_reset_values to NPCM GCR

2025-02-20 Thread Peter Maydell
From: Hao Wu These 2 values are different between NPCM7XX and NPCM8XX GCRs. So we add them to the class and assign different values to them. Reviewed-by: Peter Maydell Signed-off-by: Hao Wu Message-id: 20250219184609.1839281-7-wuhao...@google.com Signed-off-by: Peter Maydell --- include/hw/m

[PULL 00/41] target-arm queue

2025-02-20 Thread Peter Maydell
o staging (2025-02-19 08:36:45 +0800) are available in the Git repository at: https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20250220 for you to fetch changes up to 1c3169179b8242866316108386800379c4e22974: docs/system/arm: Add Description for NPCM8XX SoC (2025-0

[PULL 01/41] target/arm: Report correct syndrome for UNDEFINED CNTPS_*_EL1 from EL2 and NS EL1

2025-02-20 Thread Peter Maydell
The access pseudocode for the CNTPS_TVAL_EL1, CNTPS_CTL_EL1 and CNTPS_CVAL_EL1 secure timer registers says that they are UNDEFINED from EL2 or NS EL1. We incorrectly return CP_ACCESS_TRAP from the access function in these cases, which means that we report the wrong syndrome value to the target EL.

[PULL 40/41] hw/arm: Add NPCM845 Evaluation board

2025-02-20 Thread Peter Maydell
From: Hao Wu Reviewed-by: Peter Maydell Signed-off-by: Hao Wu Message-id: 20250219184609.1839281-17-wuhao...@google.com Signed-off-by: Peter Maydell --- include/hw/arm/npcm8xx.h | 21 hw/arm/npcm8xx_boards.c | 253 +++ hw/arm/meson.build | 2

[PULL 36/41] hw/misc: Add nr_regs and cold_reset_values to NPCM CLK

2025-02-20 Thread Peter Maydell
From: Hao Wu These 2 values are different between NPCM7XX and NPCM8XX CLKs. So we add them to the class and assign different values to them. Reviewed-by: Peter Maydell Signed-off-by: Hao Wu Message-id: 20250219184609.1839281-13-wuhao...@google.com Signed-off-by: Peter Maydell --- include/hw/

[PULL 39/41] hw/arm: Add NPCM8XX SoC

2025-02-20 Thread Peter Maydell
From: Hao Wu Signed-off-by: Hao Wu Reviewed-by: Peter Maydell Message-id: 20250219184609.1839281-16-wuhao...@google.com Signed-off-by: Peter Maydell --- configs/devices/aarch64-softmmu/default.mak | 1 + include/hw/arm/npcm8xx.h| 106 +++ hw/arm/npcm8xx.c

[PULL 11/41] target/arm: Use TRAP_UNCATEGORIZED for XScale CPAR traps

2025-02-20 Thread Peter Maydell
On XScale CPUs, there is no EL2 or AArch64, so no syndrome register. These traps are just UNDEFs in the traditional AArch32 sense, so CP_ACCESS_TRAP_UNCATEGORIZED is more accurate than CP_ACCESS_TRAP. This has no visible behavioural change, because the guest doesn't have a way to see the syndrome v

[PULL 24/41] target/arm: Use uint32_t in t32_expandimm_imm()

2025-02-20 Thread Peter Maydell
From: Stephen Longfield In t32_expandimm_imm(), we take an 8 bit value XY and construct a 32-bit value which might be of the form XY, 00XY00XY, XY00XY00, or XYXYXYXY. We do this with multiplications, and we use an 'int' type. For the cases where we're setting the high byte of the 32-bit value to

[PULL 14/41] target/arm: Correct errors in WFI/WFE trapping

2025-02-20 Thread Peter Maydell
The code for WFI/WFE trapping has several errors: * it wasn't using arm_sctlr(), so it would look at SCTLR_EL1 even if the CPU was in the EL2&0 translation regime * it was raising UNDEF, not Monitor Trap, for traps to AArch32 EL3 because of SCR.{TWE,TWI} * it was not honouring SCR.{TWE,TWI

[PULL 25/41] roms: Update vbootrom to 1287b6e

2025-02-20 Thread Peter Maydell
From: Hao Wu This newer vbootrom supports NPCM8xx. Similar to the NPCM7XX one it supports loading the UBoot from the SPI device and not more. We updated the npcm7xx bootrom to be compiled from this version. Reviewed-by: Peter Maydell Signed-off-by: Hao Wu Message-id: 20250219184609.1839281-2-

[PULL 06/41] hw/intc/arm_gicv3_cpuif: Don't downgrade monitor traps for AArch32 EL3

2025-02-20 Thread Peter Maydell
In the gicv3_{irq,fiq,irqfiq}_access() functions, there is a check which downgrades a CP_ACCESS_TRAP_EL3 to CP_ACCESS_TRAP if EL3 is not AArch64. This has been there since the GIC was first implemented, but it isn't right: if we are trapping because of SCR.IRQ or SCR.FIQ then we definitely want to

[PULL 27/41] hw/ssi: Make flash size a property in NPCM7XX FIU

2025-02-20 Thread Peter Maydell
From: Hao Wu This allows different FIUs to have different flash sizes, useful in NPCM8XX which has multiple different sized FIU modules. Reviewed-by: Peter Maydell Signed-off-by: Hao Wu Reviewed-by: Philippe Mathieu-Daude Message-id: 20250219184609.1839281-4-wuhao...@google.com [PMM: flash_si

[PULL 15/41] hw/arm/exynos4210: Replace magic 32 by proper 'GIC_INTERNAL' definition

2025-02-20 Thread Peter Maydell
From: Philippe Mathieu-Daudé The 32 IRQ lines skipped are the GIC internal ones. Use the GIC_INTERNAL definition for clarity. No logical change. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-id: 20250212154333.28644-2-phi...@linaro.org Signed-off-by: Peter Maydel

[PULL 13/41] target/arm: Rename CP_ACCESS_TRAP_UNCATEGORIZED to CP_ACCESS_UNDEFINED

2025-02-20 Thread Peter Maydell
CP_ACCESS_TRAP_UNCATEGORIZED is technically an accurate description of what this return value from a cpreg accessfn does, but it's liable to confusion because it doesn't match how the Arm ARM pseudocode indicates this case. What it does is an EXCP_UDEF with a zero ("uncategorized") syndrome value,

[PULL 38/41] hw/net: Add NPCM8XX PCS Module

2025-02-20 Thread Peter Maydell
From: Hao Wu The PCS exists in NPCM8XX's GMAC1 and is used to control the SGMII PHY. This implementation contains all the default registers and the soft reset feature that are required to load the Linux kernel driver. Further features have not been implemented yet. Signed-off-by: Hao Wu Reviewe

[PULL 07/41] target/arm: Honour SDCR.TDCC and SCR.TERR in AArch32 EL3 non-Monitor modes

2025-02-20 Thread Peter Maydell
There are not many traps in AArch32 which should trap to Monitor mode, but these trap bits should trap not just lower ELs to Monitor mode but also the non-Monitor modes running at EL3 (i.e. Secure System, Secure Undef, etc). We get this wrong because the relevant access functions implement the AA

[PULL 19/41] hw/arm/xilinx_zynq: Specify explicitly the GIC has 64 external IRQs

2025-02-20 Thread Peter Maydell
From: Philippe Mathieu-Daudé Looking at the Zynq 7000 SoC Technical Reference Manual (UG585 v1.14) on Appendix A: Register Details, the mpcore Interrupt Controller Type Register (ICDICTR) has the IT_Lines_Number field read-only with value 0x2, described as: IT_Lines_Number b00010 =

[PULL 23/41] Kconfig: Extract CONFIG_USB_CHIPIDEA from CONFIG_IMX

2025-02-20 Thread Peter Maydell
From: Bernhard Beschow TYPE_CHIPIDEA models an IP block which is also used in TYPE_ZYNQ_MACHINE which itself is not an IMX device. CONFIG_ZYNQ selects CONFIG_USB_EHCI_SYSBUS while TYPE_CHIPIDEA is a separate compilation unit, so only works by accident if CONFIG_IMX is given. Fix that by extractin

[PULL 10/41] target/arm: Use CP_ACCESS_TRAP_EL1 for traps that are always to EL1

2025-02-20 Thread Peter Maydell
We currently use CP_ACCESS_TRAP in a number of access functions where we know we're currently at EL0; in this case the "usual target EL" is EL1, so CP_ACCESS_TRAP and CP_ACCESS_TRAP_EL1 behave the same. Use CP_ACCESS_TRAP_EL1 to more closely match the pseudocode for this sort of check. Note that i

[PULL 16/41] hw/arm/exynos4210: Specify explicitly the GIC has 64 external IRQs

2025-02-20 Thread Peter Maydell
From: Philippe Mathieu-Daudé When not specified, Cortex-A9MP configures its GIC with 64 external IRQs (see commit a32134aad89 "arm:make the number of GIC interrupts configurable"). Add the GIC_EXT_IRQS definition (with a comment) to make that explicit. Except explicitly setting a property value

[PULL 17/41] hw/arm/realview: Specify explicitly the GIC has 64 external IRQs

2025-02-20 Thread Peter Maydell
From: Philippe Mathieu-Daudé When not specified, Cortex-A9MP configures its GIC with 64 external IRQs (see commit a32134aad89 "arm:make the number of GIC interrupts configurable"). Add the GIC_EXT_IRQS definition (with a comment) to make that explicit. Except explicitly setting a property value

[PULL 08/41] hw/intc/arm_gicv3_cpuif(): Remove redundant tests of is_a64()

2025-02-20 Thread Peter Maydell
In the gicv3_{irq,fiq,irqfiq}_access() functions, in the arm_current_el(env) == 3 case we do the following test: if (!is_a64(env) && !arm_is_el3_or_mon(env)) { r = CP_ACCESS_TRAP_EL3; } In this check, the "!is_a64(env)" is redundant, because if we are at EL3 and in AArch64 then arm

[PULL 09/41] target/arm: Support CP_ACCESS_TRAP_EL1 as a CPAccessResult

2025-02-20 Thread Peter Maydell
In the CPAccessResult enum, the CP_ACCESS_TRAP* values indicate the equivalent of the pseudocode AArch64.SystemAccessTrap(..., 0x18), causing a trap to a specified exception level with a syndrome value giving information about the failing instructions. In the pseudocode, such traps are always take

[PULL 35/41] hw/misc: Move NPCM7XX CLK to NPCM CLK

2025-02-20 Thread Peter Maydell
From: Hao Wu A lot of NPCM7XX and NPCM8XX CLK modules share the same code, this commit moves the NPCM7XX CLK to NPCM CLK for these properties. Reviewed-by: Peter Maydell Signed-off-by: Hao Wu Message-id: 20250219184609.1839281-12-wuhao...@google.com Signed-off-by: Peter Maydell --- include/h

[PULL 37/41] hw/misc: Support NPCM8XX CLK Module Registers

2025-02-20 Thread Peter Maydell
From: Hao Wu NPCM8XX adds a few new registers and have a different set of reset values to the CLK modules. This patch supports them. This patch doesn't support the new clock values generated by these registers. Currently no modules use these new clock values so they are not necessary at this poi

[PULL 26/41] pc-bios: Add NPCM8XX vBootrom

2025-02-20 Thread Peter Maydell
From: Hao Wu The bootrom is a minimal bootrom used to load an NPCM8XX image. The source code is located in the same repo as the NPCM7XX one: github.com/google/vbootrom/tree/master/npcm8xx. Reviewed-by: Peter Maydell Signed-off-by: Hao Wu Message-id: 20250219184609.1839281-3-wuhao...@google.com

[PULL 18/41] hw/arm/xilinx_zynq: Replace IRQ_OFFSET -> GIC_INTERNAL

2025-02-20 Thread Peter Maydell
From: Philippe Mathieu-Daudé We already have a definition to distinct GIC internal IRQs versus external ones, use it. No logical changes. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20250212154333.28644-5-phi...@linaro.org Signed

[PULL 41/41] docs/system/arm: Add Description for NPCM8XX SoC

2025-02-20 Thread Peter Maydell
From: Hao Wu NPCM8XX SoC is the successor of the NPCM7XX. It features quad-core Cortex-A35 (Armv8, 64-bit) CPUs and some additional peripherals. This document describes the NPCM8XX SoC and an evaluation board (NPCM 845 EVB). Signed-off-by: Hao Wu Reviewed-by: Peter Maydell Message-id: 2025021

[PULL 33/41] hw/misc: Support 8-bytes memop in NPCM GCR module

2025-02-20 Thread Peter Maydell
From: Hao Wu The NPCM8xx GCR device can be accessed with 64-bit memory operations. This patch supports that. Reviewed-by: Peter Maydell Signed-off-by: Hao Wu Reviewed-by: Philippe Mathieu-Daude Message-id: 20250219184609.1839281-10-wuhao...@google.com Signed-off-by: Peter Maydell --- hw/mis

[PULL 28/41] hw/misc: Rename npcm7xx_gcr to npcm_gcr

2025-02-20 Thread Peter Maydell
From: Hao Wu NPCM7XX and NPCM8XX have a different set of GCRs and the GCR module needs to fit both. This commit changes the name of the GCR module. Future commits will add the support for NPCM8XX GCRs. Reviewed-by: Peter Maydell Signed-off-by: Hao Wu Message-id: 20250219184609.1839281-5-wuhao.

[PULL 34/41] hw/misc: Rename npcm7xx_clk to npcm_clk

2025-02-20 Thread Peter Maydell
From: Hao Wu NPCM7XX and NPCM8XX have a different set of CLK registers. This commit changes the name of the clk files to be used by both NPCM7XX and NPCM8XX CLK modules. Reviewed-by: Peter Maydell Signed-off-by: Hao Wu Message-id: 20250219184609.1839281-11-wuhao...@google.com Signed-off-by: Pe

[PULL 32/41] hw/misc: Store DRAM size in NPCM8XX GCR Module

2025-02-20 Thread Peter Maydell
From: Hao Wu NPCM8XX boot block stores the DRAM size in SCRPAD_B register in GCR module. Since we don't simulate a detailed memory controller, we need to store this information directly similar to the NPCM7XX's INCTR3 register. Reviewed-by: Peter Maydell Signed-off-by: Hao Wu Message-id: 20250

[PULL 03/41] target/arm: Report correct syndrome for UNDEFINED S1E2 AT ops at EL3

2025-02-20 Thread Peter Maydell
The pseudocode for AT S1E2R and AT S1E2W says that they should be UNDEFINED if executed at EL3 when EL2 is not enabled. We were incorrectly using CP_ACCESS_TRAP and reporting the wrong exception syndrome as a result. Use CP_ACCESS_TRAP_UNCATEGORIZED. Cc: qemu-sta...@nongnu.org Fixes: 2a47df953202e

Re: [PATCH 1/2] pvg: do not enable it on cross-architecture targets

2025-02-20 Thread Philippe Mathieu-Daudé
On 20/2/25 14:33, Paolo Bonzini wrote: PVG is not cross-architecture; the PVG guest drivers with x86-64 macOS do not give useful results with the aarch64 macOS host PVG framework, and vice versa. To express this repurpose CONFIG_MAC_PVG, making it true only if the target has the same architectur

[PULL 20/41] hw/arm/vexpress: Specify explicitly the GIC has 64 external IRQs

2025-02-20 Thread Peter Maydell
From: Philippe Mathieu-Daudé When not specified, Cortex-A9MP configures its GIC with 64 external IRQs, (see commit a32134aad89 "arm:make the number of GIC interrupts configurable"), and Cortex-15MP to 128 (see commit 528622421eb "hw/cpu/a15mpcore: Correct default value for num-irq"). The Versati

[PULL 21/41] hw/arm/highbank: Specify explicitly the GIC has 128 external IRQs

2025-02-20 Thread Peter Maydell
From: Philippe Mathieu-Daudé When not specified, Cortex-A9MP configures its GIC with 64 external IRQs, (see commit a32134aad89 "arm:make the number of GIC interrupts configurable"), and Cortex-15MP to 128 (see commit 528622421eb "hw/cpu/a15mpcore: Correct default value for num-irq"). The Caldexa

<    1   2   3   >