[PATCH v2 2/2] automation/eclair: tag Rule 19.1 as clean

2025-05-02 Thread victorm.lira
From: Federico Serafini Tag MISRA C Rule 19.1 as clean to avoid regressions. Signed-off-by: Federico Serafini Signed-off-by: Victor Lira Acked-by: Stefano Stabellini --- Cc: Andrew Cooper Cc: Anthony PERARD Cc: Michal Orzel Cc: Jan Beulich Cc: Julien Grall Cc: Roger Pau Monné Cc: Stefan

[PATCH v2 1/2] x86: x86_emulate: address violations of MISRA C Rule 19.1

2025-05-02 Thread victorm.lira
From: Nicola Vetrini Rule 19.1 states: "An object shall not be assigned or copied to an overlapping object". In the function like macro "get_rep_prefix", one member of a union is assigned the value of another member. Reading from one member and writing to the other violates the rule, while not ca

Re: [PATCH v2 2/2] automation/eclair: tag Rule 19.1 as clean

2025-05-02 Thread Lira, Victor M
Sorry, the content transfer encoding was wrong so the patch might not apply, I'll re-send this. Victor

[PATCH v2 2/2] automation/eclair: tag Rule 19.1 as clean

2025-05-02 Thread victorm.lira
From: Federico Serafini Tag MISRA C Rule 19.1 as clean to avoid regressions. Signed-off-by: Federico Serafini Signed-off-by: Victor Lira Acked-by: Stefano Stabellini --- Cc: Andrew Cooper Cc: Anthony PERARD Cc: Michal Orzel Cc: Jan Beulich Cc: Julien Grall Cc: Roger Pau Monné Cc: Stefa

[PATCH v2 1/2] x86: x86_emulate: address violations of MISRA C Rule 19.1

2025-05-02 Thread victorm.lira
From: Nicola Vetrini Rule 19.1 states: "An object shall not be assigned or copied to an overlapping object". In the function like macro "get_rep_prefix", one member of a union is assigned the value of another member. Reading from one member and writing to the other violates the rule, while not ca

[PATCH v2 1/1] mm: fix folio_pte_batch() on XEN PV

2025-05-02 Thread Petr Vaněk
On XEN PV, folio_pte_batch() can incorrectly batch beyond the end of a folio due to a corner case in pte_advance_pfn(). Specifically, when the PFN following the folio maps to an invalidated MFN, expected_pte = pte_advance_pfn(expected_pte, nr); produces a pte_none(). If the actual next PT

[PATCH v2 0/1] mm: Xen PV regression after THP PTE optimization

2025-05-02 Thread Petr Vaněk
Hi all, I recently discovered an mm regression introduced in kernel version 6.9 that affects systems running as a Xen PV domain [1]. Original fix proposal wasn't ideal, but it sparked a discussion which helped us fully understand the root cause. The new v2 patch contains changes based on David Hi

Re: [PATCH v3 5/8] asm-generic: move some parts of Arm's domain_build.h to common

2025-05-02 Thread Stefano Stabellini
On Fri, 2 May 2025, Oleksii Kurochko wrote: > Nothing changed. Only some functions declaration are moved to xen/include/ > headers as they are expected to be used by common code of domain builing > or dom0less. > > Signed-off-by: Oleksii Kurochko > --- > Chnages in v3: > - Drop inclusion of fr

Re: [PATCH v3 8/8] xen/common: dom0less: introduce common dom0less-build.c

2025-05-02 Thread Stefano Stabellini
On Fri, 2 May 2025, Oleksii Kurochko wrote: > Part of Arm's dom0less-build.c could be common between architectures which are > using device tree files to create guest domains. Thereby move some parts of > Arm's dom0less-build.c to common code with minor changes. > > As a part of theses changes the

Re: [PATCH v3 7/8] xen/common: dom0less: introduce common domain-build.c

