[PATCH v2 2/4] xen: common: add ability to enable stack protector

2024-11-29 Thread Volodymyr Babchuk
Both GCC and Clang support -fstack-protector feature, which add stack canaries to functions where stack corruption is possible. This patch makes general preparations to enable this feature on different supported architectures: - Added CONFIG_HAS_STACK_PROTECTOR option so each architecture can

[PATCH v2 0/4] Add stack protector

2024-11-29 Thread Volodymyr Babchuk
Both GCC and Clang support -fstack-protector feature, which add stack canaries to functions where stack corruption is possible. This series makes possible to use this feature in Xen. I tested this on ARM64 and it is working as intended. Tested both with GCC and Clang. It is hard to enable this fea

[PATCH v2 4/4] xen: riscv: enable stack protector feature

2024-11-29 Thread Volodymyr Babchuk
Enable previously added CONFIG_STACK_PROTECTOR feature for RISC-V platform. Here we can call boot_stack_chk_guard_setup() in start_xen() function, because it never returns, so stack protector code will not be triggered because of changed canary. Signed-off-by: Volodymyr Babchuk Tested-by: Oleksii

[PATCH v2 3/4] xen: arm: enable stack protector feature

2024-11-29 Thread Volodymyr Babchuk
Enable previously added CONFIG_STACK_PROTECTOR feature for ARM platform. Here we can call boot_stack_chk_guard_setup() in start_xen() function, because it never returns, so stack protector code will not be triggered because of changed canary. Signed-off-by: Volodymyr Babchuk --- In v2: - Reord

[PATCH v2 1/4] common: remove -fno-stack-protector from EMBEDDED_EXTRA_CFLAGS

2024-11-29 Thread Volodymyr Babchuk
This patch is preparation for making stack protector configurable. First step is to remove -fno-stack-protector flag from EMBEDDED_EXTRA_CFLAGS so separate projects (Hypervisor in this case) can enable/disable this feature by themselves. Signed-off-by: Volodymyr Babchuk --- Changes in v2: - Ne

Re: [PATCH 3/5] build: arm64: provide -target and -march if using clang

2024-11-29 Thread Volodymyr Babchuk
Hi Jan, Jan Beulich writes: > On 29.11.2024 02:49, Volodymyr Babchuk wrote: >> Provide -target and -march explicitly when building with clang. This >> makes cross-compilation much easier, because clang accept this >> parameters regardless of host platform. Basically, >> >> make XEN_TARGET_A

Re: [PATCH v2 1/2] xen/swiotlb: add alignment check for dma buffers

