Re: [PATCH] x86/hap: Inline "flush_vcpu" in "flush_tlb"

2025-09-29 Thread Teddy Astie
Le 29/09/2025 à 16:09, Roger Pau Monné a écrit : > On Mon, Sep 29, 2025 at 12:36:30PM +0000, Teddy Astie wrote: >> flush_vcpu static function here is only used in one place which is just below >> where it is defined. Inline the function to reduce the noise and clarify >> what

Re: [RESEND PATCH v2 2/3] hvmloader: Update to SMBIOS 2.6

2025-09-03 Thread Teddy Astie
Le 02/09/2025 à 16:10, Jan Beulich a écrit : > On 02.09.2025 15:24, Teddy Astie wrote: >> Le 02/09/2025 à 14:38, Jan Beulich a écrit : >>> On 29.08.2025 11:58, Teddy Astie wrote: >>>> @@ -505,7 +505,22 @@ smbios_type_1_init(void *start, const char >>>> *x

Re: [RESEND PATCH v2 2/3] hvmloader: Update to SMBIOS 2.6

2025-09-02 Thread Teddy Astie
Le 02/09/2025 à 14:38, Jan Beulich a écrit : > On 29.08.2025 11:58, Teddy Astie wrote: >> @@ -505,7 +505,22 @@ smbios_type_1_init(void *start, const char *xen_version, >> p->version_str = 3; >> p->serial_number_str = 4; >> >> -memcpy(p->

Re: [PATCH v5.10.y] xen: replace xen_remap() with memremap()

2025-09-02 Thread Teddy Astie
Le 02/09/2025 à 13:18, Greg Kroah-Hartman a écrit : > On Tue, Sep 02, 2025 at 09:28:32AM +0000, Teddy Astie wrote: >> From: Juergen Gross >> >> From: Juergen Gross >> >> [ upstream commit 41925b105e345ebc84cedb64f59d20cb14a62613 ] >> >> xen_remap()

[PATCH v5.10.y] xen: replace xen_remap() with memremap()

2025-09-02 Thread Teddy Astie
ergen Gross Signed-off-by: Teddy Astie [backport to 5.10.y] --- Cc: Anthoine Bourgeois Cc: Juergen Gross Cc: Boris Ostrovsky Cc: Stefano Stabellini Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Petkov Cc: Dave Hansen Cc: "H. Peter Anvin" Cc: Greg Kroah-Hartman Cc: Jiri Sl

Re: [RFC PATCH v3 3/3] x86/hvm: Introduce Xen-wide ASID allocator

2025-08-29 Thread Teddy Astie
Le 28/08/2025 à 15:05, Jan Beulich a écrit : > On 26.06.2025 16:01, Teddy Astie wrote: >> From: Vaishali Thakkar (formely vates.tech) >> >> Currently ASID generation and management is done per-PCPU. This >> scheme is incompatible with SEV technologies as SEV VMs n

Re: [RFC PATCH 5/9] docs/x86: Introduce FastABI

2025-08-29 Thread Teddy Astie
Le 28/08/2025 à 14:35, Jan Beulich a écrit : > On 21.08.2025 17:25, Teddy Astie wrote: >> FastABI is a alternative ABI designed with performance and coco-enabled >> guest in mind. It is register-oriented instead of refering to C structures >> in the guest memory (through a v

Re: [RFC PATCH 8/9] hvm: Introduce XEN_HVM_MEMMAP_TYPE_HOTPLUG_ZONE

2025-08-29 Thread Teddy Astie
Le 28/08/2025 à 14:40, Jan Beulich a écrit : > On 21.08.2025 17:25, Teddy Astie wrote: >> Allow specifying in memory map a region which can be hotplugged. >> >> This will be used by a future memory hotplug feature. > > Why could this not be done the ACPI way, with the

Re: [RFC PATCH 4/9] hvm: Introduce "fixed memory layout" feature

2025-08-29 Thread Teddy Astie
Le 28/08/2025 à 14:30, Jan Beulich a écrit : > On 21.08.2025 17:25, Teddy Astie wrote: >> @@ -686,10 +691,31 @@ static int domain_construct_memmap(libxl__gc *gc, >> /* We always own at least one lowmem entry. */ >> unsigned int e820_entries = 1; >> st

Re: [RFC PATCH 1/9] x86/hvm: Use direct structures instead of guest handles

2025-08-29 Thread Teddy Astie
Le 28/08/2025 à 14:16, Jan Beulich a écrit : > On 21.08.2025 17:25, Teddy Astie wrote: >> Make these functions work with hypervisor-owned pointer rather than >> guest handles, so the function parameters don't have to live in guest memory. > > This is odd to read

[RESEND PATCH v2 3/3] CHANGELOG.md: Add SMBIOS 2.6 update statement

2025-08-29 Thread Teddy Astie
Signed-off-by: Teddy Astie --- v2: - introduced --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8c4435c181..80a8273d7e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,6 +34,7 @@ The format is based on [Keep a Changelog](https

[RESEND PATCH v2 1/3] xen: Define xen_domain_handle_t encoding and formatting

2025-08-29 Thread Teddy Astie
users (at least with XAPI, xl, libvirt, hvmloader and Linux). Fixes: 30ce2a9295a5 ("Store an opaque handle (tools uuid) in the domain structure") Suggested-by: Andrew Cooper Signed-off-by: Teddy Astie --- v2: - introduced --- CHANGELOG.md | 1 + xen/include/public

[RESEND PATCH v2 2/3] hvmloader: Update to SMBIOS 2.6

2025-08-29 Thread Teddy Astie
vmloader.") (SMBIOS versions before 2.6 has a ill-defined UUID definition) Signed-off-by: Teddy Astie --- v2: - rebase onto staging - introduce missing SMBIOS 2.5-2.6 fields - check for new SMBIOS 2.6 table lengths - update UUID conversion comment - add Fixes: note --- tools/firmw

[RESEND PATCH v2 0/3] Update to SMBIOS 2.6

2025-08-29 Thread Teddy Astie
First patch clarifies the Xen guest handle definition as being a big endian UUID. The second does update to SMBIOS 2.6, writing a proper UUID in the table. Teddy Astie (3): xen: Define xen_domain_handle_t encoding and formatting hvmloader: Update to SMBIOS 2.6 CHANGELOG.md: Add SMBIOS 2.6

[PATCH v2 0/3] Update to SMBIOS 2.6

2025-08-28 Thread Teddy Astie
First patch clarify the Xen guest handle definition as being a big endian UUID. The second does update to SMBIOS 2.6, writing a proper UUID in the table. Teddy Astie (3): xen: Define xen_domain_handle_t encoding and formatting hvmloader: Update to SMBIOS 2.6 CHANGELOG.md: Add SMBIOS 2.6

[PATCH v2 1/3] xen: Define xen_domain_handle_t encoding and formatting

2025-08-28 Thread Teddy Astie
users (at least with XAPI, xl, libvirt, hvmloader and Linux). Fixes: 30ce2a9295a5 ("Store an opaque handle (tools uuid) in the domain structure") Suggested-by: Andrew Cooper Signed-off-by: Teddy Astie --- v2: - introduced --- CHANGELOG.md | 1 + xen/include/public

[PATCH v2 2/3] hvmloader: Update to SMBIOS 2.6

2025-08-28 Thread Teddy Astie
vmloader.") (SMBIOS versions before 2.6 has a ill-defined UUID definition) Signed-off-by: Teddy Astie --- v2: - rebase onto staging - introduce missing SMBIOS 2.5-2.6 fields - check for new SMBIOS 2.6 table lengths - update UUID conversion comment - add Fixes: note --- tools/firmw

[PATCH v2 3/3] CHANGELOG.md: Add SMBIOS 2.6 update statement

2025-08-28 Thread Teddy Astie
Signed-off-by: Teddy Astie --- v2: - introduced --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8c4435c181..80a8273d7e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,6 +34,7 @@ The format is based on [Keep a Changelog](https

Re: [PATCH] hvmloader: Update to SMBIOS 2.6

2025-08-28 Thread Teddy Astie
though it sounds a bit like this UUID could be a little endian GUID in some cases. Teddy Astie | Vates XCP-ng Developer XCP-ng & Xen Orchestra - Vates solutions web: https://vates.tech

Re: [PATCH] hvmloader: Update to SMBIOS 2.6

2025-08-28 Thread Teddy Astie
Le 28/08/2025 à 09:08, Jan Beulich a écrit : > On 22.08.2025 15:47, Teddy Astie wrote: >> Currently, hvmloader uses SMBIOS 2.4, however, when using OVMF, the >> SMBIOS is patched to 2.8, which has clarified the UUID format (as GUID). >> >> In Linux, if the SMBIOS version

Re: [PATCH] hvmloader: Update to SMBIOS 2.6

2025-08-27 Thread Teddy Astie
Le 27/08/2025 à 19:49, Andrew Cooper a écrit : > On 22/08/2025 2:47 pm, Teddy Astie wrote: >> Currently, hvmloader uses SMBIOS 2.4, however, when using OVMF, the >> SMBIOS is patched to 2.8, which has clarified the UUID format (as GUID). >> >> In Linux, if the SMBIOS

Re: [PATCH v5 3/4] hvmloader: add new SMBIOS tables (7, 8, 9, 26, 27, 28)

2025-08-25 Thread Teddy Astie
gt; + I would prefer having hex constants (so that it matches the number format the specification gives). e.g BUILD_BUG_ON(sizeof(struct smbios_type_7) != 0x13); (same for other checks) Teddy Teddy Astie | Vates XCP-ng Developer XCP-ng & Xen Orchestra - Vates solutions web: https://vates.tech

Re: [PATCH v5 2/4] hvmloader: fix SMBIOS table length checks

2025-08-23 Thread Teddy Astie
uint8_t board_type; /* Optional */ > +uint8_t contained_handle_count; /* Optional */ > +uint16_t contained_handles[]; /* Optional */ > } __attribute__ ((packed)); > > /* System Enclosure - Contained Elements */ > @@ -118,12 +118,12 @@ struct smbios_typ

Re: [PATCH v1] tools: make "opengl" generic

2025-08-22 Thread Teddy Astie
omain_config > *d_config, FILE *fh) > fprintf(fh, "\t\t\t(sdl %s)\n", > libxl_defbool_to_string(b_info->u.hvm.sdl.enable)); > fprintf(fh, "\t\t\t(opengl %s)\n", > - libxl_defbool_to_string(b_info->u.hvm.sdl.opengl)); > + libxl_defbool_to_string(b_info->u.hvm.opengl)); > fprintf(fh, "\t\t\t(nographic %s)\n", > libxl_defbool_to_string(b_info->u.hvm.nographic)); > fprintf(fh, "\t\t\t(spice %s)\n", > @@ -219,10 +219,10 @@ void printf_info_sexp(int domid, libxl_domain_config > *d_config, FILE *fh) > fprintf(fh, "\t\t\t(vncunused %s)\n", > libxl_defbool_to_string(d_config->vfbs[i].vnc.findunused)); > fprintf(fh, "\t\t\t(keymap %s)\n", d_config->vfbs[i].keymap); > +fprintf(fh, "\t\t\t(opengl %s)\n", > + libxl_defbool_to_string(d_config->vfbs[i].opengl)); > fprintf(fh, "\t\t\t(sdl %s)\n", > libxl_defbool_to_string(d_config->vfbs[i].sdl.enable)); > -fprintf(fh, "\t\t\t(opengl %s)\n", > - libxl_defbool_to_string(d_config->vfbs[i].sdl.opengl)); > fprintf(fh, "\t\t\t(display %s)\n", d_config->vfbs[i].sdl.display); > fprintf(fh, "\t\t\t(xauthority %s)\n", > d_config->vfbs[i].sdl.xauthority); > fprintf(fh, "\t\t)\n"); Teddy Astie | Vates XCP-ng Developer XCP-ng & Xen Orchestra - Vates solutions web: https://vates.tech

[PATCH] hvmloader: Update to SMBIOS 2.6

2025-08-22 Thread Teddy Astie
eb7 This patch updates the SMBIOS version from 2.4 to 2.6 and fixup the UUID written in the table; which effectively fix this endianness mismatch with OVMF; while the UUID displayed by Linux is still the same for SeaBIOS. Signed-off-by: Teddy Astie --- This effectively changes the UUID seen with U

[RFC PATCH 1/9] x86/hvm: Use direct structures instead of guest handles

2025-08-21 Thread Teddy Astie
Make these functions work with hypervisor-owned pointer rather than guest handles, so the function parameters don't have to live in guest memory. No functional changes intended. Signed-off-by: Teddy Astie --- xen/arch/x86/hvm/hvm.c | 126 +++-- 1

[PATCH 8/9] RFC: hvm: Introduce XEN_HVM_MEMMAP_TYPE_HOTPLUG_ZONE

2025-08-21 Thread Teddy Astie
Allow specifying in memory map a region which can be hotplugged. This will be used by a future memory hotplug feature. Signed-off-by: Teddy Astie --- xen/include/public/arch-x86/hvm/start_info.h | 1 + 1 file changed, 1 insertion(+) diff --git a/xen/include/public/arch-x86/hvm/start_info.h b

[RFC PATCH 4/9] hvm: Introduce "fixed memory layout" feature

2025-08-21 Thread Teddy Astie
feature is useful to allow having a working guest without having to expose to it physmap manipulation. [1] https://lore.kernel.org/xen-devel/20250610162930.89055-1-roger@citrix.com/ Signed-off-by: Teddy Astie --- .../x86/fixed-memory-layout.pandoc| 24 ++ docs/guest-guide/x86

[RFC PATCH 7/9] x86/hvm: Introduce FastABI implementation

2025-08-21 Thread Teddy Astie
Implement FastABI basing on docs/guest-guide/x86/fastabi.pandoc and defined ABI. Signed-off-by: Teddy Astie --- xen/arch/x86/cpuid.c | 3 + xen/arch/x86/domain.c | 71 ++ xen/arch/x86/hvm/hvm.c | 81 +++- xen/arch/x86/hvm/hypercall.c

[RFC PATCH 9/9] tools: Introduce abi-tool

2025-08-21 Thread Teddy Astie
abi-tool is a small Rust tool that is able to parse ABI yaml files and generate C stubs for performing hypercalls. Signed-off-by: Teddy Astie --- Usage : ./abi-tool < abi.yaml > abi.h --- xen/tools/abi-tool/.gitignore| 1 + xen/tools/abi-tool/Cargo.lock

[RFC PATCH 2/9] common: Isolate XENVER_get_features into a separate function

2025-08-21 Thread Teddy Astie
Make do_xen_version more readable by moving the main XENVER_get_features into a separate function. No functional changes intended. Signed-off-by: Teddy Astie --- xen/common/kernel.c | 84 + 1 file changed, 46 insertions(+), 38 deletions(-) diff

[RFC PATCH 3/9] common/grant_table: Use direct structures instead of guest handles

2025-08-21 Thread Teddy Astie
Make these functions work with hypervisor-owned pointer rather than guest handles, so the function parameters don't have to live in guest memory. No functional changes. Signed-off-by: Teddy Astie --- xen/common/grant_table.c | 68 +++- 1 file change

[RFC PATCH 5/9] docs/x86: Introduce FastABI

2025-08-21 Thread Teddy Astie
tions. Signed-off-by: Teddy Astie --- docs/guest-guide/x86/fastabi.pandoc | 50 ++ docs/guest-guide/x86/index.rst | 1 + xen/abi/event_channel.yml | 130 ++ xen/abi/grant_table.yml | 46 + xen/abi/hvm.yml

[RFC PATCH 6/9] sched: Extract do_poll main logic into vcpu_poll

2025-08-21 Thread Teddy Astie
do_poll takes sched_poll* as parameter, but that's actually in guest memory (so it's more a guest handle). Split its copy from/to guest logic from the main logic, so that we have a separate vcpu_poll which takes the sched_poll parameters directly. Signed-off-by: Teddy Astie --- xen/co

[RFC PATCH 8/9] hvm: Introduce XEN_HVM_MEMMAP_TYPE_HOTPLUG_ZONE

2025-08-21 Thread Teddy Astie
Allow specifying in memory map a region which can be hotplugged. This will be used by a future memory hotplug feature. Signed-off-by: Teddy Astie --- xen/include/public/arch-x86/hvm/start_info.h | 1 + 1 file changed, 1 insertion(+) diff --git a/xen/include/public/arch-x86/hvm/start_info.h b

[RFC PATCH 0/9] x86/hvm: New Xen HVM ABI proposal ("HVMv2" part 1)

2025-08-21 Thread Teddy Astie
me example generated headers in Linux SEV WIP branch [1]. [1] https://github.com/xcp-ng/linux/tree/xen-sev-6.14/include/xen/interface/fastabi Teddy Astie (9): x86/hvm: Use direct structures instead of guest handles common: Isolate XENVER_get_features into a separate function common/grant_table:

Re: [PATCH] misra: address Rule 11.1 violation in cmpxchgptr()

2025-08-13 Thread Teddy Astie
tore it. > - Tagged as `safe` for ECLAIR. Here, we are constructing a function pointer from a unsigned long. I assume this rule goes the other way it says, and allow converting a unsigned long into a function pointer as long as its value is a valid function pointer. Teddy Teddy Astie | Vates XCP-ng Developer XCP-ng & Xen Orchestra - Vates solutions web: https://vates.tech

Re: [RFC PATCH] misra: allow conversion from unsigned long to function pointer

2025-08-13 Thread Teddy Astie
o_maddr(relocate_xen); > relocate_xen_fn *fn = (relocate_xen_fn *)id_addr; > lpae_t pte; > +BUILD_BUG_ON(sizeof(unsigned long) < sizeof(fn)); > > /* Enable the identity mapping in the boot page tables */ > update_identity_mapping(true); > @@ -178,6 +179,7 @@ void __init switch_ttbr(uint64_t ttbr) > vaddr_t id_addr = virt_to_maddr(switch_ttbr_id); > switch_ttbr_fn *fn = (switch_ttbr_fn *)id_addr; > lpae_t pte; > +BUILD_BUG_ON(sizeof(unsigned long) < sizeof(fn)); > > /* Enable the identity mapping in the boot page tables */ > update_identity_mapping(true); Teddy Astie | Vates XCP-ng Developer XCP-ng & Xen Orchestra - Vates solutions web: https://vates.tech

[PATCH] libxl: Add virtio (virtio-vga) display support

2025-08-13 Thread Teddy Astie
Add "virtio" vga which uses the virtio-vga device provided by upstream QEMU. It is VGA compatible and can be enlightened with virtio-gpu drivers which are available since Linux 4.4 and as a part of KVM Windows drivers. Signed-off-by: Teddy Astie --- CHANGELOG.md |

Re: [RFC PATCH v3 1/3] vmx: Rewrite vpid_sync_vcpu_gva

2025-07-31 Thread Teddy Astie
Le 31/07/2025 à 17:54, Jan Beulich a écrit : > On 26.06.2025 16:01, Teddy Astie wrote: >> Rewrite this function such as it doesn't rely on goto, also change the >> type of "type" to match the __invvpid function call. > > While this type change is probably

Re: [XEN][PATCH 2/7] xen/domctl: introduce XEN_DOMCTL_CDF_is_32bits

2025-07-31 Thread Teddy Astie
... } ``` As there could be cases of limited backward compatibility, or multiple diverging subarchs variants. Teddy Teddy Astie | Vates XCP-ng Developer XCP-ng & Xen Orchestra - Vates solutions web: https://vates.tech

Re: [PATCH] x86/vmx: Avoid pausing on HVM_PARAM_IDENT_PT in additional cases

2025-07-30 Thread Teddy Astie
Le 30/07/2025 à 18:40, Teddy Astie a écrit : > When settings HVM_PARAM_IDENT_PT, skip domain pausing when : > - there is no vcpu > - unrestricted guest capability is used > > Signed-off-by: Teddy Astie > --- > xen/arch/x86/hvm/hvm.c | 4 +++- > 1 file changed, 3 i

[PATCH] x86/vmx: Avoid pausing on HVM_PARAM_IDENT_PT in additional cases

2025-07-30 Thread Teddy Astie
When settings HVM_PARAM_IDENT_PT, skip domain pausing when : - there is no vcpu - unrestricted guest capability is used Signed-off-by: Teddy Astie --- xen/arch/x86/hvm/hvm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c

Re: [PATCH v1 4/6] vpci: add SR-IOV support for PVH Dom0

2025-07-25 Thread Teddy Astie
drivers/vpci/vpci.c > index 09988f04c2..7af6651831 100644 > --- a/xen/drivers/vpci/vpci.c > +++ b/xen/drivers/vpci/vpci.c > @@ -120,6 +120,7 @@ void vpci_deassign_device(struct pci_dev *pdev) > for ( i = 0; i < ARRAY_SIZE(pdev->vpci->header.bars); i++ ) > rangeset_destroy(pdev->vpci->header.bars[i].mem); > > +xfree(pdev->vpci->sriov); > xfree(pdev->vpci->msix); > xfree(pdev->vpci->msi); > xfree(pdev->vpci); > diff --git a/xen/include/xen/vpci.h b/xen/include/xen/vpci.h > index 06f7039f20..9e8dcab17e 100644 > --- a/xen/include/xen/vpci.h > +++ b/xen/include/xen/vpci.h > @@ -138,7 +138,6 @@ struct vpci { >* upon to know whether BARs are mapped into the guest p2m. >*/ > bool bars_mapped : 1; > -/* FIXME: currently there's no support for SR-IOV. */ > } header; > > /* MSI data. */ > @@ -192,6 +191,12 @@ struct vpci { > struct vpci_arch_msix_entry arch; > } entries[]; > } *msix; > + > +struct vpci_sriov { > +/* PF only */ > +struct vpci_bar vf_bars[PCI_SRIOV_NUM_BARS]; > +} *sriov; > + > #ifdef CONFIG_HAS_VPCI_GUEST_SUPPORT > /* Guest SBDF of the device. */ > #define INVALID_GUEST_SBDF ((pci_sbdf_t){ .sbdf = ~0U }) Teddy Astie | Vates XCP-ng Developer XCP-ng & Xen Orchestra - Vates solutions web: https://vates.tech

Re: [PATCH v1 3/6] vpci: rename and export vpci_bar_add_rangeset

2025-07-25 Thread Teddy Astie
pci_ecam_read(pci_sbdf_t sbdf, unsigned int reg, > unsigned int len, > > /* Map/unmap the BARs of a vPCI device. */ > int vpci_modify_bars(const struct pci_dev *pdev, uint16_t cmd, bool > rom_only); > +int vpci_bar_add_rangeset(const struct pci_dev *pdev, struct vpci_bar *bar

Re: [PATCH v1 2/6] vpci: rename and export vpci_guest_mem_bar_{read,write}

2025-07-25 Thread Teddy Astie
Le 25/07/2025 à 16:26, Mykyta Poturai a écrit : > From: Stewart Hildebrand > > Export functions required for SR-IOV support. > > Signed-off-by: Stewart Hildebrand > Signed-off-by: Mykyta Poturai Reviewed-by: Teddy Astie Thanks Teddy Astie | Vates XCP-ng Developer XCP-

Re: [PATCH v1 1/6] vpci: rename and export vpci_modify_bars

2025-07-25 Thread Teddy Astie
Le 25/07/2025 à 16:26, Mykyta Poturai a écrit : > From: Stewart Hildebrand > > Export functions required for SR-IOV support. > > Signed-off-by: Stewart Hildebrand > Signed-off-by: Mykyta Poturai Reviewed-by: Teddy Astie Thanks Teddy Astie | Vates XCP-ng Developer XCP-

[PATCH] xen: Rename xenmem_reservation_increase to xenmem_populate_physmap

2025-07-25 Thread Teddy Astie
xenmem_reservation_increase currently calls XENMEM_populate_physmap. Rename the function to avoid confusion with XENMEM_increase_reservation. Signed-off-by: Teddy Astie --- Cc: Juergen Gross Cc: Stefano Stabellini Cc: Oleksandr Tyshchenko --- drivers/xen/balloon.c | 2 +- drivers/xen

Re: [PATCH v2] x86/hvm: Replace do_sched_op calls with their underlying logic

2025-07-23 Thread Teddy Astie
Le 23/07/2025 à 13:16, Andrew Cooper a écrit : > On 23/07/2025 10:05 am, Teddy Astie wrote: >> do_sched_op(SCHEDOP_yield) just calls vcpu_yield(). Remove the indirection >> through the hypercall handler and use the function directly. >> >> Perform the same for SCHEDOP_bl

[PATCH v2] x86/hvm: Replace do_sched_op calls with their underlying logic

2025-07-23 Thread Teddy Astie
do_sched_op(SCHEDOP_yield) just calls vcpu_yield(). Remove the indirection through the hypercall handler and use the function directly. Perform the same for SCHEDOP_block. Not a functional change. Signed-off-by: Teddy Astie --- v2: - For SCHEDOP_block case: export and use

[PATCH] x86/hvm: Replace do_sched_op calls with their underlying logic

2025-07-22 Thread Teddy Astie
do_sched_op(SCHEDOP_yield) just calls vcpu_yield(). Remove the indirection through the hypercall handler and use the function directly. Perform the same for SCHEDOP_block. Not a functional change. Signed-off-by: Teddy Astie --- xen/arch/x86/hvm/hvm.c | 3 ++- xen/arch/x86/hvm

[PATCH] x86/svm: Always flush TLB using TLB_CTRL_FLUSH_ALL

2025-07-22 Thread Teddy Astie
ven when flush-by-asid is available. Fixes: 64b1da5a2fcf ("x86/svm: Use flush-by-asid when available") Signed-off-by: Teddy Astie Reviewed-by: Jan Beulich --- This patch has been sent first at the security mailing list (secur...@xenproject.org) which asked me to publish it public

Re: [PATCH v8] xen/console: introduce domain_console struct

2025-07-16 Thread Teddy Astie
t; No functional change. > > Signed-off-by: Denis Mukhin Reviewed-by: Teddy Astie > --- > Changes since v7: > - use ARRAY_SIZE() for cons->buf checks > - update the commit message > --- > xen/arch/arm/vpl011.c | 2 +- > xen/arch/x86/hvm/hvm.c

Re: [PATCH] xen/netfront: Fix TX response spurious interrupts

2025-07-11 Thread Teddy Astie
(struct sk_buff *skb, > struct net_device *dev > tx_stats->packets++; > u64_stats_update_end(&tx_stats->syncp); > > - /* Note: It is not safe to access skb after xennet_tx_buf_gc()! */ > - xennet_tx_buf_gc(queue); > - > if (!netfront_tx_slot_available(q

[PATCH 5.15.y v3] xen: replace xen_remap() with memremap()

2025-07-04 Thread Teddy Astie
ff-by: Teddy Astie [backport to 5.15.y] --- v3: - add missing hvc_xen.c change v2: - also remove xen_remap/xen_unmap on ARM --- arch/x86/include/asm/xen/page.h | 3 --- drivers/tty/hvc/hvc_xen.c | 2 +- drivers/xen/grant-table.c | 6 +++--- drivers/xen/xenbus/xenbus_probe.

[PATCH 5.15.y v2] xen: replace xen_remap() with memremap()

2025-07-02 Thread Teddy Astie
ff-by: Teddy Astie [backport to 5.15.y] --- v2: - also remove xen_remap/xen_unmap on ARM --- arch/x86/include/asm/xen/page.h | 3 --- drivers/xen/grant-table.c | 6 +++--- drivers/xen/xenbus/xenbus_probe.c | 3 +-- include/xen/arm/page.h| 3 --- 4 files changed, 4 insertions(+

[PATCH 5.15.y] xen: replace xen_remap() with memremap()

2025-07-02 Thread Teddy Astie
ff-by: Teddy Astie [backport to 5.15.y] --- arch/x86/include/asm/xen/page.h | 3 --- drivers/xen/grant-table.c | 6 +++--- drivers/xen/xenbus/xenbus_probe.c | 3 +-- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/arch/x86/include/asm/xen/page.h b/arch/x86/include/asm/xen/p

[RFC PATCH v3 0/3] x86/hvm: Introduce Xen-wide ASID allocator

2025-06-26 Thread Teddy Astie
sh-by-asid tlb_control on AMD). Changes were tested on Intel Haswell, KVM AMD virtual machine and AMD EPYC Genoa. Teddy Astie (3): vmx: Rewrite vpid_sync_vcpu_gva vmx: Introduce vcpu single context VPID invalidation x86/hvm: Introduce Xen-wide ASID allocator xen/arch/x86/flushtlb.c

[RFC PATCH v3 1/3] vmx: Rewrite vpid_sync_vcpu_gva

2025-06-26 Thread Teddy Astie
Rewrite this function such as it doesn't rely on goto, also change the type of "type" to match the __invvpid function call. Suggested-by: Jan Beulich Signed-off-by: Teddy Astie --- xen/arch/x86/include/asm/hvm/vmx/vmx.h | 29 +- 1 file changed, 10 in

[RFC PATCH v3 3/3] x86/hvm: Introduce Xen-wide ASID allocator

2025-06-26 Thread Teddy Astie
e TLB invalidations. Introduce vcpu->needs_tlb_flush attribute to schedule a guest TLB flush for the next VMRUN/VMENTER. This will be later be done using either TLB_CONTROL field (AMD) or INVEPT (Intel). This flush method is used in place of the current ASID swapping logic. Signed-off-by: Teddy Astie Si

[RFC PATCH v3 2/3] vmx: Introduce vcpu single context VPID invalidation

2025-06-26 Thread Teddy Astie
Introduce vpid_sync_vcpu_context to do a single-context invalidation on the vpid attached to the vcpu as a alternative to per-gva and all-context invlidations. Signed-off-by: Teddy Astie --- xen/arch/x86/include/asm/hvm/vmx/vmx.h | 13 + 1 file changed, 13 insertions(+) diff --git

Re: [PATCH v2 03/17] xen/riscv: introduce guest domain's VMID allocation and manegement

2025-06-26 Thread Teddy Astie
.e systematically flush the guest TLB before entering the vcpu and using a "blank" VMID) I don't expect a lot of platforms to allow for 32 pCPU while not giving more than 16 VMID values. So it would just be less efficient in that case at worst. Teddy Teddy Astie | Vates XCP-ng Developer XCP-ng & Xen Orchestra - Vates solutions web: https://vates.tech

Re: xenstore - Suggestion of batching watch events

2025-06-24 Thread Teddy Astie
el) In userland, this could take the form as xenstored pushing multiples messages through a single send(), so the client would be able to perform all the recv() at once. > Is this beyond the scope of what xenstored wants to do? From a first > glance, > this does not seem to introduce obvious

Re: [RFC] Proposed x86 shadow paging changes

2025-06-12 Thread Teddy Astie
Le 12/06/2025 à 14:12, Jan Beulich a écrit : > On 12.06.2025 13:45, Teddy Astie wrote: >> In Xen x86, there is the shadow paging that could be used in some cases >> (notably with HVM), and is used when HAP is not available. It may also >> be used in very specific cases for

Re: [PATCH] docs: UEFI Secure Boot security policy

2025-06-12 Thread Teddy Astie
the current plan of hardening the privcmd device is going to be very hard for sure. dom0-iommu=strict is a good mitigations in case untrusted parties of the dom0 get direct access to a devices. However, as it is now, it implies a IOTLB flush for each grant mapping done, which severely impede PV p

[RFC] Proposed x86 shadow paging changes

2025-06-12 Thread Teddy Astie
Hello, In Xen x86, there is the shadow paging that could be used in some cases (notably with HVM), and is used when HAP is not available. It may also be used in very specific cases for PV guests. With the vast majority of hardware supporting HAP (through EPT or NPT), it's rarely used in practi

Re: [PATCH v6] xen/domain: rewrite emulation_flags_ok()

2025-06-10 Thread Teddy Astie
Hello, Le 10/06/2025 à 02:45, dm...@proton.me a écrit : > From: Denis Mukhin > > Rewrite emulation_flags_ok() to simplify future modifications. > > No functional change intended. > > Signed-off-by: Denis Mukhin Reviewed-by: Teddy Astie > --- > Changes since

Re: [PATCH v1] xen/console: group pbuf under console field

2025-06-06 Thread Teddy Astie
); > diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h > index fe53d4fab7..637aa09ec4 100644 > --- a/xen/include/xen/sched.h > +++ b/xen/include/xen/sched.h > @@ -562,12 +562,6 @@ struct domain > /* Control-plane tools handle for this domain. */ > xen_domain_handle_

Re: [PATCH v5 3/6] x86: re-work memcpy()

2025-06-06 Thread Teddy Astie
Le 06/06/2025 à 11:13, Jan Beulich a écrit : > On 05.06.2025 19:06, Teddy Astie wrote: >> Le 05/06/2025 à 12:27, Jan Beulich a écrit : >>> Move the function to its own assembly file. Having it in C just for the >>> entire body to be an asm() isn't really helpf

Re: [PATCH v5 4/6] x86: control memset() and memcpy() inlining

2025-06-06 Thread Teddy Astie
Le 06/06/2025 à 11:21, Jan Beulich a écrit : > On 05.06.2025 19:34, Teddy Astie wrote: >> Le 05/06/2025 à 12:28, Jan Beulich a écrit : >>> Stop the compiler from inlining non-trivial memset() and memcpy() (for >>> memset() see e.g. map_vcpu_info() or kimage_load_segment

Re: [PATCH v5 4/6] x86: control memset() and memcpy() inlining

2025-06-05 Thread Teddy Astie
:noalign) > + > ifeq ($(CONFIG_UBSAN),y) > # Don't enable alignment sanitisation. x86 has efficient unaligned > accesses, > # and various things (ACPI tables, hypercall pages, stubs, etc) are > wont-fix. > > Teddy Teddy Astie | Vates XCP-ng Developer XCP-ng & Xen Orchestra - Vates solutions web: https://vates.tech

Re: [PATCH v5 3/6] x86: re-work memcpy()

2025-06-05 Thread Teddy Astie
" rep ; movs"__OS" ; " > -" mov %k4,%k3 ; " > -" rep ; movsb" > -: "=&c" (d0), "=&D" (d1), "=&S" (d2) > -: "0" (n/BYTES_PER_LONG), "r" (n%BYTES_PER_LONG), "1" (dest), "2" > (src) > -: "memory" ); > - > -return dest; > -} > - > void *(memmove)(void *dest, const void *src, size_t n) > { > long d0, d1, d2; > > Aside that: Reviewed-by: Teddy Astie Teddy Teddy Astie | Vates XCP-ng Developer XCP-ng & Xen Orchestra - Vates solutions web: https://vates.tech

Re: [PATCH v5 2/6] x86: re-work memset()

2025-06-05 Thread Teddy Astie
6/string.c > @@ -22,19 +22,6 @@ void *(memcpy)(void *dest, const void *s > return dest; > } > > -void *(memset)(void *s, int c, size_t n) > -{ > -long d0, d1; > - > -asm volatile ( > -"rep stosb" > -: "=&c" (d0), "=&D" (d1) > -: "a" (c), "1" (s), "0" (n) > -: "memory"); > - > -return s; > -} > - > void *(memmove)(void *dest, const void *src, size_t n) > { > long d0, d1, d2; > > Teddy Teddy Astie | Vates XCP-ng Developer XCP-ng & Xen Orchestra - Vates solutions web: https://vates.tech

Re: [PATCH] vmx: Introduce vcpu single context VPID invalidation

2025-06-05 Thread Teddy Astie
Le 05/06/2025 à 16:51, Jan Beulich a écrit : > On 30.05.2025 10:48, Teddy Astie wrote: >> Introduce vpid_sync_vcpu_context to do a single-context invalidation >> on the vpid attached to the vcpu as a alternative to per-gva and all-contexts >> invlidations. >> &g

Re: [PATCH v4 2/2] xen/domain: rewrite emulation_flags_ok()

2025-05-30 Thread Teddy Astie
gt; +.opt= X86_EMU_USE_PIRQ, > +}, > + > +/* PVH */ And this one being PVH domU. > +{ > +.caps = CAP_HVM | CAP_DOMU, > +.min= X86_EMU_LAPIC, > + .opt= 0, > + }, With that Reviewed-by: Teddy Astie Teddy T

[PATCH] vmx: Introduce vcpu single context VPID invalidation

2025-05-30 Thread Teddy Astie
Introduce vpid_sync_vcpu_context to do a single-context invalidation on the vpid attached to the vcpu as a alternative to per-gva and all-contexts invlidations. Signed-off-by: Teddy Astie --- Extracted from SEV series. This will be used for instance in fixed-ASID patches (in SEV series

[PATCH] x86/svm: Move svm_domain structure to svm.h

2025-05-30 Thread Teddy Astie
struct svm_domain was in vmcb.h which is meant for VMCB specific operations and constants, move it to svm.h where it belongs. Signed-off-by: Teddy Astie --- xen/arch/x86/include/asm/hvm/domain.h | 1 + xen/arch/x86/include/asm/hvm/svm/svm.h | 11 +++ xen/arch/x86/include/asm/hvm/svm

Re: [PATCH v3 1/3] docs: add documentation for Argo as a feature

2025-05-29 Thread Teddy Astie
> +See the ARGO section of the Xen MAINTAINERS document for web reference. > + > +# History > + > + > +Date Revision Version Notes > +-- - -- > +2025-05-28 1Xen 4.12+ Feature included in Xen 4.12. > +-- - -- Teddy Teddy Astie | Vates XCP-ng Developer XCP-ng & Xen Orchestra - Vates solutions web: https://vates.tech

[PATCH] iommu/amd: Remove dead non-atomic update checking

2025-05-22 Thread Teddy Astie
xen-project/xen/-/commit/3fc44151d83d3d63320036bcf06634dfbebe1ff3 Signed-off-by: Teddy Astie --- xen/drivers/passthrough/amd/iommu_map.c | 4 +--- xen/drivers/passthrough/amd/pci_amd_iommu.c | 18 -- 2 files changed, 1 insertion(+), 21 deletions(-) diff --git a/xen/driv

Re: [PATCH v2 04/16] xen/riscv: add ioremap_*() variants using ioremap_attr()

2025-05-19 Thread Teddy Astie
return ioremap_attr(start, len, PAGE_HYPERVISOR_WC); > +} > + > +void *ioremap(paddr_t pa, size_t len) also here > +{ > +return ioremap_attr(pa, len, PAGE_HYPERVISOR_NOCACHE); > +} Teddy Teddy Astie | Vates XCP-ng Developer XCP-ng & Xen Orchestra - Vates solutions web: https://vates.tech

[RFC PATCH] xen: Introduce extra IRQ count domain creation parameter

2025-05-16 Thread Teddy Astie
When doing PCI Passthrough with high-IRQ devices (e.g NVMe drives), the default limit may be unefficient as not all domains requires more IRQs. Introduce a new parameter to allow the toolstack to tune the IRQ count if more is required. Signed-off-by: Teddy Astie --- 0 extra_irqs is meaningful

Re: [RFC PATCH 00/16] Confidential computing and AMD SEV support

2025-05-16 Thread Teddy Astie
Le 16/05/2025 à 12:54, Jürgen Groß a écrit : > On 16.05.25 11:31, Teddy Astie wrote: >> >> In order to create a confidential computing domain, the process is >> follow : >>   - create a HVM/PVH domain with XEN_DOMCTL_CDF_coco >>   - populate ini

[RFC PATCH 16/16] HACK: Add sev_console hypercall

2025-05-16 Thread Teddy Astie
Introduce a basic console hypercall for debugging needs under SEV when PV console is not usable at this point. This is later on used by the earlyprintk of the experimental SEV Linux branch. Signed-off-by: Teddy Astie --- xen/common/coco.c| 6 ++ xen/include/hypercall-defs.c | 2

[RFC PATCH 13/16] x86/coco: Introduce AMD-SEV support

2025-05-16 Thread Teddy Astie
From: Andrei Semenov AMD-SEV is AMD implementation for confidential computing. This patch introduces SEV initialization and HVM enablement logic. Signed-off-by: Andrei Semenov Signed-off-by: Teddy Astie --- Some possible improvement would be to slightly change the ASID allocation logic under

[RFC PATCH 11/16] x86/svm: Introduce NPCTRL VMCB bits

2025-05-16 Thread Teddy Astie
Those bits are used to enable SEV-related features in VMCB. Signed-off-by: Andrei Semenov Signed-off-by: Teddy Astie --- xen/arch/x86/include/asm/hvm/svm/vmcb.h | 11 +++ 1 file changed, 11 insertions(+) diff --git a/xen/arch/x86/include/asm/hvm/svm/vmcb.h b/xen/arch/x86/include/asm

[RFC PATCH 12/16] x86/cpufeature: Introduce SME and SEV-related CPU features

2025-05-16 Thread Teddy Astie
Signed-off-by: Teddy Astie --- xen/arch/x86/cpu/common.c | 2 ++ xen/arch/x86/include/asm/cpufeature.h | 4 xen/include/public/arch-x86/cpufeatureset.h | 5 + xen/include/xen/lib/x86/cpu-policy.h| 9 - 4 files changed, 19 insertions(+), 1 deletion

[RFC PATCH 15/16] HACK: coco: Leak ASID for coco guests

2025-05-16 Thread Teddy Astie
In order to reuse a ASID in a SEV guest, we need to perform a WBINVD on all pCPUs that ran the guest, then a DF_FLUSH on the PSP. Just leak the ASID for now. Signed-off-by: Teddy Astie --- xen/arch/x86/hvm/hvm.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/xen/arch

[RFC PATCH 10/16] xl/coco: Introduce confidential computing support

2025-05-16 Thread Teddy Astie
From: Vaishali Thakkar Signed-off-by: Vaishali Thakkar Signed-off-by: Teddy Astie --- tools/include/libxl.h| 5 tools/include/xenctrl.h | 4 tools/include/xenguest.h | 1 + tools/libs/ctrl/xc_domain.c | 36 + tools

[RFC PATCH 14/16] sev/emulate: Handle some non-emulable HVM paths

2025-05-16 Thread Teddy Astie
From: Andrei Semenov Some code paths are not emulable under SEV or needs special handling. Signed-off-by: Andrei Semenov Signed-off-by: Teddy Astie --- xen/arch/x86/hvm/emulate.c | 137 - xen/arch/x86/hvm/hvm.c | 13 2 files changed, 133

[RFC PATCH 08/16] x86/crypto: Introduce AMD PSP driver for SEV

2025-05-16 Thread Teddy Astie
From: Andrei Semenov Introduce a basic PSP driver with focus on SEV commands. Signed-off-by: Andrei Semenov Signed-off-by: Teddy Astie --- xen/arch/x86/include/asm/psp-sev.h | 655 +++ xen/drivers/Kconfig| 2 + xen/drivers/Makefile | 1

[RFC PATCH 09/16] common: Introduce confidential computing infrastructure

2025-05-16 Thread Teddy Astie
guest. Signed-off-by: Teddy Astie --- xen/arch/x86/domain.c | 4 + xen/arch/x86/hvm/hvm.c| 10 ++- xen/common/Kconfig| 5 ++ xen/common/Makefile | 1 + xen/common/coco.c | 134 ++ xen/common/domain.c

[RFC PATCH 07/16] x86/hvm: Introduce Xen-wide ASID allocator

2025-05-16 Thread Teddy Astie
vcpu->needs_tlb_flush attribute to schedule a guest TLB flush for the next VMRUN/VMENTER. This will be later be done using either TLB_CONTROL field (AMD) or INVEPT (Intel). This flush method is used in place of the current ASID swapping logic. Signed-off-by: Teddy Astie Signed-off-by: Vaishali

[RFC PATCH 04/16] x86/public: Expose physaddr_abi through Xen HVM CPUID leaf

2025-05-16 Thread Teddy Astie
Signed-off-by: Teddy Astie --- xen/arch/x86/cpuid.c| 2 ++ xen/include/public/arch-x86/cpuid.h | 2 ++ 2 files changed, 4 insertions(+) diff --git a/xen/arch/x86/cpuid.c b/xen/arch/x86/cpuid.c index 8dc68945f7..e2d94619c2 100644 --- a/xen/arch/x86/cpuid.c +++ b/xen/arch/x86

[RFC PATCH 06/16] vmx: Introduce vcpu single context VPID invalidation

2025-05-16 Thread Teddy Astie
Introduce vpid_sync_vcpu_context to do a single-context invalidation on the vpid attached to the vcpu as a alternative to per-gva and all-context invlidations. Signed-off-by: Teddy Astie --- This will be used on Intel platforms for the ASID management rework. --- xen/arch/x86/include/asm/hvm

[RFC PATCH 01/16] x86/msr: Introduce SYSCFG_MEM_ENCRYPT MSR.

2025-05-16 Thread Teddy Astie
OM2_FORCE_WB (_AC(1, ULL) << 22) +#define SYSCFG_MEM_ENCRYPT (_AC(1, ULL) << 23) #define MSR_K8_IORR_BASE0 _AC(0xc0010016, U) #define MSR_K8_IORR_MASK0 _AC(0xc0010017, U) -- 2.49.0 Teddy Astie | Vates XCP-ng

[RFC PATCH 00/16] Confidential computing and AMD SEV support

2025-05-16 Thread Teddy Astie
ith early SEV support (more or less working) https://github.com/xcp-ng/linux/tree/xen-sev-6.6/ https://github.com/xcp-ng/linux/tree/xen-sev-6.14/ Teddy Astie (16): x86/msr: Introduce SYSCFG_MEM_ENCRYPT MSR. x86/svm: Move svm_domain structure to svm.h x86/hvm: Add support for physical address AB

[RFC PATCH 05/16] docs/x86: Document HVM Physical Addresss ABI

2025-05-16 Thread Teddy Astie
Signed-off-by: Teddy Astie --- docs/guest-guide/x86/hypercall-abi.rst | 4 1 file changed, 4 insertions(+) diff --git a/docs/guest-guide/x86/hypercall-abi.rst b/docs/guest-guide/x86/hypercall-abi.rst index e52ed453bc..710a02895b 100644 --- a/docs/guest-guide/x86/hypercall-abi.rst +++ b

[RFC PATCH 02/16] x86/svm: Move svm_domain structure to svm.h

2025-05-16 Thread Teddy Astie
struct svm_domain was in vmcb.h which is meant for VMCB specific operations and values, move it to svm.h where it belongs. Signed-off-by: Teddy Astie --- xen/arch/x86/include/asm/hvm/domain.h | 1 + xen/arch/x86/include/asm/hvm/svm/svm.h | 11 +++ xen/arch/x86/include/asm/hvm/svm

[RFC PATCH 03/16] x86/hvm: Add support for physical address ABI

2025-05-16 Thread Teddy Astie
Guest can tag their hypercalls with 0x4000 in order to use this alternative ABI that uses physical addresses instead of linear ones. Signed-off-by: Teddy Astie --- This one is based on the "HVMv2 ABI" RFC, but reworked in a way that is more compatible with existing guest (guest n

Re: [PATCH v6 1/2] xen/domain: unify domain ID allocation

2025-05-16 Thread Teddy Astie
= rover + 1; dom != rover; dom++ ) > -{ > -if ( dom == DOMID_FIRST_RESERVED ) > -dom = 1; > -if ( is_free_domid(dom) ) > -break; > -} > - > -ret = -ENOMEM; > -if ( dom == rover ) > -break; > - > -rover = dom; > +break; > } > > -d = domain_create(dom, &op->u.createdomain, false); > +d = domain_create(domid, &op->u.createdomain, false); > if ( IS_ERR(d) ) > { > ret = PTR_ERR(d); In case the domain creation failure, we need to free the domid, otherwise, it would not be used anymore as considered used by the domid allocator. > diff --git a/xen/include/xen/domain.h b/xen/include/xen/domain.h > index e10baf2615..039bb7eeaf 100644 > --- a/xen/include/xen/domain.h > +++ b/xen/include/xen/domain.h > @@ -38,6 +38,10 @@ void arch_get_domain_info(const struct domain *d, > > domid_t get_initial_domain_id(void); > > +void domid_init(void); > +void domid_free(domid_t domid); > +domid_t domid_alloc(domid_t domid); > + > /* CDF_* constant. Internal flags for domain creation. */ > /* Is this a privileged domain? */ > #define CDF_privileged (1U << 0) Teddy Teddy Astie | Vates XCP-ng Developer XCP-ng & Xen Orchestra - Vates solutions web: https://vates.tech

  1   2   3   >