2025-05-02 Thread Stefano Stabellini
On Fri, 2 May 2025, Oleksii Kurochko wrote: > Some functions of Arm's domain_build.c could be reused by dom0less or other > features connected to domain construction/build. > > The following functions are moved to common: > - get_allocation_size(). > - allocate_domheap_memory(). > - guest_map_page

Re: [PATCH v3 6/8] xen/common: dom0less: introduce common kernel.c

2025-05-02 Thread Stefano Stabellini
On Fri, 2 May 2025, Oleksii Kurochko wrote: > The following functions don't have arch specific things so it is moved to > common: > - kernel_prboe() > - kernel_load() > - output_length() > > Functions necessary for dom0less are only moved. > > The following changes are done: > - Swap __init and r

Re: [PATCH v3 4/8] arm/static-shmem.h: drop inclusion of asm/setup.h

2025-05-02 Thread Stefano Stabellini
On Fri, 2 May 2025, Oleksii Kurochko wrote: > Nothing is dependent from asm/setup.h in asm/static-shmem.h so inclusion of > asm/setup.h is droped. Actually, this patch is not currently dropping any inclusions > After this drop the following compilation error related to impicit declaration > of t

Re: [PATCH v3 3/8] asm-generic: move parts of Arm's asm/kernel.h to common code

2025-05-02 Thread Stefano Stabellini
On Fri, 2 May 2025, Oleksii Kurochko wrote: > Move the following parts to common with the following changes: > - struct kernel_info: > - Create arch_kernel_info for arch specific kernel information. > At the moment, it contains domain_type for Arm. > - Rename vpl011 to vuart to have more ge

Re: [PATCH v4 02/15] x86/msr: Move rdtsc{,_ordered}() to

2025-05-02 Thread Xin Li
On 5/2/2025 1:02 AM, Ingo Molnar wrote: * Xin Li (Intel) wrote: index 94408a784c8e..13335a130edf 100644 --- a/arch/x86/include/asm/tsc.h +++ b/arch/x86/include/asm/tsc.h @@ -7,7 +7,81 @@ #include #include -#include + +/* + * both i386 and x86_64 returns 64-bit value in edx:eax, but

Re: [PATCH v4 02/15] x86/msr: Move rdtsc{,_ordered}() to

2025-05-02 Thread Xin Li
On 5/2/2025 1:18 AM, Ingo Molnar wrote: * Xin Li (Intel) wrote: For some reason, there are some TSC-related functions in the MSR ^^^ header even though there is a tsc.h header. The real reason is that the rdtsc{,_ordered}() methods use the EAX_EDX_*() macros to optimize the

Re: [PATCH v4 02/15] x86/msr: Move rdtsc{,_ordered}() to

2025-05-02 Thread Xin Li
On 5/2/2025 1:52 AM, Ingo Molnar wrote: * Xin Li (Intel) wrote: For some reason, there are some TSC-related functions in the MSR header even though there is a tsc.h header. Relocate rdtsc{,_ordered}() from to , and subsequently remove the inclusion of in . Signed-off-by: Xin Li (Intel) A

Re: [PATCH v3 2/8] xen/common: dom0less: make some parts of Arm's CONFIG_DOM0LESS common

2025-05-02 Thread Stefano Stabellini
On Fri, 2 May 2025, Oleksii Kurochko wrote: > Move some parts of Arm's Dom0Less code to be reused by other architectures. > At the moment, RISC-V is going to reuse these parts. > > Move dom0less-build.h from the Arm-specific directory to asm-generic > as these header is expected to be the same acr

Re: [PATCH v4A 01/15] x86/msr: Add missing includes of

2025-05-02 Thread Xin Li
On 5/2/2025 6:13 AM, Ilpo Järvinen wrote: diff --git a/arch/x86/kernel/trace_clock.c b/arch/x86/kernel/trace_clock.c index b8e7abe00b06..708d61743d15 100644 --- a/arch/x86/kernel/trace_clock.c +++ b/arch/x86/kernel/trace_clock.c @@ -4,7 +4,7 @@ */ #include #include -#include +#include