2024-11-29 Thread Thierry Escande
Hi, On 16/09/2024 08:47, Juergen Gross wrote: > diff --git a/drivers/xen/swiotlb-xen.c b/drivers/xen/swiotlb-xen.c > index 35155258a7e2..ddf5b1df632e 100644 > --- a/drivers/xen/swiotlb-xen.c > +++ b/drivers/xen/swiotlb-xen.c > @@ -78,9 +78,15 @@ static inline int > range_straddles_page_boundary(p

Re: [PATCH 2/5] build: add possibility to use LLVM tools

2024-11-29 Thread Anthony PERARD
On Fri, Nov 29, 2024 at 08:57:47AM +0100, Jan Beulich wrote: > On 29.11.2024 02:49, Volodymyr Babchuk wrote: > > Currently, even if we are using clang as a C compiler, we still use > > GNU binutils. This patch adds new option "llvm" that allows to use > > linker, objcopy and all other tools from LL

Re: [PATCH v2 00/21] Converge on using secs_to_jiffies()

2024-11-29 Thread Przemek Kitszel
[removed most non-list recipients, it's just too much] On 11/15/24 10:26 PM, Easwar Hariharan wrote: This is a series that follows up on my previous series to introduce secs_to_jiffies() and convert a few initial users.[1] In the review for that series, Anna-Maria requested converting other us

Re: [PATCH] libxl: extend IGD check

2024-11-29 Thread Anthony PERARD
On Fri, Nov 29, 2024 at 02:00:10AM +0100, Marek Marczykowski-Górecki wrote: > Consider also "Display controller" an IGD, not only "VGA compatible > controller". Specifically, IGD on Raptor Lake has 0x038000 class, not > 0x03. > > Signed-off-by: Marek Marczykowski-Górecki Acked-by: Anthony PER

Re: [PATCH v3 1/5] common/vmap: Fall back to simple allocator when !HAS_VMAP

2024-11-29 Thread Luca Fancellu
>>> >>> Just to double check: Was it at least considered to use simple #define-s >>> to effect the aliasing? Wrapper functions like the above ones have the >>> downside of needing touching (easy to miss) when the wrapped function >>> types change in whichever minor way. (And yes, I do understand

Re: [PATCH v3 1/5] common/vmap: Fall back to simple allocator when !HAS_VMAP

2024-11-29 Thread Jan Beulich
On 29.11.2024 12:14, Luca Fancellu wrote: > Hi Jan, > >> On 29 Nov 2024, at 11:06, Jan Beulich wrote: >> >> On 29.11.2024 10:12, Luca Fancellu wrote: >>> --- a/xen/include/xen/xvmalloc.h >>> +++ b/xen/include/xen/xvmalloc.h >>> @@ -40,20 +40,46 @@ >>> ((typeof(ptr))_xvrealloc(ptr, offsetof(ty

Re: [PATCH v10 09/12] xen: add cache coloring allocator for domains

2024-11-29 Thread Jan Beulich
On 29.11.2024 10:37, Carlo Nonato wrote: > On Thu, Nov 28, 2024 at 12:43 PM Jan Beulich wrote: >> On 19.11.2024 15:13, Carlo Nonato wrote: >>> --- a/xen/common/Kconfig >>> +++ b/xen/common/Kconfig >>> @@ -537,4 +537,12 @@ config LLC_COLORS_ORDER >>> The default value corresponds to an 8 Mi

Re: [PATCH v3 1/5] common/vmap: Fall back to simple allocator when !HAS_VMAP

2024-11-29 Thread Luca Fancellu
Hi Jan, > On 29 Nov 2024, at 11:06, Jan Beulich wrote: > > On 29.11.2024 10:12, Luca Fancellu wrote: >> --- a/xen/include/xen/xvmalloc.h >> +++ b/xen/include/xen/xvmalloc.h >> @@ -40,20 +40,46 @@ >> ((typeof(ptr))_xvrealloc(ptr, offsetof(typeof(*(ptr)), field[nr]), \ >>

Re: [PATCH v10 08/12] xen/page_alloc: introduce preserved page flags macro

2024-11-29 Thread Jan Beulich
On 29.11.2024 10:32, Carlo Nonato wrote: > Hi Jan, > > On Thu, Nov 28, 2024 at 12:05 PM Jan Beulich wrote: >> >> On 19.11.2024 15:13, Carlo Nonato wrote: >>> PGC_static, PGC_extra and PGC_broken need to be preserved when assigning a >>> page. Define a new macro that groups those flags and use it

Re: [PATCH v3 1/5] common/vmap: Fall back to simple allocator when !HAS_VMAP

2024-11-29 Thread Jan Beulich
On 29.11.2024 10:12, Luca Fancellu wrote: > --- a/xen/include/xen/xvmalloc.h > +++ b/xen/include/xen/xvmalloc.h > @@ -40,20 +40,46 @@ > ((typeof(ptr))_xvrealloc(ptr, offsetof(typeof(*(ptr)), field[nr]), \ > __alignof__(typeof(*(ptr) > > +#ifdef CONFIG_HAS_VM

Re: [PATCH v3 4/5] xen/arm: Check for Static Heap feature when freeing resources

2024-11-29 Thread Jan Beulich
On 29.11.2024 10:12, Luca Fancellu wrote: > --- a/xen/common/page_alloc.c > +++ b/xen/common/page_alloc.c > @@ -165,6 +165,11 @@ > #define PGT_TYPE_INFO_INITIALIZER 0 > #endif > > +#ifdef CONFIG_STATIC_MEMORY > +/* Flag saved when Xen is using the static heap feature (xen,static-heap) */ > +boo

Re: [PATCH v10 09/12] xen: add cache coloring allocator for domains

2024-11-29 Thread Carlo Nonato
Hi Jan, On Thu, Nov 28, 2024 at 12:43 PM Jan Beulich wrote: > > On 19.11.2024 15:13, 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 freque

Re: [PATCH v10 08/12] xen/page_alloc: introduce preserved page flags macro

2024-11-29 Thread Carlo Nonato
Hi Jan, On Thu, Nov 28, 2024 at 12:05 PM Jan Beulich wrote: > > On 19.11.2024 15:13, Carlo Nonato wrote: > > PGC_static, PGC_extra and PGC_broken need 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

[PATCH v3 3/5] xen/arm: Use vmap_contig instead of __vmap where it's possible

2024-11-29 Thread Luca Fancellu
Currently the arm code uses __vmap function in few parts to map physically contiguous pages, vmap_contig was introduced recently and does the same because it's a wrapper for __vmap, so use the latter instead of the direct __vmap function. Signed-off-by: Luca Fancellu Acked-by: Julien Grall Acked

[PATCH v3 5/5] xen/arm: Move setup_frametable_mappings to arm/mmu

2024-11-29 Thread Luca Fancellu
Move the current setup_frametable_mappings implementation to arm/mmu under a new file mm.c, this implementation depends on virtual memory and won't be used as it is for MPU systems. Take the occasion to fix code style issues related to the line length. Moved also frametable_virt_end since it is u

[PATCH v3 0/5] Prerequisite patches for R82 upstreaming

2024-11-29 Thread Luca Fancellu
In this serie I've taken out patches from the R82 branch already in the ML[1] and some new patches I've done based on the current status of staging that will not impact the current Armv8-R earlyboot work. [1] https://patchwork.kernel.org/project/xen-devel/cover/20230626033443.2943270-1-penny.zh..

[PATCH v3 1/5] common/vmap: Fall back to simple allocator when !HAS_VMAP

2024-11-29 Thread Luca Fancellu
When HAS_VMAP is disabled, the xv{malloc,zalloc,...} functions should fall back to the simple x{malloc,zalloc,...} variant, implement that because MPU systems won't have virtual memory. Additionally remove VMAP_VIRT_START from vmap.h guards since MPU systems won't have it defined. Signed-off-by:

[PATCH v3 4/5] xen/arm: Check for Static Heap feature when freeing resources

2024-11-29 Thread Luca Fancellu
From: Penny Zheng If the Xen heap is statically configured in Device Tree, its size is definite, so only the defined memory shall be given to the boot allocator. Have a check where init_domheap_pages() is called which takes into account if static heap feature is used. Extract static_heap flag fr

[PATCH v3 2/5] arm/setup: Move MMU specific extern declarations to mmu/setup.h

2024-11-29 Thread Luca Fancellu
Move some extern declarations related to MMU structures and define from asm/setup.h to asm/mmu/setup.h, in order to increase encapsulation and allow the MPU part to build, since it has no clue about them. Signed-off-by: Luca Fancellu --- Changes from v2: - No changes Changes from v1: - Moved ex

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

2024-11-29 Thread Chen, Jiqian
On 2024/11/19 00:05, Anthony PERARD wrote: > On Wed, Nov 06, 2024 at 02:14:18PM +0800, Jiqian Chen wrote: >> 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/device

Re: [PATCH v10 03/12] xen/arm: permit non direct-mapped Dom0 construction

2024-11-29 Thread Carlo Nonato
Hi Michal, On Thu, Nov 28, 2024 at 11:34 AM Michal Orzel wrote: > On 19/11/2024 15:13, Carlo Nonato wrote: > > > > > > Cache coloring requires Dom0 not to be direct-mapped because of its non > > contiguous mapping nature, so allocate_memory() is needed in this case. > > 8d2c3ab18cc1 ("arm/dom0les

Re: [PATCH 5/5] xen: arm64: remove -mgeneral-regs-only for vfp.c

2024-11-29 Thread Jan Beulich
On 29.11.2024 02:49, Volodymyr Babchuk wrote: > vfp.c actually accesses VFP registers, so it can't be built with > -mgeneral-regs-only flag when using clang, as clang will complain > about this: > > arch/arm/arm64/vfp.c:9:18: error: instruction requires: fp-armv8 > 9 | asm volatile("stp q0

Re: [PATCH 4/5] xen: build: add support for CFLAGS_REMOVE variable

2024-11-29 Thread Jan Beulich
On 29.11.2024 02:49, Volodymyr Babchuk wrote: > --- a/xen/Rules.mk > +++ b/xen/Rules.mk > @@ -179,7 +179,7 @@ cpp_flags = $(filter-out -Wa$(comma)% -flto,$(1)) > # Calculation of flags, first the generic flags, then the arch specific > flags, > # and last the flags modified for a target or a dir

Re: [PATCH 3/5] build: arm64: provide -target and -march if using clang

2024-11-29 Thread Jan Beulich
On 29.11.2024 02:49, Volodymyr Babchuk wrote: > Provide -target and -march explicitly when building with clang. This > makes cross-compilation much easier, because clang accept this > parameters regardless of host platform. Basically, > > make XEN_TARGET_ARCH=arm64 clang=y llvm=y > > will behav