Re: [PATCH v2 4/4] x86/traps: Introduce early_traps_init() and simplify setup

2025-03-21 Thread Jan Beulich
On 20.03.2025 21:17, Andrew Cooper wrote: > Something I overlooked when last cleaning up exception handling is that a TSS > is not necessary if IST isn't configured, and IST isn't necessary until we're > running guest code. > > Introduce early_traps_init(), and rearrange the existing logic between

Re: [PATCH 4/4] x86/traps: Introduce early_traps_init() and simplify setup

2025-03-21 Thread Andrew Cooper
On 21/03/2025 6:52 am, Jan Beulich wrote: > On 20.03.2025 18:56, Andrew Cooper wrote: >> On 18/03/2025 3:26 pm, Jan Beulich wrote: >>> The sole dependency is percpu_init_areas(), >>> which runs - as even visible from patch context here - ahead of >>> early_traps_init(). >> percpu_init_areas() isn't

Re: [PATCH 11/16] xen/arm: Implement PSCI system suspend

2025-03-21 Thread Grygorii Strashko
Hi Mykola, On 05.03.25 11:11, Mykola Kvach wrote: From: Mirela Simonovic The implementation consists of: -Adding PSCI system suspend call as new PSCI function -Trapping PSCI system_suspend HVC -Implementing PSCI system suspend call (virtual interface that allows guests to suspend themselves)

Re: [PATCH 06/16] xen/arm: Introduce system suspend config option

2025-03-21 Thread Mykola Kvach
Hi, On Wed, Mar 12, 2025 at 12:29 AM Julien Grall wrote: > > Hi, > > On 05/03/2025 09:11, Mykola Kvach wrote: > > From: Mykola Kvach > > > > This option enables the system suspend support. This is the > > mechanism that allows the system to be suspended to RAM and > > later resumed. > > > > Sign

Re: [PATCH v9 7/8] xen/arm: enable dom0 to use PCI devices with pci-passthrough=no

2025-03-21 Thread Jan Beulich
On 21.03.2025 11:56, Mykyta Poturai wrote: > On 17.03.25 17:07, Jan Beulich wrote: >> On 14.03.2025 14:34, Mykyta Poturai wrote: >>> --- a/xen/arch/arm/pci/pci.c >>> +++ b/xen/arch/arm/pci/pci.c >>> @@ -16,9 +16,18 @@ >>> #include >>> #include >>> #include >>> +#include >>> #include >>

Re: [MINI-OS PATCH 03/12] add elf.h

2025-03-21 Thread Jan Beulich
On 21.03.2025 10:24, Juergen Gross wrote: > Add some definitions for accessing an ELF file. Only the file header > and the program header are needed. > > The main source for those are elfstructs.h and libelf.h from the Xen > tree. The license boiler plate of those files is being kept in the > resu

Re: [PATCH 06/16] xen/arm: Introduce system suspend config option

2025-03-21 Thread Jan Beulich
On 21.03.2025 10:49, Mykola Kvach wrote: > Hi, > > On Thu, Mar 13, 2025 at 5:37 PM Jan Beulich wrote: >> >> On 05.03.2025 10:11, Mykola Kvach wrote: >>> --- a/xen/arch/arm/Kconfig >>> +++ b/xen/arch/arm/Kconfig >>> @@ -475,6 +475,17 @@ config ARM64_HARDEN_BRANCH_PREDICTOR >>> config ARM32_HARDEN

Re: [PATCH v2 5/5] xen/arm: ffa: Enable VM to VM without firmware

2025-03-21 Thread Jens Wiklander
Hi Bertrand, On Fri, Mar 21, 2025 at 2:47 PM Bertrand Marquis wrote: > > Hi Jens, > > > On 21 Mar 2025, at 11:09, Jens Wiklander wrote: > > > > Hi, > > > > On Fri, Mar 21, 2025 at 10:25 AM Bertrand Marquis > > wrote: > >> > >> Hi Jens, > >> > >>> On 21 Mar 2025, at 09:55, Jens Wiklander > >>>