Re: [PATCH 2/2] xen: swiotlb: Implement map_resource callback

2025-05-02 Thread Stefano Stabellini
+Christoph On Fri, 2 May 2025, John Ernberg wrote: > Needed by the eDMA v3 DMA engine found in iommu-less SoCs such as iMX8QXP > to be able to perform DMA operations as a Xen Hardware Domain, which needs > to be able to do DMA in MMIO space. > > The callback implementation is basically the same a

Re: [PATCH 1/2] xen: swiotlb: Use swiotlb bouncing if kmalloc allocation demands it

2025-05-02 Thread Stefano Stabellini
On Fri, 2 May 2025, John Ernberg wrote: > Xen swiotlb support was missed when the patch set starting with > 4ab5f8ec7d71 ("mm/slab: decouple ARCH_KMALLOC_MINALIGN from > ARCH_DMA_MINALIGN") was merged. > > When running Xen on iMX8QXP, a SoC without IOMMU, the effect was that USB > transfers ended

Re: [PATCH] xen/x86: allow Dom0 PVH to call XENMEM_exchange

2025-05-02 Thread Stefano Stabellini
On Fri, 2 May 2025, Jan Beulich wrote: > On 01.05.2025 15:44, Jason Andryuk wrote: > > On 2025-04-30 20:19, Stefano Stabellini wrote: > >> On Wed, 30 Apr 2025, Roger Pau Monné wrote: > >>> On Wed, Apr 30, 2025 at 08:27:55AM +0200, Jan Beulich wrote: > On 29.04.2025 23:52, Stefano Stabellini wr

[PATCH v3 8/8] xen/common: dom0less: introduce common dom0less-build.c

2025-05-02 Thread Oleksii Kurochko
Part of Arm's dom0less-build.c could be common between architectures which are using device tree files to create guest domains. Thereby move some parts of Arm's dom0less-build.c to common code with minor changes. As a part of theses changes the following changes are introduced: - Introduce make_ar

[PATCH v3 6/8] xen/common: dom0less: introduce common kernel.c

2025-05-02 Thread Oleksii Kurochko
The following functions don't have arch specific things so it is moved to common: - kernel_prboe() - kernel_load() - output_length() Functions necessary for dom0less are only moved. The following changes are done: - Swap __init and return type of kernel_decompress() function to be consistent wi

[PATCH v3 2/8] xen/common: dom0less: make some parts of Arm's CONFIG_DOM0LESS common

2025-05-02 Thread Oleksii Kurochko
Move some parts of Arm's Dom0Less code to be reused by other architectures. At the moment, RISC-V is going to reuse these parts. Move dom0less-build.h from the Arm-specific directory to asm-generic as these header is expected to be the same across acrhictectures with some updates: add the followin

[PATCH v3 1/8] xen/arm: drop declaration of handle_device_interrupts()

2025-05-02 Thread Oleksii Kurochko
There is no definition of handle_device_interrupts() thereby it could be dropped. Signed-off-by: Oleksii Kurochko Reviewed-by: Michal Orzel --- Change in v3: - Update commit message - Add Reviewed-by: Michal Orzel . --- xen/arch/arm/include/asm/domain_build.h | 11 --- 1 file changed,

[PATCH v3 7/8] xen/common: dom0less: introduce common domain-build.c

2025-05-02 Thread Oleksii Kurochko
Some functions of Arm's domain_build.c could be reused by dom0less or other features connected to domain construction/build. The following functions are moved to common: - get_allocation_size(). - allocate_domheap_memory(). - guest_map_pages(). - allocate_bank_memory(). - add_hwdom_free_regions().

[PATCH v3 5/8] asm-generic: move some parts of Arm's domain_build.h to common

