Re: [PATCH 01/36] x86/setup: fix typo in acpi=off description

2024-11-26 Thread Jan Beulich
(Cc list reduced) On 27.11.2024 00:21, Denis Mukhin via B4 Relay wrote: > From: Denis Mukhin > > Signed-off-by: Denis Mukhin Acked-by: Jan Beulich

Re: [PATCH 00/36] Introduce NS8250 UART emulator

2024-11-26 Thread Jan Beulich
On 27.11.2024 00:57, Andrew Cooper wrote: > On 26/11/2024 11:21 pm, Denis Mukhin via B4 Relay wrote: >> The patch series introduces initial in-hypervisor emulator for >> NS8250/NS16x50-compatible UARTs under CONFIG_HAS_VUART_NS8250. >> >> In parallel domain creation scenario (hyperlaunch), NS8520 e

[PATCH] x86emul: MOVBE requires a memory operand

2024-11-26 Thread Jan Beulich
The reg-reg forms should cause #UD; they come into existence only with APX, where MOVBE also extends BSWAP (for the latter not being "eligible" to a REX2 prefix). Signed-off-by: Jan Beulich --- a/xen/arch/x86/x86_emulate/x86_emulate.c +++ b/xen/arch/x86/x86_emulate/x86_emulate.c @@ -6824,6 +6824

[PATCH 25/36] xen/console: introduce handle_keypress_in_domain()

2024-11-26 Thread Denis Mukhin via B4 Relay
From: Denis Mukhin With introduction of NS8250 emulator for x86, the logic of switching console focus gets more convoluted: HVM domain w/ NS8205 must be able to receive the physical console input for guest VM debugging. Also, existing code does not honor `hardware_dom=` xen command line paramete

Re: [PATCH 00/36] Introduce NS8250 UART emulator

2024-11-26 Thread Andrew Cooper
On 26/11/2024 11:21 pm, Denis Mukhin via B4 Relay wrote: > The patch series introduces initial in-hypervisor emulator for > NS8250/NS16x50-compatible UARTs under CONFIG_HAS_VUART_NS8250. > > In parallel domain creation scenario (hyperlaunch), NS8520 emulator helps > early guest OS bringup debugging

[PATCH 15/36] xen/console: move vpl011-related code to vpl011 emulator

2024-11-26 Thread Denis Mukhin via B4 Relay
From: Denis Mukhin Xen console driver has vpl011-related logic which shall belong vpl011 emulator code. Move vpl011-related to vpl011.c. Signed-off-by: Denis Mukhin --- xen/arch/arm/include/asm/vpl011.h | 2 +- xen/arch/arm/vpl011.c | 15 --- xen/drivers/char/console.c

[PATCH 29/36] xen/console: make console buffer size configurable

2024-11-26 Thread Denis Mukhin via B4 Relay
From: Denis Mukhin Add new CONRING_LOG_SHIFT Kconfig parameter to specify the boot console buffer size as a power of 2. Bump default size to 32 KiB. Link: https://gitlab.com/xen-project/xen/-/issues/185 Signed-off-by: Denis Mukhin --- xen/drivers/char/Kconfig | 23 +++ x

[PATCH 33/36] x86/hvm: introduce NS8250 UART emulator

2024-11-26 Thread Denis Mukhin via B4 Relay
From: Denis Mukhin Add initial in-hypervisor emulator for NS8250/NS16x50-compatible UARTs under CONFIG_HAS_VUART_NS8250. In parallel domain creation scenario (hyperlaunch), NS8520 emulator helps early guest OS bringup debugging, because it eliminates dependency on the external emulator being ope

[PATCH 22/36] xen/console: introduce console_set_owner()

2024-11-26 Thread Denis Mukhin via B4 Relay
From: Denis Mukhin console_set_owner() is introduced for setting the new console owner. Switches console owner to domain ID vs range of integer numbers mapped to domain IDs. This a public API to console driver, will be used in the follow on code change. Signed-off-by: Denis Mukhin --- xen/dr

[PATCH 35/36] xen/console: enable console owners w/ emulated NS8250

2024-11-26 Thread Denis Mukhin via B4 Relay
From: Denis Mukhin Enable console focus for domains w/ virtual NS8250. Code change allows to capture the output from the guest OS now and send it to the physical console device. Signed-off-by: Denis Mukhin --- xen/drivers/char/console.c | 5 + 1 file changed, 5 insertions(+) diff --git a

[PATCH 26/36] xen/console: introduce console_write()

2024-11-26 Thread Denis Mukhin via B4 Relay
From: Denis Mukhin PV Linux kernel uses HYPERVISOR_console_io hypercall for early console which ends up being handled by Xen's console driver's guest_console_write(). guest_console_write() duplicates the code from __putstr(), elimitate code duplication. Signed-off-by: Denis Mukhin --- xen/dri

[PATCH 21/36] xen/console: introduce use of 'is_console' flag

2024-11-26 Thread Denis Mukhin via B4 Relay
From: Denis Mukhin The code now inspects d->is_console flag to decide whether the console focus should move to the domain w/ console after administrator presses . To do that max_init_domid is updated in domain_create(). Console owner domain switch logic updated accordingly. Signed-off-by: Deni

[PATCH 19/36] xen/console: introduce printk_common()

