Re: [PATCH] x86/boot: Fix build with LLVM toolchain

2024-11-05 Thread Frediano Ziglio
On Tue, Nov 5, 2024 at 5:06 PM Jan Beulich wrote: > > On 05.11.2024 17:35, Frediano Ziglio wrote: > > On Tue, Nov 5, 2024 at 3:32 PM Jan Beulich wrote: > >> > >> On 05.11.2024 15:55, Frediano Ziglio wrote: > >>> This toolchain generates different object and map files. > >>> Account for these chan

[QEMU PATCH v10] xen/passthrough: use gsi to map pirq when dom0 is PVH

2024-11-05 Thread Jiqian Chen
In PVH dom0, when passthrough a device to domU, QEMU code xen_pt_realize->xc_physdev_map_pirq wants to use gsi, but in current codes the gsi number is got from file /sys/bus/pci/devices//irq, that is wrong, because irq is not equal with gsi, they are in different spaces, so pirq mapping fails. To

[PATCH v2 1/4] x86/ucode: Enforce invariant about module selection

2024-11-05 Thread Andrew Cooper
The work to add the `ucode=nmi` cmdline option left a subtle corner case. Both scan and an explicit index could be chosen, and we could really find both a CPIO archive and a microcode file. Worse, because the if/else chains for processing ucode_{blob,mod} are opposite ways around in early_microcod

[PATCH v2 2/4] x86/ucode: Use bootstrap_unmap() in early_microcode_load()

2024-11-05 Thread Andrew Cooper
If bootstrap_map() has provided a mapping, we must free it when done. Failing to do so may cause a spurious failure for unrelated logic later. Inserting a bootstrap_unmap() here does not break the use of ucode_{blob,mod} any more than they already are. Add a printk noting when we didn't find a m

[PATCH v2 3/4] x86/ucode: Drop ucode_mod and ucode_blob

2024-11-05 Thread Andrew Cooper
Both are used to pass information from early_microcode_load() to microcode_init_cache(), and both constitute use-after-free's in certain cases. Later still in microcode_init() is a failed attempt to "free" this information, long after the damage has been done. * ucode_mod is a copy of the module_

[PATCH v2 4/4] x86/ucode: Fold early_update_cache() into its single caller

2024-11-05 Thread Andrew Cooper
The data pointer is known good, so the -ENOMEM path is unnecessary. However, if we find no patch, something's wrong seeing as early_microcode_init() indicated it was happy. We are the entity initialising the cache, so we don't need the complexity of using microcode_update_cache(). Just assert th

[PATCH v2 0/4] x86/ucode: Fix module-handling use-after-free's

2024-11-05 Thread Andrew Cooper
Half of the series already committed. No other major changes. Andrew Cooper (4): x86/ucode: Enforce invariant about module selection x86/ucode: Use bootstrap_unmap() in early_microcode_load() x86/ucode: Drop ucode_mod and ucode_blob x86/ucode: Fold early_update_cache() into its single cal

Re: [PATCH 05/10] x86/ucode: Fold microcode_grab_module() into its single caller