2025-05-02 Thread Oleksii Kurochko
Nothing changed. Only some functions declaration are moved to xen/include/ headers as they are expected to be used by common code of domain builing or dom0less. Signed-off-by: Oleksii Kurochko --- Chnages in v3: - Drop inclusion of from xen/fdt-domain-build.h. - Add empty line after license t

[PATCH v3 0/8] Move parts of Arm's Dom0less to common code

2025-05-02 Thread Oleksii Kurochko
Some parts of Arm's Dom0less solution could be moved to common code as they are not truly Arm-specific. Most of the code is moved as is, with only minor changes introduced to provide abstractions that hide Arm-specific details, while maintaining functional equivalence with original Arm's code. Th

[PATCH v3 4/8] arm/static-shmem.h: drop inclusion of asm/setup.h

2025-05-02 Thread Oleksii Kurochko
Nothing is dependent from asm/setup.h in asm/static-shmem.h so inclusion of asm/setup.h is droped. After this drop the following compilation error related to impicit declaration of the following functions device_tree_get_reg and map_device_irqs_to_domain, device_tree_get_u32 occur during compilati

[PATCH v3 3/8] asm-generic: move parts of Arm's asm/kernel.h to common code

2025-05-02 Thread Oleksii Kurochko
Move the following parts to common with the following changes: - struct kernel_info: - Create arch_kernel_info for arch specific kernel information. At the moment, it contains domain_type for Arm. - Rename vpl011 to vuart to have more generic name suitable for other archs. - s/phandle_gic

Re: [PATCH] x86/cpufeatures: cpuid features for Sierra Forest

2025-05-02 Thread Andrew Cooper
On 02/05/2025 4:17 pm, Kevin Lampis wrote: > Add new cpuid features for Sierra Forest. > > Signed-off-by: Kevin Lampis One minor thing, you should have CC'd the x86 maintainers on this patch, which I've done. > --- > xen/include/public/arch-x86/cpufeatureset.h | 10 ++ > 1 file changed,

[PATCH] x86/cpufeatures: cpuid features for Sierra Forest

2025-05-02 Thread Kevin Lampis
Add new cpuid features for Sierra Forest. Signed-off-by: Kevin Lampis --- xen/include/public/arch-x86/cpufeatureset.h | 10 ++ 1 file changed, 10 insertions(+) diff --git a/xen/include/public/arch-x86/cpufeatureset.h b/xen/include/public/arch-x86/cpufeatureset.h index cc6e984a88..c0587

RE: [PATCH v4 00/15] MSR code cleanup part one

2025-05-02 Thread Michael Kelley
From: Xin Li (Intel) Sent: Sunday, April 27, 2025 2:20 AM > > This patch set is the first part of the patch set: > > MSR refactor with new MSR instructions support > > @ https://lore.kernel.org/lkml/20250422082216.1954310-1-...@zytor.com/ > > It's getting *WAY* too big, and whether to zap t

Re: [PATCH] x86/mm: Improve bitops in vcpumask_to_pcpumask()

2025-05-02 Thread Jan Beulich
On 02.05.2025 15:13, Andrew Cooper wrote: > This loop is for_each_set_bit() in disguise. > > No functional change. > > Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich

Re: [PATCH v4A 01/15] x86/msr: Add missing includes of

2025-05-02 Thread Ilpo Järvinen
On Wed, 30 Apr 2025, Xin Li (Intel) wrote: > For some reason, there are some TSC-related functions in the MSR > header even though there is a tsc.h header. > > To facilitate the relocation of rdtsc{,_ordered}() from > to and to eventually eliminate the inclusion of > in , add to the source fi

[PATCH] x86/mm: Improve bitops in vcpumask_to_pcpumask()

2025-05-02 Thread Andrew Cooper
This loop is for_each_set_bit() in disguise. No functional change. Signed-off-by: Andrew Cooper --- CC: Jan Beulich CC: Roger Pau Monné More detailed analysis: add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-46 (-46) Function old new delta vcpumas