2024-11-26 Thread Denis Mukhin via B4 Relay
From: Denis Mukhin Introduce new printk() variant for convenient printouts which skip '(XEN)' prefix on xen console. This is needed for the case when physical console is owned by a domain w/ in-hypervisor UART emulation enabled. Signed-off-by: Denis Mukhin --- xen/drivers/char/console.c | 8 ++

[PATCH 23/36] xen/console: introduce console_owner_domid()

2024-11-26 Thread Denis Mukhin via B4 Relay
From: Denis Mukhin console_owner_domid() is introduced to obtain the "console owner" domain ID. The call is used in NS8250 emulator to identify the case when physical xen console focus is owned by the domain w/ NS8250 emulator, in which case, messages from guest OS are formatted w/o '(XEN)' pref

[PATCH 31/36] x86/hvm: add HVM-specific Kconfig

2024-11-26 Thread Denis Mukhin via B4 Relay
From: Denis Mukhin Add separate menu for configuring HVM build-time settings. That will help organizing HVM-specific options under a separate menu. Signed-off-by: Denis Mukhin --- xen/arch/x86/Kconfig | 66 +++- xen/arch/x86/hvm/Kconfig | 63

[PATCH 32/36] x86/hvm: add helpers for raising guest IRQs

2024-11-26 Thread Denis Mukhin via B4 Relay
From: Denis Mukhin Added convenience wrappers for asserting/de-asserting interrupts in the hardware emulation code. That will be used for PCI-based NS8250 emulator. Signed-off-by: Denis Mukhin --- xen/arch/x86/hvm/irq.c | 24 xen/arch/x86/include/asm/hvm/i

[PATCH 18/36] xen/console: rename console_rx to console_owner

2024-11-26 Thread Denis Mukhin via B4 Relay
From: Denis Mukhin Preparation for the follow on change to switch console_owner to domid_t address space. Signed-off-by: Denis Mukhin --- xen/drivers/char/console.c | 26 +- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/xen/drivers/char/console.c b/xen

[PATCH 28/36] xen/console: simplify console owner switch hint

2024-11-26 Thread Denis Mukhin via B4 Relay
From: Denis Mukhin Update the hint w/ the combination of keys to press to switch physical console to the next owner. Signed-off-by: Denis Mukhin --- xen/drivers/char/console.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xen/drivers/char/console.c b/xen/drivers/char/

[PATCH 16/36] xen/console: rename console_input_domain

2024-11-26 Thread Denis Mukhin via B4 Relay
From: Denis Mukhin console_input_domain() takes an RCU lock to protect domain structure. That implies call to rcu_unlock_domain() after use. Rename console_input_domain() to rcu_lock_domain_console_owner() to highlight the need of calling rcu_unlock_domain(). Signed-off-by: Denis Mukhin --- x

[PATCH 27/36] xen/console: introduce hwdom_crashconsole=

2024-11-26 Thread Denis Mukhin via B4 Relay
From: Denis Mukhin The new command line switch `hwdom_crashconsole=BOOL` allows to switch serial console input focus to xen for machine state inspection using keyhandler mechanism after the hardware domain crashes. The new command line switch is aliased via `dom0=...,crashconsole` knob. Such fu

[PATCH 20/36] xen/console: introduce consoled_is_enabled()

2024-11-26 Thread Denis Mukhin via B4 Relay
From: Denis Mukhin There are few places which check pv_shim console under CONFIG_PV_SHIM in xen console driver. Instead of #ifdef-ing, use new consoled_is_enabled() to customize the logic. Header file now can be included w/o CONFIG_X86. Signature of consoled_guest_{rx,tx} has changed to account

[PATCH 36/36] docs/misc: update console documentation

2024-11-26 Thread Denis Mukhin via B4 Relay
From: Denis Mukhin Minor update related to virtual UART support. Also: s/pv/PV/g s/hvm/HVM/g Signed-off-by: Denis Mukhin --- docs/misc/console.txt | 48 +--- 1 file changed, 25 insertions(+), 23 deletions(-) diff --git a/docs/misc/console.txt b/d

[PATCH 34/36] x86/domain: implement domain_has_vuart()

2024-11-26 Thread Denis Mukhin via B4 Relay
From: Denis Mukhin Add new emulation flag for virtual UART on x86 and plumb it through the stack. This change enables NS8250 emulator initialization. Signed-off-by: Denis Mukhin --- tools/libs/light/libxl_x86.c | 6 +- tools/ocaml/libs/xc/xenctrl.ml| 1 + tools/ocaml/libs/xc/xe

[PATCH 02/36] xsm/flask: missing breaks, MISRA rule 16.4

2024-11-26 Thread Denis Mukhin via B4 Relay
From: Denis Mukhin While working on console forwarding for virtual NS8250 I stepped into flask_domain_alloc_security() where break statement was missing in default case which violates MISRA rule 16.4. Fixed everywhere in hooks.c. Signed-off-by: Denis Mukhin --- xen/xsm/flask/hooks.c | 4 +++

[PATCH 12/36] x86/domain: print emulation_flags

2024-11-26 Thread Denis Mukhin via B4 Relay
From: Denis Mukhin Print d->arch.emulation_flags on the console for better traceability while debugging in-hypervisor hardware emulators. Signed-off-by: Denis Mukhin --- xen/arch/x86/domain.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/xen/arch/x86/domain.c b/xe

