Re: [PATCH 1/2] xen/dom0less: mark domain_p2m_set_allocation __init

2025-05-13 Thread Jan Beulich
On 14.05.2025 08:31, Orzel, Michal wrote: > On 14/05/2025 02:07, Stefano Stabellini wrote: >> On Tue, 13 May 2025, Stewart Hildebrand wrote: >>> All functions in dom0less-build.c should be __init. > Why? This patch is first in your series and by that time there is no build > time > enforcement. To

Re: [PATCH 1/2] xen/dom0less: mark domain_p2m_set_allocation __init

2025-05-13 Thread Jan Beulich
On 13.05.2025 19:18, Stewart Hildebrand wrote: > --- a/xen/common/device-tree/dom0less-build.c > +++ b/xen/common/device-tree/dom0less-build.c > @@ -730,8 +730,8 @@ static int __init domain_p2m_set_allocation(struct domain > *d, uint64_t mem, > return rc; > } > #else /* !CONFIG_ARCH_PAGING_

Re: [PATCH v3 1/2] xen/arm: exclude xen,reg from direct-map domU extended regions

2025-05-13 Thread Jan Beulich
On 13.05.2025 21:54, Stewart Hildebrand wrote: > --- a/xen/common/rangeset.c > +++ b/xen/common/rangeset.c > @@ -433,6 +433,20 @@ bool rangeset_is_empty( > return ((r == NULL) || list_empty(&r->range_list)); > } > > +int rangeset_count_ranges(const struct rangeset *r) > +{ > +int nr = 0

Re: [PATCH v2 22/22] MAINTAINERS: add a section for TrenchBoot Slaunch

2025-05-13 Thread Jan Beulich
On 13.05.2025 19:05, Sergii Dmytruk wrote: > --- a/MAINTAINERS > +++ b/MAINTAINERS > @@ -542,6 +542,21 @@ F: */configure > F: */*.ac > F: tools/ > > +TRENCHBOOT SECURE LAUNCH > +M: Daniel P. Smith > +R: Ross Philipson > +R: Sergii Dmytruk > +S: Supported > +F: xen/include

Re: [PATCH 1/2] xen/dom0less: mark domain_p2m_set_allocation __init

2025-05-13 Thread Orzel, Michal
On 14/05/2025 02:07, Stefano Stabellini wrote: > On Tue, 13 May 2025, Stewart Hildebrand wrote: >> All functions in dom0less-build.c should be __init. Why? This patch is first in your series and by that time there is no build time enforcement. Together with the Fixes tag it implies that this is

Re: [PATCH v2 4/6] rangeset: introduce rangeset_subtract

2025-05-13 Thread Jan Beulich
On 13.05.2025 19:01, Stewart Hildebrand wrote: > On 5/13/25 11:39, Jan Beulich wrote: >> On 08.05.2025 15:20, Stewart Hildebrand wrote: >>> --- a/xen/common/rangeset.c >>> +++ b/xen/common/rangeset.c >>> @@ -397,6 +397,18 @@ int rangeset_merge(struct rangeset *r1, struct >>> rangeset *r2) >>>

Re: [PATCH] hw/xen/arch_hvm: Unify x86 and ARM variants

2025-05-13 Thread Xiaoyao Li
On 5/14/2025 1:17 AM, Philippe Mathieu-Daudé wrote: As each target declares the same prototypes, we can use a single header, removing the TARGET_XXX uses. Signed-off-by: Philippe Mathieu-Daudé ... diff --git a/hw/arm/xen-pvh.c b/hw/arm/xen-pvh.c index 4b26bcff7a5..1a9eeb01c8e 100644 --- a/hw/

RE: [PATCH v4 02/15] xen/cpufreq: extract _PSD info from "struct xen_processor_performance"

2025-05-13 Thread Penny, Zheng
[Public] Hi > -Original Message- > From: Jan Beulich > Sent: Monday, May 12, 2025 11:43 PM > To: Penny, Zheng > Cc: Huang, Ray ; Andrew Cooper > ; Anthony PERARD ; > Orzel, Michal ; Julien Grall ; Roger Pau > Monné ; Stefano Stabellini ; > xen- > de...@lists.xenproject.org > Subject: R

Re: [PATCH v2 20/22] x86/slaunch: support EFI boot

2025-05-13 Thread Demi Marie Obenour
On 5/13/25 1:05 PM, Sergii Dmytruk wrote: > When running on an EFI-enabled system, Xen needs to have access to Boot > Services in order to initialize itself properly and reach a state in > which a dom0 kernel can operate without issues. > > This means that DRTM must be started in the middle of Xen

Re: [PATCH v2] xen: swiotlb: Wire up map_resource callback

2025-05-13 Thread Stefano Stabellini
On Mon, 12 May 2025, John Ernberg wrote: > When running Xen on iMX8QXP, an Arm SoC without IOMMU, DMA performed via > its eDMA v3 DMA engine fail with a mapping error. > > The eDMA performs DMA between RAM and MMIO space, and it's the MMIO side > that cannot be mapped. > > MMIO->RAM DMA access ca

Re: [PATCH 2/2] xen: enforce __init in common/device-tree/*-build.c

2025-05-13 Thread Stefano Stabellini
On Tue, 13 May 2025, Stewart Hildebrand wrote: > Code in domain-build.c and dom0less-build.c was migrated from init-only > files. Thus, they contain only __init functions. Enforce this at build > time. > > Fixes: ad03faa942b9 ("xen/common: dom0less: make some parts of Arm's > CONFIG_DOM0LESS comm

Re: [PATCH 1/2] xen/dom0less: mark domain_p2m_set_allocation __init

2025-05-13 Thread Stefano Stabellini
On Tue, 13 May 2025, Stewart Hildebrand wrote: > All functions in dom0less-build.c should be __init. > > Fixes: 2705f1adb9df ("xen: introduce Kconfig ARCH_PAGING_MEMPOOL") > Signed-off-by: Stewart Hildebrand Reviewed-by: Stefano Stabellini > --- > xen/common/device-tree/dom0less-build.c | 4 +

Re: [PATCH] hw/xen/arch_hvm: Unify x86 and ARM variants

2025-05-13 Thread Stefano Stabellini
On Tue, 13 May 2025, Philippe Mathieu-Daudé wrote: > As each target declares the same prototypes, we can > use a single header, removing the TARGET_XXX uses. > > Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Stefano Stabellini > --- > include/hw/arm/xen_arch_hvm.h | 9 - > inc

Re: [PATCH v1 2/3] xen/dom0less: refactor architecture-specific DomU construction

2025-05-13 Thread Stefano Stabellini
On Tue, 13 May 2025, Oleksii Kurochko wrote: > Refactor construct_domU() to improve architecture separation and reduce > reliance on ARM-specific logic in common code: > - Drop set_domain_type() from generic code. This function is specific > to ARM and serves no purpose on other architectures lik

Re: [PATCH] hw/xen/arch_hvm: Unify x86 and ARM variants

2025-05-13 Thread Pierrick Bouvier
On 5/13/25 10:17 AM, Philippe Mathieu-Daudé wrote: As each target declares the same prototypes, we can use a single header, removing the TARGET_XXX uses. Signed-off-by: Philippe Mathieu-Daudé --- include/hw/arm/xen_arch_hvm.h | 9 - include/hw/i386/xen_arch_hvm.h | 11 ---

Re: [PATCH 5/6] x86/paravirt: Switch MSR access pv_ops functions to instruction interfaces

2025-05-13 Thread H. Peter Anvin
On May 12, 2025 11:06:02 PM PDT, "Jürgen Groß" wrote: >On 13.05.25 07:55, Xin Li wrote: >> On 5/12/2025 4:24 AM, Juergen Gross wrote: >>> Now with the mentioned patch really attached. :-) >>> >> >> Does it allow patching with an instruction more than 6 bytes long? >> >> The immediate form MSR i

Re: [PATCH v6 02/12] common/hyperlaunch: introduce the domain builder

2025-05-13 Thread Daniel P. Smith
On 5/13/25 04:05, Jan Beulich wrote: On 06.05.2025 21:29, Daniel P. Smith wrote: On 5/2/25 03:21, Jan Beulich wrote: On 30.04.2025 20:56, Daniel P. Smith wrote: On 4/29/25 08:36, Alejandro Vallejo wrote: --- a/xen/common/Makefile +++ b/xen/common/Makefile @@ -11,6 +11,7 @@ obj-$(filter-out $(

[PATCH v3 1/2] xen/arm: exclude xen,reg from direct-map domU extended regions

2025-05-13 Thread Stewart Hildebrand
Similarly to fba1b0974dd8, when a device is passed through to a direct-map dom0less domU, the xen,reg ranges may overlap with the extended regions. Remove xen,reg from direct-map domU extended regions. Introduce rangeset_count_ranges(). Take the opportunity to update the comment ahead of find_mem

[PATCH v3 0/2] arm: extended regions fixes

2025-05-13 Thread Stewart Hildebrand
v2->v3: * drop committed patches * add ("xen/arm: exclude xen,reg from direct-map domU extended regions") v1->v2: * rebase * address feedback Stewart Hildebrand (2): xen/arm: exclude xen,reg from direct-map domU extended regions tools/arm: exclude iomem from domU extended regions tools/libs

[PATCH v3 2/2] tools/arm: exclude iomem from domU extended regions

2025-05-13 Thread Stewart Hildebrand
When a device is passed through to a xl domU, the iomem ranges may overlap with the extended regions. Remove iomem from extended regions. Signed-off-by: Stewart Hildebrand --- Not sure if we need a Fixes: tag, but if we do: Fixes: 57f87857dc2d ("libxl/arm: Add handling of extended regions for Dom

Assertion 'desc->arch.creator_domid == DOMID_INVALID' failed

2025-05-13 Thread Marek Marczykowski-Górecki
Hi, When debugging CI job on Linus' master branch, I added "console=vga vga=,keep" and got PV dom0 crash Xen with: (XEN) [ 40.870435] Assertion 'desc->arch.creator_domid == DOMID_INVALID' failed at arch/x86/irq.c:294 (XEN) [ 40.886925] [ Xen-4.21-unstable x86_64 debug=y ubsan=y Not

[PATCH v2 06/22] xen/arch/x86: reserve TXT memory during Slaunch

2025-05-13 Thread Sergii Dmytruk
From: Kacper Stojek TXT heap, SINIT and TXT private space are marked as reserved or unused in e820 to protect from unintended uses. Signed-off-by: Kacper Stojek Signed-off-by: Krystian Hebel Signed-off-by: Michał Żygowski Signed-off-by: Sergii Dmytruk --- xen/arch/x86/Makefile

[PATCH 2/2] xen: enforce __init in common/device-tree/*-build.c

2025-05-13 Thread Stewart Hildebrand
Code in domain-build.c and dom0less-build.c was migrated from init-only files. Thus, they contain only __init functions. Enforce this at build time. Fixes: ad03faa942b9 ("xen/common: dom0less: make some parts of Arm's CONFIG_DOM0LESS common") Fixes: d07b7369aa65 ("xen/common: dom0less: introduce

[PATCH 1/2] xen/dom0less: mark domain_p2m_set_allocation __init

2025-05-13 Thread Stewart Hildebrand
All functions in dom0less-build.c should be __init. Fixes: 2705f1adb9df ("xen: introduce Kconfig ARCH_PAGING_MEMPOOL") Signed-off-by: Stewart Hildebrand --- xen/common/device-tree/dom0less-build.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xen/common/device-tree/dom0

[PATCH] hw/xen/arch_hvm: Unify x86 and ARM variants

2025-05-13 Thread Philippe Mathieu-Daudé
As each target declares the same prototypes, we can use a single header, removing the TARGET_XXX uses. Signed-off-by: Philippe Mathieu-Daudé --- include/hw/arm/xen_arch_hvm.h | 9 - include/hw/i386/xen_arch_hvm.h | 11 --- include/hw/xen/arch_hvm.h | 14 ++ hw/

[PATCH v2 01/22] x86/include/asm/intel-txt.h: constants and accessors for TXT registers and heap

2025-05-13 Thread Sergii Dmytruk
From: Krystian Hebel The file contains TXT register spaces base address, registers offsets, error codes and inline functions for accessing structures stored on TXT heap. Signed-off-by: Krystian Hebel Signed-off-by: Sergii Dmytruk --- xen/arch/x86/include/asm/intel-txt.h | 277

[PATCH v2 17/22] x86/acpi: disallow S3 on Secure Launch boot

2025-05-13 Thread Sergii Dmytruk
Secure Launch won't initiate DRTM on S3 resume (the code for starting DRTM is not part of Xen), so abort a request to perform S3 suspend to not lose the state of DRTM PCRs. Signed-off-by: Sergii Dmytruk --- xen/arch/x86/acpi/power.c | 8 1 file changed, 8 insertions(+) diff --git a/xen

[PATCH v2 21/22] x86/cpu: report SMX, TXT and SKINIT capabilities

2025-05-13 Thread Sergii Dmytruk
From: Michał Żygowski Report TXT capabilities so that dom0 can query the Intel TXT or AMD SKINIT support information using xl dmesg. Signed-off-by: Michał Żygowski Signed-off-by: Sergii Dmytruk --- xen/arch/x86/cpu/amd.c | 16 ++ xen/arch/x86/cpu/cpu.h | 1

[PATCH v2 11/22] x86/tpm.c: support extending PCRs of TPM2.0

2025-05-13 Thread Sergii Dmytruk
SHA1 and SHA256 are hard-coded here, but their support by the TPM is checked. Addition of event log for TPM2.0 will generalize the code further. Signed-off-by: Sergii Dmytruk --- xen/arch/x86/tpm.c | 464 +++-- 1 file changed, 452 insertions(+), 12 deleti

[PATCH v2 07/22] x86/mtrr: expose functions for pausing caching

2025-05-13 Thread Sergii Dmytruk
This allows the functionality to be reused by other units that need to update MTRRs. This also gets rid of a static variable. Signed-off-by: Sergii Dmytruk --- xen/arch/x86/cpu/mtrr/generic.c | 51 - xen/arch/x86/include/asm/mtrr.h | 8 ++ 2 files changed, 3

[PATCH v2 10/22] x86/tpm.c: code for early hashing and extending PCRs (for TPM1.2)

2025-05-13 Thread Sergii Dmytruk
From: Krystian Hebel This file is built twice: for early 32b mode without paging to measure MBI and for 64b code to measure dom0 kernel and initramfs. Since MBI is small, the first case uses TPM to do the hashing. Kernel and initramfs on the other hand are too big, sending them to the TPM would t

[PATCH v2 14/22] x86/boot: choose AP stack based on APIC ID

2025-05-13 Thread Sergii Dmytruk
From: Krystian Hebel This is made as the first step of making parallel AP bring-up possible. It should be enough for pre-C code. Parallel AP bring-up is necessary because TXT by design releases all APs at once. In addition to that it reduces number of IPIs (and more importantly, delays between t

[PATCH v2 20/22] x86/slaunch: support EFI boot

2025-05-13 Thread Sergii Dmytruk
When running on an EFI-enabled system, Xen needs to have access to Boot Services in order to initialize itself properly and reach a state in which a dom0 kernel can operate without issues. This means that DRTM must be started in the middle of Xen's initialization process. This effect is achieved

[PATCH v2 08/22] x86/slaunch: restore boot MTRRs after Intel TXT DRTM

2025-05-13 Thread Sergii Dmytruk
From: Krystian Hebel In preparation for TXT SENTER call, GRUB had to modify MTRR settings to be UC for everything except SINIT ACM. Old values are restored from SLRT where they were saved by the bootloader. Signed-off-by: Krystian Hebel Signed-off-by: Michał Żygowski Signed-off-by: Sergii Dmyt

[PATCH v2 09/22] xen/lib: add implementation of SHA-1

2025-05-13 Thread Sergii Dmytruk
From: Krystian Hebel The code comes from [1] and is licensed under GPL-2.0 license. The initial version was a combination of: - include/crypto/sha1.h - include/crypto/sha1_base.h - lib/crypto/sha1.c - crypto/sha1_generic.c Changes: - includes, formatting, naming - renames and splicing of s

[PATCH v2 13/22] x86/tpm.c: implement event log for TPM2.0

2025-05-13 Thread Sergii Dmytruk
Signed-off-by: Sergii Dmytruk --- xen/arch/x86/include/asm/intel-txt.h | 33 ++ xen/arch/x86/tpm.c | 169 ++- 2 files changed, 175 insertions(+), 27 deletions(-) diff --git a/xen/arch/x86/include/asm/intel-txt.h b/xen/arch/x86/include/asm/intel-txt

[PATCH v2 15/22] x86/smpboot.c: TXT AP bringup

2025-05-13 Thread Sergii Dmytruk
From: Krystian Hebel On Intel TXT, APs are started in one of two ways, depending on ACM which reports it in its information table. In both cases, all APs are started simultaneously after BSP requests them to do so. Two possible ways are: - GETSEC[WAKEUP] instruction, - MONITOR address. GETSEC[WA

[PATCH v2 12/22] x86/hvm: check for VMX in SMX if Slaunch is active

2025-05-13 Thread Sergii Dmytruk
From: Michał Żygowski Check whther IA32_FEATURE_CONTROL has the proper bits enabled to run VMX in SMX when slaunch is active. Signed-off-by: Michał Żygowski --- xen/arch/x86/hvm/vmx/vmcs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/a

[PATCH v2 18/22] x86/boot/slaunch-early: find MBI and SLRT on AMD

2025-05-13 Thread Sergii Dmytruk
Use slr_entry_amd_info::boot_params_base on AMD with SKINIT to get MBI location. Another thing of interest is the location of SLRT which is bootloader's data after SKL. Signed-off-by: Krystian Hebel Signed-off-by: Sergii Dmytruk --- xen/arch/x86/boot/head.S | 38

[PATCH v2 16/22] x86/slaunch: process DRTM policy

2025-05-13 Thread Sergii Dmytruk
Go through entires in the DRTM policy of SLRT to hash and extend data that they describe into corresponding PCRs. Addresses are being zeroed on measuring platform-specific data to prevent measurements from changing when the only thing that has changed is an address. Addresses can vary due to boot

[PATCH v2 19/22] x86/slaunch: support AMD SKINIT

2025-05-13 Thread Sergii Dmytruk
This mostly involves not running Intel-specific code when on AMD. There are only a few new AMD-specific implementation details: - finding SLB start and size and then mapping and reserving it in e820 - managing offset for adding the next TPM log entry (TXT-compatible data prepared by SKL is st

[PATCH v2 22/22] MAINTAINERS: add a section for TrenchBoot Slaunch

2025-05-13 Thread Sergii Dmytruk
Signed-off-by: Sergii Dmytruk --- MAINTAINERS | 15 +++ 1 file changed, 15 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index c11b82eca9..347b3bcbb0 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -542,6 +542,21 @@ F: */configure F: */*.ac F: tools/ +TRENCHBOOT SECU

[PATCH v2 05/22] x86/boot/slaunch-early: early TXT checks and boot data retrieval

2025-05-13 Thread Sergii Dmytruk
From: Krystian Hebel The tests validate that important parts of memory are protected against DMA attacks, including Xen and MBI. Modules can be tested later, when it is possible to report issues to a user before invoking TXT reset. TPM event log validation is temporarily disabled due to an issue

[PATCH v2 03/22] x86/boot: add MLE header and Secure Launch entry point

2025-05-13 Thread Sergii Dmytruk
From: Kacper Stojek Signed-off-by: Kacper Stojek Signed-off-by: Krystian Hebel Signed-off-by: Sergii Dmytruk --- docs/hypervisor-guide/x86/how-xen-boots.rst | 5 ++ xen/arch/x86/boot/head.S| 53 + 2 files changed, 58 insertions(+) diff --git a/docs/hy

[PATCH v2 04/22] x86/boot/slaunch-early: implement early initialization

2025-05-13 Thread Sergii Dmytruk
Make head.S invoke a C function to retrieve MBI and SLRT addresses in a platform-specific way. This is also the place to perform sanity checks of DRTM. Signed-off-by: Krystian Hebel Signed-off-by: Sergii Dmytruk --- xen/arch/x86/Makefile| 1 + xen/arch/x86/boot/Makefile

[PATCH v2 02/22] include/xen/slr-table.h: Secure Launch Resource Table definitions

2025-05-13 Thread Sergii Dmytruk
The file provides constants, structures and several helper functions for parsing SLRT. Signed-off-by: Ross Philipson Signed-off-by: Sergii Dmytruk --- xen/include/xen/slr-table.h | 268 1 file changed, 268 insertions(+) create mode 100644 xen/include/xen/sl

[PATCH v2 00/22] x86: Trenchboot Secure Launch DRTM (Xen)

2025-05-13 Thread Sergii Dmytruk
The aim of the [TrenchBoot] project is to provide an implementation of DRTM that is generic enough to cover various use cases: - Intel TXT and AMD SKINIT on x86 CPUs - legacy and UEFI boot - TPM1.2 and TPM2.0 - (in the future) DRTM on Arm CPUs DRTM is a version of a measured launch that starts

Xen Security Notice 3 (CVE-2024-45332) Intel Branch Privilege Injection

2025-05-13 Thread Andrew Cooper
Researchers from ETH Zurich have discovered Branch Privilege Injection, a bug in hardware prediction-domain isolation whereby an attacker can cause predictions to be tagged with the wrong mode/privilege, and then use the incorrectly-tagged predictions to mount traditional Spectre-v2 attacks. For m

Re: [PATCH v2 4/6] rangeset: introduce rangeset_subtract

2025-05-13 Thread Stewart Hildebrand
On 5/13/25 11:39, Jan Beulich wrote: > On 08.05.2025 15:20, Stewart Hildebrand wrote: >> --- a/xen/common/rangeset.c >> +++ b/xen/common/rangeset.c >> @@ -397,6 +397,18 @@ int rangeset_merge(struct rangeset *r1, struct rangeset >> *r2) >> return rangeset_report_ranges(r2, 0, ~0UL, merge, r1);

Re: [PATCH 3/4] Add lockdown mode

2025-05-13 Thread Jan Beulich
On 13.05.2025 17:59, Kevin Lampis wrote: > On Tue, May 13, 2025 at 3:32 PM Jan Beulich wrote: >> >> Well, it's easily possible to catch that error without any extra parsing. > > If `lockdown` is not the first argument then we should print a warning > to tell the user that Xen may have already par

Re: [PATCH v2 03/16] xen/riscv: introduce support of Svpbmt extension

2025-05-13 Thread Jan Beulich
On 06.05.2025 18:51, Oleksii Kurochko wrote: > Svpbmt extension is necessary for chaning the memory type for a page contains > a combination of attributes that indicate the cacheability, idempotency, > and ordering properties for access to that page. The title suggest use of the extension is optio

Re: [PATCH 3/4] Add lockdown mode

2025-05-13 Thread Kevin Lampis
On Tue, May 13, 2025 at 3:32 PM Jan Beulich wrote: > > Well, it's easily possible to catch that error without any extra parsing. If `lockdown` is not the first argument then we should print a warning to tell the user that Xen may have already parsed some insecure arguments and lockdown mode will

Re: [PATCH v2 02/16] xen/riscv: introduce smp_prepare_boot_cpu()

2025-05-13 Thread Jan Beulich
On 06.05.2025 18:51, Oleksii Kurochko wrote: > @@ -72,6 +72,8 @@ void __init noreturn start_xen(unsigned long bootcpu_id, > > remove_identity_mapping(); > > +smp_prepare_boot_cpu(); > + > set_processor_id(0); > > set_cpuid_to_hartid(0, bootcpu_id); Is this a good placement

[PATCH v2] tools/libxl: Only access legacy altp2m on HVM

2025-05-13 Thread Jason Andryuk
Only access the HVM union b_info->u.hvm on HVM guests. The union access is not guarded, so this reads and sets the default even on non-HVM guests. Usually this doesn't matter as PV and PVH unions are smaller and zero-initialized, but the zero default will be re-written as a -1 boolean. Generally

Re: [PATCH v2 01/16] xen/riscv: initialize bitmap to zero in riscv_fill_hwcap_from_isa_string()

2025-05-13 Thread Jan Beulich
On 06.05.2025 18:51, Oleksii Kurochko wrote: > The this_isa bitmap should be explicitly initialized to zero to avoid > false positives when detecting supported ISA extensions. Without proper > zero-initialization, the bitmap may retain non-zero values from > uninitialized memory, causing Xen to inc

Re: [PATCH v2 4/6] rangeset: introduce rangeset_subtract

2025-05-13 Thread Jan Beulich
On 08.05.2025 15:20, Stewart Hildebrand wrote: > --- a/xen/common/rangeset.c > +++ b/xen/common/rangeset.c > @@ -397,6 +397,18 @@ int rangeset_merge(struct rangeset *r1, struct rangeset > *r2) > return rangeset_report_ranges(r2, 0, ~0UL, merge, r1); > } > > +static int cf_check subtract(un

Re: [PATCH v2 3/5] cpufreq: Avoid potential buffer overrun and leak

2025-05-13 Thread Jan Beulich
On 12.05.2025 16:46, Ross Lagerwall wrote: > If set_px_pminfo is called a second time with a larger state_count than > the first call, calls to PMSTAT_get_pxstat will read beyond the end of > the pt and trans_pt buffers allocated in cpufreq_statistic_init() since > they would have been allocated wi

Re: [PATCH v1 3/3] xen/dom0less: move make_chosen_node() to common code

2025-05-13 Thread Orzel, Michal
On 13/05/2025 16:29, Oleksii Kurochko wrote: > The current implementation of make_chosen_node() does not contain any > architecture-specific logic. Therefore, move it from arch-specific > files to common code. > > At this stage, there is no need to introduce an arch_make_chosen_node(), > as no

Re: [PATCH v4 4/4] xen/arm: add support for R-Car Gen4 PCI host controller

2025-05-13 Thread Mykyta Poturai
On 24.04.25 22:22, Stewart Hildebrand wrote: > On 4/23/25 07:08, Mykyta Poturai wrote: >> From: Oleksandr Andrushchenko >> >> Add support for Renesas R-Car Gen4 PCI host controller, specifically >> targeting the S4 and V4H SoCs. The implementation includes configuration >> read/write operations fo

Re: [PATCH v2 2/5] public/sysctl: Clarify usage of pm_{px,cx}_stat

2025-05-13 Thread Jan Beulich
On 12.05.2025 16:46, Ross Lagerwall wrote: > --- a/xen/include/public/sysctl.h > +++ b/xen/include/public/sysctl.h > @@ -215,23 +215,51 @@ typedef struct pm_px_val pm_px_val_t; > DEFINE_XEN_GUEST_HANDLE(pm_px_val_t); > > struct pm_px_stat { > -uint8_t total;/* total Px states */ > -

[PATCH v1 0/3] common dom0less updates

2025-05-13 Thread Oleksii Kurochko
This patch series refactor construct_domU() by moving back some Arm-specific changes to Arm code as they aren't used now by other architectures. Introduce arch_contruct_domU() to cover arch specific steps of a guest domain construction. Add ARM dependency for CONFIG_STATIC_MEMORY as, at the momen

Re: [PATCH v1 1/3] xen: restrict CONFIG_STATIC_MEMORY to ARM

2025-05-13 Thread Orzel, Michal
On 13/05/2025 16:29, Oleksii Kurochko wrote: > Now that CONFIG_DOM0LESS_BOOT has been moved to common code and is planned to > be supported by other architectures (e.g., RISC-V), the dependency for > CONFIG_STATIC_MEMORY needs to be updated. > Since CONFIG_STATIC_MEMORY is currently only support

Re: [PATCH 3/4] Add lockdown mode

2025-05-13 Thread Jan Beulich
On 13.05.2025 16:28, Kevin Lampis wrote: > On Tue, May 13, 2025 at 12:09 PM Jan Beulich wrote: >> I would like this to at least be considered. >> I don't like that custom command line parsing very much. > > I understand. Parsing code can be risky. > > In this case I think the code is small and s

[PATCH v1 2/3] xen/dom0less: refactor architecture-specific DomU construction

2025-05-13 Thread Oleksii Kurochko
Refactor construct_domU() to improve architecture separation and reduce reliance on ARM-specific logic in common code: - Drop set_domain_type() from generic code. This function is specific to ARM and serves no purpose on other architectures like RISC-V, which lack the arch.type field in kernel_

[PATCH v1 1/3] xen: restrict CONFIG_STATIC_MEMORY to ARM

2025-05-13 Thread Oleksii Kurochko
Now that CONFIG_DOM0LESS_BOOT has been moved to common code and is planned to be supported by other architectures (e.g., RISC-V), the dependency for CONFIG_STATIC_MEMORY needs to be updated. Since CONFIG_STATIC_MEMORY is currently only supported on ARM, its dependency should explicitly reflect that

Re: [PATCH 3/4] Add lockdown mode

2025-05-13 Thread Kevin Lampis
On Tue, May 13, 2025 at 12:09 PM Jan Beulich wrote: > I would like this to at least be considered. > I don't like that custom command line parsing very much. I understand. Parsing code can be risky. In this case I think the code is small and simple though. My concern with asking the user to alw

Re: [PATCH v2 1/5] x86/pmstat: Check size of PMSTAT_get_pxstat buffers

2025-05-13 Thread Jan Beulich
On 12.05.2025 16:46, Ross Lagerwall wrote: > Check that the total number of states passed in and hence the size of > buffers is sufficient to avoid writing more than the caller has > allocated. > > The interface is not explicit about whether getpx.total is expected to > be set by the caller in thi

Re: [PATCH] x86/spec-ctrl: Support Intel's new PB-OPT

2025-05-13 Thread Andrew Cooper
On 13/05/2025 2:42 pm, Jan Beulich wrote: > On 13.05.2025 14:48, Andrew Cooper wrote: >> In IPU 2025.2 (May 2025), Intel have released an alternative mitigation for a >> prior security issue (SA-00982) on Sappire and Emerald Rapids CPUs. >> >> Intel suggest that certain workloads will benefit from

Re: [PATCH v2 2/6] x86/HVM: restrict guest-induced WBINVD to cache writeback

2025-05-13 Thread Jan Beulich
On 13.05.2025 15:41, Roger Pau Monné wrote: > On Wed, May 03, 2023 at 11:45:22AM +0200, Jan Beulich wrote: >> We allow its use for writeback purposes only anyway, so let's also carry >> these out that way on capable hardware. > > "for writeback purposes only" > is such the case because we cannot >

Re: [PATCH v3 0/4] remove qemu-traditional

2025-05-13 Thread Juergen Gross
Ping? On 29.04.25 13:06, Juergen Gross wrote: Remove the qemu-traditional support. This includes the Mini-OS based ioemu-stubdom. Don't remove ROMBIOS for now, as it can be used with qemu (XenServer is doing that). After adding the series a run of autoconf should be done. Changes in V2: - add

Re: [PATCH] x86/spec-ctrl: Support Intel's new PB-OPT

2025-05-13 Thread Jan Beulich
On 13.05.2025 14:48, Andrew Cooper wrote: > In IPU 2025.2 (May 2025), Intel have released an alternative mitigation for a > prior security issue (SA-00982) on Sappire and Emerald Rapids CPUs. > > Intel suggest that certain workloads will benefit from using the alternative > mode. This can be sele

Re: [PATCH v2 2/6] x86/HVM: restrict guest-induced WBINVD to cache writeback

2025-05-13 Thread Roger Pau Monné
On Wed, May 03, 2023 at 11:45:22AM +0200, Jan Beulich wrote: > We allow its use for writeback purposes only anyway, so let's also carry > these out that way on capable hardware. "for writeback purposes only" > is such the case because we cannot guarantee the guest in which state the cache will be

Re: [PATCH] tools/libxl: Only access legacy altp2m on HVM

2025-05-13 Thread Jason Andryuk
On 2025-05-13 03:27, Jan Beulich wrote: On 13.05.2025 01:54, Jason Andryuk wrote: Only access the HVM union b_info->u.hvm on HVM guests. The union access is not guarded, so this reads and sets the default even on non-HVM guests. Usually this doesn't matter as PV and PVH unions are smaller and

Re: [PATCH v2 2/6] x86/HVM: restrict guest-induced WBINVD to cache writeback

2025-05-13 Thread Jan Beulich
On 13.05.2025 15:12, Andrew Cooper wrote: > On 03/05/2023 10:45 am, Jan Beulich wrote: >> We allow its use for writeback purposes only anyway, so let's also carry >> these out that way on capable hardware. By implication of what you say ... >> With it now known that WBNOINVD uses the same VM exit

Re: [PATCH v2 2/6] x86/HVM: restrict guest-induced WBINVD to cache writeback

2025-05-13 Thread Andrew Cooper
On 03/05/2023 10:45 am, Jan Beulich wrote: > We allow its use for writeback purposes only anyway, so let's also carry > these out that way on capable hardware. > > With it now known that WBNOINVD uses the same VM exit code as WBINVD for > both SVM and VT-x, we can now also expose the feature that w

Re: [PATCH v2 1/6] x86: support cache-writeback in flush_area_local() et al

2025-05-13 Thread Roger Pau Monné
On Wed, May 03, 2023 at 11:44:39AM +0200, Jan Beulich wrote: > The majority of the present callers really aren't after invalidating > cache contents, but only after writeback. Make this available by simply > extending the FLUSH_CACHE handling accordingly. No feature checks are > required here: cach

[PATCH] x86/spec-ctrl: Support Intel's new PB-OPT

2025-05-13 Thread Andrew Cooper
In IPU 2025.2 (May 2025), Intel have released an alternative mitigation for a prior security issue (SA-00982) on Sappire and Emerald Rapids CPUs. Intel suggest that certain workloads will benefit from using the alternative mode. This can be selected by booting with `spec-ctrl=ibpb-alt`. https://

Re: [PATCH 2/4] crypto: Add RSA support

2025-05-13 Thread Andrew Cooper
On 12/05/2025 1:38 pm, Jan Beulich wrote: >> + * Copyright (C) 1994, 1996, 1998, 2000 Free Software Foundation, Inc. >> + * >> + * This file is part of GnuPG. >> + * >> + * GnuPG is free software; you can redistribute it and/or modify >> + * it under the terms of the GNU General Public License as

Re: [PATCH 3/4] Add lockdown mode

2025-05-13 Thread Jan Beulich
On 13.05.2025 13:07, Kevin Lampis wrote: > On Tue, May 13, 2025 at 8:00 AM Jan Beulich wrote: >> >> Well, there is an alternative: Require the lockdown argument to be absolutely >> first. (There are further alternatives, but likely less usable.) > > Is this your recommendation? I would like this

Re: [PATCH 3/4] Add lockdown mode

2025-05-13 Thread Kevin Lampis
On Tue, May 13, 2025 at 8:00 AM Jan Beulich wrote: > > Well, there is an alternative: Require the lockdown argument to be absolutely > first. (There are further alternatives, but likely less usable.) Is this your recommendation?

Re: [PATCH 0/3] Add lockdown mode

2025-05-13 Thread Kevin Lampis
On Mon, May 12, 2025 at 11:41 AM Jan Beulich wrote: > > You want to go into more detail here, specifically to describe the criteria > of "specifically safe". The command line doc may also want updating. I do not have a quick answer for you please bear with me.

Re: [PATCH 1/4] docs: Introduce live patch signing

2025-05-13 Thread Jan Beulich
On 13.05.2025 11:04, Ross Lagerwall wrote: > On Mon, May 12, 2025 at 1:19 PM Jan Beulich wrote: >> >> On 09.05.2025 18:18, Ross Lagerwall wrote: >>> --- a/docs/misc/livepatch.pandoc >>> +++ b/docs/misc/livepatch.pandoc >>> @@ -917,6 +917,58 @@ The normal sequence of events is to: >>> 3. *XEN_SYS

Re: [PATCH 1/4] docs: Introduce live patch signing

2025-05-13 Thread Ross Lagerwall
On Mon, May 12, 2025 at 1:19 PM Jan Beulich wrote: > > On 09.05.2025 18:18, Ross Lagerwall wrote: > > --- a/docs/misc/livepatch.pandoc > > +++ b/docs/misc/livepatch.pandoc > > @@ -917,6 +917,58 @@ The normal sequence of events is to: > > 3. *XEN_SYSCTL_LIVEPATCH_ACTION* with *LIVEPATCH_ACTION_AP

[PATCH v5 6/6] arm/mpu: Provide a constructor for pr_t type

2025-05-13 Thread Luca Fancellu
Provide a function that creates a pr_t object from a memory range and some attributes. Signed-off-by: Luca Fancellu --- v5 changes: - removed AP_RW_EL2 used only by pr_of_xenaddr(), fixed comments and typos - Given some comments to the page.h flags and modifications to the prbar_t fields

[PATCH v5 0/6] First chunk for Arm R82 and MPU support

2025-05-13 Thread Luca Fancellu
Hi all, This is the first chunk of work to support MPU and R82 on Xen, this serie reaches the early boot stages just before early_fdt_map(), just to give an idea about which stage of the boot is reached. v5: - dropped patch that touches page.h, it is not needed - general fixes listed on each pa

[PATCH v5 2/6] arm/mpu: Introduce MPU memory region map structure

2025-05-13 Thread Luca Fancellu
From: Penny Zheng Introduce pr_t typedef which is a structure having the prbar and prlar members, each being structured as the registers of the AArch64 Armv8-R architecture. Signed-off-by: Penny Zheng Signed-off-by: Wei Chen Signed-off-by: Luca Fancellu --- Changes in v5: - Given some commen

[PATCH v5 3/6] arm/mpu: Provide and populate MPU C data structures

2025-05-13 Thread Luca Fancellu
Provide some data structure in the C world to track the MPU status, these structures will be filled at boot by the assembly early code with the boot MPU regions and afterwards they will be used at runtime. Provide methods to update a bitmap created with DECLARE_BITMAP from the assembly code for bo

[PATCH v5 1/6] docs/arm: Document Xen booting protocol on Armv8-R

2025-05-13 Thread Luca Fancellu
Document the requirement needed to boot Xen on Armv8-R platforms. Signed-off-by: Luca Fancellu Reviewed-by: Ayan Kumar Halder Reviewed-by: Michal Orzel --- v5 changes: - restructured and removed some EL3 reference that might not be there on Armv8-R aarch64 - add R-by Ayan and Michal v4 cha

[PATCH v5 5/6] arm/mpu: Introduce utility functions for the pr_t type

2025-05-13 Thread Luca Fancellu
Introduce a few utility functions to manipulate and handle the pr_t type. Signed-off-by: Luca Fancellu --- v5 changes: - Don't rely on bitfield and use the mask MPU_REGION_RES0 for pr_set_base and pr_set_limit to make it explicit. Fixed typos in commit message. v4 changes: - Modify commen

[PATCH v5 4/6] arm/mpu: Provide access to the MPU region from the C code

2025-05-13 Thread Luca Fancellu
Implement some utility function in order to access the MPU regions from the C world. Signed-off-by: Luca Fancellu --- v5 changes: - move MPU_REGION_RES0 to arm64, fixed typos and code style. v4 changes: - moved back PRBAR0_EL2/PRLAR0_EL2 to mm.c and protect them with CONFIG_ARM_64, changed c

Re: [PATCH v6 02/12] common/hyperlaunch: introduce the domain builder

2025-05-13 Thread Jan Beulich
On 06.05.2025 21:29, Daniel P. Smith wrote: > On 5/2/25 03:21, Jan Beulich wrote: >> On 30.04.2025 20:56, Daniel P. Smith wrote: >>> On 4/29/25 08:36, Alejandro Vallejo wrote: --- a/xen/common/Makefile +++ b/xen/common/Makefile @@ -11,6 +11,7 @@ obj-$(filter-out $(CONFIG_X86),$(CONFI

Re: [PATCH v4 12/15] tools/xenpm: Print CPPC parameters for amd-cppc driver

2025-05-13 Thread Jan Beulich
On 09.05.2025 08:36, Penny, Zheng wrote: >> -Original Message- >> From: Jan Beulich >> Sent: Wednesday, April 30, 2025 9:55 PM >> >> On 14.04.2025 09:40, Penny Zheng wrote: >>> HWP, amd-cppc, amd-cppc-epp are all the implementation of ACPI CPPC >>> (Collaborative Processor Performace Contr

Re: [PATCH v4 09/15] xen/x86: introduce a new amd cppc driver for cpufreq scaling

2025-05-13 Thread Jan Beulich
On 07.05.2025 11:19, Penny, Zheng wrote: >> -Original Message- >> From: Jan Beulich >> Sent: Tuesday, April 29, 2025 10:29 PM >> >> On 14.04.2025 09:40, Penny Zheng wrote: >>> --- a/xen/arch/x86/acpi/cpufreq/amd-cppc.c >>> +++ b/xen/arch/x86/acpi/cpufreq/amd-cppc.c >>> +/* >>> + * If CPPC

Re: [PATCH v4 07/15] xen/cpufreq: fix core frequency calculation for AMD Family 1Ah CPUs

2025-05-13 Thread Jan Beulich
On 07.05.2025 08:12, Penny, Zheng wrote: >> -Original Message- >> From: Jan Beulich >> Sent: Thursday, April 17, 2025 11:23 PM >> >> On 14.04.2025 09:40, Penny Zheng wrote: >>> --- a/xen/arch/x86/cpu/amd.c >>> +++ b/xen/arch/x86/cpu/amd.c >>> @@ -570,12 +573,35 @@ static void amd_get_topol

Re: [PATCH 5/6] x86/paravirt: Switch MSR access pv_ops functions to instruction interfaces

2025-05-13 Thread Xin Li
On 5/12/2025 4:20 AM, Jürgen Groß wrote: On 09.05.25 10:18, Xin Li wrote: On 5/6/2025 2:20 AM, Juergen Gross wrote: I'm trying to evaluate how to add the immediate form MSR instructions on top of this patch set.  And I'm close to get it done. There is something to consider when running as a Xe

Re: [PATCH] tools/libxl: Only access legacy altp2m on HVM

2025-05-13 Thread Jan Beulich
On 13.05.2025 01:54, Jason Andryuk wrote: > Only access the HVM union b_info->u.hvm on HVM guests. The union > access is not guarded, so this reads and sets the default even on > non-HVM guests. Usually this doesn't matter as PV and PVH unions are > smaller and zero-initialized, but the zero defa

Re: [PATCH 0/3] Add lockdown mode

2025-05-13 Thread Jan Beulich
On 12.05.2025 21:56, Kevin Lampis wrote: > The intention of lockdown mode is to prevent attacks from a rogue dom0 > userspace from compromising the system. Lockdown mode can be controlled by a > Kconfig option and a command-line parameter. It is also enabled automatically > when Secure Boot is enab

Re: [PATCH 3/4] Add lockdown mode

2025-05-13 Thread Jan Beulich
On 12.05.2025 21:51, Kevin Lampis wrote: > On Mon, May 12, 2025 at 11:39 AM Jan Beulich wrote: >> >> I can't spot the effect the comment mentions anywhere in this patch. Is the >> description perhaps lacking some detail? It's rather odd after all to see ... >> >> ... such custom token splitting ah