Re: [RFC PATCH 1/4] xen: Introduce physaddr_abi CDF flag

2025-05-02 Thread Jan Beulich
On 02.05.2025 13:55, Teddy Astie wrote: > Le 30/04/2025 à 17:59, Jan Beulich a écrit : >> On 18.04.2025 16:18, Teddy Astie wrote: >>> @@ -745,6 +747,12 @@ static int sanitise_domain_config(struct >>> xen_domctl_createdomain *config) >>> return -EINVAL; >>> } >>> >>> +if ( ph

Re: [PATCH] x86/vpic: Improve bitops usage

2025-05-02 Thread Andrew Cooper
On 02/05/2025 9:04 am, Jan Beulich wrote: > On 02.05.2025 01:30, Andrew Cooper wrote: >> * For vpic_get_priority(), introduce a common ror8() helper in plain C. One >>thing that I can't persuade the compiler to realise is that a non-zero >>value rotated is still non-zero, so use __builtin

Re: [RFC PATCH 0/4] Physical address hypercall ABI ("HVMv2")

2025-05-02 Thread Teddy Astie
Le 01/05/2025 à 13:14, Julien Grall a écrit : > Hi, > > On 22/04/2025 08:45, Jan Beulich wrote: >> On 18.04.2025 16:18, Teddy Astie wrote: >>> In current HVM mode, when a hypercall references a structure in guest >>> memory, >>> it is passed to the hypervisor as its "linear address" (e.g virtual >>

Re: [RFC PATCH 1/4] xen: Introduce physaddr_abi CDF flag

2025-05-02 Thread Teddy Astie
Le 30/04/2025 à 17:59, Jan Beulich a écrit : > On 18.04.2025 16:18, Teddy Astie wrote: >> @@ -745,6 +747,12 @@ static int sanitise_domain_config(struct >> xen_domctl_createdomain *config) >> return -EINVAL; >> } >> >> +if ( physaddr_abi && !hvm ) >> +{ >> +dprintk(X

[PATCH 1/2] xen: swiotlb: Use swiotlb bouncing if kmalloc allocation demands it

2025-05-02 Thread John Ernberg
Xen swiotlb support was missed when the patch set starting with 4ab5f8ec7d71 ("mm/slab: decouple ARCH_KMALLOC_MINALIGN from ARCH_DMA_MINALIGN") was merged. When running Xen on iMX8QXP, a SoC without IOMMU, the effect was that USB transfers ended up corrupted when there was more than one URB inflig

[PATCH 2/2] xen: swiotlb: Implement map_resource callback

2025-05-02 Thread John Ernberg
Needed by the eDMA v3 DMA engine found in iommu-less SoCs such as iMX8QXP to be able to perform DMA operations as a Xen Hardware Domain, which needs to be able to do DMA in MMIO space. The callback implementation is basically the same as the one for direct mapping of resources, except this also ta

[PATCH 0/2] xen: swiotlb: 2 fixes SoCs w/o IOMMU (e.g. iMX8QXP)

2025-05-02 Thread John Ernberg
There's 2 problems with DMA today when running Xen on the iMX8QXP SoC. The first identifies as a USB corruption, but is actually a memory corruption risk with any small DMA transfer, and just manifests itself in USB transfers. This is a regression fix tracing back to Linux 6.5 when the blamed com

Re: [PATCH v4 02/15] x86/msr: Move rdtsc{,_ordered}() to

2025-05-02 Thread Ingo Molnar
* Xin Li (Intel) wrote: > For some reason, there are some TSC-related functions in the MSR > header even though there is a tsc.h header. > > Relocate rdtsc{,_ordered}() from to , and > subsequently remove the inclusion of in . > > Signed-off-by: Xin Li (Intel) > Acked-by: Dave Hansen > Ac

Re: [PATCH v4 10/15] x86/xen/msr: Remove calling native_{read,write}_msr{,_safe}() in pmu_msr_{read,write}()

2025-05-02 Thread Ingo Molnar
* Xin Li (Intel) wrote: > hpa found that pmu_msr_write() is actually a completely pointless > function [1]: all it does is shuffle some arguments, then calls > pmu_msr_chk_emulated() and if it returns true AND the emulated flag > is clear then does *exactly the same thing* that the calling code

Re: [PATCH v4 02/15] x86/msr: Move rdtsc{,_ordered}() to

2025-05-02 Thread Ingo Molnar
* Xin Li (Intel) wrote: > For some reason, there are some TSC-related functions in the MSR ^^^ > header even though there is a tsc.h header. The real reason is that the rdtsc{,_ordered}() methods use the EAX_EDX_*() macros to optimize their EDX/EAX assembly accessors, which is

Re: [PATCH] x86/vpic: Improve bitops usage

2025-05-02 Thread Jan Beulich
On 02.05.2025 01:30, Andrew Cooper wrote: > * For vpic_get_priority(), introduce a common ror8() helper in plain C. One >thing that I can't persuade the compiler to realise is that a non-zero >value rotated is still non-zero, so use __builtin_clz() to help the >optimiser out. > > *

Re: [PATCH v4 02/15] x86/msr: Move rdtsc{,_ordered}() to

2025-05-02 Thread Ingo Molnar
* Xin Li (Intel) wrote: > index 94408a784c8e..13335a130edf 100644 > --- a/arch/x86/include/asm/tsc.h > +++ b/arch/x86/include/asm/tsc.h > @@ -7,7 +7,81 @@ > > #include > #include > -#include > + > +/* > + * both i386 and x86_64 returns 64-bit value in edx:eax, but gcc's "A" > + * constra

Re: [PATCH] x86/thunk: Don't opencode TSX instructions in clear_bhb_tsx()

2025-05-02 Thread Jan Beulich
On 01.05.2025 20:16, Andrew Cooper wrote: > The new toolchain baseline understands the RTM instructions. > > No functional change. > > Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich

Re: [PATCH] x86/vmx: Fix label name in vmwrite_safe()

2025-05-02 Thread Jan Beulich
On 02.05.2025 01:08, Andrew Cooper wrote: > This condition is called VMFail(valid) in the SDM. > > No functional change. > > Fixes: fc3db01db6fb ("x86/vmx: Rework VMX wrappers using `asm goto()`") > Signed-off-by: Andrew Cooper Acked-by: Jan Beulich

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

2025-05-02 Thread Jan Beulich
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),$(CONFIG_ACPI)) += device.o >> obj-$(CONFIG_HAS_DEVICE_TREE) += device-tree/ >> obj-$(CONFIG_IOR

Re: [PATCH] xen/x86: allow Dom0 PVH to call XENMEM_exchange

2025-05-02 Thread Jan Beulich
On 01.05.2025 15:44, Jason Andryuk wrote: > On 2025-04-30 20:19, Stefano Stabellini wrote: >> On Wed, 30 Apr 2025, Roger Pau Monné wrote: >>> On Wed, Apr 30, 2025 at 08:27:55AM +0200, Jan Beulich wrote: On 29.04.2025 23:52, Stefano Stabellini wrote: > On Tue, 29 Apr 2025, Jan Beulich wrote

Re: [XEN PATCH v2] sbat: Add SBAT section to the Xen EFI binary

2025-05-02 Thread Jan Beulich
On 01.05.2025 14:23, Gerald Elder-Vass wrote: > --- a/xen/arch/x86/Makefile > +++ b/xen/arch/x86/Makefile > @@ -58,6 +58,7 @@ obj-y += percpu.o > obj-y += physdev.o > obj-$(CONFIG_COMPAT) += x86_64/physdev.o > obj-y += psr.o > +obj-y += sbat.o > obj-y += setup.o > obj-y += shutdown.o > obj-y