[PATCH 24/36] xen/console: introduce console_init_owner()

2024-11-26 Thread Denis Mukhin via B4 Relay
From: Denis Mukhin console_init_owner() is introduced for selecting the boot-time console owner. Signed-off-by: Denis Mukhin --- xen/drivers/char/console.c | 27 +-- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/xen/drivers/char/console.c b/xen/drivers

[PATCH 08/36] arm/vuart: make domain_has_vuart() public

2024-11-26 Thread Denis Mukhin via B4 Relay
From: Denis Mukhin Move domain_has_vuart() to arch namespace as preparation code change for architecture-agnostic way of forwarding physical console to the guest OS w/ in-hypervisor UART emulator. Signed-off-by: Denis Mukhin --- xen/arch/arm/include/asm/domain.h | 9 + xen/arch/arm/vpl

[PATCH 04/36] xen/irq: introduce NO_IRQ

2024-11-26 Thread Denis Mukhin via B4 Relay
From: Denis Mukhin Introduce definition for IRQ resource checks. Signed-off-by: Denis Mukhin --- xen/include/xen/irq.h | 1 + 1 file changed, 1 insertion(+) diff --git a/xen/include/xen/irq.h b/xen/include/xen/irq.h index 95034c0d6bb5f0aa7d5bb572aca59872508a438a..aee878293ecc0de6a938bcfea114

[PATCH 00/36] Introduce NS8250 UART emulator

2024-11-26 Thread Denis Mukhin via B4 Relay
The patch series introduces initial in-hypervisor emulator for NS8250/NS16x50-compatible UARTs under CONFIG_HAS_VUART_NS8250. In parallel domain creation scenario (hyperlaunch), NS8520 emulator helps early guest OS bringup debugging, because it eliminates dependency on the external emulator being

[PATCH 30/36] xen/8250-uart: add missing definitions

2024-11-26 Thread Denis Mukhin via B4 Relay
From: Denis Mukhin Added missing definitions needed for NS8250 UART emulator. Signed-off-by: Denis Mukhin --- xen/include/xen/8250-uart.h | 82 + 1 file changed, 61 insertions(+), 21 deletions(-) diff --git a/xen/include/xen/8250-uart.h b/xen/includ

[PATCH 17/36] xen/console: rename switch_serial_input() to console_find_owner()

2024-11-26 Thread Denis Mukhin via B4 Relay
From: Denis Mukhin Updated the name to highlight the logic of selection the physical console owner: existing code does not switch only serial console, it also switches video console and debugging console (debug I/O port and console hypercall). Signed-off-by: Denis Mukhin --- xen/drivers/char/c

[PATCH 13/36] xen/domain: add get_initial_domain_id()

2024-11-26 Thread Denis Mukhin via B4 Relay
From: Denis Mukhin Move get_initial_domain_id() to a public API and enable for all architectures. That is pre-requisite change for console focus switch logic cleanup. Signed-off-by: Denis Mukhin --- xen/arch/x86/include/asm/pv/shim.h | 4 ++-- xen/arch/x86/pv/shim.c | 4 ++-- xen

[PATCH 09/36] riscv/domain: introduce domain_has_vuart()

2024-11-26 Thread Denis Mukhin via B4 Relay
From: Denis Mukhin Introduce domain_has_vuart() for RISC-V port to be used in the console driver. Signed-off-by: Denis Mukhin --- xen/arch/riscv/include/asm/domain.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/xen/arch/riscv/include/asm/domain.h b/xen/arch/riscv/include/asm/domain.h

[PATCH 01/36] x86/setup: fix typo in acpi=off description

2024-11-26 Thread Denis Mukhin via B4 Relay
From: Denis Mukhin Signed-off-by: Denis Mukhin --- xen/arch/x86/setup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index d8661d7ca699c96f38229c75ad0a8626c6f675d4..0a748e2c14122d6c5d692bc5691e8cbe13a32c81 100644 --- a/xen/arc

[PATCH 14/36] xen/domain: enable max_init_domid for all architectures

2024-11-26 Thread Denis Mukhin via B4 Relay
From: Denis Mukhin Move max_init_domid to a public API and enable for all architectures. That is pre-requisite change for console focus switch logic cleanup. Signed-off-by: Denis Mukhin --- xen/arch/arm/include/asm/setup.h | 2 -- xen/arch/arm/setup.c | 2 -- xen/arch/ppc/inclu

[PATCH 10/36] ppc/domain: introduce domain_has_vuart()

2024-11-26 Thread Denis Mukhin via B4 Relay
From: Denis Mukhin Introduce domain_has_vuart() for PPC port to be used in the console driver. Signed-off-by: Denis Mukhin --- xen/arch/ppc/include/asm/domain.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/xen/arch/ppc/include/asm/domain.h b/xen/arch/ppc/include/asm/domain.h index 3

[PATCH 11/36] x86/domain: introduce domain_has_vuart()

2024-11-26 Thread Denis Mukhin via B4 Relay
From: Denis Mukhin Introduce domain_has_vuart() for x86 port to be used in the console driver. Signed-off-by: Denis Mukhin --- xen/arch/x86/include/asm/domain.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/xen/arch/x86/include/asm/domain.h b/xen/arch/x86/include/asm/domain.h index

