Re: [PATCH v2 03/11] x86/mkreloc: use the string table to get names

2025-04-02 Thread Jan Beulich
On 01.04.2025 15:08, Roger Pau Monne wrote: > @@ -83,6 +111,31 @@ static unsigned int load(const char *name, int *handle, > exit(3); > } > > +if ( !string_table && pe_hdr.symbol_table ) > +{ > +char *strings; > + > +if ( lseek(in, pe_hdr.symbol_table + pe_hdr

Re: [PATCH v2 02/11] x86/mkreloc: fix obtaining PE image base address

2025-04-02 Thread Jan Beulich
On 01.04.2025 16:17, Jan Beulich wrote: > On 01.04.2025 15:08, Roger Pau Monne wrote: >> The base address is in the pe32_opt_hdr, not after it. Which is a result of pe.h munging both the optional and the NT header into a single structure. >> Previous to commit f7f42acc the base was read stand

Re: [RFC PATCH v1 01/15] x86/msr: Replace __wrmsr() with native_wrmsrl()

2025-04-02 Thread H. Peter Anvin
On April 2, 2025 10:09:21 PM PDT, Xin Li wrote: >On 4/1/2025 12:52 AM, Ingo Molnar wrote: >>> Should we rename the *msrl() functions to *msrq() as part of this >>> overhaul? >> Yeah, that's a good idea, and because talk is cheap I just implemented >> this in the tip:WIP.x86/msr branch with a coupl

Re: [QUESTION] Minimal Xen Configuration

2025-04-02 Thread Stefano Stabellini
On Wed, 2 Apr 2025, Nicola Vetrini wrote: > On 2025-03-28 07:43, Kwon, Gihwan wrote: > > Dear Xen Community, > > > > I hope this message finds you well. > > > > I have heard that there exists a minimal Xen configuration optimized for > > safety-critical products, particularly in automotive applic

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

2025-04-02 Thread Andrew Cooper
On 02/04/2025 10:30 am, Jan Beulich wrote: > On 02.04.2025 11:21, Andrew Cooper wrote: >> On 01/04/2025 11:09 am, Jan Beulich wrote: >>> --- a/xen/common/bitmap.c >>> +++ b/xen/common/bitmap.c >>> @@ -359,12 +343,11 @@ static void bitmap_byte_to_long(unsigned >>> >>> #elif defined(__LITTLE_ENDIA

[PATCH v1 3/3] xen/console: introduce conring_flush()

2025-04-02 Thread dmkhn
From: Denis Mukhin Introduce conring_flush() to ensure all messages kept in the internal console ring are sent to all physical consoles (serial, VGA (x86)) after their initialization is completed. Resolves: https://gitlab.com/xen-project/xen/-/issues/184 Signed-off-by: Denis Mukhin --- The patc

Re: [PATCH v2] xen: add kconfig for event_fifo

2025-04-02 Thread Orzel, Michal
On 28/03/2025 00:22, Stefano Stabellini wrote: > Evtchn fifos are not needed on smaller systems; the older interface is > lightweight and sufficient. Also, event_fifo causes runtime anonymous > memory allocations, which are undesirable. Additionally, it exposes an > extra interface to the guest

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

2025-04-02 Thread Jan Beulich
On 02.04.2025 11:36, Andrew Cooper wrote: > On 02/04/2025 10:30 am, Jan Beulich wrote: >> On 02.04.2025 11:21, Andrew Cooper wrote: >>> On 01/04/2025 11:09 am, Jan Beulich wrote: --- a/xen/common/bitmap.c +++ b/xen/common/bitmap.c @@ -359,12 +343,11 @@ static void bitmap_byte_to_long

Re: New Defects reported by Coverity Scan for XenProject

2025-04-02 Thread Jan Beulich
On 02.04.2025 14:56, scan-ad...@coverity.com wrote: > ** CID 1645573: Null pointer dereferences (FORWARD_NULL) > > > > *** CID 1645573: Null pointer dereferences (FORWARD_NULL) > /xen/arch

Re: [PATCH] xen: Change xen-acpi-processor dom0 dependency

2025-04-02 Thread Jürgen Groß
On 31.03.25 19:29, Jason Andryuk wrote: xen-acpi-processor functions under a PVH dom0 with only a xen_initial_domain() runtime check. Change the Kconfig dependency from PV dom0 to generic dom0 to reflect that. Suggested-by: Jan Beulich Signed-off-by: Jason Andryuk --- drivers/xen/Kconfig |

Re: [PATCH] xen: Change xen-acpi-processor dom0 dependency

2025-04-02 Thread Jason Andryuk
On 2025-04-02 10:24, Jürgen Groß wrote: On 31.03.25 19:29, Jason Andryuk wrote: xen-acpi-processor functions under a PVH dom0 with only a xen_initial_domain() runtime check.  Change the Kconfig dependency from PV dom0 to generic dom0 to reflect that. Suggested-by: Jan Beulich Signed-off-by: Ja

[PATCH v1 2/3] xen/console: introduce console_puts()

2025-04-02 Thread dmkhn
From: Denis Mukhin guest_console_write() duplicates the code from __putstr(), eliminate code duplication. Introduce console_puts() for writing a buffer to console devices. Also, introduce internal console flags to control which console devices should be used. Signed-off-by: Denis Mukhin ---

[PATCH v1 1/3] xen/console: cleanup conring management

2025-04-02 Thread dmkhn
From: Denis Mukhin Move console_locks_busted handling inside conring_puts() to remove tasklet code duplication. Signed-off-by: Denis Mukhin --- xen/drivers/char/console.c | 29 ++--- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/xen/drivers/char/consol

Re: [PATCH] xen/arm: mpu: Use new-style annotations

2025-04-02 Thread Julien Grall
Hi Michal, On 02/04/2025 10:02, Michal Orzel wrote: When purging old-style annotations, MPU code was left unmodified. Fix it. Fixes: 221c66f4f2a4 ("Arm: purge ENTRY(), ENDPROC(), and ALIGN") Signed-off-by: Michal Orzel Acked-by: Julien Grall Cheers, -- Julien Grall

Re: [PATCH] xen/arm: mpu: Use new-style annotations

2025-04-02 Thread Jan Beulich
On 02.04.2025 11:02, Michal Orzel wrote: > When purging old-style annotations, MPU code was left unmodified. Fix > it. > > Fixes: 221c66f4f2a4 ("Arm: purge ENTRY(), ENDPROC(), and ALIGN") > Signed-off-by: Michal Orzel Reviewed-by: Jan Beulich I'm sorry for the oversight. I had meant to do a la

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

2025-04-02 Thread Jan Beulich
On 02.04.2025 02:14, Stefano Stabellini wrote: > On Tue, 1 Apr 2025, Jan Beulich wrote: >> From: Stefano Stabellini >> >> The little endian implementation of bitmap_to_xenctl_bitmap leads to >> unnecessary xmallocs and xfrees. Given that Xen only supports little >> endian architectures, it is wort

Re: [XEN PATCH 1/1] xen/x86: drop wrappers of SVM instructions

2025-04-02 Thread Andrew Cooper
On 02/04/2025 3:54 pm, Alexander M. Merritt wrote: > The new toolchain baseline knows the SVM instructions. > > Resolves: xen-project/xen#204 > > Signed-off-by: Alexander M. Merritt Reviewed-by: Andrew Cooper , with a couple of notes. > --- > xen/arch/x86/hvm/svm/svm.h | 14 +++---

Re: [PATCH] xen/arm: Include xen/vmap.h in mm.c

2025-04-02 Thread Bertrand Marquis
Hi Michal, > On 2 Apr 2025, at 12:10, Michal Orzel wrote: > > As reported by ECLAIR scan, MISRA requires declaration to be visible > (R8.4). This is not the case for ioremap(). > > Fixes: 2cd02c27d327 ("arm/mpu: Implement stubs for ioremap_attr on MPU") > Signed-off-by: Michal Orzel Reviewed-

[XEN PATCH 1/1] xen/x86: drop wrappers of SVM instructions

2025-04-02 Thread Alexander M. Merritt
The new toolchain baseline knows the SVM instructions. Resolves: xen-project/xen#204 Signed-off-by: Alexander M. Merritt --- xen/arch/x86/hvm/svm/svm.h | 14 +++--- xen/arch/x86/include/asm/asm-defns.h | 12 2 files changed, 3 insertions(+), 23 deletions(-) diff

Re: [PATCH v2 10/11] x86/efi: do not merge all .init sections

2025-04-02 Thread Jan Beulich
On 01.04.2025 15:08, Roger Pau Monne wrote: > @@ -218,12 +214,15 @@ SECTIONS > */ > *(.altinstr_replacement) > > -#ifdef EFI /* EFI wants to merge all of .init.* ELF doesn't. */ > - . = ALIGN(SMP_CACHE_BYTES); > -#else >} PHDR(text) > - DECL_SECTION(.init.data) { > +#

Re: [PATCH v2 05/11] xen: remove -N from the linker command line

2025-04-02 Thread Julien Grall
Hi Roger, On 01/04/2025 14:08, Roger Pau Monne wrote: It's unclear why -N is being used in the first place. It was added by commit 4676bbf96dc8 back in 2002 without any justification. When building a PE image it's actually detrimental to forcefully set the .text section as writable. The GNU L

[PATCH v2 0/5] symbols: assorted adjustments

2025-04-02 Thread Jan Beulich
The main goal was what patch 3 does, but on the way there various other things became noticeable, and some preparation was necessary, too. 1: add minimal self-test 2: split symbols_num_syms 3: arrange to know where functions end 4: centralize and re-arrange $(all_symbols) calculation 5: prefer sym

Re: [PATCH] x86/apic: Fix function typechecking in TSC Deadline errata check

2025-04-02 Thread Jan Beulich
On 21.03.2022 15:26, Jan Beulich wrote: > On 21.03.2022 15:12, Andrew Cooper wrote: >> --- a/xen/arch/x86/apic.c >> +++ b/xen/arch/x86/apic.c >> @@ -1092,12 +1092,17 @@ static void setup_APIC_timer(void) >> local_irq_restore(flags); >> } >> >> +#define DEADLINE_MODEL_FUNCT(m, fn) \ >> +

[PATCH v2 1/5] symbols: add minimal self-test

2025-04-02 Thread Jan Beulich
... before making changes to the involved logic. Signed-off-by: Jan Beulich --- While Andrew validly suggests cf_check isn't a requirement for selecting which function(s) to use (with the non-upstream gcc patch that we're using in CI), that's only because of how the non-upstream patch works. Goin

[PATCH v2 3/5] symbols: arrange to know where functions end

2025-04-02 Thread Jan Beulich
When determining the symbol for a given address (e.g. for the %pS logging format specifier), so far the size of a symbol (function) was assumed to be everything until the next symbol. There may be gaps though, which would better be recognizable in output (often suggesting something odd is going on)

Re: [PATCH v2 4/6] xen/arm: dom0less seed xenstore grant table entry

2025-04-02 Thread Jason Andryuk
On 2025-04-01 19:50, Stefano Stabellini wrote: On Tue, 1 Apr 2025, Jason Andryuk wrote: On 2025-04-01 08:16, Jan Beulich wrote: On 31.03.2025 23:43, Jason Andryuk wrote: --- a/xen/arch/arm/dom0less-build.c +++ b/xen/arch/arm/dom0less-build.c @@ -865,6 +865,10 @@ static void __init initialize

[PATCH v2 2/5] symbols: split symbols_num_syms

2025-04-02 Thread Jan Beulich
In preparation for inserting address entries into symbols_addresses[] / symbols_offsets[] without enlarging symbols_sorted_offsets[], split symbols_num_syms into symbols_num_addrs (counting entries in the former plus symbols_names[] as well as, less directly, symbols_markers[]) and symbols_num_name

Re: [PATCH v2 3/5] symbols: arrange to know where functions end

2025-04-02 Thread Jan Beulich
On 02.04.2025 15:58, Jan Beulich wrote: > When determining the symbol for a given address (e.g. for the %pS > logging format specifier), so far the size of a symbol (function) was > assumed to be everything until the next symbol. There may be gaps > though, which would better be recognizable in out

[PATCH v2] x86/vmx: Use asm goto() in _vmx_cpu_up()

2025-04-02 Thread Andrew Cooper
With the new toolchain baseline, we can make use of asm goto() in certain places, and the VMXON invocation is one example. This removes the logic to set up rc (including a fixup section where bactraces have no connection to the invoking function), the logic to decode it, and the default case which

[PATCH] xen/arm: Include xen/vmap.h in mm.c

2025-04-02 Thread Michal Orzel
As reported by ECLAIR scan, MISRA requires declaration to be visible (R8.4). This is not the case for ioremap(). Fixes: 2cd02c27d327 ("arm/mpu: Implement stubs for ioremap_attr on MPU") Signed-off-by: Michal Orzel --- https://gitlab.com/xen-project/hardware/xen/-/jobs/9599092510 as part of the mo

Re: Domain IDs and Capabilities

2025-04-02 Thread Jan Beulich
On 01.04.2025 19:32, Jason Andryuk wrote: > On 2025-04-01 04:07, Jan Beulich wrote: >> On 31.03.2025 23:46, Jason Andryuk wrote: >>> It is useful for a domain to know its own domid. Xenstored has command >>> line flags to set --master-domid (the local domid) and --priv-domid, but >>> it would be b

Re: [PATCH RFC] x86/vmx: Use asm goto() in _vmx_cpu_up()

2025-04-02 Thread Jan Beulich
On 02.04.2025 01:34, Andrew Cooper wrote: > With the new toolchain baseline, we can make use of asm goto() in certain > places, and the VMXON invocation is one example. > > This removes the logic to set up rc (including a fixup section where bactraces > have no connection to the invoking function)

Re: [PATCH v1 4/5] x86/vmx: remove *_OPCODE

2025-04-02 Thread Jan Beulich
On 02.04.2025 00:21, dm...@proton.me wrote: > @@ -497,9 +479,7 @@ static inline void vpid_sync_all(void) > > static inline void __vmxoff(void) > { > -asm volatile ( > -VMXOFF_OPCODE > -: : : "memory" ); > +asm volatile ("vmxoff" : : : "memory"); Nit (style): Blanks imme

Re: [PATCH RFC] x86/vmx: Use asm goto() in _vmx_cpu_up()

2025-04-02 Thread Andrew Cooper
On 02/04/2025 10:40 am, Jan Beulich wrote: > On 02.04.2025 01:34, Andrew Cooper wrote: >> With the new toolchain baseline, we can make use of asm goto() in certain >> places, and the VMXON invocation is one example. >> >> This removes the logic to set up rc (including a fixup section where >> bact

Re: [PATCH v2 09/19] xen/pmstat: clean up pmstat.c

2025-04-02 Thread Jan Beulich
On 26.03.2025 06:50, Penny Zheng wrote: > We intend to move the following functions into drivers/acpi/pmstat.c, as they > are all designed for performance statistic: "We intend to ..." describes future plans. Yet this is what you're doing in this very patch. > - cpufreq_residency_update > - cpufr

[PATCH] x86/xen: fix balloon target initialization for PVH dom0

2025-04-02 Thread Roger Pau Monne
PVH dom0 re-uses logic from PV dom0, in which RAM ranges not assigned to dom0 are re-used as scratch memory to map foreign and grant pages. Such logic relies on reporting those unpopulated ranges as RAM to Linux, and mark them as reserved. This way Linux creates the underlying page structures req

Re: [PATCH v2 08/11] x86/boot: place trampoline code in a non-execute section

2025-04-02 Thread Jan Beulich
On 01.04.2025 15:49, Andrew Cooper wrote: > On 01/04/2025 2:08 pm, Roger Pau Monne wrote: >> The trampoline code is never executed in the position placed by the >> loader. It's first copied to the low 1MB, and always executed from >> there. >> >> Move the trampoline code from being in .init.text s

Re: [PATCH] xen/arm: Include xen/vmap.h in mm.c

2025-04-02 Thread Andrew Cooper
On 02/04/2025 11:10 am, Michal Orzel wrote: > As reported by ECLAIR scan, MISRA requires declaration to be visible > (R8.4). This is not the case for ioremap(). > > Fixes: 2cd02c27d327 ("arm/mpu: Implement stubs for ioremap_attr on MPU") > Signed-off-by: Michal Orzel Acked-by: Andrew Cooper

Re: [PATCH v2 09/11] x86/efi: avoid a relocation in efi_arch_post_exit_boot()

2025-04-02 Thread Jan Beulich
On 01.04.2025 15:08, Roger Pau Monne wrote: > Instead of using the absolute __start_xen address, calculate it as an > offset from the current instruction pointer. The relocation would be > problematic if the loader has acknowledged the Xen image section > attributes, and mapped .init.text with jus

Re: [RFC PATCH v1 01/15] x86/msr: Replace __wrmsr() with native_wrmsrl()

2025-04-02 Thread H. Peter Anvin
On April 2, 2025 8:41:07 AM PDT, Dave Hansen wrote: >On 3/31/25 22:53, Xin Li wrote: >> Per "struct msr" defined in arch/x86/include/asm/shared/msr.h: >> >> struct msr { >>     union { >>     struct { >>     u32 l; >>     u32 h; >>  

Re: New Defects reported by Coverity Scan for XenProject

2025-04-02 Thread Andrew Cooper
On 02/04/2025 3:19 pm, Jan Beulich wrote: > On 02.04.2025 14:56, scan-ad...@coverity.com wrote: >> ** CID 1645573: Null pointer dereferences (FORWARD_NULL) >> >> >> >> *** CID 1645573: Null p

[PATCH v2] xen/arm: Drop process_shm_chosen()

2025-04-02 Thread Michal Orzel
There's no benefit in having process_shm_chosen() next to process_shm(). The former is just a helper to pass "/chosen" node to the latter for hwdom case. Drop process_shm_chosen() and instead use process_shm() passing NULL as node parameter, which will result in searching for and using /chosen to f

[PATCH] x86/EFI: sanitize DLL characteristics in binary

2025-04-02 Thread Jan Beulich
In GNU ld --disable-reloc-section implies --disable-dynamicbase (and also --disable-high-entropy-va, just fyi). Therefore to yield functionally identical binaries independent of whether mkreloc needs to come into play, add --dynamicbase as well. GNU ld further defaults to --high-entropy-va (along

Re: [PATCH v2] xen/arm: Drop process_shm_chosen()

2025-04-02 Thread Bertrand Marquis
Hi Michal, > On 2 Apr 2025, at 10:42, Michal Orzel wrote: > > There's no benefit in having process_shm_chosen() next to process_shm(). > The former is just a helper to pass "/chosen" node to the latter for > hwdom case. Drop process_shm_chosen() and instead use process_shm() > passing NULL as no

Re: Domain IDs and Capabilities

2025-04-02 Thread Juergen Gross
On 02.04.25 11:33, Jan Beulich wrote: On 01.04.2025 19:32, Jason Andryuk wrote: On 2025-04-01 04:07, Jan Beulich wrote: On 31.03.2025 23:46, Jason Andryuk wrote: It is useful for a domain to know its own domid. Xenstored has command line flags to set --master-domid (the local domid) and --pri

Re: [PATCH v2 6/6] xen/arm: Add capabilities to dom0less

2025-04-02 Thread Jason Andryuk
On 2025-04-01 20:03, Stefano Stabellini wrote: On Mon, 31 Mar 2025, Jason Andryuk wrote: Add capabilities property to dom0less to allow building a disaggregated system. Only a single hardware domain and single xenstore domain can be specified. Multiple control domains are possible. Introduce