Re: [PATCH v2 5/5] xen/arm: ffa: Enable VM to VM without firmware

2025-03-21 Thread Bertrand Marquis
Hi Jens, > On 21 Mar 2025, at 15:00, Jens Wiklander wrote: > > Hi Bertrand, > > On Fri, Mar 21, 2025 at 2:47 PM Bertrand Marquis > wrote: >> >> Hi Jens, >> >>> On 21 Mar 2025, at 11:09, Jens Wiklander wrote: >>> >>> Hi, >>> >>> On Fri, Mar 21, 2025 at 10:25 AM Bertrand Marquis >>> wrote:

[PATCH v7] Avoid crash calling PrintErrMesg from efi_multiboot2

2025-03-21 Thread Frediano Ziglio
Although code is compiled with -fpic option data is not position independent. This causes data pointer to become invalid if code is not relocated properly which is what happens for efi_multiboot2 which is called by multiboot entry code. Code tested adding PrintErrMesg(L"Test message", EFI_BUFFE

Re: [PATCH v2 2/5] xen/arm: ffa: Introduce VM to VM support

2025-03-21 Thread Bertrand Marquis
Hi Jens, > On 20 Mar 2025, at 18:06, Jens Wiklander wrote: > > Hi, > > On Thu, Mar 20, 2025 at 4:47 PM Bertrand Marquis > wrote: >> >> Hi Jens, >> >> Thanks a lot for the review. >> >>> On 20 Mar 2025, at 15:20, Jens Wiklander wrote: >>> >>> Hi Bertrand, >>> >>> On Mon, Mar 10, 2025 at 3

[MINI-OS PATCH 02/12] kexec: add final kexec stage

2025-03-21 Thread Juergen Gross
Add the code and data definitions of the final kexec stage. Put the code and related data into a dedicated section in order to be able to copy it to another location. For this reason there must be no absolute relocations being used in the code or data. Being functionally related, add a function f

[MINI-OS PATCH 06/12] kexec: reserve memory below boundary

2025-03-21 Thread Juergen Gross
In order to support kexec any memory used during copying the new kernel to its final destination must not overlap with the destination area. In order to achieve that add a new interface allowing to mark all allocatable memory below a specific physical address as not available. This is done by wal

[MINI-OS PATCH 12/12] kexec: do the final kexec step

2025-03-21 Thread Juergen Gross
With all kexec preparations done, activate the new kernel. Signed-off-by: Juergen Gross --- kexec.c | 17 +++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/kexec.c b/kexec.c index 2db876e8..85b09959 100644 --- a/kexec.c +++ b/kexec.c @@ -169,6 +169,7 @@ int kexec(v

[MINI-OS PATCH 08/12] kexec: move used pages away for new kernel

2025-03-21 Thread Juergen Gross
Copying the new kexec kernel must not overwrite any pages still needed during this process. Those are especially the GDT, IDT and page tables. Move those to new allocated pages and update any related pointers. In case the kexec process is cancelled later, don't undo any page table moves, as the s

[MINI-OS PATCH 04/12] kexec: analyze new kernel for kexec

2025-03-21 Thread Juergen Gross
Analyze the properties of the new kernel to be loaded by kexec. The data needed is: - upper boundary in final location - copy and memory clear operations - entry point and entry parameter Signed-off-by: Juergen Gross --- arch/x86/kexec.c | 91 +++ include/kexec.

[MINI-OS PATCH 10/12] kexec: switch read-only area to be writable again

2025-03-21 Thread Juergen Gross
In order to allow writing the new kernel, make the readonly area covering current kernel text writable again. Signed-off-by: Juergen Gross --- kexec.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/kexec.c b/kexec.c index 16a0030a..2992f58f 100644 --- a/kexec.c +++ b/kexec.c @@ -184,6 +1

[MINI-OS PATCH 09/12] mm: change set_readonly() to change_readonly()

2025-03-21 Thread Juergen Gross
Rename set_readonly() to change_readonly() and add a parameter specifying whether it should set the kernel to readonly or to writable. At the same time move the boundary setting from the only caller into the function itself, avoiding the need to use the same boundaries in future, when it will be ca

Re: [PATCH 04/16] xen/cpu: prevent disable_nonboot_cpus crash on ARM64

2025-03-21 Thread Mykola Kvach
On Thu, Mar 13, 2025 at 5:43 PM Jan Beulich wrote: > > On 11.03.2025 21:47, Julien Grall wrote: > > Hi Mykola, > > > > On 05/03/2025 09:11, Mykola Kvach wrote: > >> If we call disable_nonboot_cpus on ARM64 with system_state set > >> to SYS_STATE_suspend, the following assertion will be triggered:

Re: [PATCH 05/16] xen/percpu: don't initialize percpu on resume

2025-03-21 Thread Mykola Kvach
Hi, On Thu, Mar 13, 2025 at 6:20 PM Jan Beulich wrote: > > On 13.03.2025 17:05, Jürgen Groß wrote: > > On 13.03.25 16:54, Jan Beulich wrote: > >> On 11.03.2025 21:59, Julien Grall wrote: > >>> On 05/03/2025 09:11, Mykola Kvach wrote: > Invocation of the CPU_UP_PREPARE notification > on

Re: [PATCH 07/16] xen/char: implement suspend/resume calls for SCIF driver

2025-03-21 Thread Mykola Kvach
Hi, On Wed, Mar 19, 2025 at 7:21 PM Grygorii Strashko wrote: > > > > On 05.03.25 11:11, Mykola Kvach wrote: > > From: Mykola Kvach > > > > The changes have been tested only on the Renesas R-Car-H3 Starter Kit board. > > > > Signed-off-by: Volodymyr Babchuk > > Signed-off-by: Oleksandr Andrushch

Re: [PATCH 06/16] xen/arm: Introduce system suspend config option

2025-03-21 Thread Grygorii Strashko
On 21.03.25 11:48, Mykola Kvach wrote: Hi, On Wed, Mar 12, 2025 at 12:29 AM Julien Grall wrote: Hi, On 05/03/2025 09:11, Mykola Kvach wrote: From: Mykola Kvach This option enables the system suspend support. This is the mechanism that allows the system to be suspended to RAM and later

Re: [PATCH v9 7/8] xen/arm: enable dom0 to use PCI devices with pci-passthrough=no

2025-03-21 Thread Jan Beulich
On 21.03.2025 15:50, Mykyta Poturai wrote: > On 21.03.25 15:41, Jan Beulich wrote: >> On 21.03.2025 11:56, Mykyta Poturai wrote: >>> On 17.03.25 17:07, Jan Beulich wrote: On 14.03.2025 14:34, Mykyta Poturai wrote: > --- a/xen/drivers/pci/physdev.c > +++ b/xen/drivers/pci/physdev.c

Re: [RFC PATCH v2] xen: add libafl-qemu fuzzer support

2025-03-21 Thread Julien Grall
Hi Stefano, Volodymyr, On 21/03/2025 22:32, Stefano Stabellini wrote: diff --git a/xen/arch/arm/psci.c b/xen/arch/arm/psci.c index b6860a7760..c7a51a1144 100644 --- a/xen/arch/arm/psci.c +++ b/xen/arch/arm/psci.c @@ -17,6 +17,7 @@ #include #include #include +#include /* * Whil

Re: [PATCH] xen: simplify bitmap_to_xenctl_bitmap for little endian

2025-03-21 Thread Stefano Stabellini
On Thu, 20 Mar 2025, Jan Beulich wrote: > On 20.03.2025 01:57, Stefano Stabellini wrote: > > On Wed, 19 Mar 2025, Jan Beulich wrote: > >> What about xenctl_bitmap_to_bitmap()? > > > > Let me see first if I managed to handle bitmap_to_xenctl_bitmap well. > > Well, the code looks correct to me, bu

Re: [PATCH 08/16] xen/arm: add watchdog domain suspend/resume helpers

2025-03-21 Thread Mykola Kvach
Hi, On Thu, Mar 13, 2025 at 5:34 PM Jan Beulich wrote: > > On 05.03.2025 10:11, Mykola Kvach wrote: > > From: Mykola Kvach > > > > This patch implements suspend/resume helpers for the watchdog. > > While a domain is suspended its watchdogs must be paused. Otherwise, > > if the domain stays in th

Re: [PATCH] xen/arm/efi: merge neighboring banks

2025-03-21 Thread Julien Grall
On 21/03/2025 22:22, Julien Grall wrote: Hi Stefano, On 21/03/2025 21:14, Stefano Stabellini wrote: When booting from U-Boot bootefi, there can be a high number of neighboring RAM banks. See for example: (XEN) RAM: - 00bf (XEN) RAM: 00c0 - 00

Re: [RFC PATCH v2] xen: add libafl-qemu fuzzer support

2025-03-21 Thread Stefano Stabellini
On Sat, 15 Mar 2025, Volodymyr Babchuk wrote: > LibAFL, which is a part of AFL++ project is a instrument that allows > us to perform fuzzing on beremetal code (Xen hypervisor in this case) > using QEMU as an emulator. It employs QEMU's ability to create > snapshots to run many tests relatively quic

Re: [PATCH 3/3] CHANGELOG: Minimum toolchain requirements

2025-03-21 Thread Oleksii Kurochko
On 3/20/25 4:59 PM, Andrew Cooper wrote: Signed-off-by: Andrew Cooper --- CC: Anthony PERARD CC: Michal Orzel CC: Jan Beulich CC: Julien Grall CC: Roger Pau Monné CC: Stefano Stabellini CC: Oleksii Kurochko --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b

Using Restricted DMA for virtio-pci

2025-03-21 Thread David Woodhouse
On Tue, 2021-02-09 at 14:21 +0800, Claire Chang wrote: > This series implements mitigations for lack of DMA access control on > systems without an IOMMU, which could result in the DMA accessing the > system memory at unexpected times and/or unexpected addresses, possibly > leading to data leakage o

Re: [PATCH v2 1/4] automation/cirrus-ci: use matrix keyword to generate per-version build tasks

2025-03-21 Thread Stefano Stabellini
On Thu, 20 Mar 2025, Roger Pau Monne wrote: > Move the current logic to use the matrix keyword to generate a task for > each version of FreeBSD we want to build Xen on. The matrix keyword > however cannot be used in YAML aliases, so it needs to be explicitly used > inside of each task, which creat

Re: [PATCH 2/3] Xen: Update compiler checks

2025-03-21 Thread Stefano Stabellini
On Thu, 20 Mar 2025, Andrew Cooper wrote: > We didn't really have a Clang check before, so add one while adjusting the GCC > check. > > Signed-off-by: Andrew Cooper Reviewed-by: Stefano Stabellini > --- > CC: Anthony PERARD > CC: Michal Orzel > CC: Jan Beulich > CC: Julien Grall > CC: Roge

Re: [PATCH v2 4/4] automation/cirrus-ci: add smoke tests for the FreeBSD builds

2025-03-21 Thread Stefano Stabellini
On Thu, 20 Mar 2025, Roger Pau Monne wrote: > Introduce a basic set of smoke tests using the XTF selftest image, and run > them on QEMU. Use the matrix keyword to create a different task for each > XTF flavor on each FreeBSD build. > > Signed-off-by: Roger Pau Monné > Acked-by: Oleksii Kurochko

Re: [PATCH v2 2/4] automation/cirrus-ci: build XTF

2025-03-21 Thread Stefano Stabellini
On Thu, 20 Mar 2025, Roger Pau Monne wrote: > In preparation for using the XTF selftests to smoke test the FreeBSD based > Xen builds. > > Signed-off-by: Roger Pau Monné Reviewed-by: Stefano Stabellini > --- > Changes since v1: > - Use production version. > --- > .cirrus.yml | 24 +++

Re: [PATCH 08/16] xen/arm: add watchdog domain suspend/resume helpers

2025-03-21 Thread Jan Beulich
On 21.03.2025 10:50, Mykola Kvach wrote: > On Thu, Mar 13, 2025 at 5:34 PM Jan Beulich wrote: >> On 05.03.2025 10:11, Mykola Kvach wrote: >>> +void watchdog_domain_resume(struct domain *d) >>> +{ >>> +unsigned int i; >>> + >>> +spin_lock(&d->watchdog_lock); >>> + >>> +for ( i = 0; i <

Re: Using Restricted DMA for virtio-pci

2025-03-21 Thread David Woodhouse
On Fri, 2025-03-21 at 14:32 -0400, Michael S. Tsirkin wrote: > On Fri, Mar 21, 2025 at 03:38:10PM +, David Woodhouse wrote: > > On Tue, 2021-02-09 at 14:21 +0800, Claire Chang wrote: > > > This series implements mitigations for lack of DMA access control on > > > systems without an IOMMU, which

Re: [PATCH] xen: add kconfig for event_fifo

2025-03-21 Thread Stefano Stabellini
On Thu, 20 Mar 2025, Jan Beulich wrote: > On 19.03.2025 00:40, Stefano Stabellini wrote: > > Evtchn fifos are not needed on smaller systems; the older interface is > > lightweight and sufficient. Make it possible to disable evtchn fifo. > > > > Signed-off-by: Stefano Stabellini > > Let me ask a

Re: [RFC PATCH v2] xen: add libafl-qemu fuzzer support

2025-03-21 Thread Julien Grall
Hi Volodymyr, On 15/03/2025 00:36, Volodymyr Babchuk wrote: LibAFL, which is a part of AFL++ project is a instrument that allows us to perform fuzzing on beremetal code (Xen hypervisor in this case) using QEMU as an emulator. It employs QEMU's ability to create snapshots to run many tests relati

Re: [PATCH v2] x86: make Viridian support optional

2025-03-21 Thread Alejandro Vallejo
On Fri Mar 21, 2025 at 9:26 AM GMT, Sergiy Kibrik wrote: > Add config option HVM_VIRIDIAN that covers viridian code within HVM. > Calls to viridian functions guarded by is_viridian_domain() and related > macros. > Having this option may be beneficial by reducing code footprint for systems > that a

Re: [MINI-OS PATCH 03/12] add elf.h

2025-03-21 Thread Jürgen Groß
On 21.03.25 14:51, Jan Beulich wrote: On 21.03.2025 10:24, Juergen Gross wrote: Add some definitions for accessing an ELF file. Only the file header and the program header are needed. The main source for those are elfstructs.h and libelf.h from the Xen tree. The license boiler plate of those fi

Re: [PATCH 3/7] xen: remove -N from the linker command line

2025-03-21 Thread Oleksii Kurochko
On 3/18/25 6:35 PM, Roger Pau Monne wrote: It's unclear why -N is being used in the first place. It was added by commit 40828c657dd0c back in 2004 without any justification. When building a PE image it's actually detrimental to forcefully set the .text section as writable. The GNU LD man page

Re: [RFC PATCH v2] xen: add libafl-qemu fuzzer support

2025-03-21 Thread Julien Grall
Hi Stefano, On 21/03/2025 22:32, Stefano Stabellini wrote: As discussed, please add a wrapper with an empty implementation in the regular case and the call to libafl_qemu_end when the fuzzer is enabled. So that here it becomes just something like: fuzzer_success(); I was thinking the same

Re: [PATCH] xen/arm/efi: merge neighboring banks

2025-03-21 Thread Julien Grall
Hi Stefano, On 21/03/2025 21:14, Stefano Stabellini wrote: When booting from U-Boot bootefi, there can be a high number of neighboring RAM banks. See for example: (XEN) RAM: - 00bf (XEN) RAM: 00c0 - 00c00fff (XEN) RAM: 00c01000 -

[PATCH] xen/arm/efi: merge neighboring banks

2025-03-21 Thread Stefano Stabellini
When booting from U-Boot bootefi, there can be a high number of neighboring RAM banks. See for example: (XEN) RAM: - 00bf (XEN) RAM: 00c0 - 00c00fff (XEN) RAM: 00c01000 - 00df (XEN) RAM: 00e0 - 0279dfff (XEN)