[PATCH 03/36] xen: introduce resource.h

2024-11-26 Thread Denis Mukhin via B4 Relay
From: Denis Mukhin Move resource definitions to a new architecture-agnostic shared header file. It will be used in follow on NS8250 emulator code to describe legacy PC COM resources. Signed-off-by: Denis Mukhin --- xen/common/device-tree/device-tree.c | 21 +-- xen/drivers/pas

[PATCH 06/36] xen/ctype: introduce isconsole()

2024-11-26 Thread Denis Mukhin via B4 Relay
From: Denis Mukhin There are several console drivers which have same checks w.r.t. printable characters. The check is moved to new isconsole() macro and re-used in the console drivers. Signed-off-by: Denis Mukhin --- xen/arch/arm/vuart.c | 3 +-- xen/arch/x86/hvm/hvm.c | 3 +-- xen/d

[PATCH 07/36] arm/vuart: use guest_printk()

2024-11-26 Thread Denis Mukhin via B4 Relay
From: Denis Mukhin Use guest_printk() in all current in-hypervisor UART emulators. That slightly improves the logging as guest_printk() already prints the domain ID. Signed-off-by: Denis Mukhin --- xen/arch/arm/vpl011.c | 2 +- xen/arch/arm/vuart.c | 2 +- 2 files changed, 2 insertions(+), 2

[PATCH 05/36] xen/xmalloc: add kmalloc() and kfree() aliases

2024-11-26 Thread Denis Mukhin via B4 Relay
From: Denis Mukhin Move existing aliases to a common header so those could be used in the new code. The code looks simpler w/ kmalloc(): type specification of the object being allocated is not required, e.g.: ... struct my_obj_s *obj; obj = kmalloc(sizeof(*obj), 0); ... Signed-off-by: Deni

[PATCH] x86/APIC: Remove workaround Pentium 3AP APIC_ESR erratum

2024-11-26 Thread Andrew Cooper
The SDM instructs software to write 0 to ESR prior to reading it. However, due to an original Pentium erratum, most logic skips the write based on there being more than 3 LVTs; a stand-in to identify the Pentium. Xen, being 64bit, doesn't need compatibility for i586 processors. Introduce a new a

Re: [XEN PATCH v1] x86/APIC: Read Error Status Register correctly