2024-11-05 Thread Daniel P. Smith
On 11/5/24 18:07, Andrew Cooper wrote: On 02/11/2024 4:33 pm, Daniel P. Smith wrote: On 10/28/24 05:18, Andrew Cooper wrote: @@ -831,7 +818,15 @@ static int __init early_microcode_load(struct boot_info *bi)   size_t size;   struct microcode_patch *patch;   -    microcode_grab_module(

Re: [PATCH 05/10] x86/ucode: Fold microcode_grab_module() into its single caller

2024-11-05 Thread Andrew Cooper
On 02/11/2024 4:33 pm, Daniel P. Smith wrote: > On 10/28/24 05:18, Andrew Cooper wrote: >> @@ -831,7 +818,15 @@ static int __init early_microcode_load(struct >> boot_info *bi) >>   size_t size; >>   struct microcode_patch *patch; >>   -    microcode_grab_module(bi); >> +    if ( ucode_mod_i

[PATCH] CI: Fix package installation for Coverity run

2024-11-05 Thread Andrew Cooper
Something has changed recently in the Github Actions environment and the golang metapacakge resolves to something that no longer exists: https://github.com/xen-project/xen/actions/runs/11539340171/job/32120834909 Update metadata before installing, which fixes things. Signed-off-by: Andrew Coop

Re: [PATCH] tools/libxl: remove usage of VLA arrays

2024-11-05 Thread Andrew Cooper
On 05/11/2024 3:05 pm, Anthony PERARD wrote: > On Mon, Oct 28, 2024 at 12:03:59PM +, Andrew Cooper wrote: >> On 28/10/2024 11:48 am, Roger Pau Monne wrote: >>> Clang 19 complains with the following error when building libxl: >>> >>> libxl_utils.c:48:15: error: variable length array folded to co

Re: [PATCH] x86/boot: Fix build with LLVM toolchain

2024-11-05 Thread Andrew Cooper
On 05/11/2024 2:55 pm, Frediano Ziglio wrote: > diff --git a/xen/tools/combine_two_binaries.py > b/xen/tools/combine_two_binaries.py > index 447c0d3bdb..79ae8900b1 100755 > --- a/xen/tools/combine_two_binaries.py > +++ b/xen/tools/combine_two_binaries.py > @@ -67,13 +67,22 @@ if args.exports is no

Re: [PATCH] x86/boot: Fix build with LLVM toolchain

2024-11-05 Thread Jan Beulich
On 05.11.2024 17:35, Frediano Ziglio wrote: > On Tue, Nov 5, 2024 at 3:32 PM Jan Beulich wrote: >> >> On 05.11.2024 15:55, Frediano Ziglio wrote: >>> This toolchain generates different object and map files. >>> Account for these changes. >> >> At least briefly mentioning what exactly the differenc

Re: [PATCH] x86/boot: Fix build with LLVM toolchain

2024-11-05 Thread Frediano Ziglio
On Tue, Nov 5, 2024 at 3:32 PM Jan Beulich wrote: > > On 05.11.2024 15:55, Frediano Ziglio wrote: > > This toolchain generates different object and map files. > > Account for these changes. > > At least briefly mentioning what exactly the differences are would be > quite nice, imo. > What about.

Re: [PATCH v9 09/13] xen: add cache coloring allocator for domains

2024-11-05 Thread Jan Beulich
On 25.10.2024 11:50, Carlo Nonato wrote: > --- a/docs/misc/xen-command-line.pandoc > +++ b/docs/misc/xen-command-line.pandoc > @@ -270,6 +270,20 @@ and not running softirqs. Reduce this if softirqs are > not being run frequently > enough. Setting this to a high value may cause boot failure, parti

Re: [PATCH v9 08/13] xen/page_alloc: introduce preserved page flags macro

2024-11-05 Thread Jan Beulich
On 25.10.2024 11:50, Carlo Nonato wrote: > PGC_static and PGC_extra needs to be preserved when assigning a page. > Define a new macro that groups those flags and use it instead of or'ing > every time. > > To make preserved flags even more meaningful, they are kept also when > switching state in ma

Re: [PATCH] xen: Fix the issue of resource not being properly released in xenbus_dev_probe()

2024-11-05 Thread Jürgen Groß
On 05.11.24 14:09, Qiu-ji Chen wrote: This patch fixes an issue in the function xenbus_dev_probe(). In the xenbus_dev_probe() function, within the if (err) branch at line 313, the program incorrectly returns err directly without releasing the resources allocated by err = drv->probe(dev, id). As t

Re: [PATCH v9 07/13] xen/arm: add support for cache coloring configuration via device-tree

2024-11-05 Thread Jan Beulich
On 25.10.2024 11:50, Carlo Nonato wrote: > Add the "llc-colors" Device Tree attribute to express DomUs and Dom0less > color configurations. > > Based on original work from: Luca Miccio > > Signed-off-by: Carlo Nonato > Signed-off-by: Marco Solieri Reviewed-by: Jan Beulich # non-Arm

Re: [PATCH v9 01/13] xen/common: add cache coloring common code

2024-11-05 Thread Jan Beulich
On 25.10.2024 11:50, Carlo Nonato wrote: > Last Level Cache (LLC) coloring allows to partition the cache in smaller > chunks called cache colors. > > Since not all architectures can actually implement it, add a HAS_LLC_COLORING > Kconfig option. > MAX_LLC_COLORS_ORDER Kconfig option has a range ma

[PATCH V2] docs: fusa: Add requirements for Device Passthrough

2024-11-05 Thread Oleksandr Tyshchenko
From: Oleksandr Tyshchenko Add common requirements for a physical device assignment to Arm64 and AMD64 PVH domains. Signed-off-by: Oleksandr Tyshchenko --- Previous discussion (V1) here: https://lists.xenproject.org/archives/html/xen-devel/2024-10/msg00534.html V2: A lot of changes... Re

Re: [PATCH] x86/boot: Fix build with LLVM toolchain

2024-11-05 Thread Jan Beulich
On 05.11.2024 15:55, Frediano Ziglio wrote: > This toolchain generates different object and map files. > Account for these changes. At least briefly mentioning what exactly the differences are would be quite nice, imo. > --- a/xen/tools/combine_two_binaries.py > +++ b/xen/tools/combine_two_binari

Re: [PATCH v3 1/3] xen/riscv: introduce setup_mm()

2024-11-05 Thread Jan Beulich
On 01.11.2024 14:16, Oleksii Kurochko wrote:> @@ -423,3 +429,138 @@ void * __init early_fdt_map(paddr_t fdt_paddr) > > return fdt_virt; > } > + > +vaddr_t __ro_after_init directmap_virt_start = DIRECTMAP_VIRT_START; > + > +#ifndef CONFIG_RISCV_32 > + > +/* Map a frame table to cover physic

Re: [PATCH] tools/libxl: remove usage of VLA arrays

2024-11-05 Thread Anthony PERARD
On Mon, Oct 28, 2024 at 12:03:59PM +, Andrew Cooper wrote: > On 28/10/2024 11:48 am, Roger Pau Monne wrote: > > Clang 19 complains with the following error when building libxl: > > > > libxl_utils.c:48:15: error: variable length array folded to constant array > > as an extension [-Werror,-Wgnu

[PATCH v2 01/13] x86/xstate: Remove stale assertions in fpu_x{rstor,save}()

2024-11-05 Thread Alejandro Vallejo
After edb48e76458b("x86/fpu: Combine fpu_ctxt and xsave_area in arch_vcpu"), v->arch.xsave_area is always present and we can just remove these asserts. Fixes: edb48e76458b("x86/fpu: Combine fpu_ctxt and xsave_area in arch_vcpu") Signed-off-by: Alejandro Vallejo --- v2: * Remove asserts rather t

[PATCH v2 02/13] x86/xstate: Create map/unmap primitives for xsave areas

2024-11-05 Thread Alejandro Vallejo
Add infrastructure to simplify ASI handling. With ASI in the picture we'll have several different means of accessing the XSAVE area of a given vCPU, depending on whether a domain is covered by ASI or not and whether the vCPU is question is scheduled on the current pCPU or not. Having these complex

[PATCH] x86/boot: Fix build with LLVM toolchain

2024-11-05 Thread Frediano Ziglio
This toolchain generates different object and map files. Account for these changes. Added sections need to have special type so we put them in separate sections as linker will copy type from input sections. Signed-off-by: Frediano Ziglio --- xen/arch/x86/boot/build32.lds.S | 9 + xen/

Re: [PATCH] CHANGELOG: Add note about xAPIC destination mode change

2024-11-05 Thread Jan Beulich
On 05.11.2024 15:33, Matthew Barnes wrote: > --- a/CHANGELOG.md > +++ b/CHANGELOG.md > @@ -21,6 +21,8 @@ The format is based on [Keep a > Changelog](https://keepachangelog.com/en/1.0.0/) > - Removed the `ucode=allow-same` command line option. > - Removed x2APIC Cluster Mode for external in

[PATCH] CHANGELOG: Add note about xAPIC destination mode change

2024-11-05 Thread Matthew Barnes
Signed-off-by: Matthew Barnes --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 674944cbe4fb..dd1d68847187 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en

Re: [PATCH v4] Avoid crash calling PrintErrMesg from efi_multiboot2

2024-11-05 Thread Jan Beulich
On 19.08.2024 16:29, Frediano Ziglio wrote: > --- a/xen/common/efi/boot.c > +++ b/xen/common/efi/boot.c > @@ -287,19 +287,36 @@ static bool __init match_guid(const EFI_GUID *guid1, > const EFI_GUID *guid2) > /* generic routine for printing error messages */ > static void __init PrintErrMesg(cons

[PATCH v2 08/13] x86/xstate: Map/unmap xsave area in {compress,expand}_xsave_states()

2024-11-05 Thread Alejandro Vallejo
No functional change. Signed-off-by: Alejandro Vallejo --- v2: * No change --- xen/arch/x86/xstate.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/xen/arch/x86/xstate.c b/xen/arch/x86/xstate.c index 401bdad2eb0d..6db7ec2ea6a9 100644 --- a/xen/arch/x86/xstate.c +++

[PATCH v2 13/13] x86/xstate: Make xstate_all() and vcpu_xsave_mask() take explicit xstate

2024-11-05 Thread Alejandro Vallejo
No functional change. Signed-off-by: Alejandro Vallejo --- xen/arch/x86/i387.c | 9 + xen/arch/x86/include/asm/xstate.h | 5 +++-- xen/arch/x86/xstate.c | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/xen/arch/x86/i387.c b/xen/arch/x86/i38

[PATCH v2 06/13] x86/hvm: Map/unmap xsave area in hvmemul_{get,put}_fpu()

2024-11-05 Thread Alejandro Vallejo
No functional change. Signed-off-by: Alejandro Vallejo --- v2: * Added comments highlighting fastpath for current --- xen/arch/x86/hvm/emulate.c | 12 ++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c index f2bc6

[PATCH v2 12/13] x86/fpu: Pass explicit xsave areas to fpu_(f)xrstor()

2024-11-05 Thread Alejandro Vallejo
No functional change. Signed-off-by: Alejandro Vallejo --- v2: * const-ified v in fpu_xrstor() --- xen/arch/x86/i387.c | 26 -- xen/arch/x86/include/asm/xstate.h | 2 +- xen/arch/x86/xstate.c | 10 ++ 3 files changed, 23 insertions(+),

[PATCH v2 10/13] x86/mpx: Map/unmap xsave area in in read_bndcfgu()

2024-11-05 Thread Alejandro Vallejo
No functional change. Signed-off-by: Alejandro Vallejo --- v2: * s/ret/bndcfgu --- xen/arch/x86/xstate.c | 12 +--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/xen/arch/x86/xstate.c b/xen/arch/x86/xstate.c index 6db7ec2ea6a9..9ecbef760277 100644 --- a/xen/arch/x86/xst

[PATCH v2 09/13] x86/emulator: Refactor FXSAVE_AREA to use wrappers

2024-11-05 Thread Alejandro Vallejo
Adds an UNMAP primitive to make use of vcpu_unmap_xsave_area() when linked into xen. unmap is a no-op during tests. Signed-off-by: Alejandro Vallejo --- v2: * Added comments highlighting fastpath on `current` --- xen/arch/x86/x86_emulate/blk.c | 11 ++- 1 file changed, 10 insertions(+)

[PATCH v2 00/13] x86: Address Space Isolation FPU preparations

2024-11-05 Thread Alejandro Vallejo
See original cover letter in v1 v1: https://lore.kernel.org/xen-devel/20241028154932.6797-1-alejandro.vall...@cloud.com/ v1->v2: * Turned v1/patch1 into an assert removal * Dropped v1/patch11: "x86/mpx: Adjust read_bndcfgu() to clean after itself" * Other minor changes out of feedback. Expl

[PATCH v2 03/13] x86/hvm: Map/unmap xsave area in hvm_save_cpu_ctxt()

2024-11-05 Thread Alejandro Vallejo
No functional change. Signed-off-by: Alejandro Vallejo --- v2: * No change --- xen/arch/x86/hvm/hvm.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c index 018d44a08b6b..c90654697cb1 100644 --- a/xen/arch/x86/hvm/hvm.c

[PATCH v2 11/13] x86/fpu: Pass explicit xsave areas to fpu_(f)xsave()

2024-11-05 Thread Alejandro Vallejo
No functional change. Signed-off-by: Alejandro Vallejo --- v2: * const-ified v --- xen/arch/x86/i387.c | 16 ++-- xen/arch/x86/include/asm/xstate.h | 2 +- xen/arch/x86/xstate.c | 3 +-- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/xen

[PATCH v2 07/13] x86/domctl: Map/unmap xsave area in arch_get_info_guest()

2024-11-05 Thread Alejandro Vallejo
No functional change. Signed-off-by: Alejandro Vallejo --- v2: * No change --- xen/arch/x86/domctl.c | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/xen/arch/x86/domctl.c b/xen/arch/x86/domctl.c index 5f0619da..3044f706de1c 100644 --- a/xen/arch/x86/domctl.c ++

[PATCH v2 05/13] x86/xstate: Map/unmap xsave area in xstate_set_init() and handle_setbv()

2024-11-05 Thread Alejandro Vallejo
No functional change. Signed-off-by: Alejandro Vallejo --- v2: * Added comment highlighting fastpath for current --- xen/arch/x86/xstate.c | 12 ++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/xen/arch/x86/xstate.c b/xen/arch/x86/xstate.c index af9e345a7ace..401bdad

[PATCH v2 04/13] x86/fpu: Map/umap xsave area in vcpu_{reset,setup}_fpu()

2024-11-05 Thread Alejandro Vallejo
No functional change. Signed-off-by: Alejandro Vallejo --- v2: * No change --- xen/arch/x86/i387.c | 12 ++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/xen/arch/x86/i387.c b/xen/arch/x86/i387.c index 3add0025e495..a6ae323fa95f 100644 --- a/xen/arch/x86/i387.c +++ b

Re: [PATCH] x86emul/test: drop an undue conditional

2024-11-05 Thread Andrew Cooper
On 05/11/2024 1:53 pm, Jan Beulich wrote: > Gating the main part of what do_test() does is wrong: As it stands, the > "memory" forms of BNDC{L,N,U} weren't tested because of this mistake. > > Signed-off-by: Jan Beulich Acked-by: Andrew Cooper

[PATCH] x86/PV: further harden guest memory accesses against speculative abuse

2024-11-05 Thread Jan Beulich
The original implementation has two issues: For one it doesn't preserve non-canonical-ness of inputs in the range 0x8000 through 0x80007fff. Bogus guest pointers in that range would not cause a (#GP) fault upon access, when they should. And then there is an AMD-specific aspect,

[PATCH] x86emul/test: drop an undue conditional

2024-11-05 Thread Jan Beulich
Gating the main part of what do_test() does is wrong: As it stands, the "memory" forms of BNDC{L,N,U} weren't tested because of this mistake. Signed-off-by: Jan Beulich --- a/tools/tests/x86_emulator/predicates.c +++ b/tools/tests/x86_emulator/predicates.c @@ -2213,42 +2213,37 @@ void do_test(ui

[PATCH v2] drop setting XEN_QEMU_CONSOLE_LIMIT in the environment

2024-11-05 Thread James Dingwall
On Tue, Nov 05, 2024 at 01:57:41PM +0100, Jan Beulich wrote: > On 05.11.2024 13:43, James Dingwall wrote: > > Since qemu-xen-4.18.0 the corresponding code which responds to this > > environment variable was not applied to the qemu tree. It doesn't make > > sense to me that it continues to be set i

[PATCH] xen: Fix the issue of resource not being properly released in xenbus_dev_probe()

2024-11-05 Thread Qiu-ji Chen
This patch fixes an issue in the function xenbus_dev_probe(). In the xenbus_dev_probe() function, within the if (err) branch at line 313, the program incorrectly returns err directly without releasing the resources allocated by err = drv->probe(dev, id). As the return value is non-zero, the upp

Re: [PATCH] drop setting XEN_QEMU_CONSOLE_LIMIT in the environment

2024-11-05 Thread Jan Beulich
On 05.11.2024 13:43, James Dingwall wrote: > Hi, > > Since qemu-xen-4.18.0 the corresponding code which responds to this > environment variable was not applied to the qemu tree. It doesn't make > sense to me that it continues to be set in libxl so here's a patch > which removes it. > > These are

[PATCH] drop setting XEN_QEMU_CONSOLE_LIMIT in the environment

2024-11-05 Thread James Dingwall
Hi, Since qemu-xen-4.18.0 the corresponding code which responds to this environment variable was not applied to the qemu tree. It doesn't make sense to me that it continues to be set in libxl so here's a patch which removes it. These are the relevant commits for various qemu tags: qemu-xen-4.10

Re: [PATCH v5 1/3] xen/device-tree: Let DT reserve map entries overlap reserved-memory

2024-11-05 Thread Grygorii Strashko
On 05.11.24 12:42, Michal Orzel wrote: On 04/11/2024 13:39, Grygorii Strashko wrote: Hi All, On 04.11.24 12:49, Michal Orzel wrote: On 27/09/2024 00:24, Shawn Anastasio wrote: Commit 53dc37829c31 ("xen/arm: Add DT reserve map regions to bootinfo.reserved_mem") changes the way reser

Re: [PATCH v5 1/3] xen/device-tree: Let DT reserve map entries overlap reserved-memory

2024-11-05 Thread Michal Orzel
On 04/11/2024 13:39, Grygorii Strashko wrote: > > > Hi All, > > On 04.11.24 12:49, Michal Orzel wrote: >> >> >> On 27/09/2024 00:24, Shawn Anastasio wrote: >>> >>> >>> Commit 53dc37829c31 ("xen/arm: Add DT reserve map regions to >>> bootinfo.reserved_mem") changes the way reserve map regions

Re: [XEN RFC PATCH v4 0/5] IOMMU subsystem redesign and PV-IOMMU interface

2024-11-05 Thread Teddy Astie
Hello, Le 05/11/2024 à 02:10, Marek Marczykowski-Górecki a écrit : > On Mon, Nov 04, 2024 at 02:28:38PM +, Teddy Astie wrote: >> * introduce "dom0-iommu=no-dma" to make default context block all DMA >>(disables HAP and sync-pt), enforcing usage of PV-IOMMU for DMA >>Can be used to expo

Re: [PATCH v6 2/3] xen/pci: introduce PF<->VF links

2024-11-05 Thread Roger Pau Monné
On Mon, Nov 04, 2024 at 11:45:05AM +, Alejandro Vallejo wrote: > On Sat Nov 2, 2024 at 3:18 PM GMT, Daniel P. Smith wrote: > > On 11/1/24 16:16, Stewart Hildebrand wrote: > > > +Daniel (XSM mention) > > > > > > On 10/28/24 13:02, Jan Beulich wrote: > > >> On 18.10.2024 22:39, Stewart Hildebran

Re: [PATCH v6 2/3] xen/pci: introduce PF<->VF links

2024-11-05 Thread Roger Pau Monné
On Sat, Nov 02, 2024 at 11:18:24AM -0400, Daniel P. Smith wrote: > On 11/1/24 16:16, Stewart Hildebrand wrote: > > +Daniel (XSM mention) > > > > On 10/28/24 13:02, Jan Beulich wrote: > > > On 18.10.2024 22:39, Stewart Hildebrand wrote: > > > > Add links between a VF's struct pci_dev and its associ