2024-11-26 Thread Andrew Cooper
On 26/11/2024 5:06 pm, Javi Merino wrote: > The logic to read the APIC_ESR was copied from linux in a commit from > 2002: 4676bbf96dc8 (bitkeeper revision > 1.2 (3ddb79c9KusG02eh7i-uXkgY0IksKA), 2002-11-20). In linux 3.14, > this logic was fixed to follow the Intel SDM (see commit > 60283df7ac26 (

Re: [PATCH v3 4/7] x86: control memset() and memcpy() inlining

2024-11-26 Thread Andrew Cooper
On 25/11/2024 2:29 pm, Jan Beulich wrote: > Stop the compiler from inlining non-trivial memset() and memcpy() (for > memset() see e.g. map_vcpu_info() or kimage_load_segments() for > examples). This way we even keep the compiler from using REP STOSQ / > REP MOVSQ when we'd prefer REP STOSB / REP MO

Re: [PATCH v3 3/7] x86: re-work memcpy()

2024-11-26 Thread Andrew Cooper
On 25/11/2024 2:28 pm, Jan Beulich wrote: > Move the function to its own assembly file. Having it in C just for the > entire body to be an asm() isn't really helpful. Then have two flavors: > A "basic" version using qword steps for the bulk of the operation, and an > ERMS version for modern hardwar

Re: [PATCH 5/6] tools: add a dedicated header file for barrier definitions

2024-11-26 Thread Anthony PERARD
On Wed, Oct 23, 2024 at 03:10:04PM +0200, Juergen Gross wrote: > diff --git a/tools/include/xen-barrier.h b/tools/include/xen-barrier.h > new file mode 100644 > index 00..62036f528b > --- /dev/null > +++ b/tools/include/xen-barrier.h > @@ -0,0 +1,51 @@ > +/**

[PATCH v2 2/2] tools/xl: add suspend and resume subcommands

2024-11-26 Thread Jason Andryuk
From: zithro / Cyril Rébert The xl command doesn't provide suspend/resume, so add them : xl suspend xl resume This patch follows a discussion on XenDevel: when you want the virtualized equivalent of "sleep"-ing a host, it's better to suspend/resume than to pause/unpause a domain. Suggeste

[PATCH v2 1/2] xl: Keep monitoring suspended domain

2024-11-26 Thread Jason Andryuk
When a VM transitioned to LIBXL_SHUTDOWN_REASON_SUSPEND, the xl daemon was exiting as 0 = DOMAIN_RESTART_NONE "No domain restart". Later, when the VM actually shutdown, the missing xl daemon meant the domain wasn't cleaned up properly. Add a new DOMAIN_RESTART_SUSPENDED to handle the case. The xl

[PATCH v2 0/2] xl suspend/resume commands

2024-11-26 Thread Jason Andryuk
This is a v2 of Cyril's implementation of xl suspend/resume. This is a cooperative operation like libvirt's suspend. I renamed suspend-to-ram to just suspend. xl also needed a fixup to avoid exiting when the domain suspends. Jason Andryuk (1): xl: Keep monitoring suspended domain zithro / Cy

Re: [PATCH v3 2/7] x86: re-work memset()

2024-11-26 Thread Andrew Cooper
On 25/11/2024 2:28 pm, Jan Beulich wrote: > Move the function to its own assembly file. Having it in C just for the > entire body to be an asm() isn't really helpful. Then have two flavors: > A "basic" version using qword steps for the bulk of the operation, and an > ERMS version for modern hardwar

[XEN PATCH v1] x86/APIC: Read Error Status Register correctly

2024-11-26 Thread Javi Merino
The logic to read the APIC_ESR was copied from linux in a commit from 2002: 4676bbf96dc8 (bitkeeper revision 1.2 (3ddb79c9KusG02eh7i-uXkgY0IksKA), 2002-11-20). In linux 3.14, this logic was fixed to follow the Intel SDM (see commit 60283df7ac26 (x86/apic: Read Error Status Register correctly, 2014

Re: [PATCH 4/6] tools/libs: add a new libxenmanage library

2024-11-26 Thread Anthony PERARD
On Fri, Nov 22, 2024 at 04:12:25PM +0100, Jürgen Groß wrote: > On 22.11.24 14:55, Anthony PERARD wrote: > > On Wed, Oct 23, 2024 at 03:10:03PM +0200, Juergen Gross wrote: > > > diff --git a/tools/include/xenmanage.h b/tools/include/xenmanage.h > > > new file mode 100644 > > > index 00..2e6c

Re: [RFC PATCH 12/25] xen: Replace sysctl/readconsole with autogenerated version

2024-11-26 Thread Jan Beulich
On 26.11.2024 15:36, Alejandro Vallejo wrote: > On Tue Nov 26, 2024 at 1:20 PM GMT, Jan Beulich wrote: >> On 26.11.2024 13:27, Alejandro Vallejo wrote: >>> On Tue Nov 26, 2024 at 9:40 AM GMT, Jan Beulich wrote: On 25.11.2024 19:51, Alejandro Vallejo wrote: > On Mon Nov 25, 2024 at 12:05 PM

[PATCH v7 3/3] xen/riscv: finalize boot allocator and transition to boot state

2024-11-26 Thread Oleksii Kurochko
Add a call to end_boot_allocator() in start_xen() to finalize the boot memory allocator, moving free pages to the domain sub-allocator. After initializing the memory subsystem, update `system_state` from `SYS_STATE_early_boot` to `SYS_STATE_boot`, signifying the end of the early boot phase. Signe

Re: [RFC PATCH 12/25] xen: Replace sysctl/readconsole with autogenerated version

2024-11-26 Thread Jan Beulich
On 26.11.2024 15:39, Teddy Astie wrote: > Le 26/11/2024 à 14:20, Jan Beulich a écrit : Signed-ness of plain char doesn't really matter as long as it's used only for what really are characters (or strings thereof). And that looks the be pretty much the case throughout the

[PATCH v7 0/3] Setup memory management for RISC-V

2024-11-26 Thread Oleksii Kurochko
Finish initializing the memory subsystem by mapping the direct map and frame table. The frametable_virt_start variable is introduced with substracting of an offest ( taking into account that RAM start could be not 0 ) to save virtual address space of FRAMETABLE. Also it simplifies the calculations

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

2024-11-26 Thread Oleksii Kurochko
Introduce the implementation of setup_mm(), which includes: 1. Adding all free regions to the boot allocator, as memory is needed to allocate page tables used for frame table mapping. 2. Calculating RAM size and the RAM end address. 3. Setting up direct map mappings from each RAM bank and initia

[PATCH v7 2/3] xen/riscv: initialize the VMAP_DEFAULT virtual range

2024-11-26 Thread Oleksii Kurochko
Call vm_init() to initialize the VMAP_DEFAULT virtual range. To support this, introduce the populate_pt_range() and arch_vmap_virt_end() functions, which are used by vm_init()->vm_init_type(). Signed-off-by: Oleksii Kurochko Acked-by: Jan Beulich --- Change in V2-V7: - Add Acked-by: Jan Beulic

Re: [RFC PATCH 12/25] xen: Replace sysctl/readconsole with autogenerated version

2024-11-26 Thread Teddy Astie
Hello, Le 26/11/2024 à 14:20, Jan Beulich a écrit : >>> Signed-ness of plain char doesn't really matter as long as it's used only >>> for >>> what really are characters (or strings thereof). And that looks the be >>> pretty >>> much the case throughout the public headers. >> Maybe. Still, as a g

Re: [RFC PATCH 12/25] xen: Replace sysctl/readconsole with autogenerated version

2024-11-26 Thread Alejandro Vallejo
On Tue Nov 26, 2024 at 1:20 PM GMT, Jan Beulich wrote: > On 26.11.2024 13:27, Alejandro Vallejo wrote: > > On Tue Nov 26, 2024 at 9:40 AM GMT, Jan Beulich wrote: > >> On 25.11.2024 19:51, Alejandro Vallejo wrote: > >>> On Mon Nov 25, 2024 at 12:05 PM GMT, Jan Beulich wrote: > On 15.11.2024 12:

Re: [PATCH v3 1/7] x86: suppress ERMS for internal use when MISC_ENABLE.FAST_STRING is clear

2024-11-26 Thread Andrew Cooper
On 25/11/2024 2:27 pm, Jan Beulich wrote: > Before we start actually adjusting behavior when ERMS is available, > follow Linux commit 161ec53c702c ("x86, mem, intel: Initialize Enhanced > REP MOVSB/STOSB") and zap the CPUID-derived feature flag when the MSR > bit is clear. Don't extend the artifici

Re: [PATCH v2 4/4] xen/arm: do not give memory back to static heap

2024-11-26 Thread Luca Fancellu
> On 26 Nov 2024, at 13:29, Jan Beulich wrote: > > On 26.11.2024 14:25, Luca Fancellu wrote: >>> This reads better, thanks. Follow-on question: Is what is statically >>> configured for the heap guaranteed to never overlap with anything passed >>> to init_domheap_pages() in those places that you

Re: [PATCH] domain: Validate __copy_to_guest in VCPUOP_register_runstate_memory_area

2024-11-26 Thread Jan Beulich
On 26.11.2024 12:24, Michal Orzel wrote: > On 26/11/2024 11:40, Jan Beulich wrote: >> On 26.11.2024 11:26, Michal Orzel wrote: >>> For guests with paging mode external, guest_handle_okay() always returns >>> success, even if the guest handle is invalid (e.g. address not in P2M). >>> In VCPUOP_regis

Re: [PATCH v2 4/4] xen/arm: do not give memory back to static heap

2024-11-26 Thread Jan Beulich
On 26.11.2024 14:25, Luca Fancellu wrote: >> This reads better, thanks. Follow-on question: Is what is statically >> configured for the heap guaranteed to never overlap with anything passed >> to init_domheap_pages() in those places that you touch? > > I think so, the places of the check are mainl

Re: [PATCH v2 4/4] xen/arm: do not give memory back to static heap

2024-11-26 Thread Luca Fancellu
Hi Jan, > > This reads better, thanks. Follow-on question: Is what is statically > configured for the heap guaranteed to never overlap with anything passed > to init_domheap_pages() in those places that you touch? I think so, the places of the check are mainly memory regions related to boot mod

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

2024-11-26 Thread Jan Beulich
On 26.11.2024 12:57, oleksii.kuroc...@gmail.com wrote: > On Mon, 2024-11-25 at 16:49 +0100, Jan Beulich wrote: >> On 15.11.2024 13:47, Oleksii Kurochko wrote: >>> --- a/xen/arch/riscv/include/asm/config.h >>> +++ b/xen/arch/riscv/include/asm/config.h >>> @@ -90,6 +90,7 @@ >>>  #define DIRECTMAP_SLO

Re: [RFC PATCH 12/25] xen: Replace sysctl/readconsole with autogenerated version

2024-11-26 Thread Jan Beulich
On 26.11.2024 13:27, Alejandro Vallejo wrote: > On Tue Nov 26, 2024 at 9:40 AM GMT, Jan Beulich wrote: >> On 25.11.2024 19:51, Alejandro Vallejo wrote: >>> On Mon Nov 25, 2024 at 12:05 PM GMT, Jan Beulich wrote: On 15.11.2024 12:51, Alejandro Vallejo wrote: > Describe sysctl/readconsole as

Re: [RFC PATCH 12/25] xen: Replace sysctl/readconsole with autogenerated version

2024-11-26 Thread Alejandro Vallejo
On Tue Nov 26, 2024 at 9:40 AM GMT, Jan Beulich wrote: > On 25.11.2024 19:51, Alejandro Vallejo wrote: > > On Mon Nov 25, 2024 at 12:05 PM GMT, Jan Beulich wrote: > >> On 15.11.2024 12:51, Alejandro Vallejo wrote: > >>> Describe sysctl/readconsole as a TOML specification, remove old > >>> hand-code

Re: [PATCH 2/4] x86: Add architectural LBR declarations

2024-11-26 Thread Jan Beulich
On 18.11.2024 09:49, ngoc-tu.d...@vates.tech wrote: > From: Tu Dinh > > Signed-off-by: Tu Dinh > --- > xen/arch/x86/include/asm/msr-index.h | 11 +++ > 1 file changed, 11 insertions(+) > > diff --git a/xen/arch/x86/include/asm/msr-index.h > b/xen/arch/x86/include/asm/msr-index.h > ind

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

2024-11-26 Thread oleksii . kurochko
On Mon, 2024-11-25 at 16:49 +0100, Jan Beulich wrote: > On 15.11.2024 13:47, Oleksii Kurochko wrote: > > --- a/xen/arch/riscv/include/asm/config.h > > +++ b/xen/arch/riscv/include/asm/config.h > > @@ -90,6 +90,7 @@ > >  #define DIRECTMAP_SLOT_START    200 > >  #define DIRECTMAP_VIRT_START    SLOTN(

Re: [PATCH 4/4] x86/vmx: Virtualize architectural LBRs

2024-11-26 Thread Jan Beulich
On 18.11.2024 09:49, ngoc-tu.d...@vates.tech wrote: > --- a/xen/arch/x86/cpu-policy.c > +++ b/xen/arch/x86/cpu-policy.c > @@ -788,6 +788,9 @@ static void __init calculate_hvm_max_policy(void) > > if ( !cpu_has_vmx_xsaves ) > __clear_bit(X86_FEATURE_XSAVES, fs); > + > +

Re: [PATCH 2/4] x86: Add architectural LBR declarations

2024-11-26 Thread Jan Beulich
On 18.11.2024 09:49, ngoc-tu.d...@vates.tech wrote: > --- a/xen/arch/x86/include/asm/msr-index.h > +++ b/xen/arch/x86/include/asm/msr-index.h > @@ -304,6 +304,17 @@ > #define MSR_IA32_LASTINTFROMIP 0x01dd > #define MSR_IA32_LASTINTTOIP 0x01de > > +/* Architectural

Re: [PATCH 1/3] xen: common: add ability to enable stack protector

2024-11-26 Thread Volodymyr Babchuk
Hi Julien, Julien Grall writes: > Hi, > > Hi Volodymyr, > > On 22/11/2024 21:07, Volodymyr Babchuk wrote: >> diff --git a/xen/include/xen/stack_protector.h >> b/xen/include/xen/stack_protector.h >> new file mode 100644 >> index 00..97f1eb5ac0 >> --- /dev/null >> +++ b/xen/include/xen/

Re: [PATCH] domain: Validate __copy_to_guest in VCPUOP_register_runstate_memory_area

2024-11-26 Thread Michal Orzel
On 26/11/2024 11:40, Jan Beulich wrote: > > > On 26.11.2024 11:26, Michal Orzel wrote: >> For guests with paging mode external, guest_handle_okay() always returns >> success, even if the guest handle is invalid (e.g. address not in P2M). >> In VCPUOP_register_runstate_memory_area, we would the

Re: [PATCH v2 4/4] xen/arm: do not give memory back to static heap

2024-11-26 Thread Jan Beulich
On 26.11.2024 11:56, Luca Fancellu wrote: > Hi Jan, > > thanks for your review > >> On 25 Nov 2024, at 16:32, Jan Beulich wrote: >> >> On 19.11.2024 09:58, Luca Fancellu wrote: >>> From: Penny Zheng >>> >>> If Xenheap is statically configured in Device Tree, its size is >>> definite. So, the me

Re: [PATCH 3/4] x86: Adjust arch LBR CPU policy

2024-11-26 Thread Jan Beulich
On 18.11.2024 09:49, ngoc-tu.d...@vates.tech wrote: > From: Tu Dinh > > Allow virtual arch LBR with a single depth that's equal to that of the > host. If this is not possible, disable arch LBR altogether. How will this work across migration? What does "single depth that's equal to that of the h

Re: [PATCH v2 4/4] xen/arm: do not give memory back to static heap

2024-11-26 Thread Luca Fancellu
Hi Jan, thanks for your review > On 25 Nov 2024, at 16:32, Jan Beulich wrote: > > On 19.11.2024 09:58, Luca Fancellu wrote: >> From: Penny Zheng >> >> If Xenheap is statically configured in Device Tree, its size is >> definite. So, the memory shall not be given back into static heap, like >>

Re: [PATCH 2/4] x86: Add architectural LBR declarations

2024-11-26 Thread Jan Beulich
On 18.11.2024 09:49, ngoc-tu.d...@vates.tech wrote: > --- a/xen/arch/x86/include/asm/msr-index.h > +++ b/xen/arch/x86/include/asm/msr-index.h > @@ -304,6 +304,17 @@ Please note this comment around line 250: /* * Legacy MSR constants in need of cleanup. No new MSRs below this comment. */ You w

Re: [PATCH] domain: Validate __copy_to_guest in VCPUOP_register_runstate_memory_area

2024-11-26 Thread Jan Beulich
On 26.11.2024 11:26, Michal Orzel wrote: > For guests with paging mode external, guest_handle_okay() always returns > success, even if the guest handle is invalid (e.g. address not in P2M). > In VCPUOP_register_runstate_memory_area, we would then blindly set > runstate_guest() for a given vCPU to i

[PATCH] domain: Validate __copy_to_guest in VCPUOP_register_runstate_memory_area

2024-11-26 Thread Michal Orzel
For guests with paging mode external, guest_handle_okay() always returns success, even if the guest handle is invalid (e.g. address not in P2M). In VCPUOP_register_runstate_memory_area, we would then blindly set runstate_guest() for a given vCPU to invalid handle. Moreover, we don't check the retur

Re: [PATCH 05/15] kconfig: introduce domain builder config option

2024-11-26 Thread Jan Beulich
On 23.11.2024 19:20, Daniel P. Smith wrote: > Hyperlaunch domain builder will be the consolidated boot time domain building > logic framework. Introduces the config option to enable this domain builder to > and turn on the ability to load the domain configuration via a flattened > device > tree. >

Re: [PATCH 04/15] kconfig: introduce option to independently enable libfdt

2024-11-26 Thread Jan Beulich
On 26.11.2024 11:03, Jan Beulich wrote: > On 23.11.2024 19:20, Daniel P. Smith wrote: >> --- a/xen/common/Kconfig >> +++ b/xen/common/Kconfig >> @@ -53,8 +53,12 @@ config HAS_ALTERNATIVE >> config HAS_COMPAT >> bool >> >> +config LIB_DEVICE_TREE >> +bool > > Nit: Indentation is wrong h

Re: [PATCH 04/15] kconfig: introduce option to independently enable libfdt

2024-11-26 Thread Jan Beulich
On 23.11.2024 19:20, Daniel P. Smith wrote: > --- a/xen/common/Kconfig > +++ b/xen/common/Kconfig > @@ -53,8 +53,12 @@ config HAS_ALTERNATIVE > config HAS_COMPAT > bool > > +config LIB_DEVICE_TREE > +bool Nit: Indentation is wrong here and ... > config HAS_DEVICE_TREE > bool >

Re: [PATCH v2 1/2] x86/uaccess: rework user access speculative harden guards

2024-11-26 Thread Jan Beulich
On 26.11.2024 10:35, Roger Pau Monne wrote: > The current guards to select whether user accesses should be speculative > hardened violate Misra rule 20.7, as the UA_KEEP() macro doesn't (and can't) > parenthesize the 'args' argument. For my own education: This definitely isn't the only place where

Re: [PATCH] vpci: Add resizable bar support

2024-11-26 Thread Jan Beulich
On 26.11.2024 07:02, Chen, Jiqian wrote: > On 2024/11/25 20:47, Roger Pau Monné wrote: >> On Mon, Nov 25, 2024 at 03:44:52AM +, Chen, Jiqian wrote: >>> On 2024/11/21 17:52, Roger Pau Monné wrote: On Thu, Nov 21, 2024 at 03:05:14AM +, Chen, Jiqian wrote: > On 2024/11/20 17:01, Roger

[PATCH v2 1/2] x86/uaccess: rework user access speculative harden guards

2024-11-26 Thread Roger Pau Monne
The current guards to select whether user accesses should be speculative hardened violate Misra rule 20.7, as the UA_KEEP() macro doesn't (and can't) parenthesize the 'args' argument. Change the logic so the guard is implemented inside the assembly block using the .if assembly directive. This res

Re: [RFC PATCH 12/25] xen: Replace sysctl/readconsole with autogenerated version

2024-11-26 Thread Jan Beulich
On 25.11.2024 19:51, Alejandro Vallejo wrote: > On Mon Nov 25, 2024 at 12:05 PM GMT, Jan Beulich wrote: >> On 15.11.2024 12:51, Alejandro Vallejo wrote: >>> Describe sysctl/readconsole as a TOML specification, remove old >>> hand-coded version and replace it with autogenerated file. >>> >>> While a

[PATCH v2 2/2] automation/eclair: make Misra rule 20.7 blocking for x86 also

2024-11-26 Thread Roger Pau Monne
There are no violations left, make the rule globally blocking for both x86 and ARM. Signed-off-by: Roger Pau Monné Reviewed-by: Andrew Cooper --- automation/eclair_analysis/ECLAIR/tagging.ecl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/automation/eclair_analysis/ECLAIR

[PATCH v2 0/2] x86/misra: fix remaining violation of rule 20.7

2024-11-26 Thread Roger Pau Monne
Hello, This series fixes the remaining violation of rule 20.7, and marks the rule a blocking for x86 also on the Eclair scan. An example gitlab job with the rule enabled can be seen at: https://gitlab.com/xen-project/people/royger/xen/-/jobs/8470641011 Thanks, Roger. Roger Pau Monne (2): x86

Re: [PATCH v7 10/11] Arm32: use new-style entry annotations in head.S

2024-11-26 Thread Jan Beulich
On 25.11.2024 21:28, Julien Grall wrote: > On 01/10/2024 16:17, Jan Beulich wrote: >> Locally override SYM_PUSH_SECTION() to retain the intended section >> association. >> >> Signed-off-by: Jan Beulich >> --- >> v7: New. >> >> --- a/xen/arch/arm/arm32/head.S >> +++ b/xen/arch/arm/arm32/head.S >> @

Re: [PATCH v7 09/11] Arm32: use new-style entry annotations for entry code

2024-11-26 Thread Jan Beulich
On 25.11.2024 21:25, Julien Grall wrote: > On 01/10/2024 16:17, Jan Beulich wrote: >> Signed-off-by: Jan Beulich >> --- >> Should the GLOBAL()s also be replaced? > > What would you replace them with? LABEL() or, perhaps better, DATA()/END() pairs. >> @@ -362,13 +362,13 @@ trap_irq: >> trap_fi

Re: [PATCH v7 07/11] Arm32: use new-style entry annotations for library code

2024-11-26 Thread Jan Beulich
On 25.11.2024 21:15, Julien Grall wrote: > Hi Jan, > > Sorry for the late answer. > > On 01/10/2024 16:16, Jan Beulich wrote: >> No functional change, albeit all globals now become hidden, and aliasing >> symbols (__aeabi_{u,}idiv) as well as __memzero lose their function-ness >> and size. >> >>

Re: [PATCH v3 7/7] mm: allow page scrubbing routine(s) to be arch controlled

2024-11-26 Thread Jan Beulich
On 25.11.2024 23:17, Julien Grall wrote: >> --- a/xen/arch/arm/include/asm/page.h >> +++ b/xen/arch/arm/include/asm/page.h >> @@ -144,6 +144,12 @@ extern size_t dcache_line_bytes; >> >> #define copy_page(dp, sp) memcpy(dp, sp, PAGE_SIZE) >> >> +#define clear_page_hot clear_page >> +#define