From xen-changelog-bounces@lists.xenproject.org Mon Mar 02 16:00:07 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 02 Mar 2026 16:00:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1244439.1543879 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vx5gh-0003VC-Gb; Mon, 02 Mar 2026 16:00:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1244439.1543879; Mon, 02 Mar 2026 16:00:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vx5gh-0003Ur-Dg; Mon, 02 Mar 2026 16:00:03 +0000
Received: by outflank-mailman (input) for mailman id 1244439;
 Mon, 02 Mar 2026 16:00:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vx5gg-0003DS-Df
 for xen-changelog@lists.xenproject.org; Mon, 02 Mar 2026 16:00:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vx5gg-001Z9N-1F
 for xen-changelog@lists.xenproject.org;
 Mon, 02 Mar 2026 16:00:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vx5gg-00CzlP-16
 for xen-changelog@lists.xenproject.org;
 Mon, 02 Mar 2026 16:00:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=8oqnBJ6ikKAnS1YullS/mvy320ju4/kXilzcV1NJiak=; b=t0EJcdgWhsbziTYfcSW180IFLd
	vdZUg0FEz/aQK4lRvwo9RvRMfDQr133csCiO7OQOLrxd34fGc6C7BbqoDi/LC6RWbUXtDMoK87MCb
	usuU2wVPW66PIePFXG8dkKMCtHSI3JgROAcHHiL5SFc041sdiA3P84YZVetwUN47Hl64=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/xl: Fix when config "cpus" is set, but "vcpus" is missing
Message-Id: <E1vx5gg-00CzlP-16@xenbits.xenproject.org>
Date: Mon, 02 Mar 2026 16:00:02 +0000

commit 4b71a86eaa7aa2249d4434c808102f5e301e2c8d
Author:     Anthony PERARD <anthony.perard@vates.tech>
AuthorDate: Wed Dec 17 18:26:33 2025 +0100
Commit:     Anthony PERARD <anthony.perard@vates.tech>
CommitDate: Mon Mar 2 15:39:58 2026 +0100

    tools/xl: Fix when config "cpus" is set, but "vcpus" is missing
    
    If we start a guest with 'cpus="all"' and without 'vcpus' or
    'maxvcpus' (or sets them to 0), we execute parse_vcpu_affinity() with
    `num_cpus=0`. This malloc "b_info->vcpu_hard_affinity" with a buffer
    of size 0, which is implementation defined, and we still initialise
    the "first" bitmap of this allocation, which mean we have a buffer
    overflow.
    
    On Alpine Linux, this result in a segv when the buffer is being
    disposed of.
    
    Since libxl will assume there's at least 1 vcpu, we default to 1 in
    xl as well. (libxl sets max_vcpus to 1 if unset, and allocate
    avail_vcpus if its size is 0.)
    
    Link: https://gitlab.alpinelinux.org/alpine/aports/-/issues/17809
    Fixes: a5dbdcf6743a ("libxl/xl: push VCPU affinity pinning down to libxl")
    Signed-off-by: Anthony PERARD <anthony.perard@vates.tech>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
---
 tools/xl/xl_parse.c | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/tools/xl/xl_parse.c b/tools/xl/xl_parse.c
index af86d3186d..1a2ea8b5d5 100644
--- a/tools/xl/xl_parse.c
+++ b/tools/xl/xl_parse.c
@@ -1518,14 +1518,22 @@ void parse_config_data(const char *config_source,
 
     if (!xlu_cfg_get_long (config, "vcpus", &l, 0)) {
         vcpus = l;
-        if (libxl_cpu_bitmap_alloc(ctx, &b_info->avail_vcpus, l)) {
-            fprintf(stderr, "Unable to allocate cpumap\n");
-            exit(1);
-        }
-        libxl_bitmap_set_none(&b_info->avail_vcpus);
-        while (l-- > 0)
-            libxl_bitmap_set((&b_info->avail_vcpus), l);
     }
+    if (vcpus < 1) {
+        /*
+         * Default to 1 vCPU, libxl is already assuming this
+         * when vcpus == 0 and parse_vcpu_affinity() also assume there's at
+         * least one vcpu.
+         */
+        vcpus = 1;
+    }
+    if (libxl_cpu_bitmap_alloc(ctx, &b_info->avail_vcpus, vcpus)) {
+        fprintf(stderr, "Unable to allocate cpumap\n");
+        exit(1);
+    }
+    libxl_bitmap_set_none(&b_info->avail_vcpus);
+    for (long vcpu = vcpus; vcpu-- > 0;)
+        libxl_bitmap_set((&b_info->avail_vcpus), vcpu);
 
     if (!xlu_cfg_get_long (config, "maxvcpus", &l, 0))
         b_info->max_vcpus = l;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Mar 02 16:00:13 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 02 Mar 2026 16:00:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1244440.1543884 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vx5gr-000455-Hr; Mon, 02 Mar 2026 16:00:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1244440.1543884; Mon, 02 Mar 2026 16:00:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vx5gr-00044x-F5; Mon, 02 Mar 2026 16:00:13 +0000
Received: by outflank-mailman (input) for mailman id 1244440;
 Mon, 02 Mar 2026 16:00:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vx5gq-00044r-Gp
 for xen-changelog@lists.xenproject.org; Mon, 02 Mar 2026 16:00:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vx5gq-001ZOo-1X
 for xen-changelog@lists.xenproject.org;
 Mon, 02 Mar 2026 16:00:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vx5gq-00CzmZ-1Q
 for xen-changelog@lists.xenproject.org;
 Mon, 02 Mar 2026 16:00:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=TWQ5MXCIG5qXpLpOQBwMkzXBNJuHbAv9FBYW0VFSJjo=; b=fZWLKbADHPBJTjiJj4tLhG1v4J
	1cWY6piNL8/Bf4domIOKQq1irhVh5Jf3+NER5hyNZH1HlyKeKcxIR6bU5dqolKBrMjNTvpXIjNKUz
	JWEFhmFfnp4CojadIQDxIV6HrdYg++dMSP5ukFoD5xbH4/yjkGlVBAjrUhxytwSMvMJU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] CI: Remove `brctl` from Arch Linux container
Message-Id: <E1vx5gq-00CzmZ-1Q@xenbits.xenproject.org>
Date: Mon, 02 Mar 2026 16:00:12 +0000

commit 8596535982ea2054f31d6c9a06bb40c44f8eb42d
Author:     Anthony PERARD <anthony.perard@vates.tech>
AuthorDate: Fri Feb 13 11:19:21 2026 +0100
Commit:     Anthony PERARD <anthony.perard@vates.tech>
CommitDate: Mon Mar 2 15:39:58 2026 +0100

    CI: Remove `brctl` from Arch Linux container
    
    Package "bridge-utils" have been removed from the official repos, it
    contained `brctl`. That utility is used by network hotplug scripts,
    but they already check if it is available and switch to use "iproute2"
    (`ip`) when not.
    
    Signed-off-by: Anthony PERARD <anthony.perard@vates.tech>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 automation/build/archlinux/current.dockerfile | 1 -
 1 file changed, 1 deletion(-)

diff --git a/automation/build/archlinux/current.dockerfile b/automation/build/archlinux/current.dockerfile
index 4e53c835fa..a257027772 100644
--- a/automation/build/archlinux/current.dockerfile
+++ b/automation/build/archlinux/current.dockerfile
@@ -6,7 +6,6 @@ LABEL maintainer.name="The Xen Project" \
 RUN pacman-key --init
 
 RUN pacman -S --refresh --sysupgrade --noconfirm --noprogressbar --needed \
-        bridge-utils \
         bzip2 \
         cpio \
         discount \
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Mar 02 16:33:10 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 02 Mar 2026 16:33:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1244462.1543908 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vx6Cd-0000e7-4p; Mon, 02 Mar 2026 16:33:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1244462.1543908; Mon, 02 Mar 2026 16:33:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vx6Cd-0000dz-27; Mon, 02 Mar 2026 16:33:03 +0000
Received: by outflank-mailman (input) for mailman id 1244462;
 Mon, 02 Mar 2026 16:33:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vx6Cb-0000dt-KA
 for xen-changelog@lists.xenproject.org; Mon, 02 Mar 2026 16:33:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vx6Cb-001a2d-1p
 for xen-changelog@lists.xenproject.org;
 Mon, 02 Mar 2026 16:33:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vx6Cb-00D22U-1h
 for xen-changelog@lists.xenproject.org;
 Mon, 02 Mar 2026 16:33:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Z385Xtk5H/jHVSKZ34VgmktAg6L1DvePnuZCRSbbfu4=; b=KTgahwFocr/WnUpgKTwpKvoH7W
	lmQYJz5dORtw0ucXXZM+V+YSJqLU2JjBJVrKotKqrQ5cwefpCtHY58+fQCWgLOSgOuZPdHaVkkOaD
	Dbz38r9U+5bZrNrwiNHLJbGTK9DSDxcrTxwN5AEEtJHd5ElDP2XmOgN8phQRg0y3kL1Q=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/efi: remove unreachable efi_halt_system() function
Message-Id: <E1vx6Cb-00D22U-1h@xenbits.xenproject.org>
Date: Mon, 02 Mar 2026 16:33:01 +0000

commit 0f410b45de689172a2c2928759e305bb79ea1d47
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Tue Feb 24 20:55:19 2026 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Mon Mar 2 17:16:26 2026 +0100

    x86/efi: remove unreachable efi_halt_system() function
    
    After e4c3755d4dd7 the function efi_halt_system() is unreachable, remove it
    from the file.
    
    No functional change expected, as the function is not called.
    
    Fixes: e4c3755d4dd7 ("x86-64/EFI: don't call EfiResetSystem() from machine_halt()")
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
    Acked-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
---
 xen/common/efi/common-stub.c |  1 -
 xen/common/efi/runtime.c     | 13 -------------
 xen/include/xen/efi.h        |  1 -
 3 files changed, 15 deletions(-)

diff --git a/xen/common/efi/common-stub.c b/xen/common/efi/common-stub.c
index 77f138a6c5..9dc8aa538c 100644
--- a/xen/common/efi/common-stub.c
+++ b/xen/common/efi/common-stub.c
@@ -18,7 +18,6 @@ unsigned long efi_get_time(void)
     return 0;
 }
 
-void efi_halt_system(void) { }
 void efi_reset_system(bool warm) { }
 
 int efi_get_info(uint32_t idx, union xenpf_efi_info *info)
diff --git a/xen/common/efi/runtime.c b/xen/common/efi/runtime.c
index f786ceb007..ba27c62132 100644
--- a/xen/common/efi/runtime.c
+++ b/xen/common/efi/runtime.c
@@ -188,19 +188,6 @@ unsigned long efi_get_time(void)
                   time.Hour, time.Minute, time.Second);
 }
 
-void efi_halt_system(void)
-{
-    EFI_STATUS status;
-    struct efi_rs_state state = efi_rs_enter();
-
-    if ( !state.cr3 )
-        return;
-    status = efi_rs->ResetSystem(EfiResetShutdown, EFI_SUCCESS, 0, NULL);
-    efi_rs_leave(&state);
-
-    printk(XENLOG_WARNING "EFI: could not halt system (%#lx)\n", status);
-}
-
 void efi_reset_system(bool warm)
 {
     EFI_STATUS status;
diff --git a/xen/include/xen/efi.h b/xen/include/xen/efi.h
index 723cb80852..2e36b01e20 100644
--- a/xen/include/xen/efi.h
+++ b/xen/include/xen/efi.h
@@ -42,7 +42,6 @@ void efi_init_memory(void);
 bool efi_boot_mem_unused(unsigned long *start, unsigned long *end);
 bool efi_rs_using_pgtables(void);
 unsigned long efi_get_time(void);
-void efi_halt_system(void);
 void efi_reset_system(bool warm);
 #ifndef COMPAT
 int efi_get_info(uint32_t idx, union xenpf_efi_info *info);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Mar 02 16:33:13 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 02 Mar 2026 16:33:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1244463.1543911 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vx6Cn-0000fc-6C; Mon, 02 Mar 2026 16:33:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1244463.1543911; Mon, 02 Mar 2026 16:33:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vx6Cn-0000fU-3V; Mon, 02 Mar 2026 16:33:13 +0000
Received: by outflank-mailman (input) for mailman id 1244463;
 Mon, 02 Mar 2026 16:33:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vx6Cl-0000fK-OI
 for xen-changelog@lists.xenproject.org; Mon, 02 Mar 2026 16:33:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vx6Cl-001a2t-2K
 for xen-changelog@lists.xenproject.org;
 Mon, 02 Mar 2026 16:33:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vx6Cl-00D26P-20
 for xen-changelog@lists.xenproject.org;
 Mon, 02 Mar 2026 16:33:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=r1An5Wo8v9PczOO9X8V6W3iMrhk4wbR3PpgMAQvzjJM=; b=ysziH9B5bNMLuBUatVlyGZQzkm
	63QAojATu5aRrG74LqbS6qFQjQ+3ROnMonvpGIjzRIa3MVwEP+PNWdXmZtWAp5ZcXvwsn+SLdQxzy
	Xua0ELyYS/Du+T6nk/gi225BWZoN9oHAFR/AmPh8KQFvVNE3b7EKTRqU+92BgyfSc/VI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/cpufreq: fix adjusting of sampling window on early exit
Message-Id: <E1vx6Cl-00D26P-20@xenbits.xenproject.org>
Date: Mon, 02 Mar 2026 16:33:11 +0000

commit 74867aae25cb6356b8a7d1140c81666e2a23b818
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Thu Feb 26 18:53:02 2026 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Mon Mar 2 17:16:26 2026 +0100

    xen/cpufreq: fix adjusting of sampling window on early exit
    
    The logic in dbs_check_cpu() resets the sampling window even when the
    sampling period is considered too small.  This leads to further calls
    finding an imbalance between the total window time and the idle time, as
    the total window time is possibly shorter than the idle time.
    
    Fix by resetting the sampling window start time in the same block where the
    current idle time is stored.  While there also prevent a duplicated call to
    NOW() and instead re-use the previously fetched value.
    
    Fixes: d6f001cb91ac ("x86: Implement cpufreq ondemand policy")
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/drivers/cpufreq/cpufreq_ondemand.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/drivers/cpufreq/cpufreq_ondemand.c b/xen/drivers/cpufreq/cpufreq_ondemand.c
index 0126a3f5d9..537695eaab 100644
--- a/xen/drivers/cpufreq/cpufreq_ondemand.c
+++ b/xen/drivers/cpufreq/cpufreq_ondemand.c
@@ -117,11 +117,12 @@ static void dbs_check_cpu(struct cpu_dbs_info_s *this_dbs_info)
 
     cur_ns = NOW();
     total_ns = cur_ns - this_dbs_info->prev_cpu_wall;
-    this_dbs_info->prev_cpu_wall = NOW();
 
     if (total_ns < MIN_DBS_INTERVAL)
         return;
 
+    this_dbs_info->prev_cpu_wall = cur_ns;
+
     /* Get Idle Time */
     for_each_cpu(j, policy->cpus) {
         uint64_t idle_ns, total_idle_ns;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Mar 02 16:33:23 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 02 Mar 2026 16:33:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1244464.1543917 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vx6Cx-0000iQ-7p; Mon, 02 Mar 2026 16:33:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1244464.1543917; Mon, 02 Mar 2026 16:33:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vx6Cx-0000iH-4n; Mon, 02 Mar 2026 16:33:23 +0000
Received: by outflank-mailman (input) for mailman id 1244464;
 Mon, 02 Mar 2026 16:33:21 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vx6Cv-0000iA-R3
 for xen-changelog@lists.xenproject.org; Mon, 02 Mar 2026 16:33:21 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vx6Cv-001a5K-2b
 for xen-changelog@lists.xenproject.org;
 Mon, 02 Mar 2026 16:33:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vx6Cv-00D284-2V
 for xen-changelog@lists.xenproject.org;
 Mon, 02 Mar 2026 16:33:21 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=joDkZeD17Y24hVVm2+25miSOys+gfad+Rx6sluW5ms8=; b=dmK/ZsFi1lQVhwiSKHif/zoBiY
	2zVI9uB8cu+ayvxAkgXLAOZsaGguYhqfVCSmhCPuRuXaLp7e2zYCe/vQH9Gd8UVu2o4t//NCuqa74
	fM6VnqQPG5Ut4pRuunOOYOVLptQGrOg0o/QjmOQYHLNVE0vmHKPoMM8cxycXMMEQl698=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/cpufreq: fix usages of align_timer() in the on-demand governor
Message-Id: <E1vx6Cv-00D284-2V@xenbits.xenproject.org>
Date: Mon, 02 Mar 2026 16:33:21 +0000

commit a0ed5bcfbeee81c91c574ad484faa057054eaf09
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Thu Feb 26 18:54:19 2026 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Mon Mar 2 17:16:26 2026 +0100

    xen/cpufreq: fix usages of align_timer() in the on-demand governor
    
    The first parameter passed to align_timer() is the timer expiration, not
    the current time.  Adjust the calls to align_timer() in the on-demand
    governor to pass the expected timer expiration as the first parameter.
    
    Fixes: af74e3a15a83 ("cpufreq: align dbs timer for better package C state residency")
    Fixes: 382b95f627a9 ("Fix cpufreq HW-ALL coordination handle")
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/drivers/cpufreq/cpufreq_ondemand.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/xen/drivers/cpufreq/cpufreq_ondemand.c b/xen/drivers/cpufreq/cpufreq_ondemand.c
index 537695eaab..0d94c0e464 100644
--- a/xen/drivers/cpufreq/cpufreq_ondemand.c
+++ b/xen/drivers/cpufreq/cpufreq_ondemand.c
@@ -185,7 +185,8 @@ static void cf_check do_dbs_timer(void *dbs)
     dbs_check_cpu(dbs_info);
 
     set_timer(&per_cpu(dbs_timer, dbs_info->cpu),
-            align_timer(NOW() , dbs_tuners_ins.sampling_rate));
+              align_timer(NOW() + dbs_tuners_ins.sampling_rate,
+                          dbs_tuners_ins.sampling_rate));
 }
 
 static void dbs_timer_init(struct cpu_dbs_info_s *dbs_info)
@@ -400,6 +401,6 @@ void cpufreq_dbs_timer_resume(void)
             (void)cmpxchg(stoppable, -1, 1);
         }
         else
-            set_timer(t, align_timer(now, dbs_tuners_ins.sampling_rate));
+            set_timer(t, align_timer(t->expires, dbs_tuners_ins.sampling_rate));
     }
 }
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Mar 02 21:22:13 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 02 Mar 2026 21:22:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1244541.1543983 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxAiJ-0003Ul-GH; Mon, 02 Mar 2026 21:22:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1244541.1543983; Mon, 02 Mar 2026 21:22:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxAiJ-0003Ud-DT; Mon, 02 Mar 2026 21:22:03 +0000
Received: by outflank-mailman (input) for mailman id 1244541;
 Mon, 02 Mar 2026 21:22:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vxAiH-0003UX-TX
 for xen-changelog@lists.xenproject.org; Mon, 02 Mar 2026 21:22:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxAiH-001fw5-2R
 for xen-changelog@lists.xenproject.org;
 Mon, 02 Mar 2026 21:22:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxAiH-00DQw8-2J
 for xen-changelog@lists.xenproject.org;
 Mon, 02 Mar 2026 21:22:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=SHmKbALHzL+mMgB/HPI7W8N0XyLAg58hYJuyYbFobSk=; b=wcxIty973b/CDFYu+4xzu4L2kn
	VUBmsboXrx9yWQXQ3iLJHbhm6GElezVK/Jxooc+naFDQqLSKnotdLIoxmbG0mB+vlnmWqPoQFXdOe
	ruVv/lindExZlvxKqQNvuS79UqI9PkQFMyjJMekEGzkG0oGiVzQOYjkw42Nufc9Xi2W8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/xl: Fix when config "cpus" is set, but "vcpus" is missing
Message-Id: <E1vxAiH-00DQw8-2J@xenbits.xenproject.org>
Date: Mon, 02 Mar 2026 21:22:01 +0000

commit 4b71a86eaa7aa2249d4434c808102f5e301e2c8d
Author:     Anthony PERARD <anthony.perard@vates.tech>
AuthorDate: Wed Dec 17 18:26:33 2025 +0100
Commit:     Anthony PERARD <anthony.perard@vates.tech>
CommitDate: Mon Mar 2 15:39:58 2026 +0100

    tools/xl: Fix when config "cpus" is set, but "vcpus" is missing
    
    If we start a guest with 'cpus="all"' and without 'vcpus' or
    'maxvcpus' (or sets them to 0), we execute parse_vcpu_affinity() with
    `num_cpus=0`. This malloc "b_info->vcpu_hard_affinity" with a buffer
    of size 0, which is implementation defined, and we still initialise
    the "first" bitmap of this allocation, which mean we have a buffer
    overflow.
    
    On Alpine Linux, this result in a segv when the buffer is being
    disposed of.
    
    Since libxl will assume there's at least 1 vcpu, we default to 1 in
    xl as well. (libxl sets max_vcpus to 1 if unset, and allocate
    avail_vcpus if its size is 0.)
    
    Link: https://gitlab.alpinelinux.org/alpine/aports/-/issues/17809
    Fixes: a5dbdcf6743a ("libxl/xl: push VCPU affinity pinning down to libxl")
    Signed-off-by: Anthony PERARD <anthony.perard@vates.tech>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
---
 tools/xl/xl_parse.c | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/tools/xl/xl_parse.c b/tools/xl/xl_parse.c
index af86d3186d..1a2ea8b5d5 100644
--- a/tools/xl/xl_parse.c
+++ b/tools/xl/xl_parse.c
@@ -1518,14 +1518,22 @@ void parse_config_data(const char *config_source,
 
     if (!xlu_cfg_get_long (config, "vcpus", &l, 0)) {
         vcpus = l;
-        if (libxl_cpu_bitmap_alloc(ctx, &b_info->avail_vcpus, l)) {
-            fprintf(stderr, "Unable to allocate cpumap\n");
-            exit(1);
-        }
-        libxl_bitmap_set_none(&b_info->avail_vcpus);
-        while (l-- > 0)
-            libxl_bitmap_set((&b_info->avail_vcpus), l);
     }
+    if (vcpus < 1) {
+        /*
+         * Default to 1 vCPU, libxl is already assuming this
+         * when vcpus == 0 and parse_vcpu_affinity() also assume there's at
+         * least one vcpu.
+         */
+        vcpus = 1;
+    }
+    if (libxl_cpu_bitmap_alloc(ctx, &b_info->avail_vcpus, vcpus)) {
+        fprintf(stderr, "Unable to allocate cpumap\n");
+        exit(1);
+    }
+    libxl_bitmap_set_none(&b_info->avail_vcpus);
+    for (long vcpu = vcpus; vcpu-- > 0;)
+        libxl_bitmap_set((&b_info->avail_vcpus), vcpu);
 
     if (!xlu_cfg_get_long (config, "maxvcpus", &l, 0))
         b_info->max_vcpus = l;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Mar 02 21:22:13 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 02 Mar 2026 21:22:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1244542.1543987 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxAiT-0003WC-Hl; Mon, 02 Mar 2026 21:22:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1244542.1543987; Mon, 02 Mar 2026 21:22:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxAiT-0003W4-Eu; Mon, 02 Mar 2026 21:22:13 +0000
Received: by outflank-mailman (input) for mailman id 1244542;
 Mon, 02 Mar 2026 21:22:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vxAiR-0003Vk-Sc
 for xen-changelog@lists.xenproject.org; Mon, 02 Mar 2026 21:22:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxAiR-001fwA-2j
 for xen-changelog@lists.xenproject.org;
 Mon, 02 Mar 2026 21:22:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxAiR-00DQwr-2c
 for xen-changelog@lists.xenproject.org;
 Mon, 02 Mar 2026 21:22:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=qfqXwbKBLCycCT9JWmxmMcPrn23io4GqgzT546rGWLU=; b=br4xWVp5ugpBWdMLJhZ3NIvf0B
	SvcgOrnENTtupqwE7attxHPcSLf47KMM4pkaJcnThEECQGF4UmZ8QttE5rRer4AyER4f3i84bPTUV
	5PtDGyJQbHgA7G+ggoi98lCzjPxhmylj4lFofF3VK3/I61UuPUZTLCCTioLVgPQntYmw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] CI: Remove `brctl` from Arch Linux container
Message-Id: <E1vxAiR-00DQwr-2c@xenbits.xenproject.org>
Date: Mon, 02 Mar 2026 21:22:11 +0000

commit 8596535982ea2054f31d6c9a06bb40c44f8eb42d
Author:     Anthony PERARD <anthony.perard@vates.tech>
AuthorDate: Fri Feb 13 11:19:21 2026 +0100
Commit:     Anthony PERARD <anthony.perard@vates.tech>
CommitDate: Mon Mar 2 15:39:58 2026 +0100

    CI: Remove `brctl` from Arch Linux container
    
    Package "bridge-utils" have been removed from the official repos, it
    contained `brctl`. That utility is used by network hotplug scripts,
    but they already check if it is available and switch to use "iproute2"
    (`ip`) when not.
    
    Signed-off-by: Anthony PERARD <anthony.perard@vates.tech>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 automation/build/archlinux/current.dockerfile | 1 -
 1 file changed, 1 deletion(-)

diff --git a/automation/build/archlinux/current.dockerfile b/automation/build/archlinux/current.dockerfile
index 4e53c835fa..a257027772 100644
--- a/automation/build/archlinux/current.dockerfile
+++ b/automation/build/archlinux/current.dockerfile
@@ -6,7 +6,6 @@ LABEL maintainer.name="The Xen Project" \
 RUN pacman-key --init
 
 RUN pacman -S --refresh --sysupgrade --noconfirm --noprogressbar --needed \
-        bridge-utils \
         bzip2 \
         cpio \
         discount \
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Mar 02 21:22:23 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 02 Mar 2026 21:22:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1244543.1543990 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxAid-0003Yk-J8; Mon, 02 Mar 2026 21:22:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1244543.1543990; Mon, 02 Mar 2026 21:22:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxAid-0003Yc-GU; Mon, 02 Mar 2026 21:22:23 +0000
Received: by outflank-mailman (input) for mailman id 1244543;
 Mon, 02 Mar 2026 21:22:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vxAib-0003YT-Vv
 for xen-changelog@lists.xenproject.org; Mon, 02 Mar 2026 21:22:21 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxAib-001fwE-32
 for xen-changelog@lists.xenproject.org;
 Mon, 02 Mar 2026 21:22:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxAib-00DQxL-2t
 for xen-changelog@lists.xenproject.org;
 Mon, 02 Mar 2026 21:22:21 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=tk3l6h8AImsYukxpN+AbGJpOBJLQ2eUQiDpEX/sLdJw=; b=XbOhHzuepdaMtF2xokntXWmNP9
	gQJVNddn5pU8wKnqqWTUe+fqXorUCM5gyWSC/GGvBM2CHw4EYPMLJcCwHU3/j2JBSr1BG7wsB7Yqs
	jgssib4XYRJWnnru/ur4OGkf8IbHf5VHN0prrYe62B1CPHkQ7EEpCViAHO5HpMY1cCVk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/efi: remove unreachable efi_halt_system() function
Message-Id: <E1vxAib-00DQxL-2t@xenbits.xenproject.org>
Date: Mon, 02 Mar 2026 21:22:21 +0000

commit 0f410b45de689172a2c2928759e305bb79ea1d47
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Tue Feb 24 20:55:19 2026 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Mon Mar 2 17:16:26 2026 +0100

    x86/efi: remove unreachable efi_halt_system() function
    
    After e4c3755d4dd7 the function efi_halt_system() is unreachable, remove it
    from the file.
    
    No functional change expected, as the function is not called.
    
    Fixes: e4c3755d4dd7 ("x86-64/EFI: don't call EfiResetSystem() from machine_halt()")
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
    Acked-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
---
 xen/common/efi/common-stub.c |  1 -
 xen/common/efi/runtime.c     | 13 -------------
 xen/include/xen/efi.h        |  1 -
 3 files changed, 15 deletions(-)

diff --git a/xen/common/efi/common-stub.c b/xen/common/efi/common-stub.c
index 77f138a6c5..9dc8aa538c 100644
--- a/xen/common/efi/common-stub.c
+++ b/xen/common/efi/common-stub.c
@@ -18,7 +18,6 @@ unsigned long efi_get_time(void)
     return 0;
 }
 
-void efi_halt_system(void) { }
 void efi_reset_system(bool warm) { }
 
 int efi_get_info(uint32_t idx, union xenpf_efi_info *info)
diff --git a/xen/common/efi/runtime.c b/xen/common/efi/runtime.c
index f786ceb007..ba27c62132 100644
--- a/xen/common/efi/runtime.c
+++ b/xen/common/efi/runtime.c
@@ -188,19 +188,6 @@ unsigned long efi_get_time(void)
                   time.Hour, time.Minute, time.Second);
 }
 
-void efi_halt_system(void)
-{
-    EFI_STATUS status;
-    struct efi_rs_state state = efi_rs_enter();
-
-    if ( !state.cr3 )
-        return;
-    status = efi_rs->ResetSystem(EfiResetShutdown, EFI_SUCCESS, 0, NULL);
-    efi_rs_leave(&state);
-
-    printk(XENLOG_WARNING "EFI: could not halt system (%#lx)\n", status);
-}
-
 void efi_reset_system(bool warm)
 {
     EFI_STATUS status;
diff --git a/xen/include/xen/efi.h b/xen/include/xen/efi.h
index 723cb80852..2e36b01e20 100644
--- a/xen/include/xen/efi.h
+++ b/xen/include/xen/efi.h
@@ -42,7 +42,6 @@ void efi_init_memory(void);
 bool efi_boot_mem_unused(unsigned long *start, unsigned long *end);
 bool efi_rs_using_pgtables(void);
 unsigned long efi_get_time(void);
-void efi_halt_system(void);
 void efi_reset_system(bool warm);
 #ifndef COMPAT
 int efi_get_info(uint32_t idx, union xenpf_efi_info *info);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Mar 02 21:22:33 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 02 Mar 2026 21:22:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1244544.1543995 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxAin-0003bJ-MJ; Mon, 02 Mar 2026 21:22:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1244544.1543995; Mon, 02 Mar 2026 21:22:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxAin-0003bB-Jd; Mon, 02 Mar 2026 21:22:33 +0000
Received: by outflank-mailman (input) for mailman id 1244544;
 Mon, 02 Mar 2026 21:22:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vxAim-0003b0-23
 for xen-changelog@lists.xenproject.org; Mon, 02 Mar 2026 21:22:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxAim-001fwY-06
 for xen-changelog@lists.xenproject.org;
 Mon, 02 Mar 2026 21:22:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxAil-00DQxn-3D
 for xen-changelog@lists.xenproject.org;
 Mon, 02 Mar 2026 21:22:31 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=SYgs1hGxQ/QHMXzq8I+2ov7oBcOla7QUTqPcsaZpGSY=; b=PQXQ47y7IBd+ic1BGCDv5OPhfV
	xxaSsM0GTZgAbwjKnW1/1D9yjnhCtV1aX5pWnGnYzJX6G1ZGqhJEPWArSWT4AgSQ/KUeE1rEgWAfX
	k3SIYmklozaFSLGX2i8e+evgc/NXrlMuwf8TjZFK708iQ9RZY8KpduL02tz9usJ+zC3E=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/cpufreq: fix adjusting of sampling window on early exit
Message-Id: <E1vxAil-00DQxn-3D@xenbits.xenproject.org>
Date: Mon, 02 Mar 2026 21:22:31 +0000

commit 74867aae25cb6356b8a7d1140c81666e2a23b818
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Thu Feb 26 18:53:02 2026 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Mon Mar 2 17:16:26 2026 +0100

    xen/cpufreq: fix adjusting of sampling window on early exit
    
    The logic in dbs_check_cpu() resets the sampling window even when the
    sampling period is considered too small.  This leads to further calls
    finding an imbalance between the total window time and the idle time, as
    the total window time is possibly shorter than the idle time.
    
    Fix by resetting the sampling window start time in the same block where the
    current idle time is stored.  While there also prevent a duplicated call to
    NOW() and instead re-use the previously fetched value.
    
    Fixes: d6f001cb91ac ("x86: Implement cpufreq ondemand policy")
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/drivers/cpufreq/cpufreq_ondemand.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/drivers/cpufreq/cpufreq_ondemand.c b/xen/drivers/cpufreq/cpufreq_ondemand.c
index 0126a3f5d9..537695eaab 100644
--- a/xen/drivers/cpufreq/cpufreq_ondemand.c
+++ b/xen/drivers/cpufreq/cpufreq_ondemand.c
@@ -117,11 +117,12 @@ static void dbs_check_cpu(struct cpu_dbs_info_s *this_dbs_info)
 
     cur_ns = NOW();
     total_ns = cur_ns - this_dbs_info->prev_cpu_wall;
-    this_dbs_info->prev_cpu_wall = NOW();
 
     if (total_ns < MIN_DBS_INTERVAL)
         return;
 
+    this_dbs_info->prev_cpu_wall = cur_ns;
+
     /* Get Idle Time */
     for_each_cpu(j, policy->cpus) {
         uint64_t idle_ns, total_idle_ns;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Mar 02 21:22:43 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 02 Mar 2026 21:22:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1244545.1543998 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxAix-0003di-NV; Mon, 02 Mar 2026 21:22:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1244545.1543998; Mon, 02 Mar 2026 21:22:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxAix-0003da-L1; Mon, 02 Mar 2026 21:22:43 +0000
Received: by outflank-mailman (input) for mailman id 1244545;
 Mon, 02 Mar 2026 21:22:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vxAiw-0003dS-6q
 for xen-changelog@lists.xenproject.org; Mon, 02 Mar 2026 21:22:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxAiw-001fwk-0Q
 for xen-changelog@lists.xenproject.org;
 Mon, 02 Mar 2026 21:22:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxAiw-00DQyO-0H
 for xen-changelog@lists.xenproject.org;
 Mon, 02 Mar 2026 21:22:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=TZDmx771ApBFeSNUVje9KFhtxexSWnsphAwdBccHdbE=; b=cB4bT4MXdkWSzXZYiSGhx5sIIY
	ii5x9F0rt1Gvt8DLM8UqNAVRKl536n2IH0Bkhap61L/gnz/y4NBCR4LlFmsNDDLMcti1MGFrDLX0V
	QubblyS31yBWLs1TR2MEwGNoGQNXqCk8NqnR1rxwSIaKX5FwW4u86Wh9GIXr3AkoU8l8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/cpufreq: fix usages of align_timer() in the on-demand governor
Message-Id: <E1vxAiw-00DQyO-0H@xenbits.xenproject.org>
Date: Mon, 02 Mar 2026 21:22:42 +0000

commit a0ed5bcfbeee81c91c574ad484faa057054eaf09
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Thu Feb 26 18:54:19 2026 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Mon Mar 2 17:16:26 2026 +0100

    xen/cpufreq: fix usages of align_timer() in the on-demand governor
    
    The first parameter passed to align_timer() is the timer expiration, not
    the current time.  Adjust the calls to align_timer() in the on-demand
    governor to pass the expected timer expiration as the first parameter.
    
    Fixes: af74e3a15a83 ("cpufreq: align dbs timer for better package C state residency")
    Fixes: 382b95f627a9 ("Fix cpufreq HW-ALL coordination handle")
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/drivers/cpufreq/cpufreq_ondemand.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/xen/drivers/cpufreq/cpufreq_ondemand.c b/xen/drivers/cpufreq/cpufreq_ondemand.c
index 537695eaab..0d94c0e464 100644
--- a/xen/drivers/cpufreq/cpufreq_ondemand.c
+++ b/xen/drivers/cpufreq/cpufreq_ondemand.c
@@ -185,7 +185,8 @@ static void cf_check do_dbs_timer(void *dbs)
     dbs_check_cpu(dbs_info);
 
     set_timer(&per_cpu(dbs_timer, dbs_info->cpu),
-            align_timer(NOW() , dbs_tuners_ins.sampling_rate));
+              align_timer(NOW() + dbs_tuners_ins.sampling_rate,
+                          dbs_tuners_ins.sampling_rate));
 }
 
 static void dbs_timer_init(struct cpu_dbs_info_s *dbs_info)
@@ -400,6 +401,6 @@ void cpufreq_dbs_timer_resume(void)
             (void)cmpxchg(stoppable, -1, 1);
         }
         else
-            set_timer(t, align_timer(now, dbs_tuners_ins.sampling_rate));
+            set_timer(t, align_timer(t->expires, dbs_tuners_ins.sampling_rate));
     }
 }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 03 18:11:12 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Mar 2026 18:11:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1245002.1544333 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxUD1-0003lr-UR; Tue, 03 Mar 2026 18:11:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1245002.1544333; Tue, 03 Mar 2026 18:11:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxUD1-0003lj-RI; Tue, 03 Mar 2026 18:11:03 +0000
Received: by outflank-mailman (input) for mailman id 1245002;
 Tue, 03 Mar 2026 18:11:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vxUD0-0003ld-6R
 for xen-changelog@lists.xenproject.org; Tue, 03 Mar 2026 18:11:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxUD0-003Jg9-0J
 for xen-changelog@lists.xenproject.org;
 Tue, 03 Mar 2026 18:11:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxUD0-00EjZz-0A
 for xen-changelog@lists.xenproject.org;
 Tue, 03 Mar 2026 18:11:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=enra8xmiXZwKA4h/T5r46juwe60CZeU3bzAi/uMnxko=; b=T8z3z4uQVRBbZB4XSI9Spwvbg/
	JkQMO4kmRAKBxO571q41Gv0Jr0M6gu3TM5+/M57Ti9827hka0nnU0hWFN4psC5rSsBIs/er0eep0t
	xrwsGzI2YUHStvuhiM+6VBG2JHfbeR01D182D/rRlifMCuD5SQdMm4MKv3sgRaJ9RGTE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/ucode: Support discrete modules being CPIO archives
Message-Id: <E1vxUD0-00EjZz-0A@xenbits.xenproject.org>
Date: Tue, 03 Mar 2026 18:11:02 +0000

commit 878a9cfa451878dcba6108ae5b7879c80f049661
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Jan 27 14:25:26 2026 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 3 15:15:53 2026 +0000

    x86/ucode: Support discrete modules being CPIO archives
    
    Multiple downstream distros have tried passing discrete CPIO archives and
    tripped over this not working.  It turns out to be easy to support, so do so.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Tested-by: Teddy Astie <teddy.astie@vates.tech>
---
 CHANGELOG.md                      |  1 +
 docs/misc/xen-command-line.pandoc | 19 ++++++++-----------
 xen/arch/x86/cpu/microcode/core.c | 20 +++++++++++++++++++-
 3 files changed, 28 insertions(+), 12 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 18f3d10f20..c191e504ab 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -13,6 +13,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
    - Support for Bus Lock Threshold on AMD Zen5 and later CPUs, used by Xen to
      mitigate (by rate-limiting) the system wide impact of an HVM guest
      misusing atomic instructions.
+   - Support for CPIO microcode in discrete multiboot modules.
 
 ### Removed
  - On x86:
diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index c1f2def9f9..ebdca007d2 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -2764,23 +2764,20 @@ Controls for CPU microcode loading, available when `CONFIG_MICROCODE_LOADING`
 is enabled.
 
 In order to load microcode at boot, Xen needs to find a suitable update
-amongst the modules provided by the bootloader.  Two kinds of microcode update
-are supported:
+amongst the modules provided by the bootloader.  Two formats are supported:
 
  1. Raw microcode containers.  The format of the container is CPU vendor
     specific.
 
- 2. CPIO archive.  This is Linux's preferred mechanism, and involves having
-    the raw containers expressed as files
+ 2. CPIO archive, which involves having the raw containers expressed as files
     (e.g. `kernel/x86/microcode/{GenuineIntel,AuthenticAMD}.bin`) in a CPIO
-    archive, typically prepended to the initrd.
+    archive.  Linux commonly prepends this to the initrd.
 
-The `<integer>` and `scan=<bool>` options are mutually exclusive and select
-between these two options.  Further restrictions exist for booting xen.efi
-(see below).
+The `<integer>` and `scan=<bool>` options are mutually exclusive and work as
+follows.  Further restrictions exist for booting xen.efi (see below).
 
- *  The `<integer>` option nominates a specific multiboot module as a raw
-    container (option 1 above).  Valid options start from 1 (module 0 is
+ *  The `<integer>` option nominates a specific multiboot module as containing
+    microcode in either format.  Valid options start from 1 (module 0 is
     always the dom0 kernel).  A negative number may be used, and will
     back-reference from the end of the module list.  i.e. `ucode=-1` will
     nominate the final multiboot module.
@@ -2794,7 +2791,7 @@ When booting xen.efi natively, the concept of multiboot modules doesn't exist.
 Instead:
 
  *  In the [EFI configuration file](efi.html), `ucode=<filename>` can be used
-    to identify a file as a raw container (option 1 above).  Use of this
+    to identify a file as containing microcode in either format.  Use of this
     mechanism will disable both `<integer>` and `scan=`.
 
  *  If `ucode=<filename>` in the EFI configuration file is not used, it is
diff --git a/xen/arch/x86/cpu/microcode/core.c b/xen/arch/x86/cpu/microcode/core.c
index ea0b35c499..9b8d1e09cb 100644
--- a/xen/arch/x86/cpu/microcode/core.c
+++ b/xen/arch/x86/cpu/microcode/core.c
@@ -767,6 +767,7 @@ static int __init early_microcode_load(struct boot_info *bi)
     void *data = NULL;
     size_t size;
     const struct microcode_patch *patch;
+    struct cpio_data cd;
     int idx = opt_mod_idx;
     int rc;
 
@@ -783,7 +784,6 @@ static int __init early_microcode_load(struct boot_info *bi)
         for ( idx = 0; idx < bi->nr_modules; ++idx )
         {
             const struct boot_module *bm = &bi->mods[idx];
-            struct cpio_data cd;
 
             /* Search anything unclaimed or likely to be a CPIO archive. */
             if ( bm->kind != BOOTMOD_UNKNOWN && bm->kind != BOOTMOD_RAMDISK )
@@ -851,6 +851,24 @@ static int __init early_microcode_load(struct boot_info *bi)
                    idx, size);
             return -ENODEV;
         }
+
+        /*
+         * If this blob appears to be a CPIO archive, try interpreting it as
+         * one.  Otherwise treat it as a raw vendor blob.
+         */
+        cd = find_cpio_data(ucode_ops.cpio_path, data, size);
+        if ( cd.data )
+        {
+            data = cd.data;
+            size = cd.size;
+
+            /*
+             * (Ab)use opt_scan to inform microcode_init_cache() that
+             * early_mod_idx refers to a CPIO archive.
+             */
+            opt_scan = true;
+        }
+
         goto found;
     }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 03 18:11:12 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Mar 2026 18:11:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1245003.1544336 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxUDA-0003n6-VH; Tue, 03 Mar 2026 18:11:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1245003.1544336; Tue, 03 Mar 2026 18:11:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxUDA-0003my-Se; Tue, 03 Mar 2026 18:11:12 +0000
Received: by outflank-mailman (input) for mailman id 1245003;
 Tue, 03 Mar 2026 18:11:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vxUDA-0003mo-8w
 for xen-changelog@lists.xenproject.org; Tue, 03 Mar 2026 18:11:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxUDA-003JgI-0c
 for xen-changelog@lists.xenproject.org;
 Tue, 03 Mar 2026 18:11:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxUDA-00Ejag-0V
 for xen-changelog@lists.xenproject.org;
 Tue, 03 Mar 2026 18:11:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=YFMW01HOI00EWXaOtdMzqH+ebadzvhVgthoJciCoeII=; b=RSrunTeEGwW1ODwC7kL5YIp5CO
	6Y//yyo5QCi+iMMvAGR0mSybKPWrlZAB7aa2Z1ajGNXIJtUEkWCZJq2eZEZMFB6Uj1jrCRniLJ4xd
	JFhZSjllDYcZbryzLgt3DNoVUNQyKSuN1WBiXWEX8yvx49AuSuUqIjXCx8wKK3GON/Aw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/pv: Don't assume that INT $imm8 instructions are two bytes long
Message-Id: <E1vxUDA-00Ejag-0V@xenbits.xenproject.org>
Date: Tue, 03 Mar 2026 18:11:12 +0000

commit a934a600c45486b7acfe8abc3658e284e64e5dd5
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Feb 19 13:20:26 2026 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 3 15:15:53 2026 +0000

    x86/pv: Don't assume that INT $imm8 instructions are two bytes long
    
    For INT $N instructions (besides $0x80 for which there is a dedicated fast
    path), handling is mostly fault-based because of DPL0 gates in the IDT.  This
    means that when the guest kernel allows the instruction too, Xen must
    increment %rip to the end of the instruction before passing a trap to the
    guest kernel.
    
    When an INT $N instruction has a prefix, it's longer than two bytes, and Xen
    will deliver the "trap" with %rip pointing into the middle of the instruction.
    
    Introduce a new pv_emulate_sw_interrupt() which uses x86_insn_length() to
    determine the instruction length, rather than assuming two.
    
    This is a change in behaviour for PV guests, but the prior behaviour cannot
    reasonably be said to be intentional.
    
    This change does not affect the INT $0x80 fastpath.  Prefixed INT $N
    instructions occur almost exclusively in test code or exploits, and INT $0x80
    appears to be the only user-usable interrupt gate in contemporary PV guests.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/include/asm/pv/traps.h |  2 ++
 xen/arch/x86/pv/emul-priv-op.c      | 49 +++++++++++++++++++++++++++++++++++++
 xen/arch/x86/traps.c                |  3 +--
 3 files changed, 52 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/include/asm/pv/traps.h b/xen/arch/x86/include/asm/pv/traps.h
index 8c20119092..16e9a8d2aa 100644
--- a/xen/arch/x86/include/asm/pv/traps.h
+++ b/xen/arch/x86/include/asm/pv/traps.h
@@ -17,6 +17,7 @@
 int pv_raise_nmi(struct vcpu *v);
 
 int pv_emulate_privileged_op(struct cpu_user_regs *regs);
+void pv_emulate_sw_interrupt(struct cpu_user_regs *regs);
 void pv_emulate_gate_op(struct cpu_user_regs *regs);
 bool pv_emulate_invalid_op(struct cpu_user_regs *regs);
 
@@ -31,6 +32,7 @@ static inline bool pv_trap_callback_registered(const struct vcpu *v,
 static inline int pv_raise_nmi(struct vcpu *v) { return -EOPNOTSUPP; }
 
 static inline int pv_emulate_privileged_op(struct cpu_user_regs *regs) { return 0; }
+static inline void pv_emulate_sw_interrupt(struct cpu_user_regs *regs) {}
 static inline void pv_emulate_gate_op(struct cpu_user_regs *regs) {}
 static inline bool pv_emulate_invalid_op(struct cpu_user_regs *regs) { return true; }
 
diff --git a/xen/arch/x86/pv/emul-priv-op.c b/xen/arch/x86/pv/emul-priv-op.c
index fba1e25c31..64d47ab677 100644
--- a/xen/arch/x86/pv/emul-priv-op.c
+++ b/xen/arch/x86/pv/emul-priv-op.c
@@ -8,6 +8,7 @@
  */
 
 #include <xen/domain_page.h>
+#include <xen/err.h>
 #include <xen/event.h>
 #include <xen/guest_access.h>
 #include <xen/hypercall.h>
@@ -1401,6 +1402,54 @@ int pv_emulate_privileged_op(struct cpu_user_regs *regs)
     return 0;
 }
 
+/*
+ * Hardware already decoded the INT $N instruction and determined that there
+ * was a permission issue (i.e. the DPL violation intended to trigger #GP).
+ * Xen has already determined that the guest kernel has permitted this
+ * software interrupt.
+ *
+ * All that is needed is the instruction length, to turn the fault into a
+ * trap.  All errors are turned back into the original #GP, as that's the
+ * action that really happened.
+ */
+void pv_emulate_sw_interrupt(struct cpu_user_regs *regs)
+{
+    struct vcpu *curr = current;
+    struct domain *currd = curr->domain;
+    struct priv_op_ctxt ctxt = {
+        .ctxt.regs = regs,
+        .ctxt.lma = !is_pv_32bit_domain(currd),
+    };
+    struct x86_emulate_state *state;
+    uint8_t vector = regs->error_code >> 3;
+    unsigned int len, ar;
+
+    if ( !pv_emul_read_descriptor(regs->cs, curr, &ctxt.cs.base,
+                                  &ctxt.cs.limit, &ar, 1) ||
+         !(ar & _SEGMENT_S) ||
+         !(ar & _SEGMENT_P) ||
+         !(ar & _SEGMENT_CODE) )
+        goto error;
+
+    state = x86_decode_insn(&ctxt.ctxt, insn_fetch);
+    if ( IS_ERR_OR_NULL(state) )
+        goto error;
+
+    len = x86_insn_length(state, &ctxt.ctxt);
+    x86_emulate_free_state(state);
+
+    /* Note: Checked slightly late to simplify 'state' handling. */
+    if ( ctxt.ctxt.opcode != 0xcd /* INT $imm8 */ )
+        goto error;
+
+    regs->rip += len;
+    pv_inject_sw_interrupt(vector);
+    return;
+
+ error:
+    pv_inject_hw_exception(X86_EXC_GP, regs->error_code);
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index 3c01c5eb53..bcae704d96 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -1379,8 +1379,7 @@ void do_general_protection(struct cpu_user_regs *regs)
 
         if ( permit_softint(TI_GET_DPL(ti), v, regs) )
         {
-            regs->rip += 2;
-            pv_inject_sw_interrupt(vector);
+            pv_emulate_sw_interrupt(regs);
             return;
         }
     }
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 03 18:11:23 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Mar 2026 18:11:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1245004.1544340 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxUDL-0003pt-0c; Tue, 03 Mar 2026 18:11:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1245004.1544340; Tue, 03 Mar 2026 18:11:22 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxUDK-0003pl-U6; Tue, 03 Mar 2026 18:11:22 +0000
Received: by outflank-mailman (input) for mailman id 1245004;
 Tue, 03 Mar 2026 18:11:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vxUDK-0003pd-C6
 for xen-changelog@lists.xenproject.org; Tue, 03 Mar 2026 18:11:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxUDK-003JgN-17
 for xen-changelog@lists.xenproject.org;
 Tue, 03 Mar 2026 18:11:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxUDK-00EjcM-0n
 for xen-changelog@lists.xenproject.org;
 Tue, 03 Mar 2026 18:11:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=TlIg75EdUjVq4Ney0WQWSZbRwIo8nOxvhpyY7UnU7QI=; b=oEHTMeNrIVq6ndHCeGKgSxTJ/J
	jNslqG+0dM5mo+Mxr4YTCmgk07fr7h6jajDl17MSQFW7ahv4YxMDOkuZgKGpuojycUcY4992Gj8nN
	3dfTCw+wyaUDkpz5CpkQR5FC5/KSe1MTMSnmZyAxkg9bwPpIDyX/FCuF1i2w8o+U5rNY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] docs/guest-guide: Describe the PV traps and entrypoints ABI
Message-Id: <E1vxUDK-00EjcM-0n@xenbits.xenproject.org>
Date: Tue, 03 Mar 2026 18:11:22 +0000

commit 31cbb8e2a52a5470d375ad725b9771da670f6d62
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Feb 19 13:20:26 2026 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 3 15:15:53 2026 +0000

    docs/guest-guide: Describe the PV traps and entrypoints ABI
    
    ... seeing as I've had to thoroughly reverse engineer it for FRED and make
    tweaks in places.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 docs/glossary.rst                 |   3 +
 docs/guest-guide/x86/index.rst    |   1 +
 docs/guest-guide/x86/pv-traps.rst | 126 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 130 insertions(+)

diff --git a/docs/glossary.rst b/docs/glossary.rst
index 6adeec77e1..5c3229a8c4 100644
--- a/docs/glossary.rst
+++ b/docs/glossary.rst
@@ -43,6 +43,9 @@ Glossary
      Sapphire Rapids (Server, 2023) CPUs.  AMD support only CET-SS, starting
      with Zen3 (Both client and server, 2020) CPUs.
 
+   event channel
+     A paravirtual facility for guests to send and receive interrupts.
+
    guest
      The term 'guest' has two different meanings, depending on context, and
      should not be confused with :term:`domain`.
diff --git a/docs/guest-guide/x86/index.rst b/docs/guest-guide/x86/index.rst
index 502968490d..5b38ae397a 100644
--- a/docs/guest-guide/x86/index.rst
+++ b/docs/guest-guide/x86/index.rst
@@ -7,3 +7,4 @@ x86
    :maxdepth: 2
 
    hypercall-abi
+   pv-traps
diff --git a/docs/guest-guide/x86/pv-traps.rst b/docs/guest-guide/x86/pv-traps.rst
new file mode 100644
index 0000000000..c10001e023
--- /dev/null
+++ b/docs/guest-guide/x86/pv-traps.rst
@@ -0,0 +1,126 @@
+.. SPDX-License-Identifier: CC-BY-4.0
+
+PV Traps and Entrypoints
+========================
+
+.. note::
+
+   The details here are specific to 64bit builds of Xen.  Details for 32bit
+   builds of Xen are different and not discussed further.
+
+PV guests are subject to Xen's linkage setup for events (interrupts,
+exceptions and system calls).  x86's IDT architecture and limitations are the
+majority influence on the PV ABI.
+
+All external interrupts are routed to PV guests via the :term:`Event Channel`
+interface, and not discussed further here.
+
+What remain are exceptions, and the instructions which cause control
+transfers.  In the x86 architecture, the instructions relevant for PV guests
+are:
+
+ * ``INT3``, which generates ``#BP``.
+
+ * ``INTO``, which generates ``#OF`` only if the overflow flag is set.  It is
+   only usable in compatibility mode, and will ``#UD`` in 64bit mode.
+
+ * ``CALL (far)`` referencing a gate in the GDT.
+
+ * ``INT $N``, which invokes an arbitrary IDT gate.  These four instructions
+   so far all check the gate DPL and will ``#GP`` otherwise.
+
+ * ``INT1``, also known as ``ICEBP``, which generates ``#DB``.  This
+   instruction does *not* check DPL, and can be used unconditionally by
+   userspace.
+
+ * ``SYSCALL``, which enters CPL0 as configured by the ``{C,L,}STAR`` MSRs.
+   It is usable if enabled by ``MSR_EFER.SCE``, and will ``#UD`` otherwise.
+   On Intel parts, ``SYSCALL`` is unusable outside of 64bit mode.
+
+ * ``SYSENTER``, which enters CPL0 as configured by the ``SEP`` MSRs.  It is
+   usable if enabled by ``MSR_SYSENTER_CS`` having a non-NUL selector, and
+   will ``#GP`` otherwise.  On AMD parts, ``SYSENTER`` is unusable in Long
+   mode.
+
+The ``BOUND`` instruction is not included.  It is a hardware exception and
+strictly a fault, with no trapping configuraton.
+
+
+Xen's configuration
+-------------------
+
+Xen maintains a complete IDT, with most gates configured with DPL0.  This
+causes most ``INT $N`` instructions to ``#GP``.  This allows Xen to emulate
+the instruction, referring to the guest kernels vDPL choice.
+
+ * Vectors 3 ``#BP`` and 4 ``#OF`` are DPL3, in order to allow the ``INT3``
+   and ``INTO`` instructions to function in userspace.
+
+ * Vector 0x80 is DPL3 because of it's common usage for syscall in UNIXes.
+   This is a fastpath to avoid the emulation overhead.
+
+ * Vector 0x82 is DPL1 when PV32 is enabled, allowing the guest kernel to make
+   hypercalls to Xen.  All other cases (PV32 guest userspace, and both PV64
+   modes) operate in CPL3 and this vector behaves like all others to ``INT
+   $N`` instructions.
+
+A range of the GDT is guest-owned, allowing for call gates.  During audit, Xen
+forces all call gates to DPL0, causing their use to ``#GP`` allowing for
+emulation.
+
+Xen enables ``SYSCALL`` in all cases as it is mandatory in 64bit mode, and
+enables ``SYSENTER`` when available in 64bit mode.
+
+When Xen is using FRED delivery the hardware configuration is substantially
+different, but the behaviour for guests remains as unchanged as possible.
+
+
+PV Guest's configuration
+------------------------
+
+The PV ABI contains the "trap table", modelled closely on the IDT.  It is
+manipulated by ``HYPERCALL_set_trap_table``, has 256 entries, each containing
+a code segment selector, an address, and flags.  A guest is expected to
+configure handlers for all exceptions; failure to do so is terminal and
+similar to a Triple Fault.
+
+Part of the GDT is guest owned with descriptors audited by Xen.  This range
+can be manipulated with ``HYPERVISOR_set_gdt`` and
+``HYPERVISOR_update_descriptor``.
+
+Other entrypoints are configured via ``HYPERVISOR_callback_op``.  Of note here
+are the callback types ``syscall``, ``syscall32`` (relevant for AMD parts) and
+``sysenter`` (relevant for Intel parts).
+
+.. warning::
+
+   Prior to Xen 4.15, there was no check that the ``syscall`` or ``syscall32``
+   callbacks had been registered before attempting to deliver via them.
+   Guests are strongly advised to ensure the entrypoints are registered before
+   running userspace.
+
+
+Notes
+-----
+
+``INT3`` vs ``INT $3`` and ``INTO`` vs ``INT $4`` are hard to distinguish
+architecturally as both forms have a DPL check and use the same IDT vectors.
+Because Xen configures both as DPL3, the ``INT $`` forms do not fault for
+emulation, and are treated as if they were exceptions.  This means the guest
+can't block these instruction by trying to configure them with vDPL0.
+
+The instructions which trap into Xen (``INT $0x80``, ``SYSCALL``,
+``SYSENTER``) but can be disabled by guest configuration need turning back
+into faults for the guest kernel to process.
+
+ * When using IDT delivery, instruction lengths are not provided by hardware
+   and Xen does not account for possible prefixes.  ``%rip`` only gets rewound
+   by the length of the un-prefixed instruction.  This is observable, but not
+   expected to be an issue in practice.
+
+ * When Xen is using FRED delivery, the full instruction length is provided by
+   hardware, and ``%rip`` is rewound fully.
+
+While both PV32 and PV64 guests are permitted to write Call Gates into the
+GDT, emulation is only wired up for PV32.  At the time of writing, the x86
+maintainers feel no specific need to fix this omission.
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 03 18:11:33 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Mar 2026 18:11:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1245006.1544344 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxUDV-0003sI-1z; Tue, 03 Mar 2026 18:11:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1245006.1544344; Tue, 03 Mar 2026 18:11:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxUDU-0003sA-VT; Tue, 03 Mar 2026 18:11:32 +0000
Received: by outflank-mailman (input) for mailman id 1245006;
 Tue, 03 Mar 2026 18:11:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vxUDU-0003s2-Fg
 for xen-changelog@lists.xenproject.org; Tue, 03 Mar 2026 18:11:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxUDU-003Jgb-1Q
 for xen-changelog@lists.xenproject.org;
 Tue, 03 Mar 2026 18:11:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxUDU-00Ejcw-1J
 for xen-changelog@lists.xenproject.org;
 Tue, 03 Mar 2026 18:11:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=uWYmLQnBBVWUPyxkeBg6UMFUwFInaob5gR+dFkeGADc=; b=N+WeaxR2Q1UGH/LnVZsQxdk4Qy
	PSbyYG3/RFWA6JMaPpj7S5Vr482ku8NljzAbfOyiIp9tpRGpxxSAqHWsxAiE6bTMsLSWjaUrdNRIV
	3xDcCmzNSbjyumHJnwIX73AIDgX3e9SO+lbIo0XmGIHsY2302HaM39jQMfSrsX0P6FlM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/boot: Move gdt_l1e caching out of traps_init()
Message-Id: <E1vxUDU-00Ejcw-1J@xenbits.xenproject.org>
Date: Tue, 03 Mar 2026 18:11:32 +0000

commit a1e6afbf54283be0ea3db9bf6cb046c683fcf684
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Feb 13 23:45:28 2026 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 3 15:15:54 2026 +0000

    x86/boot: Move gdt_l1e caching out of traps_init()
    
    Commit 564d261687c0 ("x86/ctxt-switch: Document and improve GDT handling") put
    the initialisation of {,compat_}gdt_l1e into traps_init() but this wasn't a
    great choice.  Instead, put it in smp_prepare_cpus() which performs the BSP
    preparation of variables normally set up by cpu_smpboot_alloc() for APs.
    
    This removes an implicit dependency that prevents traps_init() moving earlier
    than move_xen() in the boot sequence.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/domain.c      |  2 ++
 xen/arch/x86/smpboot.c     | 11 +++++++++++
 xen/arch/x86/traps-setup.c |  7 -------
 3 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index 8eb1509782..e658c2d647 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -2029,6 +2029,8 @@ static always_inline bool need_full_gdt(const struct domain *d)
 
 static void update_xen_slot_in_full_gdt(const struct vcpu *v, unsigned int cpu)
 {
+    ASSERT(per_cpu(gdt_l1e, cpu).l1); /* Confirm these have been cached. */
+
     l1e_write(pv_gdt_ptes(v) + FIRST_RESERVED_GDT_PAGE,
               !is_pv_32bit_vcpu(v) ? per_cpu(gdt_l1e, cpu)
                                    : per_cpu(compat_gdt_l1e, cpu));
diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c
index 961bdf5333..491cbbba33 100644
--- a/xen/arch/x86/smpboot.c
+++ b/xen/arch/x86/smpboot.c
@@ -1167,6 +1167,17 @@ void __init smp_prepare_cpus(void)
     initialize_cpu_data(0); /* Final full version of the data */
     print_cpu_info(0);
 
+    /*
+     * Cache {,compat_}gdt_l1e for the BSP now that physically relocation is
+     * done.  It must be after physical relocation of Xen, and before the
+     * first context_switch().
+     */
+    this_cpu(gdt_l1e) =
+        l1e_from_pfn(virt_to_mfn(boot_gdt), __PAGE_HYPERVISOR_RW);
+    if ( IS_ENABLED(CONFIG_PV32) )
+        this_cpu(compat_gdt_l1e) =
+            l1e_from_pfn(virt_to_mfn(boot_compat_gdt), __PAGE_HYPERVISOR_RW);
+
     boot_cpu_physical_apicid = get_apic_id();
     x86_cpu_to_apicid[0] = boot_cpu_physical_apicid;
 
diff --git a/xen/arch/x86/traps-setup.c b/xen/arch/x86/traps-setup.c
index d77be8f839..c5fc71c75b 100644
--- a/xen/arch/x86/traps-setup.c
+++ b/xen/arch/x86/traps-setup.c
@@ -341,13 +341,6 @@ void __init traps_init(void)
 
     init_ler();
 
-    /* Cache {,compat_}gdt_l1e now that physically relocation is done. */
-    this_cpu(gdt_l1e) =
-        l1e_from_pfn(virt_to_mfn(boot_gdt), __PAGE_HYPERVISOR_RW);
-    if ( IS_ENABLED(CONFIG_PV32) )
-        this_cpu(compat_gdt_l1e) =
-            l1e_from_pfn(virt_to_mfn(boot_compat_gdt), __PAGE_HYPERVISOR_RW);
-
     percpu_traps_init();
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 03 18:11:43 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Mar 2026 18:11:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1245007.1544348 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxUDf-0003uQ-35; Tue, 03 Mar 2026 18:11:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1245007.1544348; Tue, 03 Mar 2026 18:11:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxUDf-0003uJ-0W; Tue, 03 Mar 2026 18:11:43 +0000
Received: by outflank-mailman (input) for mailman id 1245007;
 Tue, 03 Mar 2026 18:11:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vxUDe-0003uC-I5
 for xen-changelog@lists.xenproject.org; Tue, 03 Mar 2026 18:11:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxUDe-003Jgi-1i
 for xen-changelog@lists.xenproject.org;
 Tue, 03 Mar 2026 18:11:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxUDe-00Ejdr-1b
 for xen-changelog@lists.xenproject.org;
 Tue, 03 Mar 2026 18:11:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=oJNsQCfC9b1UkhqL/6wj04OKL/MV/5e11vwx0uQGlnM=; b=ZlXGVzLGi3LzuPV3SIzi2esoCu
	91if4omLCjJX5vRSPxU2cI24onc9KmZKL7dh2woyefQD3dkp+usfUSItZt+76fH/gykRYI92FqaaJ
	FnvkRaIxYK0lSF/zcs0kRFVJvEVuaBMFwNeyq3paGqafSAdRTI5YgkmfHaPI5wcTzKrM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/boot: Document the ordering dependency of _svm_cpu_up()
Message-Id: <E1vxUDe-00Ejdr-1b@xenbits.xenproject.org>
Date: Tue, 03 Mar 2026 18:11:42 +0000

commit c2f15b0fff94ca71fe32792ea933fcf2a907111d
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Feb 16 20:57:02 2026 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 3 15:15:54 2026 +0000

    x86/boot: Document the ordering dependency of _svm_cpu_up()
    
    Lets just say this took an unreasonable amount of time and effort to track
    down, when trying to move traps_init() earlier during boot.
    
    When the SYSCALL linkage MSRs are not configured ahead of _svm_cpu_up() on the
    BSP, context switch clobbers the later-set-up linkage with the 0's cached
    here.  Amongst other problems, this causes PV guest to enter at 0 in
    supervisor mode on the user stack.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/svm/svm.c | 14 ++++++++++++++
 xen/arch/x86/setup.c       |  2 +-
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
index 18ba837738..243c41fb13 100644
--- a/xen/arch/x86/hvm/svm/svm.c
+++ b/xen/arch/x86/hvm/svm/svm.c
@@ -1581,6 +1581,20 @@ static int _svm_cpu_up(bool bsp)
     /* Initialize OSVW bits to be used by guests */
     svm_host_osvw_init();
 
+    /*
+     * VMSAVE writes out the current full FS, GS, LDTR and TR segments, and
+     * the GS_SHADOW, SYSENTER and SYSCALL linkage MSRs.
+     *
+     * The segment data gets modified by the svm_load_segs() optimisation for
+     * PV context switches, but all values get reloaded at that point, as well
+     * as during context switch from SVM.
+     *
+     * If PV guests are available, it is critical that the SYSCALL linkage
+     * MSRs been configured at this juncture even in FRED mode.
+     */
+    if ( IS_ENABLED(CONFIG_PV) )
+        ASSERT(rdmsr(MSR_STAR) == XEN_MSR_STAR);
+
     svm_vmsave_pa(per_cpu(host_vmcb, cpu));
 
     return 0;
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 27c63d1d97..675de3a649 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -2078,7 +2078,7 @@ void asmlinkage __init noreturn __start_xen(void)
                                            &this_cpu(stubs).mfn);
     BUG_ON(!this_cpu(stubs.addr));
 
-    traps_init(); /* Needs stubs allocated. */
+    traps_init(); /* Needs stubs allocated, must be before presmp_initcalls. */
 
     cpu_init();
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 03 18:11:53 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Mar 2026 18:11:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1245008.1544352 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxUDp-0003wm-5o; Tue, 03 Mar 2026 18:11:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1245008.1544352; Tue, 03 Mar 2026 18:11:53 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxUDp-0003wa-3F; Tue, 03 Mar 2026 18:11:53 +0000
Received: by outflank-mailman (input) for mailman id 1245008;
 Tue, 03 Mar 2026 18:11:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vxUDo-0003wU-L8
 for xen-changelog@lists.xenproject.org; Tue, 03 Mar 2026 18:11:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxUDo-003Jh9-21
 for xen-changelog@lists.xenproject.org;
 Tue, 03 Mar 2026 18:11:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxUDo-00EjeD-1t
 for xen-changelog@lists.xenproject.org;
 Tue, 03 Mar 2026 18:11:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=wDS7Wr7QyyO4aOomuKvgzUNBPtjh9iWYTxq2TelvBnk=; b=TH3JVW6jAwl2wjpCThT4gIeneS
	iWeqvL79Ds5E/ThB7O8XRNIh9Lm1jNf1mvxBdxILns7BsdpoTa1ht665rP2EK9FYTF3AYc8dFOt+9
	BJM309c6QOSrigEXFSyYNLoAsRDIN2Ix7K6kkAVtKEdP9Cry/RQhqS+qQUV/GPfsxpRA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/traps: Move traps_init() earlier on boot
Message-Id: <E1vxUDo-00EjeD-1t@xenbits.xenproject.org>
Date: Tue, 03 Mar 2026 18:11:52 +0000

commit 8e4775d118c327782f5bf286e5b353a9de797bef
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Aug 15 22:56:42 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 3 15:15:54 2026 +0000

    x86/traps: Move traps_init() earlier on boot
    
    We wish to make use of opt_fred earlier on boot, which involves moving
    traps_init() earlier, but this comes with several ordering complications.
    
    The feature word containing FRED needs collecting in early_cpu_init(), and
    legacy_syscall_init() cannot be moved that early because it relies on the
    stubs being allocated, yet must be called ahead of cpu_init() so the SYSCALL
    linkage MSRs are set up before being cached.
    
    Delaying legacy_syscall_init() is easy enough based on a system_state check.
    Reuse bsp_traps_reinit() to cause a call to legacy_syscall_init() to occur at
    the same point as previously.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/cpu/common.c  |  4 +++-
 xen/arch/x86/setup.c       |  4 +++-
 xen/arch/x86/traps-setup.c | 12 +++++++++++-
 3 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c
index bfa63fcfb7..5d0523a78b 100644
--- a/xen/arch/x86/cpu/common.c
+++ b/xen/arch/x86/cpu/common.c
@@ -407,7 +407,9 @@ void __init early_cpu_init(bool verbose)
 		}
 
 		if (max_subleaf >= 1)
-			cpuid_count(7, 1, &eax, &ebx, &ecx,
+			cpuid_count(7, 1,
+                                    &c->x86_capability[FEATURESET_7a1],
+                                    &ebx, &ecx,
 				    &c->x86_capability[FEATURESET_7d1]);
 	}
 
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 675de3a649..0816a713e1 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -1386,6 +1386,8 @@ void asmlinkage __init noreturn __start_xen(void)
     else
         panic("Bootloader provided no memory information\n");
 
+    traps_init();
+
     /* Choose shadow stack early, to set infrastructure up appropriately. */
     if ( !boot_cpu_has(X86_FEATURE_CET_SS) )
         opt_xen_shstk = 0;
@@ -2078,7 +2080,7 @@ void asmlinkage __init noreturn __start_xen(void)
                                            &this_cpu(stubs).mfn);
     BUG_ON(!this_cpu(stubs.addr));
 
-    traps_init(); /* Needs stubs allocated, must be before presmp_initcalls. */
+    bsp_traps_reinit(); /* Needs stubs allocated, must be before presmp_initcalls. */
 
     cpu_init();
 
diff --git a/xen/arch/x86/traps-setup.c b/xen/arch/x86/traps-setup.c
index c5fc71c75b..b2c161943d 100644
--- a/xen/arch/x86/traps-setup.c
+++ b/xen/arch/x86/traps-setup.c
@@ -346,6 +346,10 @@ void __init traps_init(void)
 
 /*
  * Re-initialise all state referencing the early-boot stack.
+ *
+ * This is called twice during boot, first to ensure legacy_syscall_init() has
+ * run (deferred from earlier), and second when the virtual address of the BSP
+ * stack changes.
  */
 void __init bsp_traps_reinit(void)
 {
@@ -359,7 +363,13 @@ void __init bsp_traps_reinit(void)
  */
 void percpu_traps_init(void)
 {
-    legacy_syscall_init();
+    /*
+     * Skip legacy_syscall_init() at early boot.  It requires the stubs being
+     * allocated, limiting the placement of the traps_init() call, and gets
+     * re-done anyway by bsp_traps_reinit().
+     */
+    if ( system_state > SYS_STATE_early_boot )
+        legacy_syscall_init();
 
     if ( cpu_has_xen_lbr )
         wrmsrl(MSR_IA32_DEBUGCTLMSR, IA32_DEBUGCTLMSR_LBR);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 03 18:12:03 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Mar 2026 18:12:03 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1245009.1544356 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxUDz-0003yz-7X; Tue, 03 Mar 2026 18:12:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1245009.1544356; Tue, 03 Mar 2026 18:12:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxUDz-0003ys-4Z; Tue, 03 Mar 2026 18:12:03 +0000
Received: by outflank-mailman (input) for mailman id 1245009;
 Tue, 03 Mar 2026 18:12:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vxUDy-0003ym-OY
 for xen-changelog@lists.xenproject.org; Tue, 03 Mar 2026 18:12:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxUDy-003JhQ-2J
 for xen-changelog@lists.xenproject.org;
 Tue, 03 Mar 2026 18:12:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxUDy-00Ejf6-2D
 for xen-changelog@lists.xenproject.org;
 Tue, 03 Mar 2026 18:12:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=JiKYpz/9CGqPu+C13bQSY4/qqaOuxQCugyjyBF8cwhM=; b=mUJp3Ya4q/f4Xi9iJktuhmHD1S
	bij8kaRUttEf3HjtPFiSEgF8NtvCfeEs5kmhBhEbAxTW26FQxA3TENXILs1IJOj2H8wWrgYKJl0qH
	jknKN+5aKbIfzKESJR/QAq6F0e93a9MdQ16ruge7N3YAKuDz+jgY7JcBHhAsJIWaDn2A=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/traps: Don't configure Supervisor Shadow Stack tokens in FRED mode
Message-Id: <E1vxUDy-00Ejf6-2D@xenbits.xenproject.org>
Date: Tue, 03 Mar 2026 18:12:02 +0000

commit 7634f5662551864a4976d5f0022263a056efd14d
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Aug 15 22:56:42 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 3 15:15:54 2026 +0000

    x86/traps: Don't configure Supervisor Shadow Stack tokens in FRED mode
    
    FRED doesn't use Supervisor Shadow Stack tokens.  This means that:
    
     1) memguard_guard_stack() should not write Supervisor Shadow Stack Tokens.
     2) cpu_has_bug_shstk_fracture is no longer relevant when deciding whether to
        enable Shadow Stacks or not.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/mm.c    | 14 +++++++++++---
 xen/arch/x86/setup.c | 16 ++++++++++------
 2 files changed, 21 insertions(+), 9 deletions(-)

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index 0d0d529295..4c404b6c13 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -129,6 +129,7 @@
 #include <asm/shadow.h>
 #include <asm/shared.h>
 #include <asm/trampoline.h>
+#include <asm/traps.h>
 #include <asm/x86_emulate.h>
 
 #include <public/memory.h>
@@ -6441,8 +6442,15 @@ static void write_sss_token(unsigned long *ptr)
 
 void memguard_guard_stack(void *p)
 {
-    /* IST Shadow stacks.  4x 1k in stack page 0. */
-    if ( IS_ENABLED(CONFIG_XEN_SHSTK) )
+    ASSERT(opt_fred >= 0); /* Confirm that FRED-ness has been resolved */
+
+    /*
+     * IST Shadow stacks.  4x 1k in stack page 0.
+     *
+     * With IDT delivery, we need Supervisor Shadow Stack tokens at the base
+     * of each stack.  With FRED delivery, these no longer exist.
+     */
+    if ( IS_ENABLED(CONFIG_XEN_SHSTK) && !opt_fred )
     {
         write_sss_token(p + (IST_MCE * IST_SHSTK_SIZE) - 8);
         write_sss_token(p + (IST_NMI * IST_SHSTK_SIZE) - 8);
@@ -6453,7 +6461,7 @@ void memguard_guard_stack(void *p)
 
     /* Primary Shadow Stack.  1x 4k in stack page 5. */
     p += PRIMARY_SHSTK_SLOT * PAGE_SIZE;
-    if ( IS_ENABLED(CONFIG_XEN_SHSTK) )
+    if ( IS_ENABLED(CONFIG_XEN_SHSTK) && !opt_fred )
         write_sss_token(p + PAGE_SIZE - 8);
 
     map_pages_to_xen((unsigned long)p, virt_to_mfn(p), 1, PAGE_HYPERVISOR_SHSTK);
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 0816a713e1..8e59c9801a 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -1412,15 +1412,19 @@ void asmlinkage __init noreturn __start_xen(void)
             boot_cpu_data.x86_vendor == X86_VENDOR_INTEL &&
             !boot_cpu_has(X86_FEATURE_CET_SSS);
 
+        ASSERT(opt_fred >= 0); /* Confirm that FRED-ness has been resolved */
+
         /*
-         * On bare metal, assume that Xen won't be impacted by shstk
-         * fracturing problems.  Under virt, be more conservative and disable
-         * shstk by default.
+         * If FRED is in use, Supervisor Shadow Stack tokens are not used and
+         * shstk fracturing is of no consequence.  Otherwise:
+         * - On bare metal, assume that Xen won't be impacted by shstk
+         *   fracturing problems.
+         * - Under virt, be more conservative and disable shstk by default.
          */
         if ( opt_xen_shstk == -1 )
             opt_xen_shstk =
-                cpu_has_hypervisor ? !cpu_has_bug_shstk_fracture
-                                   : true;
+                opt_fred || (cpu_has_hypervisor ? !cpu_has_bug_shstk_fracture
+                                                : true);
 
         if ( opt_xen_shstk )
         {
@@ -1925,7 +1929,7 @@ void asmlinkage __init noreturn __start_xen(void)
 
     system_state = SYS_STATE_boot;
 
-    bsp_stack = cpu_alloc_stack(0);
+    bsp_stack = cpu_alloc_stack(0); /* Needs to know IDT vs FRED */
     if ( !bsp_stack )
         panic("No memory for BSP stack\n");
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 03 18:12:14 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Mar 2026 18:12:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1245010.1544362 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxUEA-000414-9b; Tue, 03 Mar 2026 18:12:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1245010.1544362; Tue, 03 Mar 2026 18:12:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxUEA-00040w-69; Tue, 03 Mar 2026 18:12:14 +0000
Received: by outflank-mailman (input) for mailman id 1245010;
 Tue, 03 Mar 2026 18:12:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vxUE8-00040p-RN
 for xen-changelog@lists.xenproject.org; Tue, 03 Mar 2026 18:12:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxUE8-003JhX-2e
 for xen-changelog@lists.xenproject.org;
 Tue, 03 Mar 2026 18:12:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxUE8-00Ejfl-2V
 for xen-changelog@lists.xenproject.org;
 Tue, 03 Mar 2026 18:12:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=tFyfv00zydjzbHYf51ODZYAcGDhGvFDIM/ZmzkG5bOU=; b=OFU8veCLMKQn2gMOgFXV0JK8H7
	T3kaK86O4RJW2T4wuDKgPR/ukaqdIwUgUfkKd2nKS6UGjy7DaXD40W/wMTCFARmfs+BOM2WiFdFvL
	mkqUrC2/YiFUZuCyqR9vhk58f/TVUtHmZ4FPac4qnSMzKybQZCigtZFZgORXDjpJhuMQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/traps: Introduce FRED entrypoints
Message-Id: <E1vxUE8-00Ejfl-2V@xenbits.xenproject.org>
Date: Tue, 03 Mar 2026 18:12:12 +0000

commit 0e9cc04453fc2d7234ad3ced51b520c597c7bfbf
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Dec 24 11:03:06 2024 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 3 15:15:54 2026 +0000

    x86/traps: Introduce FRED entrypoints
    
    Under FRED, there's one entrypoint from Ring 3, and one from Ring 0.
    
    FRED gives us a good stack (even for SYSCALL/SYSENTER), and a unified event
    frame on the stack with all flags cleared, meaning that all software needs to
    do is spill the GPRs with a line of PUSHes.  Introduce PUSH_AND_CLEAR_GPRS for
    this purpose, along with the matching POP_GPRS.
    
    Introduce entry_FRED_R0() which to a first approximation is complete for all
    event handling within Xen.
    
    entry_FRED_R0() needs deriving from entry_FRED_R3(), so introduce a basic
    Ring3 handler.  There is more work required to make the return-to-guest path
    work under FRED.
    
    Also introduce entry_from_{xen,pv}() to be the C level handlers.  By simply
    copying regs->fred_ss.vector into regs->entry_vector, we can reuse all the
    existing fault handlers.
    
    Extend fatal_trap() to render the event type including name, when FRED is
    active.  This is slightly complicated, because X86_ET_OTHER must not use
    vector_name() or SYSCALL and SYSENTER get rendered as #BP and #DB.
    
    This is sufficient to handle all interrupts and exceptions encountered during
    development, including plenty of Double Faults.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/include/asm/asm_defns.h |  63 ++++++++++++++
 xen/arch/x86/traps.c                 | 155 +++++++++++++++++++++++++++++++++++
 xen/arch/x86/x86_64/Makefile         |   1 +
 xen/arch/x86/x86_64/entry-fred.S     |  33 ++++++++
 4 files changed, 252 insertions(+)

diff --git a/xen/arch/x86/include/asm/asm_defns.h b/xen/arch/x86/include/asm/asm_defns.h
index 4a21a7b466..0dd63270fc 100644
--- a/xen/arch/x86/include/asm/asm_defns.h
+++ b/xen/arch/x86/include/asm/asm_defns.h
@@ -312,6 +312,69 @@ static always_inline void stac(void)
         subq  $-(UREGS_error_code-UREGS_r15+\adj), %rsp
 .endm
 
+/*
+ * Push and clear GPRs
+ */
+.macro PUSH_AND_CLEAR_GPRS
+        push  %rdi
+        xor   %edi, %edi
+        push  %rsi
+        xor   %esi, %esi
+        push  %rdx
+        xor   %edx, %edx
+        push  %rcx
+        xor   %ecx, %ecx
+        push  %rax
+        xor   %eax, %eax
+        push  %r8
+        xor   %r8d, %r8d
+        push  %r9
+        xor   %r9d, %r9d
+        push  %r10
+        xor   %r10d, %r10d
+        push  %r11
+        xor   %r11d, %r11d
+        push  %rbx
+        xor   %ebx, %ebx
+        push  %rbp
+#ifdef CONFIG_FRAME_POINTER
+/* Indicate special exception stack frame by inverting the frame pointer. */
+        mov   %rsp, %rbp
+        not   %rbp
+#else
+        xor   %ebp, %ebp
+#endif
+        push  %r12
+        xor   %r12d, %r12d
+        push  %r13
+        xor   %r13d, %r13d
+        push  %r14
+        xor   %r14d, %r14d
+        push  %r15
+        xor   %r15d, %r15d
+.endm
+
+/*
+ * POP GPRs from a UREGS_* frame on the stack.  Does not modify flags.
+ */
+.macro POP_GPRS
+        pop   %r15
+        pop   %r14
+        pop   %r13
+        pop   %r12
+        pop   %rbp
+        pop   %rbx
+        pop   %r11
+        pop   %r10
+        pop   %r9
+        pop   %r8
+        pop   %rax
+        pop   %rcx
+        pop   %rdx
+        pop   %rsi
+        pop   %rdi
+.endm
+
 #ifdef CONFIG_PV32
 #define CR4_PV32_RESTORE                               \
     ALTERNATIVE_2 "",                                  \
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index bcae704d96..e40b51d693 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -88,6 +88,13 @@ const unsigned int nmi_cpu;
 #define stack_words_per_line 4
 #define ESP_BEFORE_EXCEPTION(regs) ((unsigned long *)(regs)->rsp)
 
+/* Only valid to use when FRED is active. */
+static inline struct fred_info *cpu_regs_fred_info(struct cpu_user_regs *regs)
+{
+    ASSERT(read_cr4() & X86_CR4_FRED);
+    return &container_of(regs, struct cpu_info, guest_cpu_user_regs)->_fred;
+}
+
 struct extra_state
 {
     unsigned long cr0, cr2, cr3, cr4;
@@ -1028,6 +1035,32 @@ void show_execution_state_nmi(const cpumask_t *mask, bool show_all)
         printk("Non-responding CPUs: {%*pbl}\n", CPUMASK_PR(&show_state_mask));
 }
 
+static const char *x86_et_name(unsigned int type)
+{
+    static const char *const names[] = {
+        [X86_ET_EXT_INTR]    = "EXT_INTR",
+        [X86_ET_NMI]         = "NMI",
+        [X86_ET_HW_EXC]      = "HW_EXC",
+        [X86_ET_SW_INT]      = "SW_INT",
+        [X86_ET_PRIV_SW_EXC] = "PRIV_SW_EXC",
+        [X86_ET_SW_EXC]      = "SW_EXC",
+        [X86_ET_OTHER]       = "OTHER",
+    };
+
+    return (type < ARRAY_SIZE(names) && names[type]) ? names[type] : "???";
+}
+
+static const char *x86_et_other_name(unsigned int what)
+{
+    static const char *const names[] = {
+        [0] = "MTF",
+        [1] = "SYSCALL",
+        [2] = "SYSENTER",
+    };
+
+    return (what < ARRAY_SIZE(names) && names[what]) ? names[what] : "???";
+}
+
 const char *vector_name(unsigned int vec)
 {
     static const char names[][4] = {
@@ -1106,6 +1139,38 @@ void fatal_trap(const struct cpu_user_regs *regs, bool show_remote)
         }
     }
 
+    if ( read_cr4() & X86_CR4_FRED )
+    {
+        bool render_ec = false;
+        const char *vec_name = NULL;
+
+        switch ( regs->fred_ss.type )
+        {
+        case X86_ET_HW_EXC:
+        case X86_ET_PRIV_SW_EXC:
+        case X86_ET_SW_EXC:
+            render_ec = true;
+            vec_name = vector_name(regs->fred_ss.vector);
+            break;
+
+        case X86_ET_OTHER:
+            vec_name = x86_et_other_name(regs->fred_ss.vector);
+            break;
+        }
+
+        if ( render_ec )
+            panic("FATAL TRAP: type %u, %s, vec %u, %s[%04x]%s\n",
+                  regs->fred_ss.type, x86_et_name(regs->fred_ss.type),
+                  regs->fred_ss.vector, vec_name ?: "",
+                  regs->error_code,
+                  (regs->eflags & X86_EFLAGS_IF) ? "" : " IN INTERRUPT CONTEXT");
+        else
+            panic("FATAL TRAP: type %u, %s, vec %u, %s%s\n",
+                  regs->fred_ss.type, x86_et_name(regs->fred_ss.type),
+                  regs->fred_ss.vector, vec_name ?: "",
+                  (regs->eflags & X86_EFLAGS_IF) ? "" : " IN INTERRUPT CONTEXT");
+    }
+
     panic("FATAL TRAP: vec %u, %s[%04x]%s\n",
           trapnr, vector_name(trapnr), regs->error_code,
           (regs->eflags & X86_EFLAGS_IF) ? "" : " IN INTERRUPT CONTEXT");
@@ -2200,6 +2265,96 @@ void asmlinkage check_ist_exit(const struct cpu_user_regs *regs, bool ist_exit)
 }
 #endif
 
+void asmlinkage entry_from_pv(struct cpu_user_regs *regs)
+{
+    /* Copy fred_ss.vector into entry_vector as IDT delivery would have done. */
+    regs->entry_vector = regs->fred_ss.vector;
+
+    fatal_trap(regs, false);
+}
+
+void asmlinkage entry_from_xen(struct cpu_user_regs *regs)
+{
+    struct fred_info *fi = cpu_regs_fred_info(regs);
+    uint8_t type = regs->fred_ss.type;
+
+    /* Copy fred_ss.vector into entry_vector as IDT delivery would have done. */
+    regs->entry_vector = regs->fred_ss.vector;
+
+    /*
+     * First, handle the asynchronous or fatal events.  These are either
+     * unrelated to the interrupted context, or may not have valid context
+     * recorded, and all have special rules on how/whether to re-enable IRQs.
+     */
+    if ( regs->fred_ss.nested )
+        goto fatal;
+
+    switch ( type )
+    {
+    case X86_ET_EXT_INTR:
+        return do_IRQ(regs);
+
+    case X86_ET_NMI:
+        return do_nmi(regs);
+
+    case X86_ET_HW_EXC:
+        switch ( regs->fred_ss.vector )
+        {
+        case X86_EXC_DF: return do_double_fault(regs);
+        case X86_EXC_MC: return do_machine_check(regs);
+        }
+        break;
+    }
+
+    /*
+     * With the asynchronous events handled, what remains are the synchronous
+     * ones.  If we interrupted an IRQs-on region, we should re-enable IRQs
+     * now; for #PF and #DB, %cr2 and PENDING_DBG are on the stack in edata.
+     */
+    if ( regs->eflags & X86_EFLAGS_IF )
+        local_irq_enable();
+
+    switch ( type )
+    {
+    case X86_ET_HW_EXC:
+    case X86_ET_PRIV_SW_EXC:
+    case X86_ET_SW_EXC:
+        switch ( regs->fred_ss.vector )
+        {
+        case X86_EXC_PF:  handle_PF(regs, fi->edata); break;
+        case X86_EXC_GP:  do_general_protection(regs); break;
+        case X86_EXC_UD:  do_invalid_op(regs); break;
+        case X86_EXC_NM:  do_device_not_available(regs); break;
+        case X86_EXC_BP:  do_int3(regs); break;
+        case X86_EXC_DB:  handle_DB(regs, fi->edata); break;
+        case X86_EXC_CP:  do_entry_CP(regs); break;
+
+        case X86_EXC_DE:
+        case X86_EXC_OF:
+        case X86_EXC_BR:
+        case X86_EXC_NP:
+        case X86_EXC_SS:
+        case X86_EXC_MF:
+        case X86_EXC_AC:
+        case X86_EXC_XM:
+            do_trap(regs);
+            break;
+
+        default:
+            goto fatal;
+        }
+        break;
+
+    default:
+        goto fatal;
+    }
+
+    return;
+
+ fatal:
+    fatal_trap(regs, false);
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/xen/arch/x86/x86_64/Makefile b/xen/arch/x86/x86_64/Makefile
index f207630887..c0a0b66032 100644
--- a/xen/arch/x86/x86_64/Makefile
+++ b/xen/arch/x86/x86_64/Makefile
@@ -1,5 +1,6 @@
 obj-$(CONFIG_PV32) += compat/
 
+obj-bin-y += entry-fred.o
 obj-bin-y += entry.o
 obj-$(CONFIG_KEXEC) += machine_kexec.o
 obj-y += pci.o
diff --git a/xen/arch/x86/x86_64/entry-fred.S b/xen/arch/x86/x86_64/entry-fred.S
new file mode 100644
index 0000000000..3c3320df22
--- /dev/null
+++ b/xen/arch/x86/x86_64/entry-fred.S
@@ -0,0 +1,33 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+        .file "x86_64/entry-fred.S"
+
+#include <asm/asm_defns.h>
+#include <asm/page.h>
+
+        .section .text.entry, "ax", @progbits
+
+        /* The Ring3 entry point is required to be 4k aligned. */
+
+FUNC(entry_FRED_R3, 4096)
+        PUSH_AND_CLEAR_GPRS
+
+        mov     %rsp, %rdi
+        call    entry_from_pv
+
+        POP_GPRS
+        eretu
+END(entry_FRED_R3)
+
+        /* The Ring0 entrypoint is at Ring3 + 0x100. */
+        .org entry_FRED_R3 + 0x100, 0xcc
+
+FUNC_LOCAL(entry_FRED_R0, 0)
+        PUSH_AND_CLEAR_GPRS
+
+        mov     %rsp, %rdi
+        call    entry_from_xen
+
+        POP_GPRS
+        erets
+END(entry_FRED_R0)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 03 18:12:24 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Mar 2026 18:12:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1245011.1544363 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxUEK-000438-A5; Tue, 03 Mar 2026 18:12:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1245011.1544363; Tue, 03 Mar 2026 18:12:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxUEK-000430-7V; Tue, 03 Mar 2026 18:12:24 +0000
Received: by outflank-mailman (input) for mailman id 1245011;
 Tue, 03 Mar 2026 18:12:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vxUEI-00042n-UA
 for xen-changelog@lists.xenproject.org; Tue, 03 Mar 2026 18:12:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxUEI-003Jhb-2v
 for xen-changelog@lists.xenproject.org;
 Tue, 03 Mar 2026 18:12:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxUEI-00Ejgg-2o
 for xen-changelog@lists.xenproject.org;
 Tue, 03 Mar 2026 18:12:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=vz95rcit0HVVeRewC6cvm86erjhu1Gx1v6ks8Xd2MxA=; b=hrrct6I2iCJMZuTqhgJOYSCnNC
	wbHOPemx+aeB1Beo/dzD41cjQV489zWLn57Txftdrx6mRNmGohhU2tweH8arjRIPqnp02EEAZnNPQ
	563cQxO7L8Ufhmeizz+kba3qwuU6EM7cWe0txki5dGO0pFT7+arc5FeVGJZmuIzGeZMc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/traps: Enable FRED when requested
Message-Id: <E1vxUEI-00Ejgg-2o@xenbits.xenproject.org>
Date: Tue, 03 Mar 2026 18:12:22 +0000

commit bbfb30f649fc11281b091b91fd353954df1354a0
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Dec 24 11:03:06 2024 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 3 15:15:54 2026 +0000

    x86/traps: Enable FRED when requested
    
    With the shadow stack and exception handling adjustements in place, we can now
    activate FRED when appropriate.  Note that opt_fred is still disabled by
    default until more development is complete.
    
    Introduce init_fred() to set up all the MSRs relevant for FRED.  FRED uses
    MSR_STAR (entries from Ring3 only), and MSR_FRED_SSP_SL0 aliases MSR_PL0_SSP
    when CET-SS is active.  Otherwise, they're all new MSRs.
    
    Also introduce init_fred_tss().  At this juncture we need a TSS set up, even
    if it is mostly unused.  Reinsert the BUILD_BUG_ON() checking the size of the
    TSS against 0x67, this time with a more precise comment.
    
    With init_fred() existing, load_system_tables() and legacy_syscall_init()
    should only be used when setting up IDT delivery.  Insert ASSERT()s to this
    effect, and adjust the various init functions to make this property true.
    
    The FRED initialisation path still needs to write to all system table
    registers at least once, even if only to invalidate them.  Per the
    documentation, percpu_early_traps_init() is responsible for switching off the
    boot GDT, which also needs doing even in FRED mode.
    
    Finally, set CR4.FRED in traps_init()/percpu_early_traps_init().
    
    Xen can now boot in FRED mode and run a PVH dom0.  PV guests still need more
    work before they can be run under FRED.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/include/asm/current.h |   3 +
 xen/arch/x86/include/asm/traps.h   |   2 +
 xen/arch/x86/traps-setup.c         | 130 +++++++++++++++++++++++++++++++++++--
 3 files changed, 130 insertions(+), 5 deletions(-)

diff --git a/xen/arch/x86/include/asm/current.h b/xen/arch/x86/include/asm/current.h
index 62817e8476..6139980ab1 100644
--- a/xen/arch/x86/include/asm/current.h
+++ b/xen/arch/x86/include/asm/current.h
@@ -23,6 +23,9 @@
  * 2 - NMI IST stack
  * 1 - #MC IST stack
  * 0 - IST Shadow Stacks (4x 1k, read-only)
+ *
+ * In FRED mode, #DB and NMI do not need special stacks, so their IST stacks
+ * are unused.
  */
 
 /*
diff --git a/xen/arch/x86/include/asm/traps.h b/xen/arch/x86/include/asm/traps.h
index 73097e957d..5d7504bc44 100644
--- a/xen/arch/x86/include/asm/traps.h
+++ b/xen/arch/x86/include/asm/traps.h
@@ -16,6 +16,8 @@ void traps_init(void);
 void bsp_traps_reinit(void);
 void percpu_traps_init(void);
 
+void nocall entry_FRED_R3(void);
+
 extern unsigned int ler_msr;
 
 const char *vector_name(unsigned int vec);
diff --git a/xen/arch/x86/traps-setup.c b/xen/arch/x86/traps-setup.c
index b2c161943d..9b8301c23e 100644
--- a/xen/arch/x86/traps-setup.c
+++ b/xen/arch/x86/traps-setup.c
@@ -59,6 +59,8 @@ static void load_system_tables(void)
         .limit = sizeof(bsp_idt) - 1,
     };
 
+    ASSERT(opt_fred == 0);
+
     /*
      * Set up the TSS.  Warning - may be live, and the NMI/#MC must remain
      * valid on every instruction boundary.  (Note: these are all
@@ -191,6 +193,8 @@ static void legacy_syscall_init(void)
     unsigned char *stub_page;
     unsigned int offset;
 
+    ASSERT(opt_fred == 0);
+
     /* No PV guests?  No need to set up SYSCALL/SYSENTER infrastructure. */
     if ( !IS_ENABLED(CONFIG_PV) )
         return;
@@ -268,6 +272,76 @@ static void __init init_ler(void)
     setup_force_cpu_cap(X86_FEATURE_XEN_LBR);
 }
 
+/*
+ * Set up all MSRs relevant for FRED event delivery.
+ *
+ * Xen does not use any of the optional config in MSR_FRED_CONFIG, so all that
+ * is needed is the entrypoint.
+ *
+ * Because FRED always provides a good stack, NMI and #DB do not need any
+ * special treatment.  Only #DF needs another stack level, and #MC for the
+ * off-chance that Xen's main stack suffers an uncorrectable error.
+ *
+ * This makes Stack Level 1 unused, but we use #DB's stacks, and with the
+ * regular and shadow stack pointers reversed as poison to guarantee that any
+ * use escalates to #DF.
+ *
+ * FRED reuses MSR_STAR to provide the segment selector values to load on
+ * entry from Ring3.  Entry from Ring0 leave %cs and %ss unmodified.
+ */
+static void init_fred(void)
+{
+    unsigned long stack_top = get_stack_bottom() & ~(STACK_SIZE - 1);
+
+    ASSERT(opt_fred == 1);
+
+    wrmsrns(MSR_STAR, XEN_MSR_STAR);
+    wrmsrns(MSR_FRED_CONFIG, (unsigned long)entry_FRED_R3);
+
+    /*
+     * MSR_FRED_RSP_* all come with an 64-byte alignment check, avoiding the
+     * need for an explicit BUG_ON().
+     */
+    wrmsrns(MSR_FRED_RSP_SL0, (unsigned long)(&get_cpu_info()->_fred + 1));
+    wrmsrns(MSR_FRED_RSP_SL1, stack_top + (IST_DB * IST_SHSTK_SIZE)); /* Poison */
+    wrmsrns(MSR_FRED_RSP_SL2, stack_top + (1 + IST_MCE)  * PAGE_SIZE);
+    wrmsrns(MSR_FRED_RSP_SL3, stack_top + (1 + IST_DF)   * PAGE_SIZE);
+    wrmsrns(MSR_FRED_STK_LVLS, ((2UL << (X86_EXC_MC * 2)) |
+                                (3UL << (X86_EXC_DF * 2))));
+
+    if ( cpu_has_xen_shstk )
+    {
+        wrmsrns(MSR_FRED_SSP_SL0, stack_top + (PRIMARY_SHSTK_SLOT + 1) * PAGE_SIZE);
+        wrmsrns(MSR_FRED_SSP_SL1, stack_top + (1 + IST_DB) * PAGE_SIZE); /* Poison */
+        wrmsrns(MSR_FRED_SSP_SL2, stack_top + (IST_MCE * IST_SHSTK_SIZE));
+        wrmsrns(MSR_FRED_SSP_SL3, stack_top + (IST_DF  * IST_SHSTK_SIZE));
+    }
+}
+
+/*
+ * Set up a minimal TSS and selector for use in FRED mode.
+ *
+ * With FRED moving the stack pointers into MSRs, we would like to avoid
+ * having a TSS at all, but:
+ *  - VT-x VMExit unconditionally sets TR.limit to 0x67, meaning that
+ *    HOST_TR_BASE needs to point to a good TSS.
+ *  - show_stack_overflow() cross-checks tss->rsp0.
+ *
+ * Fill in rsp0 and the bitmap offset, and load a zero-length TR.  If VT-x
+ * does get used, it will clobber TR to refer to this_cpu(tss_page).tss.
+ */
+static void init_fred_tss(void)
+{
+    seg_desc_t *gdt = this_cpu(gdt) - FIRST_RESERVED_GDT_ENTRY;
+    struct tss64 *tss = &this_cpu(tss_page).tss;
+
+    tss->rsp0 = get_stack_bottom();
+    tss->bitmap = IOBMP_INVALID_OFFSET;
+
+    _set_tssldt_desc(gdt + TSS_ENTRY, 0, 0, SYS_DESC_tss_avail);
+    ltr(TSS_SELECTOR);
+}
+
 /*
  * Configure basic exception handling.  This is prior to parsing the command
  * line or configuring a console, and needs to be as simple as possible.
@@ -322,6 +396,8 @@ void __init traps_init(void)
 
     if ( opt_fred )
     {
+        const struct desc_ptr idtr = {};
+
 #ifdef CONFIG_PV32
         if ( opt_pv32 )
         {
@@ -329,16 +405,27 @@ void __init traps_init(void)
             printk(XENLOG_INFO "Disabling PV32 due to FRED\n");
         }
 #endif
+
+        init_fred();
+        set_in_cr4(X86_CR4_FRED);
+
+        /*
+         * Invalidate the IDT as it's not used.  Set up a minimal TSS.  The
+         * LDT was configured by bsp_early_traps_init().
+         */
+        lidt(&idtr);
+        init_fred_tss();
+
         setup_force_cpu_cap(X86_FEATURE_XEN_FRED);
         printk("Using FRED event delivery\n");
     }
     else
     {
+        load_system_tables();
+
         printk("Using IDT event delivery\n");
     }
 
-    load_system_tables();
-
     init_ler();
 
     percpu_traps_init();
@@ -353,7 +440,11 @@ void __init traps_init(void)
  */
 void __init bsp_traps_reinit(void)
 {
-    load_system_tables();
+    if ( opt_fred )
+        init_fred();
+    else
+        load_system_tables();
+
     percpu_traps_init();
 }
 
@@ -368,7 +459,7 @@ void percpu_traps_init(void)
      * allocated, limiting the placement of the traps_init() call, and gets
      * re-done anyway by bsp_traps_reinit().
      */
-    if ( system_state > SYS_STATE_early_boot )
+    if ( !opt_fred && system_state > SYS_STATE_early_boot )
         legacy_syscall_init();
 
     if ( cpu_has_xen_lbr )
@@ -384,7 +475,29 @@ void percpu_traps_init(void)
  */
 void asmlinkage percpu_early_traps_init(void)
 {
-    load_system_tables();
+    if ( opt_fred )
+    {
+        seg_desc_t *gdt = this_cpu(gdt) - FIRST_RESERVED_GDT_ENTRY;
+        const struct desc_ptr gdtr = {
+            .base = (unsigned long)gdt,
+            .limit = LAST_RESERVED_GDT_BYTE,
+        }, idtr = {};
+
+        lgdt(&gdtr);
+
+        init_fred();
+        write_cr4(read_cr4() | X86_CR4_FRED);
+
+        /*
+         * Invalidate the IDT (not used) and LDT (not set up yet).  Set up a
+         * minimal TSS.
+         */
+        lidt(&idtr);
+        init_fred_tss();
+        lldt(0);
+    }
+    else
+        load_system_tables();
 }
 
 static void __init __maybe_unused build_assertions(void)
@@ -403,4 +516,11 @@ static void __init __maybe_unused build_assertions(void)
                   endof_field(struct cpu_info, guest_cpu_user_regs)) & 15);
     BUILD_BUG_ON((sizeof(struct cpu_info) -
                   endof_field(struct cpu_info, _fred)) & 63);
+
+    /*
+     * The x86 architecture is happy with TR.limit being less than 0x67, but
+     * VT-x is not.  VMExit unconditionally sets the limit to 0x67, meaning
+     * that HOST_TR_BASE needs to refer to a good TSS of at least this size.
+     */
+    BUILD_BUG_ON(sizeof(struct tss64) <= 0x67);
 }
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 03 19:22:06 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Mar 2026 19:22:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1245035.1544383 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxVJj-0003ze-At; Tue, 03 Mar 2026 19:22:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1245035.1544383; Tue, 03 Mar 2026 19:22:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxVJj-0003zX-8K; Tue, 03 Mar 2026 19:22:03 +0000
Received: by outflank-mailman (input) for mailman id 1245035;
 Tue, 03 Mar 2026 19:22:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vxVJi-0003zR-DI
 for xen-changelog@lists.xenproject.org; Tue, 03 Mar 2026 19:22:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxVJi-003L7I-19
 for xen-changelog@lists.xenproject.org;
 Tue, 03 Mar 2026 19:22:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxVJi-00EnwQ-11
 for xen-changelog@lists.xenproject.org;
 Tue, 03 Mar 2026 19:22:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=IiuR0mIvzCqoA5bWG7GnsdWJB0jtgyysu9Ie/x7L/rw=; b=z/uAnhOLtpX7xfseL8sW0eJjQe
	gs8a1Ylmt/LqhzlULwABaRKo2IDz4OoIsolkH+gpRzciIZx+Cq926m/OWJfzmBfGo7PYAUezJqLZp
	PNKNMdHQqDI1+tWhdjH0oNDm2Q33pK8bLFcjjhr5x5noefaz9+cI9IwFCb6BwlwWODgI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/ucode: Support discrete modules being CPIO archives
Message-Id: <E1vxVJi-00EnwQ-11@xenbits.xenproject.org>
Date: Tue, 03 Mar 2026 19:22:02 +0000

commit 878a9cfa451878dcba6108ae5b7879c80f049661
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Jan 27 14:25:26 2026 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 3 15:15:53 2026 +0000

    x86/ucode: Support discrete modules being CPIO archives
    
    Multiple downstream distros have tried passing discrete CPIO archives and
    tripped over this not working.  It turns out to be easy to support, so do so.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Tested-by: Teddy Astie <teddy.astie@vates.tech>
---
 CHANGELOG.md                      |  1 +
 docs/misc/xen-command-line.pandoc | 19 ++++++++-----------
 xen/arch/x86/cpu/microcode/core.c | 20 +++++++++++++++++++-
 3 files changed, 28 insertions(+), 12 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 18f3d10f20..c191e504ab 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -13,6 +13,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
    - Support for Bus Lock Threshold on AMD Zen5 and later CPUs, used by Xen to
      mitigate (by rate-limiting) the system wide impact of an HVM guest
      misusing atomic instructions.
+   - Support for CPIO microcode in discrete multiboot modules.
 
 ### Removed
  - On x86:
diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index c1f2def9f9..ebdca007d2 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -2764,23 +2764,20 @@ Controls for CPU microcode loading, available when `CONFIG_MICROCODE_LOADING`
 is enabled.
 
 In order to load microcode at boot, Xen needs to find a suitable update
-amongst the modules provided by the bootloader.  Two kinds of microcode update
-are supported:
+amongst the modules provided by the bootloader.  Two formats are supported:
 
  1. Raw microcode containers.  The format of the container is CPU vendor
     specific.
 
- 2. CPIO archive.  This is Linux's preferred mechanism, and involves having
-    the raw containers expressed as files
+ 2. CPIO archive, which involves having the raw containers expressed as files
     (e.g. `kernel/x86/microcode/{GenuineIntel,AuthenticAMD}.bin`) in a CPIO
-    archive, typically prepended to the initrd.
+    archive.  Linux commonly prepends this to the initrd.
 
-The `<integer>` and `scan=<bool>` options are mutually exclusive and select
-between these two options.  Further restrictions exist for booting xen.efi
-(see below).
+The `<integer>` and `scan=<bool>` options are mutually exclusive and work as
+follows.  Further restrictions exist for booting xen.efi (see below).
 
- *  The `<integer>` option nominates a specific multiboot module as a raw
-    container (option 1 above).  Valid options start from 1 (module 0 is
+ *  The `<integer>` option nominates a specific multiboot module as containing
+    microcode in either format.  Valid options start from 1 (module 0 is
     always the dom0 kernel).  A negative number may be used, and will
     back-reference from the end of the module list.  i.e. `ucode=-1` will
     nominate the final multiboot module.
@@ -2794,7 +2791,7 @@ When booting xen.efi natively, the concept of multiboot modules doesn't exist.
 Instead:
 
  *  In the [EFI configuration file](efi.html), `ucode=<filename>` can be used
-    to identify a file as a raw container (option 1 above).  Use of this
+    to identify a file as containing microcode in either format.  Use of this
     mechanism will disable both `<integer>` and `scan=`.
 
  *  If `ucode=<filename>` in the EFI configuration file is not used, it is
diff --git a/xen/arch/x86/cpu/microcode/core.c b/xen/arch/x86/cpu/microcode/core.c
index ea0b35c499..9b8d1e09cb 100644
--- a/xen/arch/x86/cpu/microcode/core.c
+++ b/xen/arch/x86/cpu/microcode/core.c
@@ -767,6 +767,7 @@ static int __init early_microcode_load(struct boot_info *bi)
     void *data = NULL;
     size_t size;
     const struct microcode_patch *patch;
+    struct cpio_data cd;
     int idx = opt_mod_idx;
     int rc;
 
@@ -783,7 +784,6 @@ static int __init early_microcode_load(struct boot_info *bi)
         for ( idx = 0; idx < bi->nr_modules; ++idx )
         {
             const struct boot_module *bm = &bi->mods[idx];
-            struct cpio_data cd;
 
             /* Search anything unclaimed or likely to be a CPIO archive. */
             if ( bm->kind != BOOTMOD_UNKNOWN && bm->kind != BOOTMOD_RAMDISK )
@@ -851,6 +851,24 @@ static int __init early_microcode_load(struct boot_info *bi)
                    idx, size);
             return -ENODEV;
         }
+
+        /*
+         * If this blob appears to be a CPIO archive, try interpreting it as
+         * one.  Otherwise treat it as a raw vendor blob.
+         */
+        cd = find_cpio_data(ucode_ops.cpio_path, data, size);
+        if ( cd.data )
+        {
+            data = cd.data;
+            size = cd.size;
+
+            /*
+             * (Ab)use opt_scan to inform microcode_init_cache() that
+             * early_mod_idx refers to a CPIO archive.
+             */
+            opt_scan = true;
+        }
+
         goto found;
     }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 03 19:22:13 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Mar 2026 19:22:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1245036.1544389 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxVJt-00041Q-E3; Tue, 03 Mar 2026 19:22:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1245036.1544389; Tue, 03 Mar 2026 19:22:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxVJt-00041I-9w; Tue, 03 Mar 2026 19:22:13 +0000
Received: by outflank-mailman (input) for mailman id 1245036;
 Tue, 03 Mar 2026 19:22:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vxVJs-00041A-GW
 for xen-changelog@lists.xenproject.org; Tue, 03 Mar 2026 19:22:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxVJs-003L7R-1V
 for xen-changelog@lists.xenproject.org;
 Tue, 03 Mar 2026 19:22:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxVJs-00EnxE-1K
 for xen-changelog@lists.xenproject.org;
 Tue, 03 Mar 2026 19:22:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=wfXcaWe1pt/23t5B2RDRegWyfYbZjBdzZFh0XOabMnI=; b=I/B0GwdgPsZUb6wew+MNuusdq6
	WucdljXTDp3RcWMMASYQOn0FPRQUq4Z7oBydYZZ2hRX+XfxGYIF9rNM1/bUoFtObSRRtd1MzowEWz
	wJIY+ciGYOvLbbe/mQ/oRlhNN3CDnfFNLU8eK5j/cCftYLGDKq7Y8WvZ0hn86ztknvbY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/pv: Don't assume that INT $imm8 instructions are two bytes long
Message-Id: <E1vxVJs-00EnxE-1K@xenbits.xenproject.org>
Date: Tue, 03 Mar 2026 19:22:12 +0000

commit a934a600c45486b7acfe8abc3658e284e64e5dd5
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Feb 19 13:20:26 2026 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 3 15:15:53 2026 +0000

    x86/pv: Don't assume that INT $imm8 instructions are two bytes long
    
    For INT $N instructions (besides $0x80 for which there is a dedicated fast
    path), handling is mostly fault-based because of DPL0 gates in the IDT.  This
    means that when the guest kernel allows the instruction too, Xen must
    increment %rip to the end of the instruction before passing a trap to the
    guest kernel.
    
    When an INT $N instruction has a prefix, it's longer than two bytes, and Xen
    will deliver the "trap" with %rip pointing into the middle of the instruction.
    
    Introduce a new pv_emulate_sw_interrupt() which uses x86_insn_length() to
    determine the instruction length, rather than assuming two.
    
    This is a change in behaviour for PV guests, but the prior behaviour cannot
    reasonably be said to be intentional.
    
    This change does not affect the INT $0x80 fastpath.  Prefixed INT $N
    instructions occur almost exclusively in test code or exploits, and INT $0x80
    appears to be the only user-usable interrupt gate in contemporary PV guests.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/include/asm/pv/traps.h |  2 ++
 xen/arch/x86/pv/emul-priv-op.c      | 49 +++++++++++++++++++++++++++++++++++++
 xen/arch/x86/traps.c                |  3 +--
 3 files changed, 52 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/include/asm/pv/traps.h b/xen/arch/x86/include/asm/pv/traps.h
index 8c20119092..16e9a8d2aa 100644
--- a/xen/arch/x86/include/asm/pv/traps.h
+++ b/xen/arch/x86/include/asm/pv/traps.h
@@ -17,6 +17,7 @@
 int pv_raise_nmi(struct vcpu *v);
 
 int pv_emulate_privileged_op(struct cpu_user_regs *regs);
+void pv_emulate_sw_interrupt(struct cpu_user_regs *regs);
 void pv_emulate_gate_op(struct cpu_user_regs *regs);
 bool pv_emulate_invalid_op(struct cpu_user_regs *regs);
 
@@ -31,6 +32,7 @@ static inline bool pv_trap_callback_registered(const struct vcpu *v,
 static inline int pv_raise_nmi(struct vcpu *v) { return -EOPNOTSUPP; }
 
 static inline int pv_emulate_privileged_op(struct cpu_user_regs *regs) { return 0; }
+static inline void pv_emulate_sw_interrupt(struct cpu_user_regs *regs) {}
 static inline void pv_emulate_gate_op(struct cpu_user_regs *regs) {}
 static inline bool pv_emulate_invalid_op(struct cpu_user_regs *regs) { return true; }
 
diff --git a/xen/arch/x86/pv/emul-priv-op.c b/xen/arch/x86/pv/emul-priv-op.c
index fba1e25c31..64d47ab677 100644
--- a/xen/arch/x86/pv/emul-priv-op.c
+++ b/xen/arch/x86/pv/emul-priv-op.c
@@ -8,6 +8,7 @@
  */
 
 #include <xen/domain_page.h>
+#include <xen/err.h>
 #include <xen/event.h>
 #include <xen/guest_access.h>
 #include <xen/hypercall.h>
@@ -1401,6 +1402,54 @@ int pv_emulate_privileged_op(struct cpu_user_regs *regs)
     return 0;
 }
 
+/*
+ * Hardware already decoded the INT $N instruction and determined that there
+ * was a permission issue (i.e. the DPL violation intended to trigger #GP).
+ * Xen has already determined that the guest kernel has permitted this
+ * software interrupt.
+ *
+ * All that is needed is the instruction length, to turn the fault into a
+ * trap.  All errors are turned back into the original #GP, as that's the
+ * action that really happened.
+ */
+void pv_emulate_sw_interrupt(struct cpu_user_regs *regs)
+{
+    struct vcpu *curr = current;
+    struct domain *currd = curr->domain;
+    struct priv_op_ctxt ctxt = {
+        .ctxt.regs = regs,
+        .ctxt.lma = !is_pv_32bit_domain(currd),
+    };
+    struct x86_emulate_state *state;
+    uint8_t vector = regs->error_code >> 3;
+    unsigned int len, ar;
+
+    if ( !pv_emul_read_descriptor(regs->cs, curr, &ctxt.cs.base,
+                                  &ctxt.cs.limit, &ar, 1) ||
+         !(ar & _SEGMENT_S) ||
+         !(ar & _SEGMENT_P) ||
+         !(ar & _SEGMENT_CODE) )
+        goto error;
+
+    state = x86_decode_insn(&ctxt.ctxt, insn_fetch);
+    if ( IS_ERR_OR_NULL(state) )
+        goto error;
+
+    len = x86_insn_length(state, &ctxt.ctxt);
+    x86_emulate_free_state(state);
+
+    /* Note: Checked slightly late to simplify 'state' handling. */
+    if ( ctxt.ctxt.opcode != 0xcd /* INT $imm8 */ )
+        goto error;
+
+    regs->rip += len;
+    pv_inject_sw_interrupt(vector);
+    return;
+
+ error:
+    pv_inject_hw_exception(X86_EXC_GP, regs->error_code);
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index 3c01c5eb53..bcae704d96 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -1379,8 +1379,7 @@ void do_general_protection(struct cpu_user_regs *regs)
 
         if ( permit_softint(TI_GET_DPL(ti), v, regs) )
         {
-            regs->rip += 2;
-            pv_inject_sw_interrupt(vector);
+            pv_emulate_sw_interrupt(regs);
             return;
         }
     }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 03 19:22:24 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Mar 2026 19:22:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1245037.1544392 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxVK4-00043i-E1; Tue, 03 Mar 2026 19:22:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1245037.1544392; Tue, 03 Mar 2026 19:22:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxVK4-00043Z-BO; Tue, 03 Mar 2026 19:22:24 +0000
Received: by outflank-mailman (input) for mailman id 1245037;
 Tue, 03 Mar 2026 19:22:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vxVK2-00043M-JB
 for xen-changelog@lists.xenproject.org; Tue, 03 Mar 2026 19:22:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxVK2-003L7V-1p
 for xen-changelog@lists.xenproject.org;
 Tue, 03 Mar 2026 19:22:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxVK2-00Enxu-1f
 for xen-changelog@lists.xenproject.org;
 Tue, 03 Mar 2026 19:22:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Q0lhyx34frkirpQJsvsnu9kMOCKW3OMtmrZIxAbIVMA=; b=O9nsGQ9e9wHgURuy/6G28pBaGc
	Ol5HDUaAqN/5F+lQ7tkTOqyW2X4S+YZYQ4sntZtdVnecBZ3pX71eAO6dcG/W4LFCp96GAaI1G9ZhH
	/YLPkD29eBY1o6Qt/hYplfVCMfTTZlYPiUI/WhzZHOmXG1x8piycPpYjXdRcWVBa+Epw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] docs/guest-guide: Describe the PV traps and entrypoints ABI
Message-Id: <E1vxVK2-00Enxu-1f@xenbits.xenproject.org>
Date: Tue, 03 Mar 2026 19:22:22 +0000

commit 31cbb8e2a52a5470d375ad725b9771da670f6d62
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Feb 19 13:20:26 2026 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 3 15:15:53 2026 +0000

    docs/guest-guide: Describe the PV traps and entrypoints ABI
    
    ... seeing as I've had to thoroughly reverse engineer it for FRED and make
    tweaks in places.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 docs/glossary.rst                 |   3 +
 docs/guest-guide/x86/index.rst    |   1 +
 docs/guest-guide/x86/pv-traps.rst | 126 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 130 insertions(+)

diff --git a/docs/glossary.rst b/docs/glossary.rst
index 6adeec77e1..5c3229a8c4 100644
--- a/docs/glossary.rst
+++ b/docs/glossary.rst
@@ -43,6 +43,9 @@ Glossary
      Sapphire Rapids (Server, 2023) CPUs.  AMD support only CET-SS, starting
      with Zen3 (Both client and server, 2020) CPUs.
 
+   event channel
+     A paravirtual facility for guests to send and receive interrupts.
+
    guest
      The term 'guest' has two different meanings, depending on context, and
      should not be confused with :term:`domain`.
diff --git a/docs/guest-guide/x86/index.rst b/docs/guest-guide/x86/index.rst
index 502968490d..5b38ae397a 100644
--- a/docs/guest-guide/x86/index.rst
+++ b/docs/guest-guide/x86/index.rst
@@ -7,3 +7,4 @@ x86
    :maxdepth: 2
 
    hypercall-abi
+   pv-traps
diff --git a/docs/guest-guide/x86/pv-traps.rst b/docs/guest-guide/x86/pv-traps.rst
new file mode 100644
index 0000000000..c10001e023
--- /dev/null
+++ b/docs/guest-guide/x86/pv-traps.rst
@@ -0,0 +1,126 @@
+.. SPDX-License-Identifier: CC-BY-4.0
+
+PV Traps and Entrypoints
+========================
+
+.. note::
+
+   The details here are specific to 64bit builds of Xen.  Details for 32bit
+   builds of Xen are different and not discussed further.
+
+PV guests are subject to Xen's linkage setup for events (interrupts,
+exceptions and system calls).  x86's IDT architecture and limitations are the
+majority influence on the PV ABI.
+
+All external interrupts are routed to PV guests via the :term:`Event Channel`
+interface, and not discussed further here.
+
+What remain are exceptions, and the instructions which cause control
+transfers.  In the x86 architecture, the instructions relevant for PV guests
+are:
+
+ * ``INT3``, which generates ``#BP``.
+
+ * ``INTO``, which generates ``#OF`` only if the overflow flag is set.  It is
+   only usable in compatibility mode, and will ``#UD`` in 64bit mode.
+
+ * ``CALL (far)`` referencing a gate in the GDT.
+
+ * ``INT $N``, which invokes an arbitrary IDT gate.  These four instructions
+   so far all check the gate DPL and will ``#GP`` otherwise.
+
+ * ``INT1``, also known as ``ICEBP``, which generates ``#DB``.  This
+   instruction does *not* check DPL, and can be used unconditionally by
+   userspace.
+
+ * ``SYSCALL``, which enters CPL0 as configured by the ``{C,L,}STAR`` MSRs.
+   It is usable if enabled by ``MSR_EFER.SCE``, and will ``#UD`` otherwise.
+   On Intel parts, ``SYSCALL`` is unusable outside of 64bit mode.
+
+ * ``SYSENTER``, which enters CPL0 as configured by the ``SEP`` MSRs.  It is
+   usable if enabled by ``MSR_SYSENTER_CS`` having a non-NUL selector, and
+   will ``#GP`` otherwise.  On AMD parts, ``SYSENTER`` is unusable in Long
+   mode.
+
+The ``BOUND`` instruction is not included.  It is a hardware exception and
+strictly a fault, with no trapping configuraton.
+
+
+Xen's configuration
+-------------------
+
+Xen maintains a complete IDT, with most gates configured with DPL0.  This
+causes most ``INT $N`` instructions to ``#GP``.  This allows Xen to emulate
+the instruction, referring to the guest kernels vDPL choice.
+
+ * Vectors 3 ``#BP`` and 4 ``#OF`` are DPL3, in order to allow the ``INT3``
+   and ``INTO`` instructions to function in userspace.
+
+ * Vector 0x80 is DPL3 because of it's common usage for syscall in UNIXes.
+   This is a fastpath to avoid the emulation overhead.
+
+ * Vector 0x82 is DPL1 when PV32 is enabled, allowing the guest kernel to make
+   hypercalls to Xen.  All other cases (PV32 guest userspace, and both PV64
+   modes) operate in CPL3 and this vector behaves like all others to ``INT
+   $N`` instructions.
+
+A range of the GDT is guest-owned, allowing for call gates.  During audit, Xen
+forces all call gates to DPL0, causing their use to ``#GP`` allowing for
+emulation.
+
+Xen enables ``SYSCALL`` in all cases as it is mandatory in 64bit mode, and
+enables ``SYSENTER`` when available in 64bit mode.
+
+When Xen is using FRED delivery the hardware configuration is substantially
+different, but the behaviour for guests remains as unchanged as possible.
+
+
+PV Guest's configuration
+------------------------
+
+The PV ABI contains the "trap table", modelled closely on the IDT.  It is
+manipulated by ``HYPERCALL_set_trap_table``, has 256 entries, each containing
+a code segment selector, an address, and flags.  A guest is expected to
+configure handlers for all exceptions; failure to do so is terminal and
+similar to a Triple Fault.
+
+Part of the GDT is guest owned with descriptors audited by Xen.  This range
+can be manipulated with ``HYPERVISOR_set_gdt`` and
+``HYPERVISOR_update_descriptor``.
+
+Other entrypoints are configured via ``HYPERVISOR_callback_op``.  Of note here
+are the callback types ``syscall``, ``syscall32`` (relevant for AMD parts) and
+``sysenter`` (relevant for Intel parts).
+
+.. warning::
+
+   Prior to Xen 4.15, there was no check that the ``syscall`` or ``syscall32``
+   callbacks had been registered before attempting to deliver via them.
+   Guests are strongly advised to ensure the entrypoints are registered before
+   running userspace.
+
+
+Notes
+-----
+
+``INT3`` vs ``INT $3`` and ``INTO`` vs ``INT $4`` are hard to distinguish
+architecturally as both forms have a DPL check and use the same IDT vectors.
+Because Xen configures both as DPL3, the ``INT $`` forms do not fault for
+emulation, and are treated as if they were exceptions.  This means the guest
+can't block these instruction by trying to configure them with vDPL0.
+
+The instructions which trap into Xen (``INT $0x80``, ``SYSCALL``,
+``SYSENTER``) but can be disabled by guest configuration need turning back
+into faults for the guest kernel to process.
+
+ * When using IDT delivery, instruction lengths are not provided by hardware
+   and Xen does not account for possible prefixes.  ``%rip`` only gets rewound
+   by the length of the un-prefixed instruction.  This is observable, but not
+   expected to be an issue in practice.
+
+ * When Xen is using FRED delivery, the full instruction length is provided by
+   hardware, and ``%rip`` is rewound fully.
+
+While both PV32 and PV64 guests are permitted to write Call Gates into the
+GDT, emulation is only wired up for PV32.  At the time of writing, the x86
+maintainers feel no specific need to fix this omission.
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 03 19:22:34 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Mar 2026 19:22:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1245038.1544396 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxVKE-000460-FU; Tue, 03 Mar 2026 19:22:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1245038.1544396; Tue, 03 Mar 2026 19:22:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxVKE-00045s-Cl; Tue, 03 Mar 2026 19:22:34 +0000
Received: by outflank-mailman (input) for mailman id 1245038;
 Tue, 03 Mar 2026 19:22:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vxVKC-00045L-Nx
 for xen-changelog@lists.xenproject.org; Tue, 03 Mar 2026 19:22:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxVKC-003L7Z-2I
 for xen-changelog@lists.xenproject.org;
 Tue, 03 Mar 2026 19:22:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxVKC-00EnyQ-20
 for xen-changelog@lists.xenproject.org;
 Tue, 03 Mar 2026 19:22:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=mZBMf60GQZK04+/qYSgOs3Tis9JfipIztub5C7Ezhc0=; b=WtCq2XTNVGssoB99iTTI106Eh1
	RhCSh7frXR//E2BucoGiPdzMaNmeEp04bBJACmZwntjEg09s+fk2lIZa34jajT8Vqa6A0844Wc9o6
	3Y6LBE344L0AhjhojVo/Aa7ExWJDF4Nt8qxzeIqA7aLiDi4g9h98tcG+uiWDg4Fv+gEo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/boot: Move gdt_l1e caching out of traps_init()
Message-Id: <E1vxVKC-00EnyQ-20@xenbits.xenproject.org>
Date: Tue, 03 Mar 2026 19:22:32 +0000

commit a1e6afbf54283be0ea3db9bf6cb046c683fcf684
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Feb 13 23:45:28 2026 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 3 15:15:54 2026 +0000

    x86/boot: Move gdt_l1e caching out of traps_init()
    
    Commit 564d261687c0 ("x86/ctxt-switch: Document and improve GDT handling") put
    the initialisation of {,compat_}gdt_l1e into traps_init() but this wasn't a
    great choice.  Instead, put it in smp_prepare_cpus() which performs the BSP
    preparation of variables normally set up by cpu_smpboot_alloc() for APs.
    
    This removes an implicit dependency that prevents traps_init() moving earlier
    than move_xen() in the boot sequence.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/domain.c      |  2 ++
 xen/arch/x86/smpboot.c     | 11 +++++++++++
 xen/arch/x86/traps-setup.c |  7 -------
 3 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index 8eb1509782..e658c2d647 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -2029,6 +2029,8 @@ static always_inline bool need_full_gdt(const struct domain *d)
 
 static void update_xen_slot_in_full_gdt(const struct vcpu *v, unsigned int cpu)
 {
+    ASSERT(per_cpu(gdt_l1e, cpu).l1); /* Confirm these have been cached. */
+
     l1e_write(pv_gdt_ptes(v) + FIRST_RESERVED_GDT_PAGE,
               !is_pv_32bit_vcpu(v) ? per_cpu(gdt_l1e, cpu)
                                    : per_cpu(compat_gdt_l1e, cpu));
diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c
index 961bdf5333..491cbbba33 100644
--- a/xen/arch/x86/smpboot.c
+++ b/xen/arch/x86/smpboot.c
@@ -1167,6 +1167,17 @@ void __init smp_prepare_cpus(void)
     initialize_cpu_data(0); /* Final full version of the data */
     print_cpu_info(0);
 
+    /*
+     * Cache {,compat_}gdt_l1e for the BSP now that physically relocation is
+     * done.  It must be after physical relocation of Xen, and before the
+     * first context_switch().
+     */
+    this_cpu(gdt_l1e) =
+        l1e_from_pfn(virt_to_mfn(boot_gdt), __PAGE_HYPERVISOR_RW);
+    if ( IS_ENABLED(CONFIG_PV32) )
+        this_cpu(compat_gdt_l1e) =
+            l1e_from_pfn(virt_to_mfn(boot_compat_gdt), __PAGE_HYPERVISOR_RW);
+
     boot_cpu_physical_apicid = get_apic_id();
     x86_cpu_to_apicid[0] = boot_cpu_physical_apicid;
 
diff --git a/xen/arch/x86/traps-setup.c b/xen/arch/x86/traps-setup.c
index d77be8f839..c5fc71c75b 100644
--- a/xen/arch/x86/traps-setup.c
+++ b/xen/arch/x86/traps-setup.c
@@ -341,13 +341,6 @@ void __init traps_init(void)
 
     init_ler();
 
-    /* Cache {,compat_}gdt_l1e now that physically relocation is done. */
-    this_cpu(gdt_l1e) =
-        l1e_from_pfn(virt_to_mfn(boot_gdt), __PAGE_HYPERVISOR_RW);
-    if ( IS_ENABLED(CONFIG_PV32) )
-        this_cpu(compat_gdt_l1e) =
-            l1e_from_pfn(virt_to_mfn(boot_compat_gdt), __PAGE_HYPERVISOR_RW);
-
     percpu_traps_init();
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 03 19:22:44 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Mar 2026 19:22:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1245039.1544400 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxVKO-00048W-H0; Tue, 03 Mar 2026 19:22:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1245039.1544400; Tue, 03 Mar 2026 19:22:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxVKO-00048O-E6; Tue, 03 Mar 2026 19:22:44 +0000
Received: by outflank-mailman (input) for mailman id 1245039;
 Tue, 03 Mar 2026 19:22:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vxVKM-00048E-Sa
 for xen-changelog@lists.xenproject.org; Tue, 03 Mar 2026 19:22:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxVKM-003L7j-2l
 for xen-changelog@lists.xenproject.org;
 Tue, 03 Mar 2026 19:22:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxVKM-00Enyt-2T
 for xen-changelog@lists.xenproject.org;
 Tue, 03 Mar 2026 19:22:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=14ikjtlVOZqajt99K5nbd5JqZxImw8ZC3TN9lmYVVeA=; b=i8nuwiQnD2S1paUE5agApVzwXj
	5Rd75EjUtAqldKffX0uZ4Q5JkksA8BbZ/VtfE6FeOjz36QXom3XUEdkvAiVXHZHcmEQcNh7C9xDBE
	jhAKIg5P4dZbUc+eoBa0/ht74xPQBs63LhMkt0ycqogOI66lWa6ez0FCgJz0XA8Uj0do=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/boot: Document the ordering dependency of _svm_cpu_up()
Message-Id: <E1vxVKM-00Enyt-2T@xenbits.xenproject.org>
Date: Tue, 03 Mar 2026 19:22:42 +0000

commit c2f15b0fff94ca71fe32792ea933fcf2a907111d
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Feb 16 20:57:02 2026 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 3 15:15:54 2026 +0000

    x86/boot: Document the ordering dependency of _svm_cpu_up()
    
    Lets just say this took an unreasonable amount of time and effort to track
    down, when trying to move traps_init() earlier during boot.
    
    When the SYSCALL linkage MSRs are not configured ahead of _svm_cpu_up() on the
    BSP, context switch clobbers the later-set-up linkage with the 0's cached
    here.  Amongst other problems, this causes PV guest to enter at 0 in
    supervisor mode on the user stack.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/svm/svm.c | 14 ++++++++++++++
 xen/arch/x86/setup.c       |  2 +-
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
index 18ba837738..243c41fb13 100644
--- a/xen/arch/x86/hvm/svm/svm.c
+++ b/xen/arch/x86/hvm/svm/svm.c
@@ -1581,6 +1581,20 @@ static int _svm_cpu_up(bool bsp)
     /* Initialize OSVW bits to be used by guests */
     svm_host_osvw_init();
 
+    /*
+     * VMSAVE writes out the current full FS, GS, LDTR and TR segments, and
+     * the GS_SHADOW, SYSENTER and SYSCALL linkage MSRs.
+     *
+     * The segment data gets modified by the svm_load_segs() optimisation for
+     * PV context switches, but all values get reloaded at that point, as well
+     * as during context switch from SVM.
+     *
+     * If PV guests are available, it is critical that the SYSCALL linkage
+     * MSRs been configured at this juncture even in FRED mode.
+     */
+    if ( IS_ENABLED(CONFIG_PV) )
+        ASSERT(rdmsr(MSR_STAR) == XEN_MSR_STAR);
+
     svm_vmsave_pa(per_cpu(host_vmcb, cpu));
 
     return 0;
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 27c63d1d97..675de3a649 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -2078,7 +2078,7 @@ void asmlinkage __init noreturn __start_xen(void)
                                            &this_cpu(stubs).mfn);
     BUG_ON(!this_cpu(stubs.addr));
 
-    traps_init(); /* Needs stubs allocated. */
+    traps_init(); /* Needs stubs allocated, must be before presmp_initcalls. */
 
     cpu_init();
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 03 19:22:54 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Mar 2026 19:22:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1245041.1544403 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxVKY-0004BC-Jl; Tue, 03 Mar 2026 19:22:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1245041.1544403; Tue, 03 Mar 2026 19:22:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxVKY-0004B4-HE; Tue, 03 Mar 2026 19:22:54 +0000
Received: by outflank-mailman (input) for mailman id 1245041;
 Tue, 03 Mar 2026 19:22:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vxVKW-0004Aw-Vk
 for xen-changelog@lists.xenproject.org; Tue, 03 Mar 2026 19:22:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxVKW-003L83-35
 for xen-changelog@lists.xenproject.org;
 Tue, 03 Mar 2026 19:22:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxVKW-00EnzL-2x
 for xen-changelog@lists.xenproject.org;
 Tue, 03 Mar 2026 19:22:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=huZ5MKJjoryaxeM5NOOeCEvDeebL+okd96VW//vMTcg=; b=z6Mlty9cgBXn2bzRXi/Zda1A4r
	x2zQq4VLWiEI4MG0kCTa8O9pA0acH/GEUeXMS9e7/K2E7DIBqv4UH5CJR3HV+K37U5ankdGXhmLzo
	07kBlMlSCjhkX240tjXE0Og791eM3EsgXa/JJaOJEEm/sdvv8EzSKT6LSTe8GjsfVotg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/traps: Move traps_init() earlier on boot
Message-Id: <E1vxVKW-00EnzL-2x@xenbits.xenproject.org>
Date: Tue, 03 Mar 2026 19:22:52 +0000

commit 8e4775d118c327782f5bf286e5b353a9de797bef
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Aug 15 22:56:42 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 3 15:15:54 2026 +0000

    x86/traps: Move traps_init() earlier on boot
    
    We wish to make use of opt_fred earlier on boot, which involves moving
    traps_init() earlier, but this comes with several ordering complications.
    
    The feature word containing FRED needs collecting in early_cpu_init(), and
    legacy_syscall_init() cannot be moved that early because it relies on the
    stubs being allocated, yet must be called ahead of cpu_init() so the SYSCALL
    linkage MSRs are set up before being cached.
    
    Delaying legacy_syscall_init() is easy enough based on a system_state check.
    Reuse bsp_traps_reinit() to cause a call to legacy_syscall_init() to occur at
    the same point as previously.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/cpu/common.c  |  4 +++-
 xen/arch/x86/setup.c       |  4 +++-
 xen/arch/x86/traps-setup.c | 12 +++++++++++-
 3 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c
index bfa63fcfb7..5d0523a78b 100644
--- a/xen/arch/x86/cpu/common.c
+++ b/xen/arch/x86/cpu/common.c
@@ -407,7 +407,9 @@ void __init early_cpu_init(bool verbose)
 		}
 
 		if (max_subleaf >= 1)
-			cpuid_count(7, 1, &eax, &ebx, &ecx,
+			cpuid_count(7, 1,
+                                    &c->x86_capability[FEATURESET_7a1],
+                                    &ebx, &ecx,
 				    &c->x86_capability[FEATURESET_7d1]);
 	}
 
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 675de3a649..0816a713e1 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -1386,6 +1386,8 @@ void asmlinkage __init noreturn __start_xen(void)
     else
         panic("Bootloader provided no memory information\n");
 
+    traps_init();
+
     /* Choose shadow stack early, to set infrastructure up appropriately. */
     if ( !boot_cpu_has(X86_FEATURE_CET_SS) )
         opt_xen_shstk = 0;
@@ -2078,7 +2080,7 @@ void asmlinkage __init noreturn __start_xen(void)
                                            &this_cpu(stubs).mfn);
     BUG_ON(!this_cpu(stubs.addr));
 
-    traps_init(); /* Needs stubs allocated, must be before presmp_initcalls. */
+    bsp_traps_reinit(); /* Needs stubs allocated, must be before presmp_initcalls. */
 
     cpu_init();
 
diff --git a/xen/arch/x86/traps-setup.c b/xen/arch/x86/traps-setup.c
index c5fc71c75b..b2c161943d 100644
--- a/xen/arch/x86/traps-setup.c
+++ b/xen/arch/x86/traps-setup.c
@@ -346,6 +346,10 @@ void __init traps_init(void)
 
 /*
  * Re-initialise all state referencing the early-boot stack.
+ *
+ * This is called twice during boot, first to ensure legacy_syscall_init() has
+ * run (deferred from earlier), and second when the virtual address of the BSP
+ * stack changes.
  */
 void __init bsp_traps_reinit(void)
 {
@@ -359,7 +363,13 @@ void __init bsp_traps_reinit(void)
  */
 void percpu_traps_init(void)
 {
-    legacy_syscall_init();
+    /*
+     * Skip legacy_syscall_init() at early boot.  It requires the stubs being
+     * allocated, limiting the placement of the traps_init() call, and gets
+     * re-done anyway by bsp_traps_reinit().
+     */
+    if ( system_state > SYS_STATE_early_boot )
+        legacy_syscall_init();
 
     if ( cpu_has_xen_lbr )
         wrmsrl(MSR_IA32_DEBUGCTLMSR, IA32_DEBUGCTLMSR_LBR);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 03 19:23:04 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Mar 2026 19:23:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1245042.1544408 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxVKi-0004DE-LD; Tue, 03 Mar 2026 19:23:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1245042.1544408; Tue, 03 Mar 2026 19:23:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxVKi-0004D6-Ia; Tue, 03 Mar 2026 19:23:04 +0000
Received: by outflank-mailman (input) for mailman id 1245042;
 Tue, 03 Mar 2026 19:23:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vxVKh-0004Cy-2s
 for xen-changelog@lists.xenproject.org; Tue, 03 Mar 2026 19:23:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxVKh-003L8N-09
 for xen-changelog@lists.xenproject.org;
 Tue, 03 Mar 2026 19:23:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxVKh-00Eo0D-03
 for xen-changelog@lists.xenproject.org;
 Tue, 03 Mar 2026 19:23:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=eGXw4WxcqUv01F9P+hoNnBI7Zy0ZEPD8+T8Goo0/T3o=; b=PE4JTUnVN+9u9n4tiAdIKBQieZ
	rmnxMLo5mYwBsgenkxabAmjrFYMou610fluxttFpaGOccUa6NhvQLcFma6rORq+VFDD5qlU2ODnRm
	mY/VNHMizg9OlikY4WoiSwawb6wQHDylbR3DxKWDWKFy9gYtUXIxCQ92C1HzDH76b/oU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/traps: Don't configure Supervisor Shadow Stack tokens in FRED mode
Message-Id: <E1vxVKh-00Eo0D-03@xenbits.xenproject.org>
Date: Tue, 03 Mar 2026 19:23:03 +0000

commit 7634f5662551864a4976d5f0022263a056efd14d
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Aug 15 22:56:42 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 3 15:15:54 2026 +0000

    x86/traps: Don't configure Supervisor Shadow Stack tokens in FRED mode
    
    FRED doesn't use Supervisor Shadow Stack tokens.  This means that:
    
     1) memguard_guard_stack() should not write Supervisor Shadow Stack Tokens.
     2) cpu_has_bug_shstk_fracture is no longer relevant when deciding whether to
        enable Shadow Stacks or not.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/mm.c    | 14 +++++++++++---
 xen/arch/x86/setup.c | 16 ++++++++++------
 2 files changed, 21 insertions(+), 9 deletions(-)

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index 0d0d529295..4c404b6c13 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -129,6 +129,7 @@
 #include <asm/shadow.h>
 #include <asm/shared.h>
 #include <asm/trampoline.h>
+#include <asm/traps.h>
 #include <asm/x86_emulate.h>
 
 #include <public/memory.h>
@@ -6441,8 +6442,15 @@ static void write_sss_token(unsigned long *ptr)
 
 void memguard_guard_stack(void *p)
 {
-    /* IST Shadow stacks.  4x 1k in stack page 0. */
-    if ( IS_ENABLED(CONFIG_XEN_SHSTK) )
+    ASSERT(opt_fred >= 0); /* Confirm that FRED-ness has been resolved */
+
+    /*
+     * IST Shadow stacks.  4x 1k in stack page 0.
+     *
+     * With IDT delivery, we need Supervisor Shadow Stack tokens at the base
+     * of each stack.  With FRED delivery, these no longer exist.
+     */
+    if ( IS_ENABLED(CONFIG_XEN_SHSTK) && !opt_fred )
     {
         write_sss_token(p + (IST_MCE * IST_SHSTK_SIZE) - 8);
         write_sss_token(p + (IST_NMI * IST_SHSTK_SIZE) - 8);
@@ -6453,7 +6461,7 @@ void memguard_guard_stack(void *p)
 
     /* Primary Shadow Stack.  1x 4k in stack page 5. */
     p += PRIMARY_SHSTK_SLOT * PAGE_SIZE;
-    if ( IS_ENABLED(CONFIG_XEN_SHSTK) )
+    if ( IS_ENABLED(CONFIG_XEN_SHSTK) && !opt_fred )
         write_sss_token(p + PAGE_SIZE - 8);
 
     map_pages_to_xen((unsigned long)p, virt_to_mfn(p), 1, PAGE_HYPERVISOR_SHSTK);
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 0816a713e1..8e59c9801a 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -1412,15 +1412,19 @@ void asmlinkage __init noreturn __start_xen(void)
             boot_cpu_data.x86_vendor == X86_VENDOR_INTEL &&
             !boot_cpu_has(X86_FEATURE_CET_SSS);
 
+        ASSERT(opt_fred >= 0); /* Confirm that FRED-ness has been resolved */
+
         /*
-         * On bare metal, assume that Xen won't be impacted by shstk
-         * fracturing problems.  Under virt, be more conservative and disable
-         * shstk by default.
+         * If FRED is in use, Supervisor Shadow Stack tokens are not used and
+         * shstk fracturing is of no consequence.  Otherwise:
+         * - On bare metal, assume that Xen won't be impacted by shstk
+         *   fracturing problems.
+         * - Under virt, be more conservative and disable shstk by default.
          */
         if ( opt_xen_shstk == -1 )
             opt_xen_shstk =
-                cpu_has_hypervisor ? !cpu_has_bug_shstk_fracture
-                                   : true;
+                opt_fred || (cpu_has_hypervisor ? !cpu_has_bug_shstk_fracture
+                                                : true);
 
         if ( opt_xen_shstk )
         {
@@ -1925,7 +1929,7 @@ void asmlinkage __init noreturn __start_xen(void)
 
     system_state = SYS_STATE_boot;
 
-    bsp_stack = cpu_alloc_stack(0);
+    bsp_stack = cpu_alloc_stack(0); /* Needs to know IDT vs FRED */
     if ( !bsp_stack )
         panic("No memory for BSP stack\n");
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 03 19:23:14 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Mar 2026 19:23:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1245043.1544412 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxVKs-0004FE-Mi; Tue, 03 Mar 2026 19:23:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1245043.1544412; Tue, 03 Mar 2026 19:23:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxVKs-0004F7-Jv; Tue, 03 Mar 2026 19:23:14 +0000
Received: by outflank-mailman (input) for mailman id 1245043;
 Tue, 03 Mar 2026 19:23:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vxVKr-0004Ew-5l
 for xen-changelog@lists.xenproject.org; Tue, 03 Mar 2026 19:23:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxVKr-003L8T-0T
 for xen-changelog@lists.xenproject.org;
 Tue, 03 Mar 2026 19:23:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxVKr-00Eo3B-0K
 for xen-changelog@lists.xenproject.org;
 Tue, 03 Mar 2026 19:23:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Xt44ejn64yBUr7wMPWMGK7N18gcyARvBbNC/qD0vmxs=; b=R+9gwGJqtkdaO5e++33lOpzWiI
	8uvS3+VWOJwptHRvHezJldnMNxY0S5p/LWKnweBBlAbgkRgmO/2KjXd94Ms43EzoZyNlQHoGAwU1l
	GGrRCAfa/w2nN3+i0fWJMzkTHGIJTZ+7RhVBfXo358sj5qwe8EO7vOylNGDLK+tzGldM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/traps: Introduce FRED entrypoints
Message-Id: <E1vxVKr-00Eo3B-0K@xenbits.xenproject.org>
Date: Tue, 03 Mar 2026 19:23:13 +0000

commit 0e9cc04453fc2d7234ad3ced51b520c597c7bfbf
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Dec 24 11:03:06 2024 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 3 15:15:54 2026 +0000

    x86/traps: Introduce FRED entrypoints
    
    Under FRED, there's one entrypoint from Ring 3, and one from Ring 0.
    
    FRED gives us a good stack (even for SYSCALL/SYSENTER), and a unified event
    frame on the stack with all flags cleared, meaning that all software needs to
    do is spill the GPRs with a line of PUSHes.  Introduce PUSH_AND_CLEAR_GPRS for
    this purpose, along with the matching POP_GPRS.
    
    Introduce entry_FRED_R0() which to a first approximation is complete for all
    event handling within Xen.
    
    entry_FRED_R0() needs deriving from entry_FRED_R3(), so introduce a basic
    Ring3 handler.  There is more work required to make the return-to-guest path
    work under FRED.
    
    Also introduce entry_from_{xen,pv}() to be the C level handlers.  By simply
    copying regs->fred_ss.vector into regs->entry_vector, we can reuse all the
    existing fault handlers.
    
    Extend fatal_trap() to render the event type including name, when FRED is
    active.  This is slightly complicated, because X86_ET_OTHER must not use
    vector_name() or SYSCALL and SYSENTER get rendered as #BP and #DB.
    
    This is sufficient to handle all interrupts and exceptions encountered during
    development, including plenty of Double Faults.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/include/asm/asm_defns.h |  63 ++++++++++++++
 xen/arch/x86/traps.c                 | 155 +++++++++++++++++++++++++++++++++++
 xen/arch/x86/x86_64/Makefile         |   1 +
 xen/arch/x86/x86_64/entry-fred.S     |  33 ++++++++
 4 files changed, 252 insertions(+)

diff --git a/xen/arch/x86/include/asm/asm_defns.h b/xen/arch/x86/include/asm/asm_defns.h
index 4a21a7b466..0dd63270fc 100644
--- a/xen/arch/x86/include/asm/asm_defns.h
+++ b/xen/arch/x86/include/asm/asm_defns.h
@@ -312,6 +312,69 @@ static always_inline void stac(void)
         subq  $-(UREGS_error_code-UREGS_r15+\adj), %rsp
 .endm
 
+/*
+ * Push and clear GPRs
+ */
+.macro PUSH_AND_CLEAR_GPRS
+        push  %rdi
+        xor   %edi, %edi
+        push  %rsi
+        xor   %esi, %esi
+        push  %rdx
+        xor   %edx, %edx
+        push  %rcx
+        xor   %ecx, %ecx
+        push  %rax
+        xor   %eax, %eax
+        push  %r8
+        xor   %r8d, %r8d
+        push  %r9
+        xor   %r9d, %r9d
+        push  %r10
+        xor   %r10d, %r10d
+        push  %r11
+        xor   %r11d, %r11d
+        push  %rbx
+        xor   %ebx, %ebx
+        push  %rbp
+#ifdef CONFIG_FRAME_POINTER
+/* Indicate special exception stack frame by inverting the frame pointer. */
+        mov   %rsp, %rbp
+        not   %rbp
+#else
+        xor   %ebp, %ebp
+#endif
+        push  %r12
+        xor   %r12d, %r12d
+        push  %r13
+        xor   %r13d, %r13d
+        push  %r14
+        xor   %r14d, %r14d
+        push  %r15
+        xor   %r15d, %r15d
+.endm
+
+/*
+ * POP GPRs from a UREGS_* frame on the stack.  Does not modify flags.
+ */
+.macro POP_GPRS
+        pop   %r15
+        pop   %r14
+        pop   %r13
+        pop   %r12
+        pop   %rbp
+        pop   %rbx
+        pop   %r11
+        pop   %r10
+        pop   %r9
+        pop   %r8
+        pop   %rax
+        pop   %rcx
+        pop   %rdx
+        pop   %rsi
+        pop   %rdi
+.endm
+
 #ifdef CONFIG_PV32
 #define CR4_PV32_RESTORE                               \
     ALTERNATIVE_2 "",                                  \
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index bcae704d96..e40b51d693 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -88,6 +88,13 @@ const unsigned int nmi_cpu;
 #define stack_words_per_line 4
 #define ESP_BEFORE_EXCEPTION(regs) ((unsigned long *)(regs)->rsp)
 
+/* Only valid to use when FRED is active. */
+static inline struct fred_info *cpu_regs_fred_info(struct cpu_user_regs *regs)
+{
+    ASSERT(read_cr4() & X86_CR4_FRED);
+    return &container_of(regs, struct cpu_info, guest_cpu_user_regs)->_fred;
+}
+
 struct extra_state
 {
     unsigned long cr0, cr2, cr3, cr4;
@@ -1028,6 +1035,32 @@ void show_execution_state_nmi(const cpumask_t *mask, bool show_all)
         printk("Non-responding CPUs: {%*pbl}\n", CPUMASK_PR(&show_state_mask));
 }
 
+static const char *x86_et_name(unsigned int type)
+{
+    static const char *const names[] = {
+        [X86_ET_EXT_INTR]    = "EXT_INTR",
+        [X86_ET_NMI]         = "NMI",
+        [X86_ET_HW_EXC]      = "HW_EXC",
+        [X86_ET_SW_INT]      = "SW_INT",
+        [X86_ET_PRIV_SW_EXC] = "PRIV_SW_EXC",
+        [X86_ET_SW_EXC]      = "SW_EXC",
+        [X86_ET_OTHER]       = "OTHER",
+    };
+
+    return (type < ARRAY_SIZE(names) && names[type]) ? names[type] : "???";
+}
+
+static const char *x86_et_other_name(unsigned int what)
+{
+    static const char *const names[] = {
+        [0] = "MTF",
+        [1] = "SYSCALL",
+        [2] = "SYSENTER",
+    };
+
+    return (what < ARRAY_SIZE(names) && names[what]) ? names[what] : "???";
+}
+
 const char *vector_name(unsigned int vec)
 {
     static const char names[][4] = {
@@ -1106,6 +1139,38 @@ void fatal_trap(const struct cpu_user_regs *regs, bool show_remote)
         }
     }
 
+    if ( read_cr4() & X86_CR4_FRED )
+    {
+        bool render_ec = false;
+        const char *vec_name = NULL;
+
+        switch ( regs->fred_ss.type )
+        {
+        case X86_ET_HW_EXC:
+        case X86_ET_PRIV_SW_EXC:
+        case X86_ET_SW_EXC:
+            render_ec = true;
+            vec_name = vector_name(regs->fred_ss.vector);
+            break;
+
+        case X86_ET_OTHER:
+            vec_name = x86_et_other_name(regs->fred_ss.vector);
+            break;
+        }
+
+        if ( render_ec )
+            panic("FATAL TRAP: type %u, %s, vec %u, %s[%04x]%s\n",
+                  regs->fred_ss.type, x86_et_name(regs->fred_ss.type),
+                  regs->fred_ss.vector, vec_name ?: "",
+                  regs->error_code,
+                  (regs->eflags & X86_EFLAGS_IF) ? "" : " IN INTERRUPT CONTEXT");
+        else
+            panic("FATAL TRAP: type %u, %s, vec %u, %s%s\n",
+                  regs->fred_ss.type, x86_et_name(regs->fred_ss.type),
+                  regs->fred_ss.vector, vec_name ?: "",
+                  (regs->eflags & X86_EFLAGS_IF) ? "" : " IN INTERRUPT CONTEXT");
+    }
+
     panic("FATAL TRAP: vec %u, %s[%04x]%s\n",
           trapnr, vector_name(trapnr), regs->error_code,
           (regs->eflags & X86_EFLAGS_IF) ? "" : " IN INTERRUPT CONTEXT");
@@ -2200,6 +2265,96 @@ void asmlinkage check_ist_exit(const struct cpu_user_regs *regs, bool ist_exit)
 }
 #endif
 
+void asmlinkage entry_from_pv(struct cpu_user_regs *regs)
+{
+    /* Copy fred_ss.vector into entry_vector as IDT delivery would have done. */
+    regs->entry_vector = regs->fred_ss.vector;
+
+    fatal_trap(regs, false);
+}
+
+void asmlinkage entry_from_xen(struct cpu_user_regs *regs)
+{
+    struct fred_info *fi = cpu_regs_fred_info(regs);
+    uint8_t type = regs->fred_ss.type;
+
+    /* Copy fred_ss.vector into entry_vector as IDT delivery would have done. */
+    regs->entry_vector = regs->fred_ss.vector;
+
+    /*
+     * First, handle the asynchronous or fatal events.  These are either
+     * unrelated to the interrupted context, or may not have valid context
+     * recorded, and all have special rules on how/whether to re-enable IRQs.
+     */
+    if ( regs->fred_ss.nested )
+        goto fatal;
+
+    switch ( type )
+    {
+    case X86_ET_EXT_INTR:
+        return do_IRQ(regs);
+
+    case X86_ET_NMI:
+        return do_nmi(regs);
+
+    case X86_ET_HW_EXC:
+        switch ( regs->fred_ss.vector )
+        {
+        case X86_EXC_DF: return do_double_fault(regs);
+        case X86_EXC_MC: return do_machine_check(regs);
+        }
+        break;
+    }
+
+    /*
+     * With the asynchronous events handled, what remains are the synchronous
+     * ones.  If we interrupted an IRQs-on region, we should re-enable IRQs
+     * now; for #PF and #DB, %cr2 and PENDING_DBG are on the stack in edata.
+     */
+    if ( regs->eflags & X86_EFLAGS_IF )
+        local_irq_enable();
+
+    switch ( type )
+    {
+    case X86_ET_HW_EXC:
+    case X86_ET_PRIV_SW_EXC:
+    case X86_ET_SW_EXC:
+        switch ( regs->fred_ss.vector )
+        {
+        case X86_EXC_PF:  handle_PF(regs, fi->edata); break;
+        case X86_EXC_GP:  do_general_protection(regs); break;
+        case X86_EXC_UD:  do_invalid_op(regs); break;
+        case X86_EXC_NM:  do_device_not_available(regs); break;
+        case X86_EXC_BP:  do_int3(regs); break;
+        case X86_EXC_DB:  handle_DB(regs, fi->edata); break;
+        case X86_EXC_CP:  do_entry_CP(regs); break;
+
+        case X86_EXC_DE:
+        case X86_EXC_OF:
+        case X86_EXC_BR:
+        case X86_EXC_NP:
+        case X86_EXC_SS:
+        case X86_EXC_MF:
+        case X86_EXC_AC:
+        case X86_EXC_XM:
+            do_trap(regs);
+            break;
+
+        default:
+            goto fatal;
+        }
+        break;
+
+    default:
+        goto fatal;
+    }
+
+    return;
+
+ fatal:
+    fatal_trap(regs, false);
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/xen/arch/x86/x86_64/Makefile b/xen/arch/x86/x86_64/Makefile
index f207630887..c0a0b66032 100644
--- a/xen/arch/x86/x86_64/Makefile
+++ b/xen/arch/x86/x86_64/Makefile
@@ -1,5 +1,6 @@
 obj-$(CONFIG_PV32) += compat/
 
+obj-bin-y += entry-fred.o
 obj-bin-y += entry.o
 obj-$(CONFIG_KEXEC) += machine_kexec.o
 obj-y += pci.o
diff --git a/xen/arch/x86/x86_64/entry-fred.S b/xen/arch/x86/x86_64/entry-fred.S
new file mode 100644
index 0000000000..3c3320df22
--- /dev/null
+++ b/xen/arch/x86/x86_64/entry-fred.S
@@ -0,0 +1,33 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+        .file "x86_64/entry-fred.S"
+
+#include <asm/asm_defns.h>
+#include <asm/page.h>
+
+        .section .text.entry, "ax", @progbits
+
+        /* The Ring3 entry point is required to be 4k aligned. */
+
+FUNC(entry_FRED_R3, 4096)
+        PUSH_AND_CLEAR_GPRS
+
+        mov     %rsp, %rdi
+        call    entry_from_pv
+
+        POP_GPRS
+        eretu
+END(entry_FRED_R3)
+
+        /* The Ring0 entrypoint is at Ring3 + 0x100. */
+        .org entry_FRED_R3 + 0x100, 0xcc
+
+FUNC_LOCAL(entry_FRED_R0, 0)
+        PUSH_AND_CLEAR_GPRS
+
+        mov     %rsp, %rdi
+        call    entry_from_xen
+
+        POP_GPRS
+        erets
+END(entry_FRED_R0)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 03 19:23:24 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Mar 2026 19:23:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1245044.1544417 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxVL2-0004HH-PK; Tue, 03 Mar 2026 19:23:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1245044.1544417; Tue, 03 Mar 2026 19:23:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxVL2-0004H8-LY; Tue, 03 Mar 2026 19:23:24 +0000
Received: by outflank-mailman (input) for mailman id 1245044;
 Tue, 03 Mar 2026 19:23:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vxVL1-0004Gw-8Z
 for xen-changelog@lists.xenproject.org; Tue, 03 Mar 2026 19:23:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxVL1-003LAu-0l
 for xen-changelog@lists.xenproject.org;
 Tue, 03 Mar 2026 19:23:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxVL1-00Eo3X-0e
 for xen-changelog@lists.xenproject.org;
 Tue, 03 Mar 2026 19:23:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=1FIlIPyRAhFbFpvxf49c8UD1oDYoQxG81/vUw1VsGNQ=; b=CTvkc7fQxrAiwBo6mlIUotDf21
	Mmk3BQI+DKj3KH6xWq0yQbi9EceqH6lFAGvyH991ppWvPc1p3F2XlplWgjz47TlSsLYHgHeOEYrEt
	OK6ucHnrSY5tXWfCWVFrQ9tcmpjJoTtcVcxCSEhrj2WCYNnK/+2EPSt+AK8JG0ZApAGA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/traps: Enable FRED when requested
Message-Id: <E1vxVL1-00Eo3X-0e@xenbits.xenproject.org>
Date: Tue, 03 Mar 2026 19:23:23 +0000

commit bbfb30f649fc11281b091b91fd353954df1354a0
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Dec 24 11:03:06 2024 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 3 15:15:54 2026 +0000

    x86/traps: Enable FRED when requested
    
    With the shadow stack and exception handling adjustements in place, we can now
    activate FRED when appropriate.  Note that opt_fred is still disabled by
    default until more development is complete.
    
    Introduce init_fred() to set up all the MSRs relevant for FRED.  FRED uses
    MSR_STAR (entries from Ring3 only), and MSR_FRED_SSP_SL0 aliases MSR_PL0_SSP
    when CET-SS is active.  Otherwise, they're all new MSRs.
    
    Also introduce init_fred_tss().  At this juncture we need a TSS set up, even
    if it is mostly unused.  Reinsert the BUILD_BUG_ON() checking the size of the
    TSS against 0x67, this time with a more precise comment.
    
    With init_fred() existing, load_system_tables() and legacy_syscall_init()
    should only be used when setting up IDT delivery.  Insert ASSERT()s to this
    effect, and adjust the various init functions to make this property true.
    
    The FRED initialisation path still needs to write to all system table
    registers at least once, even if only to invalidate them.  Per the
    documentation, percpu_early_traps_init() is responsible for switching off the
    boot GDT, which also needs doing even in FRED mode.
    
    Finally, set CR4.FRED in traps_init()/percpu_early_traps_init().
    
    Xen can now boot in FRED mode and run a PVH dom0.  PV guests still need more
    work before they can be run under FRED.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/include/asm/current.h |   3 +
 xen/arch/x86/include/asm/traps.h   |   2 +
 xen/arch/x86/traps-setup.c         | 130 +++++++++++++++++++++++++++++++++++--
 3 files changed, 130 insertions(+), 5 deletions(-)

diff --git a/xen/arch/x86/include/asm/current.h b/xen/arch/x86/include/asm/current.h
index 62817e8476..6139980ab1 100644
--- a/xen/arch/x86/include/asm/current.h
+++ b/xen/arch/x86/include/asm/current.h
@@ -23,6 +23,9 @@
  * 2 - NMI IST stack
  * 1 - #MC IST stack
  * 0 - IST Shadow Stacks (4x 1k, read-only)
+ *
+ * In FRED mode, #DB and NMI do not need special stacks, so their IST stacks
+ * are unused.
  */
 
 /*
diff --git a/xen/arch/x86/include/asm/traps.h b/xen/arch/x86/include/asm/traps.h
index 73097e957d..5d7504bc44 100644
--- a/xen/arch/x86/include/asm/traps.h
+++ b/xen/arch/x86/include/asm/traps.h
@@ -16,6 +16,8 @@ void traps_init(void);
 void bsp_traps_reinit(void);
 void percpu_traps_init(void);
 
+void nocall entry_FRED_R3(void);
+
 extern unsigned int ler_msr;
 
 const char *vector_name(unsigned int vec);
diff --git a/xen/arch/x86/traps-setup.c b/xen/arch/x86/traps-setup.c
index b2c161943d..9b8301c23e 100644
--- a/xen/arch/x86/traps-setup.c
+++ b/xen/arch/x86/traps-setup.c
@@ -59,6 +59,8 @@ static void load_system_tables(void)
         .limit = sizeof(bsp_idt) - 1,
     };
 
+    ASSERT(opt_fred == 0);
+
     /*
      * Set up the TSS.  Warning - may be live, and the NMI/#MC must remain
      * valid on every instruction boundary.  (Note: these are all
@@ -191,6 +193,8 @@ static void legacy_syscall_init(void)
     unsigned char *stub_page;
     unsigned int offset;
 
+    ASSERT(opt_fred == 0);
+
     /* No PV guests?  No need to set up SYSCALL/SYSENTER infrastructure. */
     if ( !IS_ENABLED(CONFIG_PV) )
         return;
@@ -268,6 +272,76 @@ static void __init init_ler(void)
     setup_force_cpu_cap(X86_FEATURE_XEN_LBR);
 }
 
+/*
+ * Set up all MSRs relevant for FRED event delivery.
+ *
+ * Xen does not use any of the optional config in MSR_FRED_CONFIG, so all that
+ * is needed is the entrypoint.
+ *
+ * Because FRED always provides a good stack, NMI and #DB do not need any
+ * special treatment.  Only #DF needs another stack level, and #MC for the
+ * off-chance that Xen's main stack suffers an uncorrectable error.
+ *
+ * This makes Stack Level 1 unused, but we use #DB's stacks, and with the
+ * regular and shadow stack pointers reversed as poison to guarantee that any
+ * use escalates to #DF.
+ *
+ * FRED reuses MSR_STAR to provide the segment selector values to load on
+ * entry from Ring3.  Entry from Ring0 leave %cs and %ss unmodified.
+ */
+static void init_fred(void)
+{
+    unsigned long stack_top = get_stack_bottom() & ~(STACK_SIZE - 1);
+
+    ASSERT(opt_fred == 1);
+
+    wrmsrns(MSR_STAR, XEN_MSR_STAR);
+    wrmsrns(MSR_FRED_CONFIG, (unsigned long)entry_FRED_R3);
+
+    /*
+     * MSR_FRED_RSP_* all come with an 64-byte alignment check, avoiding the
+     * need for an explicit BUG_ON().
+     */
+    wrmsrns(MSR_FRED_RSP_SL0, (unsigned long)(&get_cpu_info()->_fred + 1));
+    wrmsrns(MSR_FRED_RSP_SL1, stack_top + (IST_DB * IST_SHSTK_SIZE)); /* Poison */
+    wrmsrns(MSR_FRED_RSP_SL2, stack_top + (1 + IST_MCE)  * PAGE_SIZE);
+    wrmsrns(MSR_FRED_RSP_SL3, stack_top + (1 + IST_DF)   * PAGE_SIZE);
+    wrmsrns(MSR_FRED_STK_LVLS, ((2UL << (X86_EXC_MC * 2)) |
+                                (3UL << (X86_EXC_DF * 2))));
+
+    if ( cpu_has_xen_shstk )
+    {
+        wrmsrns(MSR_FRED_SSP_SL0, stack_top + (PRIMARY_SHSTK_SLOT + 1) * PAGE_SIZE);
+        wrmsrns(MSR_FRED_SSP_SL1, stack_top + (1 + IST_DB) * PAGE_SIZE); /* Poison */
+        wrmsrns(MSR_FRED_SSP_SL2, stack_top + (IST_MCE * IST_SHSTK_SIZE));
+        wrmsrns(MSR_FRED_SSP_SL3, stack_top + (IST_DF  * IST_SHSTK_SIZE));
+    }
+}
+
+/*
+ * Set up a minimal TSS and selector for use in FRED mode.
+ *
+ * With FRED moving the stack pointers into MSRs, we would like to avoid
+ * having a TSS at all, but:
+ *  - VT-x VMExit unconditionally sets TR.limit to 0x67, meaning that
+ *    HOST_TR_BASE needs to point to a good TSS.
+ *  - show_stack_overflow() cross-checks tss->rsp0.
+ *
+ * Fill in rsp0 and the bitmap offset, and load a zero-length TR.  If VT-x
+ * does get used, it will clobber TR to refer to this_cpu(tss_page).tss.
+ */
+static void init_fred_tss(void)
+{
+    seg_desc_t *gdt = this_cpu(gdt) - FIRST_RESERVED_GDT_ENTRY;
+    struct tss64 *tss = &this_cpu(tss_page).tss;
+
+    tss->rsp0 = get_stack_bottom();
+    tss->bitmap = IOBMP_INVALID_OFFSET;
+
+    _set_tssldt_desc(gdt + TSS_ENTRY, 0, 0, SYS_DESC_tss_avail);
+    ltr(TSS_SELECTOR);
+}
+
 /*
  * Configure basic exception handling.  This is prior to parsing the command
  * line or configuring a console, and needs to be as simple as possible.
@@ -322,6 +396,8 @@ void __init traps_init(void)
 
     if ( opt_fred )
     {
+        const struct desc_ptr idtr = {};
+
 #ifdef CONFIG_PV32
         if ( opt_pv32 )
         {
@@ -329,16 +405,27 @@ void __init traps_init(void)
             printk(XENLOG_INFO "Disabling PV32 due to FRED\n");
         }
 #endif
+
+        init_fred();
+        set_in_cr4(X86_CR4_FRED);
+
+        /*
+         * Invalidate the IDT as it's not used.  Set up a minimal TSS.  The
+         * LDT was configured by bsp_early_traps_init().
+         */
+        lidt(&idtr);
+        init_fred_tss();
+
         setup_force_cpu_cap(X86_FEATURE_XEN_FRED);
         printk("Using FRED event delivery\n");
     }
     else
     {
+        load_system_tables();
+
         printk("Using IDT event delivery\n");
     }
 
-    load_system_tables();
-
     init_ler();
 
     percpu_traps_init();
@@ -353,7 +440,11 @@ void __init traps_init(void)
  */
 void __init bsp_traps_reinit(void)
 {
-    load_system_tables();
+    if ( opt_fred )
+        init_fred();
+    else
+        load_system_tables();
+
     percpu_traps_init();
 }
 
@@ -368,7 +459,7 @@ void percpu_traps_init(void)
      * allocated, limiting the placement of the traps_init() call, and gets
      * re-done anyway by bsp_traps_reinit().
      */
-    if ( system_state > SYS_STATE_early_boot )
+    if ( !opt_fred && system_state > SYS_STATE_early_boot )
         legacy_syscall_init();
 
     if ( cpu_has_xen_lbr )
@@ -384,7 +475,29 @@ void percpu_traps_init(void)
  */
 void asmlinkage percpu_early_traps_init(void)
 {
-    load_system_tables();
+    if ( opt_fred )
+    {
+        seg_desc_t *gdt = this_cpu(gdt) - FIRST_RESERVED_GDT_ENTRY;
+        const struct desc_ptr gdtr = {
+            .base = (unsigned long)gdt,
+            .limit = LAST_RESERVED_GDT_BYTE,
+        }, idtr = {};
+
+        lgdt(&gdtr);
+
+        init_fred();
+        write_cr4(read_cr4() | X86_CR4_FRED);
+
+        /*
+         * Invalidate the IDT (not used) and LDT (not set up yet).  Set up a
+         * minimal TSS.
+         */
+        lidt(&idtr);
+        init_fred_tss();
+        lldt(0);
+    }
+    else
+        load_system_tables();
 }
 
 static void __init __maybe_unused build_assertions(void)
@@ -403,4 +516,11 @@ static void __init __maybe_unused build_assertions(void)
                   endof_field(struct cpu_info, guest_cpu_user_regs)) & 15);
     BUILD_BUG_ON((sizeof(struct cpu_info) -
                   endof_field(struct cpu_info, _fred)) & 63);
+
+    /*
+     * The x86 architecture is happy with TR.limit being less than 0x67, but
+     * VT-x is not.  VMExit unconditionally sets the limit to 0x67, meaning
+     * that HOST_TR_BASE needs to refer to a good TSS of at least this size.
+     */
+    BUILD_BUG_ON(sizeof(struct tss64) <= 0x67);
 }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Mar 04 08:44:07 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Mar 2026 08:44:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1245166.1544524 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxhpr-0001m6-CD; Wed, 04 Mar 2026 08:44:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1245166.1544524; Wed, 04 Mar 2026 08:44:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxhpr-0001ly-98; Wed, 04 Mar 2026 08:44:03 +0000
Received: by outflank-mailman (input) for mailman id 1245166;
 Wed, 04 Mar 2026 08:44:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vxhpp-0001lg-MK
 for xen-changelog@lists.xenproject.org; Wed, 04 Mar 2026 08:44:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxhpp-004nS3-22
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 08:44:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxhpp-00FZZo-1p
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 08:44:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=TUt6bOkzHO2NrPsQNMNZnFhgw8Cwdbqmu+dprCVJPsU=; b=PDhVGiYG2QjMu8FdFXSgnAzlL9
	x6NTtD48c+haSo7LTrlDU6Sa8IUwDQwGwsSQQd7Bi0nQSTQpCa8/avaQkeuDnsg6XEVDc5D4vwCqB
	U2FaXyvvP03qRAhNnx/Mu3LTSWeTIO59YVhltFayUiHtsXOycQ+bBqE1eVQB4707K0mM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] vPCI: introduce private header
Message-Id: <E1vxhpp-00FZZo-1p@xenbits.xenproject.org>
Date: Wed, 04 Mar 2026 08:44:01 +0000

commit c6f5590c93444d39170f145c4cf682878aac09d2
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Mar 4 08:21:28 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 4 08:21:28 2026 +0100

    vPCI: introduce private header
    
    Before adding more private stuff to xen/vpci.h, split it up. In order to
    be able to include the private header first in a CU, the per-arch struct
    decls also need to move (to new asm/vpci.h files).
    
    While adjusting the test harness'es Makefile, also switch the pre-existing
    header symlink-ing rule to a pattern one.
    
    Apart from in the test harness code, things only move; no functional
    change intended.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Stewart Hildebrand <stewart.hildebrand@amd.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 .gitignore                        |   1 +
 tools/tests/vpci/Makefile         |  16 ++---
 tools/tests/vpci/emul.h           |   1 +
 xen/arch/arm/include/asm/pci.h    |   8 ---
 xen/arch/arm/include/asm/vpci.h   |  13 ++++
 xen/arch/x86/include/asm/hvm/io.h |  11 ----
 xen/arch/x86/include/asm/vpci.h   |  29 +++++++++
 xen/drivers/vpci/header.c         |   3 +-
 xen/drivers/vpci/msi.c            |   3 +-
 xen/drivers/vpci/msix.c           |   3 +-
 xen/drivers/vpci/private.h        | 126 ++++++++++++++++++++++++++++++++++++++
 xen/drivers/vpci/rebar.c          |   3 +-
 xen/drivers/vpci/vpci.c           |   3 +-
 xen/include/xen/vpci.h            | 107 +-------------------------------
 14 files changed, 189 insertions(+), 138 deletions(-)

diff --git a/.gitignore b/.gitignore
index 57d54f676f..bfc7bdf043 100644
--- a/.gitignore
+++ b/.gitignore
@@ -154,6 +154,7 @@ tools/tests/x86_emulator/test_x86_emulator
 tools/tests/x86_emulator/x86_emulate
 tools/tests/x86_emulator/xop*.[ch]
 tools/tests/vpci/list.h
+tools/tests/vpci/private.h
 tools/tests/vpci/vpci.[hc]
 tools/tests/vpci/test_vpci
 tools/xcutils/lsevtchn
diff --git a/tools/tests/vpci/Makefile b/tools/tests/vpci/Makefile
index 97359ff67f..28b6009332 100644
--- a/tools/tests/vpci/Makefile
+++ b/tools/tests/vpci/Makefile
@@ -14,12 +14,12 @@ else
 	$(warning HOSTCC != CC, will not run test)
 endif
 
-$(TARGET): vpci.c vpci.h list.h main.c emul.h
-	$(CC) $(CFLAGS_xeninclude) -g -o $@ vpci.c main.c
+$(TARGET): vpci.c vpci.h list.h private.h main.c emul.h
+	$(CC) $(CFLAGS_xeninclude) -include emul.h -g -o $@ vpci.c main.c
 
 .PHONY: clean
 clean:
-	rm -rf $(TARGET) *.o *~ vpci.h vpci.c list.h
+	rm -rf $(TARGET) *.o *~ vpci.h vpci.c list.h private.h
 
 .PHONY: distclean
 distclean: clean
@@ -34,10 +34,10 @@ uninstall:
 	$(RM) -- $(DESTDIR)$(LIBEXEC)/tests/$(TARGET)
 
 vpci.c: $(XEN_ROOT)/xen/drivers/vpci/vpci.c
-	# Remove includes and add the test harness header
-	sed -e '/#include/d' -e '1s/^/#include "emul.h"/' <$< >$@
+	sed -e '/#include/d' <$< >$@
+
+private.h: %.h: $(XEN_ROOT)/xen/drivers/vpci/%.h
+	sed -e '/#include/d' <$< >$@
 
-list.h: $(XEN_ROOT)/xen/include/xen/list.h
-vpci.h: $(XEN_ROOT)/xen/include/xen/vpci.h
-list.h vpci.h:
+list.h vpci.h: %.h: $(XEN_ROOT)/xen/include/xen/%.h
 	sed -e '/#include/d' <$< >$@
diff --git a/tools/tests/vpci/emul.h b/tools/tests/vpci/emul.h
index dd048cffbf..38211afbb8 100644
--- a/tools/tests/vpci/emul.h
+++ b/tools/tests/vpci/emul.h
@@ -86,6 +86,7 @@ typedef union {
 
 #define CONFIG_HAS_VPCI
 #include "vpci.h"
+#include "private.h"
 
 #define __hwdom_init
 
diff --git a/xen/arch/arm/include/asm/pci.h b/xen/arch/arm/include/asm/pci.h
index 73c3be74ae..7c3211823f 100644
--- a/xen/arch/arm/include/asm/pci.h
+++ b/xen/arch/arm/include/asm/pci.h
@@ -31,14 +31,6 @@ struct arch_pci_dev {
     struct device dev;
 };
 
-/* Arch-specific MSI data for vPCI. */
-struct vpci_arch_msi {
-};
-
-/* Arch-specific MSI-X entry data for vPCI. */
-struct vpci_arch_msix_entry {
-};
-
 /*
  * Because of the header cross-dependencies, e.g. we need both
  * struct pci_dev and struct arch_pci_dev at the same time, this cannot be
diff --git a/xen/arch/arm/include/asm/vpci.h b/xen/arch/arm/include/asm/vpci.h
new file mode 100644
index 0000000000..db04687fc0
--- /dev/null
+++ b/xen/arch/arm/include/asm/vpci.h
@@ -0,0 +1,13 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+#ifndef ARM_VPCI_H
+#define ARM_VPCI_H
+
+/* Arch-specific MSI data for vPCI. */
+struct vpci_arch_msi {
+};
+
+/* Arch-specific MSI-X entry data for vPCI. */
+struct vpci_arch_msix_entry {
+};
+
+#endif /* ARM_VPCI_H */
diff --git a/xen/arch/x86/include/asm/hvm/io.h b/xen/arch/x86/include/asm/hvm/io.h
index c12f099a03..986822ff15 100644
--- a/xen/arch/x86/include/asm/hvm/io.h
+++ b/xen/arch/x86/include/asm/hvm/io.h
@@ -97,17 +97,6 @@ void msixtbl_init(struct domain *d);
 static inline void msixtbl_init(struct domain *d) {}
 #endif
 
-/* Arch-specific MSI data for vPCI. */
-struct vpci_arch_msi {
-    int pirq;
-    bool bound;
-};
-
-/* Arch-specific MSI-X entry data for vPCI. */
-struct vpci_arch_msix_entry {
-    int pirq;
-};
-
 void stdvga_init(struct domain *d);
 
 extern void hvm_dpci_msi_eoi(struct domain *d, int vector);
diff --git a/xen/arch/x86/include/asm/vpci.h b/xen/arch/x86/include/asm/vpci.h
new file mode 100644
index 0000000000..c501ff1709
--- /dev/null
+++ b/xen/arch/x86/include/asm/vpci.h
@@ -0,0 +1,29 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#ifndef X86_VPCI_H
+#define X86_VPCI_H
+
+#include <xen/stdbool.h>
+
+/* Arch-specific MSI data for vPCI. */
+struct vpci_arch_msi {
+    int pirq;
+    bool bound;
+};
+
+/* Arch-specific MSI-X entry data for vPCI. */
+struct vpci_arch_msix_entry {
+    int pirq;
+};
+
+#endif /* X86_VPCI_H */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff --git a/xen/drivers/vpci/header.c b/xen/drivers/vpci/header.c
index 739a5f610e..b90a7f2b4e 100644
--- a/xen/drivers/vpci/header.c
+++ b/xen/drivers/vpci/header.c
@@ -17,11 +17,12 @@
  * License along with this program; If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include "private.h"
+
 #include <xen/iocap.h>
 #include <xen/lib.h>
 #include <xen/sched.h>
 #include <xen/softirq.h>
-#include <xen/vpci.h>
 
 #include <xsm/xsm.h>
 
diff --git a/xen/drivers/vpci/msi.c b/xen/drivers/vpci/msi.c
index 737770ffa3..f736054b2b 100644
--- a/xen/drivers/vpci/msi.c
+++ b/xen/drivers/vpci/msi.c
@@ -16,9 +16,10 @@
  * License along with this program; If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include "private.h"
+
 #include <xen/sched.h>
 #include <xen/softirq.h>
-#include <xen/vpci.h>
 
 #include <asm/msi.h>
 
diff --git a/xen/drivers/vpci/msix.c b/xen/drivers/vpci/msix.c
index eaf8fae970..f87212b46f 100644
--- a/xen/drivers/vpci/msix.c
+++ b/xen/drivers/vpci/msix.c
@@ -17,10 +17,11 @@
  * License along with this program; If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include "private.h"
+
 #include <xen/io.h>
 #include <xen/lib.h>
 #include <xen/sched.h>
-#include <xen/vpci.h>
 
 #include <asm/msi.h>
 #include <asm/p2m.h>
diff --git a/xen/drivers/vpci/private.h b/xen/drivers/vpci/private.h
new file mode 100644
index 0000000000..5a7ca47557
--- /dev/null
+++ b/xen/drivers/vpci/private.h
@@ -0,0 +1,126 @@
+#ifndef VPCI_PRIVATE_H
+#define VPCI_PRIVATE_H
+
+#include <xen/vpci.h>
+
+typedef uint32_t vpci_read_t(const struct pci_dev *pdev, unsigned int reg,
+                             void *data);
+
+typedef void vpci_write_t(const struct pci_dev *pdev, unsigned int reg,
+                          uint32_t val, void *data);
+
+typedef struct {
+    unsigned int id;
+    bool is_ext;
+    int (* init)(struct pci_dev *pdev);
+    int (* cleanup)(const struct pci_dev *pdev, bool hide);
+} vpci_capability_t;
+
+#define REGISTER_VPCI_CAPABILITY(cap, name, finit, fclean, ext) \
+    static const vpci_capability_t name##_entry \
+        __used_section(".data.rel.ro.vpci") = { \
+        .id = (cap), \
+        .init = (finit), \
+        .cleanup = (fclean), \
+        .is_ext = (ext), \
+    }
+
+#define REGISTER_VPCI_CAP(name, finit, fclean) \
+    REGISTER_VPCI_CAPABILITY(PCI_CAP_ID_##name, name, finit, fclean, false)
+#define REGISTER_VPCI_EXTCAP(name, finit, fclean) \
+    REGISTER_VPCI_CAPABILITY(PCI_EXT_CAP_ID_##name, name, finit, fclean, true)
+
+int __must_check vpci_init_header(struct pci_dev *pdev);
+
+/* Add/remove a register handler. */
+int __must_check vpci_add_register_mask(struct vpci *vpci,
+                                        vpci_read_t *read_handler,
+                                        vpci_write_t *write_handler,
+                                        unsigned int offset, unsigned int size,
+                                        void *data, uint32_t ro_mask,
+                                        uint32_t rw1c_mask, uint32_t rsvdp_mask,
+                                        uint32_t rsvdz_mask);
+int __must_check vpci_add_register(struct vpci *vpci,
+                                   vpci_read_t *read_handler,
+                                   vpci_write_t *write_handler,
+                                   unsigned int offset, unsigned int size,
+                                   void *data);
+
+int vpci_remove_registers(struct vpci *vpci, unsigned int start,
+                          unsigned int size);
+
+/* Helper to return the value passed in data. */
+uint32_t cf_check vpci_read_val(
+    const struct pci_dev *pdev, unsigned int reg, void *data);
+
+/* Passthrough handlers. */
+uint32_t cf_check vpci_hw_read8(
+    const struct pci_dev *pdev, unsigned int reg, void *data);
+uint32_t cf_check vpci_hw_read16(
+    const struct pci_dev *pdev, unsigned int reg, void *data);
+uint32_t cf_check vpci_hw_read32(
+    const struct pci_dev *pdev, unsigned int reg, void *data);
+void cf_check vpci_hw_write8(
+    const struct pci_dev *pdev, unsigned int reg, uint32_t val, void *data);
+void cf_check vpci_hw_write16(
+    const struct pci_dev *pdev, unsigned int reg, uint32_t val, void *data);
+
+#ifdef __XEN__
+/* Make sure there's a hole in the p2m for the MSIX mmio areas. */
+int vpci_make_msix_hole(const struct pci_dev *pdev);
+
+/*
+ * Helper functions to fetch MSIX related data. They are used by both the
+ * emulated MSIX code and the BAR handlers.
+ */
+static inline paddr_t vmsix_table_host_base(const struct vpci *vpci,
+                                            unsigned int nr)
+{
+    return vpci->header.bars[vpci->msix->tables[nr] & PCI_MSIX_BIRMASK].addr;
+}
+
+static inline paddr_t vmsix_table_host_addr(const struct vpci *vpci,
+                                            unsigned int nr)
+{
+    return vmsix_table_host_base(vpci, nr) +
+           (vpci->msix->tables[nr] & ~PCI_MSIX_BIRMASK);
+}
+
+static inline paddr_t vmsix_table_base(const struct vpci *vpci, unsigned int nr)
+{
+    return vpci->header.bars[vpci->msix->tables[nr] &
+                             PCI_MSIX_BIRMASK].guest_addr;
+}
+
+static inline paddr_t vmsix_table_addr(const struct vpci *vpci, unsigned int nr)
+{
+    return vmsix_table_base(vpci, nr) +
+           (vpci->msix->tables[nr] & ~PCI_MSIX_BIRMASK);
+}
+
+/*
+ * Note regarding the size calculation of the PBA: the spec mentions "The last
+ * QWORD will not necessarily be fully populated", so it implies that the PBA
+ * size is 64-bit aligned.
+ */
+static inline size_t vmsix_table_size(const struct vpci *vpci, unsigned int nr)
+{
+    return
+        (nr == VPCI_MSIX_TABLE) ? vpci->msix->max_entries * PCI_MSIX_ENTRY_SIZE
+                                : ROUNDUP(DIV_ROUND_UP(vpci->msix->max_entries,
+                                                       8), 8);
+}
+
+#endif /* __XEN__ */
+
+#endif /* VPCI_PRIVATE_H */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff --git a/xen/drivers/vpci/rebar.c b/xen/drivers/vpci/rebar.c
index 4d22f08af3..ab5c5453a8 100644
--- a/xen/drivers/vpci/rebar.c
+++ b/xen/drivers/vpci/rebar.c
@@ -5,8 +5,9 @@
  * Author: Jiqian Chen <Jiqian.Chen@amd.com>
  */
 
+#include "private.h"
+
 #include <xen/sched.h>
-#include <xen/vpci.h>
 
 static void cf_check rebar_ctrl_write(const struct pci_dev *pdev,
                                       unsigned int reg,
diff --git a/xen/drivers/vpci/vpci.c b/xen/drivers/vpci/vpci.c
index f66f50c8ba..ce0f297b44 100644
--- a/xen/drivers/vpci/vpci.c
+++ b/xen/drivers/vpci/vpci.c
@@ -17,8 +17,9 @@
  * License along with this program; If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include "private.h"
+
 #include <xen/sched.h>
-#include <xen/vpci.h>
 #include <xen/vmap.h>
 
 /* Internal struct to store the emulated PCI registers. */
diff --git a/xen/include/xen/vpci.h b/xen/include/xen/vpci.h
index d6310104ea..d104efbce2 100644
--- a/xen/include/xen/vpci.h
+++ b/xen/include/xen/vpci.h
@@ -7,18 +7,7 @@
 #include <xen/types.h>
 #include <xen/list.h>
 
-typedef uint32_t vpci_read_t(const struct pci_dev *pdev, unsigned int reg,
-                             void *data);
-
-typedef void vpci_write_t(const struct pci_dev *pdev, unsigned int reg,
-                          uint32_t val, void *data);
-
-typedef struct {
-    unsigned int id;
-    bool is_ext;
-    int (* init)(struct pci_dev *pdev);
-    int (* cleanup)(const struct pci_dev *pdev, bool hide);
-} vpci_capability_t;
+#include <asm/vpci.h>
 
 #define VPCI_ECAM_BDF(addr)     (((addr) & 0x0ffff000) >> 12)
 
@@ -30,66 +19,17 @@ typedef struct {
  */
 #define VPCI_MAX_VIRT_DEV       (PCI_SLOT(~0) + 1)
 
-#define REGISTER_VPCI_CAPABILITY(cap, name, finit, fclean, ext) \
-    static const vpci_capability_t name##_entry \
-        __used_section(".data.rel.ro.vpci") = { \
-        .id = (cap), \
-        .init = (finit), \
-        .cleanup = (fclean), \
-        .is_ext = (ext), \
-    }
-
-#define REGISTER_VPCI_CAP(name, finit, fclean) \
-    REGISTER_VPCI_CAPABILITY(PCI_CAP_ID_##name, name, finit, fclean, false)
-#define REGISTER_VPCI_EXTCAP(name, finit, fclean) \
-    REGISTER_VPCI_CAPABILITY(PCI_EXT_CAP_ID_##name, name, finit, fclean, true)
-
-int __must_check vpci_init_header(struct pci_dev *pdev);
-
 /* Assign vPCI to device by adding handlers. */
 int __must_check vpci_assign_device(struct pci_dev *pdev);
 
 /* Remove all handlers and free vpci related structures. */
 void vpci_deassign_device(struct pci_dev *pdev);
 
-/* Add/remove a register handler. */
-int __must_check vpci_add_register_mask(struct vpci *vpci,
-                                        vpci_read_t *read_handler,
-                                        vpci_write_t *write_handler,
-                                        unsigned int offset, unsigned int size,
-                                        void *data, uint32_t ro_mask,
-                                        uint32_t rw1c_mask, uint32_t rsvdp_mask,
-                                        uint32_t rsvdz_mask);
-int __must_check vpci_add_register(struct vpci *vpci,
-                                   vpci_read_t *read_handler,
-                                   vpci_write_t *write_handler,
-                                   unsigned int offset, unsigned int size,
-                                   void *data);
-
-int vpci_remove_registers(struct vpci *vpci, unsigned int start,
-                          unsigned int size);
-
 /* Generic read/write handlers for the PCI config space. */
 uint32_t vpci_read(pci_sbdf_t sbdf, unsigned int reg, unsigned int size);
 void vpci_write(pci_sbdf_t sbdf, unsigned int reg, unsigned int size,
                 uint32_t data);
 
-/* Helper to return the value passed in data. */
-uint32_t cf_check vpci_read_val(
-    const struct pci_dev *pdev, unsigned int reg, void *data);
-
-/* Passthrough handlers. */
-uint32_t cf_check vpci_hw_read8(
-    const struct pci_dev *pdev, unsigned int reg, void *data);
-uint32_t cf_check vpci_hw_read16(
-    const struct pci_dev *pdev, unsigned int reg, void *data);
-uint32_t cf_check vpci_hw_read32(
-    const struct pci_dev *pdev, unsigned int reg, void *data);
-void cf_check vpci_hw_write8(
-    const struct pci_dev *pdev, unsigned int reg, uint32_t val, void *data);
-void cf_check vpci_hw_write16(
-    const struct pci_dev *pdev, unsigned int reg, uint32_t val, void *data);
-
 /*
  * Check for pending vPCI operations on this vcpu. Returns true if the vcpu
  * should not run.
@@ -213,9 +153,6 @@ struct vpci_vcpu {
 #ifdef __XEN__
 void vpci_dump_msi(void);
 
-/* Make sure there's a hole in the p2m for the MSIX mmio areas. */
-int vpci_make_msix_hole(const struct pci_dev *pdev);
-
 /* Arch-specific vPCI MSI helpers. */
 void vpci_msi_arch_mask(struct vpci_msi *msi, const struct pci_dev *pdev,
                         unsigned int entry, bool mask);
@@ -238,48 +175,6 @@ int __must_check vpci_msix_arch_disable_entry(struct vpci_msix_entry *entry,
 void vpci_msix_arch_init_entry(struct vpci_msix_entry *entry);
 int vpci_msix_arch_print(const struct vpci_msix *msix);
 
-/*
- * Helper functions to fetch MSIX related data. They are used by both the
- * emulated MSIX code and the BAR handlers.
- */
-static inline paddr_t vmsix_table_host_base(const struct vpci *vpci,
-                                            unsigned int nr)
-{
-    return vpci->header.bars[vpci->msix->tables[nr] & PCI_MSIX_BIRMASK].addr;
-}
-
-static inline paddr_t vmsix_table_host_addr(const struct vpci *vpci,
-                                            unsigned int nr)
-{
-    return vmsix_table_host_base(vpci, nr) +
-           (vpci->msix->tables[nr] & ~PCI_MSIX_BIRMASK);
-}
-
-static inline paddr_t vmsix_table_base(const struct vpci *vpci, unsigned int nr)
-{
-    return vpci->header.bars[vpci->msix->tables[nr] &
-                             PCI_MSIX_BIRMASK].guest_addr;
-}
-
-static inline paddr_t vmsix_table_addr(const struct vpci *vpci, unsigned int nr)
-{
-    return vmsix_table_base(vpci, nr) +
-           (vpci->msix->tables[nr] & ~PCI_MSIX_BIRMASK);
-}
-
-/*
- * Note regarding the size calculation of the PBA: the spec mentions "The last
- * QWORD will not necessarily be fully populated", so it implies that the PBA
- * size is 64-bit aligned.
- */
-static inline size_t vmsix_table_size(const struct vpci *vpci, unsigned int nr)
-{
-    return
-        (nr == VPCI_MSIX_TABLE) ? vpci->msix->max_entries * PCI_MSIX_ENTRY_SIZE
-                                : ROUNDUP(DIV_ROUND_UP(vpci->msix->max_entries,
-                                                       8), 8);
-}
-
 static inline unsigned int vmsix_entry_nr(const struct vpci_msix *msix,
                                           const struct vpci_msix_entry *entry)
 {
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Mar 04 08:44:13 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Mar 2026 08:44:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1245167.1544527 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxhq1-0001ob-DD; Wed, 04 Mar 2026 08:44:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1245167.1544527; Wed, 04 Mar 2026 08:44:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxhq1-0001oT-Ad; Wed, 04 Mar 2026 08:44:13 +0000
Received: by outflank-mailman (input) for mailman id 1245167;
 Wed, 04 Mar 2026 08:44:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vxhpz-0001oC-P4
 for xen-changelog@lists.xenproject.org; Wed, 04 Mar 2026 08:44:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxhpz-004nSA-2O
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 08:44:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxhpz-00FZb1-2D
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 08:44:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=y6NeUat9gXwmCN/0z7jmczZhoxfuRfnPqKgxBFzgu4o=; b=UPJCYe4SMt6UZrqSUkwoMXfD38
	XYwQBu8c32ZchEvxHXc4/T+60rajbNsBo7A+XSqeB6RQN2AWo5VjnUvsoGD7jBsXtmMTxaWwsEFCm
	E0cY3fVYLB7bPlGySswK5MYLS9JeEJgWGzr55ymuKJOkQBGtISe3uiVphpJgzIzgHVS8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] vPCI: move vpci_init_capabilities() to a separate file
Message-Id: <E1vxhpz-00FZb1-2D@xenbits.xenproject.org>
Date: Wed, 04 Mar 2026 08:44:11 +0000

commit 998060dd91015988760e21b6e5966a4455868df8
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Mar 4 08:22:42 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 4 08:22:42 2026 +0100

    vPCI: move vpci_init_capabilities() to a separate file
    
    Let's keep capability handling together. Start with moving
    vpci_init_capabilities() and its helpers, plus splitting out of its
    cleanup counterpart.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Stewart Hildebrand <stewart.hildebrand@amd.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/drivers/vpci/Makefile  |   1 +
 xen/drivers/vpci/cap.c     | 252 +++++++++++++++++++++++++++++++++++++++++++++
 xen/drivers/vpci/private.h |  21 ++++
 xen/drivers/vpci/vpci.c    | 250 +-------------------------------------------
 4 files changed, 278 insertions(+), 246 deletions(-)

diff --git a/xen/drivers/vpci/Makefile b/xen/drivers/vpci/Makefile
index a7c8a30a89..9793a4f9b0 100644
--- a/xen/drivers/vpci/Makefile
+++ b/xen/drivers/vpci/Makefile
@@ -1,2 +1,3 @@
+obj-y += cap.o
 obj-y += vpci.o header.o rebar.o
 obj-$(CONFIG_HAS_PCI_MSI) += msi.o msix.o
diff --git a/xen/drivers/vpci/cap.c b/xen/drivers/vpci/cap.c
new file mode 100644
index 0000000000..37c1811c62
--- /dev/null
+++ b/xen/drivers/vpci/cap.c
@@ -0,0 +1,252 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Capability handling for guest PCI configuration space.
+ */
+
+#include "private.h"
+
+#include <xen/sched.h>
+
+extern const vpci_capability_t __start_vpci_array[];
+extern const vpci_capability_t __end_vpci_array[];
+#define NUM_VPCI_INIT (__end_vpci_array - __start_vpci_array)
+
+static struct vpci_register *vpci_get_previous_cap_register(
+    const struct vpci *vpci, unsigned int offset)
+{
+    unsigned int next;
+    struct vpci_register *r;
+
+    if ( offset < 0x40 )
+    {
+        ASSERT_UNREACHABLE();
+        return NULL;
+    }
+
+    for ( r = vpci_get_register(vpci, PCI_CAPABILITY_LIST, 1); r;
+          r = next >= 0x40 ? vpci_get_register(vpci,
+                                               next + PCI_CAP_LIST_NEXT, 1)
+                           : NULL )
+    {
+        next = (unsigned int)(uintptr_t)r->private;
+        ASSERT(next == (uintptr_t)r->private);
+        if ( next == offset )
+            break;
+    }
+
+    return r;
+}
+
+static int vpci_capability_hide(const struct pci_dev *pdev, unsigned int cap)
+{
+    const unsigned int offset = pci_find_cap_offset(pdev->sbdf, cap);
+    struct vpci_register *prev_r, *next_r;
+    struct vpci *vpci = pdev->vpci;
+
+    if ( !offset )
+    {
+        ASSERT_UNREACHABLE();
+        return 0;
+    }
+
+    spin_lock(&vpci->lock);
+    prev_r = vpci_get_previous_cap_register(vpci, offset);
+    next_r = vpci_get_register(vpci, offset + PCI_CAP_LIST_NEXT, 1);
+    if ( !prev_r || !next_r )
+    {
+        spin_unlock(&vpci->lock);
+        return -ENODEV;
+    }
+
+    prev_r->private = next_r->private;
+    /*
+     * Not calling vpci_remove_registers() here is to avoid redoing
+     * the register search.
+     */
+    list_del(&next_r->node);
+    spin_unlock(&vpci->lock);
+    xfree(next_r);
+
+    if ( !is_hardware_domain(pdev->domain) )
+        return vpci_remove_registers(vpci, offset + PCI_CAP_LIST_ID, 1);
+
+    return 0;
+}
+
+static struct vpci_register *vpci_get_previous_ext_cap_register(
+    const struct vpci *vpci, unsigned int offset)
+{
+    unsigned int pos = PCI_CFG_SPACE_SIZE;
+    struct vpci_register *r;
+
+    if ( offset <= PCI_CFG_SPACE_SIZE )
+    {
+        ASSERT_UNREACHABLE();
+        return NULL;
+    }
+
+    for ( r = vpci_get_register(vpci, pos, 4); r;
+          r = pos > PCI_CFG_SPACE_SIZE ? vpci_get_register(vpci, pos, 4)
+                                       : NULL )
+    {
+        uint32_t header = (uint32_t)(uintptr_t)r->private;
+
+        ASSERT(header == (uintptr_t)r->private);
+
+        pos = PCI_EXT_CAP_NEXT(header);
+        if ( pos == offset )
+            break;
+    }
+
+    return r;
+}
+
+static int vpci_ext_capability_hide(
+    const struct pci_dev *pdev, unsigned int cap)
+{
+    const unsigned int offset = pci_find_ext_capability(pdev, cap);
+    struct vpci_register *r, *prev_r;
+    struct vpci *vpci = pdev->vpci;
+    uint32_t header, pre_header;
+
+    if ( offset < PCI_CFG_SPACE_SIZE )
+    {
+        ASSERT_UNREACHABLE();
+        return 0;
+    }
+
+    spin_lock(&vpci->lock);
+    r = vpci_get_register(vpci, offset, 4);
+    if ( !r )
+    {
+        spin_unlock(&vpci->lock);
+        return -ENODEV;
+    }
+
+    header = (uint32_t)(uintptr_t)r->private;
+    if ( offset == PCI_CFG_SPACE_SIZE )
+    {
+        if ( PCI_EXT_CAP_NEXT(header) <= PCI_CFG_SPACE_SIZE )
+            r->private = (void *)0;
+        else
+            /*
+             * The first extended capability (0x100) can not be removed from
+             * the linked list, so instead mask its capability ID to return 0
+             * hopefully forcing OSes to skip it.
+             */
+            r->private = (void *)(uintptr_t)(header & ~PCI_EXT_CAP_ID(header));
+
+        spin_unlock(&vpci->lock);
+        return 0;
+    }
+
+    prev_r = vpci_get_previous_ext_cap_register(vpci, offset);
+    if ( !prev_r )
+    {
+        spin_unlock(&vpci->lock);
+        return -ENODEV;
+    }
+
+    pre_header = (uint32_t)(uintptr_t)prev_r->private;
+    pre_header &= ~PCI_EXT_CAP_NEXT_MASK;
+    pre_header |= header & PCI_EXT_CAP_NEXT_MASK;
+    prev_r->private = (void *)(uintptr_t)pre_header;
+
+    list_del(&r->node);
+    spin_unlock(&vpci->lock);
+    xfree(r);
+
+    return 0;
+}
+
+int vpci_init_capabilities(struct pci_dev *pdev)
+{
+    for ( unsigned int i = 0; i < NUM_VPCI_INIT; i++ )
+    {
+        const vpci_capability_t *capability = &__start_vpci_array[i];
+        const unsigned int cap = capability->id;
+        const bool is_ext = capability->is_ext;
+        unsigned int pos = 0;
+        int rc;
+
+        if ( !is_ext )
+            pos = pci_find_cap_offset(pdev->sbdf, cap);
+        else if ( is_hardware_domain(pdev->domain) )
+            pos = pci_find_ext_capability(pdev, cap);
+
+        if ( !pos )
+            continue;
+
+        rc = capability->init(pdev);
+        if ( rc )
+        {
+            const char *type = is_ext ? "extended" : "legacy";
+
+            printk(XENLOG_WARNING
+                   "%pd %pp: init %s cap %u fail rc=%d, mask it\n",
+                   pdev->domain, &pdev->sbdf, type, cap, rc);
+
+            if ( capability->cleanup )
+            {
+                rc = capability->cleanup(pdev, true);
+                if ( rc )
+                {
+                    printk(XENLOG_ERR "%pd %pp: clean %s cap %u fail rc=%d\n",
+                           pdev->domain, &pdev->sbdf, type, cap, rc);
+                    if ( !is_hardware_domain(pdev->domain) )
+                        return rc;
+                }
+            }
+
+            if ( !is_ext )
+                rc = vpci_capability_hide(pdev, cap);
+            else
+                rc = vpci_ext_capability_hide(pdev, cap);
+            if ( rc )
+            {
+                printk(XENLOG_ERR "%pd %pp: hide %s cap %u fail rc=%d\n",
+                       pdev->domain, &pdev->sbdf, type, cap, rc);
+                return rc;
+            }
+        }
+    }
+
+    return 0;
+}
+
+void vpci_cleanup_capabilities(struct pci_dev *pdev)
+{
+    for ( unsigned int i = 0; i < NUM_VPCI_INIT; i++ )
+    {
+        const vpci_capability_t *capability = &__start_vpci_array[i];
+        const unsigned int cap = capability->id;
+        unsigned int pos = 0;
+
+        if ( !capability->cleanup )
+            continue;
+
+        if ( !capability->is_ext )
+            pos = pci_find_cap_offset(pdev->sbdf, cap);
+        else if ( is_hardware_domain(pdev->domain) )
+            pos = pci_find_ext_capability(pdev, cap);
+        if ( pos )
+        {
+            int rc = capability->cleanup(pdev, false);
+
+            if ( rc )
+                printk(XENLOG_ERR "%pd %pp: clean %s cap %u fail rc=%d\n",
+                       pdev->domain, &pdev->sbdf,
+                       capability->is_ext ? "extended" : "legacy", cap, rc);
+        }
+    }
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff --git a/xen/drivers/vpci/private.h b/xen/drivers/vpci/private.h
index 5a7ca47557..140092cc52 100644
--- a/xen/drivers/vpci/private.h
+++ b/xen/drivers/vpci/private.h
@@ -9,6 +9,20 @@ typedef uint32_t vpci_read_t(const struct pci_dev *pdev, unsigned int reg,
 typedef void vpci_write_t(const struct pci_dev *pdev, unsigned int reg,
                           uint32_t val, void *data);
 
+/* Internal struct to store the emulated PCI registers. */
+struct vpci_register {
+    vpci_read_t *read;
+    vpci_write_t *write;
+    unsigned int size;
+    unsigned int offset;
+    void *private;
+    struct list_head node;
+    uint32_t ro_mask;
+    uint32_t rw1c_mask;
+    uint32_t rsvdp_mask;
+    uint32_t rsvdz_mask;
+};
+
 typedef struct {
     unsigned int id;
     bool is_ext;
@@ -32,6 +46,9 @@ typedef struct {
 
 int __must_check vpci_init_header(struct pci_dev *pdev);
 
+int vpci_init_capabilities(struct pci_dev *pdev);
+void vpci_cleanup_capabilities(struct pci_dev *pdev);
+
 /* Add/remove a register handler. */
 int __must_check vpci_add_register_mask(struct vpci *vpci,
                                         vpci_read_t *read_handler,
@@ -49,6 +66,10 @@ int __must_check vpci_add_register(struct vpci *vpci,
 int vpci_remove_registers(struct vpci *vpci, unsigned int start,
                           unsigned int size);
 
+struct vpci_register *vpci_get_register(const struct vpci *vpci,
+                                        unsigned int offset,
+                                        unsigned int size);
+
 /* Helper to return the value passed in data. */
 uint32_t cf_check vpci_read_val(
     const struct pci_dev *pdev, unsigned int reg, void *data);
diff --git a/xen/drivers/vpci/vpci.c b/xen/drivers/vpci/vpci.c
index ce0f297b44..683d5fc36c 100644
--- a/xen/drivers/vpci/vpci.c
+++ b/xen/drivers/vpci/vpci.c
@@ -22,24 +22,7 @@
 #include <xen/sched.h>
 #include <xen/vmap.h>
 
-/* Internal struct to store the emulated PCI registers. */
-struct vpci_register {
-    vpci_read_t *read;
-    vpci_write_t *write;
-    unsigned int size;
-    unsigned int offset;
-    void *private;
-    struct list_head node;
-    uint32_t ro_mask;
-    uint32_t rw1c_mask;
-    uint32_t rsvdp_mask;
-    uint32_t rsvdz_mask;
-};
-
 #ifdef __XEN__
-extern const vpci_capability_t __start_vpci_array[];
-extern const vpci_capability_t __end_vpci_array[];
-#define NUM_VPCI_INIT (__end_vpci_array - __start_vpci_array)
 
 #ifdef CONFIG_HAS_VPCI_GUEST_SUPPORT
 static int assign_virtual_sbdf(struct pci_dev *pdev)
@@ -84,9 +67,9 @@ static int assign_virtual_sbdf(struct pci_dev *pdev)
 
 #endif /* CONFIG_HAS_VPCI_GUEST_SUPPORT */
 
-static struct vpci_register *vpci_get_register(const struct vpci *vpci,
-                                               unsigned int offset,
-                                               unsigned int size)
+struct vpci_register *vpci_get_register(const struct vpci *vpci,
+                                        unsigned int offset,
+                                        unsigned int size)
 {
     struct vpci_register *r;
 
@@ -104,209 +87,6 @@ static struct vpci_register *vpci_get_register(const struct vpci *vpci,
     return NULL;
 }
 
-static struct vpci_register *vpci_get_previous_cap_register(
-    const struct vpci *vpci, unsigned int offset)
-{
-    unsigned int next;
-    struct vpci_register *r;
-
-    if ( offset < 0x40 )
-    {
-        ASSERT_UNREACHABLE();
-        return NULL;
-    }
-
-    for ( r = vpci_get_register(vpci, PCI_CAPABILITY_LIST, 1); r;
-          r = next >= 0x40 ? vpci_get_register(vpci,
-                                               next + PCI_CAP_LIST_NEXT, 1)
-                           : NULL )
-    {
-        next = (unsigned int)(uintptr_t)r->private;
-        ASSERT(next == (uintptr_t)r->private);
-        if ( next == offset )
-            break;
-    }
-
-    return r;
-}
-
-static int vpci_capability_hide(const struct pci_dev *pdev, unsigned int cap)
-{
-    const unsigned int offset = pci_find_cap_offset(pdev->sbdf, cap);
-    struct vpci_register *prev_r, *next_r;
-    struct vpci *vpci = pdev->vpci;
-
-    if ( !offset )
-    {
-        ASSERT_UNREACHABLE();
-        return 0;
-    }
-
-    spin_lock(&vpci->lock);
-    prev_r = vpci_get_previous_cap_register(vpci, offset);
-    next_r = vpci_get_register(vpci, offset + PCI_CAP_LIST_NEXT, 1);
-    if ( !prev_r || !next_r )
-    {
-        spin_unlock(&vpci->lock);
-        return -ENODEV;
-    }
-
-    prev_r->private = next_r->private;
-    /*
-     * Not calling vpci_remove_registers() here is to avoid redoing
-     * the register search.
-     */
-    list_del(&next_r->node);
-    spin_unlock(&vpci->lock);
-    xfree(next_r);
-
-    if ( !is_hardware_domain(pdev->domain) )
-        return vpci_remove_registers(vpci, offset + PCI_CAP_LIST_ID, 1);
-
-    return 0;
-}
-
-static struct vpci_register *vpci_get_previous_ext_cap_register(
-    const struct vpci *vpci, unsigned int offset)
-{
-    unsigned int pos = PCI_CFG_SPACE_SIZE;
-    struct vpci_register *r;
-
-    if ( offset <= PCI_CFG_SPACE_SIZE )
-    {
-        ASSERT_UNREACHABLE();
-        return NULL;
-    }
-
-    for ( r = vpci_get_register(vpci, pos, 4); r;
-          r = pos > PCI_CFG_SPACE_SIZE ? vpci_get_register(vpci, pos, 4)
-                                       : NULL )
-    {
-        uint32_t header = (uint32_t)(uintptr_t)r->private;
-
-        ASSERT(header == (uintptr_t)r->private);
-
-        pos = PCI_EXT_CAP_NEXT(header);
-        if ( pos == offset )
-            break;
-    }
-
-    return r;
-}
-
-static int vpci_ext_capability_hide(
-    const struct pci_dev *pdev, unsigned int cap)
-{
-    const unsigned int offset = pci_find_ext_capability(pdev, cap);
-    struct vpci_register *r, *prev_r;
-    struct vpci *vpci = pdev->vpci;
-    uint32_t header, pre_header;
-
-    if ( offset < PCI_CFG_SPACE_SIZE )
-    {
-        ASSERT_UNREACHABLE();
-        return 0;
-    }
-
-    spin_lock(&vpci->lock);
-    r = vpci_get_register(vpci, offset, 4);
-    if ( !r )
-    {
-        spin_unlock(&vpci->lock);
-        return -ENODEV;
-    }
-
-    header = (uint32_t)(uintptr_t)r->private;
-    if ( offset == PCI_CFG_SPACE_SIZE )
-    {
-        if ( PCI_EXT_CAP_NEXT(header) <= PCI_CFG_SPACE_SIZE )
-            r->private = (void *)0;
-        else
-            /*
-             * The first extended capability (0x100) can not be removed from
-             * the linked list, so instead mask its capability ID to return 0
-             * hopefully forcing OSes to skip it.
-             */
-            r->private = (void *)(uintptr_t)(header & ~PCI_EXT_CAP_ID(header));
-
-        spin_unlock(&vpci->lock);
-        return 0;
-    }
-
-    prev_r = vpci_get_previous_ext_cap_register(vpci, offset);
-    if ( !prev_r )
-    {
-        spin_unlock(&vpci->lock);
-        return -ENODEV;
-    }
-
-    pre_header = (uint32_t)(uintptr_t)prev_r->private;
-    pre_header &= ~PCI_EXT_CAP_NEXT_MASK;
-    pre_header |= header & PCI_EXT_CAP_NEXT_MASK;
-    prev_r->private = (void *)(uintptr_t)pre_header;
-
-    list_del(&r->node);
-    spin_unlock(&vpci->lock);
-    xfree(r);
-
-    return 0;
-}
-
-static int vpci_init_capabilities(struct pci_dev *pdev)
-{
-    for ( unsigned int i = 0; i < NUM_VPCI_INIT; i++ )
-    {
-        const vpci_capability_t *capability = &__start_vpci_array[i];
-        const unsigned int cap = capability->id;
-        const bool is_ext = capability->is_ext;
-        unsigned int pos = 0;
-        int rc;
-
-        if ( !is_ext )
-            pos = pci_find_cap_offset(pdev->sbdf, cap);
-        else if ( is_hardware_domain(pdev->domain) )
-            pos = pci_find_ext_capability(pdev, cap);
-
-        if ( !pos )
-            continue;
-
-        rc = capability->init(pdev);
-        if ( rc )
-        {
-            const char *type = is_ext ? "extended" : "legacy";
-
-            printk(XENLOG_WARNING
-                   "%pd %pp: init %s cap %u fail rc=%d, mask it\n",
-                   pdev->domain, &pdev->sbdf, type, cap, rc);
-
-            if ( capability->cleanup )
-            {
-                rc = capability->cleanup(pdev, true);
-                if ( rc )
-                {
-                    printk(XENLOG_ERR "%pd %pp: clean %s cap %u fail rc=%d\n",
-                           pdev->domain, &pdev->sbdf, type, cap, rc);
-                    if ( !is_hardware_domain(pdev->domain) )
-                        return rc;
-                }
-            }
-
-            if ( !is_ext )
-                rc = vpci_capability_hide(pdev, cap);
-            else
-                rc = vpci_ext_capability_hide(pdev, cap);
-            if ( rc )
-            {
-                printk(XENLOG_ERR "%pd %pp: hide %s cap %u fail rc=%d\n",
-                       pdev->domain, &pdev->sbdf, type, cap, rc);
-                return rc;
-            }
-        }
-    }
-
-    return 0;
-}
-
 void vpci_deassign_device(struct pci_dev *pdev)
 {
     unsigned int i;
@@ -322,29 +102,7 @@ void vpci_deassign_device(struct pci_dev *pdev)
                     &pdev->domain->vpci_dev_assigned_map);
 #endif
 
-    for ( i = 0; i < NUM_VPCI_INIT; i++ )
-    {
-        const vpci_capability_t *capability = &__start_vpci_array[i];
-        const unsigned int cap = capability->id;
-        unsigned int pos = 0;
-
-        if ( !capability->cleanup )
-            continue;
-
-        if ( !capability->is_ext )
-            pos = pci_find_cap_offset(pdev->sbdf, cap);
-        else if ( is_hardware_domain(pdev->domain) )
-            pos = pci_find_ext_capability(pdev, cap);
-        if ( pos )
-        {
-            int rc = capability->cleanup(pdev, false);
-
-            if ( rc )
-                printk(XENLOG_ERR "%pd %pp: clean %s cap %u fail rc=%d\n",
-                       pdev->domain, &pdev->sbdf,
-                       capability->is_ext ? "extended" : "legacy", cap, rc);
-        }
-    }
+    vpci_cleanup_capabilities(pdev);
 
     spin_lock(&pdev->vpci->lock);
     while ( !list_empty(&pdev->vpci->handlers) )
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Mar 04 08:44:23 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Mar 2026 08:44:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1245168.1544532 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxhqB-0001vD-GG; Wed, 04 Mar 2026 08:44:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1245168.1544532; Wed, 04 Mar 2026 08:44:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxhqB-0001v5-DL; Wed, 04 Mar 2026 08:44:23 +0000
Received: by outflank-mailman (input) for mailman id 1245168;
 Wed, 04 Mar 2026 08:44:21 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vxhq9-0001uo-To
 for xen-changelog@lists.xenproject.org; Wed, 04 Mar 2026 08:44:21 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxhq9-004nSE-2s
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 08:44:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxhq9-00FZd7-2a
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 08:44:21 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=9SB0hSuPUMDp7ySZUY1FnyrGOap4AihzyBGVh9YAY9I=; b=1dN/74K7kfKDWIbO/ppjZonIWf
	tvutg4zv3ygZRA+fcH7H/u+6ZbUGsGVvO/9gE8diMEr5IXOYvLitjPqwpDaMzRplS5MXXSr2W7c6o
	8pT6mzky11Jceojs1vaYbMVE+2U2tclAdIF/WL1msTBHIDI7UUkqbYHYOg6MQXau6LCg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] vPCI: move capability-list init
Message-Id: <E1vxhq9-00FZd7-2a@xenbits.xenproject.org>
Date: Wed, 04 Mar 2026 08:44:21 +0000

commit 16c3761129cd5bddd36da16a77b40bde973d8e54
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Mar 4 08:23:22 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 4 08:23:22 2026 +0100

    vPCI: move capability-list init
    
    ... both for when the functions are invoked and where they live in source.
    Don't invoke them directly in vpci_init_header(), but instead first thing
    in vpci_init_capabilities().
    
    Suggested-by: Roger Pau Monné <roger.pau@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Stewart Hildebrand <stewart.hildebrand@amd.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/drivers/vpci/cap.c    | 137 +++++++++++++++++++++++++++++++++++++++++++++-
 xen/drivers/vpci/header.c | 134 ---------------------------------------------
 2 files changed, 136 insertions(+), 135 deletions(-)

diff --git a/xen/drivers/vpci/cap.c b/xen/drivers/vpci/cap.c
index 37c1811c62..e26a2f95da 100644
--- a/xen/drivers/vpci/cap.c
+++ b/xen/drivers/vpci/cap.c
@@ -159,15 +159,150 @@ static int vpci_ext_capability_hide(
     return 0;
 }
 
+static int vpci_init_capability_list(struct pci_dev *pdev)
+{
+    int rc;
+    bool mask_cap_list = false;
+    bool is_hwdom = is_hardware_domain(pdev->domain);
+
+    if ( pci_conf_read16(pdev->sbdf, PCI_STATUS) & PCI_STATUS_CAP_LIST )
+    {
+        /* Only expose capabilities to the guest that vPCI can handle. */
+        unsigned int next, ttl = 48;
+        static const unsigned int supported_caps[] = {
+            PCI_CAP_ID_MSI,
+            PCI_CAP_ID_MSIX,
+        };
+        /*
+         * For dom0, we should expose all capabilities instead of a fixed
+         * capabilities array, so setting n to 0 here is to get the next
+         * capability position directly in pci_find_next_cap_ttl.
+         */
+        const unsigned int n = is_hwdom ? 0 : ARRAY_SIZE(supported_caps);
+
+        next = pci_find_next_cap_ttl(pdev->sbdf, PCI_CAPABILITY_LIST,
+                                     supported_caps, n, &ttl);
+
+        rc = vpci_add_register(pdev->vpci, vpci_read_val,
+                               is_hwdom ? vpci_hw_write8 : NULL,
+                               PCI_CAPABILITY_LIST, 1,
+                               (void *)(uintptr_t)next);
+        if ( rc )
+            return rc;
+
+        next &= ~3;
+
+        if ( !next && !is_hwdom )
+            /*
+             * If we don't have any supported capabilities to expose to the
+             * guest, mask the PCI_STATUS_CAP_LIST bit in the status
+             * register.
+             */
+            mask_cap_list = true;
+
+        while ( next && ttl )
+        {
+            unsigned int pos = next;
+
+            next = pci_find_next_cap_ttl(pdev->sbdf,
+                                         pos + PCI_CAP_LIST_NEXT,
+                                         supported_caps, n, &ttl);
+
+            if ( !is_hwdom )
+            {
+                rc = vpci_add_register(pdev->vpci, vpci_hw_read8, NULL,
+                                       pos + PCI_CAP_LIST_ID, 1, NULL);
+                if ( rc )
+                    return rc;
+            }
+
+            rc = vpci_add_register(pdev->vpci, vpci_read_val,
+                                   is_hwdom ? vpci_hw_write8 : NULL,
+                                   pos + PCI_CAP_LIST_NEXT, 1,
+                                   (void *)(uintptr_t)next);
+            if ( rc )
+                return rc;
+
+            next &= ~3;
+        }
+    }
+
+    /* Return early for the hw domain, no masking of PCI_STATUS. */
+    if ( is_hwdom )
+        return 0;
+
+    /* Utilize rsvdp_mask to hide PCI_STATUS_CAP_LIST from the guest. */
+    return vpci_add_register_mask(pdev->vpci, vpci_hw_read16, vpci_hw_write16,
+                                  PCI_STATUS, 2, NULL,
+                                  PCI_STATUS_RO_MASK &
+                                    ~(mask_cap_list ? PCI_STATUS_CAP_LIST : 0),
+                                  PCI_STATUS_RW1C_MASK,
+                                  mask_cap_list ? PCI_STATUS_CAP_LIST : 0,
+                                  PCI_STATUS_RSVDZ_MASK);
+}
+
+static int vpci_init_ext_capability_list(const struct pci_dev *pdev)
+{
+    unsigned int pos = PCI_CFG_SPACE_SIZE;
+
+    if ( !pdev->ext_cfg )
+        return 0;
+
+    if ( !is_hardware_domain(pdev->domain) )
+        /* Extended capabilities read as zero, write ignore for DomU */
+        return vpci_add_register(pdev->vpci, vpci_read_val, NULL,
+                                 pos, 4, (void *)0);
+
+    do
+    {
+        uint32_t header = pci_conf_read32(pdev->sbdf, pos);
+        int rc;
+
+        if ( header == 0xffffffffU )
+        {
+            printk(XENLOG_WARNING
+                   "%pd %pp: broken extended cap list, offset %#x\n",
+                   pdev->domain, &pdev->sbdf, pos);
+            return 0;
+        }
+
+        rc = vpci_add_register(pdev->vpci, vpci_read_val, NULL,
+                               pos, 4, (void *)(uintptr_t)header);
+        if ( rc == -EEXIST )
+        {
+            printk(XENLOG_WARNING
+                   "%pd %pp: overlap in extended cap list, offset %#x\n",
+                   pdev->domain, &pdev->sbdf, pos);
+            return 0;
+        }
+
+        if ( rc )
+            return rc;
+
+        pos = PCI_EXT_CAP_NEXT(header);
+    } while ( pos >= PCI_CFG_SPACE_SIZE );
+
+    return 0;
+}
+
 int vpci_init_capabilities(struct pci_dev *pdev)
 {
+    int rc;
+
+    rc = vpci_init_capability_list(pdev);
+    if ( rc )
+        return rc;
+
+    rc = vpci_init_ext_capability_list(pdev);
+    if ( rc )
+        return rc;
+
     for ( unsigned int i = 0; i < NUM_VPCI_INIT; i++ )
     {
         const vpci_capability_t *capability = &__start_vpci_array[i];
         const unsigned int cap = capability->id;
         const bool is_ext = capability->is_ext;
         unsigned int pos = 0;
-        int rc;
 
         if ( !is_ext )
             pos = pci_find_cap_offset(pdev->sbdf, cap);
diff --git a/xen/drivers/vpci/header.c b/xen/drivers/vpci/header.c
index b90a7f2b4e..1c0818c2e7 100644
--- a/xen/drivers/vpci/header.c
+++ b/xen/drivers/vpci/header.c
@@ -744,132 +744,6 @@ static int bar_add_rangeset(const struct pci_dev *pdev, struct vpci_bar *bar,
     return !bar->mem ? -ENOMEM : 0;
 }
 
-static int vpci_init_capability_list(struct pci_dev *pdev)
-{
-    int rc;
-    bool mask_cap_list = false;
-    bool is_hwdom = is_hardware_domain(pdev->domain);
-
-    if ( pci_conf_read16(pdev->sbdf, PCI_STATUS) & PCI_STATUS_CAP_LIST )
-    {
-        /* Only expose capabilities to the guest that vPCI can handle. */
-        unsigned int next, ttl = 48;
-        static const unsigned int supported_caps[] = {
-            PCI_CAP_ID_MSI,
-            PCI_CAP_ID_MSIX,
-        };
-        /*
-         * For dom0, we should expose all capabilities instead of a fixed
-         * capabilities array, so setting n to 0 here is to get the next
-         * capability position directly in pci_find_next_cap_ttl.
-         */
-        const unsigned int n = is_hwdom ? 0 : ARRAY_SIZE(supported_caps);
-
-        next = pci_find_next_cap_ttl(pdev->sbdf, PCI_CAPABILITY_LIST,
-                                     supported_caps, n, &ttl);
-
-        rc = vpci_add_register(pdev->vpci, vpci_read_val,
-                               is_hwdom ? vpci_hw_write8 : NULL,
-                               PCI_CAPABILITY_LIST, 1,
-                               (void *)(uintptr_t)next);
-        if ( rc )
-            return rc;
-
-        next &= ~3;
-
-        if ( !next && !is_hwdom )
-            /*
-             * If we don't have any supported capabilities to expose to the
-             * guest, mask the PCI_STATUS_CAP_LIST bit in the status
-             * register.
-             */
-            mask_cap_list = true;
-
-        while ( next && ttl )
-        {
-            unsigned int pos = next;
-
-            next = pci_find_next_cap_ttl(pdev->sbdf,
-                                         pos + PCI_CAP_LIST_NEXT,
-                                         supported_caps, n, &ttl);
-
-            if ( !is_hwdom )
-            {
-                rc = vpci_add_register(pdev->vpci, vpci_hw_read8, NULL,
-                                       pos + PCI_CAP_LIST_ID, 1, NULL);
-                if ( rc )
-                    return rc;
-            }
-
-            rc = vpci_add_register(pdev->vpci, vpci_read_val,
-                                   is_hwdom ? vpci_hw_write8 : NULL,
-                                   pos + PCI_CAP_LIST_NEXT, 1,
-                                   (void *)(uintptr_t)next);
-            if ( rc )
-                return rc;
-
-            next &= ~3;
-        }
-    }
-
-    /* Return early for the hw domain, no masking of PCI_STATUS. */
-    if ( is_hwdom )
-        return 0;
-
-    /* Utilize rsvdp_mask to hide PCI_STATUS_CAP_LIST from the guest. */
-    return vpci_add_register_mask(pdev->vpci, vpci_hw_read16, vpci_hw_write16,
-                                  PCI_STATUS, 2, NULL,
-                                  PCI_STATUS_RO_MASK &
-                                    ~(mask_cap_list ? PCI_STATUS_CAP_LIST : 0),
-                                  PCI_STATUS_RW1C_MASK,
-                                  mask_cap_list ? PCI_STATUS_CAP_LIST : 0,
-                                  PCI_STATUS_RSVDZ_MASK);
-}
-
-static int vpci_init_ext_capability_list(const struct pci_dev *pdev)
-{
-    unsigned int pos = PCI_CFG_SPACE_SIZE;
-
-    if ( !pdev->ext_cfg )
-        return 0;
-
-    if ( !is_hardware_domain(pdev->domain) )
-        /* Extended capabilities read as zero, write ignore for DomU */
-        return vpci_add_register(pdev->vpci, vpci_read_val, NULL,
-                                 pos, 4, (void *)0);
-
-    do
-    {
-        uint32_t header = pci_conf_read32(pdev->sbdf, pos);
-        int rc;
-
-        if ( header == 0xffffffffU )
-        {
-            printk(XENLOG_WARNING
-                   "%pd %pp: broken extended cap list, offset %#x\n",
-                   pdev->domain, &pdev->sbdf, pos);
-            return 0;
-        }
-
-        rc = vpci_add_register(pdev->vpci, vpci_read_val, NULL,
-                               pos, 4, (void *)(uintptr_t)header);
-        if ( rc == -EEXIST )
-        {
-            printk(XENLOG_WARNING
-                   "%pd %pp: overlap in extended cap list, offset %#x\n",
-                   pdev->domain, &pdev->sbdf, pos);
-            return 0;
-        }
-
-        if ( rc )
-            return rc;
-
-        pos = PCI_EXT_CAP_NEXT(header);
-    } while ( pos >= PCI_CFG_SPACE_SIZE );
-
-    return 0;
-}
-
 int vpci_init_header(struct pci_dev *pdev)
 {
     uint16_t cmd;
@@ -918,14 +792,6 @@ int vpci_init_header(struct pci_dev *pdev)
     if ( rc )
         return rc;
 
-    rc = vpci_init_capability_list(pdev);
-    if ( rc )
-        return rc;
-
-    rc = vpci_init_ext_capability_list(pdev);
-    if ( rc )
-        return rc;
-
     if ( pdev->ignore_bars )
         return 0;
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Mar 04 08:44:33 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Mar 2026 08:44:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1245169.1544536 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxhqL-0001y4-HF; Wed, 04 Mar 2026 08:44:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1245169.1544536; Wed, 04 Mar 2026 08:44:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxhqL-0001xw-Eh; Wed, 04 Mar 2026 08:44:33 +0000
Received: by outflank-mailman (input) for mailman id 1245169;
 Wed, 04 Mar 2026 08:44:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vxhqK-0001xi-0O
 for xen-changelog@lists.xenproject.org; Wed, 04 Mar 2026 08:44:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxhqJ-004nSI-3A
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 08:44:31 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxhqJ-00FZeY-34
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 08:44:31 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=8JsQqUg46JlU7bLugFuGobOLb2ZKyamuE2LYsjk5hoc=; b=blgUxvK5BDT2F2plUESRVQB3mf
	wJ9ygiLdpZu64eAQHCP9vKYkuIU4M7zk/r24V5y8rDxlFiA9l2ZklIqUQu4zNqSJXkyP5k7amWMeu
	6tJbNuqMx0NFVdxS6N/uvCr2h6H6Dsb1j3T7zpiME0JjCgWjb1o1tIzMwWGMtTlTgN6Q=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/time: move ticks<->ns helpers to common code
Message-Id: <E1vxhqJ-00FZeY-34@xenbits.xenproject.org>
Date: Wed, 04 Mar 2026 08:44:31 +0000

commit c66d20357726806e754970bab4f7ecec8c8d44cb
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Wed Mar 4 08:24:28 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 4 08:24:28 2026 +0100

    xen/time: move ticks<->ns helpers to common code
    
    ticks_to_ns() and ns_to_ticks() are not architecture-specific, so provide a
    common implementation that is more resilient to overflow than the historical
    Arm version. This is not a practical issue for Arm, as the latest ARM ARM
    that timer frequency should be fixed at 1 GHz and older platforms used much
    lower rates, which is shy of 32-bit overflow. As the helpers are declared
    as static inline, they should not affect x86, which does not use them.
    
    On Arm, these helpers were historically implemented as out-of-line functions
    because the counter frequency was originally defined as static and unavailable
    to headers [1]. Later changes [2] removed this restriction, but the helpers
    remained unchanged. Now they can be implemented as static inline without any
    issues.
    
    Centralising the helpers avoids duplication and removes subtle differences
    between architectures while keeping the implementation simple.
    
    Drop redundant <asm/time.h> includes where <xen/time.h> already pulls it in.
    
    No functional change is intended.
    
    [1] ddee56dc2994 arm: driver for the generic timer for ARMv7
    [2] 096578b4e489 xen: move XEN_SYSCTL_physinfo, XEN_SYSCTL_numainfo and
                          XEN_SYSCTL_topologyinfo to common code
    
    Suggested-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 xen/arch/arm/include/asm/time.h   |  3 ---
 xen/arch/arm/time.c               | 11 -----------
 xen/arch/arm/vtimer.c             |  2 +-
 xen/arch/riscv/include/asm/time.h |  5 -----
 xen/arch/riscv/time.c             |  1 +
 xen/include/xen/time.h            | 11 +++++++++++
 6 files changed, 13 insertions(+), 20 deletions(-)

diff --git a/xen/arch/arm/include/asm/time.h b/xen/arch/arm/include/asm/time.h
index 49ad8c1a6d..c194dbb9f5 100644
--- a/xen/arch/arm/include/asm/time.h
+++ b/xen/arch/arm/include/asm/time.h
@@ -101,9 +101,6 @@ extern void init_timer_interrupt(void);
 /* Counter value at boot time */
 extern uint64_t boot_count;
 
-extern s_time_t ticks_to_ns(uint64_t ticks);
-extern uint64_t ns_to_ticks(s_time_t ns);
-
 void preinit_xen_time(void);
 
 void force_update_vcpu_system_time(struct vcpu *v);
diff --git a/xen/arch/arm/time.c b/xen/arch/arm/time.c
index cc3fcf47b6..a12912a106 100644
--- a/xen/arch/arm/time.c
+++ b/xen/arch/arm/time.c
@@ -27,7 +27,6 @@
 #include <asm/cpufeature.h>
 #include <asm/platform.h>
 #include <asm/system.h>
-#include <asm/time.h>
 #include <asm/vgic.h>
 
 uint64_t __read_mostly boot_count;
@@ -47,16 +46,6 @@ unsigned int timer_get_irq(enum timer_ppi ppi)
     return timer_irq[ppi];
 }
 
-/*static inline*/ s_time_t ticks_to_ns(uint64_t ticks)
-{
-    return muldiv64(ticks, SECONDS(1), 1000 * cpu_khz);
-}
-
-/*static inline*/ uint64_t ns_to_ticks(s_time_t ns)
-{
-    return muldiv64(ns, 1000 * cpu_khz, SECONDS(1));
-}
-
 static __initdata struct dt_device_node *timer;
 
 #ifdef CONFIG_ACPI
diff --git a/xen/arch/arm/vtimer.c b/xen/arch/arm/vtimer.c
index d2124b1755..2e85ff2b6e 100644
--- a/xen/arch/arm/vtimer.c
+++ b/xen/arch/arm/vtimer.c
@@ -12,13 +12,13 @@
 #include <xen/lib.h>
 #include <xen/perfc.h>
 #include <xen/sched.h>
+#include <xen/time.h>
 #include <xen/timer.h>
 
 #include <asm/cpregs.h>
 #include <asm/div64.h>
 #include <asm/irq.h>
 #include <asm/regs.h>
-#include <asm/time.h>
 #include <asm/vgic.h>
 #include <asm/vreg.h>
 #include <asm/vtimer.h>
diff --git a/xen/arch/riscv/include/asm/time.h b/xen/arch/riscv/include/asm/time.h
index 1e7801e2ea..be3875b998 100644
--- a/xen/arch/riscv/include/asm/time.h
+++ b/xen/arch/riscv/include/asm/time.h
@@ -24,11 +24,6 @@ static inline cycles_t get_cycles(void)
     return csr_read(CSR_TIME);
 }
 
-static inline s_time_t ticks_to_ns(uint64_t ticks)
-{
-    return muldiv64(ticks, MILLISECS(1), cpu_khz);
-}
-
 void preinit_xen_time(void);
 
 #endif /* ASM__RISCV__TIME_H */
diff --git a/xen/arch/riscv/time.c b/xen/arch/riscv/time.c
index e962f8518d..2c7af0a5d6 100644
--- a/xen/arch/riscv/time.c
+++ b/xen/arch/riscv/time.c
@@ -4,6 +4,7 @@
 #include <xen/init.h>
 #include <xen/lib.h>
 #include <xen/sections.h>
+#include <xen/time.h>
 #include <xen/types.h>
 
 unsigned long __ro_after_init cpu_khz; /* CPU clock frequency in kHz. */
diff --git a/xen/include/xen/time.h b/xen/include/xen/time.h
index fe0d7a578a..2185dd26a4 100644
--- a/xen/include/xen/time.h
+++ b/xen/include/xen/time.h
@@ -8,6 +8,7 @@
 #ifndef __XEN_TIME_H__
 #define __XEN_TIME_H__
 
+#include <xen/muldiv64.h>
 #include <xen/types.h>
 #include <public/xen.h>
 
@@ -75,6 +76,16 @@ extern void send_timer_event(struct vcpu *v);
 
 void domain_set_time_offset(struct domain *d, int64_t time_offset_seconds);
 
+static inline s_time_t ticks_to_ns(uint64_t ticks)
+{
+    return muldiv64(ticks, MILLISECS(1), cpu_khz);
+}
+
+static inline uint64_t ns_to_ticks(s_time_t ns)
+{
+    return muldiv64(ns, cpu_khz, MILLISECS(1));
+}
+
 #include <asm/time.h>
 
 #endif /* __XEN_TIME_H__ */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Mar 04 08:44:43 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Mar 2026 08:44:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1245170.1544540 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxhqV-00021P-Id; Wed, 04 Mar 2026 08:44:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1245170.1544540; Wed, 04 Mar 2026 08:44:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxhqV-00021H-G0; Wed, 04 Mar 2026 08:44:43 +0000
Received: by outflank-mailman (input) for mailman id 1245170;
 Wed, 04 Mar 2026 08:44:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vxhqU-000214-2s
 for xen-changelog@lists.xenproject.org; Wed, 04 Mar 2026 08:44:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxhqU-004nSO-0C
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 08:44:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxhqU-00FZfP-06
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 08:44:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=KF/IJvSv9CPLUWaHgS1Ytg72jvKYelQ+BhE8j6EmNcA=; b=qvN18JjMzWpZCVBq4hgkJCccNF
	USRBHbFaIOl0M76xA/dWgdP6MVDYoSlcpNRgjZyf8iAMO9X+/k1KYXjMwelolr+rgq2IISimT+mpI
	o7ocVS4LsRpmwSBow3NKMnnVRiy9XY3jvA+fMu7uKXYtgF5GDcjQo1P1VOpvCrvByjCM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/tests/x86_emulator: fix build on clang-21
Message-Id: <E1vxhqU-00FZfP-06@xenbits.xenproject.org>
Date: Wed, 04 Mar 2026 08:44:42 +0000

commit 34e9c2151444ffc96f0be193445d3f6b146653d3
Author:     Edwin Török <edwin.torok@citrix.com>
AuthorDate: Wed Mar 4 08:25:19 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 4 08:25:19 2026 +0100

    tools/tests/x86_emulator: fix build on clang-21
    
    clang-21's built-in assembler is enabled by default, but it doesn't
    support some mnemonics:
    ```
    test_x86_emulator.c:2636:36: error: invalid instruction mnemonic 'fsaves'
     2636 |                        "fidivs %1\n\t"
    test_x86_emulator.c:2640:24: error: invalid instruction mnemonic 'frstors'
     2640 |         asm volatile ( "frstors %0" :: "m" (res[25]) : "memory" );
          |                        ^
    test_x86_emulator.c:4251:24: error: invalid instruction mnemonic 'vpcmpestriq'
     4251 |                        put_insn(vpcmpestri,
          |                        ^
    ```
    
    Use the external assembler with Clang for consistency with GCC.
    
    Signed-off-by: Edwin Török <edwin.torok@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 tools/tests/x86_emulator/Makefile | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tools/tests/x86_emulator/Makefile b/tools/tests/x86_emulator/Makefile
index e18725d0c3..5003c464f3 100644
--- a/tools/tests/x86_emulator/Makefile
+++ b/tools/tests/x86_emulator/Makefile
@@ -297,6 +297,11 @@ x86_emulate:
 
 HOSTCFLAGS-x86_64 := -fno-PIE
 $(call cc-option-add,HOSTCFLAGS-x86_64,HOSTCC,-no-pie)
+
+# clang's integrated as does not support some mnemonics:
+#  https://github.com/llvm/llvm-project/issues/183635
+$(call cc-option-add,HOSTCFLAGS-x86_64,HOSTCC,-no-integrated-as)
+
 HOSTCFLAGS += $(CFLAGS_xeninclude) -I. $(HOSTCFLAGS-$(XEN_COMPILE_ARCH))
 
 x86.h := $(addprefix $(XEN_ROOT)/tools/include/xen/asm/,\
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Mar 04 08:44:53 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Mar 2026 08:44:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1245171.1544544 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxhqf-00023z-Jv; Wed, 04 Mar 2026 08:44:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1245171.1544544; Wed, 04 Mar 2026 08:44:53 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxhqf-00023r-HJ; Wed, 04 Mar 2026 08:44:53 +0000
Received: by outflank-mailman (input) for mailman id 1245171;
 Wed, 04 Mar 2026 08:44:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vxhqe-00023f-99
 for xen-changelog@lists.xenproject.org; Wed, 04 Mar 2026 08:44:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxhqe-004nSd-0e
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 08:44:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxhqe-00FZg8-0N
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 08:44:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=BHcRzn49JvCOzOCYMMWrSA+cX68jRDXVUivLb1RvltY=; b=0nzTQL2nuHjKvFXdS6Fk6mGGFl
	zX1i7oOA5GeY+gEk9KXxddag5bfy4E6++R7em/TGHKNz1fm8NnOVt6iHjkVlFmWeQVkYC4bm9kEn4
	ySqgtG+SamY0jEc8E8ZjZ4DAqLYCkCSa9ng4PQFp9K+lG4G6ALDGsgaThEnhaXNKWrBY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/tests/x86_emulator: fix undefined behaviour in shift
Message-Id: <E1vxhqe-00FZg8-0N@xenbits.xenproject.org>
Date: Wed, 04 Mar 2026 08:44:52 +0000

commit c8ff52f87620e43e3fbd809e6450d299b567b900
Author:     Edwin Török <edwin.torok@citrix.com>
AuthorDate: Wed Mar 4 08:25:49 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 4 08:25:49 2026 +0100

    tools/tests/x86_emulator: fix undefined behaviour in shift
    
    Fixes this `-fsanitize=undefined` error:
    ```
    test_x86_emulator.c:1103:32: runtime error: left shift of 573785183 by 2 places cannot be represented in type 'int'
    SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior test_x86_emulator.c:1103:32
    ```
    
    Signed-off-by: Edwin Török <edwin.torok@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 tools/tests/x86_emulator/test_x86_emulator.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/tests/x86_emulator/test_x86_emulator.c b/tools/tests/x86_emulator/test_x86_emulator.c
index ea507f9c3a..f30568b7f1 100644
--- a/tools/tests/x86_emulator/test_x86_emulator.c
+++ b/tools/tests/x86_emulator/test_x86_emulator.c
@@ -1100,7 +1100,7 @@ int main(int argc, char **argv)
     regs.edi    = (unsigned long)res;
     rc = x86_emulate(&ctxt, &emulops);
     if ( (rc != X86EMUL_OKAY) ||
-         (*res != ((0x2233445F << 2) | 2)) ||
+         (*res != ((0x2233445FU << 2) | 2)) ||
          ((regs.eflags & (EFLAGS_MASK & ~X86_EFLAGS_OF))
           != EFLAGS_ALWAYS_SET) ||
          (regs.eip != (unsigned long)&instr[3]) )
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Mar 04 08:45:03 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Mar 2026 08:45:03 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1245172.1544549 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxhqp-00026V-Le; Wed, 04 Mar 2026 08:45:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1245172.1544549; Wed, 04 Mar 2026 08:45:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxhqp-00026L-Ih; Wed, 04 Mar 2026 08:45:03 +0000
Received: by outflank-mailman (input) for mailman id 1245172;
 Wed, 04 Mar 2026 08:45:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vxhqo-000267-AB
 for xen-changelog@lists.xenproject.org; Wed, 04 Mar 2026 08:45:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxhqo-004nTR-0v
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 08:45:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxhqo-00FZhH-0p
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 08:45:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=wCXI375sNC0dV1uqcYXNAg+ipmRDIBNRHaULwBEg0CQ=; b=b65Gof22+YgG/e+fzWLhBqkap+
	I9epogs/vEZ6Z8TyshH6wXXFuhjVTLPnpkrk/eWYZfKxFowb7Rae+K6957UV81tu9Lm5OuOTO4DGW
	INJnn1idpuvRMz3dDmhRZ7g83Iv3wIxJvFrxCtgNWBMRyJCEaJAbHBAxV3ewz/TRqreI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/tests/x86_emulator: avoid passing NULL to memcpy
Message-Id: <E1vxhqo-00FZhH-0p@xenbits.xenproject.org>
Date: Wed, 04 Mar 2026 08:45:02 +0000

commit bdd49cc2f61510797a47ad81486be653633ab3ee
Author:     Edwin Török <edwin.torok@citrix.com>
AuthorDate: Wed Mar 4 08:26:11 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 4 08:26:11 2026 +0100

    tools/tests/x86_emulator: avoid passing NULL to memcpy
    
    Fixes this `-fsanitize=undefined` error:
    ```
    test_x86_emulator.c:614:12: runtime error: null pointer passed as argument 1, which is declared to never be null
    /usr/include/string.h:44:28: note: nonnull attribute specified here
    SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior test_x86_emulator.c:614:12
    ```
    
    Although this is more of a grey area: I don't see anything in the
    standard that'd forbid calling `memcpy` with NULL and 0, but `glibc`
    does specify it as non-null, which allows the compiler to make
    optimizations assuming it never is NULL, so this is undefined behaviour
    only on glibc.
    Best to avoid the potential undefined behaviour though.
    
    Signed-off-by: Edwin Török <edwin.torok@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 tools/tests/x86_emulator/test_x86_emulator.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/tests/x86_emulator/test_x86_emulator.c b/tools/tests/x86_emulator/test_x86_emulator.c
index f30568b7f1..20929b80c6 100644
--- a/tools/tests/x86_emulator/test_x86_emulator.c
+++ b/tools/tests/x86_emulator/test_x86_emulator.c
@@ -611,7 +611,8 @@ static int fetch(
     if ( verbose )
         printf("** %s(CS:%p,, %u,)\n", __func__, (void *)offset, bytes);
 
-    memcpy(p_data, (void *)offset, bytes);
+    if ( bytes )
+        memcpy(p_data, (void *)offset, bytes);
     return X86EMUL_OKAY;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Mar 04 09:44:11 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Mar 2026 09:44:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1245229.1544603 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxilu-0005BG-Vt; Wed, 04 Mar 2026 09:44:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1245229.1544603; Wed, 04 Mar 2026 09:44:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxilu-0005B6-Sb; Wed, 04 Mar 2026 09:44:02 +0000
Received: by outflank-mailman (input) for mailman id 1245229;
 Wed, 04 Mar 2026 09:44:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vxilt-0005Ay-Np
 for xen-changelog@lists.xenproject.org; Wed, 04 Mar 2026 09:44:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxilt-004odC-23
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 09:44:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxilt-00FdhR-1t
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 09:44:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=CjtbLtpEeO3X6cN7J6rUbhpFsEGbmrF0oD1BsQAN2v4=; b=X0XrshEnEtvDZ47IyuK6oItL5q
	IDi3LxTpKeyTA53SEjIE2d6Yc8+zFDr6lIXdApX7hAG3mnOY5P7OzWMRklklmSlO6sI9TlomsWhu9
	JUfdnqyo3vva9o6+tfeLxrSbBSOjOkDj4Xg/2d2P8lXUhh7Ll2DszUbYeMH3dN6Aeh/Q=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] vPCI: introduce private header
Message-Id: <E1vxilt-00FdhR-1t@xenbits.xenproject.org>
Date: Wed, 04 Mar 2026 09:44:01 +0000

commit c6f5590c93444d39170f145c4cf682878aac09d2
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Mar 4 08:21:28 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 4 08:21:28 2026 +0100

    vPCI: introduce private header
    
    Before adding more private stuff to xen/vpci.h, split it up. In order to
    be able to include the private header first in a CU, the per-arch struct
    decls also need to move (to new asm/vpci.h files).
    
    While adjusting the test harness'es Makefile, also switch the pre-existing
    header symlink-ing rule to a pattern one.
    
    Apart from in the test harness code, things only move; no functional
    change intended.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Stewart Hildebrand <stewart.hildebrand@amd.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 .gitignore                        |   1 +
 tools/tests/vpci/Makefile         |  16 ++---
 tools/tests/vpci/emul.h           |   1 +
 xen/arch/arm/include/asm/pci.h    |   8 ---
 xen/arch/arm/include/asm/vpci.h   |  13 ++++
 xen/arch/x86/include/asm/hvm/io.h |  11 ----
 xen/arch/x86/include/asm/vpci.h   |  29 +++++++++
 xen/drivers/vpci/header.c         |   3 +-
 xen/drivers/vpci/msi.c            |   3 +-
 xen/drivers/vpci/msix.c           |   3 +-
 xen/drivers/vpci/private.h        | 126 ++++++++++++++++++++++++++++++++++++++
 xen/drivers/vpci/rebar.c          |   3 +-
 xen/drivers/vpci/vpci.c           |   3 +-
 xen/include/xen/vpci.h            | 107 +-------------------------------
 14 files changed, 189 insertions(+), 138 deletions(-)

diff --git a/.gitignore b/.gitignore
index 57d54f676f..bfc7bdf043 100644
--- a/.gitignore
+++ b/.gitignore
@@ -154,6 +154,7 @@ tools/tests/x86_emulator/test_x86_emulator
 tools/tests/x86_emulator/x86_emulate
 tools/tests/x86_emulator/xop*.[ch]
 tools/tests/vpci/list.h
+tools/tests/vpci/private.h
 tools/tests/vpci/vpci.[hc]
 tools/tests/vpci/test_vpci
 tools/xcutils/lsevtchn
diff --git a/tools/tests/vpci/Makefile b/tools/tests/vpci/Makefile
index 97359ff67f..28b6009332 100644
--- a/tools/tests/vpci/Makefile
+++ b/tools/tests/vpci/Makefile
@@ -14,12 +14,12 @@ else
 	$(warning HOSTCC != CC, will not run test)
 endif
 
-$(TARGET): vpci.c vpci.h list.h main.c emul.h
-	$(CC) $(CFLAGS_xeninclude) -g -o $@ vpci.c main.c
+$(TARGET): vpci.c vpci.h list.h private.h main.c emul.h
+	$(CC) $(CFLAGS_xeninclude) -include emul.h -g -o $@ vpci.c main.c
 
 .PHONY: clean
 clean:
-	rm -rf $(TARGET) *.o *~ vpci.h vpci.c list.h
+	rm -rf $(TARGET) *.o *~ vpci.h vpci.c list.h private.h
 
 .PHONY: distclean
 distclean: clean
@@ -34,10 +34,10 @@ uninstall:
 	$(RM) -- $(DESTDIR)$(LIBEXEC)/tests/$(TARGET)
 
 vpci.c: $(XEN_ROOT)/xen/drivers/vpci/vpci.c
-	# Remove includes and add the test harness header
-	sed -e '/#include/d' -e '1s/^/#include "emul.h"/' <$< >$@
+	sed -e '/#include/d' <$< >$@
+
+private.h: %.h: $(XEN_ROOT)/xen/drivers/vpci/%.h
+	sed -e '/#include/d' <$< >$@
 
-list.h: $(XEN_ROOT)/xen/include/xen/list.h
-vpci.h: $(XEN_ROOT)/xen/include/xen/vpci.h
-list.h vpci.h:
+list.h vpci.h: %.h: $(XEN_ROOT)/xen/include/xen/%.h
 	sed -e '/#include/d' <$< >$@
diff --git a/tools/tests/vpci/emul.h b/tools/tests/vpci/emul.h
index dd048cffbf..38211afbb8 100644
--- a/tools/tests/vpci/emul.h
+++ b/tools/tests/vpci/emul.h
@@ -86,6 +86,7 @@ typedef union {
 
 #define CONFIG_HAS_VPCI
 #include "vpci.h"
+#include "private.h"
 
 #define __hwdom_init
 
diff --git a/xen/arch/arm/include/asm/pci.h b/xen/arch/arm/include/asm/pci.h
index 73c3be74ae..7c3211823f 100644
--- a/xen/arch/arm/include/asm/pci.h
+++ b/xen/arch/arm/include/asm/pci.h
@@ -31,14 +31,6 @@ struct arch_pci_dev {
     struct device dev;
 };
 
-/* Arch-specific MSI data for vPCI. */
-struct vpci_arch_msi {
-};
-
-/* Arch-specific MSI-X entry data for vPCI. */
-struct vpci_arch_msix_entry {
-};
-
 /*
  * Because of the header cross-dependencies, e.g. we need both
  * struct pci_dev and struct arch_pci_dev at the same time, this cannot be
diff --git a/xen/arch/arm/include/asm/vpci.h b/xen/arch/arm/include/asm/vpci.h
new file mode 100644
index 0000000000..db04687fc0
--- /dev/null
+++ b/xen/arch/arm/include/asm/vpci.h
@@ -0,0 +1,13 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+#ifndef ARM_VPCI_H
+#define ARM_VPCI_H
+
+/* Arch-specific MSI data for vPCI. */
+struct vpci_arch_msi {
+};
+
+/* Arch-specific MSI-X entry data for vPCI. */
+struct vpci_arch_msix_entry {
+};
+
+#endif /* ARM_VPCI_H */
diff --git a/xen/arch/x86/include/asm/hvm/io.h b/xen/arch/x86/include/asm/hvm/io.h
index c12f099a03..986822ff15 100644
--- a/xen/arch/x86/include/asm/hvm/io.h
+++ b/xen/arch/x86/include/asm/hvm/io.h
@@ -97,17 +97,6 @@ void msixtbl_init(struct domain *d);
 static inline void msixtbl_init(struct domain *d) {}
 #endif
 
-/* Arch-specific MSI data for vPCI. */
-struct vpci_arch_msi {
-    int pirq;
-    bool bound;
-};
-
-/* Arch-specific MSI-X entry data for vPCI. */
-struct vpci_arch_msix_entry {
-    int pirq;
-};
-
 void stdvga_init(struct domain *d);
 
 extern void hvm_dpci_msi_eoi(struct domain *d, int vector);
diff --git a/xen/arch/x86/include/asm/vpci.h b/xen/arch/x86/include/asm/vpci.h
new file mode 100644
index 0000000000..c501ff1709
--- /dev/null
+++ b/xen/arch/x86/include/asm/vpci.h
@@ -0,0 +1,29 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#ifndef X86_VPCI_H
+#define X86_VPCI_H
+
+#include <xen/stdbool.h>
+
+/* Arch-specific MSI data for vPCI. */
+struct vpci_arch_msi {
+    int pirq;
+    bool bound;
+};
+
+/* Arch-specific MSI-X entry data for vPCI. */
+struct vpci_arch_msix_entry {
+    int pirq;
+};
+
+#endif /* X86_VPCI_H */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff --git a/xen/drivers/vpci/header.c b/xen/drivers/vpci/header.c
index 739a5f610e..b90a7f2b4e 100644
--- a/xen/drivers/vpci/header.c
+++ b/xen/drivers/vpci/header.c
@@ -17,11 +17,12 @@
  * License along with this program; If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include "private.h"
+
 #include <xen/iocap.h>
 #include <xen/lib.h>
 #include <xen/sched.h>
 #include <xen/softirq.h>
-#include <xen/vpci.h>
 
 #include <xsm/xsm.h>
 
diff --git a/xen/drivers/vpci/msi.c b/xen/drivers/vpci/msi.c
index 737770ffa3..f736054b2b 100644
--- a/xen/drivers/vpci/msi.c
+++ b/xen/drivers/vpci/msi.c
@@ -16,9 +16,10 @@
  * License along with this program; If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include "private.h"
+
 #include <xen/sched.h>
 #include <xen/softirq.h>
-#include <xen/vpci.h>
 
 #include <asm/msi.h>
 
diff --git a/xen/drivers/vpci/msix.c b/xen/drivers/vpci/msix.c
index eaf8fae970..f87212b46f 100644
--- a/xen/drivers/vpci/msix.c
+++ b/xen/drivers/vpci/msix.c
@@ -17,10 +17,11 @@
  * License along with this program; If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include "private.h"
+
 #include <xen/io.h>
 #include <xen/lib.h>
 #include <xen/sched.h>
-#include <xen/vpci.h>
 
 #include <asm/msi.h>
 #include <asm/p2m.h>
diff --git a/xen/drivers/vpci/private.h b/xen/drivers/vpci/private.h
new file mode 100644
index 0000000000..5a7ca47557
--- /dev/null
+++ b/xen/drivers/vpci/private.h
@@ -0,0 +1,126 @@
+#ifndef VPCI_PRIVATE_H
+#define VPCI_PRIVATE_H
+
+#include <xen/vpci.h>
+
+typedef uint32_t vpci_read_t(const struct pci_dev *pdev, unsigned int reg,
+                             void *data);
+
+typedef void vpci_write_t(const struct pci_dev *pdev, unsigned int reg,
+                          uint32_t val, void *data);
+
+typedef struct {
+    unsigned int id;
+    bool is_ext;
+    int (* init)(struct pci_dev *pdev);
+    int (* cleanup)(const struct pci_dev *pdev, bool hide);
+} vpci_capability_t;
+
+#define REGISTER_VPCI_CAPABILITY(cap, name, finit, fclean, ext) \
+    static const vpci_capability_t name##_entry \
+        __used_section(".data.rel.ro.vpci") = { \
+        .id = (cap), \
+        .init = (finit), \
+        .cleanup = (fclean), \
+        .is_ext = (ext), \
+    }
+
+#define REGISTER_VPCI_CAP(name, finit, fclean) \
+    REGISTER_VPCI_CAPABILITY(PCI_CAP_ID_##name, name, finit, fclean, false)
+#define REGISTER_VPCI_EXTCAP(name, finit, fclean) \
+    REGISTER_VPCI_CAPABILITY(PCI_EXT_CAP_ID_##name, name, finit, fclean, true)
+
+int __must_check vpci_init_header(struct pci_dev *pdev);
+
+/* Add/remove a register handler. */
+int __must_check vpci_add_register_mask(struct vpci *vpci,
+                                        vpci_read_t *read_handler,
+                                        vpci_write_t *write_handler,
+                                        unsigned int offset, unsigned int size,
+                                        void *data, uint32_t ro_mask,
+                                        uint32_t rw1c_mask, uint32_t rsvdp_mask,
+                                        uint32_t rsvdz_mask);
+int __must_check vpci_add_register(struct vpci *vpci,
+                                   vpci_read_t *read_handler,
+                                   vpci_write_t *write_handler,
+                                   unsigned int offset, unsigned int size,
+                                   void *data);
+
+int vpci_remove_registers(struct vpci *vpci, unsigned int start,
+                          unsigned int size);
+
+/* Helper to return the value passed in data. */
+uint32_t cf_check vpci_read_val(
+    const struct pci_dev *pdev, unsigned int reg, void *data);
+
+/* Passthrough handlers. */
+uint32_t cf_check vpci_hw_read8(
+    const struct pci_dev *pdev, unsigned int reg, void *data);
+uint32_t cf_check vpci_hw_read16(
+    const struct pci_dev *pdev, unsigned int reg, void *data);
+uint32_t cf_check vpci_hw_read32(
+    const struct pci_dev *pdev, unsigned int reg, void *data);
+void cf_check vpci_hw_write8(
+    const struct pci_dev *pdev, unsigned int reg, uint32_t val, void *data);
+void cf_check vpci_hw_write16(
+    const struct pci_dev *pdev, unsigned int reg, uint32_t val, void *data);
+
+#ifdef __XEN__
+/* Make sure there's a hole in the p2m for the MSIX mmio areas. */
+int vpci_make_msix_hole(const struct pci_dev *pdev);
+
+/*
+ * Helper functions to fetch MSIX related data. They are used by both the
+ * emulated MSIX code and the BAR handlers.
+ */
+static inline paddr_t vmsix_table_host_base(const struct vpci *vpci,
+                                            unsigned int nr)
+{
+    return vpci->header.bars[vpci->msix->tables[nr] & PCI_MSIX_BIRMASK].addr;
+}
+
+static inline paddr_t vmsix_table_host_addr(const struct vpci *vpci,
+                                            unsigned int nr)
+{
+    return vmsix_table_host_base(vpci, nr) +
+           (vpci->msix->tables[nr] & ~PCI_MSIX_BIRMASK);
+}
+
+static inline paddr_t vmsix_table_base(const struct vpci *vpci, unsigned int nr)
+{
+    return vpci->header.bars[vpci->msix->tables[nr] &
+                             PCI_MSIX_BIRMASK].guest_addr;
+}
+
+static inline paddr_t vmsix_table_addr(const struct vpci *vpci, unsigned int nr)
+{
+    return vmsix_table_base(vpci, nr) +
+           (vpci->msix->tables[nr] & ~PCI_MSIX_BIRMASK);
+}
+
+/*
+ * Note regarding the size calculation of the PBA: the spec mentions "The last
+ * QWORD will not necessarily be fully populated", so it implies that the PBA
+ * size is 64-bit aligned.
+ */
+static inline size_t vmsix_table_size(const struct vpci *vpci, unsigned int nr)
+{
+    return
+        (nr == VPCI_MSIX_TABLE) ? vpci->msix->max_entries * PCI_MSIX_ENTRY_SIZE
+                                : ROUNDUP(DIV_ROUND_UP(vpci->msix->max_entries,
+                                                       8), 8);
+}
+
+#endif /* __XEN__ */
+
+#endif /* VPCI_PRIVATE_H */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff --git a/xen/drivers/vpci/rebar.c b/xen/drivers/vpci/rebar.c
index 4d22f08af3..ab5c5453a8 100644
--- a/xen/drivers/vpci/rebar.c
+++ b/xen/drivers/vpci/rebar.c
@@ -5,8 +5,9 @@
  * Author: Jiqian Chen <Jiqian.Chen@amd.com>
  */
 
+#include "private.h"
+
 #include <xen/sched.h>
-#include <xen/vpci.h>
 
 static void cf_check rebar_ctrl_write(const struct pci_dev *pdev,
                                       unsigned int reg,
diff --git a/xen/drivers/vpci/vpci.c b/xen/drivers/vpci/vpci.c
index f66f50c8ba..ce0f297b44 100644
--- a/xen/drivers/vpci/vpci.c
+++ b/xen/drivers/vpci/vpci.c
@@ -17,8 +17,9 @@
  * License along with this program; If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include "private.h"
+
 #include <xen/sched.h>
-#include <xen/vpci.h>
 #include <xen/vmap.h>
 
 /* Internal struct to store the emulated PCI registers. */
diff --git a/xen/include/xen/vpci.h b/xen/include/xen/vpci.h
index d6310104ea..d104efbce2 100644
--- a/xen/include/xen/vpci.h
+++ b/xen/include/xen/vpci.h
@@ -7,18 +7,7 @@
 #include <xen/types.h>
 #include <xen/list.h>
 
-typedef uint32_t vpci_read_t(const struct pci_dev *pdev, unsigned int reg,
-                             void *data);
-
-typedef void vpci_write_t(const struct pci_dev *pdev, unsigned int reg,
-                          uint32_t val, void *data);
-
-typedef struct {
-    unsigned int id;
-    bool is_ext;
-    int (* init)(struct pci_dev *pdev);
-    int (* cleanup)(const struct pci_dev *pdev, bool hide);
-} vpci_capability_t;
+#include <asm/vpci.h>
 
 #define VPCI_ECAM_BDF(addr)     (((addr) & 0x0ffff000) >> 12)
 
@@ -30,66 +19,17 @@ typedef struct {
  */
 #define VPCI_MAX_VIRT_DEV       (PCI_SLOT(~0) + 1)
 
-#define REGISTER_VPCI_CAPABILITY(cap, name, finit, fclean, ext) \
-    static const vpci_capability_t name##_entry \
-        __used_section(".data.rel.ro.vpci") = { \
-        .id = (cap), \
-        .init = (finit), \
-        .cleanup = (fclean), \
-        .is_ext = (ext), \
-    }
-
-#define REGISTER_VPCI_CAP(name, finit, fclean) \
-    REGISTER_VPCI_CAPABILITY(PCI_CAP_ID_##name, name, finit, fclean, false)
-#define REGISTER_VPCI_EXTCAP(name, finit, fclean) \
-    REGISTER_VPCI_CAPABILITY(PCI_EXT_CAP_ID_##name, name, finit, fclean, true)
-
-int __must_check vpci_init_header(struct pci_dev *pdev);
-
 /* Assign vPCI to device by adding handlers. */
 int __must_check vpci_assign_device(struct pci_dev *pdev);
 
 /* Remove all handlers and free vpci related structures. */
 void vpci_deassign_device(struct pci_dev *pdev);
 
-/* Add/remove a register handler. */
-int __must_check vpci_add_register_mask(struct vpci *vpci,
-                                        vpci_read_t *read_handler,
-                                        vpci_write_t *write_handler,
-                                        unsigned int offset, unsigned int size,
-                                        void *data, uint32_t ro_mask,
-                                        uint32_t rw1c_mask, uint32_t rsvdp_mask,
-                                        uint32_t rsvdz_mask);
-int __must_check vpci_add_register(struct vpci *vpci,
-                                   vpci_read_t *read_handler,
-                                   vpci_write_t *write_handler,
-                                   unsigned int offset, unsigned int size,
-                                   void *data);
-
-int vpci_remove_registers(struct vpci *vpci, unsigned int start,
-                          unsigned int size);
-
 /* Generic read/write handlers for the PCI config space. */
 uint32_t vpci_read(pci_sbdf_t sbdf, unsigned int reg, unsigned int size);
 void vpci_write(pci_sbdf_t sbdf, unsigned int reg, unsigned int size,
                 uint32_t data);
 
-/* Helper to return the value passed in data. */
-uint32_t cf_check vpci_read_val(
-    const struct pci_dev *pdev, unsigned int reg, void *data);
-
-/* Passthrough handlers. */
-uint32_t cf_check vpci_hw_read8(
-    const struct pci_dev *pdev, unsigned int reg, void *data);
-uint32_t cf_check vpci_hw_read16(
-    const struct pci_dev *pdev, unsigned int reg, void *data);
-uint32_t cf_check vpci_hw_read32(
-    const struct pci_dev *pdev, unsigned int reg, void *data);
-void cf_check vpci_hw_write8(
-    const struct pci_dev *pdev, unsigned int reg, uint32_t val, void *data);
-void cf_check vpci_hw_write16(
-    const struct pci_dev *pdev, unsigned int reg, uint32_t val, void *data);
-
 /*
  * Check for pending vPCI operations on this vcpu. Returns true if the vcpu
  * should not run.
@@ -213,9 +153,6 @@ struct vpci_vcpu {
 #ifdef __XEN__
 void vpci_dump_msi(void);
 
-/* Make sure there's a hole in the p2m for the MSIX mmio areas. */
-int vpci_make_msix_hole(const struct pci_dev *pdev);
-
 /* Arch-specific vPCI MSI helpers. */
 void vpci_msi_arch_mask(struct vpci_msi *msi, const struct pci_dev *pdev,
                         unsigned int entry, bool mask);
@@ -238,48 +175,6 @@ int __must_check vpci_msix_arch_disable_entry(struct vpci_msix_entry *entry,
 void vpci_msix_arch_init_entry(struct vpci_msix_entry *entry);
 int vpci_msix_arch_print(const struct vpci_msix *msix);
 
-/*
- * Helper functions to fetch MSIX related data. They are used by both the
- * emulated MSIX code and the BAR handlers.
- */
-static inline paddr_t vmsix_table_host_base(const struct vpci *vpci,
-                                            unsigned int nr)
-{
-    return vpci->header.bars[vpci->msix->tables[nr] & PCI_MSIX_BIRMASK].addr;
-}
-
-static inline paddr_t vmsix_table_host_addr(const struct vpci *vpci,
-                                            unsigned int nr)
-{
-    return vmsix_table_host_base(vpci, nr) +
-           (vpci->msix->tables[nr] & ~PCI_MSIX_BIRMASK);
-}
-
-static inline paddr_t vmsix_table_base(const struct vpci *vpci, unsigned int nr)
-{
-    return vpci->header.bars[vpci->msix->tables[nr] &
-                             PCI_MSIX_BIRMASK].guest_addr;
-}
-
-static inline paddr_t vmsix_table_addr(const struct vpci *vpci, unsigned int nr)
-{
-    return vmsix_table_base(vpci, nr) +
-           (vpci->msix->tables[nr] & ~PCI_MSIX_BIRMASK);
-}
-
-/*
- * Note regarding the size calculation of the PBA: the spec mentions "The last
- * QWORD will not necessarily be fully populated", so it implies that the PBA
- * size is 64-bit aligned.
- */
-static inline size_t vmsix_table_size(const struct vpci *vpci, unsigned int nr)
-{
-    return
-        (nr == VPCI_MSIX_TABLE) ? vpci->msix->max_entries * PCI_MSIX_ENTRY_SIZE
-                                : ROUNDUP(DIV_ROUND_UP(vpci->msix->max_entries,
-                                                       8), 8);
-}
-
 static inline unsigned int vmsix_entry_nr(const struct vpci_msix *msix,
                                           const struct vpci_msix_entry *entry)
 {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Mar 04 09:44:14 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Mar 2026 09:44:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1245230.1544605 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxim5-0005DJ-0d; Wed, 04 Mar 2026 09:44:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1245230.1544605; Wed, 04 Mar 2026 09:44:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxim4-0005DC-U7; Wed, 04 Mar 2026 09:44:12 +0000
Received: by outflank-mailman (input) for mailman id 1245230;
 Wed, 04 Mar 2026 09:44:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vxim3-0005Cx-RG
 for xen-changelog@lists.xenproject.org; Wed, 04 Mar 2026 09:44:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxim3-004odJ-2P
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 09:44:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxim3-00Fdkq-2F
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 09:44:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=NeieDq+Spx7FZV0vqwmiW0tWdYY5Hz7fBU9gx0Zih6w=; b=TZCRBIpo+HSSL3Hj8WPuSH8L5o
	kvj/8039dzDv6EvEV+Q0ia126lTxWCoXvsMtDpIwj+ubiAr/jmiwx6aBAipRBGgrzcVndI0d1cxTM
	FLSpXeG2/Pgs+GIzyl7o3q65mj2HnzbJpPdqThCFeFI+2xaeH8Dm/FHWCuu+IRHJKkec=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] vPCI: move vpci_init_capabilities() to a separate file
Message-Id: <E1vxim3-00Fdkq-2F@xenbits.xenproject.org>
Date: Wed, 04 Mar 2026 09:44:11 +0000

commit 998060dd91015988760e21b6e5966a4455868df8
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Mar 4 08:22:42 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 4 08:22:42 2026 +0100

    vPCI: move vpci_init_capabilities() to a separate file
    
    Let's keep capability handling together. Start with moving
    vpci_init_capabilities() and its helpers, plus splitting out of its
    cleanup counterpart.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Stewart Hildebrand <stewart.hildebrand@amd.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/drivers/vpci/Makefile  |   1 +
 xen/drivers/vpci/cap.c     | 252 +++++++++++++++++++++++++++++++++++++++++++++
 xen/drivers/vpci/private.h |  21 ++++
 xen/drivers/vpci/vpci.c    | 250 +-------------------------------------------
 4 files changed, 278 insertions(+), 246 deletions(-)

diff --git a/xen/drivers/vpci/Makefile b/xen/drivers/vpci/Makefile
index a7c8a30a89..9793a4f9b0 100644
--- a/xen/drivers/vpci/Makefile
+++ b/xen/drivers/vpci/Makefile
@@ -1,2 +1,3 @@
+obj-y += cap.o
 obj-y += vpci.o header.o rebar.o
 obj-$(CONFIG_HAS_PCI_MSI) += msi.o msix.o
diff --git a/xen/drivers/vpci/cap.c b/xen/drivers/vpci/cap.c
new file mode 100644
index 0000000000..37c1811c62
--- /dev/null
+++ b/xen/drivers/vpci/cap.c
@@ -0,0 +1,252 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Capability handling for guest PCI configuration space.
+ */
+
+#include "private.h"
+
+#include <xen/sched.h>
+
+extern const vpci_capability_t __start_vpci_array[];
+extern const vpci_capability_t __end_vpci_array[];
+#define NUM_VPCI_INIT (__end_vpci_array - __start_vpci_array)
+
+static struct vpci_register *vpci_get_previous_cap_register(
+    const struct vpci *vpci, unsigned int offset)
+{
+    unsigned int next;
+    struct vpci_register *r;
+
+    if ( offset < 0x40 )
+    {
+        ASSERT_UNREACHABLE();
+        return NULL;
+    }
+
+    for ( r = vpci_get_register(vpci, PCI_CAPABILITY_LIST, 1); r;
+          r = next >= 0x40 ? vpci_get_register(vpci,
+                                               next + PCI_CAP_LIST_NEXT, 1)
+                           : NULL )
+    {
+        next = (unsigned int)(uintptr_t)r->private;
+        ASSERT(next == (uintptr_t)r->private);
+        if ( next == offset )
+            break;
+    }
+
+    return r;
+}
+
+static int vpci_capability_hide(const struct pci_dev *pdev, unsigned int cap)
+{
+    const unsigned int offset = pci_find_cap_offset(pdev->sbdf, cap);
+    struct vpci_register *prev_r, *next_r;
+    struct vpci *vpci = pdev->vpci;
+
+    if ( !offset )
+    {
+        ASSERT_UNREACHABLE();
+        return 0;
+    }
+
+    spin_lock(&vpci->lock);
+    prev_r = vpci_get_previous_cap_register(vpci, offset);
+    next_r = vpci_get_register(vpci, offset + PCI_CAP_LIST_NEXT, 1);
+    if ( !prev_r || !next_r )
+    {
+        spin_unlock(&vpci->lock);
+        return -ENODEV;
+    }
+
+    prev_r->private = next_r->private;
+    /*
+     * Not calling vpci_remove_registers() here is to avoid redoing
+     * the register search.
+     */
+    list_del(&next_r->node);
+    spin_unlock(&vpci->lock);
+    xfree(next_r);
+
+    if ( !is_hardware_domain(pdev->domain) )
+        return vpci_remove_registers(vpci, offset + PCI_CAP_LIST_ID, 1);
+
+    return 0;
+}
+
+static struct vpci_register *vpci_get_previous_ext_cap_register(
+    const struct vpci *vpci, unsigned int offset)
+{
+    unsigned int pos = PCI_CFG_SPACE_SIZE;
+    struct vpci_register *r;
+
+    if ( offset <= PCI_CFG_SPACE_SIZE )
+    {
+        ASSERT_UNREACHABLE();
+        return NULL;
+    }
+
+    for ( r = vpci_get_register(vpci, pos, 4); r;
+          r = pos > PCI_CFG_SPACE_SIZE ? vpci_get_register(vpci, pos, 4)
+                                       : NULL )
+    {
+        uint32_t header = (uint32_t)(uintptr_t)r->private;
+
+        ASSERT(header == (uintptr_t)r->private);
+
+        pos = PCI_EXT_CAP_NEXT(header);
+        if ( pos == offset )
+            break;
+    }
+
+    return r;
+}
+
+static int vpci_ext_capability_hide(
+    const struct pci_dev *pdev, unsigned int cap)
+{
+    const unsigned int offset = pci_find_ext_capability(pdev, cap);
+    struct vpci_register *r, *prev_r;
+    struct vpci *vpci = pdev->vpci;
+    uint32_t header, pre_header;
+
+    if ( offset < PCI_CFG_SPACE_SIZE )
+    {
+        ASSERT_UNREACHABLE();
+        return 0;
+    }
+
+    spin_lock(&vpci->lock);
+    r = vpci_get_register(vpci, offset, 4);
+    if ( !r )
+    {
+        spin_unlock(&vpci->lock);
+        return -ENODEV;
+    }
+
+    header = (uint32_t)(uintptr_t)r->private;
+    if ( offset == PCI_CFG_SPACE_SIZE )
+    {
+        if ( PCI_EXT_CAP_NEXT(header) <= PCI_CFG_SPACE_SIZE )
+            r->private = (void *)0;
+        else
+            /*
+             * The first extended capability (0x100) can not be removed from
+             * the linked list, so instead mask its capability ID to return 0
+             * hopefully forcing OSes to skip it.
+             */
+            r->private = (void *)(uintptr_t)(header & ~PCI_EXT_CAP_ID(header));
+
+        spin_unlock(&vpci->lock);
+        return 0;
+    }
+
+    prev_r = vpci_get_previous_ext_cap_register(vpci, offset);
+    if ( !prev_r )
+    {
+        spin_unlock(&vpci->lock);
+        return -ENODEV;
+    }
+
+    pre_header = (uint32_t)(uintptr_t)prev_r->private;
+    pre_header &= ~PCI_EXT_CAP_NEXT_MASK;
+    pre_header |= header & PCI_EXT_CAP_NEXT_MASK;
+    prev_r->private = (void *)(uintptr_t)pre_header;
+
+    list_del(&r->node);
+    spin_unlock(&vpci->lock);
+    xfree(r);
+
+    return 0;
+}
+
+int vpci_init_capabilities(struct pci_dev *pdev)
+{
+    for ( unsigned int i = 0; i < NUM_VPCI_INIT; i++ )
+    {
+        const vpci_capability_t *capability = &__start_vpci_array[i];
+        const unsigned int cap = capability->id;
+        const bool is_ext = capability->is_ext;
+        unsigned int pos = 0;
+        int rc;
+
+        if ( !is_ext )
+            pos = pci_find_cap_offset(pdev->sbdf, cap);
+        else if ( is_hardware_domain(pdev->domain) )
+            pos = pci_find_ext_capability(pdev, cap);
+
+        if ( !pos )
+            continue;
+
+        rc = capability->init(pdev);
+        if ( rc )
+        {
+            const char *type = is_ext ? "extended" : "legacy";
+
+            printk(XENLOG_WARNING
+                   "%pd %pp: init %s cap %u fail rc=%d, mask it\n",
+                   pdev->domain, &pdev->sbdf, type, cap, rc);
+
+            if ( capability->cleanup )
+            {
+                rc = capability->cleanup(pdev, true);
+                if ( rc )
+                {
+                    printk(XENLOG_ERR "%pd %pp: clean %s cap %u fail rc=%d\n",
+                           pdev->domain, &pdev->sbdf, type, cap, rc);
+                    if ( !is_hardware_domain(pdev->domain) )
+                        return rc;
+                }
+            }
+
+            if ( !is_ext )
+                rc = vpci_capability_hide(pdev, cap);
+            else
+                rc = vpci_ext_capability_hide(pdev, cap);
+            if ( rc )
+            {
+                printk(XENLOG_ERR "%pd %pp: hide %s cap %u fail rc=%d\n",
+                       pdev->domain, &pdev->sbdf, type, cap, rc);
+                return rc;
+            }
+        }
+    }
+
+    return 0;
+}
+
+void vpci_cleanup_capabilities(struct pci_dev *pdev)
+{
+    for ( unsigned int i = 0; i < NUM_VPCI_INIT; i++ )
+    {
+        const vpci_capability_t *capability = &__start_vpci_array[i];
+        const unsigned int cap = capability->id;
+        unsigned int pos = 0;
+
+        if ( !capability->cleanup )
+            continue;
+
+        if ( !capability->is_ext )
+            pos = pci_find_cap_offset(pdev->sbdf, cap);
+        else if ( is_hardware_domain(pdev->domain) )
+            pos = pci_find_ext_capability(pdev, cap);
+        if ( pos )
+        {
+            int rc = capability->cleanup(pdev, false);
+
+            if ( rc )
+                printk(XENLOG_ERR "%pd %pp: clean %s cap %u fail rc=%d\n",
+                       pdev->domain, &pdev->sbdf,
+                       capability->is_ext ? "extended" : "legacy", cap, rc);
+        }
+    }
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff --git a/xen/drivers/vpci/private.h b/xen/drivers/vpci/private.h
index 5a7ca47557..140092cc52 100644
--- a/xen/drivers/vpci/private.h
+++ b/xen/drivers/vpci/private.h
@@ -9,6 +9,20 @@ typedef uint32_t vpci_read_t(const struct pci_dev *pdev, unsigned int reg,
 typedef void vpci_write_t(const struct pci_dev *pdev, unsigned int reg,
                           uint32_t val, void *data);
 
+/* Internal struct to store the emulated PCI registers. */
+struct vpci_register {
+    vpci_read_t *read;
+    vpci_write_t *write;
+    unsigned int size;
+    unsigned int offset;
+    void *private;
+    struct list_head node;
+    uint32_t ro_mask;
+    uint32_t rw1c_mask;
+    uint32_t rsvdp_mask;
+    uint32_t rsvdz_mask;
+};
+
 typedef struct {
     unsigned int id;
     bool is_ext;
@@ -32,6 +46,9 @@ typedef struct {
 
 int __must_check vpci_init_header(struct pci_dev *pdev);
 
+int vpci_init_capabilities(struct pci_dev *pdev);
+void vpci_cleanup_capabilities(struct pci_dev *pdev);
+
 /* Add/remove a register handler. */
 int __must_check vpci_add_register_mask(struct vpci *vpci,
                                         vpci_read_t *read_handler,
@@ -49,6 +66,10 @@ int __must_check vpci_add_register(struct vpci *vpci,
 int vpci_remove_registers(struct vpci *vpci, unsigned int start,
                           unsigned int size);
 
+struct vpci_register *vpci_get_register(const struct vpci *vpci,
+                                        unsigned int offset,
+                                        unsigned int size);
+
 /* Helper to return the value passed in data. */
 uint32_t cf_check vpci_read_val(
     const struct pci_dev *pdev, unsigned int reg, void *data);
diff --git a/xen/drivers/vpci/vpci.c b/xen/drivers/vpci/vpci.c
index ce0f297b44..683d5fc36c 100644
--- a/xen/drivers/vpci/vpci.c
+++ b/xen/drivers/vpci/vpci.c
@@ -22,24 +22,7 @@
 #include <xen/sched.h>
 #include <xen/vmap.h>
 
-/* Internal struct to store the emulated PCI registers. */
-struct vpci_register {
-    vpci_read_t *read;
-    vpci_write_t *write;
-    unsigned int size;
-    unsigned int offset;
-    void *private;
-    struct list_head node;
-    uint32_t ro_mask;
-    uint32_t rw1c_mask;
-    uint32_t rsvdp_mask;
-    uint32_t rsvdz_mask;
-};
-
 #ifdef __XEN__
-extern const vpci_capability_t __start_vpci_array[];
-extern const vpci_capability_t __end_vpci_array[];
-#define NUM_VPCI_INIT (__end_vpci_array - __start_vpci_array)
 
 #ifdef CONFIG_HAS_VPCI_GUEST_SUPPORT
 static int assign_virtual_sbdf(struct pci_dev *pdev)
@@ -84,9 +67,9 @@ static int assign_virtual_sbdf(struct pci_dev *pdev)
 
 #endif /* CONFIG_HAS_VPCI_GUEST_SUPPORT */
 
-static struct vpci_register *vpci_get_register(const struct vpci *vpci,
-                                               unsigned int offset,
-                                               unsigned int size)
+struct vpci_register *vpci_get_register(const struct vpci *vpci,
+                                        unsigned int offset,
+                                        unsigned int size)
 {
     struct vpci_register *r;
 
@@ -104,209 +87,6 @@ static struct vpci_register *vpci_get_register(const struct vpci *vpci,
     return NULL;
 }
 
-static struct vpci_register *vpci_get_previous_cap_register(
-    const struct vpci *vpci, unsigned int offset)
-{
-    unsigned int next;
-    struct vpci_register *r;
-
-    if ( offset < 0x40 )
-    {
-        ASSERT_UNREACHABLE();
-        return NULL;
-    }
-
-    for ( r = vpci_get_register(vpci, PCI_CAPABILITY_LIST, 1); r;
-          r = next >= 0x40 ? vpci_get_register(vpci,
-                                               next + PCI_CAP_LIST_NEXT, 1)
-                           : NULL )
-    {
-        next = (unsigned int)(uintptr_t)r->private;
-        ASSERT(next == (uintptr_t)r->private);
-        if ( next == offset )
-            break;
-    }
-
-    return r;
-}
-
-static int vpci_capability_hide(const struct pci_dev *pdev, unsigned int cap)
-{
-    const unsigned int offset = pci_find_cap_offset(pdev->sbdf, cap);
-    struct vpci_register *prev_r, *next_r;
-    struct vpci *vpci = pdev->vpci;
-
-    if ( !offset )
-    {
-        ASSERT_UNREACHABLE();
-        return 0;
-    }
-
-    spin_lock(&vpci->lock);
-    prev_r = vpci_get_previous_cap_register(vpci, offset);
-    next_r = vpci_get_register(vpci, offset + PCI_CAP_LIST_NEXT, 1);
-    if ( !prev_r || !next_r )
-    {
-        spin_unlock(&vpci->lock);
-        return -ENODEV;
-    }
-
-    prev_r->private = next_r->private;
-    /*
-     * Not calling vpci_remove_registers() here is to avoid redoing
-     * the register search.
-     */
-    list_del(&next_r->node);
-    spin_unlock(&vpci->lock);
-    xfree(next_r);
-
-    if ( !is_hardware_domain(pdev->domain) )
-        return vpci_remove_registers(vpci, offset + PCI_CAP_LIST_ID, 1);
-
-    return 0;
-}
-
-static struct vpci_register *vpci_get_previous_ext_cap_register(
-    const struct vpci *vpci, unsigned int offset)
-{
-    unsigned int pos = PCI_CFG_SPACE_SIZE;
-    struct vpci_register *r;
-
-    if ( offset <= PCI_CFG_SPACE_SIZE )
-    {
-        ASSERT_UNREACHABLE();
-        return NULL;
-    }
-
-    for ( r = vpci_get_register(vpci, pos, 4); r;
-          r = pos > PCI_CFG_SPACE_SIZE ? vpci_get_register(vpci, pos, 4)
-                                       : NULL )
-    {
-        uint32_t header = (uint32_t)(uintptr_t)r->private;
-
-        ASSERT(header == (uintptr_t)r->private);
-
-        pos = PCI_EXT_CAP_NEXT(header);
-        if ( pos == offset )
-            break;
-    }
-
-    return r;
-}
-
-static int vpci_ext_capability_hide(
-    const struct pci_dev *pdev, unsigned int cap)
-{
-    const unsigned int offset = pci_find_ext_capability(pdev, cap);
-    struct vpci_register *r, *prev_r;
-    struct vpci *vpci = pdev->vpci;
-    uint32_t header, pre_header;
-
-    if ( offset < PCI_CFG_SPACE_SIZE )
-    {
-        ASSERT_UNREACHABLE();
-        return 0;
-    }
-
-    spin_lock(&vpci->lock);
-    r = vpci_get_register(vpci, offset, 4);
-    if ( !r )
-    {
-        spin_unlock(&vpci->lock);
-        return -ENODEV;
-    }
-
-    header = (uint32_t)(uintptr_t)r->private;
-    if ( offset == PCI_CFG_SPACE_SIZE )
-    {
-        if ( PCI_EXT_CAP_NEXT(header) <= PCI_CFG_SPACE_SIZE )
-            r->private = (void *)0;
-        else
-            /*
-             * The first extended capability (0x100) can not be removed from
-             * the linked list, so instead mask its capability ID to return 0
-             * hopefully forcing OSes to skip it.
-             */
-            r->private = (void *)(uintptr_t)(header & ~PCI_EXT_CAP_ID(header));
-
-        spin_unlock(&vpci->lock);
-        return 0;
-    }
-
-    prev_r = vpci_get_previous_ext_cap_register(vpci, offset);
-    if ( !prev_r )
-    {
-        spin_unlock(&vpci->lock);
-        return -ENODEV;
-    }
-
-    pre_header = (uint32_t)(uintptr_t)prev_r->private;
-    pre_header &= ~PCI_EXT_CAP_NEXT_MASK;
-    pre_header |= header & PCI_EXT_CAP_NEXT_MASK;
-    prev_r->private = (void *)(uintptr_t)pre_header;
-
-    list_del(&r->node);
-    spin_unlock(&vpci->lock);
-    xfree(r);
-
-    return 0;
-}
-
-static int vpci_init_capabilities(struct pci_dev *pdev)
-{
-    for ( unsigned int i = 0; i < NUM_VPCI_INIT; i++ )
-    {
-        const vpci_capability_t *capability = &__start_vpci_array[i];
-        const unsigned int cap = capability->id;
-        const bool is_ext = capability->is_ext;
-        unsigned int pos = 0;
-        int rc;
-
-        if ( !is_ext )
-            pos = pci_find_cap_offset(pdev->sbdf, cap);
-        else if ( is_hardware_domain(pdev->domain) )
-            pos = pci_find_ext_capability(pdev, cap);
-
-        if ( !pos )
-            continue;
-
-        rc = capability->init(pdev);
-        if ( rc )
-        {
-            const char *type = is_ext ? "extended" : "legacy";
-
-            printk(XENLOG_WARNING
-                   "%pd %pp: init %s cap %u fail rc=%d, mask it\n",
-                   pdev->domain, &pdev->sbdf, type, cap, rc);
-
-            if ( capability->cleanup )
-            {
-                rc = capability->cleanup(pdev, true);
-                if ( rc )
-                {
-                    printk(XENLOG_ERR "%pd %pp: clean %s cap %u fail rc=%d\n",
-                           pdev->domain, &pdev->sbdf, type, cap, rc);
-                    if ( !is_hardware_domain(pdev->domain) )
-                        return rc;
-                }
-            }
-
-            if ( !is_ext )
-                rc = vpci_capability_hide(pdev, cap);
-            else
-                rc = vpci_ext_capability_hide(pdev, cap);
-            if ( rc )
-            {
-                printk(XENLOG_ERR "%pd %pp: hide %s cap %u fail rc=%d\n",
-                       pdev->domain, &pdev->sbdf, type, cap, rc);
-                return rc;
-            }
-        }
-    }
-
-    return 0;
-}
-
 void vpci_deassign_device(struct pci_dev *pdev)
 {
     unsigned int i;
@@ -322,29 +102,7 @@ void vpci_deassign_device(struct pci_dev *pdev)
                     &pdev->domain->vpci_dev_assigned_map);
 #endif
 
-    for ( i = 0; i < NUM_VPCI_INIT; i++ )
-    {
-        const vpci_capability_t *capability = &__start_vpci_array[i];
-        const unsigned int cap = capability->id;
-        unsigned int pos = 0;
-
-        if ( !capability->cleanup )
-            continue;
-
-        if ( !capability->is_ext )
-            pos = pci_find_cap_offset(pdev->sbdf, cap);
-        else if ( is_hardware_domain(pdev->domain) )
-            pos = pci_find_ext_capability(pdev, cap);
-        if ( pos )
-        {
-            int rc = capability->cleanup(pdev, false);
-
-            if ( rc )
-                printk(XENLOG_ERR "%pd %pp: clean %s cap %u fail rc=%d\n",
-                       pdev->domain, &pdev->sbdf,
-                       capability->is_ext ? "extended" : "legacy", cap, rc);
-        }
-    }
+    vpci_cleanup_capabilities(pdev);
 
     spin_lock(&pdev->vpci->lock);
     while ( !list_empty(&pdev->vpci->handlers) )
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Mar 04 09:44:23 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Mar 2026 09:44:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1245231.1544610 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vximF-0005I2-3U; Wed, 04 Mar 2026 09:44:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1245231.1544610; Wed, 04 Mar 2026 09:44:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vximF-0005Hu-0n; Wed, 04 Mar 2026 09:44:23 +0000
Received: by outflank-mailman (input) for mailman id 1245231;
 Wed, 04 Mar 2026 09:44:21 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vximD-0005Hk-Ry
 for xen-changelog@lists.xenproject.org; Wed, 04 Mar 2026 09:44:21 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vximD-004odP-2h
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 09:44:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vximD-00FdmH-2Z
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 09:44:21 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=RAMNBSK9Iwh+IRKiqYDZJ6HeE5Tex1F2KiWs7VIa9Xw=; b=nFSBQsbRCYy3hzrLZBGCoZAy7F
	SJITRLxKRFmV4Tj8zBZ8l7jF0PmmXqpUvgaFTe5sQRkB7Gio5w9s4pJhP+gn/uji242h4nVih57Yd
	hVi97PDeE9SE0xMz5HHiZwZ6Md+FYKKssk0iBqOzhsAKmy7eeJ4HypU+4eQHtkwD9jws=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] vPCI: move capability-list init
Message-Id: <E1vximD-00FdmH-2Z@xenbits.xenproject.org>
Date: Wed, 04 Mar 2026 09:44:21 +0000

commit 16c3761129cd5bddd36da16a77b40bde973d8e54
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Mar 4 08:23:22 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 4 08:23:22 2026 +0100

    vPCI: move capability-list init
    
    ... both for when the functions are invoked and where they live in source.
    Don't invoke them directly in vpci_init_header(), but instead first thing
    in vpci_init_capabilities().
    
    Suggested-by: Roger Pau Monné <roger.pau@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Stewart Hildebrand <stewart.hildebrand@amd.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/drivers/vpci/cap.c    | 137 +++++++++++++++++++++++++++++++++++++++++++++-
 xen/drivers/vpci/header.c | 134 ---------------------------------------------
 2 files changed, 136 insertions(+), 135 deletions(-)

diff --git a/xen/drivers/vpci/cap.c b/xen/drivers/vpci/cap.c
index 37c1811c62..e26a2f95da 100644
--- a/xen/drivers/vpci/cap.c
+++ b/xen/drivers/vpci/cap.c
@@ -159,15 +159,150 @@ static int vpci_ext_capability_hide(
     return 0;
 }
 
+static int vpci_init_capability_list(struct pci_dev *pdev)
+{
+    int rc;
+    bool mask_cap_list = false;
+    bool is_hwdom = is_hardware_domain(pdev->domain);
+
+    if ( pci_conf_read16(pdev->sbdf, PCI_STATUS) & PCI_STATUS_CAP_LIST )
+    {
+        /* Only expose capabilities to the guest that vPCI can handle. */
+        unsigned int next, ttl = 48;
+        static const unsigned int supported_caps[] = {
+            PCI_CAP_ID_MSI,
+            PCI_CAP_ID_MSIX,
+        };
+        /*
+         * For dom0, we should expose all capabilities instead of a fixed
+         * capabilities array, so setting n to 0 here is to get the next
+         * capability position directly in pci_find_next_cap_ttl.
+         */
+        const unsigned int n = is_hwdom ? 0 : ARRAY_SIZE(supported_caps);
+
+        next = pci_find_next_cap_ttl(pdev->sbdf, PCI_CAPABILITY_LIST,
+                                     supported_caps, n, &ttl);
+
+        rc = vpci_add_register(pdev->vpci, vpci_read_val,
+                               is_hwdom ? vpci_hw_write8 : NULL,
+                               PCI_CAPABILITY_LIST, 1,
+                               (void *)(uintptr_t)next);
+        if ( rc )
+            return rc;
+
+        next &= ~3;
+
+        if ( !next && !is_hwdom )
+            /*
+             * If we don't have any supported capabilities to expose to the
+             * guest, mask the PCI_STATUS_CAP_LIST bit in the status
+             * register.
+             */
+            mask_cap_list = true;
+
+        while ( next && ttl )
+        {
+            unsigned int pos = next;
+
+            next = pci_find_next_cap_ttl(pdev->sbdf,
+                                         pos + PCI_CAP_LIST_NEXT,
+                                         supported_caps, n, &ttl);
+
+            if ( !is_hwdom )
+            {
+                rc = vpci_add_register(pdev->vpci, vpci_hw_read8, NULL,
+                                       pos + PCI_CAP_LIST_ID, 1, NULL);
+                if ( rc )
+                    return rc;
+            }
+
+            rc = vpci_add_register(pdev->vpci, vpci_read_val,
+                                   is_hwdom ? vpci_hw_write8 : NULL,
+                                   pos + PCI_CAP_LIST_NEXT, 1,
+                                   (void *)(uintptr_t)next);
+            if ( rc )
+                return rc;
+
+            next &= ~3;
+        }
+    }
+
+    /* Return early for the hw domain, no masking of PCI_STATUS. */
+    if ( is_hwdom )
+        return 0;
+
+    /* Utilize rsvdp_mask to hide PCI_STATUS_CAP_LIST from the guest. */
+    return vpci_add_register_mask(pdev->vpci, vpci_hw_read16, vpci_hw_write16,
+                                  PCI_STATUS, 2, NULL,
+                                  PCI_STATUS_RO_MASK &
+                                    ~(mask_cap_list ? PCI_STATUS_CAP_LIST : 0),
+                                  PCI_STATUS_RW1C_MASK,
+                                  mask_cap_list ? PCI_STATUS_CAP_LIST : 0,
+                                  PCI_STATUS_RSVDZ_MASK);
+}
+
+static int vpci_init_ext_capability_list(const struct pci_dev *pdev)
+{
+    unsigned int pos = PCI_CFG_SPACE_SIZE;
+
+    if ( !pdev->ext_cfg )
+        return 0;
+
+    if ( !is_hardware_domain(pdev->domain) )
+        /* Extended capabilities read as zero, write ignore for DomU */
+        return vpci_add_register(pdev->vpci, vpci_read_val, NULL,
+                                 pos, 4, (void *)0);
+
+    do
+    {
+        uint32_t header = pci_conf_read32(pdev->sbdf, pos);
+        int rc;
+
+        if ( header == 0xffffffffU )
+        {
+            printk(XENLOG_WARNING
+                   "%pd %pp: broken extended cap list, offset %#x\n",
+                   pdev->domain, &pdev->sbdf, pos);
+            return 0;
+        }
+
+        rc = vpci_add_register(pdev->vpci, vpci_read_val, NULL,
+                               pos, 4, (void *)(uintptr_t)header);
+        if ( rc == -EEXIST )
+        {
+            printk(XENLOG_WARNING
+                   "%pd %pp: overlap in extended cap list, offset %#x\n",
+                   pdev->domain, &pdev->sbdf, pos);
+            return 0;
+        }
+
+        if ( rc )
+            return rc;
+
+        pos = PCI_EXT_CAP_NEXT(header);
+    } while ( pos >= PCI_CFG_SPACE_SIZE );
+
+    return 0;
+}
+
 int vpci_init_capabilities(struct pci_dev *pdev)
 {
+    int rc;
+
+    rc = vpci_init_capability_list(pdev);
+    if ( rc )
+        return rc;
+
+    rc = vpci_init_ext_capability_list(pdev);
+    if ( rc )
+        return rc;
+
     for ( unsigned int i = 0; i < NUM_VPCI_INIT; i++ )
     {
         const vpci_capability_t *capability = &__start_vpci_array[i];
         const unsigned int cap = capability->id;
         const bool is_ext = capability->is_ext;
         unsigned int pos = 0;
-        int rc;
 
         if ( !is_ext )
             pos = pci_find_cap_offset(pdev->sbdf, cap);
diff --git a/xen/drivers/vpci/header.c b/xen/drivers/vpci/header.c
index b90a7f2b4e..1c0818c2e7 100644
--- a/xen/drivers/vpci/header.c
+++ b/xen/drivers/vpci/header.c
@@ -744,132 +744,6 @@ static int bar_add_rangeset(const struct pci_dev *pdev, struct vpci_bar *bar,
     return !bar->mem ? -ENOMEM : 0;
 }
 
-static int vpci_init_capability_list(struct pci_dev *pdev)
-{
-    int rc;
-    bool mask_cap_list = false;
-    bool is_hwdom = is_hardware_domain(pdev->domain);
-
-    if ( pci_conf_read16(pdev->sbdf, PCI_STATUS) & PCI_STATUS_CAP_LIST )
-    {
-        /* Only expose capabilities to the guest that vPCI can handle. */
-        unsigned int next, ttl = 48;
-        static const unsigned int supported_caps[] = {
-            PCI_CAP_ID_MSI,
-            PCI_CAP_ID_MSIX,
-        };
-        /*
-         * For dom0, we should expose all capabilities instead of a fixed
-         * capabilities array, so setting n to 0 here is to get the next
-         * capability position directly in pci_find_next_cap_ttl.
-         */
-        const unsigned int n = is_hwdom ? 0 : ARRAY_SIZE(supported_caps);
-
-        next = pci_find_next_cap_ttl(pdev->sbdf, PCI_CAPABILITY_LIST,
-                                     supported_caps, n, &ttl);
-
-        rc = vpci_add_register(pdev->vpci, vpci_read_val,
-                               is_hwdom ? vpci_hw_write8 : NULL,
-                               PCI_CAPABILITY_LIST, 1,
-                               (void *)(uintptr_t)next);
-        if ( rc )
-            return rc;
-
-        next &= ~3;
-
-        if ( !next && !is_hwdom )
-            /*
-             * If we don't have any supported capabilities to expose to the
-             * guest, mask the PCI_STATUS_CAP_LIST bit in the status
-             * register.
-             */
-            mask_cap_list = true;
-
-        while ( next && ttl )
-        {
-            unsigned int pos = next;
-
-            next = pci_find_next_cap_ttl(pdev->sbdf,
-                                         pos + PCI_CAP_LIST_NEXT,
-                                         supported_caps, n, &ttl);
-
-            if ( !is_hwdom )
-            {
-                rc = vpci_add_register(pdev->vpci, vpci_hw_read8, NULL,
-                                       pos + PCI_CAP_LIST_ID, 1, NULL);
-                if ( rc )
-                    return rc;
-            }
-
-            rc = vpci_add_register(pdev->vpci, vpci_read_val,
-                                   is_hwdom ? vpci_hw_write8 : NULL,
-                                   pos + PCI_CAP_LIST_NEXT, 1,
-                                   (void *)(uintptr_t)next);
-            if ( rc )
-                return rc;
-
-            next &= ~3;
-        }
-    }
-
-    /* Return early for the hw domain, no masking of PCI_STATUS. */
-    if ( is_hwdom )
-        return 0;
-
-    /* Utilize rsvdp_mask to hide PCI_STATUS_CAP_LIST from the guest. */
-    return vpci_add_register_mask(pdev->vpci, vpci_hw_read16, vpci_hw_write16,
-                                  PCI_STATUS, 2, NULL,
-                                  PCI_STATUS_RO_MASK &
-                                    ~(mask_cap_list ? PCI_STATUS_CAP_LIST : 0),
-                                  PCI_STATUS_RW1C_MASK,
-                                  mask_cap_list ? PCI_STATUS_CAP_LIST : 0,
-                                  PCI_STATUS_RSVDZ_MASK);
-}
-
-static int vpci_init_ext_capability_list(const struct pci_dev *pdev)
-{
-    unsigned int pos = PCI_CFG_SPACE_SIZE;
-
-    if ( !pdev->ext_cfg )
-        return 0;
-
-    if ( !is_hardware_domain(pdev->domain) )
-        /* Extended capabilities read as zero, write ignore for DomU */
-        return vpci_add_register(pdev->vpci, vpci_read_val, NULL,
-                                 pos, 4, (void *)0);
-
-    do
-    {
-        uint32_t header = pci_conf_read32(pdev->sbdf, pos);
-        int rc;
-
-        if ( header == 0xffffffffU )
-        {
-            printk(XENLOG_WARNING
-                   "%pd %pp: broken extended cap list, offset %#x\n",
-                   pdev->domain, &pdev->sbdf, pos);
-            return 0;
-        }
-
-        rc = vpci_add_register(pdev->vpci, vpci_read_val, NULL,
-                               pos, 4, (void *)(uintptr_t)header);
-        if ( rc == -EEXIST )
-        {
-            printk(XENLOG_WARNING
-                   "%pd %pp: overlap in extended cap list, offset %#x\n",
-                   pdev->domain, &pdev->sbdf, pos);
-            return 0;
-        }
-
-        if ( rc )
-            return rc;
-
-        pos = PCI_EXT_CAP_NEXT(header);
-    } while ( pos >= PCI_CFG_SPACE_SIZE );
-
-    return 0;
-}
-
 int vpci_init_header(struct pci_dev *pdev)
 {
     uint16_t cmd;
@@ -918,14 +792,6 @@ int vpci_init_header(struct pci_dev *pdev)
     if ( rc )
         return rc;
 
-    rc = vpci_init_capability_list(pdev);
-    if ( rc )
-        return rc;
-
-    rc = vpci_init_ext_capability_list(pdev);
-    if ( rc )
-        return rc;
-
     if ( pdev->ignore_bars )
         return 0;
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Mar 04 09:44:33 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Mar 2026 09:44:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1245232.1544613 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vximP-0005Ka-4v; Wed, 04 Mar 2026 09:44:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1245232.1544613; Wed, 04 Mar 2026 09:44:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vximP-0005KS-2C; Wed, 04 Mar 2026 09:44:33 +0000
Received: by outflank-mailman (input) for mailman id 1245232;
 Wed, 04 Mar 2026 09:44:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vximO-0005KK-0G
 for xen-changelog@lists.xenproject.org; Wed, 04 Mar 2026 09:44:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vximN-004odT-2z
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 09:44:31 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vximN-00FdnY-2s
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 09:44:31 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=XN1PvChpR4dGDWwL0Gn0UrG0b7oubC8jnaQ//7+9Rbs=; b=4u8Aq/7zpECiphO0qAsgEp2nk1
	8zib4q8l9ZudTCfl8hXGqncHQ5xnIf2fs+KW326mUOoHA9PZLCut25tux2z/pG2nir4ID739FNDLW
	+Nr/4PC6Uc2mUdIyt0bRIkRFdCAj+6pHL1NgkB7TYuTa7Mom7AL/bHNWF0nokSohOK0M=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/time: move ticks<->ns helpers to common code
Message-Id: <E1vximN-00FdnY-2s@xenbits.xenproject.org>
Date: Wed, 04 Mar 2026 09:44:31 +0000

commit c66d20357726806e754970bab4f7ecec8c8d44cb
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Wed Mar 4 08:24:28 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 4 08:24:28 2026 +0100

    xen/time: move ticks<->ns helpers to common code
    
    ticks_to_ns() and ns_to_ticks() are not architecture-specific, so provide a
    common implementation that is more resilient to overflow than the historical
    Arm version. This is not a practical issue for Arm, as the latest ARM ARM
    that timer frequency should be fixed at 1 GHz and older platforms used much
    lower rates, which is shy of 32-bit overflow. As the helpers are declared
    as static inline, they should not affect x86, which does not use them.
    
    On Arm, these helpers were historically implemented as out-of-line functions
    because the counter frequency was originally defined as static and unavailable
    to headers [1]. Later changes [2] removed this restriction, but the helpers
    remained unchanged. Now they can be implemented as static inline without any
    issues.
    
    Centralising the helpers avoids duplication and removes subtle differences
    between architectures while keeping the implementation simple.
    
    Drop redundant <asm/time.h> includes where <xen/time.h> already pulls it in.
    
    No functional change is intended.
    
    [1] ddee56dc2994 arm: driver for the generic timer for ARMv7
    [2] 096578b4e489 xen: move XEN_SYSCTL_physinfo, XEN_SYSCTL_numainfo and
                          XEN_SYSCTL_topologyinfo to common code
    
    Suggested-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 xen/arch/arm/include/asm/time.h   |  3 ---
 xen/arch/arm/time.c               | 11 -----------
 xen/arch/arm/vtimer.c             |  2 +-
 xen/arch/riscv/include/asm/time.h |  5 -----
 xen/arch/riscv/time.c             |  1 +
 xen/include/xen/time.h            | 11 +++++++++++
 6 files changed, 13 insertions(+), 20 deletions(-)

diff --git a/xen/arch/arm/include/asm/time.h b/xen/arch/arm/include/asm/time.h
index 49ad8c1a6d..c194dbb9f5 100644
--- a/xen/arch/arm/include/asm/time.h
+++ b/xen/arch/arm/include/asm/time.h
@@ -101,9 +101,6 @@ extern void init_timer_interrupt(void);
 /* Counter value at boot time */
 extern uint64_t boot_count;
 
-extern s_time_t ticks_to_ns(uint64_t ticks);
-extern uint64_t ns_to_ticks(s_time_t ns);
-
 void preinit_xen_time(void);
 
 void force_update_vcpu_system_time(struct vcpu *v);
diff --git a/xen/arch/arm/time.c b/xen/arch/arm/time.c
index cc3fcf47b6..a12912a106 100644
--- a/xen/arch/arm/time.c
+++ b/xen/arch/arm/time.c
@@ -27,7 +27,6 @@
 #include <asm/cpufeature.h>
 #include <asm/platform.h>
 #include <asm/system.h>
-#include <asm/time.h>
 #include <asm/vgic.h>
 
 uint64_t __read_mostly boot_count;
@@ -47,16 +46,6 @@ unsigned int timer_get_irq(enum timer_ppi ppi)
     return timer_irq[ppi];
 }
 
-/*static inline*/ s_time_t ticks_to_ns(uint64_t ticks)
-{
-    return muldiv64(ticks, SECONDS(1), 1000 * cpu_khz);
-}
-
-/*static inline*/ uint64_t ns_to_ticks(s_time_t ns)
-{
-    return muldiv64(ns, 1000 * cpu_khz, SECONDS(1));
-}
-
 static __initdata struct dt_device_node *timer;
 
 #ifdef CONFIG_ACPI
diff --git a/xen/arch/arm/vtimer.c b/xen/arch/arm/vtimer.c
index d2124b1755..2e85ff2b6e 100644
--- a/xen/arch/arm/vtimer.c
+++ b/xen/arch/arm/vtimer.c
@@ -12,13 +12,13 @@
 #include <xen/lib.h>
 #include <xen/perfc.h>
 #include <xen/sched.h>
+#include <xen/time.h>
 #include <xen/timer.h>
 
 #include <asm/cpregs.h>
 #include <asm/div64.h>
 #include <asm/irq.h>
 #include <asm/regs.h>
-#include <asm/time.h>
 #include <asm/vgic.h>
 #include <asm/vreg.h>
 #include <asm/vtimer.h>
diff --git a/xen/arch/riscv/include/asm/time.h b/xen/arch/riscv/include/asm/time.h
index 1e7801e2ea..be3875b998 100644
--- a/xen/arch/riscv/include/asm/time.h
+++ b/xen/arch/riscv/include/asm/time.h
@@ -24,11 +24,6 @@ static inline cycles_t get_cycles(void)
     return csr_read(CSR_TIME);
 }
 
-static inline s_time_t ticks_to_ns(uint64_t ticks)
-{
-    return muldiv64(ticks, MILLISECS(1), cpu_khz);
-}
-
 void preinit_xen_time(void);
 
 #endif /* ASM__RISCV__TIME_H */
diff --git a/xen/arch/riscv/time.c b/xen/arch/riscv/time.c
index e962f8518d..2c7af0a5d6 100644
--- a/xen/arch/riscv/time.c
+++ b/xen/arch/riscv/time.c
@@ -4,6 +4,7 @@
 #include <xen/init.h>
 #include <xen/lib.h>
 #include <xen/sections.h>
+#include <xen/time.h>
 #include <xen/types.h>
 
 unsigned long __ro_after_init cpu_khz; /* CPU clock frequency in kHz. */
diff --git a/xen/include/xen/time.h b/xen/include/xen/time.h
index fe0d7a578a..2185dd26a4 100644
--- a/xen/include/xen/time.h
+++ b/xen/include/xen/time.h
@@ -8,6 +8,7 @@
 #ifndef __XEN_TIME_H__
 #define __XEN_TIME_H__
 
+#include <xen/muldiv64.h>
 #include <xen/types.h>
 #include <public/xen.h>
 
@@ -75,6 +76,16 @@ extern void send_timer_event(struct vcpu *v);
 
 void domain_set_time_offset(struct domain *d, int64_t time_offset_seconds);
 
+static inline s_time_t ticks_to_ns(uint64_t ticks)
+{
+    return muldiv64(ticks, MILLISECS(1), cpu_khz);
+}
+
+static inline uint64_t ns_to_ticks(s_time_t ns)
+{
+    return muldiv64(ns, cpu_khz, MILLISECS(1));
+}
+
 #include <asm/time.h>
 
 #endif /* __XEN_TIME_H__ */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Mar 04 09:44:43 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Mar 2026 09:44:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1245233.1544617 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vximZ-0005NB-66; Wed, 04 Mar 2026 09:44:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1245233.1544617; Wed, 04 Mar 2026 09:44:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vximZ-0005N4-3Y; Wed, 04 Mar 2026 09:44:43 +0000
Received: by outflank-mailman (input) for mailman id 1245233;
 Wed, 04 Mar 2026 09:44:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vximY-0005Mg-1e
 for xen-changelog@lists.xenproject.org; Wed, 04 Mar 2026 09:44:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vximY-004odX-03
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 09:44:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vximX-00Fdpj-3A
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 09:44:41 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=CVrrpS4JGL1TrSGvlugH07XsyiygAR3l/Es9Qs5ASPA=; b=ayxoUwxDp4Y3jKI3VoN6Z7nxs1
	VD6dc2RwL9twmvFYgo5kvxSkkvDkhLGjGr4U1TSlXNVoyqB8aEMB1eqlQ7SQim9pAGTXdeBpcLOf+
	21xrxcndvQJpLE7S6n9VnVCLNxysyJJyizDaYrbItysblIOeTDNwycyWzVoiPbe2wFy4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/tests/x86_emulator: fix build on clang-21
Message-Id: <E1vximX-00Fdpj-3A@xenbits.xenproject.org>
Date: Wed, 04 Mar 2026 09:44:41 +0000

commit 34e9c2151444ffc96f0be193445d3f6b146653d3
Author:     Edwin Török <edwin.torok@citrix.com>
AuthorDate: Wed Mar 4 08:25:19 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 4 08:25:19 2026 +0100

    tools/tests/x86_emulator: fix build on clang-21
    
    clang-21's built-in assembler is enabled by default, but it doesn't
    support some mnemonics:
    ```
    test_x86_emulator.c:2636:36: error: invalid instruction mnemonic 'fsaves'
     2636 |                        "fidivs %1\n\t"
    test_x86_emulator.c:2640:24: error: invalid instruction mnemonic 'frstors'
     2640 |         asm volatile ( "frstors %0" :: "m" (res[25]) : "memory" );
          |                        ^
    test_x86_emulator.c:4251:24: error: invalid instruction mnemonic 'vpcmpestriq'
     4251 |                        put_insn(vpcmpestri,
          |                        ^
    ```
    
    Use the external assembler with Clang for consistency with GCC.
    
    Signed-off-by: Edwin Török <edwin.torok@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 tools/tests/x86_emulator/Makefile | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tools/tests/x86_emulator/Makefile b/tools/tests/x86_emulator/Makefile
index e18725d0c3..5003c464f3 100644
--- a/tools/tests/x86_emulator/Makefile
+++ b/tools/tests/x86_emulator/Makefile
@@ -297,6 +297,11 @@ x86_emulate:
 
 HOSTCFLAGS-x86_64 := -fno-PIE
 $(call cc-option-add,HOSTCFLAGS-x86_64,HOSTCC,-no-pie)
+
+# clang's integrated as does not support some mnemonics:
+#  https://github.com/llvm/llvm-project/issues/183635
+$(call cc-option-add,HOSTCFLAGS-x86_64,HOSTCC,-no-integrated-as)
+
 HOSTCFLAGS += $(CFLAGS_xeninclude) -I. $(HOSTCFLAGS-$(XEN_COMPILE_ARCH))
 
 x86.h := $(addprefix $(XEN_ROOT)/tools/include/xen/asm/,\
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Mar 04 09:44:53 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Mar 2026 09:44:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1245234.1544622 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vximj-0005Pj-7h; Wed, 04 Mar 2026 09:44:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1245234.1544622; Wed, 04 Mar 2026 09:44:53 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vximj-0005Pb-54; Wed, 04 Mar 2026 09:44:53 +0000
Received: by outflank-mailman (input) for mailman id 1245234;
 Wed, 04 Mar 2026 09:44:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vximi-0005PT-4J
 for xen-changelog@lists.xenproject.org; Wed, 04 Mar 2026 09:44:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vximi-004odh-0L
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 09:44:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vximi-00Fdyy-0F
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 09:44:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ZA6O6ndOVbQ6bumg9W//N3ArBP7njySvKLlkNi/s7+Q=; b=lMPszvbqi/3WqaXb543oERdkHV
	461s1Ahr4x9RvN4+W5E19p9whke/a3dPSRrgOA/tqkHH9n0n6nzboqJCQs498TLeNADuGyu6clUyr
	wTcAInOFyxRbm3bpy6Kcpp9BVqEbhqeX2QsFYuHcJbs2sgouLgKaSN6bZssh38JQ0QeU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/tests/x86_emulator: fix undefined behaviour in shift
Message-Id: <E1vximi-00Fdyy-0F@xenbits.xenproject.org>
Date: Wed, 04 Mar 2026 09:44:52 +0000

commit c8ff52f87620e43e3fbd809e6450d299b567b900
Author:     Edwin Török <edwin.torok@citrix.com>
AuthorDate: Wed Mar 4 08:25:49 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 4 08:25:49 2026 +0100

    tools/tests/x86_emulator: fix undefined behaviour in shift
    
    Fixes this `-fsanitize=undefined` error:
    ```
    test_x86_emulator.c:1103:32: runtime error: left shift of 573785183 by 2 places cannot be represented in type 'int'
    SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior test_x86_emulator.c:1103:32
    ```
    
    Signed-off-by: Edwin Török <edwin.torok@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 tools/tests/x86_emulator/test_x86_emulator.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/tests/x86_emulator/test_x86_emulator.c b/tools/tests/x86_emulator/test_x86_emulator.c
index ea507f9c3a..f30568b7f1 100644
--- a/tools/tests/x86_emulator/test_x86_emulator.c
+++ b/tools/tests/x86_emulator/test_x86_emulator.c
@@ -1100,7 +1100,7 @@ int main(int argc, char **argv)
     regs.edi    = (unsigned long)res;
     rc = x86_emulate(&ctxt, &emulops);
     if ( (rc != X86EMUL_OKAY) ||
-         (*res != ((0x2233445F << 2) | 2)) ||
+         (*res != ((0x2233445FU << 2) | 2)) ||
          ((regs.eflags & (EFLAGS_MASK & ~X86_EFLAGS_OF))
           != EFLAGS_ALWAYS_SET) ||
          (regs.eip != (unsigned long)&instr[3]) )
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Mar 04 09:45:03 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Mar 2026 09:45:03 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1245235.1544626 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vximt-0005S4-8s; Wed, 04 Mar 2026 09:45:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1245235.1544626; Wed, 04 Mar 2026 09:45:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vximt-0005Rw-6N; Wed, 04 Mar 2026 09:45:03 +0000
Received: by outflank-mailman (input) for mailman id 1245235;
 Wed, 04 Mar 2026 09:45:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vxims-0005Rm-8n
 for xen-changelog@lists.xenproject.org; Wed, 04 Mar 2026 09:45:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxims-004oeV-0m
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 09:45:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxims-00Fe7A-0W
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 09:45:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ZG4WjN4HeJL9hJOnsI6oSL5nY4UhWSiv9HNqDKkOjs8=; b=DrskOiP84BntN+10bW6spdsS7t
	FX6ZDqGWSrzkrM7FzLkUqCQubifdyUNh5xQ6SY01zdVVPT/UgX0KQ6sVy4dmWIzvLMMXm+OTW/u8E
	RL5s0CU7iXVcN9wAemtawB60Oo0PbCeug02ZqmI4MLrog29Yka7kwci0FQbqK0aQP7hI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/tests/x86_emulator: avoid passing NULL to memcpy
Message-Id: <E1vxims-00Fe7A-0W@xenbits.xenproject.org>
Date: Wed, 04 Mar 2026 09:45:02 +0000

commit bdd49cc2f61510797a47ad81486be653633ab3ee
Author:     Edwin Török <edwin.torok@citrix.com>
AuthorDate: Wed Mar 4 08:26:11 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 4 08:26:11 2026 +0100

    tools/tests/x86_emulator: avoid passing NULL to memcpy
    
    Fixes this `-fsanitize=undefined` error:
    ```
    test_x86_emulator.c:614:12: runtime error: null pointer passed as argument 1, which is declared to never be null
    /usr/include/string.h:44:28: note: nonnull attribute specified here
    SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior test_x86_emulator.c:614:12
    ```
    
    Although this is more of a grey area: I don't see anything in the
    standard that'd forbid calling `memcpy` with NULL and 0, but `glibc`
    does specify it as non-null, which allows the compiler to make
    optimizations assuming it never is NULL, so this is undefined behaviour
    only on glibc.
    Best to avoid the potential undefined behaviour though.
    
    Signed-off-by: Edwin Török <edwin.torok@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 tools/tests/x86_emulator/test_x86_emulator.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/tests/x86_emulator/test_x86_emulator.c b/tools/tests/x86_emulator/test_x86_emulator.c
index f30568b7f1..20929b80c6 100644
--- a/tools/tests/x86_emulator/test_x86_emulator.c
+++ b/tools/tests/x86_emulator/test_x86_emulator.c
@@ -611,7 +611,8 @@ static int fetch(
     if ( verbose )
         printf("** %s(CS:%p,, %u,)\n", __func__, (void *)offset, bytes);
 
-    memcpy(p_data, (void *)offset, bytes);
+    if ( bytes )
+        memcpy(p_data, (void *)offset, bytes);
     return X86EMUL_OKAY;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Mar 04 14:00:08 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Mar 2026 14:00:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1245404.1544729 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxmlf-0001Xh-TB; Wed, 04 Mar 2026 14:00:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1245404.1544729; Wed, 04 Mar 2026 14:00:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxmlf-0001XG-QU; Wed, 04 Mar 2026 14:00:03 +0000
Received: by outflank-mailman (input) for mailman id 1245404;
 Wed, 04 Mar 2026 14:00:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vxmle-0001ED-FK
 for xen-changelog@lists.xenproject.org; Wed, 04 Mar 2026 14:00:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxmle-004u79-1I
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 14:00:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxmle-00FyKT-1B
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 14:00:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=OGLSbdCWt7IWZoHwE57Ul/stRI8LLVc8sebJXWCjfzA=; b=JEXnYCllcwxsJmdKFzK7LGOWAJ
	npsRYw00UYf7cvBtemGK7efMBZ76pc5aLajWOeT3klras17Sl5V2f/mWO9QlLzAwFY63RNMimE8bj
	iKhQA1Baa7DRKiXCN7Gendcc8ZsTfIHiCvBkbBwhb5Sm3R5VN7ZLqlASVz2WAksmTqEw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.21] EFI: Fix relocating ESRT for dom0
Message-Id: <E1vxmle-00FyKT-1B@xenbits.xenproject.org>
Date: Wed, 04 Mar 2026 14:00:02 +0000

commit 99bd17462dd4b7366bd40d33ffee119d21799da8
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Wed Mar 4 14:47:59 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 4 14:47:59 2026 +0100

    EFI: Fix relocating ESRT for dom0
    
    Fix calculating the table size - it consists of a header + entries, not
    just entries.
    This bug caused the last entry to have garbage in its final fields,
    including LowestSupportedFwVersion and CapsuleFlags, which (usually)
    made fwupd able to detect firmware update availability, but refuse
    actually installing it.
    
    Fixes: dc7da0874ba4 ("EFI: preserve the System Resource Table for dom0")
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Acked-by: Daniel P. Smith <dpsmith@apertussolutions.com>
    master commit: 3ea44aa78c8170ca8010a89d24717d6f6ccfe564
    master date: 2026-02-12 11:35:05 +0100
---
 xen/common/efi/boot.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c
index d7f4d0cb22..2047d58e39 100644
--- a/xen/common/efi/boot.c
+++ b/xen/common/efi/boot.c
@@ -675,7 +675,8 @@ static size_t __init get_esrt_size(const EFI_MEMORY_DESCRIPTOR *desc)
     if ( esrt_ptr->FwResourceCount > available_len / sizeof(esrt_ptr->Entries[0]) )
         return 0;
 
-    return esrt_ptr->FwResourceCount * sizeof(esrt_ptr->Entries[0]);
+    return offsetof(EFI_SYSTEM_RESOURCE_TABLE,
+                    Entries[esrt_ptr->FwResourceCount]);
 }
 
 static EFI_GUID __initdata esrt_guid = EFI_SYSTEM_RESOURCE_TABLE_GUID;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.21


From xen-changelog-bounces@lists.xenproject.org Wed Mar 04 14:00:13 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Mar 2026 14:00:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1245406.1544733 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxmlp-00020K-UZ; Wed, 04 Mar 2026 14:00:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1245406.1544733; Wed, 04 Mar 2026 14:00:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxmlp-00020A-Rv; Wed, 04 Mar 2026 14:00:13 +0000
Received: by outflank-mailman (input) for mailman id 1245406;
 Wed, 04 Mar 2026 14:00:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vxmlo-0001zt-Il
 for xen-changelog@lists.xenproject.org; Wed, 04 Mar 2026 14:00:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxmlo-004u7e-1m
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 14:00:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxmlo-00FyM2-1T
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 14:00:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=pLvMQYBJIZOJNohwznFwF+FNzwFqIjORPEpPrZPfMH4=; b=0EJJguka5ZJQUdtL8Gr+jROpO8
	35L0C5NniVkxlHDWrkunRuOk2qSKiLLFApgGI+SccR575W4f5ZZj33JdqKxz3NxaWLToRg3P1hH3r
	o4WFwhV7vOQdod7qgQNLe5HixmX/+1uvSJfmKXvsMCfxSYDLnNd1m0QGYa5tDJU7hcV4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.21] xen/x86: fix usage of [[:blank:]] with BSD grep
Message-Id: <E1vxmlo-00FyM2-1T@xenbits.xenproject.org>
Date: Wed, 04 Mar 2026 14:00:12 +0000

commit 14db25be36de437c2603a27ee033658c58fffd1b
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Mar 4 14:48:30 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 4 14:48:30 2026 +0100

    xen/x86: fix usage of [[:blank:]] with BSD grep
    
    BSD grep only recognizes [[:blank:]] as a valid expression when using
    extended (modern) regular expressions.  Pass -E to the grep call used in
    efi-nr-fixups.
    
    Additionally, the return from `wc -l` is space padded on BSD, and hence
    the content of efi-nr-fixups is "       2", not plain "2".  Strip the
    spaces in the Makefile using $(strip ...).
    
    Fixes: 1be65ec4c8bc ('x86/EFI: avoid use of GNU ld's --disable-reloc-section when possible')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    master commit: c13335b5c1292e90436746ec04ed0553b688160b
    master date: 2026-02-13 16:42:34 +0100
---
 xen/arch/x86/arch.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/arch.mk b/xen/arch/x86/arch.mk
index 16368a498b..22fd2bc871 100644
--- a/xen/arch/x86/arch.mk
+++ b/xen/arch/x86/arch.mk
@@ -98,7 +98,7 @@ endif
 ifeq ($(XEN_BUILD_PE),y)
 
 # Check if the linker produces fixups in PE by default
-efi-nr-fixups := $(shell LC_ALL=C $(OBJDUMP) -p $(efi-check).efi | grep '^[[:blank:]]*reloc[[:blank:]]*[0-9][[:blank:]].*DIR64$$' | wc -l)
+efi-nr-fixups := $(strip $(shell LC_ALL=C $(OBJDUMP) -p $(efi-check).efi | grep -E '^[[:blank:]]*reloc[[:blank:]]*[0-9][[:blank:]].*DIR64$$' | wc -l))
 
 ifeq ($(efi-nr-fixups),2)
 MKRELOC := :
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.21


From xen-changelog-bounces@lists.xenproject.org Wed Mar 04 14:00:24 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Mar 2026 14:00:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1245408.1544737 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxmlz-00022e-Vt; Wed, 04 Mar 2026 14:00:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1245408.1544737; Wed, 04 Mar 2026 14:00:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxmlz-00022W-TE; Wed, 04 Mar 2026 14:00:23 +0000
Received: by outflank-mailman (input) for mailman id 1245408;
 Wed, 04 Mar 2026 14:00:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vxmly-00022N-Lw
 for xen-changelog@lists.xenproject.org; Wed, 04 Mar 2026 14:00:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxmly-004u7o-26
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 14:00:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxmly-00FyNd-1w
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 14:00:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=FxAP7989jpJui7KsTNzEhNeBv5qu9n08T8iyRGzLXbg=; b=QgTWKJqrHRu92IjSmxVp6DtZ6f
	sTaaYQ4Tem2HgmKmFvvsml3QoSJb7m4KTMxn8l7e/t4lnpeDEVAOH9FpK9VkEKEPcFurwPkqfz9to
	UFVhYtS1ULdNEXn5Vq2FPLRQf129TMvj7VxQn7PXffl53nC2mZ/i/7DfgpQwPYe+GSNI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.21] xen: add non-executable stack note uniformly
Message-Id: <E1vxmly-00FyNd-1w@xenbits.xenproject.org>
Date: Wed, 04 Mar 2026 14:00:22 +0000

commit a7380f14379ba79eaf43852b5555ed53a35da9e4
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Mar 4 14:48:39 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 4 14:48:39 2026 +0100

    xen: add non-executable stack note uniformly
    
    Currently the -Wa,--noexecstack parameter is only passed to the compiler
    when building assembly files, as the assembler doesn't add such note for
    stack attributes.
    
    However, the default addition of the .note.GNU-stack section is dependent
    on the ELF target used.  Adjust the passing of -Wa,--noexecstack so it's
    added to CFLAGS instead of AFLAGS, and hence such section is also added to
    object files generated from .c sources.  This fixes the complains from the
    linker about missing .note.GNU-stack section when building x86-64 Xen on
    Darwin platforms.
    
    Note we could instead pass `-z noexecstack` to the linker, but that however
    would mask any possible errors or unintended mismatches from previous
    steps.
    
    Suggested-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    master commit: 3dfd77003c28ff3f6bfbf76a75d40a41ccecb33f
    master date: 2026-02-13 16:42:42 +0100
---
 xen/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/Makefile b/xen/Makefile
index 9ed5853020..1a54194a1e 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -415,7 +415,7 @@ endif
 
 AFLAGS += -D__ASSEMBLY__
 
-$(call cc-option-add,AFLAGS,CC,-Wa$$(comma)--noexecstack)
+$(call cc-option-add,CFLAGS,CC,-Wa$$(comma)--noexecstack)
 
 LDFLAGS-$(call ld-option,--warn-rwx-segments) += --no-warn-rwx-segments
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.21


From xen-changelog-bounces@lists.xenproject.org Wed Mar 04 14:00:34 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Mar 2026 14:00:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1245411.1544741 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxmmA-00025B-2K; Wed, 04 Mar 2026 14:00:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1245411.1544741; Wed, 04 Mar 2026 14:00:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxmm9-000251-Vp; Wed, 04 Mar 2026 14:00:33 +0000
Received: by outflank-mailman (input) for mailman id 1245411;
 Wed, 04 Mar 2026 14:00:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vxmm8-00024j-OT
 for xen-changelog@lists.xenproject.org; Wed, 04 Mar 2026 14:00:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxmm8-004u7w-2M
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 14:00:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxmm8-00FyPW-2G
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 14:00:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=5JWy0Ud4vtY/Uxf1HVpr63znLs8x+qPAEs4irjTA0MA=; b=ViWY55lpJixHcwE+TfXAkSvkVU
	HNuUFmswtGCm7lWe4FIKkihpg9L40nhnevEHmwOZmyaWnt4UR1ZRYJ8XIJqb9UZWaPfnSs9pZaASV
	1G/j3C6MJIOEsq57QSVVXvNF0MLmPHVJoFn+CauroVmIxXzIRWnb4tcdjXHrlZ6UayL0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.21] VT-d: fix off-by-one when handling extra RMRR ranges
Message-Id: <E1vxmm8-00FyPW-2G@xenbits.xenproject.org>
Date: Wed, 04 Mar 2026 14:00:32 +0000

commit 615199f05b43e27b9675c485fb0c5f128603a074
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Wed Mar 4 14:48:56 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 4 14:48:56 2026 +0100

    VT-d: fix off-by-one when handling extra RMRR ranges
    
    add_one_user_rmrr() operates on inclusive [start,end] range, which means
    the end page needs to be calculated as (start + page_count - 1).
    This off-by-one error resulted in one extra pages being mapped in IOMMU
    context, but not marked as reserved in the memory map. This in turns
    confused PVH dom0 code, resulting in the following crash:
    
        (XEN) [    3.934848] d0: GFN 0x5475c (0x5475c,5,3) -> (0x46a0f4,0,7) not permitted (0x20)
        (XEN) [    3.969657] domain_crash called from arch/x86/mm/p2m.c:695
        (XEN) [    3.972568] Domain 0 reported crashed by domain 32767 on cpu#0:
        (XEN) [    3.975527] Hardware Dom0 crashed: rebooting machine in 5 seconds.
        (XEN) [    8.986353] Resetting with ACPI MEMORY or I/O RESET_REG.
    
    I checked other parts of this API and it was the only error like this.
    Other places:
     - iommu_get_extra_reserved_device_memory() -> reserve_e820_ram() - this
       function expects exclusive range, so the code is correct
     - add_one_extra_ivmd() - this operates on start address and memory
       length
    
    Fixes: 2d9b3699136d ("IOMMU/VT-d: wire common device reserved memory API")
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: d41501fcf62457c3df779abda6718c64da8635ae
    master date: 2026-02-17 08:59:34 +0100
---
 xen/drivers/passthrough/vtd/dmar.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/drivers/passthrough/vtd/dmar.c b/xen/drivers/passthrough/vtd/dmar.c
index 91c22b8330..2a756831a6 100644
--- a/xen/drivers/passthrough/vtd/dmar.c
+++ b/xen/drivers/passthrough/vtd/dmar.c
@@ -1065,7 +1065,8 @@ static int __init add_user_rmrr(void)
 static int __init cf_check add_one_extra_rmrr(xen_pfn_t start, xen_ulong_t nr, u32 id, void *ctxt)
 {
     u32 sbdf_array[] = { id };
-    return add_one_user_rmrr(start, start+nr, 1, sbdf_array);
+
+    return add_one_user_rmrr(start, start + nr - 1, 1, sbdf_array);
 }
 
 static int __init add_extra_rmrr(void)
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.21


From xen-changelog-bounces@lists.xenproject.org Wed Mar 04 14:00:44 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Mar 2026 14:00:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1245412.1544745 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxmmK-00027G-3c; Wed, 04 Mar 2026 14:00:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1245412.1544745; Wed, 04 Mar 2026 14:00:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxmmK-000277-0u; Wed, 04 Mar 2026 14:00:44 +0000
Received: by outflank-mailman (input) for mailman id 1245412;
 Wed, 04 Mar 2026 14:00:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vxmmI-000270-Rj
 for xen-changelog@lists.xenproject.org; Wed, 04 Mar 2026 14:00:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxmmI-004u8C-2c
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 14:00:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxmmI-00FyRN-2W
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 14:00:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=BSOdNb0Ae1/YzSZl+6U0P6T3JtVEo+l1Pv4N69jGGHM=; b=jr8GrBltC2PrGmxxRtb8EeKxSC
	f9KQyZRmQhmGhOtexK4CrWG2zQ9ZO0SiruT8WQykPY1rZfDVAqlX7L6dEAu/YbKTxAkbzn0NAUNy7
	n5f9gUlvOApr8cuiheekWlj9CcCHBJ1LvRfdS1t9hNvTbrxTX+rHlinEAYAVMIGjGqIM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.21] common/domctl: xsm update for get_domain_state access
Message-Id: <E1vxmmI-00FyRN-2W@xenbits.xenproject.org>
Date: Wed, 04 Mar 2026 14:00:42 +0000

commit 4778574053ab2127d1a97a01b9788e786570412c
Author:     Daniel P. Smith <dpsmith@apertussolutions.com>
AuthorDate: Wed Mar 4 14:49:47 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 4 14:49:47 2026 +0100

    common/domctl: xsm update for get_domain_state access
    
    When using XSM Flask, passing DOMID_INVALID will result in a NULL pointer
    reference from the passing of NULL as the target domain to
    xsm_get_domain_state(). Simply not invoking xsm_get_domain_state() when the
    target domain is NULL opens the opportunity to circumvent the XSM
    get_domain_state access check. This is due to the fact that the call to
    xsm_domctl() for get_domain_state op is a no-op check, deferring to
    xsm_get_domain_state().
    
    Modify the helper get_domain_state() to ensure the requesting domain has
    get_domain_state access for the target domain, whether the target domain is
    explicitly set or implicitly determined with a domain state search. In the case
    of access not being allowed for a domain found during an implicit search, the
    search will continue to the next domain whose state has changed.
    
    Fixes: 3ad3df1bd0aa ("xen: add new domctl get_domain_state")
    Reported-by: Chris Rogers <rogersc@ainfosec.com>
    Reported-by: Dmytro Firsov <dmytro_firsov@epam.com>
    Signed-off-by: Daniel P. Smith <dpsmith@apertussolutions.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 0c79dde780217935a5c320300e381fc797f5fa19
    master date: 2026-02-23 08:42:15 +0100
---
 xen/common/domain.c | 37 ++++++++++++++++++++++---------------
 xen/common/domctl.c |  7 ++-----
 2 files changed, 24 insertions(+), 20 deletions(-)

diff --git a/xen/common/domain.c b/xen/common/domain.c
index 6ae7c46b40..ac06532544 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -209,7 +209,7 @@ static void set_domain_state_info(struct xen_domctl_get_domain_state *info,
 int get_domain_state(struct xen_domctl_get_domain_state *info, struct domain *d,
                      domid_t *domid)
 {
-    unsigned int dom;
+    unsigned int dom = -1;
     int rc = -ENOENT;
     struct domain *hdl;
 
@@ -218,6 +218,10 @@ int get_domain_state(struct xen_domctl_get_domain_state *info, struct domain *d,
 
     if ( d )
     {
+        rc = xsm_get_domain_state(XSM_XS_PRIV, d);
+        if ( rc )
+            return rc;
+
         set_domain_state_info(info, d);
 
         return 0;
@@ -237,28 +241,31 @@ int get_domain_state(struct xen_domctl_get_domain_state *info, struct domain *d,
 
     while ( dom_state_changed )
     {
-        dom = find_first_bit(dom_state_changed, DOMID_MASK + 1);
+        dom = find_next_bit(dom_state_changed, DOMID_MASK + 1, dom + 1);
         if ( dom >= DOMID_FIRST_RESERVED )
             break;
-        if ( test_and_clear_bit(dom, dom_state_changed) )
-        {
-            *domid = dom;
-
-            d = rcu_lock_domain_by_id(dom);
 
+        d = rcu_lock_domain_by_id(dom);
+        if ( (d && xsm_get_domain_state(XSM_XS_PRIV, d)) ||
+             !test_and_clear_bit(dom, dom_state_changed) )
+        {
             if ( d )
-            {
-                set_domain_state_info(info, d);
-
                 rcu_unlock_domain(d);
-            }
-            else
-                memset(info, 0, sizeof(*info));
+            continue;
+        }
 
-            rc = 0;
+        *domid = dom;
 
-            break;
+        if ( d )
+        {
+            set_domain_state_info(info, d);
+            rcu_unlock_domain(d);
         }
+        else
+            memset(info, 0, sizeof(*info));
+
+        rc = 0;
+        break;
     }
 
  out:
diff --git a/xen/common/domctl.c b/xen/common/domctl.c
index 954d790226..21bbffdc40 100644
--- a/xen/common/domctl.c
+++ b/xen/common/domctl.c
@@ -854,12 +854,9 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl)
         break;
 
     case XEN_DOMCTL_get_domain_state:
-        ret = xsm_get_domain_state(XSM_XS_PRIV, d);
-        if ( ret )
-            break;
-
-        copyback = 1;
         ret = get_domain_state(&op->u.get_domain_state, d, &op->domain);
+        if ( !ret )
+            copyback = true;
         break;
 
     default:
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.21


From xen-changelog-bounces@lists.xenproject.org Wed Mar 04 14:00:54 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Mar 2026 14:00:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1245413.1544748 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxmmU-00029Y-4q; Wed, 04 Mar 2026 14:00:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1245413.1544748; Wed, 04 Mar 2026 14:00:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxmmU-00029Q-2H; Wed, 04 Mar 2026 14:00:54 +0000
Received: by outflank-mailman (input) for mailman id 1245413;
 Wed, 04 Mar 2026 14:00:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vxmmS-00029I-Ts
 for xen-changelog@lists.xenproject.org; Wed, 04 Mar 2026 14:00:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxmmS-004u8O-2u
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 14:00:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxmmS-00FyT2-2n
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 14:00:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=na23mn+2/BPQOL7Pl8ukga9yZd15WCLp7TPWDfntsKc=; b=cteIX/YYbYNSpMKrWvfkaomgZS
	s2rD0B1FDvhLC87rLTOcAhQxKrl2x/7lr3illlYP2bopD3MCFGovQf/VBIq6jvuPbPDnko+8hEVkE
	egs1bRRAcuCxP5SDY2f2N38LzQIgby0PlICMBUwPnLq2/rEWjuo3B4GtX5wJwwEYXOm0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.21] xen/cpufreq: fix adjusting of sampling window on early exit
Message-Id: <E1vxmmS-00FyT2-2n@xenbits.xenproject.org>
Date: Wed, 04 Mar 2026 14:00:52 +0000

commit ae0708e940ea56e7cc4369732310353c4d1790b0
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Mar 4 14:50:04 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 4 14:50:04 2026 +0100

    xen/cpufreq: fix adjusting of sampling window on early exit
    
    The logic in dbs_check_cpu() resets the sampling window even when the
    sampling period is considered too small.  This leads to further calls
    finding an imbalance between the total window time and the idle time, as
    the total window time is possibly shorter than the idle time.
    
    Fix by resetting the sampling window start time in the same block where the
    current idle time is stored.  While there also prevent a duplicated call to
    NOW() and instead re-use the previously fetched value.
    
    Fixes: d6f001cb91ac ("x86: Implement cpufreq ondemand policy")
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 74867aae25cb6356b8a7d1140c81666e2a23b818
    master date: 2026-03-02 17:16:26 +0100
---
 xen/drivers/cpufreq/cpufreq_ondemand.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/drivers/cpufreq/cpufreq_ondemand.c b/xen/drivers/cpufreq/cpufreq_ondemand.c
index 0126a3f5d9..537695eaab 100644
--- a/xen/drivers/cpufreq/cpufreq_ondemand.c
+++ b/xen/drivers/cpufreq/cpufreq_ondemand.c
@@ -117,11 +117,12 @@ static void dbs_check_cpu(struct cpu_dbs_info_s *this_dbs_info)
 
     cur_ns = NOW();
     total_ns = cur_ns - this_dbs_info->prev_cpu_wall;
-    this_dbs_info->prev_cpu_wall = NOW();
 
     if (total_ns < MIN_DBS_INTERVAL)
         return;
 
+    this_dbs_info->prev_cpu_wall = cur_ns;
+
     /* Get Idle Time */
     for_each_cpu(j, policy->cpus) {
         uint64_t idle_ns, total_idle_ns;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.21


From xen-changelog-bounces@lists.xenproject.org Wed Mar 04 14:01:04 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Mar 2026 14:01:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1245414.1544752 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxmme-0002Ba-6K; Wed, 04 Mar 2026 14:01:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1245414.1544752; Wed, 04 Mar 2026 14:01:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxmme-0002BS-3i; Wed, 04 Mar 2026 14:01:04 +0000
Received: by outflank-mailman (input) for mailman id 1245414;
 Wed, 04 Mar 2026 14:01:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vxmmd-0002BK-0S
 for xen-changelog@lists.xenproject.org; Wed, 04 Mar 2026 14:01:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxmmc-004u90-3A
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 14:01:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxmmc-00FyUX-34
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 14:01:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=0q8HHiN9QsZ4iPQ8+V9Py6fAc4KpI2KmSQFU4hANKJY=; b=MaXArccNvx+aI10Ox6j71/9eS2
	lxmk7wywwxGG+DNNZPqa0gyarVMvv1aM+iTDsc+bEZdwh/z1V4KJVT6HA9S7dkF03c0v33YVdlbeh
	5kbUgQG770On6kgedf8PUT81JWtNM9usc4pmHb3sOprHGaIBc661fPut3fhg5MQKuSW8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.21] xen/cpufreq: fix usages of align_timer() in the on-demand governor
Message-Id: <E1vxmmc-00FyUX-34@xenbits.xenproject.org>
Date: Wed, 04 Mar 2026 14:01:02 +0000

commit 55bb6db0811d590c4d4a16f5be40180e81d3d172
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Mar 4 14:50:21 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 4 14:50:21 2026 +0100

    xen/cpufreq: fix usages of align_timer() in the on-demand governor
    
    The first parameter passed to align_timer() is the timer expiration, not
    the current time.  Adjust the calls to align_timer() in the on-demand
    governor to pass the expected timer expiration as the first parameter.
    
    Fixes: af74e3a15a83 ("cpufreq: align dbs timer for better package C state residency")
    Fixes: 382b95f627a9 ("Fix cpufreq HW-ALL coordination handle")
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: a0ed5bcfbeee81c91c574ad484faa057054eaf09
    master date: 2026-03-02 17:16:26 +0100
---
 xen/drivers/cpufreq/cpufreq_ondemand.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/xen/drivers/cpufreq/cpufreq_ondemand.c b/xen/drivers/cpufreq/cpufreq_ondemand.c
index 537695eaab..0d94c0e464 100644
--- a/xen/drivers/cpufreq/cpufreq_ondemand.c
+++ b/xen/drivers/cpufreq/cpufreq_ondemand.c
@@ -185,7 +185,8 @@ static void cf_check do_dbs_timer(void *dbs)
     dbs_check_cpu(dbs_info);
 
     set_timer(&per_cpu(dbs_timer, dbs_info->cpu),
-            align_timer(NOW() , dbs_tuners_ins.sampling_rate));
+              align_timer(NOW() + dbs_tuners_ins.sampling_rate,
+                          dbs_tuners_ins.sampling_rate));
 }
 
 static void dbs_timer_init(struct cpu_dbs_info_s *dbs_info)
@@ -400,6 +401,6 @@ void cpufreq_dbs_timer_resume(void)
             (void)cmpxchg(stoppable, -1, 1);
         }
         else
-            set_timer(t, align_timer(now, dbs_tuners_ins.sampling_rate));
+            set_timer(t, align_timer(t->expires, dbs_tuners_ins.sampling_rate));
     }
 }
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.21


From xen-changelog-bounces@lists.xenproject.org Wed Mar 04 14:01:15 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Mar 2026 14:01:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1245415.1544757 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxmmp-0002E8-9W; Wed, 04 Mar 2026 14:01:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1245415.1544757; Wed, 04 Mar 2026 14:01:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxmmp-0002E0-6h; Wed, 04 Mar 2026 14:01:15 +0000
Received: by outflank-mailman (input) for mailman id 1245415;
 Wed, 04 Mar 2026 14:01:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vxmmn-0002Dr-Hl
 for xen-changelog@lists.xenproject.org; Wed, 04 Mar 2026 14:01:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxmmn-004u9B-1g
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 14:01:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxmmn-00FyXf-1Y
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 14:01:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=d1r87+N75f2awJVo6sHR/Kt1yP/szQIelKbPwvSG5UQ=; b=34qxw6MQibcZaUuLi3SK3PPKwY
	XyA1Bv4GUqYlh6+MQuojKh+2gveBfMH/6YUfFoi24tjyxj3/LZ3FIzFpIi4QmMDC20P+yWBmDFxhK
	qTT67jzwIrrvNnR8C6+wAj53zAA/gdi/uirmdT/o1yrGnhfleLtkIhq5KFn+WaHMtSWY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.20] EFI: Fix relocating ESRT for dom0
Message-Id: <E1vxmmn-00FyXf-1Y@xenbits.xenproject.org>
Date: Wed, 04 Mar 2026 14:01:13 +0000

commit f8944780320d5528af66fb3a6b14b0e8e687c642
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Wed Mar 4 14:51:26 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 4 14:51:26 2026 +0100

    EFI: Fix relocating ESRT for dom0
    
    Fix calculating the table size - it consists of a header + entries, not
    just entries.
    This bug caused the last entry to have garbage in its final fields,
    including LowestSupportedFwVersion and CapsuleFlags, which (usually)
    made fwupd able to detect firmware update availability, but refuse
    actually installing it.
    
    Fixes: dc7da0874ba4 ("EFI: preserve the System Resource Table for dom0")
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Acked-by: Daniel P. Smith <dpsmith@apertussolutions.com>
    master commit: 3ea44aa78c8170ca8010a89d24717d6f6ccfe564
    master date: 2026-02-12 11:35:05 +0100
---
 xen/common/efi/boot.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c
index 04d4bbd801..b09890cb8f 100644
--- a/xen/common/efi/boot.c
+++ b/xen/common/efi/boot.c
@@ -624,7 +624,8 @@ static size_t __init get_esrt_size(const EFI_MEMORY_DESCRIPTOR *desc)
     if ( esrt_ptr->FwResourceCount > available_len / sizeof(esrt_ptr->Entries[0]) )
         return 0;
 
-    return esrt_ptr->FwResourceCount * sizeof(esrt_ptr->Entries[0]);
+    return offsetof(EFI_SYSTEM_RESOURCE_TABLE,
+                    Entries[esrt_ptr->FwResourceCount]);
 }
 
 static EFI_GUID __initdata esrt_guid = EFI_SYSTEM_RESOURCE_TABLE_GUID;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.20


From xen-changelog-bounces@lists.xenproject.org Wed Mar 04 14:01:25 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Mar 2026 14:01:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1245416.1544761 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxmmz-0002GF-Ae; Wed, 04 Mar 2026 14:01:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1245416.1544761; Wed, 04 Mar 2026 14:01:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxmmz-0002G7-83; Wed, 04 Mar 2026 14:01:25 +0000
Received: by outflank-mailman (input) for mailman id 1245416;
 Wed, 04 Mar 2026 14:01:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vxmmx-0002Fy-KB
 for xen-changelog@lists.xenproject.org; Wed, 04 Mar 2026 14:01:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxmmx-004u9Q-1w
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 14:01:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxmmx-00FyZv-1q
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 14:01:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=rXTg8uHQctSNTxLpnApZKwdRJQodR1mh9905LUX+4UU=; b=64iBK/T5dfUJY9Gkn5qleGDDlq
	y9cNYD7lpSoqwF9SH3S8GvnSkHGsHywP4JPAZvwg5OpZgmCpxCX5BugPperSeQW5wOSK7WmurrAID
	BfUBhJNpRmuBDzp+4aqPKXrvzXcY4a+c9cKIOxtqGsTA1rhCZn7XkRlu5Pf5S6LUp5fw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.20] xen/x86: fix usage of [[:blank:]] with BSD grep
Message-Id: <E1vxmmx-00FyZv-1q@xenbits.xenproject.org>
Date: Wed, 04 Mar 2026 14:01:23 +0000

commit f98cee7981dd10b8a9a3e1bb0091e0394148c304
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Mar 4 14:52:08 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 4 14:52:08 2026 +0100

    xen/x86: fix usage of [[:blank:]] with BSD grep
    
    BSD grep only recognizes [[:blank:]] as a valid expression when using
    extended (modern) regular expressions.  Pass -E to the grep call used in
    efi-nr-fixups.
    
    Additionally, the return from `wc -l` is space padded on BSD, and hence
    the content of efi-nr-fixups is "       2", not plain "2".  Strip the
    spaces in the Makefile using $(strip ...).
    
    Fixes: 1be65ec4c8bc ('x86/EFI: avoid use of GNU ld's --disable-reloc-section when possible')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    master commit: c13335b5c1292e90436746ec04ed0553b688160b
    master date: 2026-02-13 16:42:34 +0100
---
 xen/arch/x86/arch.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/arch.mk b/xen/arch/x86/arch.mk
index efdbdb6045..b7cb03a9c1 100644
--- a/xen/arch/x86/arch.mk
+++ b/xen/arch/x86/arch.mk
@@ -112,7 +112,7 @@ endif
 ifeq ($(XEN_BUILD_PE),y)
 
 # Check if the linker produces fixups in PE by default
-efi-nr-fixups := $(shell LC_ALL=C $(OBJDUMP) -p $(efi-check).efi | grep '^[[:blank:]]*reloc[[:blank:]]*[0-9][[:blank:]].*DIR64$$' | wc -l)
+efi-nr-fixups := $(strip $(shell LC_ALL=C $(OBJDUMP) -p $(efi-check).efi | grep -E '^[[:blank:]]*reloc[[:blank:]]*[0-9][[:blank:]].*DIR64$$' | wc -l))
 
 ifeq ($(efi-nr-fixups),2)
 MKRELOC := :
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.20


From xen-changelog-bounces@lists.xenproject.org Wed Mar 04 14:01:35 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Mar 2026 14:01:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1245417.1544764 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxmn9-0002IJ-Bu; Wed, 04 Mar 2026 14:01:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1245417.1544764; Wed, 04 Mar 2026 14:01:35 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxmn9-0002IB-9K; Wed, 04 Mar 2026 14:01:35 +0000
Received: by outflank-mailman (input) for mailman id 1245417;
 Wed, 04 Mar 2026 14:01:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vxmn7-0002I2-OU
 for xen-changelog@lists.xenproject.org; Wed, 04 Mar 2026 14:01:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxmn7-004u9d-2D
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 14:01:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxmn7-00FybJ-27
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 14:01:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=rvNUBKHNXTvYE2uqq4zKfE0JkD9iQtsxNThBkIhuxNs=; b=WUQFFeHGvjk4+ZEOHMow0fRDR9
	DC5BHMX6omGjxoZxNtZ3QX1VcwZyQ/aZk/Who2FbdeFaQPscZlfcXtxhv0447g4Wv6i88eDTcC9sp
	6wvueEYkuvQpM9GPPU71UP5NlH8Jg5oNrow2GhwBCxOOZUorhHwMgXo719Dhh+ih4G0A=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.20] xen: add non-executable stack note uniformly
Message-Id: <E1vxmn7-00FybJ-27@xenbits.xenproject.org>
Date: Wed, 04 Mar 2026 14:01:33 +0000

commit 6a0a1202c69383c0d0ac62019ac41a3a56fd4cea
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Mar 4 14:52:21 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 4 14:52:21 2026 +0100

    xen: add non-executable stack note uniformly
    
    Currently the -Wa,--noexecstack parameter is only passed to the compiler
    when building assembly files, as the assembler doesn't add such note for
    stack attributes.
    
    However, the default addition of the .note.GNU-stack section is dependent
    on the ELF target used.  Adjust the passing of -Wa,--noexecstack so it's
    added to CFLAGS instead of AFLAGS, and hence such section is also added to
    object files generated from .c sources.  This fixes the complains from the
    linker about missing .note.GNU-stack section when building x86-64 Xen on
    Darwin platforms.
    
    Note we could instead pass `-z noexecstack` to the linker, but that however
    would mask any possible errors or unintended mismatches from previous
    steps.
    
    Suggested-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    master commit: 3dfd77003c28ff3f6bfbf76a75d40a41ccecb33f
    master date: 2026-02-13 16:42:42 +0100
---
 xen/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/Makefile b/xen/Makefile
index b7b5941159..19d4e56bd2 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -415,7 +415,7 @@ endif
 
 AFLAGS += -D__ASSEMBLY__
 
-$(call cc-option-add,AFLAGS,CC,-Wa$$(comma)--noexecstack)
+$(call cc-option-add,CFLAGS,CC,-Wa$$(comma)--noexecstack)
 
 LDFLAGS-$(call ld-option,--warn-rwx-segments) += --no-warn-rwx-segments
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.20


From xen-changelog-bounces@lists.xenproject.org Wed Mar 04 14:01:45 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Mar 2026 14:01:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1245418.1544769 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxmnJ-0002KN-DQ; Wed, 04 Mar 2026 14:01:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1245418.1544769; Wed, 04 Mar 2026 14:01:45 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxmnJ-0002KF-Ai; Wed, 04 Mar 2026 14:01:45 +0000
Received: by outflank-mailman (input) for mailman id 1245418;
 Wed, 04 Mar 2026 14:01:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vxmnH-0002K5-Ph
 for xen-changelog@lists.xenproject.org; Wed, 04 Mar 2026 14:01:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxmnH-004u9j-2U
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 14:01:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxmnH-00Fycg-2N
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 14:01:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=teL2x5SxB0p/MCzTSy3yFkHTW1oKEFlueuQ4ezdO1S8=; b=3nLpkyBxdfEpPHYznw3mBoIYoL
	/1SrHKLAfDaS4Xb/3QGxD2eSn1RW0R5AzcU4qQClRyelTuhR0w3+1/xl0FQRNAHq+6OYUWYCoEKZi
	EysoLo9kdv2+6ywouIDI72I1cOrsyCBrokSsBz8pZIM272Ty7dOFyhH174VTyXR1gqxM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.20] VT-d: fix off-by-one when handling extra RMRR ranges
Message-Id: <E1vxmnH-00Fycg-2N@xenbits.xenproject.org>
Date: Wed, 04 Mar 2026 14:01:43 +0000

commit 1aaa2a0097dc8dd7f6ff49c0d0f5965bccf4b492
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Wed Mar 4 14:52:30 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 4 14:52:30 2026 +0100

    VT-d: fix off-by-one when handling extra RMRR ranges
    
    add_one_user_rmrr() operates on inclusive [start,end] range, which means
    the end page needs to be calculated as (start + page_count - 1).
    This off-by-one error resulted in one extra pages being mapped in IOMMU
    context, but not marked as reserved in the memory map. This in turns
    confused PVH dom0 code, resulting in the following crash:
    
        (XEN) [    3.934848] d0: GFN 0x5475c (0x5475c,5,3) -> (0x46a0f4,0,7) not permitted (0x20)
        (XEN) [    3.969657] domain_crash called from arch/x86/mm/p2m.c:695
        (XEN) [    3.972568] Domain 0 reported crashed by domain 32767 on cpu#0:
        (XEN) [    3.975527] Hardware Dom0 crashed: rebooting machine in 5 seconds.
        (XEN) [    8.986353] Resetting with ACPI MEMORY or I/O RESET_REG.
    
    I checked other parts of this API and it was the only error like this.
    Other places:
     - iommu_get_extra_reserved_device_memory() -> reserve_e820_ram() - this
       function expects exclusive range, so the code is correct
     - add_one_extra_ivmd() - this operates on start address and memory
       length
    
    Fixes: 2d9b3699136d ("IOMMU/VT-d: wire common device reserved memory API")
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: d41501fcf62457c3df779abda6718c64da8635ae
    master date: 2026-02-17 08:59:34 +0100
---
 xen/drivers/passthrough/vtd/dmar.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/drivers/passthrough/vtd/dmar.c b/xen/drivers/passthrough/vtd/dmar.c
index 91c22b8330..2a756831a6 100644
--- a/xen/drivers/passthrough/vtd/dmar.c
+++ b/xen/drivers/passthrough/vtd/dmar.c
@@ -1065,7 +1065,8 @@ static int __init add_user_rmrr(void)
 static int __init cf_check add_one_extra_rmrr(xen_pfn_t start, xen_ulong_t nr, u32 id, void *ctxt)
 {
     u32 sbdf_array[] = { id };
-    return add_one_user_rmrr(start, start+nr, 1, sbdf_array);
+
+    return add_one_user_rmrr(start, start + nr - 1, 1, sbdf_array);
 }
 
 static int __init add_extra_rmrr(void)
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.20


From xen-changelog-bounces@lists.xenproject.org Wed Mar 04 14:01:55 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Mar 2026 14:01:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1245419.1544772 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxmnT-0002Mm-Er; Wed, 04 Mar 2026 14:01:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1245419.1544772; Wed, 04 Mar 2026 14:01:55 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxmnT-0002Me-CB; Wed, 04 Mar 2026 14:01:55 +0000
Received: by outflank-mailman (input) for mailman id 1245419;
 Wed, 04 Mar 2026 14:01:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vxmnR-0002MU-U8
 for xen-changelog@lists.xenproject.org; Wed, 04 Mar 2026 14:01:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxmnR-004u9p-2v
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 14:01:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxmnR-00FyeI-2e
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 14:01:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=wen5I1zrbMK/mRtGg3Zc+qM4r96IIoyxCnUXbbt7kOY=; b=ZOoF2deHitaEoZWkk1IKbtX/3Y
	LlXnfVoTKFa3ue5oIfEfQxeJgYTupChsPUGwf/NTEQk8Vz2Eq991payKFWaJcxOIPOWZF1oTt58bA
	NHYjYDiG2rL9e5t0v/m+RFrL3DpwlX8ttyIV6Dt/Nvwb7nBAlxMre/SkrgFq2aAVpsKI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.20] xen/cpufreq: fix adjusting of sampling window on early exit
Message-Id: <E1vxmnR-00FyeI-2e@xenbits.xenproject.org>
Date: Wed, 04 Mar 2026 14:01:53 +0000

commit be58d3002fdc3fb5b24c0bcd2453232d1d911005
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Mar 4 14:52:54 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 4 14:52:54 2026 +0100

    xen/cpufreq: fix adjusting of sampling window on early exit
    
    The logic in dbs_check_cpu() resets the sampling window even when the
    sampling period is considered too small.  This leads to further calls
    finding an imbalance between the total window time and the idle time, as
    the total window time is possibly shorter than the idle time.
    
    Fix by resetting the sampling window start time in the same block where the
    current idle time is stored.  While there also prevent a duplicated call to
    NOW() and instead re-use the previously fetched value.
    
    Fixes: d6f001cb91ac ("x86: Implement cpufreq ondemand policy")
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 74867aae25cb6356b8a7d1140c81666e2a23b818
    master date: 2026-03-02 17:16:26 +0100
---
 xen/drivers/cpufreq/cpufreq_ondemand.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/drivers/cpufreq/cpufreq_ondemand.c b/xen/drivers/cpufreq/cpufreq_ondemand.c
index 06cfc88d30..f62678fa61 100644
--- a/xen/drivers/cpufreq/cpufreq_ondemand.c
+++ b/xen/drivers/cpufreq/cpufreq_ondemand.c
@@ -115,11 +115,12 @@ static void dbs_check_cpu(struct cpu_dbs_info_s *this_dbs_info)
 
     cur_ns = NOW();
     total_ns = cur_ns - this_dbs_info->prev_cpu_wall;
-    this_dbs_info->prev_cpu_wall = NOW();
 
     if (total_ns < MIN_DBS_INTERVAL)
         return;
 
+    this_dbs_info->prev_cpu_wall = cur_ns;
+
     /* Get Idle Time */
     for_each_cpu(j, policy->cpus) {
         uint64_t idle_ns, total_idle_ns;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.20


From xen-changelog-bounces@lists.xenproject.org Wed Mar 04 14:02:05 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Mar 2026 14:02:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1245421.1544776 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxmnd-0002Ow-GO; Wed, 04 Mar 2026 14:02:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1245421.1544776; Wed, 04 Mar 2026 14:02:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxmnd-0002Op-Dd; Wed, 04 Mar 2026 14:02:05 +0000
Received: by outflank-mailman (input) for mailman id 1245421;
 Wed, 04 Mar 2026 14:02:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vxmnc-0002Oi-0G
 for xen-changelog@lists.xenproject.org; Wed, 04 Mar 2026 14:02:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxmnb-004uAT-3A
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 14:02:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxmnb-00Fyhd-35
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 14:02:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=zsCLAq5EQg+WtRHRvvF2v3jQvNHHqx1sHVPe3kQhj5A=; b=ETx8YIWCN4NyoS7BILnThV10Au
	Rt8/BEKDoCWvAJ+hFqpBRaNAQQQkoI7EeUoDBqXSDdKE4LyTX+5kYOWvyBMXqjUOhcSFxeECfQlqo
	NP41Byr5fr03teAGd+EZwqXiUpu+0MTe5EBravH0ss6ijULNL/9OxcxTFRmWowoEs8xA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.20] xen/cpufreq: fix usages of align_timer() in the on-demand governor
Message-Id: <E1vxmnb-00Fyhd-35@xenbits.xenproject.org>
Date: Wed, 04 Mar 2026 14:02:03 +0000

commit 057f0dd56eea1bde442ca0ebd2d6c3b0c1ad0d05
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Mar 4 14:53:05 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 4 14:53:05 2026 +0100

    xen/cpufreq: fix usages of align_timer() in the on-demand governor
    
    The first parameter passed to align_timer() is the timer expiration, not
    the current time.  Adjust the calls to align_timer() in the on-demand
    governor to pass the expected timer expiration as the first parameter.
    
    Fixes: af74e3a15a83 ("cpufreq: align dbs timer for better package C state residency")
    Fixes: 382b95f627a9 ("Fix cpufreq HW-ALL coordination handle")
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: a0ed5bcfbeee81c91c574ad484faa057054eaf09
    master date: 2026-03-02 17:16:26 +0100
---
 xen/drivers/cpufreq/cpufreq_ondemand.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/xen/drivers/cpufreq/cpufreq_ondemand.c b/xen/drivers/cpufreq/cpufreq_ondemand.c
index f62678fa61..9828a40c4b 100644
--- a/xen/drivers/cpufreq/cpufreq_ondemand.c
+++ b/xen/drivers/cpufreq/cpufreq_ondemand.c
@@ -183,7 +183,8 @@ static void cf_check do_dbs_timer(void *dbs)
     dbs_check_cpu(dbs_info);
 
     set_timer(&per_cpu(dbs_timer, dbs_info->cpu),
-            align_timer(NOW() , dbs_tuners_ins.sampling_rate));
+              align_timer(NOW() + dbs_tuners_ins.sampling_rate,
+                          dbs_tuners_ins.sampling_rate));
 }
 
 static void dbs_timer_init(struct cpu_dbs_info_s *dbs_info)
@@ -398,6 +399,6 @@ void cpufreq_dbs_timer_resume(void)
             (void)cmpxchg(stoppable, -1, 1);
         }
         else
-            set_timer(t, align_timer(now, dbs_tuners_ins.sampling_rate));
+            set_timer(t, align_timer(t->expires, dbs_tuners_ins.sampling_rate));
     }
 }
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.20


From xen-changelog-bounces@lists.xenproject.org Wed Mar 04 14:02:16 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Mar 2026 14:02:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1245422.1544784 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxmno-0002Sa-J3; Wed, 04 Mar 2026 14:02:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1245422.1544784; Wed, 04 Mar 2026 14:02:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxmno-0002SS-GS; Wed, 04 Mar 2026 14:02:16 +0000
Received: by outflank-mailman (input) for mailman id 1245422;
 Wed, 04 Mar 2026 14:02:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vxmnm-0002Qm-E5
 for xen-changelog@lists.xenproject.org; Wed, 04 Mar 2026 14:02:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxmnm-004uAd-1K
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 14:02:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxmnm-00Fyk3-1E
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 14:02:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Vxk6Ig0k8QabG5t/5wHd5KNG3NRh7RJ/skvm3/zotLU=; b=Mz3xXjk1K9JiG58SaAcpifjS/v
	pTO1K7k4IcpHD39wu7SD9QbkVGlf75RMfbhYlYG5ckF9VgglYzbBtv3KQeSuWZGQSLeQoFBDDhpZh
	zMZXoDe/+LSlYTAyPH8H9XH47T9kSxZmUuQ3LG7TwfwQMokMAWQTwim657qYokX5BmZI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] EFI: Fix relocating ESRT for dom0
Message-Id: <E1vxmnm-00Fyk3-1E@xenbits.xenproject.org>
Date: Wed, 04 Mar 2026 14:02:14 +0000

commit 68044518e078e8475e59b8be10197e3d38a04685
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Wed Mar 4 14:53:37 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 4 14:53:37 2026 +0100

    EFI: Fix relocating ESRT for dom0
    
    Fix calculating the table size - it consists of a header + entries, not
    just entries.
    This bug caused the last entry to have garbage in its final fields,
    including LowestSupportedFwVersion and CapsuleFlags, which (usually)
    made fwupd able to detect firmware update availability, but refuse
    actually installing it.
    
    Fixes: dc7da0874ba4 ("EFI: preserve the System Resource Table for dom0")
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Acked-by: Daniel P. Smith <dpsmith@apertussolutions.com>
    master commit: 3ea44aa78c8170ca8010a89d24717d6f6ccfe564
    master date: 2026-02-12 11:35:05 +0100
---
 xen/common/efi/boot.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c
index 04d4bbd801..b09890cb8f 100644
--- a/xen/common/efi/boot.c
+++ b/xen/common/efi/boot.c
@@ -624,7 +624,8 @@ static size_t __init get_esrt_size(const EFI_MEMORY_DESCRIPTOR *desc)
     if ( esrt_ptr->FwResourceCount > available_len / sizeof(esrt_ptr->Entries[0]) )
         return 0;
 
-    return esrt_ptr->FwResourceCount * sizeof(esrt_ptr->Entries[0]);
+    return offsetof(EFI_SYSTEM_RESOURCE_TABLE,
+                    Entries[esrt_ptr->FwResourceCount]);
 }
 
 static EFI_GUID __initdata esrt_guid = EFI_SYSTEM_RESOURCE_TABLE_GUID;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Mar 04 14:02:26 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Mar 2026 14:02:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1245423.1544788 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxmny-0002VF-KZ; Wed, 04 Mar 2026 14:02:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1245423.1544788; Wed, 04 Mar 2026 14:02:26 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxmny-0002V7-Hn; Wed, 04 Mar 2026 14:02:26 +0000
Received: by outflank-mailman (input) for mailman id 1245423;
 Wed, 04 Mar 2026 14:02:24 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vxmnw-0002Ur-Gg
 for xen-changelog@lists.xenproject.org; Wed, 04 Mar 2026 14:02:24 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxmnw-004uAs-1Z
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 14:02:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxmnw-00Fylq-1U
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 14:02:24 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=C6EnMNGjvmvdpPvx4cANPXDfSNuXxTYwde5GGdK5KLc=; b=C/P3ctzJ6V+M2phqKYc/OAX9Os
	6bllvbQKoCG5zkHxnjWOJICGtKP2TL1tFuMmk7M4w02WZuaTzrGL38URY0OENqpJc1cWq9X7zPTrX
	iuChtIjV9/468Z3gnK8uV+JES8+BxmQ1c2ruNvHz/Et4wNGNTcrMyXvOdQaNtjEHyZhc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] xen/x86: fix usage of [[:blank:]] with BSD grep
Message-Id: <E1vxmnw-00Fylq-1U@xenbits.xenproject.org>
Date: Wed, 04 Mar 2026 14:02:24 +0000

commit 2d88bf5b69cbec182e6bc9a5fa4de44215dd620f
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Mar 4 14:54:02 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 4 14:54:02 2026 +0100

    xen/x86: fix usage of [[:blank:]] with BSD grep
    
    BSD grep only recognizes [[:blank:]] as a valid expression when using
    extended (modern) regular expressions.  Pass -E to the grep call used in
    efi-nr-fixups.
    
    Additionally, the return from `wc -l` is space padded on BSD, and hence
    the content of efi-nr-fixups is "       2", not plain "2".  Strip the
    spaces in the Makefile using $(strip ...).
    
    Fixes: 1be65ec4c8bc ('x86/EFI: avoid use of GNU ld's --disable-reloc-section when possible')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    master commit: c13335b5c1292e90436746ec04ed0553b688160b
    master date: 2026-02-13 16:42:34 +0100
---
 xen/arch/x86/arch.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/arch.mk b/xen/arch/x86/arch.mk
index 85d3e7cbfe..4924d3c660 100644
--- a/xen/arch/x86/arch.mk
+++ b/xen/arch/x86/arch.mk
@@ -114,7 +114,7 @@ endif
 ifeq ($(XEN_BUILD_PE),y)
 
 # Check if the linker produces fixups in PE by default
-efi-nr-fixups := $(shell LC_ALL=C $(OBJDUMP) -p $(efi-check).efi | grep '^[[:blank:]]*reloc[[:blank:]]*[0-9][[:blank:]].*DIR64$$' | wc -l)
+efi-nr-fixups := $(strip $(shell LC_ALL=C $(OBJDUMP) -p $(efi-check).efi | grep -E '^[[:blank:]]*reloc[[:blank:]]*[0-9][[:blank:]].*DIR64$$' | wc -l))
 
 ifeq ($(efi-nr-fixups),2)
 MKRELOC := :
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Mar 04 14:02:35 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Mar 2026 14:02:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1245425.1544792 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxmo7-0002Yc-Nq; Wed, 04 Mar 2026 14:02:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1245425.1544792; Wed, 04 Mar 2026 14:02:35 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxmo7-0002YT-L3; Wed, 04 Mar 2026 14:02:35 +0000
Received: by outflank-mailman (input) for mailman id 1245425;
 Wed, 04 Mar 2026 14:02:34 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vxmo6-0002YN-JV
 for xen-changelog@lists.xenproject.org; Wed, 04 Mar 2026 14:02:34 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxmo6-004uAz-1r
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 14:02:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxmo6-00Fyng-1l
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 14:02:34 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=+lm5u4FhwSsIRtCx6vjqpuPwamcWbC6iZNX+PjRRUQE=; b=SNOzCHnaALalL2NZ8gFfuAUlwf
	Rx/nLs5lDzZdL43ov/xu2pWehvk1eVb0T+fPGjsSTfBeoNYdTw2Dz8JmQcBX4pKS+cWD9Uex4V6mU
	f9GVQKA/voU2zKAvQqle8pt08otL/eqF3nNufiCfG0sq8C3Vxst7WmhU3IhpnRKL2UOk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] xen: add non-executable stack note uniformly
Message-Id: <E1vxmo6-00Fyng-1l@xenbits.xenproject.org>
Date: Wed, 04 Mar 2026 14:02:34 +0000

commit 744d8cf1991a9b43c5c64ec520121a799cb332b9
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Mar 4 14:54:10 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 4 14:54:10 2026 +0100

    xen: add non-executable stack note uniformly
    
    Currently the -Wa,--noexecstack parameter is only passed to the compiler
    when building assembly files, as the assembler doesn't add such note for
    stack attributes.
    
    However, the default addition of the .note.GNU-stack section is dependent
    on the ELF target used.  Adjust the passing of -Wa,--noexecstack so it's
    added to CFLAGS instead of AFLAGS, and hence such section is also added to
    object files generated from .c sources.  This fixes the complains from the
    linker about missing .note.GNU-stack section when building x86-64 Xen on
    Darwin platforms.
    
    Note we could instead pass `-z noexecstack` to the linker, but that however
    would mask any possible errors or unintended mismatches from previous
    steps.
    
    Suggested-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    master commit: 3dfd77003c28ff3f6bfbf76a75d40a41ccecb33f
    master date: 2026-02-13 16:42:42 +0100
---
 xen/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/Makefile b/xen/Makefile
index b83e8827a4..4d34597522 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -412,7 +412,7 @@ endif
 
 AFLAGS += -D__ASSEMBLY__
 
-$(call cc-option-add,AFLAGS,CC,-Wa$$(comma)--noexecstack)
+$(call cc-option-add,CFLAGS,CC,-Wa$$(comma)--noexecstack)
 
 LDFLAGS-$(call ld-option,--warn-rwx-segments) += --no-warn-rwx-segments
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Mar 04 14:02:45 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Mar 2026 14:02:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1245429.1544795 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxmoH-0002bk-P9; Wed, 04 Mar 2026 14:02:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1245429.1544795; Wed, 04 Mar 2026 14:02:45 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxmoH-0002bc-MN; Wed, 04 Mar 2026 14:02:45 +0000
Received: by outflank-mailman (input) for mailman id 1245429;
 Wed, 04 Mar 2026 14:02:44 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vxmoG-0002bB-MA
 for xen-changelog@lists.xenproject.org; Wed, 04 Mar 2026 14:02:44 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxmoG-004uBB-27
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 14:02:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxmoG-00FypV-21
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 14:02:44 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=693Td1l37/rOA2Tbr+ATJjZlapzExXC2PH5yO+ahnp4=; b=ZyMRwLP8f52sTMeMW3zgdW2Gic
	5GrLOiskKZ1CXgRj2NPzlgw7NwEudZyjl6MPNyERYMTgfmz4JMg0nA6RZjXHrlB8TgB2Hlwwy1jb3
	XgUET1c2jfKFmi8Ycl7g2vzcGKXDkvGlzXwGaMPgX5OLWLbBMcMVcmvd75cnz6w//TBw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] VT-d: fix off-by-one when handling extra RMRR ranges
Message-Id: <E1vxmoG-00FypV-21@xenbits.xenproject.org>
Date: Wed, 04 Mar 2026 14:02:44 +0000

commit aa073513622ab7f4c9b3fda3bbc4d7e9ffa775fd
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Wed Mar 4 14:54:27 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 4 14:54:27 2026 +0100

    VT-d: fix off-by-one when handling extra RMRR ranges
    
    add_one_user_rmrr() operates on inclusive [start,end] range, which means
    the end page needs to be calculated as (start + page_count - 1).
    This off-by-one error resulted in one extra pages being mapped in IOMMU
    context, but not marked as reserved in the memory map. This in turns
    confused PVH dom0 code, resulting in the following crash:
    
        (XEN) [    3.934848] d0: GFN 0x5475c (0x5475c,5,3) -> (0x46a0f4,0,7) not permitted (0x20)
        (XEN) [    3.969657] domain_crash called from arch/x86/mm/p2m.c:695
        (XEN) [    3.972568] Domain 0 reported crashed by domain 32767 on cpu#0:
        (XEN) [    3.975527] Hardware Dom0 crashed: rebooting machine in 5 seconds.
        (XEN) [    8.986353] Resetting with ACPI MEMORY or I/O RESET_REG.
    
    I checked other parts of this API and it was the only error like this.
    Other places:
     - iommu_get_extra_reserved_device_memory() -> reserve_e820_ram() - this
       function expects exclusive range, so the code is correct
     - add_one_extra_ivmd() - this operates on start address and memory
       length
    
    Fixes: 2d9b3699136d ("IOMMU/VT-d: wire common device reserved memory API")
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: d41501fcf62457c3df779abda6718c64da8635ae
    master date: 2026-02-17 08:59:34 +0100
---
 xen/drivers/passthrough/vtd/dmar.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/drivers/passthrough/vtd/dmar.c b/xen/drivers/passthrough/vtd/dmar.c
index 91c22b8330..2a756831a6 100644
--- a/xen/drivers/passthrough/vtd/dmar.c
+++ b/xen/drivers/passthrough/vtd/dmar.c
@@ -1065,7 +1065,8 @@ static int __init add_user_rmrr(void)
 static int __init cf_check add_one_extra_rmrr(xen_pfn_t start, xen_ulong_t nr, u32 id, void *ctxt)
 {
     u32 sbdf_array[] = { id };
-    return add_one_user_rmrr(start, start+nr, 1, sbdf_array);
+
+    return add_one_user_rmrr(start, start + nr - 1, 1, sbdf_array);
 }
 
 static int __init add_extra_rmrr(void)
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Mar 04 14:02:55 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Mar 2026 14:02:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1245430.1544799 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxmoR-0002eL-QY; Wed, 04 Mar 2026 14:02:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1245430.1544799; Wed, 04 Mar 2026 14:02:55 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxmoR-0002eE-Nm; Wed, 04 Mar 2026 14:02:55 +0000
Received: by outflank-mailman (input) for mailman id 1245430;
 Wed, 04 Mar 2026 14:02:54 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vxmoQ-0002e1-ON
 for xen-changelog@lists.xenproject.org; Wed, 04 Mar 2026 14:02:54 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxmoQ-004uBJ-2M
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 14:02:54 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxmoQ-00Fyqc-2H
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 14:02:54 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=GI00ODZtJCRKOxJksvhxqXGsDQMdpYRuSVUbjtvPocY=; b=C6ze+yL08RS58Ng/nroLQZeExf
	Dt5pZj9826CxYjC2QHZWhrVUDcm+0doCmhAQXJvHi2+x5yM39mgUYVb9BiuKkhc1cqjFYQjQDVSdY
	OlGboFwhsFcDeMHR4+e/3rNLLrzz+DcCNMw6Iw58YfVpldqja3CFm7MXyHF+Ca5WdKvc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] xen/cpufreq: fix adjusting of sampling window on early exit
Message-Id: <E1vxmoQ-00Fyqc-2H@xenbits.xenproject.org>
Date: Wed, 04 Mar 2026 14:02:54 +0000

commit 24c83081d542a46dcfb9befc0977a8ed4ecd8d14
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Mar 4 14:54:46 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 4 14:54:46 2026 +0100

    xen/cpufreq: fix adjusting of sampling window on early exit
    
    The logic in dbs_check_cpu() resets the sampling window even when the
    sampling period is considered too small.  This leads to further calls
    finding an imbalance between the total window time and the idle time, as
    the total window time is possibly shorter than the idle time.
    
    Fix by resetting the sampling window start time in the same block where the
    current idle time is stored.  While there also prevent a duplicated call to
    NOW() and instead re-use the previously fetched value.
    
    Fixes: d6f001cb91ac ("x86: Implement cpufreq ondemand policy")
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 74867aae25cb6356b8a7d1140c81666e2a23b818
    master date: 2026-03-02 17:16:26 +0100
---
 xen/drivers/cpufreq/cpufreq_ondemand.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/drivers/cpufreq/cpufreq_ondemand.c b/xen/drivers/cpufreq/cpufreq_ondemand.c
index 06cfc88d30..f62678fa61 100644
--- a/xen/drivers/cpufreq/cpufreq_ondemand.c
+++ b/xen/drivers/cpufreq/cpufreq_ondemand.c
@@ -115,11 +115,12 @@ static void dbs_check_cpu(struct cpu_dbs_info_s *this_dbs_info)
 
     cur_ns = NOW();
     total_ns = cur_ns - this_dbs_info->prev_cpu_wall;
-    this_dbs_info->prev_cpu_wall = NOW();
 
     if (total_ns < MIN_DBS_INTERVAL)
         return;
 
+    this_dbs_info->prev_cpu_wall = cur_ns;
+
     /* Get Idle Time */
     for_each_cpu(j, policy->cpus) {
         uint64_t idle_ns, total_idle_ns;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Mar 04 14:03:05 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Mar 2026 14:03:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1245432.1544804 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxmob-0002gk-S4; Wed, 04 Mar 2026 14:03:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1245432.1544804; Wed, 04 Mar 2026 14:03:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxmob-0002gc-PL; Wed, 04 Mar 2026 14:03:05 +0000
Received: by outflank-mailman (input) for mailman id 1245432;
 Wed, 04 Mar 2026 14:03:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vxmoa-0002gV-Qz
 for xen-changelog@lists.xenproject.org; Wed, 04 Mar 2026 14:03:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxmoa-004uBu-2c
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 14:03:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxmoa-00Fyrk-2W
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 14:03:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=F8oN/VQs4Og5F4K6T8zOshgS1EGHPsM0XBz7dGUEUPc=; b=FQqSd579gote1hvlDFTlX8fRoo
	Rs9EltGSIR0ukwCKfdo4UpkWIR2nXDopiHDM+GxH03SYzglQ4SXr/oakYaNMb5uaZpwnIt+wiOUvT
	dBLXt8/36QpN2iYqpmUtxk1OocragFR4gkjxmMLkyQvftZAJsbK2cU2EeDJiUkB/uqAk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] xen/cpufreq: fix usages of align_timer() in the on-demand governor
Message-Id: <E1vxmoa-00Fyrk-2W@xenbits.xenproject.org>
Date: Wed, 04 Mar 2026 14:03:04 +0000

commit 84b006870c41f94ee99af202d5f0a7b4dcd3cc94
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Mar 4 14:54:55 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 4 14:54:55 2026 +0100

    xen/cpufreq: fix usages of align_timer() in the on-demand governor
    
    The first parameter passed to align_timer() is the timer expiration, not
    the current time.  Adjust the calls to align_timer() in the on-demand
    governor to pass the expected timer expiration as the first parameter.
    
    Fixes: af74e3a15a83 ("cpufreq: align dbs timer for better package C state residency")
    Fixes: 382b95f627a9 ("Fix cpufreq HW-ALL coordination handle")
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: a0ed5bcfbeee81c91c574ad484faa057054eaf09
    master date: 2026-03-02 17:16:26 +0100
---
 xen/drivers/cpufreq/cpufreq_ondemand.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/xen/drivers/cpufreq/cpufreq_ondemand.c b/xen/drivers/cpufreq/cpufreq_ondemand.c
index f62678fa61..9828a40c4b 100644
--- a/xen/drivers/cpufreq/cpufreq_ondemand.c
+++ b/xen/drivers/cpufreq/cpufreq_ondemand.c
@@ -183,7 +183,8 @@ static void cf_check do_dbs_timer(void *dbs)
     dbs_check_cpu(dbs_info);
 
     set_timer(&per_cpu(dbs_timer, dbs_info->cpu),
-            align_timer(NOW() , dbs_tuners_ins.sampling_rate));
+              align_timer(NOW() + dbs_tuners_ins.sampling_rate,
+                          dbs_tuners_ins.sampling_rate));
 }
 
 static void dbs_timer_init(struct cpu_dbs_info_s *dbs_info)
@@ -398,6 +399,6 @@ void cpufreq_dbs_timer_resume(void)
             (void)cmpxchg(stoppable, -1, 1);
         }
         else
-            set_timer(t, align_timer(now, dbs_tuners_ins.sampling_rate));
+            set_timer(t, align_timer(t->expires, dbs_tuners_ins.sampling_rate));
     }
 }
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Mar 04 16:00:07 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Mar 2026 16:00:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1245714.1545049 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxodn-0005KK-OD; Wed, 04 Mar 2026 16:00:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1245714.1545049; Wed, 04 Mar 2026 16:00:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxodn-0005Jt-Kv; Wed, 04 Mar 2026 16:00:03 +0000
Received: by outflank-mailman (input) for mailman id 1245714;
 Wed, 04 Mar 2026 16:00:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vxodm-0004yH-CU
 for xen-changelog@lists.xenproject.org; Wed, 04 Mar 2026 16:00:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxodm-004xXl-0k
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 16:00:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxodm-00G8Xq-0c
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 16:00:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=/eqZWAp08RLfz1nPtV8gO/mEjwLqchhtferV9EZdLR8=; b=Y5Ffx7feJFQvcxjnrR4E1pFsYO
	qLCFChr8TtdrvmpBPd1NuM7DthZfNXsdkY0yvT1ea6fNsM37FZcwZ7WCp4QmjTUWH7yCzMorOMMtl
	jWa9sO6ogkzcci96XI3SE7nmNGh4mjBCsJff8aOzk0/KOfjNrjQFdDGULq6exdSJudyo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.21] EFI: Fix relocating ESRT for dom0
Message-Id: <E1vxodm-00G8Xq-0c@xenbits.xenproject.org>
Date: Wed, 04 Mar 2026 16:00:02 +0000

commit 99bd17462dd4b7366bd40d33ffee119d21799da8
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Wed Mar 4 14:47:59 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 4 14:47:59 2026 +0100

    EFI: Fix relocating ESRT for dom0
    
    Fix calculating the table size - it consists of a header + entries, not
    just entries.
    This bug caused the last entry to have garbage in its final fields,
    including LowestSupportedFwVersion and CapsuleFlags, which (usually)
    made fwupd able to detect firmware update availability, but refuse
    actually installing it.
    
    Fixes: dc7da0874ba4 ("EFI: preserve the System Resource Table for dom0")
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Acked-by: Daniel P. Smith <dpsmith@apertussolutions.com>
    master commit: 3ea44aa78c8170ca8010a89d24717d6f6ccfe564
    master date: 2026-02-12 11:35:05 +0100
---
 xen/common/efi/boot.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c
index d7f4d0cb22..2047d58e39 100644
--- a/xen/common/efi/boot.c
+++ b/xen/common/efi/boot.c
@@ -675,7 +675,8 @@ static size_t __init get_esrt_size(const EFI_MEMORY_DESCRIPTOR *desc)
     if ( esrt_ptr->FwResourceCount > available_len / sizeof(esrt_ptr->Entries[0]) )
         return 0;
 
-    return esrt_ptr->FwResourceCount * sizeof(esrt_ptr->Entries[0]);
+    return offsetof(EFI_SYSTEM_RESOURCE_TABLE,
+                    Entries[esrt_ptr->FwResourceCount]);
 }
 
 static EFI_GUID __initdata esrt_guid = EFI_SYSTEM_RESOURCE_TABLE_GUID;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.21


From xen-changelog-bounces@lists.xenproject.org Wed Mar 04 16:00:13 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Mar 2026 16:00:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1245715.1545055 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxodx-0005ox-Rz; Wed, 04 Mar 2026 16:00:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1245715.1545055; Wed, 04 Mar 2026 16:00:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxodx-0005om-Mq; Wed, 04 Mar 2026 16:00:13 +0000
Received: by outflank-mailman (input) for mailman id 1245715;
 Wed, 04 Mar 2026 16:00:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vxodw-0005ob-C3
 for xen-changelog@lists.xenproject.org; Wed, 04 Mar 2026 16:00:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxodw-004xdm-14
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 16:00:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxodw-00G8Zg-0v
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 16:00:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=scG43lwVQue95HKOwW1nZ5XdBs0gdf2efvg7gA9948E=; b=dMzCjoXyzubSqwEwPOx7PbxX+H
	epjUH6coKcsNfnY9+nULXNUQS0g+l2fcrb9VTCVjdbwdaVVc2dViP58nz0fxku1NNy8jY2hs2uWLx
	5i4pIDGB6OAtOgWKaDyFth+koxHOd4Y51C2UCjosPTtJ6GlM8QD58xjgS2cVGC3iHfSU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.21] xen/x86: fix usage of [[:blank:]] with BSD grep
Message-Id: <E1vxodw-00G8Zg-0v@xenbits.xenproject.org>
Date: Wed, 04 Mar 2026 16:00:12 +0000

commit 14db25be36de437c2603a27ee033658c58fffd1b
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Mar 4 14:48:30 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 4 14:48:30 2026 +0100

    xen/x86: fix usage of [[:blank:]] with BSD grep
    
    BSD grep only recognizes [[:blank:]] as a valid expression when using
    extended (modern) regular expressions.  Pass -E to the grep call used in
    efi-nr-fixups.
    
    Additionally, the return from `wc -l` is space padded on BSD, and hence
    the content of efi-nr-fixups is "       2", not plain "2".  Strip the
    spaces in the Makefile using $(strip ...).
    
    Fixes: 1be65ec4c8bc ('x86/EFI: avoid use of GNU ld's --disable-reloc-section when possible')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    master commit: c13335b5c1292e90436746ec04ed0553b688160b
    master date: 2026-02-13 16:42:34 +0100
---
 xen/arch/x86/arch.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/arch.mk b/xen/arch/x86/arch.mk
index 16368a498b..22fd2bc871 100644
--- a/xen/arch/x86/arch.mk
+++ b/xen/arch/x86/arch.mk
@@ -98,7 +98,7 @@ endif
 ifeq ($(XEN_BUILD_PE),y)
 
 # Check if the linker produces fixups in PE by default
-efi-nr-fixups := $(shell LC_ALL=C $(OBJDUMP) -p $(efi-check).efi | grep '^[[:blank:]]*reloc[[:blank:]]*[0-9][[:blank:]].*DIR64$$' | wc -l)
+efi-nr-fixups := $(strip $(shell LC_ALL=C $(OBJDUMP) -p $(efi-check).efi | grep -E '^[[:blank:]]*reloc[[:blank:]]*[0-9][[:blank:]].*DIR64$$' | wc -l))
 
 ifeq ($(efi-nr-fixups),2)
 MKRELOC := :
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.21


From xen-changelog-bounces@lists.xenproject.org Wed Mar 04 16:00:23 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Mar 2026 16:00:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1245716.1545057 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxoe7-0005zY-R7; Wed, 04 Mar 2026 16:00:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1245716.1545057; Wed, 04 Mar 2026 16:00:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxoe7-0005zQ-OS; Wed, 04 Mar 2026 16:00:23 +0000
Received: by outflank-mailman (input) for mailman id 1245716;
 Wed, 04 Mar 2026 16:00:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vxoe6-0005zI-FA
 for xen-changelog@lists.xenproject.org; Wed, 04 Mar 2026 16:00:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxoe6-004xj8-1N
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 16:00:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxoe6-00G8bI-1E
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 16:00:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=vp0ZK9v/HvIDXaBOiIauoaSBBo7kWo1QEsyBliyrf3o=; b=HgBQ4Gst/Tt5M1YunOZvGE0rmb
	HYdTGtGnE9OaOc+Tlq6fe7FJ2qZ2ZGLSHcF4K0NdgmFdvuf0fa9Xro0hvqpWyERHs6hmAp53r0mWH
	kM7LhnjG+Wwl82hae44CSc3xzHGx3F8c4FAthicBMmff5Qdbbej1WdhmM0y++7ZFT2MY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.21] xen: add non-executable stack note uniformly
Message-Id: <E1vxoe6-00G8bI-1E@xenbits.xenproject.org>
Date: Wed, 04 Mar 2026 16:00:22 +0000

commit a7380f14379ba79eaf43852b5555ed53a35da9e4
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Mar 4 14:48:39 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 4 14:48:39 2026 +0100

    xen: add non-executable stack note uniformly
    
    Currently the -Wa,--noexecstack parameter is only passed to the compiler
    when building assembly files, as the assembler doesn't add such note for
    stack attributes.
    
    However, the default addition of the .note.GNU-stack section is dependent
    on the ELF target used.  Adjust the passing of -Wa,--noexecstack so it's
    added to CFLAGS instead of AFLAGS, and hence such section is also added to
    object files generated from .c sources.  This fixes the complains from the
    linker about missing .note.GNU-stack section when building x86-64 Xen on
    Darwin platforms.
    
    Note we could instead pass `-z noexecstack` to the linker, but that however
    would mask any possible errors or unintended mismatches from previous
    steps.
    
    Suggested-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    master commit: 3dfd77003c28ff3f6bfbf76a75d40a41ccecb33f
    master date: 2026-02-13 16:42:42 +0100
---
 xen/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/Makefile b/xen/Makefile
index 9ed5853020..1a54194a1e 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -415,7 +415,7 @@ endif
 
 AFLAGS += -D__ASSEMBLY__
 
-$(call cc-option-add,AFLAGS,CC,-Wa$$(comma)--noexecstack)
+$(call cc-option-add,CFLAGS,CC,-Wa$$(comma)--noexecstack)
 
 LDFLAGS-$(call ld-option,--warn-rwx-segments) += --no-warn-rwx-segments
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.21


From xen-changelog-bounces@lists.xenproject.org Wed Mar 04 16:00:33 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Mar 2026 16:00:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1245717.1545061 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxoeH-00061n-St; Wed, 04 Mar 2026 16:00:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1245717.1545061; Wed, 04 Mar 2026 16:00:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxoeH-00061f-Ps; Wed, 04 Mar 2026 16:00:33 +0000
Received: by outflank-mailman (input) for mailman id 1245717;
 Wed, 04 Mar 2026 16:00:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vxoeG-00061W-JH
 for xen-changelog@lists.xenproject.org; Wed, 04 Mar 2026 16:00:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxoeG-004xjC-1p
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 16:00:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxoeG-00G8cW-1Y
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 16:00:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=CjrP+fbDpx1ZZH4ZDsLUBfLhWWfSAD7J7DgDPEt++nI=; b=Q+V2wt3myypCBhtehd8XP927p0
	sOjTiA/AJxi40kkL9Omq2MCw2Orv3+4feC29M3BeZ2f11ndYPrDTkvs8+vJckleKA8Y97vRzw1hIS
	lcD27088QYmps2SuA7N9lvjVgQeWsbjHVxxmfKNk8Txe0iFxCJ62yV2wI1PVQDRe4QTU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.21] VT-d: fix off-by-one when handling extra RMRR ranges
Message-Id: <E1vxoeG-00G8cW-1Y@xenbits.xenproject.org>
Date: Wed, 04 Mar 2026 16:00:32 +0000

commit 615199f05b43e27b9675c485fb0c5f128603a074
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Wed Mar 4 14:48:56 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 4 14:48:56 2026 +0100

    VT-d: fix off-by-one when handling extra RMRR ranges
    
    add_one_user_rmrr() operates on inclusive [start,end] range, which means
    the end page needs to be calculated as (start + page_count - 1).
    This off-by-one error resulted in one extra pages being mapped in IOMMU
    context, but not marked as reserved in the memory map. This in turns
    confused PVH dom0 code, resulting in the following crash:
    
        (XEN) [    3.934848] d0: GFN 0x5475c (0x5475c,5,3) -> (0x46a0f4,0,7) not permitted (0x20)
        (XEN) [    3.969657] domain_crash called from arch/x86/mm/p2m.c:695
        (XEN) [    3.972568] Domain 0 reported crashed by domain 32767 on cpu#0:
        (XEN) [    3.975527] Hardware Dom0 crashed: rebooting machine in 5 seconds.
        (XEN) [    8.986353] Resetting with ACPI MEMORY or I/O RESET_REG.
    
    I checked other parts of this API and it was the only error like this.
    Other places:
     - iommu_get_extra_reserved_device_memory() -> reserve_e820_ram() - this
       function expects exclusive range, so the code is correct
     - add_one_extra_ivmd() - this operates on start address and memory
       length
    
    Fixes: 2d9b3699136d ("IOMMU/VT-d: wire common device reserved memory API")
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: d41501fcf62457c3df779abda6718c64da8635ae
    master date: 2026-02-17 08:59:34 +0100
---
 xen/drivers/passthrough/vtd/dmar.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/drivers/passthrough/vtd/dmar.c b/xen/drivers/passthrough/vtd/dmar.c
index 91c22b8330..2a756831a6 100644
--- a/xen/drivers/passthrough/vtd/dmar.c
+++ b/xen/drivers/passthrough/vtd/dmar.c
@@ -1065,7 +1065,8 @@ static int __init add_user_rmrr(void)
 static int __init cf_check add_one_extra_rmrr(xen_pfn_t start, xen_ulong_t nr, u32 id, void *ctxt)
 {
     u32 sbdf_array[] = { id };
-    return add_one_user_rmrr(start, start+nr, 1, sbdf_array);
+
+    return add_one_user_rmrr(start, start + nr - 1, 1, sbdf_array);
 }
 
 static int __init add_extra_rmrr(void)
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.21


From xen-changelog-bounces@lists.xenproject.org Wed Mar 04 16:00:44 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Mar 2026 16:00:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1245718.1545065 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxoeR-00064K-Vq; Wed, 04 Mar 2026 16:00:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1245718.1545065; Wed, 04 Mar 2026 16:00:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxoeR-00064C-T0; Wed, 04 Mar 2026 16:00:43 +0000
Received: by outflank-mailman (input) for mailman id 1245718;
 Wed, 04 Mar 2026 16:00:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vxoeQ-00063z-Ma
 for xen-changelog@lists.xenproject.org; Wed, 04 Mar 2026 16:00:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxoeQ-004xjI-27
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 16:00:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxoeQ-00G8eQ-21
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 16:00:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=S53swRa4Cd+QcBt/TFnuNr/mRjr2de0ZoouNw2WVU9w=; b=TyZJRqhxNbMkjP9mSB9EVOomwj
	w2Bp793OhdGUwCDHNDzP2BXesRQqP47JQ1zIE/GkeNd3JjJob4hJShLhFtz5M56umL4JaE9xaIeQi
	Rrr8zMD+WA6Ch4L5jnEh9myRFgbkwaqqc2foLB+sx8US/M1wKkU08oQdJa52nsCSFpE8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.21] common/domctl: xsm update for get_domain_state access
Message-Id: <E1vxoeQ-00G8eQ-21@xenbits.xenproject.org>
Date: Wed, 04 Mar 2026 16:00:42 +0000

commit 4778574053ab2127d1a97a01b9788e786570412c
Author:     Daniel P. Smith <dpsmith@apertussolutions.com>
AuthorDate: Wed Mar 4 14:49:47 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 4 14:49:47 2026 +0100

    common/domctl: xsm update for get_domain_state access
    
    When using XSM Flask, passing DOMID_INVALID will result in a NULL pointer
    reference from the passing of NULL as the target domain to
    xsm_get_domain_state(). Simply not invoking xsm_get_domain_state() when the
    target domain is NULL opens the opportunity to circumvent the XSM
    get_domain_state access check. This is due to the fact that the call to
    xsm_domctl() for get_domain_state op is a no-op check, deferring to
    xsm_get_domain_state().
    
    Modify the helper get_domain_state() to ensure the requesting domain has
    get_domain_state access for the target domain, whether the target domain is
    explicitly set or implicitly determined with a domain state search. In the case
    of access not being allowed for a domain found during an implicit search, the
    search will continue to the next domain whose state has changed.
    
    Fixes: 3ad3df1bd0aa ("xen: add new domctl get_domain_state")
    Reported-by: Chris Rogers <rogersc@ainfosec.com>
    Reported-by: Dmytro Firsov <dmytro_firsov@epam.com>
    Signed-off-by: Daniel P. Smith <dpsmith@apertussolutions.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 0c79dde780217935a5c320300e381fc797f5fa19
    master date: 2026-02-23 08:42:15 +0100
---
 xen/common/domain.c | 37 ++++++++++++++++++++++---------------
 xen/common/domctl.c |  7 ++-----
 2 files changed, 24 insertions(+), 20 deletions(-)

diff --git a/xen/common/domain.c b/xen/common/domain.c
index 6ae7c46b40..ac06532544 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -209,7 +209,7 @@ static void set_domain_state_info(struct xen_domctl_get_domain_state *info,
 int get_domain_state(struct xen_domctl_get_domain_state *info, struct domain *d,
                      domid_t *domid)
 {
-    unsigned int dom;
+    unsigned int dom = -1;
     int rc = -ENOENT;
     struct domain *hdl;
 
@@ -218,6 +218,10 @@ int get_domain_state(struct xen_domctl_get_domain_state *info, struct domain *d,
 
     if ( d )
     {
+        rc = xsm_get_domain_state(XSM_XS_PRIV, d);
+        if ( rc )
+            return rc;
+
         set_domain_state_info(info, d);
 
         return 0;
@@ -237,28 +241,31 @@ int get_domain_state(struct xen_domctl_get_domain_state *info, struct domain *d,
 
     while ( dom_state_changed )
     {
-        dom = find_first_bit(dom_state_changed, DOMID_MASK + 1);
+        dom = find_next_bit(dom_state_changed, DOMID_MASK + 1, dom + 1);
         if ( dom >= DOMID_FIRST_RESERVED )
             break;
-        if ( test_and_clear_bit(dom, dom_state_changed) )
-        {
-            *domid = dom;
-
-            d = rcu_lock_domain_by_id(dom);
 
+        d = rcu_lock_domain_by_id(dom);
+        if ( (d && xsm_get_domain_state(XSM_XS_PRIV, d)) ||
+             !test_and_clear_bit(dom, dom_state_changed) )
+        {
             if ( d )
-            {
-                set_domain_state_info(info, d);
-
                 rcu_unlock_domain(d);
-            }
-            else
-                memset(info, 0, sizeof(*info));
+            continue;
+        }
 
-            rc = 0;
+        *domid = dom;
 
-            break;
+        if ( d )
+        {
+            set_domain_state_info(info, d);
+            rcu_unlock_domain(d);
         }
+        else
+            memset(info, 0, sizeof(*info));
+
+        rc = 0;
+        break;
     }
 
  out:
diff --git a/xen/common/domctl.c b/xen/common/domctl.c
index 954d790226..21bbffdc40 100644
--- a/xen/common/domctl.c
+++ b/xen/common/domctl.c
@@ -854,12 +854,9 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl)
         break;
 
     case XEN_DOMCTL_get_domain_state:
-        ret = xsm_get_domain_state(XSM_XS_PRIV, d);
-        if ( ret )
-            break;
-
-        copyback = 1;
         ret = get_domain_state(&op->u.get_domain_state, d, &op->domain);
+        if ( !ret )
+            copyback = true;
         break;
 
     default:
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.21


From xen-changelog-bounces@lists.xenproject.org Wed Mar 04 16:00:54 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Mar 2026 16:00:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1245719.1545068 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxoec-00066f-10; Wed, 04 Mar 2026 16:00:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1245719.1545068; Wed, 04 Mar 2026 16:00:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxoeb-00066W-US; Wed, 04 Mar 2026 16:00:53 +0000
Received: by outflank-mailman (input) for mailman id 1245719;
 Wed, 04 Mar 2026 16:00:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vxoea-00066G-P7
 for xen-changelog@lists.xenproject.org; Wed, 04 Mar 2026 16:00:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxoea-004xjO-2P
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 16:00:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxoea-00G8fW-2I
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 16:00:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=9Ue2EUwRwN1TV04Vu9zr0WoqGLSscOUP6lBhCjA9W8A=; b=qy4LEkaJxNesleeRZhQ2d+yftT
	k9vNwMzhjZ9HmC+Bvz05izHHt/bGbYVktJhi7XmC3syjGlIMcprA3DxXZnImZ17sYSDQu9FaqImPh
	+6pFLYAjgSgLm2dqKn00olu2bVgDkrYOxb40CAXXYiYeZtfBj17xcHl8RCrJjL/lNSfk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.21] xen/cpufreq: fix adjusting of sampling window on early exit
Message-Id: <E1vxoea-00G8fW-2I@xenbits.xenproject.org>
Date: Wed, 04 Mar 2026 16:00:52 +0000

commit ae0708e940ea56e7cc4369732310353c4d1790b0
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Mar 4 14:50:04 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 4 14:50:04 2026 +0100

    xen/cpufreq: fix adjusting of sampling window on early exit
    
    The logic in dbs_check_cpu() resets the sampling window even when the
    sampling period is considered too small.  This leads to further calls
    finding an imbalance between the total window time and the idle time, as
    the total window time is possibly shorter than the idle time.
    
    Fix by resetting the sampling window start time in the same block where the
    current idle time is stored.  While there also prevent a duplicated call to
    NOW() and instead re-use the previously fetched value.
    
    Fixes: d6f001cb91ac ("x86: Implement cpufreq ondemand policy")
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 74867aae25cb6356b8a7d1140c81666e2a23b818
    master date: 2026-03-02 17:16:26 +0100
---
 xen/drivers/cpufreq/cpufreq_ondemand.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/drivers/cpufreq/cpufreq_ondemand.c b/xen/drivers/cpufreq/cpufreq_ondemand.c
index 0126a3f5d9..537695eaab 100644
--- a/xen/drivers/cpufreq/cpufreq_ondemand.c
+++ b/xen/drivers/cpufreq/cpufreq_ondemand.c
@@ -117,11 +117,12 @@ static void dbs_check_cpu(struct cpu_dbs_info_s *this_dbs_info)
 
     cur_ns = NOW();
     total_ns = cur_ns - this_dbs_info->prev_cpu_wall;
-    this_dbs_info->prev_cpu_wall = NOW();
 
     if (total_ns < MIN_DBS_INTERVAL)
         return;
 
+    this_dbs_info->prev_cpu_wall = cur_ns;
+
     /* Get Idle Time */
     for_each_cpu(j, policy->cpus) {
         uint64_t idle_ns, total_idle_ns;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.21


From xen-changelog-bounces@lists.xenproject.org Wed Mar 04 16:01:04 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Mar 2026 16:01:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1245720.1545074 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxoem-00068a-2S; Wed, 04 Mar 2026 16:01:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1245720.1545074; Wed, 04 Mar 2026 16:01:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxoel-00068S-Vl; Wed, 04 Mar 2026 16:01:03 +0000
Received: by outflank-mailman (input) for mailman id 1245720;
 Wed, 04 Mar 2026 16:01:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vxoek-00068C-SF
 for xen-changelog@lists.xenproject.org; Wed, 04 Mar 2026 16:01:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxoek-004xji-2k
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 16:01:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxoek-00G8hQ-2Z
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 16:01:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=/Q9t5BAet3D43FYHBlFCAn3x5s++gFJlfxVsPJMkmYQ=; b=r6Aiof3Wv2j/bBT3MeoBKJkDcE
	KKDKif1noDHDNSiJxXDkhxL0IdLioWFy9FJJnauOhutUjnL/iSy3tM8I4jgzn9f3283eEe0j6K5bX
	dxjRHh42iy4d9UMTMjUuN/i6dS4R7rzO1Z93/MdUbNTWWYz+l6D/Mr5COjlvs4hLJJNc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.21] xen/cpufreq: fix usages of align_timer() in the on-demand governor
Message-Id: <E1vxoek-00G8hQ-2Z@xenbits.xenproject.org>
Date: Wed, 04 Mar 2026 16:01:02 +0000

commit 55bb6db0811d590c4d4a16f5be40180e81d3d172
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Mar 4 14:50:21 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 4 14:50:21 2026 +0100

    xen/cpufreq: fix usages of align_timer() in the on-demand governor
    
    The first parameter passed to align_timer() is the timer expiration, not
    the current time.  Adjust the calls to align_timer() in the on-demand
    governor to pass the expected timer expiration as the first parameter.
    
    Fixes: af74e3a15a83 ("cpufreq: align dbs timer for better package C state residency")
    Fixes: 382b95f627a9 ("Fix cpufreq HW-ALL coordination handle")
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: a0ed5bcfbeee81c91c574ad484faa057054eaf09
    master date: 2026-03-02 17:16:26 +0100
---
 xen/drivers/cpufreq/cpufreq_ondemand.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/xen/drivers/cpufreq/cpufreq_ondemand.c b/xen/drivers/cpufreq/cpufreq_ondemand.c
index 537695eaab..0d94c0e464 100644
--- a/xen/drivers/cpufreq/cpufreq_ondemand.c
+++ b/xen/drivers/cpufreq/cpufreq_ondemand.c
@@ -185,7 +185,8 @@ static void cf_check do_dbs_timer(void *dbs)
     dbs_check_cpu(dbs_info);
 
     set_timer(&per_cpu(dbs_timer, dbs_info->cpu),
-            align_timer(NOW() , dbs_tuners_ins.sampling_rate));
+              align_timer(NOW() + dbs_tuners_ins.sampling_rate,
+                          dbs_tuners_ins.sampling_rate));
 }
 
 static void dbs_timer_init(struct cpu_dbs_info_s *dbs_info)
@@ -400,6 +401,6 @@ void cpufreq_dbs_timer_resume(void)
             (void)cmpxchg(stoppable, -1, 1);
         }
         else
-            set_timer(t, align_timer(now, dbs_tuners_ins.sampling_rate));
+            set_timer(t, align_timer(t->expires, dbs_tuners_ins.sampling_rate));
     }
 }
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.21


From xen-changelog-bounces@lists.xenproject.org Wed Mar 04 16:11:07 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Mar 2026 16:11:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1245742.1545097 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxooS-00005m-Bt; Wed, 04 Mar 2026 16:11:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1245742.1545097; Wed, 04 Mar 2026 16:11:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxooS-00005d-93; Wed, 04 Mar 2026 16:11:04 +0000
Received: by outflank-mailman (input) for mailman id 1245742;
 Wed, 04 Mar 2026 16:11:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vxooQ-00005X-Fc
 for xen-changelog@lists.xenproject.org; Wed, 04 Mar 2026 16:11:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxooQ-004xxu-1K
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 16:11:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxooQ-00G9kX-1C
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 16:11:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=qPkLXMbcLkJI/9nuJ8GCtLMJpHqMunQ8X73FIidXTGk=; b=5MssWxiUbXGhCycu6XiktDBgYC
	bTiMyraPX/N0oSbzQP/2gFEJewMwQCg9lJ8MEHf9fM3puVMWVSOUEw9kY/NbRkdX7Hl66nUfHL29r
	RFC81RSPf2Q9QmUmhkQhX/aJ/SZ0pfSLURjfzTFMKLXTrAnP1+FN6CLZZaPCAl8BB1pE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.20] EFI: Fix relocating ESRT for dom0
Message-Id: <E1vxooQ-00G9kX-1C@xenbits.xenproject.org>
Date: Wed, 04 Mar 2026 16:11:02 +0000

commit f8944780320d5528af66fb3a6b14b0e8e687c642
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Wed Mar 4 14:51:26 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 4 14:51:26 2026 +0100

    EFI: Fix relocating ESRT for dom0
    
    Fix calculating the table size - it consists of a header + entries, not
    just entries.
    This bug caused the last entry to have garbage in its final fields,
    including LowestSupportedFwVersion and CapsuleFlags, which (usually)
    made fwupd able to detect firmware update availability, but refuse
    actually installing it.
    
    Fixes: dc7da0874ba4 ("EFI: preserve the System Resource Table for dom0")
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Acked-by: Daniel P. Smith <dpsmith@apertussolutions.com>
    master commit: 3ea44aa78c8170ca8010a89d24717d6f6ccfe564
    master date: 2026-02-12 11:35:05 +0100
---
 xen/common/efi/boot.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c
index 04d4bbd801..b09890cb8f 100644
--- a/xen/common/efi/boot.c
+++ b/xen/common/efi/boot.c
@@ -624,7 +624,8 @@ static size_t __init get_esrt_size(const EFI_MEMORY_DESCRIPTOR *desc)
     if ( esrt_ptr->FwResourceCount > available_len / sizeof(esrt_ptr->Entries[0]) )
         return 0;
 
-    return esrt_ptr->FwResourceCount * sizeof(esrt_ptr->Entries[0]);
+    return offsetof(EFI_SYSTEM_RESOURCE_TABLE,
+                    Entries[esrt_ptr->FwResourceCount]);
 }
 
 static EFI_GUID __initdata esrt_guid = EFI_SYSTEM_RESOURCE_TABLE_GUID;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.20


From xen-changelog-bounces@lists.xenproject.org Wed Mar 04 16:11:14 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Mar 2026 16:11:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1245743.1545101 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxooc-00007r-D5; Wed, 04 Mar 2026 16:11:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1245743.1545101; Wed, 04 Mar 2026 16:11:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxooc-00007h-AM; Wed, 04 Mar 2026 16:11:14 +0000
Received: by outflank-mailman (input) for mailman id 1245743;
 Wed, 04 Mar 2026 16:11:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vxooa-00007R-H2
 for xen-changelog@lists.xenproject.org; Wed, 04 Mar 2026 16:11:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxooa-004xyJ-1b
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 16:11:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxooa-00G9lO-1U
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 16:11:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=K8mkBIQU3RW/lprghcquX1Alv2azhU//7Xkkz7sztRA=; b=k0rqA73xzkolac2jzQUmKV2u7H
	0Q56ASQkGmXpQeHZe7OVp5VyBZPOuxVXYoPu2g97tFSUKhZ9KAYUFRWzTEiu4m4PiBUqDl2CUygst
	i0ilmrbMpFCKBKRk7dpIaZvp2pmeCAZkKz10XDsph7+NRYCbMGiZHAPo881mD3MAESz0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.20] xen/x86: fix usage of [[:blank:]] with BSD grep
Message-Id: <E1vxooa-00G9lO-1U@xenbits.xenproject.org>
Date: Wed, 04 Mar 2026 16:11:12 +0000

commit f98cee7981dd10b8a9a3e1bb0091e0394148c304
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Mar 4 14:52:08 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 4 14:52:08 2026 +0100

    xen/x86: fix usage of [[:blank:]] with BSD grep
    
    BSD grep only recognizes [[:blank:]] as a valid expression when using
    extended (modern) regular expressions.  Pass -E to the grep call used in
    efi-nr-fixups.
    
    Additionally, the return from `wc -l` is space padded on BSD, and hence
    the content of efi-nr-fixups is "       2", not plain "2".  Strip the
    spaces in the Makefile using $(strip ...).
    
    Fixes: 1be65ec4c8bc ('x86/EFI: avoid use of GNU ld's --disable-reloc-section when possible')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    master commit: c13335b5c1292e90436746ec04ed0553b688160b
    master date: 2026-02-13 16:42:34 +0100
---
 xen/arch/x86/arch.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/arch.mk b/xen/arch/x86/arch.mk
index efdbdb6045..b7cb03a9c1 100644
--- a/xen/arch/x86/arch.mk
+++ b/xen/arch/x86/arch.mk
@@ -112,7 +112,7 @@ endif
 ifeq ($(XEN_BUILD_PE),y)
 
 # Check if the linker produces fixups in PE by default
-efi-nr-fixups := $(shell LC_ALL=C $(OBJDUMP) -p $(efi-check).efi | grep '^[[:blank:]]*reloc[[:blank:]]*[0-9][[:blank:]].*DIR64$$' | wc -l)
+efi-nr-fixups := $(strip $(shell LC_ALL=C $(OBJDUMP) -p $(efi-check).efi | grep -E '^[[:blank:]]*reloc[[:blank:]]*[0-9][[:blank:]].*DIR64$$' | wc -l))
 
 ifeq ($(efi-nr-fixups),2)
 MKRELOC := :
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.20


From xen-changelog-bounces@lists.xenproject.org Wed Mar 04 16:11:23 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Mar 2026 16:11:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1245744.1545105 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxool-0000AD-EN; Wed, 04 Mar 2026 16:11:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1245744.1545105; Wed, 04 Mar 2026 16:11:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxool-0000A2-Bi; Wed, 04 Mar 2026 16:11:23 +0000
Received: by outflank-mailman (input) for mailman id 1245744;
 Wed, 04 Mar 2026 16:11:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vxook-00009k-LY
 for xen-changelog@lists.xenproject.org; Wed, 04 Mar 2026 16:11:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxook-004xyS-23
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 16:11:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxook-00G9mc-1l
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 16:11:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=GHTSzE95Ols6mmrXfwDhJHR8BcASjQM9paLMl7cPJ1s=; b=IqfTKgc3yY+hBFEuwhyD9Sx5CW
	Q+oYzVxVtmApHS6iYUFWzarBklQeMdceopa8SXI0RA6lNNUQm6oLXX7+hb4fy8aT5ANwdfqPxqYXg
	nco1opW9EX09OcETNwPhlotr9kZoYMcHLt9ZQE0jtJq8JrtEeUBHCIG1CNc4HWDgEVeo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.20] xen: add non-executable stack note uniformly
Message-Id: <E1vxook-00G9mc-1l@xenbits.xenproject.org>
Date: Wed, 04 Mar 2026 16:11:22 +0000

commit 6a0a1202c69383c0d0ac62019ac41a3a56fd4cea
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Mar 4 14:52:21 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 4 14:52:21 2026 +0100

    xen: add non-executable stack note uniformly
    
    Currently the -Wa,--noexecstack parameter is only passed to the compiler
    when building assembly files, as the assembler doesn't add such note for
    stack attributes.
    
    However, the default addition of the .note.GNU-stack section is dependent
    on the ELF target used.  Adjust the passing of -Wa,--noexecstack so it's
    added to CFLAGS instead of AFLAGS, and hence such section is also added to
    object files generated from .c sources.  This fixes the complains from the
    linker about missing .note.GNU-stack section when building x86-64 Xen on
    Darwin platforms.
    
    Note we could instead pass `-z noexecstack` to the linker, but that however
    would mask any possible errors or unintended mismatches from previous
    steps.
    
    Suggested-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    master commit: 3dfd77003c28ff3f6bfbf76a75d40a41ccecb33f
    master date: 2026-02-13 16:42:42 +0100
---
 xen/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/Makefile b/xen/Makefile
index b7b5941159..19d4e56bd2 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -415,7 +415,7 @@ endif
 
 AFLAGS += -D__ASSEMBLY__
 
-$(call cc-option-add,AFLAGS,CC,-Wa$$(comma)--noexecstack)
+$(call cc-option-add,CFLAGS,CC,-Wa$$(comma)--noexecstack)
 
 LDFLAGS-$(call ld-option,--warn-rwx-segments) += --no-warn-rwx-segments
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.20


From xen-changelog-bounces@lists.xenproject.org Wed Mar 04 16:11:33 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Mar 2026 16:11:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1245745.1545110 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxoov-0000CT-GG; Wed, 04 Mar 2026 16:11:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1245745.1545110; Wed, 04 Mar 2026 16:11:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxoov-0000CK-DL; Wed, 04 Mar 2026 16:11:33 +0000
Received: by outflank-mailman (input) for mailman id 1245745;
 Wed, 04 Mar 2026 16:11:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vxoou-0000CA-QI
 for xen-changelog@lists.xenproject.org; Wed, 04 Mar 2026 16:11:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxoou-004xya-2W
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 16:11:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxoou-00G9nK-2E
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 16:11:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=7BflSYO7Fnl3IsxjbiumiQE5gOvEDKmsCPp6BZAqv/s=; b=kmJHUUbh+23OAm+TFAZXhutGWp
	iY1pWG3rJHrxWTW59u6wouOJ7uFUkc6c4TWw2bJbmFximVN3x6wz9vsHtKLGV2WMyY5ehosqZ7DCF
	XdYACMbPAkYnVjQLyeNf3TqZtL0krKUc+bFVtPkZL3cv6BYKjH4zSBQeyrE4gkUQiKDI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.20] VT-d: fix off-by-one when handling extra RMRR ranges
Message-Id: <E1vxoou-00G9nK-2E@xenbits.xenproject.org>
Date: Wed, 04 Mar 2026 16:11:32 +0000

commit 1aaa2a0097dc8dd7f6ff49c0d0f5965bccf4b492
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Wed Mar 4 14:52:30 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 4 14:52:30 2026 +0100

    VT-d: fix off-by-one when handling extra RMRR ranges
    
    add_one_user_rmrr() operates on inclusive [start,end] range, which means
    the end page needs to be calculated as (start + page_count - 1).
    This off-by-one error resulted in one extra pages being mapped in IOMMU
    context, but not marked as reserved in the memory map. This in turns
    confused PVH dom0 code, resulting in the following crash:
    
        (XEN) [    3.934848] d0: GFN 0x5475c (0x5475c,5,3) -> (0x46a0f4,0,7) not permitted (0x20)
        (XEN) [    3.969657] domain_crash called from arch/x86/mm/p2m.c:695
        (XEN) [    3.972568] Domain 0 reported crashed by domain 32767 on cpu#0:
        (XEN) [    3.975527] Hardware Dom0 crashed: rebooting machine in 5 seconds.
        (XEN) [    8.986353] Resetting with ACPI MEMORY or I/O RESET_REG.
    
    I checked other parts of this API and it was the only error like this.
    Other places:
     - iommu_get_extra_reserved_device_memory() -> reserve_e820_ram() - this
       function expects exclusive range, so the code is correct
     - add_one_extra_ivmd() - this operates on start address and memory
       length
    
    Fixes: 2d9b3699136d ("IOMMU/VT-d: wire common device reserved memory API")
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: d41501fcf62457c3df779abda6718c64da8635ae
    master date: 2026-02-17 08:59:34 +0100
---
 xen/drivers/passthrough/vtd/dmar.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/drivers/passthrough/vtd/dmar.c b/xen/drivers/passthrough/vtd/dmar.c
index 91c22b8330..2a756831a6 100644
--- a/xen/drivers/passthrough/vtd/dmar.c
+++ b/xen/drivers/passthrough/vtd/dmar.c
@@ -1065,7 +1065,8 @@ static int __init add_user_rmrr(void)
 static int __init cf_check add_one_extra_rmrr(xen_pfn_t start, xen_ulong_t nr, u32 id, void *ctxt)
 {
     u32 sbdf_array[] = { id };
-    return add_one_user_rmrr(start, start+nr, 1, sbdf_array);
+
+    return add_one_user_rmrr(start, start + nr - 1, 1, sbdf_array);
 }
 
 static int __init add_extra_rmrr(void)
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.20


From xen-changelog-bounces@lists.xenproject.org Wed Mar 04 16:11:43 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Mar 2026 16:11:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1245746.1545113 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxop5-0000FG-Im; Wed, 04 Mar 2026 16:11:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1245746.1545113; Wed, 04 Mar 2026 16:11:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxop5-0000F7-Fy; Wed, 04 Mar 2026 16:11:43 +0000
Received: by outflank-mailman (input) for mailman id 1245746;
 Wed, 04 Mar 2026 16:11:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vxop4-0000F1-Sl
 for xen-changelog@lists.xenproject.org; Wed, 04 Mar 2026 16:11:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxop4-004xyg-2n
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 16:11:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxop4-00G9of-2h
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 16:11:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=co8oRsQjvAuwAWhegaqu3wOetqDRZCH49DdC2ZEKdQo=; b=D+Y1vRvqgxIXPJs4UrD0HmTWmZ
	EwD5WAVeQdM+UJ8v7xxcPB0SaUoi4o/kmTZnPkp7rK7dBs9gqf2hv5zpBg8sW5l/O1CVu9ODBSAwP
	k+rvzIXok+2JpPTgDRrousMT4f3074RqSd/UwIE6rjlMm1toLUB25wfDqBeNkJ64TsRg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.20] xen/cpufreq: fix adjusting of sampling window on early exit
Message-Id: <E1vxop4-00G9of-2h@xenbits.xenproject.org>
Date: Wed, 04 Mar 2026 16:11:42 +0000

commit be58d3002fdc3fb5b24c0bcd2453232d1d911005
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Mar 4 14:52:54 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 4 14:52:54 2026 +0100

    xen/cpufreq: fix adjusting of sampling window on early exit
    
    The logic in dbs_check_cpu() resets the sampling window even when the
    sampling period is considered too small.  This leads to further calls
    finding an imbalance between the total window time and the idle time, as
    the total window time is possibly shorter than the idle time.
    
    Fix by resetting the sampling window start time in the same block where the
    current idle time is stored.  While there also prevent a duplicated call to
    NOW() and instead re-use the previously fetched value.
    
    Fixes: d6f001cb91ac ("x86: Implement cpufreq ondemand policy")
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 74867aae25cb6356b8a7d1140c81666e2a23b818
    master date: 2026-03-02 17:16:26 +0100
---
 xen/drivers/cpufreq/cpufreq_ondemand.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/drivers/cpufreq/cpufreq_ondemand.c b/xen/drivers/cpufreq/cpufreq_ondemand.c
index 06cfc88d30..f62678fa61 100644
--- a/xen/drivers/cpufreq/cpufreq_ondemand.c
+++ b/xen/drivers/cpufreq/cpufreq_ondemand.c
@@ -115,11 +115,12 @@ static void dbs_check_cpu(struct cpu_dbs_info_s *this_dbs_info)
 
     cur_ns = NOW();
     total_ns = cur_ns - this_dbs_info->prev_cpu_wall;
-    this_dbs_info->prev_cpu_wall = NOW();
 
     if (total_ns < MIN_DBS_INTERVAL)
         return;
 
+    this_dbs_info->prev_cpu_wall = cur_ns;
+
     /* Get Idle Time */
     for_each_cpu(j, policy->cpus) {
         uint64_t idle_ns, total_idle_ns;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.20


From xen-changelog-bounces@lists.xenproject.org Wed Mar 04 16:11:53 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Mar 2026 16:11:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1245747.1545117 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxopF-0000Hi-KB; Wed, 04 Mar 2026 16:11:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1245747.1545117; Wed, 04 Mar 2026 16:11:53 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxopF-0000Ha-HT; Wed, 04 Mar 2026 16:11:53 +0000
Received: by outflank-mailman (input) for mailman id 1245747;
 Wed, 04 Mar 2026 16:11:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vxopE-0000HU-VK
 for xen-changelog@lists.xenproject.org; Wed, 04 Mar 2026 16:11:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxopE-004xym-33
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 16:11:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxopE-00G9pg-2x
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 16:11:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=PRh95LH7e7k+Ipa6/69BWDUCzvFjJ0t6qm+mgNm8pWg=; b=eKVL+FzWrEFUIoG6HJrOkGec6G
	834SW1sWu9SaJvrpwsNCUnC7f+lkvgg3gElK9KSWr3zv1GeAgpdb2W8tzu0z2KZalZMYx8gq3l0/E
	WiyFdOoi66K3j3jrX3BmN4cSiEvUTaDxc22wnLGUQxhf35yIt5fOxySLElAB8KC1I28Y=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.20] xen/cpufreq: fix usages of align_timer() in the on-demand governor
Message-Id: <E1vxopE-00G9pg-2x@xenbits.xenproject.org>
Date: Wed, 04 Mar 2026 16:11:52 +0000

commit 057f0dd56eea1bde442ca0ebd2d6c3b0c1ad0d05
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Mar 4 14:53:05 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 4 14:53:05 2026 +0100

    xen/cpufreq: fix usages of align_timer() in the on-demand governor
    
    The first parameter passed to align_timer() is the timer expiration, not
    the current time.  Adjust the calls to align_timer() in the on-demand
    governor to pass the expected timer expiration as the first parameter.
    
    Fixes: af74e3a15a83 ("cpufreq: align dbs timer for better package C state residency")
    Fixes: 382b95f627a9 ("Fix cpufreq HW-ALL coordination handle")
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: a0ed5bcfbeee81c91c574ad484faa057054eaf09
    master date: 2026-03-02 17:16:26 +0100
---
 xen/drivers/cpufreq/cpufreq_ondemand.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/xen/drivers/cpufreq/cpufreq_ondemand.c b/xen/drivers/cpufreq/cpufreq_ondemand.c
index f62678fa61..9828a40c4b 100644
--- a/xen/drivers/cpufreq/cpufreq_ondemand.c
+++ b/xen/drivers/cpufreq/cpufreq_ondemand.c
@@ -183,7 +183,8 @@ static void cf_check do_dbs_timer(void *dbs)
     dbs_check_cpu(dbs_info);
 
     set_timer(&per_cpu(dbs_timer, dbs_info->cpu),
-            align_timer(NOW() , dbs_tuners_ins.sampling_rate));
+              align_timer(NOW() + dbs_tuners_ins.sampling_rate,
+                          dbs_tuners_ins.sampling_rate));
 }
 
 static void dbs_timer_init(struct cpu_dbs_info_s *dbs_info)
@@ -398,6 +399,6 @@ void cpufreq_dbs_timer_resume(void)
             (void)cmpxchg(stoppable, -1, 1);
         }
         else
-            set_timer(t, align_timer(now, dbs_tuners_ins.sampling_rate));
+            set_timer(t, align_timer(t->expires, dbs_tuners_ins.sampling_rate));
     }
 }
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.20


From xen-changelog-bounces@lists.xenproject.org Wed Mar 04 16:12:04 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Mar 2026 16:12:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1245748.1545121 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxopQ-0000Jo-LZ; Wed, 04 Mar 2026 16:12:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1245748.1545121; Wed, 04 Mar 2026 16:12:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxopQ-0000Jg-Iu; Wed, 04 Mar 2026 16:12:04 +0000
Received: by outflank-mailman (input) for mailman id 1245748;
 Wed, 04 Mar 2026 16:12:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vxopP-0000Ja-DY
 for xen-changelog@lists.xenproject.org; Wed, 04 Mar 2026 16:12:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxopP-004xz7-1G
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 16:12:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxopP-00G9ta-19
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 16:12:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=uGVQrLo6q6RDBqYoLDMI5k8DtUGFuk2GukmZ1cVjJj4=; b=HcTMrQLWgApIjZR9YJnRfc9ONC
	bKw53AU1BPIXp9y7UuF2u4m/0hdMHIo8DuNb4UIqulf/qmvF7C35Orh8HaDNtHU0QNpY0fSBpKh+T
	d1Yn9e9FzwkX7wHw9XlOexF+Dx7zXhREQnqfF/A7z/qWxE6nKcitk1mZLPQupUC3rcns=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] EFI: Fix relocating ESRT for dom0
Message-Id: <E1vxopP-00G9ta-19@xenbits.xenproject.org>
Date: Wed, 04 Mar 2026 16:12:03 +0000

commit 68044518e078e8475e59b8be10197e3d38a04685
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Wed Mar 4 14:53:37 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 4 14:53:37 2026 +0100

    EFI: Fix relocating ESRT for dom0
    
    Fix calculating the table size - it consists of a header + entries, not
    just entries.
    This bug caused the last entry to have garbage in its final fields,
    including LowestSupportedFwVersion and CapsuleFlags, which (usually)
    made fwupd able to detect firmware update availability, but refuse
    actually installing it.
    
    Fixes: dc7da0874ba4 ("EFI: preserve the System Resource Table for dom0")
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Acked-by: Daniel P. Smith <dpsmith@apertussolutions.com>
    master commit: 3ea44aa78c8170ca8010a89d24717d6f6ccfe564
    master date: 2026-02-12 11:35:05 +0100
---
 xen/common/efi/boot.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c
index 04d4bbd801..b09890cb8f 100644
--- a/xen/common/efi/boot.c
+++ b/xen/common/efi/boot.c
@@ -624,7 +624,8 @@ static size_t __init get_esrt_size(const EFI_MEMORY_DESCRIPTOR *desc)
     if ( esrt_ptr->FwResourceCount > available_len / sizeof(esrt_ptr->Entries[0]) )
         return 0;
 
-    return esrt_ptr->FwResourceCount * sizeof(esrt_ptr->Entries[0]);
+    return offsetof(EFI_SYSTEM_RESOURCE_TABLE,
+                    Entries[esrt_ptr->FwResourceCount]);
 }
 
 static EFI_GUID __initdata esrt_guid = EFI_SYSTEM_RESOURCE_TABLE_GUID;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Mar 04 16:12:14 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Mar 2026 16:12:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1245749.1545125 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxopa-0000Lq-N1; Wed, 04 Mar 2026 16:12:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1245749.1545125; Wed, 04 Mar 2026 16:12:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxopa-0000Li-KJ; Wed, 04 Mar 2026 16:12:14 +0000
Received: by outflank-mailman (input) for mailman id 1245749;
 Wed, 04 Mar 2026 16:12:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vxopZ-0000LY-GJ
 for xen-changelog@lists.xenproject.org; Wed, 04 Mar 2026 16:12:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxopZ-004xzX-1X
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 16:12:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxopZ-00G9uo-1Q
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 16:12:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=tM7VCYzVxTpC5a0cBPzGOmN8JlYPpB/GFi24JA4F3G0=; b=Ip47rmq5+2CZit+i6G7OH1L11t
	rcRxdsKsn/4EdXpbeIVjb4bBN8kwUHVKWyFuXkXYTMr4w23r2YMue2Frk6/+IDOQw0LAwfXUiwOQL
	cW3Nvn6K/BY4dogzQVLWmo0Y3mojqCK2cSg/rIQQEvyaXxrE6MWRiakh5jfHl3pKuU0s=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] xen/x86: fix usage of [[:blank:]] with BSD grep
Message-Id: <E1vxopZ-00G9uo-1Q@xenbits.xenproject.org>
Date: Wed, 04 Mar 2026 16:12:13 +0000

commit 2d88bf5b69cbec182e6bc9a5fa4de44215dd620f
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Mar 4 14:54:02 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 4 14:54:02 2026 +0100

    xen/x86: fix usage of [[:blank:]] with BSD grep
    
    BSD grep only recognizes [[:blank:]] as a valid expression when using
    extended (modern) regular expressions.  Pass -E to the grep call used in
    efi-nr-fixups.
    
    Additionally, the return from `wc -l` is space padded on BSD, and hence
    the content of efi-nr-fixups is "       2", not plain "2".  Strip the
    spaces in the Makefile using $(strip ...).
    
    Fixes: 1be65ec4c8bc ('x86/EFI: avoid use of GNU ld's --disable-reloc-section when possible')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    master commit: c13335b5c1292e90436746ec04ed0553b688160b
    master date: 2026-02-13 16:42:34 +0100
---
 xen/arch/x86/arch.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/arch.mk b/xen/arch/x86/arch.mk
index 85d3e7cbfe..4924d3c660 100644
--- a/xen/arch/x86/arch.mk
+++ b/xen/arch/x86/arch.mk
@@ -114,7 +114,7 @@ endif
 ifeq ($(XEN_BUILD_PE),y)
 
 # Check if the linker produces fixups in PE by default
-efi-nr-fixups := $(shell LC_ALL=C $(OBJDUMP) -p $(efi-check).efi | grep '^[[:blank:]]*reloc[[:blank:]]*[0-9][[:blank:]].*DIR64$$' | wc -l)
+efi-nr-fixups := $(strip $(shell LC_ALL=C $(OBJDUMP) -p $(efi-check).efi | grep -E '^[[:blank:]]*reloc[[:blank:]]*[0-9][[:blank:]].*DIR64$$' | wc -l))
 
 ifeq ($(efi-nr-fixups),2)
 MKRELOC := :
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Mar 04 16:12:24 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Mar 2026 16:12:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1245750.1545129 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxopk-0000O5-OZ; Wed, 04 Mar 2026 16:12:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1245750.1545129; Wed, 04 Mar 2026 16:12:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxopk-0000Nx-Ll; Wed, 04 Mar 2026 16:12:24 +0000
Received: by outflank-mailman (input) for mailman id 1245750;
 Wed, 04 Mar 2026 16:12:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vxopj-0000Nn-Ij
 for xen-changelog@lists.xenproject.org; Wed, 04 Mar 2026 16:12:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxopj-004xzi-1m
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 16:12:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxopj-00G9xZ-1h
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 16:12:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=CldqrnXuezV1za51CqhEpQPGqZiXTrNTWk+A2+DtC3Q=; b=SRKPRoEpVX6X5rafiXUbE4XOt+
	reZYhIPWzURsCKFMeXbtd63+inEw0UoXLjd34nu2yIc3jyPDwL8b49FbKxBjCqAi7yd2wWBgBC3y2
	IqFAyEq5GuLToAQEG+USQ35OT98DMLdCSCKsxROD3x59nlibpjbU6iut+OFRfFeLy70s=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] xen: add non-executable stack note uniformly
Message-Id: <E1vxopj-00G9xZ-1h@xenbits.xenproject.org>
Date: Wed, 04 Mar 2026 16:12:23 +0000

commit 744d8cf1991a9b43c5c64ec520121a799cb332b9
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Mar 4 14:54:10 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 4 14:54:10 2026 +0100

    xen: add non-executable stack note uniformly
    
    Currently the -Wa,--noexecstack parameter is only passed to the compiler
    when building assembly files, as the assembler doesn't add such note for
    stack attributes.
    
    However, the default addition of the .note.GNU-stack section is dependent
    on the ELF target used.  Adjust the passing of -Wa,--noexecstack so it's
    added to CFLAGS instead of AFLAGS, and hence such section is also added to
    object files generated from .c sources.  This fixes the complains from the
    linker about missing .note.GNU-stack section when building x86-64 Xen on
    Darwin platforms.
    
    Note we could instead pass `-z noexecstack` to the linker, but that however
    would mask any possible errors or unintended mismatches from previous
    steps.
    
    Suggested-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    master commit: 3dfd77003c28ff3f6bfbf76a75d40a41ccecb33f
    master date: 2026-02-13 16:42:42 +0100
---
 xen/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/Makefile b/xen/Makefile
index b83e8827a4..4d34597522 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -412,7 +412,7 @@ endif
 
 AFLAGS += -D__ASSEMBLY__
 
-$(call cc-option-add,AFLAGS,CC,-Wa$$(comma)--noexecstack)
+$(call cc-option-add,CFLAGS,CC,-Wa$$(comma)--noexecstack)
 
 LDFLAGS-$(call ld-option,--warn-rwx-segments) += --no-warn-rwx-segments
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Mar 04 16:12:34 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Mar 2026 16:12:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1245752.1545133 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxopu-0000QO-Pn; Wed, 04 Mar 2026 16:12:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1245752.1545133; Wed, 04 Mar 2026 16:12:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxopu-0000QE-NA; Wed, 04 Mar 2026 16:12:34 +0000
Received: by outflank-mailman (input) for mailman id 1245752;
 Wed, 04 Mar 2026 16:12:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vxopt-0000Q6-LJ
 for xen-changelog@lists.xenproject.org; Wed, 04 Mar 2026 16:12:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxopt-004xzm-21
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 16:12:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxopt-00G9yO-1w
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 16:12:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=UtMj38JDe5dlVBfAl/V1qKlvw0qXlsPokTPLVxaCiFM=; b=zhxSVjwMRhi2x8rMSystDdqAB2
	FsabPQWywcMAVzuIcQharNPhsDD8HLQCE2vSjeyyBWaARkN1nJ0P2J9oatQAGScIWQsaXoY3ts4ZD
	0jQMfk0ueJHX88xTiDSIERr8eDGRafRGpmsMNgfh/fYPUy7wl8ViZd8jULj4RIcZ8Ptw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] VT-d: fix off-by-one when handling extra RMRR ranges
Message-Id: <E1vxopt-00G9yO-1w@xenbits.xenproject.org>
Date: Wed, 04 Mar 2026 16:12:33 +0000

commit aa073513622ab7f4c9b3fda3bbc4d7e9ffa775fd
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Wed Mar 4 14:54:27 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 4 14:54:27 2026 +0100

    VT-d: fix off-by-one when handling extra RMRR ranges
    
    add_one_user_rmrr() operates on inclusive [start,end] range, which means
    the end page needs to be calculated as (start + page_count - 1).
    This off-by-one error resulted in one extra pages being mapped in IOMMU
    context, but not marked as reserved in the memory map. This in turns
    confused PVH dom0 code, resulting in the following crash:
    
        (XEN) [    3.934848] d0: GFN 0x5475c (0x5475c,5,3) -> (0x46a0f4,0,7) not permitted (0x20)
        (XEN) [    3.969657] domain_crash called from arch/x86/mm/p2m.c:695
        (XEN) [    3.972568] Domain 0 reported crashed by domain 32767 on cpu#0:
        (XEN) [    3.975527] Hardware Dom0 crashed: rebooting machine in 5 seconds.
        (XEN) [    8.986353] Resetting with ACPI MEMORY or I/O RESET_REG.
    
    I checked other parts of this API and it was the only error like this.
    Other places:
     - iommu_get_extra_reserved_device_memory() -> reserve_e820_ram() - this
       function expects exclusive range, so the code is correct
     - add_one_extra_ivmd() - this operates on start address and memory
       length
    
    Fixes: 2d9b3699136d ("IOMMU/VT-d: wire common device reserved memory API")
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: d41501fcf62457c3df779abda6718c64da8635ae
    master date: 2026-02-17 08:59:34 +0100
---
 xen/drivers/passthrough/vtd/dmar.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/drivers/passthrough/vtd/dmar.c b/xen/drivers/passthrough/vtd/dmar.c
index 91c22b8330..2a756831a6 100644
--- a/xen/drivers/passthrough/vtd/dmar.c
+++ b/xen/drivers/passthrough/vtd/dmar.c
@@ -1065,7 +1065,8 @@ static int __init add_user_rmrr(void)
 static int __init cf_check add_one_extra_rmrr(xen_pfn_t start, xen_ulong_t nr, u32 id, void *ctxt)
 {
     u32 sbdf_array[] = { id };
-    return add_one_user_rmrr(start, start+nr, 1, sbdf_array);
+
+    return add_one_user_rmrr(start, start + nr - 1, 1, sbdf_array);
 }
 
 static int __init add_extra_rmrr(void)
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Mar 04 16:12:44 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Mar 2026 16:12:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1245753.1545137 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxoq4-0000SU-RI; Wed, 04 Mar 2026 16:12:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1245753.1545137; Wed, 04 Mar 2026 16:12:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxoq4-0000SM-OU; Wed, 04 Mar 2026 16:12:44 +0000
Received: by outflank-mailman (input) for mailman id 1245753;
 Wed, 04 Mar 2026 16:12:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vxoq3-0000SF-Nl
 for xen-changelog@lists.xenproject.org; Wed, 04 Mar 2026 16:12:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxoq3-004xzy-2I
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 16:12:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxoq3-00G9z2-2C
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 16:12:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=8WNZKB06WPhGXQ9H6fCXSNCtzAaME7SgT0Yy/H4Maa8=; b=u+5jCFhRCTZp3u+CrzSJQ2HtIQ
	vBggJxvY6pXbef6ZEt//V5s3itE7VeDZ52wOfjHVJk448SdLbFuCWeVqYaS448xbCx1hfGhIkx3WI
	BjWllprwA0FSYEIwl+Hrbn2j5hXRYCSUh+YiLjR7BUDG5BlahbXoVbmr5T7ZwCGIb0xU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] xen/cpufreq: fix adjusting of sampling window on early exit
Message-Id: <E1vxoq3-00G9z2-2C@xenbits.xenproject.org>
Date: Wed, 04 Mar 2026 16:12:43 +0000

commit 24c83081d542a46dcfb9befc0977a8ed4ecd8d14
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Mar 4 14:54:46 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 4 14:54:46 2026 +0100

    xen/cpufreq: fix adjusting of sampling window on early exit
    
    The logic in dbs_check_cpu() resets the sampling window even when the
    sampling period is considered too small.  This leads to further calls
    finding an imbalance between the total window time and the idle time, as
    the total window time is possibly shorter than the idle time.
    
    Fix by resetting the sampling window start time in the same block where the
    current idle time is stored.  While there also prevent a duplicated call to
    NOW() and instead re-use the previously fetched value.
    
    Fixes: d6f001cb91ac ("x86: Implement cpufreq ondemand policy")
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 74867aae25cb6356b8a7d1140c81666e2a23b818
    master date: 2026-03-02 17:16:26 +0100
---
 xen/drivers/cpufreq/cpufreq_ondemand.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/drivers/cpufreq/cpufreq_ondemand.c b/xen/drivers/cpufreq/cpufreq_ondemand.c
index 06cfc88d30..f62678fa61 100644
--- a/xen/drivers/cpufreq/cpufreq_ondemand.c
+++ b/xen/drivers/cpufreq/cpufreq_ondemand.c
@@ -115,11 +115,12 @@ static void dbs_check_cpu(struct cpu_dbs_info_s *this_dbs_info)
 
     cur_ns = NOW();
     total_ns = cur_ns - this_dbs_info->prev_cpu_wall;
-    this_dbs_info->prev_cpu_wall = NOW();
 
     if (total_ns < MIN_DBS_INTERVAL)
         return;
 
+    this_dbs_info->prev_cpu_wall = cur_ns;
+
     /* Get Idle Time */
     for_each_cpu(j, policy->cpus) {
         uint64_t idle_ns, total_idle_ns;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Mar 04 16:12:55 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Mar 2026 16:12:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1245754.1545141 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxoqE-0000Ur-SU; Wed, 04 Mar 2026 16:12:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1245754.1545141; Wed, 04 Mar 2026 16:12:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vxoqE-0000Uj-Pr; Wed, 04 Mar 2026 16:12:54 +0000
Received: by outflank-mailman (input) for mailman id 1245754;
 Wed, 04 Mar 2026 16:12:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vxoqD-0000Ub-QL
 for xen-changelog@lists.xenproject.org; Wed, 04 Mar 2026 16:12:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxoqD-004y09-2Y
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 16:12:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vxoqD-00GA07-2S
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Mar 2026 16:12:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=AfAxqmYv8qJQdyl2kqVBY13+MKwaBs0e1/QF9gKFNeg=; b=mD84MxNSXiG+WM/PcHoUrl3NQW
	7NCBjbb/lw0/jsWlmudsVqUocV2r11qteQilRmi8IqDZMYJOxL5iaiQqjhWXjw2jJ9uuUu81sZM2V
	IBdQ/1aB+BN7LGV86EtoN4hetmYkXqdMWBWyRYh4hScFCZrOlkFhNE+EJJcyshBzlBCU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] xen/cpufreq: fix usages of align_timer() in the on-demand governor
Message-Id: <E1vxoqD-00GA07-2S@xenbits.xenproject.org>
Date: Wed, 04 Mar 2026 16:12:53 +0000

commit 84b006870c41f94ee99af202d5f0a7b4dcd3cc94
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Mar 4 14:54:55 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 4 14:54:55 2026 +0100

    xen/cpufreq: fix usages of align_timer() in the on-demand governor
    
    The first parameter passed to align_timer() is the timer expiration, not
    the current time.  Adjust the calls to align_timer() in the on-demand
    governor to pass the expected timer expiration as the first parameter.
    
    Fixes: af74e3a15a83 ("cpufreq: align dbs timer for better package C state residency")
    Fixes: 382b95f627a9 ("Fix cpufreq HW-ALL coordination handle")
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: a0ed5bcfbeee81c91c574ad484faa057054eaf09
    master date: 2026-03-02 17:16:26 +0100
---
 xen/drivers/cpufreq/cpufreq_ondemand.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/xen/drivers/cpufreq/cpufreq_ondemand.c b/xen/drivers/cpufreq/cpufreq_ondemand.c
index f62678fa61..9828a40c4b 100644
--- a/xen/drivers/cpufreq/cpufreq_ondemand.c
+++ b/xen/drivers/cpufreq/cpufreq_ondemand.c
@@ -183,7 +183,8 @@ static void cf_check do_dbs_timer(void *dbs)
     dbs_check_cpu(dbs_info);
 
     set_timer(&per_cpu(dbs_timer, dbs_info->cpu),
-            align_timer(NOW() , dbs_tuners_ins.sampling_rate));
+              align_timer(NOW() + dbs_tuners_ins.sampling_rate,
+                          dbs_tuners_ins.sampling_rate));
 }
 
 static void dbs_timer_init(struct cpu_dbs_info_s *dbs_info)
@@ -398,6 +399,6 @@ void cpufreq_dbs_timer_resume(void)
             (void)cmpxchg(stoppable, -1, 1);
         }
         else
-            set_timer(t, align_timer(now, dbs_tuners_ins.sampling_rate));
+            set_timer(t, align_timer(t->expires, dbs_tuners_ins.sampling_rate));
     }
 }
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Mar 05 09:44:08 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 05 Mar 2026 09:44:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1246367.1545558 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vy5FU-0002pa-3V; Thu, 05 Mar 2026 09:44:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1246367.1545558; Thu, 05 Mar 2026 09:44:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vy5FU-0002pR-0p; Thu, 05 Mar 2026 09:44:04 +0000
Received: by outflank-mailman (input) for mailman id 1246367;
 Thu, 05 Mar 2026 09:44:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vy5FS-0002pL-8e
 for xen-changelog@lists.xenproject.org; Thu, 05 Mar 2026 09:44:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vy5FS-006V9E-0b
 for xen-changelog@lists.xenproject.org;
 Thu, 05 Mar 2026 09:44:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vy5FS-00Hang-0P
 for xen-changelog@lists.xenproject.org;
 Thu, 05 Mar 2026 09:44:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=FfMPECqs3S42iE1OC7B1IumSwEeITH99dwEYq/y6JB4=; b=X/q94cO8Ua2wJvSP7GAG97l9Pl
	KYG1Z7AlsY4dO8J+cHKWlYr7vaL0n5dGlEhVLhqiBxHcOZKIwYvJ1EjibSOka1kSYCPZIc4QT7J6H
	dfkfuw4Hu8Xf9g01s66rI348x5wKUOtRouI3kRLtGwkIweMaPx8YFAhGf1Lmf/6a8thQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] vPCI/ReBAR: improve cleanup
Message-Id: <E1vy5FS-00Hang-0P@xenbits.xenproject.org>
Date: Thu, 05 Mar 2026 09:44:02 +0000

commit 9ebba62ca8430604b0bf77f05925b40eee2504db
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 5 09:27:08 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 5 09:27:08 2026 +0100

    vPCI/ReBAR: improve cleanup
    
    We cannot assume extended config space to (still) be accessible when
    cleaning up. Necessary values need caching instead. In fact, as the caller
    also cannot look up extended capabilities, the cleanup function needs to
    cope with being called when there's no ReBAR capability at all.
    
    As kind of a side effect nbars being 0 (which init_rebar() doesn't
    explicitly reject) no longer results in a bogus call to
    vpci_remove_registers().
    
    Fixes: ee459aeac096 ("vpci/rebar: Implement cleanup function for Rebar")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/drivers/vpci/rebar.c | 15 +++++++--------
 xen/include/xen/vpci.h   |  7 +++++++
 2 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/xen/drivers/vpci/rebar.c b/xen/drivers/vpci/rebar.c
index ab5c5453a8..1bb3dd7045 100644
--- a/xen/drivers/vpci/rebar.c
+++ b/xen/drivers/vpci/rebar.c
@@ -53,17 +53,12 @@ static void cf_check rebar_ctrl_write(const struct pci_dev *pdev,
 static int cf_check cleanup_rebar(const struct pci_dev *pdev, bool hide)
 {
     int rc;
-    uint32_t ctrl;
-    unsigned int nbars;
-    unsigned int rebar_offset = pci_find_ext_capability(pdev,
-                                                        PCI_EXT_CAP_ID_REBAR);
+    unsigned int nbars = pdev->vpci->rebar.nbars;
+    unsigned int rebar_offset = pdev->vpci->rebar.offset;
 
-    if ( !hide )
+    if ( !rebar_offset || !nbars || !hide )
         return 0;
 
-    ctrl = pci_conf_read32(pdev->sbdf, rebar_offset + PCI_REBAR_CTRL(0));
-    nbars = MASK_EXTR(ctrl, PCI_REBAR_CTRL_NBAR_MASK);
-
     rc = vpci_remove_registers(pdev->vpci, rebar_offset + PCI_REBAR_CAP(0),
                                PCI_REBAR_CTRL(nbars - 1));
     if ( rc )
@@ -121,6 +116,10 @@ static int cf_check init_rebar(struct pci_dev *pdev)
 
     ctrl = pci_conf_read32(pdev->sbdf, rebar_offset + PCI_REBAR_CTRL(0));
     nbars = MASK_EXTR(ctrl, PCI_REBAR_CTRL_NBAR_MASK);
+
+    pdev->vpci->rebar.offset = rebar_offset;
+    pdev->vpci->rebar.nbars  = nbars;
+
     for ( unsigned int i = 0; i < nbars; i++ )
     {
         int rc;
diff --git a/xen/include/xen/vpci.h b/xen/include/xen/vpci.h
index d104efbce2..83ac41edf8 100644
--- a/xen/include/xen/vpci.h
+++ b/xen/include/xen/vpci.h
@@ -135,6 +135,13 @@ struct vpci {
             struct vpci_arch_msix_entry arch;
         } entries[];
     } *msix;
+
+    /* Resizable BARs data */
+    struct vpci_rebar {
+        unsigned int offset:12;
+        unsigned int nbars:3;
+    } rebar;
+
 #ifdef CONFIG_HAS_VPCI_GUEST_SUPPORT
     /* Guest SBDF of the device. */
 #define INVALID_GUEST_SBDF ((pci_sbdf_t){ .sbdf = ~0U })
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Mar 05 09:44:14 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 05 Mar 2026 09:44:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1246368.1545562 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vy5Fe-0002rM-4n; Thu, 05 Mar 2026 09:44:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1246368.1545562; Thu, 05 Mar 2026 09:44:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vy5Fe-0002rE-28; Thu, 05 Mar 2026 09:44:14 +0000
Received: by outflank-mailman (input) for mailman id 1246368;
 Thu, 05 Mar 2026 09:44:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vy5Fc-0002qy-BT
 for xen-changelog@lists.xenproject.org; Thu, 05 Mar 2026 09:44:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vy5Fc-006V9J-0z
 for xen-changelog@lists.xenproject.org;
 Thu, 05 Mar 2026 09:44:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vy5Fc-00Hapj-0m
 for xen-changelog@lists.xenproject.org;
 Thu, 05 Mar 2026 09:44:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=TKRWWplf+gZhF2qJHMk71AB808K3HOhYvu4ATtx/c/U=; b=yKz5HGF+EMxNGs7lk4TpiV1DjZ
	eYaLKec/1WHlHtrEkHuyzif+PBojMoAQcsAtrnxOe6HZmxzuWfVYX0nhknsxhmfGT57xDsz+ypjIa
	DpKZXeVsCgcHlG5Ba6GXOH22Nh8DSJ4IZvQkWEtgKYYKb5MaTCRODftI7TgnWHJttZKo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] vpci/msix: check for BARs enabled in vpci_make_msix_hole
Message-Id: <E1vy5Fc-00Hapj-0m@xenbits.xenproject.org>
Date: Thu, 05 Mar 2026 09:44:12 +0000

commit 7c24d58a6e641e2979978c5abb312bff877dede3
Author:     Stewart Hildebrand <stewart.hildebrand@amd.com>
AuthorDate: Thu Mar 5 09:27:50 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 5 09:27:50 2026 +0100

    vpci/msix: check for BARs enabled in vpci_make_msix_hole
    
    A hotplugged PCI device may be added uninitialized. In particular,
    memory decoding might be disabled and the BARs might be zeroed. In this
    case, the BARs will not be mapped in p2m. However, vpci_make_msix_hole()
    unconditionally attempts to punch holes in p2m, leading to init_msix()
    failing:
    
    (XEN) d0v0 0000:01:00.0: existing mapping (mfn: 1c1880 type: 0) at 0 clobbers MSIX MMIO area
    (XEN) d0 0000:01:00.0: init legacy cap 17 fail rc=-17, mask it
    
    vpci_make_msix_hole() should only attempt to punch holes if the BARs
    containing the MSI-X/PBA tables are mapped in p2m. Introduce a helper
    for checking if a BAR is enabled, and add a check for the situation
    inside vpci_make_msix_hole().
    
    As a result of the newly introduced checks in vpci_make_msix_hole(),
    move the call to vpci_make_msix_hole() within modify_decoding() to after
    setting ->enabled.
    
    Fixes: ee2eb6849d50 ("vpci: Refactor REGISTER_VPCI_INIT")
    Signed-off-by: Stewart Hildebrand <stewart.hildebrand@amd.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/drivers/vpci/header.c  | 26 +++++++++++++-------------
 xen/drivers/vpci/msix.c    |  3 +++
 xen/drivers/vpci/private.h |  6 ++++++
 3 files changed, 22 insertions(+), 13 deletions(-)

diff --git a/xen/drivers/vpci/header.c b/xen/drivers/vpci/header.c
index 1c0818c2e7..a760d8c32f 100644
--- a/xen/drivers/vpci/header.c
+++ b/xen/drivers/vpci/header.c
@@ -123,19 +123,6 @@ static void modify_decoding(const struct pci_dev *pdev, uint16_t cmd,
     bool map = cmd & PCI_COMMAND_MEMORY;
     unsigned int i;
 
-    /*
-     * Make sure there are no mappings in the MSIX MMIO areas, so that accesses
-     * can be trapped (and emulated) by Xen when the memory decoding bit is
-     * enabled.
-     *
-     * FIXME: punching holes after the p2m has been set up might be racy for
-     * DomU usage, needs to be revisited.
-     */
-#ifdef CONFIG_HAS_PCI_MSI
-    if ( map && !rom_only && vpci_make_msix_hole(pdev) )
-        return;
-#endif
-
     for ( i = 0; i < ARRAY_SIZE(header->bars); i++ )
     {
         struct vpci_bar *bar = &header->bars[i];
@@ -165,6 +152,19 @@ static void modify_decoding(const struct pci_dev *pdev, uint16_t cmd,
             bar->enabled = map;
     }
 
+    /*
+     * Make sure there are no mappings in the MSIX MMIO areas, so that accesses
+     * can be trapped (and emulated) by Xen when the memory decoding bit is
+     * enabled.
+     *
+     * FIXME: punching holes after the p2m has been set up might be racy for
+     * DomU usage, needs to be revisited.
+     */
+#ifdef CONFIG_HAS_PCI_MSI
+    if ( map && !rom_only && vpci_make_msix_hole(pdev) )
+        return;
+#endif
+
     if ( !rom_only )
     {
         pci_conf_write16(pdev->sbdf, PCI_COMMAND, cmd);
diff --git a/xen/drivers/vpci/msix.c b/xen/drivers/vpci/msix.c
index f87212b46f..bbe4f213ac 100644
--- a/xen/drivers/vpci/msix.c
+++ b/xen/drivers/vpci/msix.c
@@ -606,6 +606,9 @@ int vpci_make_msix_hole(const struct pci_dev *pdev)
         unsigned long end = PFN_DOWN(vmsix_table_addr(pdev->vpci, i) +
                                      vmsix_table_size(pdev->vpci, i) - 1);
 
+        if ( !vmsix_table_bar_valid(pdev->vpci, i) )
+            continue;
+
         for ( ; start <= end; start++ )
         {
             p2m_type_t t;
diff --git a/xen/drivers/vpci/private.h b/xen/drivers/vpci/private.h
index 140092cc52..fdeeca7aa8 100644
--- a/xen/drivers/vpci/private.h
+++ b/xen/drivers/vpci/private.h
@@ -119,6 +119,12 @@ static inline paddr_t vmsix_table_addr(const struct vpci *vpci, unsigned int nr)
            (vpci->msix->tables[nr] & ~PCI_MSIX_BIRMASK);
 }
 
+static inline bool vmsix_table_bar_valid(const struct vpci *vpci,
+                                         unsigned int nr)
+{
+    return vpci->header.bars[vpci->msix->tables[nr] & PCI_MSIX_BIRMASK].enabled;
+}
+
 /*
  * Note regarding the size calculation of the PBA: the spec mentions "The last
  * QWORD will not necessarily be fully populated", so it implies that the PBA
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Mar 05 09:44:24 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 05 Mar 2026 09:44:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1246369.1545566 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vy5Fo-0002vD-67; Thu, 05 Mar 2026 09:44:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1246369.1545566; Thu, 05 Mar 2026 09:44:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vy5Fo-0002v5-3V; Thu, 05 Mar 2026 09:44:24 +0000
Received: by outflank-mailman (input) for mailman id 1246369;
 Thu, 05 Mar 2026 09:44:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vy5Fm-0002uw-Dw
 for xen-changelog@lists.xenproject.org; Thu, 05 Mar 2026 09:44:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vy5Fm-006V9g-1H
 for xen-changelog@lists.xenproject.org;
 Thu, 05 Mar 2026 09:44:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vy5Fm-00HasB-1A
 for xen-changelog@lists.xenproject.org;
 Thu, 05 Mar 2026 09:44:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=oerQQpBl3A5gD1YfQo2xqRTJuReAqG7vt2HP1zUHM7U=; b=Yrd+Zo6uAMdkYQNOxRZMCtekGU
	svF3wcbviGf+p5sRFPJQcjb6/wZONXqooQzwl1Ak1H/ts58qoAY6/Q25zoCr5BTu/35JyeGHI75M/
	ASSdNnvUDCQ+PdDYRsKECLxgYblzWCiCMT+3mpY/svQ4hE54Ir4DL3VWEXxpJxprVD7k=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] domain: use unsigned loop induction variable in complete_domain_destroy()
Message-Id: <E1vy5Fm-00HasB-1A@xenbits.xenproject.org>
Date: Thu, 05 Mar 2026 09:44:22 +0000

commit 505b2afae44caa9df189957c6e298017b2ef7988
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 5 09:28:27 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 5 09:28:27 2026 +0100

    domain: use unsigned loop induction variable in complete_domain_destroy()
    
    Using plain (signed) int variables as array indexes can be unhelpful on at
    least x86, where the compiler may see the need to insert sign-extension
    insns (strictly speaking it should be able to avoid that when the loop
    continuation condition says >= 0, but that's not generally the case even
    with gcc15).
    
    Observed effects with gcc15 (will of course vary with compiler version and
    level of optimization):
    - on x86, one less preserved register in use, yet due to sub-optimal
      choice of register variables still a small code size increase (%r12
      isn't a good choice when it's used for base-without-index addressing, as
      it requires a SIB byte which other registers wouldn't require),
    - on Arm64 code size decreases, albeit that's eaten up by padding which is
      being inserted ahead of a few labels,
    - on Arm32 code size increases for a reason I didn't fully understand (my
      ability to read Arm assembly is still somewhat limited).
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/common/domain.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/xen/common/domain.c b/xen/common/domain.c
index e06174fca7..d24be268ae 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -1475,7 +1475,7 @@ static void cf_check complete_domain_destroy(struct rcu_head *head)
 {
     struct domain *d = container_of(head, struct domain, rcu);
     struct vcpu *v;
-    int i;
+    unsigned int i;
 
     /*
      * Flush all state for the vCPU previously having run on the current CPU.
@@ -1485,7 +1485,11 @@ static void cf_check complete_domain_destroy(struct rcu_head *head)
      */
     sync_local_execstate();
 
-    for ( i = d->max_vcpus - 1; i >= 0; i-- )
+    /*
+     * Iterating downwards is a requirement here, as e.g. sched_destroy_vcpu()
+     * relies on this.
+     */
+    for ( i = d->max_vcpus; i-- > 0; )
     {
         if ( (v = d->vcpu[i]) == NULL )
             continue;
@@ -1511,7 +1515,7 @@ static void cf_check complete_domain_destroy(struct rcu_head *head)
     xfree(d->vm_event_share);
 #endif
 
-    for ( i = d->max_vcpus - 1; i >= 0; i-- )
+    for ( i = d->max_vcpus; i-- > 0; )
         if ( (v = d->vcpu[i]) != NULL )
             vcpu_destroy(v);
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Mar 05 11:22:09 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 05 Mar 2026 11:22:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1246462.1545623 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vy6mI-0000dA-V8; Thu, 05 Mar 2026 11:22:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1246462.1545623; Thu, 05 Mar 2026 11:22:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vy6mI-0000d3-SV; Thu, 05 Mar 2026 11:22:02 +0000
Received: by outflank-mailman (input) for mailman id 1246462;
 Thu, 05 Mar 2026 11:22:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vy6mH-0000cx-JV
 for xen-changelog@lists.xenproject.org; Thu, 05 Mar 2026 11:22:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vy6mH-006X6J-1V
 for xen-changelog@lists.xenproject.org;
 Thu, 05 Mar 2026 11:22:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vy6mH-0007ru-1O
 for xen-changelog@lists.xenproject.org;
 Thu, 05 Mar 2026 11:22:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=aqu6tY4tooHwjd5qO+fh/9TBp9UlDovuzWkedSCFLlM=; b=ISj/fM0ByDL2bywYYym1TLUAeN
	eWhK+o4Tv4bV/o8/BjgCSgHnkBxrjgXmXSzh0MSA1pjb5/UhTDgPIak7WrUkFMIa1ubkYKm+Rx5sK
	XptJ/jqd4pEQ9DqChQiuuLIgO1DW9o560tVe1emwrR6eLOF0rJ1xWPRkCgPN60VoXTw8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] vPCI/ReBAR: improve cleanup
Message-Id: <E1vy6mH-0007ru-1O@xenbits.xenproject.org>
Date: Thu, 05 Mar 2026 11:22:01 +0000

commit 9ebba62ca8430604b0bf77f05925b40eee2504db
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 5 09:27:08 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 5 09:27:08 2026 +0100

    vPCI/ReBAR: improve cleanup
    
    We cannot assume extended config space to (still) be accessible when
    cleaning up. Necessary values need caching instead. In fact, as the caller
    also cannot look up extended capabilities, the cleanup function needs to
    cope with being called when there's no ReBAR capability at all.
    
    As kind of a side effect nbars being 0 (which init_rebar() doesn't
    explicitly reject) no longer results in a bogus call to
    vpci_remove_registers().
    
    Fixes: ee459aeac096 ("vpci/rebar: Implement cleanup function for Rebar")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/drivers/vpci/rebar.c | 15 +++++++--------
 xen/include/xen/vpci.h   |  7 +++++++
 2 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/xen/drivers/vpci/rebar.c b/xen/drivers/vpci/rebar.c
index ab5c5453a8..1bb3dd7045 100644
--- a/xen/drivers/vpci/rebar.c
+++ b/xen/drivers/vpci/rebar.c
@@ -53,17 +53,12 @@ static void cf_check rebar_ctrl_write(const struct pci_dev *pdev,
 static int cf_check cleanup_rebar(const struct pci_dev *pdev, bool hide)
 {
     int rc;
-    uint32_t ctrl;
-    unsigned int nbars;
-    unsigned int rebar_offset = pci_find_ext_capability(pdev,
-                                                        PCI_EXT_CAP_ID_REBAR);
+    unsigned int nbars = pdev->vpci->rebar.nbars;
+    unsigned int rebar_offset = pdev->vpci->rebar.offset;
 
-    if ( !hide )
+    if ( !rebar_offset || !nbars || !hide )
         return 0;
 
-    ctrl = pci_conf_read32(pdev->sbdf, rebar_offset + PCI_REBAR_CTRL(0));
-    nbars = MASK_EXTR(ctrl, PCI_REBAR_CTRL_NBAR_MASK);
-
     rc = vpci_remove_registers(pdev->vpci, rebar_offset + PCI_REBAR_CAP(0),
                                PCI_REBAR_CTRL(nbars - 1));
     if ( rc )
@@ -121,6 +116,10 @@ static int cf_check init_rebar(struct pci_dev *pdev)
 
     ctrl = pci_conf_read32(pdev->sbdf, rebar_offset + PCI_REBAR_CTRL(0));
     nbars = MASK_EXTR(ctrl, PCI_REBAR_CTRL_NBAR_MASK);
+
+    pdev->vpci->rebar.offset = rebar_offset;
+    pdev->vpci->rebar.nbars  = nbars;
+
     for ( unsigned int i = 0; i < nbars; i++ )
     {
         int rc;
diff --git a/xen/include/xen/vpci.h b/xen/include/xen/vpci.h
index d104efbce2..83ac41edf8 100644
--- a/xen/include/xen/vpci.h
+++ b/xen/include/xen/vpci.h
@@ -135,6 +135,13 @@ struct vpci {
             struct vpci_arch_msix_entry arch;
         } entries[];
     } *msix;
+
+    /* Resizable BARs data */
+    struct vpci_rebar {
+        unsigned int offset:12;
+        unsigned int nbars:3;
+    } rebar;
+
 #ifdef CONFIG_HAS_VPCI_GUEST_SUPPORT
     /* Guest SBDF of the device. */
 #define INVALID_GUEST_SBDF ((pci_sbdf_t){ .sbdf = ~0U })
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Mar 05 11:22:12 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 05 Mar 2026 11:22:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1246463.1545626 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vy6mS-0000eo-0C; Thu, 05 Mar 2026 11:22:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1246463.1545626; Thu, 05 Mar 2026 11:22:11 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vy6mR-0000eg-U0; Thu, 05 Mar 2026 11:22:11 +0000
Received: by outflank-mailman (input) for mailman id 1246463;
 Thu, 05 Mar 2026 11:22:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vy6mR-0000eY-Ls
 for xen-changelog@lists.xenproject.org; Thu, 05 Mar 2026 11:22:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vy6mR-006X6O-25
 for xen-changelog@lists.xenproject.org;
 Thu, 05 Mar 2026 11:22:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vy6mR-0007ss-1g
 for xen-changelog@lists.xenproject.org;
 Thu, 05 Mar 2026 11:22:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=uuzjL38/Znwju8DRou8FbHnSt7i00qqWkcMHPkcsmfw=; b=GGK8z7CHpDgc1Q1wgPDcxMpCFe
	4NSWYN9GWMJZ68iDQ67LF13UtsFWUlgzQkffvFXBmRXThephfF38sFjW62ftN3bCSlNn7cwOYZRL3
	fspkKrrct8Lb0/0+cIqKjjbz8pUgoITyD4pJOnKg/8ei1tJ/7pktMiJRw0pC4ZtiBMQo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] vpci/msix: check for BARs enabled in vpci_make_msix_hole
Message-Id: <E1vy6mR-0007ss-1g@xenbits.xenproject.org>
Date: Thu, 05 Mar 2026 11:22:11 +0000

commit 7c24d58a6e641e2979978c5abb312bff877dede3
Author:     Stewart Hildebrand <stewart.hildebrand@amd.com>
AuthorDate: Thu Mar 5 09:27:50 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 5 09:27:50 2026 +0100

    vpci/msix: check for BARs enabled in vpci_make_msix_hole
    
    A hotplugged PCI device may be added uninitialized. In particular,
    memory decoding might be disabled and the BARs might be zeroed. In this
    case, the BARs will not be mapped in p2m. However, vpci_make_msix_hole()
    unconditionally attempts to punch holes in p2m, leading to init_msix()
    failing:
    
    (XEN) d0v0 0000:01:00.0: existing mapping (mfn: 1c1880 type: 0) at 0 clobbers MSIX MMIO area
    (XEN) d0 0000:01:00.0: init legacy cap 17 fail rc=-17, mask it
    
    vpci_make_msix_hole() should only attempt to punch holes if the BARs
    containing the MSI-X/PBA tables are mapped in p2m. Introduce a helper
    for checking if a BAR is enabled, and add a check for the situation
    inside vpci_make_msix_hole().
    
    As a result of the newly introduced checks in vpci_make_msix_hole(),
    move the call to vpci_make_msix_hole() within modify_decoding() to after
    setting ->enabled.
    
    Fixes: ee2eb6849d50 ("vpci: Refactor REGISTER_VPCI_INIT")
    Signed-off-by: Stewart Hildebrand <stewart.hildebrand@amd.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/drivers/vpci/header.c  | 26 +++++++++++++-------------
 xen/drivers/vpci/msix.c    |  3 +++
 xen/drivers/vpci/private.h |  6 ++++++
 3 files changed, 22 insertions(+), 13 deletions(-)

diff --git a/xen/drivers/vpci/header.c b/xen/drivers/vpci/header.c
index 1c0818c2e7..a760d8c32f 100644
--- a/xen/drivers/vpci/header.c
+++ b/xen/drivers/vpci/header.c
@@ -123,19 +123,6 @@ static void modify_decoding(const struct pci_dev *pdev, uint16_t cmd,
     bool map = cmd & PCI_COMMAND_MEMORY;
     unsigned int i;
 
-    /*
-     * Make sure there are no mappings in the MSIX MMIO areas, so that accesses
-     * can be trapped (and emulated) by Xen when the memory decoding bit is
-     * enabled.
-     *
-     * FIXME: punching holes after the p2m has been set up might be racy for
-     * DomU usage, needs to be revisited.
-     */
-#ifdef CONFIG_HAS_PCI_MSI
-    if ( map && !rom_only && vpci_make_msix_hole(pdev) )
-        return;
-#endif
-
     for ( i = 0; i < ARRAY_SIZE(header->bars); i++ )
     {
         struct vpci_bar *bar = &header->bars[i];
@@ -165,6 +152,19 @@ static void modify_decoding(const struct pci_dev *pdev, uint16_t cmd,
             bar->enabled = map;
     }
 
+    /*
+     * Make sure there are no mappings in the MSIX MMIO areas, so that accesses
+     * can be trapped (and emulated) by Xen when the memory decoding bit is
+     * enabled.
+     *
+     * FIXME: punching holes after the p2m has been set up might be racy for
+     * DomU usage, needs to be revisited.
+     */
+#ifdef CONFIG_HAS_PCI_MSI
+    if ( map && !rom_only && vpci_make_msix_hole(pdev) )
+        return;
+#endif
+
     if ( !rom_only )
     {
         pci_conf_write16(pdev->sbdf, PCI_COMMAND, cmd);
diff --git a/xen/drivers/vpci/msix.c b/xen/drivers/vpci/msix.c
index f87212b46f..bbe4f213ac 100644
--- a/xen/drivers/vpci/msix.c
+++ b/xen/drivers/vpci/msix.c
@@ -606,6 +606,9 @@ int vpci_make_msix_hole(const struct pci_dev *pdev)
         unsigned long end = PFN_DOWN(vmsix_table_addr(pdev->vpci, i) +
                                      vmsix_table_size(pdev->vpci, i) - 1);
 
+        if ( !vmsix_table_bar_valid(pdev->vpci, i) )
+            continue;
+
         for ( ; start <= end; start++ )
         {
             p2m_type_t t;
diff --git a/xen/drivers/vpci/private.h b/xen/drivers/vpci/private.h
index 140092cc52..fdeeca7aa8 100644
--- a/xen/drivers/vpci/private.h
+++ b/xen/drivers/vpci/private.h
@@ -119,6 +119,12 @@ static inline paddr_t vmsix_table_addr(const struct vpci *vpci, unsigned int nr)
            (vpci->msix->tables[nr] & ~PCI_MSIX_BIRMASK);
 }
 
+static inline bool vmsix_table_bar_valid(const struct vpci *vpci,
+                                         unsigned int nr)
+{
+    return vpci->header.bars[vpci->msix->tables[nr] & PCI_MSIX_BIRMASK].enabled;
+}
+
 /*
  * Note regarding the size calculation of the PBA: the spec mentions "The last
  * QWORD will not necessarily be fully populated", so it implies that the PBA
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Mar 05 11:22:23 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 05 Mar 2026 11:22:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1246464.1545632 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vy6md-0000hE-32; Thu, 05 Mar 2026 11:22:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1246464.1545632; Thu, 05 Mar 2026 11:22:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vy6mc-0000h6-Vi; Thu, 05 Mar 2026 11:22:22 +0000
Received: by outflank-mailman (input) for mailman id 1246464;
 Thu, 05 Mar 2026 11:22:21 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vy6mb-0000gx-QY
 for xen-changelog@lists.xenproject.org; Thu, 05 Mar 2026 11:22:21 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vy6mb-006X6s-2Y
 for xen-changelog@lists.xenproject.org;
 Thu, 05 Mar 2026 11:22:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vy6mb-0007te-2G
 for xen-changelog@lists.xenproject.org;
 Thu, 05 Mar 2026 11:22:21 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=FhSRBJrhBo4Pbg5LH6qKp9HWHfMPZDEniw09BKUkZRo=; b=dgG+xsukXGUvzV8DiMXzlDFEla
	x046nkjhWHZon0M3R2Mx1k3b+K6g3y3c4y+OJzdnEb9rtPZmVQl4b4rQC0q5kgDhOvla7qF7fnttC
	iF8TxWeK0KLFsrZivLV/93hhMAwmlshHWrYYgcljMfejaiWVguCttOMfprOppQes/Rrw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] domain: use unsigned loop induction variable in complete_domain_destroy()
Message-Id: <E1vy6mb-0007te-2G@xenbits.xenproject.org>
Date: Thu, 05 Mar 2026 11:22:21 +0000

commit 505b2afae44caa9df189957c6e298017b2ef7988
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 5 09:28:27 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 5 09:28:27 2026 +0100

    domain: use unsigned loop induction variable in complete_domain_destroy()
    
    Using plain (signed) int variables as array indexes can be unhelpful on at
    least x86, where the compiler may see the need to insert sign-extension
    insns (strictly speaking it should be able to avoid that when the loop
    continuation condition says >= 0, but that's not generally the case even
    with gcc15).
    
    Observed effects with gcc15 (will of course vary with compiler version and
    level of optimization):
    - on x86, one less preserved register in use, yet due to sub-optimal
      choice of register variables still a small code size increase (%r12
      isn't a good choice when it's used for base-without-index addressing, as
      it requires a SIB byte which other registers wouldn't require),
    - on Arm64 code size decreases, albeit that's eaten up by padding which is
      being inserted ahead of a few labels,
    - on Arm32 code size increases for a reason I didn't fully understand (my
      ability to read Arm assembly is still somewhat limited).
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/common/domain.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/xen/common/domain.c b/xen/common/domain.c
index e06174fca7..d24be268ae 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -1475,7 +1475,7 @@ static void cf_check complete_domain_destroy(struct rcu_head *head)
 {
     struct domain *d = container_of(head, struct domain, rcu);
     struct vcpu *v;
-    int i;
+    unsigned int i;
 
     /*
      * Flush all state for the vCPU previously having run on the current CPU.
@@ -1485,7 +1485,11 @@ static void cf_check complete_domain_destroy(struct rcu_head *head)
      */
     sync_local_execstate();
 
-    for ( i = d->max_vcpus - 1; i >= 0; i-- )
+    /*
+     * Iterating downwards is a requirement here, as e.g. sched_destroy_vcpu()
+     * relies on this.
+     */
+    for ( i = d->max_vcpus; i-- > 0; )
     {
         if ( (v = d->vcpu[i]) == NULL )
             continue;
@@ -1511,7 +1515,7 @@ static void cf_check complete_domain_destroy(struct rcu_head *head)
     xfree(d->vm_event_share);
 #endif
 
-    for ( i = d->max_vcpus - 1; i >= 0; i-- )
+    for ( i = d->max_vcpus; i-- > 0; )
         if ( (v = d->vcpu[i]) != NULL )
             vcpu_destroy(v);
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 06 15:33:13 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Mar 2026 15:33:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1247854.1546240 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vyXAl-0002Ra-Hy; Fri, 06 Mar 2026 15:33:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1247854.1546240; Fri, 06 Mar 2026 15:33:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vyXAl-0002RS-FK; Fri, 06 Mar 2026 15:33:03 +0000
Received: by outflank-mailman (input) for mailman id 1247854;
 Fri, 06 Mar 2026 15:33:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vyXAj-0002RM-JH
 for xen-changelog@lists.xenproject.org; Fri, 06 Mar 2026 15:33:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vyXAj-008J05-1k
 for xen-changelog@lists.xenproject.org;
 Fri, 06 Mar 2026 15:33:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vyXAj-0025wf-1d
 for xen-changelog@lists.xenproject.org;
 Fri, 06 Mar 2026 15:33:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=LHUZ8cchh5T2i5iKt6AhI/UDKoo5WKEVHkq1BDt0WyE=; b=ViuOeN5WUH3jxbRryfGQ/uJwEh
	TGmN8cwn+MlLbzJ+H6kMOp9uYIGd9sD+ojcwcHoDitoDk2Z7/gpRKLT7ewyBoCEkdHpsn/9V6P2Y5
	F5XMRs3SN13JAyEAmJwMZNCbC8fk1/cZQbAjxDRthpmu4VS7fdW7cePkcdS8DuZN3hqo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.21] libxl: Fix device_add QMP calls with QEMU 9.2 and newer
Message-Id: <E1vyXAj-0025wf-1d@xenbits.xenproject.org>
Date: Fri, 06 Mar 2026 15:33:01 +0000

commit 6adc1004f7e92374a52d70f08ff60071fb6d7416
Author:     Anthony PERARD <anthony.perard@vates.tech>
AuthorDate: Mon Dec 15 14:51:24 2025 +0100
Commit:     Anthony PERARD <anthony.perard@vates.tech>
CommitDate: Fri Mar 6 10:56:40 2026 +0100

    libxl: Fix device_add QMP calls with QEMU 9.2 and newer
    
    QEMU used to ignore JSON types and do conversion string <-> integer
    automatically for the command "device_add", but that was removed in
    QEMU 9.2 (428d1789df91 ("docs/about: Belatedly document tightening of
    QMP device_add checking")).
    
    Fixes: 9718ab394d5d ("libxl_usb: Make libxl__device_usbctrl_add uses ev_qmp")
    Fixes: 40c7eca10a82 ("libxl_usb: Make libxl__device_usbdev_add uses ev_qmp")
    Signed-off-by: Anthony PERARD <anthony.perard@vates.tech>
    Tested-by: Maximilian Engelhardt <maxi@daemonizer.de>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    (cherry picked from commit 85e12104f47276b588d5efd33599c987c545eeb1)
---
 tools/libs/light/libxl_usb.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/tools/libs/light/libxl_usb.c b/tools/libs/light/libxl_usb.c
index c5ae59681c..4e7c409fe6 100644
--- a/tools/libs/light/libxl_usb.c
+++ b/tools/libs/light/libxl_usb.c
@@ -367,10 +367,10 @@ static int libxl__device_usbctrl_add_hvm(libxl__egc *egc, libxl__ev_qmp *qmp,
     case 3:
         libxl__qmp_param_add_string(gc, &qmp_args,
                                     "driver", "nec-usb-xhci");
-        libxl__qmp_param_add_string(gc, &qmp_args, "p2",
-                                    GCSPRINTF("%d", usbctrl->ports));
-        libxl__qmp_param_add_string(gc, &qmp_args, "p3",
-                                    GCSPRINTF("%d", usbctrl->ports));
+        libxl__qmp_param_add_integer(gc, &qmp_args, "p2",
+                                     usbctrl->ports);
+        libxl__qmp_param_add_integer(gc, &qmp_args, "p3",
+                                     usbctrl->ports);
         break;
     default:
         abort(); /* Should not be possible. */
@@ -411,10 +411,10 @@ static int libxl__device_usbdev_add_hvm(libxl__egc *egc, libxl__ev_qmp *qmp,
         GCSPRINTF("xenusb-%d.0", usbdev->ctrl));
     libxl__qmp_param_add_string(gc, &qmp_args, "port",
         GCSPRINTF("%d", usbdev->port));
-    libxl__qmp_param_add_string(gc, &qmp_args, "hostbus",
-        GCSPRINTF("%d", usbdev->u.hostdev.hostbus));
-    libxl__qmp_param_add_string(gc, &qmp_args, "hostaddr",
-        GCSPRINTF("%d", usbdev->u.hostdev.hostaddr));
+    libxl__qmp_param_add_integer(gc, &qmp_args, "hostbus",
+                                 usbdev->u.hostdev.hostbus);
+    libxl__qmp_param_add_integer(gc, &qmp_args, "hostaddr",
+                                 usbdev->u.hostdev.hostaddr);
 
     return libxl__ev_qmp_send(egc, qmp, "device_add", qmp_args);
 }
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.21


From xen-changelog-bounces@lists.xenproject.org Fri Mar 06 15:33:13 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Mar 2026 15:33:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1247855.1546244 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vyXAv-0002TB-JS; Fri, 06 Mar 2026 15:33:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1247855.1546244; Fri, 06 Mar 2026 15:33:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vyXAv-0002T3-Gp; Fri, 06 Mar 2026 15:33:13 +0000
Received: by outflank-mailman (input) for mailman id 1247855;
 Fri, 06 Mar 2026 15:33:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vyXAt-0002Sb-Pb
 for xen-changelog@lists.xenproject.org; Fri, 06 Mar 2026 15:33:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vyXAt-008J0M-2H
 for xen-changelog@lists.xenproject.org;
 Fri, 06 Mar 2026 15:33:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vyXAt-00261d-1w
 for xen-changelog@lists.xenproject.org;
 Fri, 06 Mar 2026 15:33:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=D4MP0bAn7Mgg3iWcdrsao006Tdv3yzDElF42gFB7Neo=; b=4T2V6ChEC0ZHRxbZmm6eWSMTcj
	PjN7wN1zqC7u3es63Sl6Kci3WJc86QIj7K6OUzJdU+h66xquOfMYCo/mR7mgLEWijgWAYcRlU7ef6
	CfkPJhW/TLkRJ6KxIdHIOvzOARdV2bidzR/jADvJfbmo6WfaFg1skGCi3Vx+rBG8V804=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.21] tools/xenstored: fix live update
Message-Id: <E1vyXAt-00261d-1w@xenbits.xenproject.org>
Date: Fri, 06 Mar 2026 15:33:11 +0000

commit 8061625411b4bc921a1701bd09457500713a782b
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Tue Feb 17 11:46:29 2026 +0100
Commit:     Anthony PERARD <anthony.perard@vates.tech>
CommitDate: Fri Mar 6 11:02:35 2026 +0100

    tools/xenstored: fix live update
    
    Commit e5b0a940557 ("tools/xenstored: Auto-introduce domains") broke
    xenstored live update, as init_domains() will be skipped when live
    update is detected to have happened. This will leave priv_domid and
    store_domid set as invalid.
    
    Fix that by calling init_domains() in live update case, too. In case
    of live update skip introducing any found domains, as this will be done
    when reading the live update state.
    
    Fixes: e5b0a940557 ("tools/xenstored: Auto-introduce domains")
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
    (cherry picked from commit ebf99a162718c4d858d0c997b9dcf1a502c7256e)
---
 tools/xenstored/core.c   |  3 ++-
 tools/xenstored/domain.c | 20 +++++++++++++-------
 tools/xenstored/domain.h |  2 +-
 3 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/tools/xenstored/core.c b/tools/xenstored/core.c
index 64c478a801..d509736c32 100644
--- a/tools/xenstored/core.c
+++ b/tools/xenstored/core.c
@@ -2763,7 +2763,7 @@ int main(int argc, char *argv[])
 	/* Listen to hypervisor. */
 	if (!live_update) {
 		domain_init(-1);
-		init_domains();
+		init_domains(false);
 	}
 
 	/* redirect to /dev/null now we're ready to accept connections */
@@ -3109,6 +3109,7 @@ void read_state_global(const void *ctx, const void *state)
 	set_socket_fd(glb->socket_fd);
 
 	domain_init(glb->evtchn_fd);
+	init_domains(true);
 }
 
 static void add_buffered_data(struct buffered_data *bdata,
diff --git a/tools/xenstored/domain.c b/tools/xenstored/domain.c
index 5ce539d640..a53b611d34 100644
--- a/tools/xenstored/domain.c
+++ b/tools/xenstored/domain.c
@@ -1344,7 +1344,7 @@ static bool init_domain(unsigned int domid)
 
 	return true;
 }
-void init_domains(void)
+void init_domains(bool live_update)
 {
 	unsigned int *domids = NULL;
 	unsigned int nr_domids = 0;
@@ -1356,12 +1356,15 @@ void init_domains(void)
 
 	while (!xenmanage_poll_changed_domain(xm_handle, &domid, &state, &caps,
 					      &unique_id)) {
-		nr_domids++;
-		domids = talloc_realloc(NULL, domids, unsigned int, nr_domids);
-		if (!domids)
-			barf_perror("Failed to reallocate domids");
-
-		domids[nr_domids - 1] = domid;
+		if (!live_update) {
+			nr_domids++;
+			domids = talloc_realloc(NULL, domids,
+						unsigned int, nr_domids);
+			if (!domids)
+				barf_perror("Failed to reallocate domids");
+
+			domids[nr_domids - 1] = domid;
+		}
 
 		if (caps & XENMANAGE_GETDOMSTATE_CAP_CONTROL) {
 			/*
@@ -1391,6 +1394,9 @@ void init_domains(void)
 	snprintf(store_domain_path, sizeof(store_domain_path),
 		 "/local/domain/%u", store_domid);
 
+	if (live_update)
+		return;
+
 	/*
 	 * Privileged domid must be first to setup structures for firing the
 	 * special watches.
diff --git a/tools/xenstored/domain.h b/tools/xenstored/domain.h
index 3b1fce74cf..28186ccac0 100644
--- a/tools/xenstored/domain.h
+++ b/tools/xenstored/domain.h
@@ -92,7 +92,7 @@ int do_set_feature(const void *ctx, struct connection *conn,
 
 void domain_early_init(void);
 void domain_init(int evtfd);
-void init_domains(void);
+void init_domains(bool live_update);
 void stubdom_init(bool live_update);
 void domain_deinit(void);
 void ignore_connection(struct connection *conn, unsigned int err);
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.21


From xen-changelog-bounces@lists.xenproject.org Fri Mar 06 15:33:23 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Mar 2026 15:33:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1247856.1546248 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vyXB5-0002Vp-Kw; Fri, 06 Mar 2026 15:33:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1247856.1546248; Fri, 06 Mar 2026 15:33:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vyXB5-0002Vh-IB; Fri, 06 Mar 2026 15:33:23 +0000
Received: by outflank-mailman (input) for mailman id 1247856;
 Fri, 06 Mar 2026 15:33:21 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vyXB3-0002VQ-Qi
 for xen-changelog@lists.xenproject.org; Fri, 06 Mar 2026 15:33:21 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vyXB3-008J2n-2Z
 for xen-changelog@lists.xenproject.org;
 Fri, 06 Mar 2026 15:33:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vyXB3-00262X-2R
 for xen-changelog@lists.xenproject.org;
 Fri, 06 Mar 2026 15:33:21 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=MxGXaLDWv0EWOanBks1g9gGg6He9oo007nM8slxqipU=; b=F3jvn+P0rHSATX0Mw2KOwA1bQv
	zKERPPm2/HkMVLfg6AEHwj1dDUGG+dMnWk+ixN2TH44eitwLb93bVFwJUJQHvdDpBBOjGo71qng/f
	+2QA9D4Y3QM0yuSNFpmUhLQZf8L2n6fR5g/L+hAky5d/nvIgTcYwJghA/bab/vMRMQ/o=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.21] libxl: constify some local variables for building with glibc 2.43
Message-Id: <E1vyXB3-00262X-2R@xenbits.xenproject.org>
Date: Fri, 06 Mar 2026 15:33:21 +0000

commit 4a7d2f18e5668e3060538f492968566b79dc9181
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Thu Feb 26 13:31:48 2026 +0100
Commit:     Anthony PERARD <anthony.perard@vates.tech>
CommitDate: Fri Mar 6 11:03:36 2026 +0100

    libxl: constify some local variables for building with glibc 2.43
    
    Archlinux just updated glibc to 2.43+r5+g856c426a7534-1 and that
    causes libxl build failure:
    
        libxl_cpuid.c: In function ‘libxl_cpuid_parse_config_xend’:
        libxl_cpuid.c:447:16: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
          447 |         endptr = strchr(str, '=');
              |                ^
        libxl_cpuid.c:452:16: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
          452 |         endptr = strchr(str, ',');
              |                ^
        libxl_cpuid.c:454:20: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
          454 |             endptr = strchr(str, 0);
              |                    ^
        cc1: all warnings being treated as errors
    
    Add missing consts. Note in libxl_cpuid_parse_config_xend() non-const
    endptr still is needed, to be compatible with the second argument to
    strtoul(). Add second variable for this reason.
    
    And while at it, move semicolon to its own line
    
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Anthony PERARD <anthony.perard@vates.tech>
    (cherry picked from commit 44da0e3b4ff7fa15ad28b628f57412a05dae653c)
---
 tools/libs/light/libxl_cpuid.c    | 21 ++++++++++++---------
 tools/libs/light/libxl_internal.c |  2 +-
 2 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/tools/libs/light/libxl_cpuid.c b/tools/libs/light/libxl_cpuid.c
index 8420b2465f..14f08df33a 100644
--- a/tools/libs/light/libxl_cpuid.c
+++ b/tools/libs/light/libxl_cpuid.c
@@ -440,29 +440,32 @@ int libxl_cpuid_parse_config_xend(libxl_cpuid_policy_list *policy,
     str = endptr + 1;
     entry = cpuid_find_match(policy, leaf, subleaf);
     for (str = endptr + 1; *str != 0;) {
+        const char *endptrc;
+
         if (str[0] != 'e' || str[2] != 'x') {
             return 4;
         }
         value = str[1] - 'a';
-        endptr = strchr(str, '=');
-        if (value > 3 || endptr == NULL) {
+        endptrc = strchr(str, '=');
+        if (value > 3 || endptrc == NULL) {
             return 4;
         }
-        str = endptr + 1;
-        endptr = strchr(str, ',');
-        if (endptr == NULL) {
-            endptr = strchr(str, 0);
+        str = endptrc + 1;
+        endptrc = strchr(str, ',');
+        if (endptrc == NULL) {
+            endptrc = strchr(str, 0);
         }
-        if (endptr - str != 32) {
+        if (endptrc - str != 32) {
             return 5;
         }
         entry->policy[value] = calloc(32 + 1, 1);
         strncpy(entry->policy[value], str, 32);
         entry->policy[value][32] = 0;
-        if (*endptr == 0) {
+        if (*endptrc == 0) {
             break;
         }
-        for (str = endptr + 1; *str == ' ' || *str == '\n'; str++);
+        for (str = endptrc + 1; *str == ' ' || *str == '\n'; str++)
+            ;
     }
     return 0;
 }
diff --git a/tools/libs/light/libxl_internal.c b/tools/libs/light/libxl_internal.c
index 2941ca0bbd..d70cfed7d8 100644
--- a/tools/libs/light/libxl_internal.c
+++ b/tools/libs/light/libxl_internal.c
@@ -204,7 +204,7 @@ char *libxl__strndup(libxl__gc *gc, const char *c, size_t n)
 
 char *libxl__dirname(libxl__gc *gc, const char *s)
 {
-    char *c = strrchr(s, '/');
+    const char *c = strrchr(s, '/');
 
     if (!c)
         return NULL;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.21


From xen-changelog-bounces@lists.xenproject.org Fri Mar 06 15:33:33 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Mar 2026 15:33:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1247857.1546252 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vyXBF-0002Y0-MB; Fri, 06 Mar 2026 15:33:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1247857.1546252; Fri, 06 Mar 2026 15:33:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vyXBF-0002Xt-JZ; Fri, 06 Mar 2026 15:33:33 +0000
Received: by outflank-mailman (input) for mailman id 1247857;
 Fri, 06 Mar 2026 15:33:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vyXBD-0002Xk-VL
 for xen-changelog@lists.xenproject.org; Fri, 06 Mar 2026 15:33:31 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vyXBD-008J2r-31
 for xen-changelog@lists.xenproject.org;
 Fri, 06 Mar 2026 15:33:31 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vyXBD-00263K-2k
 for xen-changelog@lists.xenproject.org;
 Fri, 06 Mar 2026 15:33:31 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=N65wWkrrTJpci6mdEpyC9sujGnoQUN1ingysguSMMGk=; b=d/ePMozzSTI39EiWl9CPWvxRLO
	WJTLXHGkByVu4GVW5AKIgf619j/yJ0xXMyqMsPn4B98lDGbmX6EM+pO9EMbNsYsvMNDSJN8joik5L
	ELq5KyYclPP2qb8NY05olYqI0FZ6xtTEtwJQWE9hQmNEr1YpG4ndO7t2vIIfDyYFmQng=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.21] xenstored: Add newline to error message
Message-Id: <E1vyXBD-00263K-2k@xenbits.xenproject.org>
Date: Fri, 06 Mar 2026 15:33:31 +0000

commit 52356ca6551ec5a952165f2fcdb308f7f897420e
Author:     Jason Andryuk <jason.andryuk@amd.com>
AuthorDate: Tue Nov 25 10:25:08 2025 +0100
Commit:     Anthony PERARD <anthony.perard@vates.tech>
CommitDate: Fri Mar 6 14:41:22 2026 +0100

    xenstored: Add newline to error message
    
    Unlike barf(), xprintf() does not add a newline.  Add one.
    
    Fixes: e5b0a9405571 ("tools/xenstored: Auto-introduce domains")
    Signed-off-by: Jason Andryuk <jason.andryuk@amd.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    (cherry picked from commit 9c68f5e90c223d16418aeb3783b2e5123d2071a3)
---
 tools/xenstored/domain.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/xenstored/domain.c b/tools/xenstored/domain.c
index a53b611d34..3641f58be2 100644
--- a/tools/xenstored/domain.c
+++ b/tools/xenstored/domain.c
@@ -1333,7 +1333,7 @@ static bool init_domain(unsigned int domid)
 
 	domain = introduce_domain(NULL, domid, port, false);
 	if (!domain) {
-		xprintf("Could not initialize dom%u", domid);
+		xprintf("Could not initialize dom%u\n", domid);
 		return false;
 	}
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.21


From xen-changelog-bounces@lists.xenproject.org Fri Mar 06 15:33:43 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Mar 2026 15:33:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1247858.1546256 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vyXBP-0002a5-NU; Fri, 06 Mar 2026 15:33:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1247858.1546256; Fri, 06 Mar 2026 15:33:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vyXBP-0002Zx-Ky; Fri, 06 Mar 2026 15:33:43 +0000
Received: by outflank-mailman (input) for mailman id 1247858;
 Fri, 06 Mar 2026 15:33:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vyXBO-0002Zp-2M
 for xen-changelog@lists.xenproject.org; Fri, 06 Mar 2026 15:33:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vyXBO-008J2v-08
 for xen-changelog@lists.xenproject.org;
 Fri, 06 Mar 2026 15:33:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vyXBO-002648-00
 for xen-changelog@lists.xenproject.org;
 Fri, 06 Mar 2026 15:33:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=TG96RUkv5DiQCTe8bEdbQj2Add4m2mqKHYqso/KCMdg=; b=sKeJA2ydkYt4RVD/d2+j9+rR+Y
	CyWcyRWrm1ItibWFJPoZy0/zHxpfFwFrrEfSjNlyUtL0V4FVO1DLnpHcUc9qKja4eRDnyf7u6SC2a
	pMcWDxTjhEXOxOGlqQAWJ5A+CoRoLRTxxsyAy/V3VBiiJiU43aFnw32bTKbmmAuRlsAw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.21] systemd: fall back to default system-sleep dir without systemd-devel
Message-Id: <E1vyXBO-002648-00@xenbits.xenproject.org>
Date: Fri, 06 Mar 2026 15:33:42 +0000

commit 76dc2d60719f28714b68c47d0a72c0844fa7b053
Author:     Mykola Kvach <mykola_kvach@epam.com>
AuthorDate: Fri Dec 5 18:07:15 2025 +0200
Commit:     Anthony PERARD <anthony.perard@vates.tech>
CommitDate: Fri Mar 6 14:42:24 2026 +0100

    systemd: fall back to default system-sleep dir without systemd-devel
    
    Keep the pkg-config lookup for SYSTEMD_SLEEP_DIR, but fall back to
    "$(prefix)/lib/systemd/system-sleep/" if the variable remains unset.
    This avoids reintroducing a build-time dependency on systemd-devel while
    still honoring the path provided by pkg-config when present.
    
    Fixes: e54a6cd6a1f3 ("systemd: Add hooks to stop/start xen-watchdog on suspend/resume")
    Reported-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Mykola Kvach <mykola_kvach@epam.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    (cherry picked from commit b34bde262c8cf69fa235045108a0bc0309c63eac)
---
 m4/systemd.m4   | 2 +-
 tools/configure | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/m4/systemd.m4 b/m4/systemd.m4
index c47a25ef93..5fb5a7089e 100644
--- a/m4/systemd.m4
+++ b/m4/systemd.m4
@@ -81,7 +81,7 @@ AC_DEFUN([AX_CHECK_SYSTEMD_LIBS], [
 	], [])
 
 	AS_IF([test "x$SYSTEMD_SLEEP_DIR" = x], [
-	    AC_MSG_ERROR([SYSTEMD_SLEEP_DIR is unset])
+	    SYSTEMD_SLEEP_DIR="\$(prefix)/lib/systemd/system-sleep/"
 	], [])
 ])
 
diff --git a/tools/configure b/tools/configure
index d460f25529..d6b3487737 100755
--- a/tools/configure
+++ b/tools/configure
@@ -10360,7 +10360,7 @@ fi
 	if test "x$SYSTEMD_SLEEP_DIR" = x
 then :
 
-	    as_fn_error $? "SYSTEMD_SLEEP_DIR is unset" "$LINENO" 5
+	    SYSTEMD_SLEEP_DIR="\$(prefix)/lib/systemd/system-sleep/"
 
 fi
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.21


From xen-changelog-bounces@lists.xenproject.org Fri Mar 06 15:33:53 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Mar 2026 15:33:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1247859.1546260 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vyXBZ-0002cD-Oo; Fri, 06 Mar 2026 15:33:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1247859.1546260; Fri, 06 Mar 2026 15:33:53 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vyXBZ-0002c5-MJ; Fri, 06 Mar 2026 15:33:53 +0000
Received: by outflank-mailman (input) for mailman id 1247859;
 Fri, 06 Mar 2026 15:33:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vyXBY-0002by-6b
 for xen-changelog@lists.xenproject.org; Fri, 06 Mar 2026 15:33:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vyXBY-008J3H-0Z
 for xen-changelog@lists.xenproject.org;
 Fri, 06 Mar 2026 15:33:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vyXBY-002655-0J
 for xen-changelog@lists.xenproject.org;
 Fri, 06 Mar 2026 15:33:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=wGj7ZBxqdRkLLDZLFsI+uLGlPABMTHSJaUYlIdZ5cVE=; b=RHWEOAGa928U0Cma3XeMsawl5i
	aKFk5HKuiyP4HQD0ocDpUni323/PWPnNlvcsu61Xk0rofDug9aZQLQZRBBs+nnMIHPfXjXpz/YbaO
	z33+ePJ3shFsyWSdhX47OJ9cyEu00iDO8EyHbFUHYUkKfM0Z+ibnE8AlIFDcp39CQfEQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.21] tools/sd-notify.h: Include string.h too
Message-Id: <E1vyXBY-002655-0J@xenbits.xenproject.org>
Date: Fri, 06 Mar 2026 15:33:52 +0000

commit 18796375054498bba8a85def2f42876586fc4b8f
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Dec 5 21:33:25 2025 +0000
Commit:     Anthony PERARD <anthony.perard@vates.tech>
CommitDate: Fri Mar 6 14:42:52 2026 +0100

    tools/sd-notify.h: Include string.h too
    
    Alpine Linux, when using --enable-systemd to get the init files, fails with:
    
      tools/include/xen-sd-notify.h:69:3: error: call to undeclared library
      function 'memcpy' with type 'void *(void *, const void *, unsigned long)';
      ISO C99 and later do not support implicit function declarations
      [-Wimplicit-function-declaration]
         69 |   memcpy(socket_addr.sun.sun_path, socket_path, path_length);
            |   ^
    
    This will be down to using musl rather than glibc.  Include the appropriate
    header.
    
    Fixes: 78510f3a1522 ("tools: Import stand-alone sd_notify() implementation from systemd")
    Reported-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Acked-by: Anthony PERARD <anthony.perard@vates.tech>
    (cherry picked from commit 8efff5a69ab7596f6c63031d0aef292114948cd9)
---
 tools/include/xen-sd-notify.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/include/xen-sd-notify.h b/tools/include/xen-sd-notify.h
index 28c9b20f15..20441d0ec9 100644
--- a/tools/include/xen-sd-notify.h
+++ b/tools/include/xen-sd-notify.h
@@ -20,6 +20,7 @@
 #include <errno.h>
 #include <stddef.h>
 #include <stdlib.h>
+#include <string.h>
 #include <sys/socket.h>
 #include <sys/un.h>
 #include <unistd.h>
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.21


From xen-changelog-bounces@lists.xenproject.org Fri Mar 06 15:34:03 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Mar 2026 15:34:03 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1247861.1546264 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vyXBj-0002eP-Qn; Fri, 06 Mar 2026 15:34:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1247861.1546264; Fri, 06 Mar 2026 15:34:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vyXBj-0002eI-Nh; Fri, 06 Mar 2026 15:34:03 +0000
Received: by outflank-mailman (input) for mailman id 1247861;
 Fri, 06 Mar 2026 15:34:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vyXBi-0002eA-BF
 for xen-changelog@lists.xenproject.org; Fri, 06 Mar 2026 15:34:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vyXBi-008J3W-11
 for xen-changelog@lists.xenproject.org;
 Fri, 06 Mar 2026 15:34:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vyXBi-00265y-0k
 for xen-changelog@lists.xenproject.org;
 Fri, 06 Mar 2026 15:34:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=UWbNjdc8ylVLIjf4TYaT+pDIPgvJ/FNcw7CTsnWPkYI=; b=Po1rYpuOqIT6b6eUMPMFuqhSp6
	95c7QRgcMRLkQdl81GkC9+Ie/DSnvHZlRD+Naj1JDbbPqsOSwkObybnvGK55NhDS8J2zwGYFj00yI
	6ySOWJgHPS8yNAK14yjo2gt9uunk+bJzETYDBTGnHNrKw7cG0LvQG1OLWgkQ/2ncRYag=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.21] tools/ocaml: fix 32-bit truncation bug in stub_xc_domain_setmaxmem()
Message-Id: <E1vyXBi-00265y-0k@xenbits.xenproject.org>
Date: Fri, 06 Mar 2026 15:34:02 +0000

commit e10f3ad8694cde2c0e8a81c3825e32ecc630a51c
Author:     Edwin Török <edwin.torok@citrix.com>
AuthorDate: Thu Feb 5 13:56:45 2026 +0000
Commit:     Anthony PERARD <anthony.perard@vates.tech>
CommitDate: Fri Mar 6 15:02:01 2026 +0100

    tools/ocaml: fix 32-bit truncation bug in stub_xc_domain_setmaxmem()
    
    Observed when attempting to boot a >4TiB VM:
    
    After a call to domain_setmaxmem with 6370254848 (KiB), the domain's maxmem
    got set to 2075287552, which is exactly 2^32 smaller.
    
    xc_domain_setmaxmem takes an uint64_t as a parameter, and the OCaml value
    is 64-bit already, so fix the C variable to match the type and avoid the
    truncation.
    
    Fixes: f5b43e95facd ("libxl: fix "xl mem-set" regression from 0c029c4da2")
    Signed-off-by: Edwin Török <edwin.torok@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@cloud.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    (cherry picked from commit 381b4ff16f7ff83a2dc44f16b8dd0208f3255ec7)
---
 tools/ocaml/libs/xc/xenctrl_stubs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/ocaml/libs/xc/xenctrl_stubs.c b/tools/ocaml/libs/xc/xenctrl_stubs.c
index ac2a7537d6..c55f73b265 100644
--- a/tools/ocaml/libs/xc/xenctrl_stubs.c
+++ b/tools/ocaml/libs/xc/xenctrl_stubs.c
@@ -947,7 +947,7 @@ CAMLprim value stub_xc_domain_setmaxmem(value xch_val, value domid,
 	int retval;
 
 	uint32_t c_domid = Int_val(domid);
-	unsigned int c_max_memkb = Int64_val(max_memkb);
+	uint64_t c_max_memkb = Int64_val(max_memkb);
 	caml_enter_blocking_section();
 	retval = xc_domain_setmaxmem(xch, c_domid, c_max_memkb);
 	caml_leave_blocking_section();
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.21


From xen-changelog-bounces@lists.xenproject.org Fri Mar 06 15:34:13 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Mar 2026 15:34:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1247862.1546267 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vyXBt-0002h2-Tc; Fri, 06 Mar 2026 15:34:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1247862.1546267; Fri, 06 Mar 2026 15:34:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vyXBt-0002gu-RA; Fri, 06 Mar 2026 15:34:13 +0000
Received: by outflank-mailman (input) for mailman id 1247862;
 Fri, 06 Mar 2026 15:34:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vyXBs-0002gk-Oc
 for xen-changelog@lists.xenproject.org; Fri, 06 Mar 2026 15:34:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vyXBs-008J3a-2M
 for xen-changelog@lists.xenproject.org;
 Fri, 06 Mar 2026 15:34:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vyXBs-00267Q-2F
 for xen-changelog@lists.xenproject.org;
 Fri, 06 Mar 2026 15:34:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=p0Yb9YSdz2RlwBAbs4D355hvLQ1gJaJzhwI0ZuSHHZc=; b=Rt8ACGwca7+tcnPwnzWjcgihIe
	944LeJHh3wUu2/gD+p/gqDcFMlIhKmtUPpz7MVMgbxrDfprSHxKT2Nz4skpB5EB2Jy+pqHwjuD8p6
	g1/Uj8MTMRKsBOi3CFN9ZwHdMJYxsyb3nT4qnyZARfBOuc7zEqcm5oIp5FV2N+ClztKM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.20] libxl: Fix device_add QMP calls with QEMU 9.2 and newer
Message-Id: <E1vyXBs-00267Q-2F@xenbits.xenproject.org>
Date: Fri, 06 Mar 2026 15:34:12 +0000

commit ac333dd662e18e86ffd2afd6c10e04305c9d137b
Author:     Anthony PERARD <anthony.perard@vates.tech>
AuthorDate: Mon Dec 15 14:51:24 2025 +0100
Commit:     Anthony PERARD <anthony.perard@vates.tech>
CommitDate: Fri Mar 6 14:47:24 2026 +0100

    libxl: Fix device_add QMP calls with QEMU 9.2 and newer
    
    QEMU used to ignore JSON types and do conversion string <-> integer
    automatically for the command "device_add", but that was removed in
    QEMU 9.2 (428d1789df91 ("docs/about: Belatedly document tightening of
    QMP device_add checking")).
    
    Fixes: 9718ab394d5d ("libxl_usb: Make libxl__device_usbctrl_add uses ev_qmp")
    Fixes: 40c7eca10a82 ("libxl_usb: Make libxl__device_usbdev_add uses ev_qmp")
    Signed-off-by: Anthony PERARD <anthony.perard@vates.tech>
    Tested-by: Maximilian Engelhardt <maxi@daemonizer.de>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    (cherry picked from commit 85e12104f47276b588d5efd33599c987c545eeb1)
---
 tools/libs/light/libxl_usb.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/tools/libs/light/libxl_usb.c b/tools/libs/light/libxl_usb.c
index c5ae59681c..4e7c409fe6 100644
--- a/tools/libs/light/libxl_usb.c
+++ b/tools/libs/light/libxl_usb.c
@@ -367,10 +367,10 @@ static int libxl__device_usbctrl_add_hvm(libxl__egc *egc, libxl__ev_qmp *qmp,
     case 3:
         libxl__qmp_param_add_string(gc, &qmp_args,
                                     "driver", "nec-usb-xhci");
-        libxl__qmp_param_add_string(gc, &qmp_args, "p2",
-                                    GCSPRINTF("%d", usbctrl->ports));
-        libxl__qmp_param_add_string(gc, &qmp_args, "p3",
-                                    GCSPRINTF("%d", usbctrl->ports));
+        libxl__qmp_param_add_integer(gc, &qmp_args, "p2",
+                                     usbctrl->ports);
+        libxl__qmp_param_add_integer(gc, &qmp_args, "p3",
+                                     usbctrl->ports);
         break;
     default:
         abort(); /* Should not be possible. */
@@ -411,10 +411,10 @@ static int libxl__device_usbdev_add_hvm(libxl__egc *egc, libxl__ev_qmp *qmp,
         GCSPRINTF("xenusb-%d.0", usbdev->ctrl));
     libxl__qmp_param_add_string(gc, &qmp_args, "port",
         GCSPRINTF("%d", usbdev->port));
-    libxl__qmp_param_add_string(gc, &qmp_args, "hostbus",
-        GCSPRINTF("%d", usbdev->u.hostdev.hostbus));
-    libxl__qmp_param_add_string(gc, &qmp_args, "hostaddr",
-        GCSPRINTF("%d", usbdev->u.hostdev.hostaddr));
+    libxl__qmp_param_add_integer(gc, &qmp_args, "hostbus",
+                                 usbdev->u.hostdev.hostbus);
+    libxl__qmp_param_add_integer(gc, &qmp_args, "hostaddr",
+                                 usbdev->u.hostdev.hostaddr);
 
     return libxl__ev_qmp_send(egc, qmp, "device_add", qmp_args);
 }
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.20


From xen-changelog-bounces@lists.xenproject.org Fri Mar 06 15:34:23 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Mar 2026 15:34:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1247863.1546272 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vyXC3-0002kv-V9; Fri, 06 Mar 2026 15:34:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1247863.1546272; Fri, 06 Mar 2026 15:34:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vyXC3-0002kn-Sa; Fri, 06 Mar 2026 15:34:23 +0000
Received: by outflank-mailman (input) for mailman id 1247863;
 Fri, 06 Mar 2026 15:34:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vyXC2-0002kf-Rc
 for xen-changelog@lists.xenproject.org; Fri, 06 Mar 2026 15:34:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vyXC2-008J3g-2f
 for xen-changelog@lists.xenproject.org;
 Fri, 06 Mar 2026 15:34:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vyXC2-00268B-2X
 for xen-changelog@lists.xenproject.org;
 Fri, 06 Mar 2026 15:34:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=AKNYoNQMoCVT0HpDIf1ycqEeZOBxh3G0xfGRQ4/t1Y0=; b=CfZpogVPmaGK+mG/ptHHG0LhSV
	t05WVhQNSkzEibmJyeYxYAoO0O7wzlAepyi9izEWSPEPRW9aFfohiKxMfMzkG8DNsoj88OM4z6udJ
	4qEueJGYKsHEiKxlHmpY80KQsbayFPXubtiW0o+4uaoEXL7znHIEWckmBgvovUbGxHR4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.20] libxl: constify some local variables for building with glibc 2.43
Message-Id: <E1vyXC2-00268B-2X@xenbits.xenproject.org>
Date: Fri, 06 Mar 2026 15:34:22 +0000

commit 7fb8c54d678a511562e5aacf32b69323391270c3
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Thu Feb 26 13:31:48 2026 +0100
Commit:     Anthony PERARD <anthony.perard@vates.tech>
CommitDate: Fri Mar 6 14:48:02 2026 +0100

    libxl: constify some local variables for building with glibc 2.43
    
    Archlinux just updated glibc to 2.43+r5+g856c426a7534-1 and that
    causes libxl build failure:
    
        libxl_cpuid.c: In function ‘libxl_cpuid_parse_config_xend’:
        libxl_cpuid.c:447:16: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
          447 |         endptr = strchr(str, '=');
              |                ^
        libxl_cpuid.c:452:16: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
          452 |         endptr = strchr(str, ',');
              |                ^
        libxl_cpuid.c:454:20: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
          454 |             endptr = strchr(str, 0);
              |                    ^
        cc1: all warnings being treated as errors
    
    Add missing consts. Note in libxl_cpuid_parse_config_xend() non-const
    endptr still is needed, to be compatible with the second argument to
    strtoul(). Add second variable for this reason.
    
    And while at it, move semicolon to its own line
    
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Anthony PERARD <anthony.perard@vates.tech>
    (cherry picked from commit 44da0e3b4ff7fa15ad28b628f57412a05dae653c)
---
 tools/libs/light/libxl_cpuid.c    | 21 ++++++++++++---------
 tools/libs/light/libxl_internal.c |  2 +-
 2 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/tools/libs/light/libxl_cpuid.c b/tools/libs/light/libxl_cpuid.c
index f738e17b19..ba428e5ebb 100644
--- a/tools/libs/light/libxl_cpuid.c
+++ b/tools/libs/light/libxl_cpuid.c
@@ -440,29 +440,32 @@ int libxl_cpuid_parse_config_xend(libxl_cpuid_policy_list *policy,
     str = endptr + 1;
     entry = cpuid_find_match(policy, leaf, subleaf);
     for (str = endptr + 1; *str != 0;) {
+        const char *endptrc;
+
         if (str[0] != 'e' || str[2] != 'x') {
             return 4;
         }
         value = str[1] - 'a';
-        endptr = strchr(str, '=');
-        if (value > 3 || endptr == NULL) {
+        endptrc = strchr(str, '=');
+        if (value > 3 || endptrc == NULL) {
             return 4;
         }
-        str = endptr + 1;
-        endptr = strchr(str, ',');
-        if (endptr == NULL) {
-            endptr = strchr(str, 0);
+        str = endptrc + 1;
+        endptrc = strchr(str, ',');
+        if (endptrc == NULL) {
+            endptrc = strchr(str, 0);
         }
-        if (endptr - str != 32) {
+        if (endptrc - str != 32) {
             return 5;
         }
         entry->policy[value] = calloc(32 + 1, 1);
         strncpy(entry->policy[value], str, 32);
         entry->policy[value][32] = 0;
-        if (*endptr == 0) {
+        if (*endptrc == 0) {
             break;
         }
-        for (str = endptr + 1; *str == ' ' || *str == '\n'; str++);
+        for (str = endptrc + 1; *str == ' ' || *str == '\n'; str++)
+            ;
     }
     return 0;
 }
diff --git a/tools/libs/light/libxl_internal.c b/tools/libs/light/libxl_internal.c
index c95624933f..7e3c0eaae5 100644
--- a/tools/libs/light/libxl_internal.c
+++ b/tools/libs/light/libxl_internal.c
@@ -204,7 +204,7 @@ char *libxl__strndup(libxl__gc *gc, const char *c, size_t n)
 
 char *libxl__dirname(libxl__gc *gc, const char *s)
 {
-    char *c = strrchr(s, '/');
+    const char *c = strrchr(s, '/');
 
     if (!c)
         return NULL;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.20


From xen-changelog-bounces@lists.xenproject.org Fri Mar 06 15:34:34 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Mar 2026 15:34:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1247864.1546275 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vyXCE-0002mx-0R; Fri, 06 Mar 2026 15:34:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1247864.1546275; Fri, 06 Mar 2026 15:34:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vyXCD-0002mp-U2; Fri, 06 Mar 2026 15:34:33 +0000
Received: by outflank-mailman (input) for mailman id 1247864;
 Fri, 06 Mar 2026 15:34:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vyXCC-0002mj-U3
 for xen-changelog@lists.xenproject.org; Fri, 06 Mar 2026 15:34:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vyXCC-008J3k-2v
 for xen-changelog@lists.xenproject.org;
 Fri, 06 Mar 2026 15:34:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vyXCC-00269H-2p
 for xen-changelog@lists.xenproject.org;
 Fri, 06 Mar 2026 15:34:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Fhcw5WBc09LreeMJJjzvvBw1PVjw7KaQJ8hROcsMbC0=; b=HeQb127iV31qoxFYqW1U+W5Cp+
	xbrkQdc2b2wyWZHcReRveU/yn/qIo3i2kRbHB7KmKQL9g/w8q1QsHkgN0ALyGZIK7owjKv0zLi/i4
	nwqofu1dj98sSeV2KuWEVx4qOqbrbO5pJSoCGodLJeTB8CXlFYfPV2z9MRaiLl09NH1U=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.20] tools/sd-notify.h: Include string.h too
Message-Id: <E1vyXCC-00269H-2p@xenbits.xenproject.org>
Date: Fri, 06 Mar 2026 15:34:32 +0000

commit 27bf8182dbec433ecdd9b5e1e580f72b2fae7229
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Dec 5 21:33:25 2025 +0000
Commit:     Anthony PERARD <anthony.perard@vates.tech>
CommitDate: Fri Mar 6 14:49:09 2026 +0100

    tools/sd-notify.h: Include string.h too
    
    Alpine Linux, when using --enable-systemd to get the init files, fails with:
    
      tools/include/xen-sd-notify.h:69:3: error: call to undeclared library
      function 'memcpy' with type 'void *(void *, const void *, unsigned long)';
      ISO C99 and later do not support implicit function declarations
      [-Wimplicit-function-declaration]
         69 |   memcpy(socket_addr.sun.sun_path, socket_path, path_length);
            |   ^
    
    This will be down to using musl rather than glibc.  Include the appropriate
    header.
    
    Fixes: 78510f3a1522 ("tools: Import stand-alone sd_notify() implementation from systemd")
    Reported-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Acked-by: Anthony PERARD <anthony.perard@vates.tech>
    (cherry picked from commit 8efff5a69ab7596f6c63031d0aef292114948cd9)
---
 tools/include/xen-sd-notify.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/include/xen-sd-notify.h b/tools/include/xen-sd-notify.h
index 28c9b20f15..20441d0ec9 100644
--- a/tools/include/xen-sd-notify.h
+++ b/tools/include/xen-sd-notify.h
@@ -20,6 +20,7 @@
 #include <errno.h>
 #include <stddef.h>
 #include <stdlib.h>
+#include <string.h>
 #include <sys/socket.h>
 #include <sys/un.h>
 #include <unistd.h>
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.20


From xen-changelog-bounces@lists.xenproject.org Fri Mar 06 15:34:44 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Mar 2026 15:34:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1247865.1546280 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vyXCO-0002oz-1h; Fri, 06 Mar 2026 15:34:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1247865.1546280; Fri, 06 Mar 2026 15:34:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vyXCN-0002or-VP; Fri, 06 Mar 2026 15:34:43 +0000
Received: by outflank-mailman (input) for mailman id 1247865;
 Fri, 06 Mar 2026 15:34:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vyXCN-0002oj-29
 for xen-changelog@lists.xenproject.org; Fri, 06 Mar 2026 15:34:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vyXCM-008J3q-3B
 for xen-changelog@lists.xenproject.org;
 Fri, 06 Mar 2026 15:34:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vyXCM-0026Ag-35
 for xen-changelog@lists.xenproject.org;
 Fri, 06 Mar 2026 15:34:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=0xV4rN0EkOU3KnTP/8cvXNMwRCjIQ03uItfiJVXOrcY=; b=HLbNx+WfcBSe/SkxqLrJLwbwWQ
	cp8xGrIOd3+NEDSVB9FpmNnpYAstMfe0eiHT+ncfIbVi9P0lcLYAhv2F0U3GNJIcrCdQEEMPNivM6
	IeNcVtV4uXXKbmE+BzJmKZ7WQ6/6+WN+9G9zAmcTf5xVOO3ApdccSIItglMX0JzTE1hE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.20] tools/ocaml: fix 32-bit truncation bug in stub_xc_domain_setmaxmem()
Message-Id: <E1vyXCM-0026Ag-35@xenbits.xenproject.org>
Date: Fri, 06 Mar 2026 15:34:42 +0000

commit f833d29a3af7708b30b6076ed5c48c12481914ef
Author:     Edwin Török <edwin.torok@citrix.com>
AuthorDate: Thu Feb 5 13:56:45 2026 +0000
Commit:     Anthony PERARD <anthony.perard@vates.tech>
CommitDate: Fri Mar 6 15:02:04 2026 +0100

    tools/ocaml: fix 32-bit truncation bug in stub_xc_domain_setmaxmem()
    
    Observed when attempting to boot a >4TiB VM:
    
    After a call to domain_setmaxmem with 6370254848 (KiB), the domain's maxmem
    got set to 2075287552, which is exactly 2^32 smaller.
    
    xc_domain_setmaxmem takes an uint64_t as a parameter, and the OCaml value
    is 64-bit already, so fix the C variable to match the type and avoid the
    truncation.
    
    Fixes: f5b43e95facd ("libxl: fix "xl mem-set" regression from 0c029c4da2")
    Signed-off-by: Edwin Török <edwin.torok@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@cloud.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    (cherry picked from commit 381b4ff16f7ff83a2dc44f16b8dd0208f3255ec7)
---
 tools/ocaml/libs/xc/xenctrl_stubs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/ocaml/libs/xc/xenctrl_stubs.c b/tools/ocaml/libs/xc/xenctrl_stubs.c
index 863ab3c778..90353ec89d 100644
--- a/tools/ocaml/libs/xc/xenctrl_stubs.c
+++ b/tools/ocaml/libs/xc/xenctrl_stubs.c
@@ -934,7 +934,7 @@ CAMLprim value stub_xc_domain_setmaxmem(value xch_val, value domid,
 	int retval;
 
 	uint32_t c_domid = Int_val(domid);
-	unsigned int c_max_memkb = Int64_val(max_memkb);
+	uint64_t c_max_memkb = Int64_val(max_memkb);
 	caml_enter_blocking_section();
 	retval = xc_domain_setmaxmem(xch, c_domid, c_max_memkb);
 	caml_leave_blocking_section();
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.20


From xen-changelog-bounces@lists.xenproject.org Mon Mar 09 13:22:13 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 09 Mar 2026 13:22:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1249489.1546939 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzaYn-0007nr-A3; Mon, 09 Mar 2026 13:22:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1249489.1546939; Mon, 09 Mar 2026 13:22:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzaYn-0007ng-7J; Mon, 09 Mar 2026 13:22:13 +0000
Received: by outflank-mailman (input) for mailman id 1249489;
 Mon, 09 Mar 2026 13:22:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vzaYm-0007nU-26
 for xen-changelog@lists.xenproject.org; Mon, 09 Mar 2026 13:22:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzaYm-0003j5-0Z
 for xen-changelog@lists.xenproject.org;
 Mon, 09 Mar 2026 13:22:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzaYl-000BHx-2Z
 for xen-changelog@lists.xenproject.org;
 Mon, 09 Mar 2026 13:22:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=EEO9ZeExsLkZCRujxVcKzUT9iCt1DLrqNHADm7NEt80=; b=beBjwNBCP0hjZmqZkbDV1cyyC0
	Hb7qM7m9mukA5Yb9Aoqimsuf6QozuDpH2iRFZdnFudY5XI1/bh45Q4kB/jE+zjeW8JRyd0FAFc9vV
	CBwF6fcP6Bt+NSFeGJ4pUhzv5pL5ygrb9aDWDC9XPyZw1mdAVPZa7PzMGQ+CAKHKmNIk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.21] tools/xenstored: fix live update
Message-Id: <E1vzaYl-000BHx-2Z@xenbits.xenproject.org>
Date: Mon, 09 Mar 2026 13:22:11 +0000

commit 8061625411b4bc921a1701bd09457500713a782b
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Tue Feb 17 11:46:29 2026 +0100
Commit:     Anthony PERARD <anthony.perard@vates.tech>
CommitDate: Fri Mar 6 11:02:35 2026 +0100

    tools/xenstored: fix live update
    
    Commit e5b0a940557 ("tools/xenstored: Auto-introduce domains") broke
    xenstored live update, as init_domains() will be skipped when live
    update is detected to have happened. This will leave priv_domid and
    store_domid set as invalid.
    
    Fix that by calling init_domains() in live update case, too. In case
    of live update skip introducing any found domains, as this will be done
    when reading the live update state.
    
    Fixes: e5b0a940557 ("tools/xenstored: Auto-introduce domains")
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
    (cherry picked from commit ebf99a162718c4d858d0c997b9dcf1a502c7256e)
---
 tools/xenstored/core.c   |  3 ++-
 tools/xenstored/domain.c | 20 +++++++++++++-------
 tools/xenstored/domain.h |  2 +-
 3 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/tools/xenstored/core.c b/tools/xenstored/core.c
index 64c478a801..d509736c32 100644
--- a/tools/xenstored/core.c
+++ b/tools/xenstored/core.c
@@ -2763,7 +2763,7 @@ int main(int argc, char *argv[])
 	/* Listen to hypervisor. */
 	if (!live_update) {
 		domain_init(-1);
-		init_domains();
+		init_domains(false);
 	}
 
 	/* redirect to /dev/null now we're ready to accept connections */
@@ -3109,6 +3109,7 @@ void read_state_global(const void *ctx, const void *state)
 	set_socket_fd(glb->socket_fd);
 
 	domain_init(glb->evtchn_fd);
+	init_domains(true);
 }
 
 static void add_buffered_data(struct buffered_data *bdata,
diff --git a/tools/xenstored/domain.c b/tools/xenstored/domain.c
index 5ce539d640..a53b611d34 100644
--- a/tools/xenstored/domain.c
+++ b/tools/xenstored/domain.c
@@ -1344,7 +1344,7 @@ static bool init_domain(unsigned int domid)
 
 	return true;
 }
-void init_domains(void)
+void init_domains(bool live_update)
 {
 	unsigned int *domids = NULL;
 	unsigned int nr_domids = 0;
@@ -1356,12 +1356,15 @@ void init_domains(void)
 
 	while (!xenmanage_poll_changed_domain(xm_handle, &domid, &state, &caps,
 					      &unique_id)) {
-		nr_domids++;
-		domids = talloc_realloc(NULL, domids, unsigned int, nr_domids);
-		if (!domids)
-			barf_perror("Failed to reallocate domids");
-
-		domids[nr_domids - 1] = domid;
+		if (!live_update) {
+			nr_domids++;
+			domids = talloc_realloc(NULL, domids,
+						unsigned int, nr_domids);
+			if (!domids)
+				barf_perror("Failed to reallocate domids");
+
+			domids[nr_domids - 1] = domid;
+		}
 
 		if (caps & XENMANAGE_GETDOMSTATE_CAP_CONTROL) {
 			/*
@@ -1391,6 +1394,9 @@ void init_domains(void)
 	snprintf(store_domain_path, sizeof(store_domain_path),
 		 "/local/domain/%u", store_domid);
 
+	if (live_update)
+		return;
+
 	/*
 	 * Privileged domid must be first to setup structures for firing the
 	 * special watches.
diff --git a/tools/xenstored/domain.h b/tools/xenstored/domain.h
index 3b1fce74cf..28186ccac0 100644
--- a/tools/xenstored/domain.h
+++ b/tools/xenstored/domain.h
@@ -92,7 +92,7 @@ int do_set_feature(const void *ctx, struct connection *conn,
 
 void domain_early_init(void);
 void domain_init(int evtfd);
-void init_domains(void);
+void init_domains(bool live_update);
 void stubdom_init(bool live_update);
 void domain_deinit(void);
 void ignore_connection(struct connection *conn, unsigned int err);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.21


From xen-changelog-bounces@lists.xenproject.org Mon Mar 09 13:22:13 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 09 Mar 2026 13:22:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1249488.1546934 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzaYd-0007mF-8W; Mon, 09 Mar 2026 13:22:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1249488.1546934; Mon, 09 Mar 2026 13:22:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzaYd-0007m7-5y; Mon, 09 Mar 2026 13:22:03 +0000
Received: by outflank-mailman (input) for mailman id 1249488;
 Mon, 09 Mar 2026 13:22:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vzaYb-0007m0-QY
 for xen-changelog@lists.xenproject.org; Mon, 09 Mar 2026 13:22:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzaYb-0003im-34
 for xen-changelog@lists.xenproject.org;
 Mon, 09 Mar 2026 13:22:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzaYb-000BH4-1j
 for xen-changelog@lists.xenproject.org;
 Mon, 09 Mar 2026 13:22:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=CyxzRJgmE5HZ2K1lah62GLbBCFd8sndsXtfgRL4MWfM=; b=UPKTlbqxYUNvuQP5hsskoOjKWp
	2OFoijfcQo23Me9D+VBbHqszVLWuZUCJU9k3S4V9NQ5OcCSCGjBHRDsg8wvOJKEyBO/UMx6WoTOVH
	0v8TzNEr3CKr6Yti2G+6JYD2eyGcS4AEfis55AAX+qe2GoZLI+90HFmZpnolKE+IFkBk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.21] libxl: Fix device_add QMP calls with QEMU 9.2 and newer
Message-Id: <E1vzaYb-000BH4-1j@xenbits.xenproject.org>
Date: Mon, 09 Mar 2026 13:22:01 +0000

commit 6adc1004f7e92374a52d70f08ff60071fb6d7416
Author:     Anthony PERARD <anthony.perard@vates.tech>
AuthorDate: Mon Dec 15 14:51:24 2025 +0100
Commit:     Anthony PERARD <anthony.perard@vates.tech>
CommitDate: Fri Mar 6 10:56:40 2026 +0100

    libxl: Fix device_add QMP calls with QEMU 9.2 and newer
    
    QEMU used to ignore JSON types and do conversion string <-> integer
    automatically for the command "device_add", but that was removed in
    QEMU 9.2 (428d1789df91 ("docs/about: Belatedly document tightening of
    QMP device_add checking")).
    
    Fixes: 9718ab394d5d ("libxl_usb: Make libxl__device_usbctrl_add uses ev_qmp")
    Fixes: 40c7eca10a82 ("libxl_usb: Make libxl__device_usbdev_add uses ev_qmp")
    Signed-off-by: Anthony PERARD <anthony.perard@vates.tech>
    Tested-by: Maximilian Engelhardt <maxi@daemonizer.de>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    (cherry picked from commit 85e12104f47276b588d5efd33599c987c545eeb1)
---
 tools/libs/light/libxl_usb.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/tools/libs/light/libxl_usb.c b/tools/libs/light/libxl_usb.c
index c5ae59681c..4e7c409fe6 100644
--- a/tools/libs/light/libxl_usb.c
+++ b/tools/libs/light/libxl_usb.c
@@ -367,10 +367,10 @@ static int libxl__device_usbctrl_add_hvm(libxl__egc *egc, libxl__ev_qmp *qmp,
     case 3:
         libxl__qmp_param_add_string(gc, &qmp_args,
                                     "driver", "nec-usb-xhci");
-        libxl__qmp_param_add_string(gc, &qmp_args, "p2",
-                                    GCSPRINTF("%d", usbctrl->ports));
-        libxl__qmp_param_add_string(gc, &qmp_args, "p3",
-                                    GCSPRINTF("%d", usbctrl->ports));
+        libxl__qmp_param_add_integer(gc, &qmp_args, "p2",
+                                     usbctrl->ports);
+        libxl__qmp_param_add_integer(gc, &qmp_args, "p3",
+                                     usbctrl->ports);
         break;
     default:
         abort(); /* Should not be possible. */
@@ -411,10 +411,10 @@ static int libxl__device_usbdev_add_hvm(libxl__egc *egc, libxl__ev_qmp *qmp,
         GCSPRINTF("xenusb-%d.0", usbdev->ctrl));
     libxl__qmp_param_add_string(gc, &qmp_args, "port",
         GCSPRINTF("%d", usbdev->port));
-    libxl__qmp_param_add_string(gc, &qmp_args, "hostbus",
-        GCSPRINTF("%d", usbdev->u.hostdev.hostbus));
-    libxl__qmp_param_add_string(gc, &qmp_args, "hostaddr",
-        GCSPRINTF("%d", usbdev->u.hostdev.hostaddr));
+    libxl__qmp_param_add_integer(gc, &qmp_args, "hostbus",
+                                 usbdev->u.hostdev.hostbus);
+    libxl__qmp_param_add_integer(gc, &qmp_args, "hostaddr",
+                                 usbdev->u.hostdev.hostaddr);
 
     return libxl__ev_qmp_send(egc, qmp, "device_add", qmp_args);
 }
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.21


From xen-changelog-bounces@lists.xenproject.org Mon Mar 09 13:22:24 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 09 Mar 2026 13:22:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1249490.1546942 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzaYy-0007rx-B8; Mon, 09 Mar 2026 13:22:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1249490.1546942; Mon, 09 Mar 2026 13:22:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzaYy-0007rq-8g; Mon, 09 Mar 2026 13:22:24 +0000
Received: by outflank-mailman (input) for mailman id 1249490;
 Mon, 09 Mar 2026 13:22:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vzaYw-0007ra-8h
 for xen-changelog@lists.xenproject.org; Mon, 09 Mar 2026 13:22:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzaYw-0003jF-16
 for xen-changelog@lists.xenproject.org;
 Mon, 09 Mar 2026 13:22:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzaYw-000BKa-04
 for xen-changelog@lists.xenproject.org;
 Mon, 09 Mar 2026 13:22:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=VsrANpE6c6M6ObGmGJe6X/2Rbiba295Od4W28Pj7zpc=; b=a17QAmYfcGrTXxIBFjGT+i2v1M
	p5lBCIYIhGpiolgCMa8/r16AY6xlwKIiQ/ZYolez2j0aO4St/qvCtFIrDj9s5qi/3iibTPDH8QFh4
	0InaJR16SHvxeXqrObrZQXbXBwNQfElFfdVWxnHs1ywCqHDq9mBY4j2eyuik9BWMNkfo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.21] libxl: constify some local variables for building with glibc 2.43
Message-Id: <E1vzaYw-000BKa-04@xenbits.xenproject.org>
Date: Mon, 09 Mar 2026 13:22:22 +0000

commit 4a7d2f18e5668e3060538f492968566b79dc9181
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Thu Feb 26 13:31:48 2026 +0100
Commit:     Anthony PERARD <anthony.perard@vates.tech>
CommitDate: Fri Mar 6 11:03:36 2026 +0100

    libxl: constify some local variables for building with glibc 2.43
    
    Archlinux just updated glibc to 2.43+r5+g856c426a7534-1 and that
    causes libxl build failure:
    
        libxl_cpuid.c: In function ‘libxl_cpuid_parse_config_xend’:
        libxl_cpuid.c:447:16: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
          447 |         endptr = strchr(str, '=');
              |                ^
        libxl_cpuid.c:452:16: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
          452 |         endptr = strchr(str, ',');
              |                ^
        libxl_cpuid.c:454:20: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
          454 |             endptr = strchr(str, 0);
              |                    ^
        cc1: all warnings being treated as errors
    
    Add missing consts. Note in libxl_cpuid_parse_config_xend() non-const
    endptr still is needed, to be compatible with the second argument to
    strtoul(). Add second variable for this reason.
    
    And while at it, move semicolon to its own line
    
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Anthony PERARD <anthony.perard@vates.tech>
    (cherry picked from commit 44da0e3b4ff7fa15ad28b628f57412a05dae653c)
---
 tools/libs/light/libxl_cpuid.c    | 21 ++++++++++++---------
 tools/libs/light/libxl_internal.c |  2 +-
 2 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/tools/libs/light/libxl_cpuid.c b/tools/libs/light/libxl_cpuid.c
index 8420b2465f..14f08df33a 100644
--- a/tools/libs/light/libxl_cpuid.c
+++ b/tools/libs/light/libxl_cpuid.c
@@ -440,29 +440,32 @@ int libxl_cpuid_parse_config_xend(libxl_cpuid_policy_list *policy,
     str = endptr + 1;
     entry = cpuid_find_match(policy, leaf, subleaf);
     for (str = endptr + 1; *str != 0;) {
+        const char *endptrc;
+
         if (str[0] != 'e' || str[2] != 'x') {
             return 4;
         }
         value = str[1] - 'a';
-        endptr = strchr(str, '=');
-        if (value > 3 || endptr == NULL) {
+        endptrc = strchr(str, '=');
+        if (value > 3 || endptrc == NULL) {
             return 4;
         }
-        str = endptr + 1;
-        endptr = strchr(str, ',');
-        if (endptr == NULL) {
-            endptr = strchr(str, 0);
+        str = endptrc + 1;
+        endptrc = strchr(str, ',');
+        if (endptrc == NULL) {
+            endptrc = strchr(str, 0);
         }
-        if (endptr - str != 32) {
+        if (endptrc - str != 32) {
             return 5;
         }
         entry->policy[value] = calloc(32 + 1, 1);
         strncpy(entry->policy[value], str, 32);
         entry->policy[value][32] = 0;
-        if (*endptr == 0) {
+        if (*endptrc == 0) {
             break;
         }
-        for (str = endptr + 1; *str == ' ' || *str == '\n'; str++);
+        for (str = endptrc + 1; *str == ' ' || *str == '\n'; str++)
+            ;
     }
     return 0;
 }
diff --git a/tools/libs/light/libxl_internal.c b/tools/libs/light/libxl_internal.c
index 2941ca0bbd..d70cfed7d8 100644
--- a/tools/libs/light/libxl_internal.c
+++ b/tools/libs/light/libxl_internal.c
@@ -204,7 +204,7 @@ char *libxl__strndup(libxl__gc *gc, const char *c, size_t n)
 
 char *libxl__dirname(libxl__gc *gc, const char *s)
 {
-    char *c = strrchr(s, '/');
+    const char *c = strrchr(s, '/');
 
     if (!c)
         return NULL;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.21


From xen-changelog-bounces@lists.xenproject.org Mon Mar 09 13:22:33 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 09 Mar 2026 13:22:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1249491.1546946 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzaZ7-0007u8-Ct; Mon, 09 Mar 2026 13:22:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1249491.1546946; Mon, 09 Mar 2026 13:22:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzaZ7-0007u1-AE; Mon, 09 Mar 2026 13:22:33 +0000
Received: by outflank-mailman (input) for mailman id 1249491;
 Mon, 09 Mar 2026 13:22:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vzaZ6-0007tt-9a
 for xen-changelog@lists.xenproject.org; Mon, 09 Mar 2026 13:22:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzaZ6-0003jb-1Y
 for xen-changelog@lists.xenproject.org;
 Mon, 09 Mar 2026 13:22:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzaZ6-000BLL-0a
 for xen-changelog@lists.xenproject.org;
 Mon, 09 Mar 2026 13:22:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=PSI63XK0YMz01U/+W93WpTTIlVpuz8ZpuO6WOcUwEj0=; b=eXSQhrAdx0EhbZXRR7yEw2bYLv
	gsqxSlcoP6tZ/HDhoEA4TgoS3SaCVV6zaBAm1+wTdTNX7HEVBUGFV0OVCSTsj7CMQYmOkwXrKtkYi
	h99BFq4u2npHgm30KsWZit5yTyp4hH2llJ2DueR2N+stx4vXEfYisiXckDTxQkS9vdAg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.21] xenstored: Add newline to error message
Message-Id: <E1vzaZ6-000BLL-0a@xenbits.xenproject.org>
Date: Mon, 09 Mar 2026 13:22:32 +0000

commit 52356ca6551ec5a952165f2fcdb308f7f897420e
Author:     Jason Andryuk <jason.andryuk@amd.com>
AuthorDate: Tue Nov 25 10:25:08 2025 +0100
Commit:     Anthony PERARD <anthony.perard@vates.tech>
CommitDate: Fri Mar 6 14:41:22 2026 +0100

    xenstored: Add newline to error message
    
    Unlike barf(), xprintf() does not add a newline.  Add one.
    
    Fixes: e5b0a9405571 ("tools/xenstored: Auto-introduce domains")
    Signed-off-by: Jason Andryuk <jason.andryuk@amd.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    (cherry picked from commit 9c68f5e90c223d16418aeb3783b2e5123d2071a3)
---
 tools/xenstored/domain.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/xenstored/domain.c b/tools/xenstored/domain.c
index a53b611d34..3641f58be2 100644
--- a/tools/xenstored/domain.c
+++ b/tools/xenstored/domain.c
@@ -1333,7 +1333,7 @@ static bool init_domain(unsigned int domid)
 
 	domain = introduce_domain(NULL, domid, port, false);
 	if (!domain) {
-		xprintf("Could not initialize dom%u", domid);
+		xprintf("Could not initialize dom%u\n", domid);
 		return false;
 	}
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.21


From xen-changelog-bounces@lists.xenproject.org Mon Mar 09 13:22:43 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 09 Mar 2026 13:22:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1249492.1546951 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzaZH-0007wG-Ek; Mon, 09 Mar 2026 13:22:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1249492.1546951; Mon, 09 Mar 2026 13:22:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzaZH-0007w9-Bk; Mon, 09 Mar 2026 13:22:43 +0000
Received: by outflank-mailman (input) for mailman id 1249492;
 Mon, 09 Mar 2026 13:22:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vzaZG-0007w1-EY
 for xen-changelog@lists.xenproject.org; Mon, 09 Mar 2026 13:22:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzaZG-0003jg-1s
 for xen-changelog@lists.xenproject.org;
 Mon, 09 Mar 2026 13:22:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzaZG-000BM1-15
 for xen-changelog@lists.xenproject.org;
 Mon, 09 Mar 2026 13:22:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=vXazqUrCFKBEt2rgJBVfiOobuNQ9hw4PCDCglZtcNGc=; b=66bZI3mGt8GoU7KUbSaL+DTeN4
	WV9C054IrBnOafPOqGY/5FuXEr7z9hozkSowS7MXkJJGareQMS9+PLhPYsMs0S/8bAbfFba1F10Vx
	NygJSOG2jfM9iRsC3DKSisagikOY4qEKNVM1H9psw8y1y15zt60qzLnuWO7XO4SGD8tE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.21] systemd: fall back to default system-sleep dir without systemd-devel
Message-Id: <E1vzaZG-000BM1-15@xenbits.xenproject.org>
Date: Mon, 09 Mar 2026 13:22:42 +0000

commit 76dc2d60719f28714b68c47d0a72c0844fa7b053
Author:     Mykola Kvach <mykola_kvach@epam.com>
AuthorDate: Fri Dec 5 18:07:15 2025 +0200
Commit:     Anthony PERARD <anthony.perard@vates.tech>
CommitDate: Fri Mar 6 14:42:24 2026 +0100

    systemd: fall back to default system-sleep dir without systemd-devel
    
    Keep the pkg-config lookup for SYSTEMD_SLEEP_DIR, but fall back to
    "$(prefix)/lib/systemd/system-sleep/" if the variable remains unset.
    This avoids reintroducing a build-time dependency on systemd-devel while
    still honoring the path provided by pkg-config when present.
    
    Fixes: e54a6cd6a1f3 ("systemd: Add hooks to stop/start xen-watchdog on suspend/resume")
    Reported-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Mykola Kvach <mykola_kvach@epam.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    (cherry picked from commit b34bde262c8cf69fa235045108a0bc0309c63eac)
---
 m4/systemd.m4   | 2 +-
 tools/configure | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/m4/systemd.m4 b/m4/systemd.m4
index c47a25ef93..5fb5a7089e 100644
--- a/m4/systemd.m4
+++ b/m4/systemd.m4
@@ -81,7 +81,7 @@ AC_DEFUN([AX_CHECK_SYSTEMD_LIBS], [
 	], [])
 
 	AS_IF([test "x$SYSTEMD_SLEEP_DIR" = x], [
-	    AC_MSG_ERROR([SYSTEMD_SLEEP_DIR is unset])
+	    SYSTEMD_SLEEP_DIR="\$(prefix)/lib/systemd/system-sleep/"
 	], [])
 ])
 
diff --git a/tools/configure b/tools/configure
index d460f25529..d6b3487737 100755
--- a/tools/configure
+++ b/tools/configure
@@ -10360,7 +10360,7 @@ fi
 	if test "x$SYSTEMD_SLEEP_DIR" = x
 then :
 
-	    as_fn_error $? "SYSTEMD_SLEEP_DIR is unset" "$LINENO" 5
+	    SYSTEMD_SLEEP_DIR="\$(prefix)/lib/systemd/system-sleep/"
 
 fi
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.21


From xen-changelog-bounces@lists.xenproject.org Mon Mar 09 13:22:53 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 09 Mar 2026 13:22:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1249493.1546956 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzaZR-0007yM-Ga; Mon, 09 Mar 2026 13:22:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1249493.1546956; Mon, 09 Mar 2026 13:22:53 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzaZR-0007yE-DJ; Mon, 09 Mar 2026 13:22:53 +0000
Received: by outflank-mailman (input) for mailman id 1249493;
 Mon, 09 Mar 2026 13:22:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vzaZQ-0007y6-Fc
 for xen-changelog@lists.xenproject.org; Mon, 09 Mar 2026 13:22:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzaZQ-0003jo-2A
 for xen-changelog@lists.xenproject.org;
 Mon, 09 Mar 2026 13:22:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzaZQ-000BMi-1M
 for xen-changelog@lists.xenproject.org;
 Mon, 09 Mar 2026 13:22:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=D3A/c7+h/KI2LzNYwrvWnwrgfxkteJKL6tAxKa5gVYw=; b=rSn2kCr8bVXwa/ERlJtlh+a22Y
	sEhYDd9YJw7Y6tsALeSyPQY6dVWO8U+LbO26GpjLbD0h/GBZvSbE8lklGH/cf2EO7iDis8uHhvPMG
	6YjSeNmMkWjtYgfxEEqGd60D8skYXZ5plNPsVbT+hxXBnhFLzDgJtMnoXLFqo0WRuYrg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.21] tools/sd-notify.h: Include string.h too
Message-Id: <E1vzaZQ-000BMi-1M@xenbits.xenproject.org>
Date: Mon, 09 Mar 2026 13:22:52 +0000

commit 18796375054498bba8a85def2f42876586fc4b8f
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Dec 5 21:33:25 2025 +0000
Commit:     Anthony PERARD <anthony.perard@vates.tech>
CommitDate: Fri Mar 6 14:42:52 2026 +0100

    tools/sd-notify.h: Include string.h too
    
    Alpine Linux, when using --enable-systemd to get the init files, fails with:
    
      tools/include/xen-sd-notify.h:69:3: error: call to undeclared library
      function 'memcpy' with type 'void *(void *, const void *, unsigned long)';
      ISO C99 and later do not support implicit function declarations
      [-Wimplicit-function-declaration]
         69 |   memcpy(socket_addr.sun.sun_path, socket_path, path_length);
            |   ^
    
    This will be down to using musl rather than glibc.  Include the appropriate
    header.
    
    Fixes: 78510f3a1522 ("tools: Import stand-alone sd_notify() implementation from systemd")
    Reported-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Acked-by: Anthony PERARD <anthony.perard@vates.tech>
    (cherry picked from commit 8efff5a69ab7596f6c63031d0aef292114948cd9)
---
 tools/include/xen-sd-notify.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/include/xen-sd-notify.h b/tools/include/xen-sd-notify.h
index 28c9b20f15..20441d0ec9 100644
--- a/tools/include/xen-sd-notify.h
+++ b/tools/include/xen-sd-notify.h
@@ -20,6 +20,7 @@
 #include <errno.h>
 #include <stddef.h>
 #include <stdlib.h>
+#include <string.h>
 #include <sys/socket.h>
 #include <sys/un.h>
 #include <unistd.h>
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.21


From xen-changelog-bounces@lists.xenproject.org Mon Mar 09 13:23:03 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 09 Mar 2026 13:23:03 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1249494.1546959 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzaZb-00080S-HP; Mon, 09 Mar 2026 13:23:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1249494.1546959; Mon, 09 Mar 2026 13:23:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzaZb-00080K-Ej; Mon, 09 Mar 2026 13:23:03 +0000
Received: by outflank-mailman (input) for mailman id 1249494;
 Mon, 09 Mar 2026 13:23:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vzaZa-000808-IO
 for xen-changelog@lists.xenproject.org; Mon, 09 Mar 2026 13:23:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzaZa-0003k6-2Q
 for xen-changelog@lists.xenproject.org;
 Mon, 09 Mar 2026 13:23:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzaZa-000BNQ-1e
 for xen-changelog@lists.xenproject.org;
 Mon, 09 Mar 2026 13:23:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=oiu/R5exxYWmi7QAsQG6J9OY0ukDvn3oYw1apfkIDBc=; b=oAb7UVUewFeLYqxMYxNbISWZyk
	ANmkv2DQLZKfAOn0+IbgSi3yjq6pDZfjnUOO7Zt7rOc3LFZrD9o6qNd3U4CYXBQ3ZFp5TSnAKM71q
	MLT/J8JrJqX8nSO4nZsFvXMBXYCbmzJPfuy9NaN3WYHVLNusb9IcWUlNZ0yAlAETwFlE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.21] tools/ocaml: fix 32-bit truncation bug in stub_xc_domain_setmaxmem()
Message-Id: <E1vzaZa-000BNQ-1e@xenbits.xenproject.org>
Date: Mon, 09 Mar 2026 13:23:02 +0000

commit e10f3ad8694cde2c0e8a81c3825e32ecc630a51c
Author:     Edwin Török <edwin.torok@citrix.com>
AuthorDate: Thu Feb 5 13:56:45 2026 +0000
Commit:     Anthony PERARD <anthony.perard@vates.tech>
CommitDate: Fri Mar 6 15:02:01 2026 +0100

    tools/ocaml: fix 32-bit truncation bug in stub_xc_domain_setmaxmem()
    
    Observed when attempting to boot a >4TiB VM:
    
    After a call to domain_setmaxmem with 6370254848 (KiB), the domain's maxmem
    got set to 2075287552, which is exactly 2^32 smaller.
    
    xc_domain_setmaxmem takes an uint64_t as a parameter, and the OCaml value
    is 64-bit already, so fix the C variable to match the type and avoid the
    truncation.
    
    Fixes: f5b43e95facd ("libxl: fix "xl mem-set" regression from 0c029c4da2")
    Signed-off-by: Edwin Török <edwin.torok@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@cloud.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    (cherry picked from commit 381b4ff16f7ff83a2dc44f16b8dd0208f3255ec7)
---
 tools/ocaml/libs/xc/xenctrl_stubs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/ocaml/libs/xc/xenctrl_stubs.c b/tools/ocaml/libs/xc/xenctrl_stubs.c
index ac2a7537d6..c55f73b265 100644
--- a/tools/ocaml/libs/xc/xenctrl_stubs.c
+++ b/tools/ocaml/libs/xc/xenctrl_stubs.c
@@ -947,7 +947,7 @@ CAMLprim value stub_xc_domain_setmaxmem(value xch_val, value domid,
 	int retval;
 
 	uint32_t c_domid = Int_val(domid);
-	unsigned int c_max_memkb = Int64_val(max_memkb);
+	uint64_t c_max_memkb = Int64_val(max_memkb);
 	caml_enter_blocking_section();
 	retval = xc_domain_setmaxmem(xch, c_domid, c_max_memkb);
 	caml_leave_blocking_section();
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.21


From xen-changelog-bounces@lists.xenproject.org Mon Mar 09 14:11:07 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 09 Mar 2026 14:11:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1249521.1546984 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzbK4-0006Uc-Dh; Mon, 09 Mar 2026 14:11:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1249521.1546984; Mon, 09 Mar 2026 14:11:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzbK4-0006UU-Au; Mon, 09 Mar 2026 14:11:04 +0000
Received: by outflank-mailman (input) for mailman id 1249521;
 Mon, 09 Mar 2026 14:11:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vzbK2-0006UO-EQ
 for xen-changelog@lists.xenproject.org; Mon, 09 Mar 2026 14:11:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzbK2-0004k2-1i
 for xen-changelog@lists.xenproject.org;
 Mon, 09 Mar 2026 14:11:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzbK2-000EnE-0t
 for xen-changelog@lists.xenproject.org;
 Mon, 09 Mar 2026 14:11:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=TyWzy6Cdukg4FZvjm8J0dlIbS/4yESSIrraIShAsv0Y=; b=62sPaSmAxp+HW0E1pAbssXnfV+
	Yq9Vbj2nFwjsZffuGwMJQWURgv8Z59py8IiPbVwZDRqU7o1czP7PWTGKeCYDx1mZdKJHpqPHTB7QK
	9jVmRbly9M+7pJoCxfkXszMFTof96Ju2fR4yaLMrYJwfN5bGJvL4DjyjUYLcpXe+qVVs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.20] libxl: Fix device_add QMP calls with QEMU 9.2 and newer
Message-Id: <E1vzbK2-000EnE-0t@xenbits.xenproject.org>
Date: Mon, 09 Mar 2026 14:11:02 +0000

commit ac333dd662e18e86ffd2afd6c10e04305c9d137b
Author:     Anthony PERARD <anthony.perard@vates.tech>
AuthorDate: Mon Dec 15 14:51:24 2025 +0100
Commit:     Anthony PERARD <anthony.perard@vates.tech>
CommitDate: Fri Mar 6 14:47:24 2026 +0100

    libxl: Fix device_add QMP calls with QEMU 9.2 and newer
    
    QEMU used to ignore JSON types and do conversion string <-> integer
    automatically for the command "device_add", but that was removed in
    QEMU 9.2 (428d1789df91 ("docs/about: Belatedly document tightening of
    QMP device_add checking")).
    
    Fixes: 9718ab394d5d ("libxl_usb: Make libxl__device_usbctrl_add uses ev_qmp")
    Fixes: 40c7eca10a82 ("libxl_usb: Make libxl__device_usbdev_add uses ev_qmp")
    Signed-off-by: Anthony PERARD <anthony.perard@vates.tech>
    Tested-by: Maximilian Engelhardt <maxi@daemonizer.de>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    (cherry picked from commit 85e12104f47276b588d5efd33599c987c545eeb1)
---
 tools/libs/light/libxl_usb.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/tools/libs/light/libxl_usb.c b/tools/libs/light/libxl_usb.c
index c5ae59681c..4e7c409fe6 100644
--- a/tools/libs/light/libxl_usb.c
+++ b/tools/libs/light/libxl_usb.c
@@ -367,10 +367,10 @@ static int libxl__device_usbctrl_add_hvm(libxl__egc *egc, libxl__ev_qmp *qmp,
     case 3:
         libxl__qmp_param_add_string(gc, &qmp_args,
                                     "driver", "nec-usb-xhci");
-        libxl__qmp_param_add_string(gc, &qmp_args, "p2",
-                                    GCSPRINTF("%d", usbctrl->ports));
-        libxl__qmp_param_add_string(gc, &qmp_args, "p3",
-                                    GCSPRINTF("%d", usbctrl->ports));
+        libxl__qmp_param_add_integer(gc, &qmp_args, "p2",
+                                     usbctrl->ports);
+        libxl__qmp_param_add_integer(gc, &qmp_args, "p3",
+                                     usbctrl->ports);
         break;
     default:
         abort(); /* Should not be possible. */
@@ -411,10 +411,10 @@ static int libxl__device_usbdev_add_hvm(libxl__egc *egc, libxl__ev_qmp *qmp,
         GCSPRINTF("xenusb-%d.0", usbdev->ctrl));
     libxl__qmp_param_add_string(gc, &qmp_args, "port",
         GCSPRINTF("%d", usbdev->port));
-    libxl__qmp_param_add_string(gc, &qmp_args, "hostbus",
-        GCSPRINTF("%d", usbdev->u.hostdev.hostbus));
-    libxl__qmp_param_add_string(gc, &qmp_args, "hostaddr",
-        GCSPRINTF("%d", usbdev->u.hostdev.hostaddr));
+    libxl__qmp_param_add_integer(gc, &qmp_args, "hostbus",
+                                 usbdev->u.hostdev.hostbus);
+    libxl__qmp_param_add_integer(gc, &qmp_args, "hostaddr",
+                                 usbdev->u.hostdev.hostaddr);
 
     return libxl__ev_qmp_send(egc, qmp, "device_add", qmp_args);
 }
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.20


From xen-changelog-bounces@lists.xenproject.org Mon Mar 09 14:11:14 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 09 Mar 2026 14:11:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1249522.1546988 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzbKE-0006Ws-FK; Mon, 09 Mar 2026 14:11:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1249522.1546988; Mon, 09 Mar 2026 14:11:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzbKE-0006Wk-CL; Mon, 09 Mar 2026 14:11:14 +0000
Received: by outflank-mailman (input) for mailman id 1249522;
 Mon, 09 Mar 2026 14:11:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vzbKC-0006WW-G0
 for xen-changelog@lists.xenproject.org; Mon, 09 Mar 2026 14:11:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzbKC-0004kC-2B
 for xen-changelog@lists.xenproject.org;
 Mon, 09 Mar 2026 14:11:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzbKC-000EoH-1C
 for xen-changelog@lists.xenproject.org;
 Mon, 09 Mar 2026 14:11:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=YFEpcSPkYjSWx/6xzQVulfTwqxD4FglhYoZ3KSTYCtE=; b=WWpkjFxp02q6rB6zdidJr+h+as
	oDo2TFti10JLj+gv0/rkoqv3wnAZvlzMh8+ZPWudDBKq+OxxAcafjK1w84X6tNEtHd8qeONuIMpGd
	Z5aa3k6J9NoqSj8cpXfgA21L4PoDphWr5ixcOexuYhrlu7agflSm76IYnzGxV58JYhm8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.20] libxl: constify some local variables for building with glibc 2.43
Message-Id: <E1vzbKC-000EoH-1C@xenbits.xenproject.org>
Date: Mon, 09 Mar 2026 14:11:12 +0000

commit 7fb8c54d678a511562e5aacf32b69323391270c3
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Thu Feb 26 13:31:48 2026 +0100
Commit:     Anthony PERARD <anthony.perard@vates.tech>
CommitDate: Fri Mar 6 14:48:02 2026 +0100

    libxl: constify some local variables for building with glibc 2.43
    
    Archlinux just updated glibc to 2.43+r5+g856c426a7534-1 and that
    causes libxl build failure:
    
        libxl_cpuid.c: In function ‘libxl_cpuid_parse_config_xend’:
        libxl_cpuid.c:447:16: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
          447 |         endptr = strchr(str, '=');
              |                ^
        libxl_cpuid.c:452:16: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
          452 |         endptr = strchr(str, ',');
              |                ^
        libxl_cpuid.c:454:20: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
          454 |             endptr = strchr(str, 0);
              |                    ^
        cc1: all warnings being treated as errors
    
    Add missing consts. Note in libxl_cpuid_parse_config_xend() non-const
    endptr still is needed, to be compatible with the second argument to
    strtoul(). Add second variable for this reason.
    
    And while at it, move semicolon to its own line
    
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Anthony PERARD <anthony.perard@vates.tech>
    (cherry picked from commit 44da0e3b4ff7fa15ad28b628f57412a05dae653c)
---
 tools/libs/light/libxl_cpuid.c    | 21 ++++++++++++---------
 tools/libs/light/libxl_internal.c |  2 +-
 2 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/tools/libs/light/libxl_cpuid.c b/tools/libs/light/libxl_cpuid.c
index f738e17b19..ba428e5ebb 100644
--- a/tools/libs/light/libxl_cpuid.c
+++ b/tools/libs/light/libxl_cpuid.c
@@ -440,29 +440,32 @@ int libxl_cpuid_parse_config_xend(libxl_cpuid_policy_list *policy,
     str = endptr + 1;
     entry = cpuid_find_match(policy, leaf, subleaf);
     for (str = endptr + 1; *str != 0;) {
+        const char *endptrc;
+
         if (str[0] != 'e' || str[2] != 'x') {
             return 4;
         }
         value = str[1] - 'a';
-        endptr = strchr(str, '=');
-        if (value > 3 || endptr == NULL) {
+        endptrc = strchr(str, '=');
+        if (value > 3 || endptrc == NULL) {
             return 4;
         }
-        str = endptr + 1;
-        endptr = strchr(str, ',');
-        if (endptr == NULL) {
-            endptr = strchr(str, 0);
+        str = endptrc + 1;
+        endptrc = strchr(str, ',');
+        if (endptrc == NULL) {
+            endptrc = strchr(str, 0);
         }
-        if (endptr - str != 32) {
+        if (endptrc - str != 32) {
             return 5;
         }
         entry->policy[value] = calloc(32 + 1, 1);
         strncpy(entry->policy[value], str, 32);
         entry->policy[value][32] = 0;
-        if (*endptr == 0) {
+        if (*endptrc == 0) {
             break;
         }
-        for (str = endptr + 1; *str == ' ' || *str == '\n'; str++);
+        for (str = endptrc + 1; *str == ' ' || *str == '\n'; str++)
+            ;
     }
     return 0;
 }
diff --git a/tools/libs/light/libxl_internal.c b/tools/libs/light/libxl_internal.c
index c95624933f..7e3c0eaae5 100644
--- a/tools/libs/light/libxl_internal.c
+++ b/tools/libs/light/libxl_internal.c
@@ -204,7 +204,7 @@ char *libxl__strndup(libxl__gc *gc, const char *c, size_t n)
 
 char *libxl__dirname(libxl__gc *gc, const char *s)
 {
-    char *c = strrchr(s, '/');
+    const char *c = strrchr(s, '/');
 
     if (!c)
         return NULL;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.20


From xen-changelog-bounces@lists.xenproject.org Mon Mar 09 14:11:24 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 09 Mar 2026 14:11:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1249523.1546992 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzbKO-0006Yz-GO; Mon, 09 Mar 2026 14:11:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1249523.1546992; Mon, 09 Mar 2026 14:11:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzbKO-0006Ys-Dg; Mon, 09 Mar 2026 14:11:24 +0000
Received: by outflank-mailman (input) for mailman id 1249523;
 Mon, 09 Mar 2026 14:11:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vzbKM-0006Yk-Iy
 for xen-changelog@lists.xenproject.org; Mon, 09 Mar 2026 14:11:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzbKM-0004kG-2R
 for xen-changelog@lists.xenproject.org;
 Mon, 09 Mar 2026 14:11:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzbKM-000Epr-1g
 for xen-changelog@lists.xenproject.org;
 Mon, 09 Mar 2026 14:11:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=aVI6zUMHsGLYlFwPHzsSbsMykaJQmhyWfwe3aLdzKLQ=; b=MZLBfbcFYv0owXgn9eVH80zrj/
	K2lUBh6+puXmzKUwmKtcWIdZ7fxuJy+ziVjcuxwfQNOMm/g+q8u1yft4AWfm+McG8MahkF35nEdGL
	/HLqgypewdVI7P7e3M1/pQSAHEy5VsUYrI//ryNWmBSxTpTis6rnyNvXY2QXP7xghuT8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.20] tools/sd-notify.h: Include string.h too
Message-Id: <E1vzbKM-000Epr-1g@xenbits.xenproject.org>
Date: Mon, 09 Mar 2026 14:11:22 +0000

commit 27bf8182dbec433ecdd9b5e1e580f72b2fae7229
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Dec 5 21:33:25 2025 +0000
Commit:     Anthony PERARD <anthony.perard@vates.tech>
CommitDate: Fri Mar 6 14:49:09 2026 +0100

    tools/sd-notify.h: Include string.h too
    
    Alpine Linux, when using --enable-systemd to get the init files, fails with:
    
      tools/include/xen-sd-notify.h:69:3: error: call to undeclared library
      function 'memcpy' with type 'void *(void *, const void *, unsigned long)';
      ISO C99 and later do not support implicit function declarations
      [-Wimplicit-function-declaration]
         69 |   memcpy(socket_addr.sun.sun_path, socket_path, path_length);
            |   ^
    
    This will be down to using musl rather than glibc.  Include the appropriate
    header.
    
    Fixes: 78510f3a1522 ("tools: Import stand-alone sd_notify() implementation from systemd")
    Reported-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Acked-by: Anthony PERARD <anthony.perard@vates.tech>
    (cherry picked from commit 8efff5a69ab7596f6c63031d0aef292114948cd9)
---
 tools/include/xen-sd-notify.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/include/xen-sd-notify.h b/tools/include/xen-sd-notify.h
index 28c9b20f15..20441d0ec9 100644
--- a/tools/include/xen-sd-notify.h
+++ b/tools/include/xen-sd-notify.h
@@ -20,6 +20,7 @@
 #include <errno.h>
 #include <stddef.h>
 #include <stdlib.h>
+#include <string.h>
 #include <sys/socket.h>
 #include <sys/un.h>
 #include <unistd.h>
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.20


From xen-changelog-bounces@lists.xenproject.org Mon Mar 09 14:11:34 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 09 Mar 2026 14:11:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1249524.1546995 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzbKY-0006b4-Hk; Mon, 09 Mar 2026 14:11:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1249524.1546995; Mon, 09 Mar 2026 14:11:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzbKY-0006aw-FB; Mon, 09 Mar 2026 14:11:34 +0000
Received: by outflank-mailman (input) for mailman id 1249524;
 Mon, 09 Mar 2026 14:11:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vzbKW-0006ao-LA
 for xen-changelog@lists.xenproject.org; Mon, 09 Mar 2026 14:11:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzbKW-0004ki-2h
 for xen-changelog@lists.xenproject.org;
 Mon, 09 Mar 2026 14:11:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzbKW-000Eqf-1w
 for xen-changelog@lists.xenproject.org;
 Mon, 09 Mar 2026 14:11:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=h+1BOCzv4tSblXGqBr/8u4cYTti5ACrbDbpMUxYO2Pc=; b=5BjFc2FwYbM77VofjgcqLQq2nA
	mijpDQ7O2fO85LZwraly1MWRXg4ElEbYlkxmF1ysTB4JZAOoqTucTxwsuCLMTxBs5/GLZSvgdrC4D
	vkLGoZEyiatTZRqjutyQWc7ArI5Ts2GIJHS9lIxmHJmezRBXREgYgL6sn0P8+pdiKGT0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.20] tools/ocaml: fix 32-bit truncation bug in stub_xc_domain_setmaxmem()
Message-Id: <E1vzbKW-000Eqf-1w@xenbits.xenproject.org>
Date: Mon, 09 Mar 2026 14:11:32 +0000

commit f833d29a3af7708b30b6076ed5c48c12481914ef
Author:     Edwin Török <edwin.torok@citrix.com>
AuthorDate: Thu Feb 5 13:56:45 2026 +0000
Commit:     Anthony PERARD <anthony.perard@vates.tech>
CommitDate: Fri Mar 6 15:02:04 2026 +0100

    tools/ocaml: fix 32-bit truncation bug in stub_xc_domain_setmaxmem()
    
    Observed when attempting to boot a >4TiB VM:
    
    After a call to domain_setmaxmem with 6370254848 (KiB), the domain's maxmem
    got set to 2075287552, which is exactly 2^32 smaller.
    
    xc_domain_setmaxmem takes an uint64_t as a parameter, and the OCaml value
    is 64-bit already, so fix the C variable to match the type and avoid the
    truncation.
    
    Fixes: f5b43e95facd ("libxl: fix "xl mem-set" regression from 0c029c4da2")
    Signed-off-by: Edwin Török <edwin.torok@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@cloud.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    (cherry picked from commit 381b4ff16f7ff83a2dc44f16b8dd0208f3255ec7)
---
 tools/ocaml/libs/xc/xenctrl_stubs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/ocaml/libs/xc/xenctrl_stubs.c b/tools/ocaml/libs/xc/xenctrl_stubs.c
index 863ab3c778..90353ec89d 100644
--- a/tools/ocaml/libs/xc/xenctrl_stubs.c
+++ b/tools/ocaml/libs/xc/xenctrl_stubs.c
@@ -934,7 +934,7 @@ CAMLprim value stub_xc_domain_setmaxmem(value xch_val, value domid,
 	int retval;
 
 	uint32_t c_domid = Int_val(domid);
-	unsigned int c_max_memkb = Int64_val(max_memkb);
+	uint64_t c_max_memkb = Int64_val(max_memkb);
 	caml_enter_blocking_section();
 	retval = xc_domain_setmaxmem(xch, c_domid, c_max_memkb);
 	caml_leave_blocking_section();
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.20


From xen-changelog-bounces@lists.xenproject.org Tue Mar 10 10:33:07 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Mar 2026 10:33:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1249961.1547321 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzuOd-0005Pw-Dd; Tue, 10 Mar 2026 10:33:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1249961.1547321; Tue, 10 Mar 2026 10:33:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzuOd-0005Po-Av; Tue, 10 Mar 2026 10:33:03 +0000
Received: by outflank-mailman (input) for mailman id 1249961;
 Tue, 10 Mar 2026 10:33:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vzuOb-0005Pi-Qk
 for xen-changelog@lists.xenproject.org; Tue, 10 Mar 2026 10:33:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzuOb-001aDs-35
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 10:33:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzuOb-001ds0-2H
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 10:33:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=5GcYwzDSN1GHu4ETVe3fMxCQya9894kNqYpGbGyuj0c=; b=RWwVprHrwWOpmlnlmfEF3Ksqac
	B53Au/MOnT6eNFcGNcKancYPhN2cu42detyYA+sjJbv4+mMnL85PMjEc7xwA1aXHSCMqetLkLXJ8z
	B9QLcyMgqTALdRFVsqQscGgDjXwnwAFPCueAzWa3i5Ar56Ocu9CsDfMaEYd6Ifkscs8I=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] domain: move vmtrace_alloc_buffer() invocation in vcpu_create()
Message-Id: <E1vzuOb-001ds0-2H@xenbits.xenproject.org>
Date: Tue, 10 Mar 2026 10:33:01 +0000

commit adfbdaa347d05e53c8c61ad00a6851bd5b82c760
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Mar 10 09:23:25 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 10 09:23:25 2026 +0100

    domain: move vmtrace_alloc_buffer() invocation in vcpu_create()
    
    The label used upon the function failing is wrong. Instead of correcting
    the label, move the invocation up a little, to also avoid it altogether
    for the idle domain (where ->vmtrace_size would be zero, and hence the
    function would bail right away anyway).
    
    Fixes: 217dd79ee292 ("xen/domain: Add vmtrace_size domain creation parameter")
    Reported-by: Roger Pau Monné <roger.pau@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/common/domain.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/xen/common/domain.c b/xen/common/domain.c
index d24be268ae..ab910fcf93 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -500,14 +500,14 @@ struct vcpu *vcpu_create(struct domain *d, unsigned int vcpu_id)
         set_bit(_VPF_down, &v->pause_flags);
         vcpu_info_reset(v);
         init_waitqueue_vcpu(v);
+
+        if ( vmtrace_alloc_buffer(v) != 0 )
+            goto fail_wq;
     }
 
     if ( sched_init_vcpu(v) != 0 )
         goto fail_wq;
 
-    if ( vmtrace_alloc_buffer(v) != 0 )
-        goto fail_wq;
-
     if ( arch_vcpu_create(v) != 0 )
         goto fail_sched;
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 10 10:33:13 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Mar 2026 10:33:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1249962.1547325 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzuOn-0005Rm-F0; Tue, 10 Mar 2026 10:33:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1249962.1547325; Tue, 10 Mar 2026 10:33:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzuOn-0005Re-CL; Tue, 10 Mar 2026 10:33:13 +0000
Received: by outflank-mailman (input) for mailman id 1249962;
 Tue, 10 Mar 2026 10:33:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vzuOl-0005RL-Rv
 for xen-changelog@lists.xenproject.org; Tue, 10 Mar 2026 10:33:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzuOm-001aE9-09
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 10:33:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzuOl-001dt1-2a
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 10:33:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=WMIBxl8IAnDfL5MDXsdyFTyv8atOPkS3r8GJ0Pyj3Y0=; b=ESnuRHXuOqEAPDueIv4P42q/ZA
	jR4Oik0FWT2w2vvEk+m1LHUxyLXjn44CyGnJ7fpleHzdGgZ+HGc8zoWkB57EjjVAYnOth9UWNiVCt
	373uWEI7K/4LHQvHTVOMN/H/a7JX67djjtqSaA3eYdk64gb9O9zeDBflElCVDyeUebVw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] vPCI: re-init extended-capabilities when MMCFG availability changed
Message-Id: <E1vzuOl-001dt1-2a@xenbits.xenproject.org>
Date: Tue, 10 Mar 2026 10:33:11 +0000

commit d734babf8bc3407919cfd023e2c58bcce24eccfb
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Mar 10 09:24:00 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 10 09:24:00 2026 +0100

    vPCI: re-init extended-capabilities when MMCFG availability changed
    
    When Dom0 informs us about MMCFG usability, this may change whether
    extended capabilities are available (accessible) for devices. Zap what
    might be on record, and re-initialize things.
    
    No synchronization is added for the case where devices may already be in
    use. That'll need sorting when (a) DomU support was added and (b) DomU-s
    may run already while Dom0 / hwdom still boots (dom0less, Hyperlaunch).
    
    vpci_cleanup_capabilities() also shouldn't have used
    pci_find_ext_capability(), as already when the function was introduced
    extended config space may not have been (properly) accessible anymore,
    no matter whether it was during init. Extended capability cleanup hooks
    need to cope with being called when the respective capability doesn't
    exist (and hence the corresponding ->init() hook was never called).
    
    Fixes: 70e6dace747e ("vpci: Use cleanup to free capability resource during deassign")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/physdev.c     | 13 ++++++++++
 xen/drivers/vpci/cap.c     | 64 +++++++++++++++++++++++++++++++++++-----------
 xen/drivers/vpci/private.h |  4 +--
 xen/drivers/vpci/vpci.c    |  4 +--
 xen/include/xen/vpci.h     |  7 +++++
 5 files changed, 73 insertions(+), 19 deletions(-)

diff --git a/xen/arch/x86/physdev.c b/xen/arch/x86/physdev.c
index 8496011b59..5bbcf3b530 100644
--- a/xen/arch/x86/physdev.c
+++ b/xen/arch/x86/physdev.c
@@ -8,6 +8,8 @@
 #include <xen/guest_access.h>
 #include <xen/iocap.h>
 #include <xen/serial.h>
+#include <xen/vpci.h>
+
 #include <asm/current.h>
 #include <asm/io_apic.h>
 #include <asm/msi.h>
@@ -169,8 +171,19 @@ int cf_check physdev_check_pci_extcfg(struct pci_dev *pdev, void *arg)
 
     ASSERT(pdev->seg == info->segment);
     if ( pdev->bus >= info->start_bus && pdev->bus <= info->end_bus )
+    {
         pci_check_extcfg(pdev);
 
+        /*
+         * The re-init failing doesn't mean the device becomes entirely non-
+         * functional.  In case of failure, a message was already logged.
+         * Hence don't otherwise act upon failure.
+         *
+         * FIXME: Re-visit when DomU support is added to vPCI.
+         */
+        vpci_reinit_ext_capabilities(pdev);
+    }
+
     return 0;
 }
 #endif /* COMPAT */
diff --git a/xen/drivers/vpci/cap.c b/xen/drivers/vpci/cap.c
index e26a2f95da..3c3e6ce1d3 100644
--- a/xen/drivers/vpci/cap.c
+++ b/xen/drivers/vpci/cap.c
@@ -285,13 +285,16 @@ static int vpci_init_ext_capability_list(const struct pci_dev *pdev)
     return 0;
 }
 
-int vpci_init_capabilities(struct pci_dev *pdev)
+int vpci_init_capabilities(struct pci_dev *pdev, bool ext_only)
 {
-    int rc;
+    int rc, accum_rc = 0;
 
-    rc = vpci_init_capability_list(pdev);
-    if ( rc )
-        return rc;
+    if ( !ext_only )
+    {
+        rc = vpci_init_capability_list(pdev);
+        if ( rc )
+            return rc;
+    }
 
     rc = vpci_init_ext_capability_list(pdev);
     if ( rc )
@@ -305,7 +308,7 @@ int vpci_init_capabilities(struct pci_dev *pdev)
         unsigned int pos = 0;
 
         if ( !is_ext )
-            pos = pci_find_cap_offset(pdev->sbdf, cap);
+            pos = !ext_only ? pci_find_cap_offset(pdev->sbdf, cap) : 0;
         else if ( is_hardware_domain(pdev->domain) )
             pos = pci_find_ext_capability(pdev, cap);
 
@@ -341,30 +344,40 @@ int vpci_init_capabilities(struct pci_dev *pdev)
             {
                 printk(XENLOG_ERR "%pd %pp: hide %s cap %u fail rc=%d\n",
                        pdev->domain, &pdev->sbdf, type, cap, rc);
-                return rc;
+
+                /* Best effort for the re-init case. */
+                if ( !ext_only )
+                    return rc;
+
+                if ( !accum_rc )
+                    accum_rc = rc;
             }
         }
     }
 
-    return 0;
+    return accum_rc;
 }
 
-void vpci_cleanup_capabilities(struct pci_dev *pdev)
+void vpci_cleanup_capabilities(struct pci_dev *pdev, bool ext_only)
 {
     for ( unsigned int i = 0; i < NUM_VPCI_INIT; i++ )
     {
         const vpci_capability_t *capability = &__start_vpci_array[i];
         const unsigned int cap = capability->id;
-        unsigned int pos = 0;
 
         if ( !capability->cleanup )
             continue;
 
-        if ( !capability->is_ext )
-            pos = pci_find_cap_offset(pdev->sbdf, cap);
-        else if ( is_hardware_domain(pdev->domain) )
-            pos = pci_find_ext_capability(pdev, cap);
-        if ( pos )
+        /*
+         * Cannot call pci_find_ext_capability() here, as extended config space
+         * may (no longer) be accessible.  As a result, extended capability
+         * ->cleanup() handlers need to cope with being called despite ->init()
+         * never having been called.  Which in turn allows calling them even
+         * for DomU-s, no matter that vpci_init_capabilities() excludes them
+         * there for now.
+         */
+        if ( capability->is_ext
+             || (!ext_only && pci_find_cap_offset(pdev->sbdf, cap)) )
         {
             int rc = capability->cleanup(pdev, false);
 
@@ -376,6 +389,27 @@ void vpci_cleanup_capabilities(struct pci_dev *pdev)
     }
 }
 
+int vpci_reinit_ext_capabilities(struct pci_dev *pdev)
+{
+    if ( !pdev->vpci )
+        return 0;
+
+    /*
+     * FIXME: DomU support is missing.  For already running domains we may
+     * need to pause them around the entire re-evaluation of extended config
+     * space accessibility.
+     */
+    ASSERT(pdev->domain == hardware_domain);
+
+    if ( vpci_remove_registers(pdev->vpci, PCI_CFG_SPACE_SIZE,
+                               PCI_CFG_SPACE_EXP_SIZE - PCI_CFG_SPACE_SIZE) )
+        ASSERT_UNREACHABLE();
+
+    vpci_cleanup_capabilities(pdev, true);
+
+    return vpci_init_capabilities(pdev, true);
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/xen/drivers/vpci/private.h b/xen/drivers/vpci/private.h
index fdeeca7aa8..2907f6b40f 100644
--- a/xen/drivers/vpci/private.h
+++ b/xen/drivers/vpci/private.h
@@ -46,8 +46,8 @@ typedef struct {
 
 int __must_check vpci_init_header(struct pci_dev *pdev);
 
-int vpci_init_capabilities(struct pci_dev *pdev);
-void vpci_cleanup_capabilities(struct pci_dev *pdev);
+int vpci_init_capabilities(struct pci_dev *pdev, bool ext_only);
+void vpci_cleanup_capabilities(struct pci_dev *pdev, bool ext_only);
 
 /* Add/remove a register handler. */
 int __must_check vpci_add_register_mask(struct vpci *vpci,
diff --git a/xen/drivers/vpci/vpci.c b/xen/drivers/vpci/vpci.c
index 683d5fc36c..0ac9ec8b04 100644
--- a/xen/drivers/vpci/vpci.c
+++ b/xen/drivers/vpci/vpci.c
@@ -102,7 +102,7 @@ void vpci_deassign_device(struct pci_dev *pdev)
                     &pdev->domain->vpci_dev_assigned_map);
 #endif
 
-    vpci_cleanup_capabilities(pdev);
+    vpci_cleanup_capabilities(pdev, false);
 
     spin_lock(&pdev->vpci->lock);
     while ( !list_empty(&pdev->vpci->handlers) )
@@ -159,7 +159,7 @@ int vpci_assign_device(struct pci_dev *pdev)
     if ( rc )
         goto out;
 
-    rc = vpci_init_capabilities(pdev);
+    rc = vpci_init_capabilities(pdev, false);
 
  out:
     if ( rc )
diff --git a/xen/include/xen/vpci.h b/xen/include/xen/vpci.h
index 83ac41edf8..877aa391d1 100644
--- a/xen/include/xen/vpci.h
+++ b/xen/include/xen/vpci.h
@@ -25,6 +25,8 @@ int __must_check vpci_assign_device(struct pci_dev *pdev);
 /* Remove all handlers and free vpci related structures. */
 void vpci_deassign_device(struct pci_dev *pdev);
 
+int vpci_reinit_ext_capabilities(struct pci_dev *pdev);
+
 /* Generic read/write handlers for the PCI config space. */
 uint32_t vpci_read(pci_sbdf_t sbdf, unsigned int reg, unsigned int size);
 void vpci_write(pci_sbdf_t sbdf, unsigned int reg, unsigned int size,
@@ -202,6 +204,11 @@ bool vpci_ecam_read(pci_sbdf_t sbdf, unsigned int reg, unsigned int len,
 #else /* !CONFIG_HAS_VPCI */
 struct vpci_vcpu {};
 
+static inline int vpci_reinit_ext_capabilities(struct pci_dev *pdev)
+{
+    return 0;
+}
+
 static inline int vpci_assign_device(struct pci_dev *pdev)
 {
     return 0;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 10 10:33:23 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Mar 2026 10:33:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1249963.1547329 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzuOx-0005Un-Ia; Tue, 10 Mar 2026 10:33:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1249963.1547329; Tue, 10 Mar 2026 10:33:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzuOx-0005Ue-Fj; Tue, 10 Mar 2026 10:33:23 +0000
Received: by outflank-mailman (input) for mailman id 1249963;
 Tue, 10 Mar 2026 10:33:21 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vzuOv-0005UX-UY
 for xen-changelog@lists.xenproject.org; Tue, 10 Mar 2026 10:33:21 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzuOw-001aED-0P
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 10:33:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzuOv-001duH-2s
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 10:33:21 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=M7vWFtmKu3pj5oxbjyOthbuFKQhHVKp98TKdkNm+svA=; b=24tAxzbGwOVbOLCrUDQ2/tAyKM
	zzaik3qADGUirHUDIJ2QUhXRqMnJo8RK/0odSmfmNlJzfrA4Jtq8IS697JBlA56oonHS4CXpa3DHf
	dMFWODMFjU3RcrxixPeTZxmoRIBz5/ydDLLKbd9ugNz6GrHEAD44yyYpPk1gTITZhQ6c=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/riscv: detect and store supported hypervisor CSR bits at boot
Message-Id: <E1vzuOv-001duH-2s@xenbits.xenproject.org>
Date: Tue, 10 Mar 2026 10:33:21 +0000

commit 8149f72c0cbf6f1e8903b4a50101f806ff0630de
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Tue Mar 10 09:24:35 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 10 09:24:35 2026 +0100

    xen/riscv: detect and store supported hypervisor CSR bits at boot
    
    Some hypervisor CSRs expose optional functionality and may not implement
    all architectural bits. Writing unsupported bits can either be ignored
    or raise an exception depending on the platform.
    
    Detect the set of writable bits for selected hypervisor CSRs at boot and
    store the resulting masks for later use. This allows safely programming
    these CSRs during vCPU context switching and avoids relying on hardcoded
    architectural assumptions.
    
    Use csr_read()&csr_write() instead of csr_swap()+all ones mask as some
    CSR registers have WPRI fields which should be preserved during write
    operation.
    
    Also, ro_one struct is introduced to cover the cases when a bit in CSR
    register (at the momemnt, it is only hstateen0) may be r/o-one to have
    hypervisor view of register seen by guest correct.
    
    Masks are calculated at the moment only for hedeleg, henvcfg, hideleg,
    hstateen0 registers as only them are going to be used in the follow up
    patch.
    
    If the Smstateen extension is not implemented, hstateen0 cannot be read
    because the register is considered non-existent. Instructions that attempt
    to access a CSR that is not implemented or not visible in the current mode
    are reserved and will raise an illegal-instruction exception.
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/domain.c            | 57 ++++++++++++++++++++++++++++++++++++++
 xen/arch/riscv/include/asm/setup.h |  2 ++
 xen/arch/riscv/setup.c             |  2 ++
 3 files changed, 61 insertions(+)

diff --git a/xen/arch/riscv/domain.c b/xen/arch/riscv/domain.c
index b60320b90d..a5450a6d1b 100644
--- a/xen/arch/riscv/domain.c
+++ b/xen/arch/riscv/domain.c
@@ -2,9 +2,66 @@
 
 #include <xen/init.h>
 #include <xen/mm.h>
+#include <xen/sections.h>
 #include <xen/sched.h>
 #include <xen/vmap.h>
 
+#include <asm/cpufeature.h>
+#include <asm/csr.h>
+
+struct csr_masks {
+    register_t hedeleg;
+    register_t henvcfg;
+    register_t hideleg;
+    register_t hstateen0;
+
+    struct {
+        register_t hstateen0;
+    } ro_one;
+};
+
+static struct csr_masks __ro_after_init csr_masks;
+
+#define HEDELEG_AVAIL_MASK ULONG_MAX
+#define HIDELEG_AVAIL_MASK ULONG_MAX
+#define HENVCFG_AVAIL_MASK _UL(0xE0000003000000FF)
+#define HSTATEEN0_AVAIL_MASK _UL(0xDE00000000000007)
+
+void __init init_csr_masks(void)
+{
+    /*
+     * The mask specifies the bits that may be safely modified without
+     * causing side effects.
+     *
+     * For example, registers such as henvcfg or hstateen0 contain WPRI
+     * fields that must be preserved. Any write to the full register must
+     * therefore retain the original values of those fields.
+     */
+#define INIT_CSR_MASK(csr, field, mask) do { \
+        register_t old = csr_read_set(CSR_ ## csr, mask); \
+        csr_masks.field = csr_swap(CSR_ ## csr, old); \
+    } while (0)
+
+#define INIT_RO_ONE_MASK(csr, field, mask) do { \
+        register_t old = csr_read_clear(CSR_ ## csr, mask); \
+        csr_masks.ro_one.field = csr_swap(CSR_ ## csr, old) & mask; \
+    } while (0)
+
+    INIT_CSR_MASK(HEDELEG, hedeleg, HEDELEG_AVAIL_MASK);
+    INIT_CSR_MASK(HIDELEG, hideleg, HIDELEG_AVAIL_MASK);
+
+    INIT_CSR_MASK(HENVCFG, henvcfg, HENVCFG_AVAIL_MASK);
+
+    if ( riscv_isa_extension_available(NULL, RISCV_ISA_EXT_smstateen) )
+    {
+        INIT_CSR_MASK(HSTATEEN0, hstateen0, HSTATEEN0_AVAIL_MASK);
+        INIT_RO_ONE_MASK(HSTATEEN0, hstateen0, HSTATEEN0_AVAIL_MASK);
+    }
+
+#undef INIT_CSR_MASK
+#undef INIT_RO_ONE_MASK
+}
+
 static void continue_new_vcpu(struct vcpu *prev)
 {
     BUG_ON("unimplemented\n");
diff --git a/xen/arch/riscv/include/asm/setup.h b/xen/arch/riscv/include/asm/setup.h
index c9d69cdf51..2215894cfb 100644
--- a/xen/arch/riscv/include/asm/setup.h
+++ b/xen/arch/riscv/include/asm/setup.h
@@ -11,6 +11,8 @@ void setup_mm(void);
 
 void copy_from_paddr(void *dst, paddr_t paddr, unsigned long len);
 
+void init_csr_masks(void);
+
 #endif /* ASM__RISCV__SETUP_H */
 
 /*
diff --git a/xen/arch/riscv/setup.c b/xen/arch/riscv/setup.c
index 9b4835960d..bca6ca09ed 100644
--- a/xen/arch/riscv/setup.c
+++ b/xen/arch/riscv/setup.c
@@ -137,6 +137,8 @@ void __init noreturn start_xen(unsigned long bootcpu_id,
 
     riscv_fill_hwcap();
 
+    init_csr_masks();
+
     preinit_xen_time();
 
     intc_preinit();
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 10 10:33:33 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Mar 2026 10:33:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1249964.1547333 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzuP7-0005Wt-Jr; Tue, 10 Mar 2026 10:33:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1249964.1547333; Tue, 10 Mar 2026 10:33:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzuP7-0005Wl-HA; Tue, 10 Mar 2026 10:33:33 +0000
Received: by outflank-mailman (input) for mailman id 1249964;
 Tue, 10 Mar 2026 10:33:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vzuP6-0005Wd-2x
 for xen-changelog@lists.xenproject.org; Tue, 10 Mar 2026 10:33:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzuP6-001aEH-0s
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 10:33:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzuP5-001duf-38
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 10:33:31 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=LdwbbbECGJvs8vDCLm3gAl2EaUSN6DocSb9dOwTjpIE=; b=Y0VWa6v8aOQ3Zi1nwc0Tgbn5O2
	jD5FSA8Lw6veFnR4Dt68Hjr6nmtoLJmRLFyu/maxz/Fi/UbOjHq38G/+Ht/A01ij5oB67qbt6PTeI
	6n7NIMMIIIJ40ac677TSlZ6PxbPIiu3qvh0jVvMq00TJLpas82QnIG5+wjTZPsmDPZSk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/riscv: implement vcpu_csr_init()
Message-Id: <E1vzuP5-001duf-38@xenbits.xenproject.org>
Date: Tue, 10 Mar 2026 10:33:31 +0000

commit 02b3a1b0e53c6ebb03d7c07e2c5272cd5652b384
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Tue Mar 10 09:25:01 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 10 09:25:01 2026 +0100

    xen/riscv: implement vcpu_csr_init()
    
    Introduce vcpu_csr_init() to initialise hypervisor CSRs that control
    vCPU execution and virtualization behaviour before the vCPU is first
    scheduled.
    The function configures trap and interrupt delegation to VS-mode by
    setting the appropriate bits in the hedeleg and hideleg registers,
    initializes hstatus so that execution enters VS-mode when control is
    passed to the guest, and restricts guest access to hardware performance
    counters by initializing hcounteren, as unrestricted access would
    require additional handling in Xen.
    When the Smstateen and SSAIA extensions are available, access to AIA
    CSRs and IMSIC guest interrupt files is enabled by setting the
    corresponding bits in hstateen0, avoiding unnecessary traps into Xen
    (note that SVSLCT(Supervisor Virtual Select) name is used intead of
    CSRIND as OpenSBI uses such name and riscv_encoding.h is mostly based
    on it).
    If the Svpbmt extension is supported, the PBMTE bit is set in
    henvcfg to allow its use for VS-stage address translation. Guest
    access to the ENVCFG CSR is also enabled by setting ENVCFG bit in
    hstateen0, as a guest may need to control certain characteristics of
    the U-mode (VU-mode when V=1) execution environment.
    
    For CSRs that may contain read-only bits (e.g. hedeleg, hideleg,
    hstateen0), to the written value a correspondent mask is applied to
    avoid divergence between the software state and the actual CSR
    contents.
    
    As hstatus is not part of struct arch_vcpu (it already resides in
    struct cpu_user_regs), introduce vcpu_guest_cpu_user_regs() to provide
    a uniform way to access hstatus and other guest CPU user registers.
    
    This establishes a consistent and well-defined initial CSR state for
    vCPUs prior to their first context switch.
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/domain.c                     | 63 +++++++++++++++++++++++++++++
 xen/arch/riscv/include/asm/current.h        |  2 +
 xen/arch/riscv/include/asm/domain.h         |  6 +++
 xen/arch/riscv/include/asm/riscv_encoding.h |  2 +
 4 files changed, 73 insertions(+)

diff --git a/xen/arch/riscv/domain.c b/xen/arch/riscv/domain.c
index a5450a6d1b..14cc85093b 100644
--- a/xen/arch/riscv/domain.c
+++ b/xen/arch/riscv/domain.c
@@ -8,6 +8,7 @@
 
 #include <asm/cpufeature.h>
 #include <asm/csr.h>
+#include <asm/riscv_encoding.h>
 
 struct csr_masks {
     register_t hedeleg;
@@ -20,6 +21,21 @@ struct csr_masks {
     } ro_one;
 };
 
+#define HEDELEG_DEFAULT (BIT(CAUSE_MISALIGNED_FETCH, U) | \
+                         BIT(CAUSE_FETCH_ACCESS, U) | \
+                         BIT(CAUSE_ILLEGAL_INSTRUCTION, U) | \
+                         BIT(CAUSE_BREAKPOINT, U) | \
+                         BIT(CAUSE_MISALIGNED_LOAD, U) | \
+                         BIT(CAUSE_LOAD_ACCESS, U) | \
+                         BIT(CAUSE_MISALIGNED_STORE, U) | \
+                         BIT(CAUSE_STORE_ACCESS, U) | \
+                         BIT(CAUSE_USER_ECALL, U) | \
+                         BIT(CAUSE_FETCH_PAGE_FAULT, U) | \
+                         BIT(CAUSE_LOAD_PAGE_FAULT, U) | \
+                         BIT(CAUSE_STORE_PAGE_FAULT, U))
+
+#define HIDELEG_DEFAULT (MIP_VSSIP | MIP_VSTIP | MIP_VSEIP)
+
 static struct csr_masks __ro_after_init csr_masks;
 
 #define HEDELEG_AVAIL_MASK ULONG_MAX
@@ -62,6 +78,51 @@ void __init init_csr_masks(void)
 #undef INIT_RO_ONE_MASK
 }
 
+static void vcpu_csr_init(struct vcpu *v)
+{
+    v->arch.hedeleg = HEDELEG_DEFAULT & csr_masks.hedeleg;
+
+    vcpu_guest_cpu_user_regs(v)->hstatus = HSTATUS_SPV | HSTATUS_SPVP;
+
+    v->arch.hideleg = HIDELEG_DEFAULT & csr_masks.hideleg;
+
+    /*
+     * VS should access only the time counter directly.
+     * Everything else should trap.
+     */
+    v->arch.hcounteren = HCOUNTEREN_TM;
+
+    if ( riscv_isa_extension_available(NULL, RISCV_ISA_EXT_svpbmt) )
+        v->arch.henvcfg = ENVCFG_PBMTE & csr_masks.henvcfg;
+
+    if ( riscv_isa_extension_available(NULL, RISCV_ISA_EXT_smstateen) )
+    {
+        /* Allow guest to access CSR_SENVCFG */
+        register_t hstateen0 = SMSTATEEN0_HSENVCFG;
+
+        if ( riscv_isa_extension_available(NULL, RISCV_ISA_EXT_ssaia) )
+            /*
+             * If the hypervisor extension is implemented, the same three
+             * bits are defined also in hypervisor CSR hstateen0 but concern
+             * only the state potentially accessible to a virtual machine
+             * executing in privilege modes VS and VU:
+             *      bit 60 CSRs siselect and sireg (really vsiselect and
+             *             vsireg)
+             *      bit 59 CSRs siph and sieh (RV32 only) and stopi (really
+             *             vsiph, vsieh, and vstopi)
+             *      bit 58 all state of IMSIC guest interrupt files, including
+             *             CSR stopei (really vstopei)
+             * If one of these bits is zero in hstateen0, and the same bit is
+             * one in mstateen0, then an attempt to access the corresponding
+             * state from VS or VU-mode raises a virtual instruction exception.
+             */
+            hstateen0 |= SMSTATEEN0_AIA | SMSTATEEN0_IMSIC | SMSTATEEN0_SVSLCT;
+
+        v->arch.hstateen0 = (hstateen0 & csr_masks.hstateen0) |
+                            csr_masks.ro_one.hstateen0;
+    }
+}
+
 static void continue_new_vcpu(struct vcpu *prev)
 {
     BUG_ON("unimplemented\n");
@@ -84,6 +145,8 @@ int arch_vcpu_create(struct vcpu *v)
     if ( is_idle_vcpu(v) )
         return 0;
 
+    vcpu_csr_init(v);
+
     /*
      * As the vtimer and interrupt controller (IC) are not yet implemented,
      * return an error.
diff --git a/xen/arch/riscv/include/asm/current.h b/xen/arch/riscv/include/asm/current.h
index 58c9f1506b..5fbee8182c 100644
--- a/xen/arch/riscv/include/asm/current.h
+++ b/xen/arch/riscv/include/asm/current.h
@@ -48,6 +48,8 @@ DECLARE_PER_CPU(struct vcpu *, curr_vcpu);
 #define get_cpu_current(cpu)  per_cpu(curr_vcpu, cpu)
 
 #define guest_cpu_user_regs() ({ BUG_ON("unimplemented"); NULL; })
+#define vcpu_guest_cpu_user_regs(vcpu) \
+    (&(vcpu)->arch.cpu_info->guest_cpu_user_regs)
 
 #define switch_stack_and_jump(stack, fn) do {               \
     asm volatile (                                          \
diff --git a/xen/arch/riscv/include/asm/domain.h b/xen/arch/riscv/include/asm/domain.h
index 5aec627a7a..17be792afe 100644
--- a/xen/arch/riscv/include/asm/domain.h
+++ b/xen/arch/riscv/include/asm/domain.h
@@ -49,6 +49,12 @@ struct arch_vcpu {
 
     struct cpu_info *cpu_info;
 
+    register_t hcounteren;
+    register_t hedeleg;
+    register_t hideleg;
+    register_t henvcfg;
+    register_t hstateen0;
+
     register_t vsatp;
 };
 
diff --git a/xen/arch/riscv/include/asm/riscv_encoding.h b/xen/arch/riscv/include/asm/riscv_encoding.h
index 1f7e612366..dd15731a86 100644
--- a/xen/arch/riscv/include/asm/riscv_encoding.h
+++ b/xen/arch/riscv/include/asm/riscv_encoding.h
@@ -228,6 +228,8 @@
 #define ENVCFG_CBIE_INV			_UL(0x3)
 #define ENVCFG_FIOM			_UL(0x1)
 
+#define HCOUNTEREN_TM BIT(1, U)
+
 /* ===== User-level CSRs ===== */
 
 /* User Trap Setup (N-extension) */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 10 10:33:43 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Mar 2026 10:33:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1249965.1547336 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzuPH-0005Yu-LB; Tue, 10 Mar 2026 10:33:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1249965.1547336; Tue, 10 Mar 2026 10:33:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzuPH-0005Ym-Id; Tue, 10 Mar 2026 10:33:43 +0000
Received: by outflank-mailman (input) for mailman id 1249965;
 Tue, 10 Mar 2026 10:33:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vzuPG-0005Yc-5w
 for xen-changelog@lists.xenproject.org; Tue, 10 Mar 2026 10:33:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzuPG-001aEe-1B
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 10:33:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzuPG-001dxB-0N
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 10:33:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=7Jfq5dZHJ0W+RxCDDsSsldEPHZy6wDIilveKg0A1lo8=; b=wq6x5ubYSSOHtWboUOTi6zrRNt
	+beRtvRWrUZrZE24YuzlHX+kwKRECu4YzFG+lNK1gWObiDye3rLJ4+uF8g6WaDM8n5HvWddbC47kx
	7x67GuQ1FFrd+6nXxhNsUCEXWGMYx2LpcruiNCiN07V8Q7750ajzl3e/PW9cBxY+BPUQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/riscv: introduce tracking of pending vCPU interrupts, part 1
Message-Id: <E1vzuPG-001dxB-0N@xenbits.xenproject.org>
Date: Tue, 10 Mar 2026 10:33:42 +0000

commit c537959a5cb0178b0a34333892a8c0b47b69274f
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Tue Mar 10 09:25:16 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 10 09:25:16 2026 +0100

    xen/riscv: introduce tracking of pending vCPU interrupts, part 1
    
    Based on Linux kernel v6.16.0.
    Note that smp_wmb() is used instead of smp_mb__before_atomic() as what
    we want to guarantee that if a bit in irqs_pending_mask is obversable
    that the correspondent bit in irqs_pending is observable too.
    
    Add lockless tracking of pending vCPU interrupts using atomic bitops.
    Two bitmaps are introduced:
     - irqs_pending — interrupts currently pending for the vCPU
     - irqs_pending_mask — bits that have changed in irqs_pending
    
    The design follows a multi-producer, single-consumer model, where the
    consumer is the vCPU itself. Producers may set bits in
    irqs_pending_mask without a lock. Clearing bits in irqs_pending_mask is
    performed only by the consumer via xchg(). The consumer must not write
    to irqs_pending and must not act on bits that are not set in the mask.
    Otherwise, extra synchronization should be provided.
    
    On RISC-V interrupts are not injected via guest registers, so pending
    interrupts must be recorded in irqs_pending (using the new
    vcpu_{un}set_interrupt() helpers) and flushed to the guest by updating
    HVIP before returning control to the guest. The consumer side is
    implemented in a follow-up patch.
    
    A barrier between updating irqs_pending and setting the corresponding
    mask bit in vcpu_set_interrupt()/vcpu_unset_interrupt() guarantees
    that if the consumer observes a mask bit set, the corresponding pending
    bit is also visible. This prevents missed interrupts during the flush.
    
    It is possible that a guest could have pending bit in the hardware
    register without being marked pending in irq_pending bitmap as:
      According to the RISC-V ISA specification:
        Bits hip.VSSIP and hie.VSSIE are the interrupt-pending and
        interrupt-enable  bits for VS-level software interrupts. VSSIP in hip
        is an alias (writable) of the same bit in hvip.
      Additionally:
        When bit 2 of hideleg is zero, vsip.SSIP and vsie.SSIE are read-only
        zeros. Else, vsip.SSIP and vsie.SSIE are aliases of hip.VSSIP and
        hie.VSSIE.
    This means the guest may modify vsip.SSIP, which implicitly updates
    hip.VSSIP and the bit being written with 1 would also trigger an interrupt
    as according to the RISC-V spec:
      These conditions for an interrupt trap to occur must be evaluated in a
      bounded   amount of time from when an interrupt becomes, or ceases to be,
      pending in sip,  and must also be evaluated immediately following the
      execution of an SRET  instruction or an explicit write to a CSR on which
      these interrupt trap conditions expressly depend (including sip, sie and
      sstatus).
    What means that IRQ_VS_SOFT must be synchronized separately, what is done
    in vcpu_sync_interrupts(). Note, also, that IRQ_PMU_OVF would want to be
    synced for the similar reason as IRQ_VS_SOFT, but isn't sync-ed now as
    PMU isn't supported now.
    
    For the remaining VS-level interrupt types (IRQ_VS_TIMER and
    IRQ_VS_EXT), the specification states they cannot be modified by the guest
    and are read-only because of:
      Bits hip.VSEIP and hie.VSEIE are the interrupt-pending and interrupt-enable
      bits for VS-level external interrupts. VSEIP is read-only in hip, and is
      the logical-OR of these interrupt sources:
        • bit VSEIP of hvip;
        • the bit of hgeip selected by hstatus.VGEIN; and
        • any other platform-specific external interrupt signal directed to
          VS-level.
      Bits hip.VSTIP and hie.VSTIE are the interrupt-pending and interrupt-enable
      bits for VS-level timer interrupts. VSTIP is read-only in hip, and is the
      logical-OR of hvip.VSTIP and any other platform-specific timer interrupt
      signal directed to VS-level.
    and
      When bit 10 of hideleg is zero, vsip.SEIP and vsie.SEIE are read-only zeros.
      Else, vsip.SEIP and vsie.SEIE are aliases of hip.VSEIP and hie.VSEIE.
    
      When bit 6 of hideleg is zero, vsip.STIP and vsie.STIE are read-only zeros.
      Else, vsip.STIP and vsie.STIE are aliases of hip.VSTIP and hie.VSTIE.
    and also,
      Bits sip.SEIP and sie.SEIE are the interrupt-pending and interrupt-enable
      bits for supervisor-level external interrupts. If implemented, SEIP is
      read-only in sip, and is set and cleared by the execution environment,
      typically through a platform-specific interrupt controller.
    
      Bits sip.STIP and sie.STIE are the interrupt-pending and interrupt-enable
      bits for supervisor-level timer interrupts. If implemented, STIP is
      read-only in sip, and is set and cleared by the execution environment
    Thus, for these interrupt types, it is sufficient to use vcpu_set_interrupt()
    and vcpu_unset_interrupt(), and flush them during the call of
    vcpu_flush_interrupts() (which is introduced in follow up patch).
    
    vcpu_sync_interrupts(), which is called just before entering the VM,
    slightly bends the rule that the irqs_pending bit must be written
    first, followed by updating the corresponding bit in irqs_pending_mask.
    However, it still respects the core guarantee that the producer never
    clears the mask and only writes to irqs_pending if it is the one that
    flipped the corresponding mask bit from 0 to 1.
    Moreover, since the consumer won't run concurrently because
    vcpu_sync_interrupts() and the consumer path are going to be invoked
    sequentially immediately before VM entry, it is safe to slightly relax
    this ordering rule in vcpu_sync_interrupts().
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/domain.c             | 63 +++++++++++++++++++++++++++++++++++++
 xen/arch/riscv/include/asm/domain.h | 22 +++++++++++++
 xen/arch/riscv/traps.c              |  4 +++
 3 files changed, 89 insertions(+)

diff --git a/xen/arch/riscv/domain.c b/xen/arch/riscv/domain.c
index 14cc85093b..694a03ab74 100644
--- a/xen/arch/riscv/domain.c
+++ b/xen/arch/riscv/domain.c
@@ -6,6 +6,7 @@
 #include <xen/sched.h>
 #include <xen/vmap.h>
 
+#include <asm/bitops.h>
 #include <asm/cpufeature.h>
 #include <asm/csr.h>
 #include <asm/riscv_encoding.h>
@@ -168,6 +169,68 @@ void arch_vcpu_destroy(struct vcpu *v)
     vfree((void *)&v->arch.cpu_info[1] - STACK_SIZE);
 }
 
+int vcpu_set_interrupt(struct vcpu *v, unsigned int irq)
+{
+    bool kick_vcpu;
+
+    /* We only allow VS-mode software, timer, and external interrupts */
+    if ( irq != IRQ_VS_SOFT &&
+         irq != IRQ_VS_TIMER &&
+         irq != IRQ_VS_EXT )
+        return -EINVAL;
+
+    kick_vcpu = !test_and_set_bit(irq, v->arch.irqs_pending);
+
+    /*
+     * The counterpart of this barrier is the one encoded implicitly in xchg()
+     * which is used in consumer part (vcpu_flush_interrupts()).
+     */
+    smp_wmb();
+
+    kick_vcpu |= !test_and_set_bit(irq, v->arch.irqs_pending_mask);
+
+    if ( kick_vcpu )
+        vcpu_kick(v);
+
+    return 0;
+}
+
+int vcpu_unset_interrupt(struct vcpu *v, unsigned int irq)
+{
+    /* We only allow VS-mode software, timer, external interrupts */
+    if ( irq != IRQ_VS_SOFT &&
+         irq != IRQ_VS_TIMER &&
+         irq != IRQ_VS_EXT )
+        return -EINVAL;
+
+    clear_bit(irq, v->arch.irqs_pending);
+    /*
+     * The counterpart of this barrier is the one encoded implicitly in xchg()
+     * which is used in consumer part (vcpu_flush_interrupts()).
+     */
+    smp_wmb();
+    set_bit(irq, v->arch.irqs_pending_mask);
+
+    return 0;
+}
+
+void vcpu_sync_interrupts(struct vcpu *curr)
+{
+    unsigned long hvip = csr_read(CSR_HVIP);
+
+    ASSERT(curr == current);
+
+    /* Sync-up HVIP.VSSIP bit changes done by Guest */
+    if ( ((curr->arch.hvip ^ hvip) & BIT(IRQ_VS_SOFT, UL)) &&
+         !test_and_set_bit(IRQ_VS_SOFT, &curr->arch.irqs_pending_mask) )
+    {
+        if ( hvip & BIT(IRQ_VS_SOFT, UL) )
+            set_bit(IRQ_VS_SOFT, &curr->arch.irqs_pending);
+        else
+            clear_bit(IRQ_VS_SOFT, &curr->arch.irqs_pending);
+    }
+}
+
 static void __init __maybe_unused build_assertions(void)
 {
     /*
diff --git a/xen/arch/riscv/include/asm/domain.h b/xen/arch/riscv/include/asm/domain.h
index 17be792afe..1ecfe18c85 100644
--- a/xen/arch/riscv/include/asm/domain.h
+++ b/xen/arch/riscv/include/asm/domain.h
@@ -54,8 +54,25 @@ struct arch_vcpu {
     register_t hideleg;
     register_t henvcfg;
     register_t hstateen0;
+    register_t hvip;
 
     register_t vsatp;
+
+    /*
+     * VCPU interrupts
+     *
+     * We have a lockless approach for tracking pending VCPU interrupts
+     * implemented using atomic bitops. The irqs_pending bitmap represent
+     * pending interrupts whereas irqs_pending_mask represent bits changed
+     * in irqs_pending. Our approach is modeled around multiple producer
+     * and single consumer problem where the consumer is the VCPU itself.
+     *
+     * DECLARE_BITMAP() is needed here to support 64 vCPU local interrupts
+     * on RV32 host.
+     */
+#define RISCV_VCPU_NR_IRQS MAX(BITS_PER_LONG, 64)
+    DECLARE_BITMAP(irqs_pending, RISCV_VCPU_NR_IRQS);
+    DECLARE_BITMAP(irqs_pending_mask, RISCV_VCPU_NR_IRQS);
 };
 
 struct paging_domain {
@@ -94,6 +111,11 @@ static inline void update_guest_memory_policy(struct vcpu *v,
 
 static inline void arch_vcpu_block(struct vcpu *v) {}
 
+int vcpu_set_interrupt(struct vcpu *v, unsigned int irq);
+int vcpu_unset_interrupt(struct vcpu *v, unsigned int irq);
+
+void vcpu_sync_interrupts(struct vcpu *curr);
+
 #endif /* ASM__RISCV__DOMAIN_H */
 
 /*
diff --git a/xen/arch/riscv/traps.c b/xen/arch/riscv/traps.c
index 9fca941526..551f886e3a 100644
--- a/xen/arch/riscv/traps.c
+++ b/xen/arch/riscv/traps.c
@@ -171,6 +171,10 @@ static void do_unexpected_trap(const struct cpu_user_regs *regs)
 
 static void check_for_pcpu_work(void)
 {
+    struct vcpu *curr = current;
+
+    vcpu_sync_interrupts(curr);
+
     p2m_handle_vmenter();
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 10 10:33:53 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Mar 2026 10:33:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1249966.1547341 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzuPR-0005b3-ND; Tue, 10 Mar 2026 10:33:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1249966.1547341; Tue, 10 Mar 2026 10:33:53 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzuPR-0005av-K5; Tue, 10 Mar 2026 10:33:53 +0000
Received: by outflank-mailman (input) for mailman id 1249966;
 Tue, 10 Mar 2026 10:33:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vzuPQ-0005an-92
 for xen-changelog@lists.xenproject.org; Tue, 10 Mar 2026 10:33:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzuPQ-001aEj-1T
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 10:33:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzuPQ-001dys-0f
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 10:33:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=KDswTQcYrRgBX8MuXqJO1yexqIyUB6zPfyN3vIuyyzM=; b=0xM4fxqLgKzoVvdqcwKd6T8AtQ
	96rIUWXG4K0yHdFbkwOJ/Hd2JZdHV52+jIb6jT4pQllbuUJ8udA7Iq06yKM8D/hHi9WgI+kWMBCpg
	9MD3rstawG7OlNNPi7JeImmBQ/GATC21IePjeri2LCCytqpY/GEJNo9v9r7eXJZa7epU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/riscv: introduce tracking of pending vCPU interrupts, part 2
Message-Id: <E1vzuPQ-001dys-0f@xenbits.xenproject.org>
Date: Tue, 10 Mar 2026 10:33:52 +0000

commit 7379853e0cc91fd760ef3247fc352f7610f16eda
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Fri Mar 6 17:33:21 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 10 09:25:45 2026 +0100

    xen/riscv: introduce tracking of pending vCPU interrupts, part 2
    
    This patch is based on Linux kernel 6.16.0.
    
    Add the consumer side (vcpu_flush_interrupts()) of the lockless pending
    interrupt tracking introduced in part 1 (for producers). According, to the
    design only one consumer is possible, and it is vCPU itself.
    vcpu_flush_interrupts() is expected to be ran (as guests aren't ran now due
    to the lack of functionality) before the hypervisor returns control to the
    guest.
    
    Producers may set bits in irqs_pending_mask without a lock. Clearing bits in
    irqs_pending_mask is performed only by the consumer via xchg() (with aquire
    semantics). The consumer must not write to irqs_pending and must not act on
    bits that are not set in the mask. Otherwise, extra synchronization should
    be provided.
    The worst thing which could happen with such approach is that a new pending
    bit will be set to irqs_pending bitmap during update of hvip variable in
    vcpu_flush_interrupt() but it isn't problem as the new pending bit won't
    be lost and just be proceded during the next flush.
    
    As AIA specs introduced hviph register which would want to be updated when
    guest related AIA code vcpu_update_hvip() is introduced instead of just
    open-code it in vcpu_flush_interrupts().
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/domain.c             | 27 +++++++++++++++++++++++++++
 xen/arch/riscv/include/asm/domain.h |  1 +
 xen/arch/riscv/traps.c              |  2 ++
 3 files changed, 30 insertions(+)

diff --git a/xen/arch/riscv/domain.c b/xen/arch/riscv/domain.c
index 694a03ab74..9c86581ea2 100644
--- a/xen/arch/riscv/domain.c
+++ b/xen/arch/riscv/domain.c
@@ -231,6 +231,33 @@ void vcpu_sync_interrupts(struct vcpu *curr)
     }
 }
 
+void vcpu_flush_interrupts(struct vcpu *curr)
+{
+    ASSERT(curr == current);
+
+    if ( ACCESS_ONCE(curr->arch.irqs_pending_mask[0]) )
+    {
+        unsigned long mask = xchg(&curr->arch.irqs_pending_mask[0], 0UL);
+        unsigned long val = ACCESS_ONCE(curr->arch.irqs_pending[0]) & mask;
+        register_t *hvip = &curr->arch.hvip;
+
+        *hvip &= ~mask;
+        *hvip |= val;
+
+        csr_write(CSR_HVIP, *hvip);
+    }
+
+#ifdef CONFIG_RISCV_32
+    /*
+     * Flush AIA high interrupts.
+     *
+     * It is necessary to do only for CONFIG_RISCV_32 which isn't
+     * supported now.
+     */
+#   error "Update v->arch.hviph"
+#endif
+}
+
 static void __init __maybe_unused build_assertions(void)
 {
     /*
diff --git a/xen/arch/riscv/include/asm/domain.h b/xen/arch/riscv/include/asm/domain.h
index 1ecfe18c85..59d23e4f92 100644
--- a/xen/arch/riscv/include/asm/domain.h
+++ b/xen/arch/riscv/include/asm/domain.h
@@ -115,6 +115,7 @@ int vcpu_set_interrupt(struct vcpu *v, unsigned int irq);
 int vcpu_unset_interrupt(struct vcpu *v, unsigned int irq);
 
 void vcpu_sync_interrupts(struct vcpu *curr);
+void vcpu_flush_interrupts(struct vcpu *curr);
 
 #endif /* ASM__RISCV__DOMAIN_H */
 
diff --git a/xen/arch/riscv/traps.c b/xen/arch/riscv/traps.c
index 551f886e3a..244264c92a 100644
--- a/xen/arch/riscv/traps.c
+++ b/xen/arch/riscv/traps.c
@@ -175,6 +175,8 @@ static void check_for_pcpu_work(void)
 
     vcpu_sync_interrupts(curr);
 
+    vcpu_flush_interrupts(curr);
+
     p2m_handle_vmenter();
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 10 10:34:03 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Mar 2026 10:34:03 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1249967.1547345 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzuPb-0005db-RG; Tue, 10 Mar 2026 10:34:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1249967.1547345; Tue, 10 Mar 2026 10:34:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzuPb-0005dT-Nx; Tue, 10 Mar 2026 10:34:03 +0000
Received: by outflank-mailman (input) for mailman id 1249967;
 Tue, 10 Mar 2026 10:34:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vzuPa-0005dK-DJ
 for xen-changelog@lists.xenproject.org; Tue, 10 Mar 2026 10:34:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzuPa-001aF0-1j
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 10:34:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzuPa-001e0A-0y
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 10:34:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=T79t40oPy9jJCn5CiMiF6nHAmkWawXjXohGMaUtae/o=; b=rXAxRCErN8qdSpAEyWopH6d36Y
	zkutVd5z6wYh/BHklxcZ2VsYY5xausRjujftuKqVpAlHLV0czOKA3+y8FOBVIA+hQqI8IUPu/E1Zy
	fOKXelkGBUkxA9RmJXZIYnOILpau1lXGDFqYKvwumxRV6FtoN7PuQiofdH6/xtmh2esQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/riscv: introduce basic vtimer infrastructure for guests
Message-Id: <E1vzuPa-001e0A-0y@xenbits.xenproject.org>
Date: Tue, 10 Mar 2026 10:34:02 +0000

commit 2473ddf9b4f991859353a2a9641ff19af1dffd93
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Fri Mar 6 17:33:22 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 10 09:25:59 2026 +0100

    xen/riscv: introduce basic vtimer infrastructure for guests
    
    Lay the groundwork for guest timer support by introducing a per-vCPU
    virtual timer backed by Xen’s common timer infrastructure.
    
    The virtual timer is programmed in response to the guest SBI
    sbi_set_timer() call and injects a virtual supervisor timer interrupt
    into the vCPU when it expires.
    
    While a dedicated struct vtimer is not strictly required at present,
    it is expected to become necessary once SSTC support is introduced.
    In particular, it will need to carry additional state such as whether
    SSTC is enabled, the next compare value (e.g. for the VSTIMECMP CSR)
    to be saved and restored across context switches, and time delta state
    (e.g. HTIMEDELTA) required for use cases such as migration. Introducing
    struct vtimer now avoids a later refactoring.
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/Makefile             |  1 +
 xen/arch/riscv/domain.c             | 10 ++++--
 xen/arch/riscv/include/asm/domain.h |  3 ++
 xen/arch/riscv/include/asm/vtimer.h | 17 +++++++++
 xen/arch/riscv/vtimer.c             | 71 +++++++++++++++++++++++++++++++++++++
 5 files changed, 100 insertions(+), 2 deletions(-)

diff --git a/xen/arch/riscv/Makefile b/xen/arch/riscv/Makefile
index bc47e83b26..ffbd7062e2 100644
--- a/xen/arch/riscv/Makefile
+++ b/xen/arch/riscv/Makefile
@@ -22,6 +22,7 @@ obj-y += traps.o
 obj-y += vmid.o
 obj-y += vm_event.o
 obj-y += vsbi/
+obj-y += vtimer.o
 
 $(TARGET): $(TARGET)-syms
 	$(OBJCOPY) -O binary -S $< $@
diff --git a/xen/arch/riscv/domain.c b/xen/arch/riscv/domain.c
index 9c86581ea2..d25938200f 100644
--- a/xen/arch/riscv/domain.c
+++ b/xen/arch/riscv/domain.c
@@ -10,6 +10,7 @@
 #include <asm/cpufeature.h>
 #include <asm/csr.h>
 #include <asm/riscv_encoding.h>
+#include <asm/vtimer.h>
 
 struct csr_masks {
     register_t hedeleg;
@@ -148,11 +149,14 @@ int arch_vcpu_create(struct vcpu *v)
 
     vcpu_csr_init(v);
 
+    if ( (rc = vcpu_vtimer_init(v)) )
+        goto fail;
+
     /*
-     * As the vtimer and interrupt controller (IC) are not yet implemented,
+     * As interrupt controller (IC) is not yet implemented,
      * return an error.
      *
-     * TODO: Drop this once the vtimer and IC are implemented.
+     * TODO: Drop this once IC is implemented.
      */
     rc = -EOPNOTSUPP;
     goto fail;
@@ -166,6 +170,8 @@ int arch_vcpu_create(struct vcpu *v)
 
 void arch_vcpu_destroy(struct vcpu *v)
 {
+    vcpu_timer_destroy(v);
+
     vfree((void *)&v->arch.cpu_info[1] - STACK_SIZE);
 }
 
diff --git a/xen/arch/riscv/include/asm/domain.h b/xen/arch/riscv/include/asm/domain.h
index 59d23e4f92..6c48bf1311 100644
--- a/xen/arch/riscv/include/asm/domain.h
+++ b/xen/arch/riscv/include/asm/domain.h
@@ -8,6 +8,7 @@
 #include <public/hvm/params.h>
 
 #include <asm/p2m.h>
+#include <asm/vtimer.h>
 
 struct vcpu_vmid {
     uint64_t generation;
@@ -49,6 +50,8 @@ struct arch_vcpu {
 
     struct cpu_info *cpu_info;
 
+    struct vtimer vtimer;
+
     register_t hcounteren;
     register_t hedeleg;
     register_t hideleg;
diff --git a/xen/arch/riscv/include/asm/vtimer.h b/xen/arch/riscv/include/asm/vtimer.h
new file mode 100644
index 0000000000..111863610a
--- /dev/null
+++ b/xen/arch/riscv/include/asm/vtimer.h
@@ -0,0 +1,17 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#ifndef ASM__RISCV__VTIMER_H
+#define ASM__RISCV__VTIMER_H
+
+#include <xen/timer.h>
+
+struct vtimer {
+    struct timer timer;
+};
+
+int vcpu_vtimer_init(struct vcpu *v);
+void vcpu_timer_destroy(struct vcpu *v);
+
+void vtimer_set_timer(struct vtimer *t, uint64_t ticks);
+
+#endif /* ASM__RISCV__VTIMER_H */
diff --git a/xen/arch/riscv/vtimer.c b/xen/arch/riscv/vtimer.c
new file mode 100644
index 0000000000..32d142bcdf
--- /dev/null
+++ b/xen/arch/riscv/vtimer.c
@@ -0,0 +1,71 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#include <xen/sched.h>
+#include <xen/timer.h>
+
+#include <asm/vtimer.h>
+
+static void vtimer_expired(void *data)
+{
+    struct vtimer *t = data;
+    struct vcpu *v = container_of(t, struct vcpu, arch.vtimer);
+
+    vcpu_set_interrupt(v, IRQ_VS_TIMER);
+}
+
+int vcpu_vtimer_init(struct vcpu *v)
+{
+    struct vtimer *t = &v->arch.vtimer;
+
+    init_timer(&t->timer, vtimer_expired, t, v->processor);
+
+    return 0;
+}
+
+void vcpu_timer_destroy(struct vcpu *v)
+{
+    struct vtimer *t = &v->arch.vtimer;
+
+    if ( t->timer.status == TIMER_STATUS_invalid )
+        return;
+
+    kill_timer(&v->arch.vtimer.timer);
+}
+
+void vtimer_set_timer(struct vtimer *t, const uint64_t ticks)
+{
+    struct vcpu *v = container_of(t, struct vcpu, arch.vtimer);
+    s_time_t expires = ticks_to_ns(ticks - boot_clock_cycles);
+
+    vcpu_unset_interrupt(v, IRQ_VS_TIMER);
+
+    /*
+     * According to the RISC-V sbi spec:
+     *   If the supervisor wishes to clear the timer interrupt without
+     *   scheduling the next timer event, it can either request a timer
+     *   interrupt infinitely far into the future (i.e., (uint64_t)-1),
+     *   or it can instead mask the timer interrupt by clearing sie.STIE CSR
+     *   bit.
+     */
+    if ( ticks == ((uint64_t)~0) )
+    {
+        stop_timer(&t->timer);
+
+        return;
+    }
+
+    if ( expires < NOW() )
+    {
+        /*
+         * Simplify the logic if the timeout has already expired and just
+         * inject the event.
+         */
+        stop_timer(&t->timer);
+        vcpu_set_interrupt(v, IRQ_VS_TIMER);
+
+        return;
+    }
+
+    migrate_timer(&t->timer, smp_processor_id());
+    set_timer(&t->timer, expires);
+}
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 10 10:34:13 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Mar 2026 10:34:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1249968.1547349 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzuPl-0005fd-Sj; Tue, 10 Mar 2026 10:34:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1249968.1547349; Tue, 10 Mar 2026 10:34:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzuPl-0005fS-Pe; Tue, 10 Mar 2026 10:34:13 +0000
Received: by outflank-mailman (input) for mailman id 1249968;
 Tue, 10 Mar 2026 10:34:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vzuPk-0005fI-EP
 for xen-changelog@lists.xenproject.org; Tue, 10 Mar 2026 10:34:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzuPk-001aF6-21
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 10:34:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzuPk-001e1L-1E
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 10:34:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=MLFzwZX3Uf69Xkgevl/vgxCV9az7QlJ+1O0a7jpEvnM=; b=hw31Lk1lP+7Bo0MTjmRv74R21L
	+g7TLve0BXJRjAneXrLx+CGUXIrsNuKxhYwYechjz/ETquC6Ihxbe36/lBHTIG8KNtCeEmhgjm4GB
	aIPMDEEoqjBbAulx1TGkWPdYLElex1w9EtAtDFms1XtrieZgO/pL8il7jk4PFmh2VAL8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/riscv: introduce vcpu_kick() implementation
Message-Id: <E1vzuPk-001e1L-1E@xenbits.xenproject.org>
Date: Tue, 10 Mar 2026 10:34:12 +0000

commit d81a91b0e4dde994c5ebb0e4d199f7bc44358aec
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Fri Mar 6 17:33:23 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 10 09:26:13 2026 +0100

    xen/riscv: introduce vcpu_kick() implementation
    
    Add a RISC-V implementation of vcpu_kick(), which unblocks the target
    vCPU and sends an event check IPI if the vCPU was running on another
    processor. This mirrors the behavior of Arm and enables proper vCPU
    wakeup handling on RISC-V.
    
    Remove the stub implementation from stubs.c, as it is now provided by
    arch/riscv/domain.c.
    
    Since vcpu_kick() calls perfc_incr(vcpu_kick), add perfcounter for
    vcpu_kick to handle the case when CONFIG_PERF_COUNTERS=y. Although
    CONFIG_PERF_COUNTERS is not enabled by default, it can be enabled,
    for example, by randconfig what will lead to CI build issues.
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/domain.c                 | 14 ++++++++++++++
 xen/arch/riscv/include/asm/Makefile     |  1 -
 xen/arch/riscv/include/asm/perfc_defn.h |  3 +++
 xen/arch/riscv/stubs.c                  |  5 -----
 4 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/xen/arch/riscv/domain.c b/xen/arch/riscv/domain.c
index d25938200f..470eca3ad7 100644
--- a/xen/arch/riscv/domain.c
+++ b/xen/arch/riscv/domain.c
@@ -1,9 +1,11 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 
+#include <xen/cpumask.h>
 #include <xen/init.h>
 #include <xen/mm.h>
 #include <xen/sections.h>
 #include <xen/sched.h>
+#include <xen/smp.h>
 #include <xen/vmap.h>
 
 #include <asm/bitops.h>
@@ -264,6 +266,18 @@ void vcpu_flush_interrupts(struct vcpu *curr)
 #endif
 }
 
+void vcpu_kick(struct vcpu *v)
+{
+    bool running = v->is_running;
+
+    vcpu_unblock(v);
+    if ( running && v != current )
+    {
+        perfc_incr(vcpu_kick);
+        smp_send_event_check_mask(cpumask_of(v->processor));
+    }
+}
+
 static void __init __maybe_unused build_assertions(void)
 {
     /*
diff --git a/xen/arch/riscv/include/asm/Makefile b/xen/arch/riscv/include/asm/Makefile
index 3824f31c39..86c56251d5 100644
--- a/xen/arch/riscv/include/asm/Makefile
+++ b/xen/arch/riscv/include/asm/Makefile
@@ -7,7 +7,6 @@ generic-y += hypercall.h
 generic-y += iocap.h
 generic-y += irq-dt.h
 generic-y += percpu.h
-generic-y += perfc_defn.h
 generic-y += random.h
 generic-y += softirq.h
 generic-y += vm_event.h
diff --git a/xen/arch/riscv/include/asm/perfc_defn.h b/xen/arch/riscv/include/asm/perfc_defn.h
new file mode 100644
index 0000000000..8a4b945df6
--- /dev/null
+++ b/xen/arch/riscv/include/asm/perfc_defn.h
@@ -0,0 +1,3 @@
+/* This file is intended to be included multiple times. */
+
+PERFCOUNTER(vcpu_kick, "vcpu: notify other vcpu")
diff --git a/xen/arch/riscv/stubs.c b/xen/arch/riscv/stubs.c
index daadff0138..eedf8bf935 100644
--- a/xen/arch/riscv/stubs.c
+++ b/xen/arch/riscv/stubs.c
@@ -203,11 +203,6 @@ void vcpu_block_unless_event_pending(struct vcpu *v)
     BUG_ON("unimplemented");
 }
 
-void vcpu_kick(struct vcpu *v)
-{
-    BUG_ON("unimplemented");
-}
-
 unsigned long
 hypercall_create_continuation(unsigned int op, const char *format, ...)
 {
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 10 10:34:23 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Mar 2026 10:34:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1249969.1547352 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzuPv-0005i2-Tb; Tue, 10 Mar 2026 10:34:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1249969.1547352; Tue, 10 Mar 2026 10:34:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzuPv-0005hu-Qz; Tue, 10 Mar 2026 10:34:23 +0000
Received: by outflank-mailman (input) for mailman id 1249969;
 Tue, 10 Mar 2026 10:34:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vzuPu-0005hm-H7
 for xen-changelog@lists.xenproject.org; Tue, 10 Mar 2026 10:34:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzuPu-001aFA-2I
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 10:34:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzuPu-001e2G-1W
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 10:34:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=etXQKi3Lh5r8Oszv8CTtt6tb5pNaWbSRHSKiACSuOSw=; b=Crf8+2twSeEN/a7mLL0lRv6PUk
	hx9sjWFuDzSkAjwAoPGqCVZAnyy3vuq/GSOaU6sn8xs2Mw+MgdxGVfVvfBeYojYp3N+V57Zxvkyry
	tETdzweWAHnQgtBalBZ4eBP6Hr2GIugdQjuhSlPr/cDt9Jl1osmVqkBxD8rascNUGyJw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/riscv: add vtimer context switch helpers
Message-Id: <E1vzuPu-001e2G-1W@xenbits.xenproject.org>
Date: Tue, 10 Mar 2026 10:34:22 +0000

commit 4313feae90068fb8fccafe401dd7976cbe117db8
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Fri Mar 6 17:33:24 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 10 09:26:24 2026 +0100

    xen/riscv: add vtimer context switch helpers
    
    Introduce vtimer_ctxt_switch_from() and vtimer_ctxt_switch_to() to handle
    virtual timer state across vCPU context switches.
    
    At present, vtimer_ctxt_switch_from() is a no-op because the RISC-V SSTC
    extension, which provides a virtualization-aware timer, is not yet
    supported. Xen therefore relies the virtual (SBI-based) timer.
    
    The virtual timer uses Xen's internal timer infrastructure and must be
    associated with the pCPU on which the vCPU is currently running so that
    timer events can be delivered efficiently. As a result, vtimer_ctxt_switch_to()
    migrates the timer to the target pCPU when a vCPU is scheduled in.
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/include/asm/vtimer.h |  3 +++
 xen/arch/riscv/vtimer.c             | 15 +++++++++++++++
 2 files changed, 18 insertions(+)

diff --git a/xen/arch/riscv/include/asm/vtimer.h b/xen/arch/riscv/include/asm/vtimer.h
index 111863610a..b4d48d1a17 100644
--- a/xen/arch/riscv/include/asm/vtimer.h
+++ b/xen/arch/riscv/include/asm/vtimer.h
@@ -14,4 +14,7 @@ void vcpu_timer_destroy(struct vcpu *v);
 
 void vtimer_set_timer(struct vtimer *t, uint64_t ticks);
 
+void vtimer_ctxt_switch_from(struct vcpu *p);
+void vtimer_ctxt_switch_to(struct vcpu *n);
+
 #endif /* ASM__RISCV__VTIMER_H */
diff --git a/xen/arch/riscv/vtimer.c b/xen/arch/riscv/vtimer.c
index 32d142bcdf..afd8a53a73 100644
--- a/xen/arch/riscv/vtimer.c
+++ b/xen/arch/riscv/vtimer.c
@@ -1,5 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 
+#include <xen/bug.h>
 #include <xen/sched.h>
 #include <xen/timer.h>
 
@@ -69,3 +70,17 @@ void vtimer_set_timer(struct vtimer *t, const uint64_t ticks)
     migrate_timer(&t->timer, smp_processor_id());
     set_timer(&t->timer, expires);
 }
+
+void vtimer_ctxt_switch_from(struct vcpu *p)
+{
+    ASSERT(!is_idle_vcpu(p));
+
+    /* Nothing to do at the moment as SSTC isn't supported now. */
+}
+
+void vtimer_ctxt_switch_to(struct vcpu *n)
+{
+    ASSERT(!is_idle_vcpu(n));
+
+    migrate_timer(&n->arch.vtimer.timer, n->processor);
+}
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 10 10:34:33 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Mar 2026 10:34:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1249970.1547356 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzuQ5-0005li-V9; Tue, 10 Mar 2026 10:34:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1249970.1547356; Tue, 10 Mar 2026 10:34:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzuQ5-0005la-SZ; Tue, 10 Mar 2026 10:34:33 +0000
Received: by outflank-mailman (input) for mailman id 1249970;
 Tue, 10 Mar 2026 10:34:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vzuQ4-0005lT-JQ
 for xen-changelog@lists.xenproject.org; Tue, 10 Mar 2026 10:34:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzuQ4-001aFH-2Y
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 10:34:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzuQ4-001e2r-1n
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 10:34:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Jx4Kf2YCLxy93DNs5beLlCDbR7qduOFsC3FqS31quBk=; b=VSLL2m33r2MxRY/tqrnu9/nWlw
	k8YtdUCxE9hxTVKh23MNftz0PLOZg8FLhq8p5CRP/7h5PpSM2gLS5tISXoeLR78dMXywbmoX7/vZ7
	ZfELHFdsDk/wGyXJJnXalJnKhgUgFzteQR6cq/3KJGZOtVQ3pZFCbNMp1nuHlcUgwNsE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/riscv: implement SBI legacy SET_TIMER support for guests
Message-Id: <E1vzuQ4-001e2r-1n@xenbits.xenproject.org>
Date: Tue, 10 Mar 2026 10:34:32 +0000

commit 647542cdf13ee31e7d32dcaddba8899cfdc98747
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Fri Mar 6 17:33:25 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 10 09:26:41 2026 +0100

    xen/riscv: implement SBI legacy SET_TIMER support for guests
    
    Add handling of the SBI_EXT_0_1_SET_TIMER function ID to the legacy
    extension ecall handler. The handler now programs the vCPU’s virtual
    timer via vtimer_set_timer() and returns SBI_SUCCESS.
    
    This enables guests using the legacy SBI timer interface to schedule
    timer events correctly.
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/vsbi/legacy-extension.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/xen/arch/riscv/vsbi/legacy-extension.c b/xen/arch/riscv/vsbi/legacy-extension.c
index 2e8df191c2..090c23440c 100644
--- a/xen/arch/riscv/vsbi/legacy-extension.c
+++ b/xen/arch/riscv/vsbi/legacy-extension.c
@@ -7,6 +7,7 @@
 
 #include <asm/processor.h>
 #include <asm/vsbi.h>
+#include <asm/vtimer.h>
 
 static void vsbi_print_char(char c)
 {
@@ -44,6 +45,11 @@ static int vsbi_legacy_ecall_handler(unsigned long eid, unsigned long fid,
         ret = SBI_ERR_NOT_SUPPORTED;
         break;
 
+    case SBI_EXT_0_1_SET_TIMER:
+        vtimer_set_timer(&current->arch.vtimer, regs->a0);
+        regs->a0 = SBI_SUCCESS;
+        break;
+
     default:
         /*
          * TODO: domain_crash() is acceptable here while things are still under
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 10 10:34:44 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Mar 2026 10:34:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1249971.1547361 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzuQG-0005nb-0T; Tue, 10 Mar 2026 10:34:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1249971.1547361; Tue, 10 Mar 2026 10:34:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzuQF-0005nT-U9; Tue, 10 Mar 2026 10:34:43 +0000
Received: by outflank-mailman (input) for mailman id 1249971;
 Tue, 10 Mar 2026 10:34:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vzuQE-0005nL-ME
 for xen-changelog@lists.xenproject.org; Tue, 10 Mar 2026 10:34:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzuQE-001aFb-2o
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 10:34:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzuQE-001e3O-22
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 10:34:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=JtiD6s+Ejq8RO+5O9eSPe1dl3ZMzIj0EDdQvLk9R/os=; b=eQ3qxw7sglZWP82y/jb6ryX7S/
	qgy3wdGxtz9JakKxs5yCrZPfvEoD0wNHsztAaF7pDxClYEz5ox10tTyX695kLp78UB+jNren4HTcw
	UFsjnnrywvwUWB5bJk5mKLiyMHi6s/v6+xzGNjZyeffF0UpUuta4HTJv+J6Y03yhMAeY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/riscv: introduce sbi_set_timer()
Message-Id: <E1vzuQE-001e3O-22@xenbits.xenproject.org>
Date: Tue, 10 Mar 2026 10:34:42 +0000

commit e56decd0a2ccd5c64c05dbead05c78c36815e126
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Fri Mar 6 17:33:26 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 10 09:26:58 2026 +0100

    xen/riscv: introduce sbi_set_timer()
    
    Introduce a function pointer for sbi_set_timer(), since different OpenSBI
    versions may implement the TIME extension with different extension IDs
    and/or function IDs.
    
    If the TIME extension is not available, fall back to the legacy timer
    mechanism. This is useful when Xen runs as a guest under another Xen,
    because the TIME extension is not currently virtualised and therefore
    will not appear as available.
    Despite of the fact that sbi_set_timer_v01 is introduced and used as
    fall back, SBI v0.1 still isn't fully supported (with the current SBI
    calls usage, sbi_rfence_v01 should be introduced too), so panic()
    in sbi_init() isn't removed.
    
    The sbi_set_timer() pointer will be used by reprogram_timer() to program
    Xen’s physical timer as without SSTC extension there is no any other
    option except SBI call to do that as only M-timer is available for us.
    
    Use dprintk() for all the cases to print that a speicifc SBI extension
    is available as it isn't really necessary in case of release builds.
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/include/asm/sbi.h | 22 ++++++++++++++++++++++
 xen/arch/riscv/sbi.c             | 40 +++++++++++++++++++++++++++++++++++++++-
 2 files changed, 61 insertions(+), 1 deletion(-)

diff --git a/xen/arch/riscv/include/asm/sbi.h b/xen/arch/riscv/include/asm/sbi.h
index 79f7ff5c55..ed7af20028 100644
--- a/xen/arch/riscv/include/asm/sbi.h
+++ b/xen/arch/riscv/include/asm/sbi.h
@@ -13,6 +13,7 @@
 #define ASM__RISCV__SBI_H
 
 #include <xen/cpumask.h>
+#include <xen/sections.h>
 
 /* SBI-defined implementation ID */
 #define SBI_XEN_IMPID 7
@@ -29,6 +30,7 @@
 
 #define SBI_EXT_BASE                    0x10
 #define SBI_EXT_RFENCE                  0x52464E43
+#define SBI_EXT_TIME                    0x54494D45
 
 /* SBI function IDs for BASE extension */
 #define SBI_EXT_BASE_GET_SPEC_VERSION   0x0
@@ -48,6 +50,9 @@
 #define SBI_EXT_RFENCE_REMOTE_HFENCE_VVMA       0x5
 #define SBI_EXT_RFENCE_REMOTE_HFENCE_VVMA_ASID  0x6
 
+/* SBI function IDs for TIME extension */
+#define SBI_EXT_TIME_SET_TIMER          0x0
+
 #define SBI_SPEC_VERSION_MAJOR_MASK     0x7f000000
 #define SBI_SPEC_VERSION_MINOR_MASK     0x00ffffff
 
@@ -134,6 +139,23 @@ int sbi_remote_hfence_gvma(const cpumask_t *cpu_mask, vaddr_t start,
 int sbi_remote_hfence_gvma_vmid(const cpumask_t *cpu_mask, vaddr_t start,
                                 size_t size, unsigned long vmid);
 
+/*
+ * Programs the clock for next event at (or after) stime_value. stime_value is
+ * in absolute time. This function must clear the pending timer interrupt bit
+ * as well.
+ *
+ * If the supervisor wishes to clear the timer interrupt without scheduling the
+ * next timer event, it can either request a timer interrupt infinitely far
+ * into the future (i.e., (uint64_t)-1), or it can instead mask the timer
+ * interrupt by clearing sie.STIE CSR bit.
+ *
+ * The stime_value parameter represents absolute time measured in ticks.
+ *
+ * This SBI call returns 0 upon success or an implementation specific negative
+ * error code.
+ */
+extern int (* __ro_after_init sbi_set_timer)(uint64_t stime_value);
+
 /*
  * Initialize SBI library
  *
diff --git a/xen/arch/riscv/sbi.c b/xen/arch/riscv/sbi.c
index 425dce44c6..b4a7ae6940 100644
--- a/xen/arch/riscv/sbi.c
+++ b/xen/arch/riscv/sbi.c
@@ -249,6 +249,38 @@ static int (* __ro_after_init sbi_rfence)(unsigned long fid,
                                           unsigned long arg4,
                                           unsigned long arg5);
 
+static int cf_check sbi_set_timer_v02(uint64_t stime_value)
+{
+    struct sbiret ret;
+
+    ret = sbi_ecall(SBI_EXT_TIME, SBI_EXT_TIME_SET_TIMER, stime_value,
+#ifdef CONFIG_RISCV_32
+                    stime_value >> 32,
+#else
+                    0,
+#endif
+                    0, 0, 0, 0);
+
+    return sbi_err_map_xen_errno(ret.error);
+}
+
+static int cf_check sbi_set_timer_v01(uint64_t stime_value)
+{
+    struct sbiret ret;
+
+    ret = sbi_ecall(SBI_EXT_0_1_SET_TIMER, 0, stime_value,
+#ifdef CONFIG_RISCV_32
+                    stime_value >> 32,
+#else
+                    0,
+#endif
+                    0, 0, 0, 0);
+
+    return sbi_err_map_xen_errno(ret.error);
+}
+
+int (* __ro_after_init sbi_set_timer)(uint64_t stime_value) = sbi_set_timer_v01;
+
 int sbi_remote_sfence_vma(const cpumask_t *cpu_mask, vaddr_t start,
                           size_t size)
 {
@@ -324,7 +356,13 @@ int __init sbi_init(void)
         if ( sbi_probe_extension(SBI_EXT_RFENCE) > 0 )
         {
             sbi_rfence = sbi_rfence_v02;
-            printk("SBI v0.2 RFENCE extension detected\n");
+            dprintk(XENLOG_INFO, "SBI v0.2 RFENCE extension detected\n");
+        }
+
+        if ( sbi_probe_extension(SBI_EXT_TIME) > 0 )
+        {
+            sbi_set_timer = sbi_set_timer_v02;
+            dprintk(XENLOG_INFO, "SBI v0.2 TIME extension detected\n");
         }
     }
     else
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 10 10:34:54 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Mar 2026 10:34:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1249972.1547365 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzuQQ-0005pt-2l; Tue, 10 Mar 2026 10:34:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1249972.1547365; Tue, 10 Mar 2026 10:34:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzuQP-0005pl-Vh; Tue, 10 Mar 2026 10:34:53 +0000
Received: by outflank-mailman (input) for mailman id 1249972;
 Tue, 10 Mar 2026 10:34:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vzuQO-0005pe-Ok
 for xen-changelog@lists.xenproject.org; Tue, 10 Mar 2026 10:34:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzuQO-001aFh-34
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 10:34:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzuQO-001e4I-2I
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 10:34:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=3McMa3IVf7sMA2wRIltHVYBuRRB7N2G4zoovatxkg0o=; b=GDoIDznmYdTT0L9xrEZtom+W8c
	ULKtq/LtOKLaaieUezLLJoFmnBQEaOnAtYZObadVJ0f3pZ82nb9pV+/E3BBzS7EJ+u5tMvPur0fgI
	6aCqozt7wdX3lsMTWmPVymCaaI7tc5U17NMVq9cpTIWZ8EUCRwXXOnu/0s0UcS4fO73w=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/riscv: implement reprogram_timer() via SBI
Message-Id: <E1vzuQO-001e4I-2I@xenbits.xenproject.org>
Date: Tue, 10 Mar 2026 10:34:52 +0000

commit f3f7359b617c659d4f526d70a6d405ed12e4021d
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Fri Mar 6 17:33:27 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 10 09:27:10 2026 +0100

    xen/riscv: implement reprogram_timer() via SBI
    
    Implement reprogram_timer() on RISC-V using the standard SBI timer call.
    
    The privileged architecture only defines machine-mode timer interrupts
    (using mtime/mtimecmp). Therefore, timer services for S/HS/VS mode must
    be provided by M-mode via SBI calls. SSTC (Supervisor-mode Timer Control)
    is optional and is not supported on the boards available to me, so the
    only viable approach today is to program the timer through SBI.
    
    reprogram_timer() enables/disables the supervisor timer interrupt and
    programs the next timer deadline using sbi_set_timer(). If the SBI call
    fails, the code panics, because sbi_set_timer() is expected to return
    either 0 or -ENOSUPP (this has been stable from early OpenSBI versions to
    the latest ones). The SBI spec does not define a standard negative error
    code for this call, and without SSTC there is no alternative method to
    program the timer, so the SBI timer call must be available.
    
    reprogram_timer() currently returns int for compatibility with the
    existing prototype. While it might be cleaner to return bool, keeping the
    existing signature avoids premature changes in case sbi_set_timer() ever
    needs to return other values (based on which we could try to avoid
    panic-ing) in the future.
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/stubs.c |  5 -----
 xen/arch/riscv/time.c  | 43 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 43 insertions(+), 5 deletions(-)

diff --git a/xen/arch/riscv/stubs.c b/xen/arch/riscv/stubs.c
index eedf8bf935..2f3a0ce76a 100644
--- a/xen/arch/riscv/stubs.c
+++ b/xen/arch/riscv/stubs.c
@@ -21,11 +21,6 @@ nodemask_t __read_mostly node_online_map = { { [0] = 1UL } };
 
 /* time.c */
 
-int reprogram_timer(s_time_t timeout)
-{
-    BUG_ON("unimplemented");
-}
-
 void send_timer_event(struct vcpu *v)
 {
     BUG_ON("unimplemented");
diff --git a/xen/arch/riscv/time.c b/xen/arch/riscv/time.c
index 2c7af0a5d6..7efa76fdbc 100644
--- a/xen/arch/riscv/time.c
+++ b/xen/arch/riscv/time.c
@@ -7,6 +7,9 @@
 #include <xen/time.h>
 #include <xen/types.h>
 
+#include <asm/csr.h>
+#include <asm/sbi.h>
+
 unsigned long __ro_after_init cpu_khz; /* CPU clock frequency in kHz. */
 uint64_t __ro_after_init boot_clock_cycles;
 
@@ -40,6 +43,46 @@ static void __init preinit_dt_xen_time(void)
     cpu_khz = rate / 1000;
 }
 
+int reprogram_timer(s_time_t timeout)
+{
+    uint64_t deadline, now;
+    int rc;
+
+    if ( timeout == 0 )
+    {
+        /* Disable timer interrupt */
+        csr_clear(CSR_SIE, BIT(IRQ_S_TIMER, UL));
+
+        return 1;
+    }
+
+    deadline = ns_to_ticks(timeout) + boot_clock_cycles;
+    now = get_cycles();
+    if ( deadline <= now )
+        return 0;
+
+    /*
+     * TODO: When the SSTC extension is supported, it would be preferable to
+     *       use the supervisor timer registers directly here for better
+     *       performance, since an SBI call and mode switch would no longer
+     *       be required.
+     *
+     *       This would also reduce reliance on a specific SBI implementation.
+     *       For example, it is not ideal to panic() if sbi_set_timer() returns
+     *       a non-zero value. Currently it can return 0 or -ENOSUPP, and
+     *       without SSTC we still need an implementation because only the
+     *       M-mode timer is available, and it can only be programmed in
+     *       M-mode.
+     */
+    if ( (rc = sbi_set_timer(deadline)) )
+        panic("%s: timer wasn't set because: %d\n", __func__, rc);
+
+    /* Enable timer interrupt */
+    csr_set(CSR_SIE, BIT(IRQ_S_TIMER, UL));
+
+    return 1;
+}
+
 void __init preinit_xen_time(void)
 {
     if ( acpi_disabled )
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 10 10:35:04 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Mar 2026 10:35:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1249973.1547368 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzuQa-0005sX-4a; Tue, 10 Mar 2026 10:35:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1249973.1547368; Tue, 10 Mar 2026 10:35:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzuQa-0005sP-23; Tue, 10 Mar 2026 10:35:04 +0000
Received: by outflank-mailman (input) for mailman id 1249973;
 Tue, 10 Mar 2026 10:35:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vzuQY-0005sH-RQ
 for xen-changelog@lists.xenproject.org; Tue, 10 Mar 2026 10:35:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzuQZ-001aFw-07
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 10:35:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzuQY-001e53-2Z
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 10:35:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=XCZIGmBZGF0c0KEpHC9gEnYJpSOKpnwypKTg4O6tAyo=; b=4mgU3Mx+xPhLA4plz7OXZ4Mz8A
	WTUBXcgMuS/NvsnDsGOTAPzZei86kLW/sDsraRHOYyqjpxaL9GBx9JWyr0pt9GyCJ3SpMA3VQEKNJ
	FfbX6I51iBHAp4f79x7IXThRR/VZKf5jW+RvOBdDHsgfukv8baNrV/QvtN8Mb8vSkagw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/riscv: handle hypervisor timer interrupts
Message-Id: <E1vzuQY-001e53-2Z@xenbits.xenproject.org>
Date: Tue, 10 Mar 2026 10:35:02 +0000

commit cfef4ba93980d9da0f1d97224b233fe988639ddb
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Fri Mar 6 17:33:28 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 10 09:27:22 2026 +0100

    xen/riscv: handle hypervisor timer interrupts
    
    Introduce timer_interrupt() to process IRQ_S_TIMER interrupts.
    The handler disables further timer interrupts by clearing
    SIE.STIE and raises TIMER_SOFTIRQ so the generic timer subsystem
    can perform its processing.
    
    Update do_trap() to dispatch IRQ_S_TIMER to this new handler.
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/traps.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/xen/arch/riscv/traps.c b/xen/arch/riscv/traps.c
index 244264c92a..326f2be628 100644
--- a/xen/arch/riscv/traps.c
+++ b/xen/arch/riscv/traps.c
@@ -10,6 +10,7 @@
 #include <xen/lib.h>
 #include <xen/nospec.h>
 #include <xen/sched.h>
+#include <xen/softirq.h>
 
 #include <asm/cpufeature.h>
 #include <asm/intc.h>
@@ -180,6 +181,15 @@ static void check_for_pcpu_work(void)
     p2m_handle_vmenter();
 }
 
+static void timer_interrupt(void)
+{
+    /* Disable the timer to avoid more interrupts */
+    csr_clear(CSR_SIE, BIT(IRQ_S_TIMER, UL));
+
+    /* Signal the generic timer code to do its work */
+    raise_softirq(TIMER_SOFTIRQ);
+}
+
 void do_trap(struct cpu_user_regs *cpu_regs)
 {
     register_t pc = cpu_regs->sepc;
@@ -221,6 +231,10 @@ void do_trap(struct cpu_user_regs *cpu_regs)
                 intc_handle_external_irqs(cpu_regs);
                 break;
 
+            case IRQ_S_TIMER:
+                timer_interrupt();
+                break;
+
             default:
                 intr_handled = false;
                 break;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 10 10:35:14 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Mar 2026 10:35:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1249974.1547372 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzuQk-0005uZ-69; Tue, 10 Mar 2026 10:35:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1249974.1547372; Tue, 10 Mar 2026 10:35:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzuQk-0005uR-3V; Tue, 10 Mar 2026 10:35:14 +0000
Received: by outflank-mailman (input) for mailman id 1249974;
 Tue, 10 Mar 2026 10:35:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vzuQi-0005uH-Ua
 for xen-changelog@lists.xenproject.org; Tue, 10 Mar 2026 10:35:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzuQj-001aG0-0Q
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 10:35:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzuQi-001e5x-2p
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 10:35:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=lGw3kVpOhRD2U/a2j/32nrcv9sL+hQ9hWsdXHMIGK/Y=; b=Hy3ThdZxiqIiaTVTZAaHWdUph2
	gkqh2BRN5XbLqbWacIil/eJ4Ul4jq5z+bGdBeek3Wm6ku7XP2q4mSwIM87HMQ5oBljhKQQqt8ei4g
	g6MH7thKjwT4ti5swItMqn8pjc2eLrQbYSfMnWTjsnxVr7nyzgaP0ZOO6C/Z9UQTC2P0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/riscv: init tasklet subsystem
Message-Id: <E1vzuQi-001e5x-2p@xenbits.xenproject.org>
Date: Tue, 10 Mar 2026 10:35:12 +0000

commit 18964d1bf544129c5fb0f04c96b8502b0f203755
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Fri Mar 6 17:33:29 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 10 09:27:35 2026 +0100

    xen/riscv: init tasklet subsystem
    
    As the tasklet subsystem is now initialized, it is necessary to implement
    sync_local_execstate(), since it is invoked when something calls
    tasklet_softirq_action(), which is registered in tasklet_subsys_init().
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/setup.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/xen/arch/riscv/setup.c b/xen/arch/riscv/setup.c
index bca6ca09ed..cae49bb296 100644
--- a/xen/arch/riscv/setup.c
+++ b/xen/arch/riscv/setup.c
@@ -12,6 +12,7 @@
 #include <xen/serial.h>
 #include <xen/shutdown.h>
 #include <xen/smp.h>
+#include <xen/tasklet.h>
 #include <xen/timer.h>
 #include <xen/vmap.h>
 #include <xen/xvmalloc.h>
@@ -133,6 +134,8 @@ void __init noreturn start_xen(unsigned long bootcpu_id,
         panic("Booting using ACPI isn't supported\n");
     }
 
+    tasklet_subsys_init();
+
     init_IRQ();
 
     riscv_fill_hwcap();
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 10 10:35:25 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Mar 2026 10:35:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1249975.1547377 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzuQv-0005x3-7l; Tue, 10 Mar 2026 10:35:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1249975.1547377; Tue, 10 Mar 2026 10:35:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzuQv-0005wv-53; Tue, 10 Mar 2026 10:35:25 +0000
Received: by outflank-mailman (input) for mailman id 1249975;
 Tue, 10 Mar 2026 10:35:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vzuQt-0005wn-2k
 for xen-changelog@lists.xenproject.org; Tue, 10 Mar 2026 10:35:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzuQt-001aG4-0g
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 10:35:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzuQs-001e6h-39
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 10:35:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=x7C6Fmn9oTmDu8vEcuoEmapVawwDdceNP+UIN506U4g=; b=7Np4XwQUe4vKFhku/5L5xY/fc8
	rd6vPjXeYzP9jkyfgGHUAKTNm0m0mk0Eex579EOrShIwPg5vkhLUgZdfJUIdfSEie16QjliSVZN4E
	SY4r6speVOA+KnLRWd6AY8VYqIMJMfx70a9IifiGgk3hq8Sy8ra9hm4gUUz90k491XyI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/riscv: implement sync_vcpu_execstate()
Message-Id: <E1vzuQs-001e6h-39@xenbits.xenproject.org>
Date: Tue, 10 Mar 2026 10:35:22 +0000

commit 256479ba567766609435c83b5d5d5596c1c606e0
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Fri Mar 6 17:33:30 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 10 09:27:47 2026 +0100

    xen/riscv: implement sync_vcpu_execstate()
    
    The scheduler may call this function to force synchronization of given
    vCPU's state. RISC-V does not support lazy context switching, so nothing
    is done in sync_vcpu_execstate() and sync_local_execstate().
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/domain.c | 10 ++++++++++
 xen/arch/riscv/stubs.c  | 10 ----------
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/xen/arch/riscv/domain.c b/xen/arch/riscv/domain.c
index 470eca3ad7..c327f44d07 100644
--- a/xen/arch/riscv/domain.c
+++ b/xen/arch/riscv/domain.c
@@ -278,6 +278,16 @@ void vcpu_kick(struct vcpu *v)
     }
 }
 
+void sync_local_execstate(void)
+{
+    /* Nothing to do -- no lazy switching */
+}
+
+void sync_vcpu_execstate(struct vcpu *v)
+{
+    /* Nothing to do -- no lazy switching */
+}
+
 static void __init __maybe_unused build_assertions(void)
 {
     /*
diff --git a/xen/arch/riscv/stubs.c b/xen/arch/riscv/stubs.c
index 2f3a0ce76a..acbb5b9123 100644
--- a/xen/arch/riscv/stubs.c
+++ b/xen/arch/riscv/stubs.c
@@ -91,16 +91,6 @@ void continue_running(struct vcpu *same)
     BUG_ON("unimplemented");
 }
 
-void sync_local_execstate(void)
-{
-    BUG_ON("unimplemented");
-}
-
-void sync_vcpu_execstate(struct vcpu *v)
-{
-    BUG_ON("unimplemented");
-}
-
 void startup_cpu_idle_loop(void)
 {
     BUG_ON("unimplemented");
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 10 10:35:34 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Mar 2026 10:35:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1249976.1547380 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzuR4-0005zE-8x; Tue, 10 Mar 2026 10:35:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1249976.1547380; Tue, 10 Mar 2026 10:35:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzuR4-0005z7-6P; Tue, 10 Mar 2026 10:35:34 +0000
Received: by outflank-mailman (input) for mailman id 1249976;
 Tue, 10 Mar 2026 10:35:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vzuR3-0005yz-3X
 for xen-changelog@lists.xenproject.org; Tue, 10 Mar 2026 10:35:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzuR3-001aG8-0w
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 10:35:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzuR3-001e76-0A
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 10:35:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=k7JvdVw+Fsd9Ye+IUXdy0JPA809/A2SS5yTm2p9OfDg=; b=U5YlpA62J1Ndr44IWMLsfMS99C
	ZAxx6wxQnj2UiUno6iNrT4HIGfgGboLUV5xdjSfVDZw5dOLhKlC7elefsoy77WTszqWTC32Qmw4Gx
	q6jz2yeyn6/a5T/FmZUH7RuyE+7YtXw/+eJ1sbmoZTXlNWExWeFMTNKYyQeTZWTSdXKc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/tests/x86_emulator: avoid duplicate symbol error with clang: use -Og
Message-Id: <E1vzuR3-001e76-0A@xenbits.xenproject.org>
Date: Tue, 10 Mar 2026 10:35:33 +0000

commit 442f3481fe3979e3e563bd7d221498a3d52133cc
Author:     Edwin Török <edwin.torok@citrix.com>
AuthorDate: Tue Mar 10 09:28:09 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 10 09:28:09 2026 +0100

    tools/tests/x86_emulator: avoid duplicate symbol error with clang: use -Og
    
    clang would duplicate the loop body and end up with a double definition
    of the symbol:
    ```
    /tmp/test_x86_emulator-0f3576.s:27823: Error: symbol `vmovsh_to_mem' is already defined
    /tmp/test_x86_emulator-0f3576.s:27825: Error: symbol `.Lvmovsh_to_mem_end' is already defined
    ```
    
    Until a better solution is found: reduce optimizations in the test runner.
    
    Using -Os might also work, but we can't rely on the size optimization
    always avoiding the duplication of asm blocks.
    This is test code, not performance critical code, and -O0 is more future
    proof.
    However for debugging -Og is recommended over -O0, and this still avoids
    the duplicate label problem.
    
    Signed-off-by: Edwin Török <edwin.torok@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 tools/tests/x86_emulator/Makefile | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/tools/tests/x86_emulator/Makefile b/tools/tests/x86_emulator/Makefile
index 5003c464f3..8210e83345 100644
--- a/tools/tests/x86_emulator/Makefile
+++ b/tools/tests/x86_emulator/Makefile
@@ -323,4 +323,11 @@ x86-emulate.o x86_emulate/%.o: HOSTCFLAGS += -D__XEN_TOOLS__
 $(call cc-option-add,HOSTCFLAGS-toplevel,HOSTCC,-fno-toplevel-reorder)
 test_x86_emulator.o: HOSTCFLAGS += $(HOSTCFLAGS-toplevel)
 
+# When unrolling loops, compilers may duplicate inline assembly. put_insn()
+# emits labels, which may not be emitted multiple times.
+# The default HOSTCFLAGS from $(XEN_ROOT)/Config.mk would set a non-zero
+# optimisation level.
+# Until a better solution is found: reduce optimizations in the test runner.
+test_x86_emulator.o: HOSTCFLAGS += -Og
+
 test_x86_emulator.o: $(addsuffix .h,$(TESTCASES)) $(addsuffix -opmask.h,$(OPMASK))
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 10 11:44:07 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Mar 2026 11:44:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1250039.1547439 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzvVL-0000Mt-AQ; Tue, 10 Mar 2026 11:44:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1250039.1547439; Tue, 10 Mar 2026 11:44:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzvVL-0000Ml-7D; Tue, 10 Mar 2026 11:44:03 +0000
Received: by outflank-mailman (input) for mailman id 1250039;
 Tue, 10 Mar 2026 11:44:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vzvVJ-0000Mf-Qq
 for xen-changelog@lists.xenproject.org; Tue, 10 Mar 2026 11:44:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzvVJ-001bV9-37
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 11:44:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzvVJ-001iXR-2J
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 11:44:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=YpjM732++95BBSVdpgobDIYfcm24pP3zmI3ycVGQFeY=; b=DmLsrT0N8drZW4Rt09oqCGRl4a
	fXc81IrelzFdVQii051uEMufEzIb+gA66DCPybzEvKOGr8Ksn35o1/wpwsaW8yPnVOt7sFMSRkGhl
	KuLzaLSzAZveXpTW1Os0HVG4wI5XHPlHBUKNoDGcjGWPkQa81zcPsQNso8g3zeWrjswg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] domain: move vmtrace_alloc_buffer() invocation in vcpu_create()
Message-Id: <E1vzvVJ-001iXR-2J@xenbits.xenproject.org>
Date: Tue, 10 Mar 2026 11:44:01 +0000

commit adfbdaa347d05e53c8c61ad00a6851bd5b82c760
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Mar 10 09:23:25 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 10 09:23:25 2026 +0100

    domain: move vmtrace_alloc_buffer() invocation in vcpu_create()
    
    The label used upon the function failing is wrong. Instead of correcting
    the label, move the invocation up a little, to also avoid it altogether
    for the idle domain (where ->vmtrace_size would be zero, and hence the
    function would bail right away anyway).
    
    Fixes: 217dd79ee292 ("xen/domain: Add vmtrace_size domain creation parameter")
    Reported-by: Roger Pau Monné <roger.pau@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/common/domain.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/xen/common/domain.c b/xen/common/domain.c
index d24be268ae..ab910fcf93 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -500,14 +500,14 @@ struct vcpu *vcpu_create(struct domain *d, unsigned int vcpu_id)
         set_bit(_VPF_down, &v->pause_flags);
         vcpu_info_reset(v);
         init_waitqueue_vcpu(v);
+
+        if ( vmtrace_alloc_buffer(v) != 0 )
+            goto fail_wq;
     }
 
     if ( sched_init_vcpu(v) != 0 )
         goto fail_wq;
 
-    if ( vmtrace_alloc_buffer(v) != 0 )
-        goto fail_wq;
-
     if ( arch_vcpu_create(v) != 0 )
         goto fail_sched;
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 10 11:44:13 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Mar 2026 11:44:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1250040.1547443 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzvVV-0000P1-Bb; Tue, 10 Mar 2026 11:44:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1250040.1547443; Tue, 10 Mar 2026 11:44:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzvVV-0000Ot-8k; Tue, 10 Mar 2026 11:44:13 +0000
Received: by outflank-mailman (input) for mailman id 1250040;
 Tue, 10 Mar 2026 11:44:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vzvVT-0000Oh-TM
 for xen-changelog@lists.xenproject.org; Tue, 10 Mar 2026 11:44:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzvVU-001bVH-0I
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 11:44:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzvVT-001iZ9-2d
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 11:44:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=7sBKU3P3BZzGnH/UMhcKaX+aA7AVgOY9ORIy9GRpL40=; b=kd3ywDuB+gbFWV+q/5WFko5edd
	6xNCmwK5E+brWtLbIqQMQa03a7K3taKpck3JVe/H1G7JaLhUEeUF6y6d3VjWoT/yNrYkXFrq1aJ67
	qb6wzz/xSJJxZ7YXzlfiTpAMpMvfMuKMN2ZLTCSqzUyfOAxSn/EkvT7iy0nVLHq/FF9w=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] vPCI: re-init extended-capabilities when MMCFG availability changed
Message-Id: <E1vzvVT-001iZ9-2d@xenbits.xenproject.org>
Date: Tue, 10 Mar 2026 11:44:11 +0000

commit d734babf8bc3407919cfd023e2c58bcce24eccfb
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Mar 10 09:24:00 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 10 09:24:00 2026 +0100

    vPCI: re-init extended-capabilities when MMCFG availability changed
    
    When Dom0 informs us about MMCFG usability, this may change whether
    extended capabilities are available (accessible) for devices. Zap what
    might be on record, and re-initialize things.
    
    No synchronization is added for the case where devices may already be in
    use. That'll need sorting when (a) DomU support was added and (b) DomU-s
    may run already while Dom0 / hwdom still boots (dom0less, Hyperlaunch).
    
    vpci_cleanup_capabilities() also shouldn't have used
    pci_find_ext_capability(), as already when the function was introduced
    extended config space may not have been (properly) accessible anymore,
    no matter whether it was during init. Extended capability cleanup hooks
    need to cope with being called when the respective capability doesn't
    exist (and hence the corresponding ->init() hook was never called).
    
    Fixes: 70e6dace747e ("vpci: Use cleanup to free capability resource during deassign")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/physdev.c     | 13 ++++++++++
 xen/drivers/vpci/cap.c     | 64 +++++++++++++++++++++++++++++++++++-----------
 xen/drivers/vpci/private.h |  4 +--
 xen/drivers/vpci/vpci.c    |  4 +--
 xen/include/xen/vpci.h     |  7 +++++
 5 files changed, 73 insertions(+), 19 deletions(-)

diff --git a/xen/arch/x86/physdev.c b/xen/arch/x86/physdev.c
index 8496011b59..5bbcf3b530 100644
--- a/xen/arch/x86/physdev.c
+++ b/xen/arch/x86/physdev.c
@@ -8,6 +8,8 @@
 #include <xen/guest_access.h>
 #include <xen/iocap.h>
 #include <xen/serial.h>
+#include <xen/vpci.h>
+
 #include <asm/current.h>
 #include <asm/io_apic.h>
 #include <asm/msi.h>
@@ -169,8 +171,19 @@ int cf_check physdev_check_pci_extcfg(struct pci_dev *pdev, void *arg)
 
     ASSERT(pdev->seg == info->segment);
     if ( pdev->bus >= info->start_bus && pdev->bus <= info->end_bus )
+    {
         pci_check_extcfg(pdev);
 
+        /*
+         * The re-init failing doesn't mean the device becomes entirely non-
+         * functional.  In case of failure, a message was already logged.
+         * Hence don't otherwise act upon failure.
+         *
+         * FIXME: Re-visit when DomU support is added to vPCI.
+         */
+        vpci_reinit_ext_capabilities(pdev);
+    }
+
     return 0;
 }
 #endif /* COMPAT */
diff --git a/xen/drivers/vpci/cap.c b/xen/drivers/vpci/cap.c
index e26a2f95da..3c3e6ce1d3 100644
--- a/xen/drivers/vpci/cap.c
+++ b/xen/drivers/vpci/cap.c
@@ -285,13 +285,16 @@ static int vpci_init_ext_capability_list(const struct pci_dev *pdev)
     return 0;
 }
 
-int vpci_init_capabilities(struct pci_dev *pdev)
+int vpci_init_capabilities(struct pci_dev *pdev, bool ext_only)
 {
-    int rc;
+    int rc, accum_rc = 0;
 
-    rc = vpci_init_capability_list(pdev);
-    if ( rc )
-        return rc;
+    if ( !ext_only )
+    {
+        rc = vpci_init_capability_list(pdev);
+        if ( rc )
+            return rc;
+    }
 
     rc = vpci_init_ext_capability_list(pdev);
     if ( rc )
@@ -305,7 +308,7 @@ int vpci_init_capabilities(struct pci_dev *pdev)
         unsigned int pos = 0;
 
         if ( !is_ext )
-            pos = pci_find_cap_offset(pdev->sbdf, cap);
+            pos = !ext_only ? pci_find_cap_offset(pdev->sbdf, cap) : 0;
         else if ( is_hardware_domain(pdev->domain) )
             pos = pci_find_ext_capability(pdev, cap);
 
@@ -341,30 +344,40 @@ int vpci_init_capabilities(struct pci_dev *pdev)
             {
                 printk(XENLOG_ERR "%pd %pp: hide %s cap %u fail rc=%d\n",
                        pdev->domain, &pdev->sbdf, type, cap, rc);
-                return rc;
+
+                /* Best effort for the re-init case. */
+                if ( !ext_only )
+                    return rc;
+
+                if ( !accum_rc )
+                    accum_rc = rc;
             }
         }
     }
 
-    return 0;
+    return accum_rc;
 }
 
-void vpci_cleanup_capabilities(struct pci_dev *pdev)
+void vpci_cleanup_capabilities(struct pci_dev *pdev, bool ext_only)
 {
     for ( unsigned int i = 0; i < NUM_VPCI_INIT; i++ )
     {
         const vpci_capability_t *capability = &__start_vpci_array[i];
         const unsigned int cap = capability->id;
-        unsigned int pos = 0;
 
         if ( !capability->cleanup )
             continue;
 
-        if ( !capability->is_ext )
-            pos = pci_find_cap_offset(pdev->sbdf, cap);
-        else if ( is_hardware_domain(pdev->domain) )
-            pos = pci_find_ext_capability(pdev, cap);
-        if ( pos )
+        /*
+         * Cannot call pci_find_ext_capability() here, as extended config space
+         * may (no longer) be accessible.  As a result, extended capability
+         * ->cleanup() handlers need to cope with being called despite ->init()
+         * never having been called.  Which in turn allows calling them even
+         * for DomU-s, no matter that vpci_init_capabilities() excludes them
+         * there for now.
+         */
+        if ( capability->is_ext
+             || (!ext_only && pci_find_cap_offset(pdev->sbdf, cap)) )
         {
             int rc = capability->cleanup(pdev, false);
 
@@ -376,6 +389,27 @@ void vpci_cleanup_capabilities(struct pci_dev *pdev)
     }
 }
 
+int vpci_reinit_ext_capabilities(struct pci_dev *pdev)
+{
+    if ( !pdev->vpci )
+        return 0;
+
+    /*
+     * FIXME: DomU support is missing.  For already running domains we may
+     * need to pause them around the entire re-evaluation of extended config
+     * space accessibility.
+     */
+    ASSERT(pdev->domain == hardware_domain);
+
+    if ( vpci_remove_registers(pdev->vpci, PCI_CFG_SPACE_SIZE,
+                               PCI_CFG_SPACE_EXP_SIZE - PCI_CFG_SPACE_SIZE) )
+        ASSERT_UNREACHABLE();
+
+    vpci_cleanup_capabilities(pdev, true);
+
+    return vpci_init_capabilities(pdev, true);
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/xen/drivers/vpci/private.h b/xen/drivers/vpci/private.h
index fdeeca7aa8..2907f6b40f 100644
--- a/xen/drivers/vpci/private.h
+++ b/xen/drivers/vpci/private.h
@@ -46,8 +46,8 @@ typedef struct {
 
 int __must_check vpci_init_header(struct pci_dev *pdev);
 
-int vpci_init_capabilities(struct pci_dev *pdev);
-void vpci_cleanup_capabilities(struct pci_dev *pdev);
+int vpci_init_capabilities(struct pci_dev *pdev, bool ext_only);
+void vpci_cleanup_capabilities(struct pci_dev *pdev, bool ext_only);
 
 /* Add/remove a register handler. */
 int __must_check vpci_add_register_mask(struct vpci *vpci,
diff --git a/xen/drivers/vpci/vpci.c b/xen/drivers/vpci/vpci.c
index 683d5fc36c..0ac9ec8b04 100644
--- a/xen/drivers/vpci/vpci.c
+++ b/xen/drivers/vpci/vpci.c
@@ -102,7 +102,7 @@ void vpci_deassign_device(struct pci_dev *pdev)
                     &pdev->domain->vpci_dev_assigned_map);
 #endif
 
-    vpci_cleanup_capabilities(pdev);
+    vpci_cleanup_capabilities(pdev, false);
 
     spin_lock(&pdev->vpci->lock);
     while ( !list_empty(&pdev->vpci->handlers) )
@@ -159,7 +159,7 @@ int vpci_assign_device(struct pci_dev *pdev)
     if ( rc )
         goto out;
 
-    rc = vpci_init_capabilities(pdev);
+    rc = vpci_init_capabilities(pdev, false);
 
  out:
     if ( rc )
diff --git a/xen/include/xen/vpci.h b/xen/include/xen/vpci.h
index 83ac41edf8..877aa391d1 100644
--- a/xen/include/xen/vpci.h
+++ b/xen/include/xen/vpci.h
@@ -25,6 +25,8 @@ int __must_check vpci_assign_device(struct pci_dev *pdev);
 /* Remove all handlers and free vpci related structures. */
 void vpci_deassign_device(struct pci_dev *pdev);
 
+int vpci_reinit_ext_capabilities(struct pci_dev *pdev);
+
 /* Generic read/write handlers for the PCI config space. */
 uint32_t vpci_read(pci_sbdf_t sbdf, unsigned int reg, unsigned int size);
 void vpci_write(pci_sbdf_t sbdf, unsigned int reg, unsigned int size,
@@ -202,6 +204,11 @@ bool vpci_ecam_read(pci_sbdf_t sbdf, unsigned int reg, unsigned int len,
 #else /* !CONFIG_HAS_VPCI */
 struct vpci_vcpu {};
 
+static inline int vpci_reinit_ext_capabilities(struct pci_dev *pdev)
+{
+    return 0;
+}
+
 static inline int vpci_assign_device(struct pci_dev *pdev)
 {
     return 0;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 10 11:44:23 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Mar 2026 11:44:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1250042.1547447 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzvVf-0000Ri-D0; Tue, 10 Mar 2026 11:44:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1250042.1547447; Tue, 10 Mar 2026 11:44:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzvVf-0000Ra-AC; Tue, 10 Mar 2026 11:44:23 +0000
Received: by outflank-mailman (input) for mailman id 1250042;
 Tue, 10 Mar 2026 11:44:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vzvVd-0000RT-W3
 for xen-changelog@lists.xenproject.org; Tue, 10 Mar 2026 11:44:21 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzvVe-001bVL-0Z
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 11:44:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzvVd-001ial-30
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 11:44:21 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=UjgGHJlvbIQNN9CQk7dj+8jXH0SFmBCqwsoTHB2dbvI=; b=jtHho90UVUGCtHMzJeKO7VoJym
	VztJjMkdxMzlAxUKvzil6ykGnDQgfKCdY58rh7xwR7I8lXhuXb1q0jHidn9TXPyzTFLCnWGYeFzm1
	Hj8TgaT26wFAV/8jbb+uPSwUVVnXYKaM6tKFiSGFPOmltRCgDDSGwMGtuw2nD8p8/1+8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/riscv: detect and store supported hypervisor CSR bits at boot
Message-Id: <E1vzvVd-001ial-30@xenbits.xenproject.org>
Date: Tue, 10 Mar 2026 11:44:21 +0000

commit 8149f72c0cbf6f1e8903b4a50101f806ff0630de
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Tue Mar 10 09:24:35 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 10 09:24:35 2026 +0100

    xen/riscv: detect and store supported hypervisor CSR bits at boot
    
    Some hypervisor CSRs expose optional functionality and may not implement
    all architectural bits. Writing unsupported bits can either be ignored
    or raise an exception depending on the platform.
    
    Detect the set of writable bits for selected hypervisor CSRs at boot and
    store the resulting masks for later use. This allows safely programming
    these CSRs during vCPU context switching and avoids relying on hardcoded
    architectural assumptions.
    
    Use csr_read()&csr_write() instead of csr_swap()+all ones mask as some
    CSR registers have WPRI fields which should be preserved during write
    operation.
    
    Also, ro_one struct is introduced to cover the cases when a bit in CSR
    register (at the momemnt, it is only hstateen0) may be r/o-one to have
    hypervisor view of register seen by guest correct.
    
    Masks are calculated at the moment only for hedeleg, henvcfg, hideleg,
    hstateen0 registers as only them are going to be used in the follow up
    patch.
    
    If the Smstateen extension is not implemented, hstateen0 cannot be read
    because the register is considered non-existent. Instructions that attempt
    to access a CSR that is not implemented or not visible in the current mode
    are reserved and will raise an illegal-instruction exception.
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/domain.c            | 57 ++++++++++++++++++++++++++++++++++++++
 xen/arch/riscv/include/asm/setup.h |  2 ++
 xen/arch/riscv/setup.c             |  2 ++
 3 files changed, 61 insertions(+)

diff --git a/xen/arch/riscv/domain.c b/xen/arch/riscv/domain.c
index b60320b90d..a5450a6d1b 100644
--- a/xen/arch/riscv/domain.c
+++ b/xen/arch/riscv/domain.c
@@ -2,9 +2,66 @@
 
 #include <xen/init.h>
 #include <xen/mm.h>
+#include <xen/sections.h>
 #include <xen/sched.h>
 #include <xen/vmap.h>
 
+#include <asm/cpufeature.h>
+#include <asm/csr.h>
+
+struct csr_masks {
+    register_t hedeleg;
+    register_t henvcfg;
+    register_t hideleg;
+    register_t hstateen0;
+
+    struct {
+        register_t hstateen0;
+    } ro_one;
+};
+
+static struct csr_masks __ro_after_init csr_masks;
+
+#define HEDELEG_AVAIL_MASK ULONG_MAX
+#define HIDELEG_AVAIL_MASK ULONG_MAX
+#define HENVCFG_AVAIL_MASK _UL(0xE0000003000000FF)
+#define HSTATEEN0_AVAIL_MASK _UL(0xDE00000000000007)
+
+void __init init_csr_masks(void)
+{
+    /*
+     * The mask specifies the bits that may be safely modified without
+     * causing side effects.
+     *
+     * For example, registers such as henvcfg or hstateen0 contain WPRI
+     * fields that must be preserved. Any write to the full register must
+     * therefore retain the original values of those fields.
+     */
+#define INIT_CSR_MASK(csr, field, mask) do { \
+        register_t old = csr_read_set(CSR_ ## csr, mask); \
+        csr_masks.field = csr_swap(CSR_ ## csr, old); \
+    } while (0)
+
+#define INIT_RO_ONE_MASK(csr, field, mask) do { \
+        register_t old = csr_read_clear(CSR_ ## csr, mask); \
+        csr_masks.ro_one.field = csr_swap(CSR_ ## csr, old) & mask; \
+    } while (0)
+
+    INIT_CSR_MASK(HEDELEG, hedeleg, HEDELEG_AVAIL_MASK);
+    INIT_CSR_MASK(HIDELEG, hideleg, HIDELEG_AVAIL_MASK);
+
+    INIT_CSR_MASK(HENVCFG, henvcfg, HENVCFG_AVAIL_MASK);
+
+    if ( riscv_isa_extension_available(NULL, RISCV_ISA_EXT_smstateen) )
+    {
+        INIT_CSR_MASK(HSTATEEN0, hstateen0, HSTATEEN0_AVAIL_MASK);
+        INIT_RO_ONE_MASK(HSTATEEN0, hstateen0, HSTATEEN0_AVAIL_MASK);
+    }
+
+#undef INIT_CSR_MASK
+#undef INIT_RO_ONE_MASK
+}
+
 static void continue_new_vcpu(struct vcpu *prev)
 {
     BUG_ON("unimplemented\n");
diff --git a/xen/arch/riscv/include/asm/setup.h b/xen/arch/riscv/include/asm/setup.h
index c9d69cdf51..2215894cfb 100644
--- a/xen/arch/riscv/include/asm/setup.h
+++ b/xen/arch/riscv/include/asm/setup.h
@@ -11,6 +11,8 @@ void setup_mm(void);
 
 void copy_from_paddr(void *dst, paddr_t paddr, unsigned long len);
 
+void init_csr_masks(void);
+
 #endif /* ASM__RISCV__SETUP_H */
 
 /*
diff --git a/xen/arch/riscv/setup.c b/xen/arch/riscv/setup.c
index 9b4835960d..bca6ca09ed 100644
--- a/xen/arch/riscv/setup.c
+++ b/xen/arch/riscv/setup.c
@@ -137,6 +137,8 @@ void __init noreturn start_xen(unsigned long bootcpu_id,
 
     riscv_fill_hwcap();
 
+    init_csr_masks();
+
     preinit_xen_time();
 
     intc_preinit();
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 10 11:44:33 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Mar 2026 11:44:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1250043.1547451 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzvVp-0000Vi-Fg; Tue, 10 Mar 2026 11:44:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1250043.1547451; Tue, 10 Mar 2026 11:44:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzvVp-0000Va-D0; Tue, 10 Mar 2026 11:44:33 +0000
Received: by outflank-mailman (input) for mailman id 1250043;
 Tue, 10 Mar 2026 11:44:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vzvVo-0000VR-3W
 for xen-changelog@lists.xenproject.org; Tue, 10 Mar 2026 11:44:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzvVo-001bVR-0v
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 11:44:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzvVo-001icP-05
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 11:44:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=uCF8cyXnubeOjbgNiGTVhpZ6S/HANcQxdnZ/rhZnWVE=; b=d6wonBdWoo18zk/DTDyxnv3Cwa
	MlW1UembhOnD4L83Ou5hRmJr5azpNKtEZu8+yz11k4qAOP0SKaxDijipcMYZYsvULULWzkz22mh65
	JsyVD2yY7TkZyG8J7X3lDjXxe9I/F48TWs+Ow+f3q/awjpqXEQduBH4oDagcNZ70rX6Q=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/riscv: implement vcpu_csr_init()
Message-Id: <E1vzvVo-001icP-05@xenbits.xenproject.org>
Date: Tue, 10 Mar 2026 11:44:32 +0000

commit 02b3a1b0e53c6ebb03d7c07e2c5272cd5652b384
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Tue Mar 10 09:25:01 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 10 09:25:01 2026 +0100

    xen/riscv: implement vcpu_csr_init()
    
    Introduce vcpu_csr_init() to initialise hypervisor CSRs that control
    vCPU execution and virtualization behaviour before the vCPU is first
    scheduled.
    The function configures trap and interrupt delegation to VS-mode by
    setting the appropriate bits in the hedeleg and hideleg registers,
    initializes hstatus so that execution enters VS-mode when control is
    passed to the guest, and restricts guest access to hardware performance
    counters by initializing hcounteren, as unrestricted access would
    require additional handling in Xen.
    When the Smstateen and SSAIA extensions are available, access to AIA
    CSRs and IMSIC guest interrupt files is enabled by setting the
    corresponding bits in hstateen0, avoiding unnecessary traps into Xen
    (note that SVSLCT(Supervisor Virtual Select) name is used intead of
    CSRIND as OpenSBI uses such name and riscv_encoding.h is mostly based
    on it).
    If the Svpbmt extension is supported, the PBMTE bit is set in
    henvcfg to allow its use for VS-stage address translation. Guest
    access to the ENVCFG CSR is also enabled by setting ENVCFG bit in
    hstateen0, as a guest may need to control certain characteristics of
    the U-mode (VU-mode when V=1) execution environment.
    
    For CSRs that may contain read-only bits (e.g. hedeleg, hideleg,
    hstateen0), to the written value a correspondent mask is applied to
    avoid divergence between the software state and the actual CSR
    contents.
    
    As hstatus is not part of struct arch_vcpu (it already resides in
    struct cpu_user_regs), introduce vcpu_guest_cpu_user_regs() to provide
    a uniform way to access hstatus and other guest CPU user registers.
    
    This establishes a consistent and well-defined initial CSR state for
    vCPUs prior to their first context switch.
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/domain.c                     | 63 +++++++++++++++++++++++++++++
 xen/arch/riscv/include/asm/current.h        |  2 +
 xen/arch/riscv/include/asm/domain.h         |  6 +++
 xen/arch/riscv/include/asm/riscv_encoding.h |  2 +
 4 files changed, 73 insertions(+)

diff --git a/xen/arch/riscv/domain.c b/xen/arch/riscv/domain.c
index a5450a6d1b..14cc85093b 100644
--- a/xen/arch/riscv/domain.c
+++ b/xen/arch/riscv/domain.c
@@ -8,6 +8,7 @@
 
 #include <asm/cpufeature.h>
 #include <asm/csr.h>
+#include <asm/riscv_encoding.h>
 
 struct csr_masks {
     register_t hedeleg;
@@ -20,6 +21,21 @@ struct csr_masks {
     } ro_one;
 };
 
+#define HEDELEG_DEFAULT (BIT(CAUSE_MISALIGNED_FETCH, U) | \
+                         BIT(CAUSE_FETCH_ACCESS, U) | \
+                         BIT(CAUSE_ILLEGAL_INSTRUCTION, U) | \
+                         BIT(CAUSE_BREAKPOINT, U) | \
+                         BIT(CAUSE_MISALIGNED_LOAD, U) | \
+                         BIT(CAUSE_LOAD_ACCESS, U) | \
+                         BIT(CAUSE_MISALIGNED_STORE, U) | \
+                         BIT(CAUSE_STORE_ACCESS, U) | \
+                         BIT(CAUSE_USER_ECALL, U) | \
+                         BIT(CAUSE_FETCH_PAGE_FAULT, U) | \
+                         BIT(CAUSE_LOAD_PAGE_FAULT, U) | \
+                         BIT(CAUSE_STORE_PAGE_FAULT, U))
+
+#define HIDELEG_DEFAULT (MIP_VSSIP | MIP_VSTIP | MIP_VSEIP)
+
 static struct csr_masks __ro_after_init csr_masks;
 
 #define HEDELEG_AVAIL_MASK ULONG_MAX
@@ -62,6 +78,51 @@ void __init init_csr_masks(void)
 #undef INIT_RO_ONE_MASK
 }
 
+static void vcpu_csr_init(struct vcpu *v)
+{
+    v->arch.hedeleg = HEDELEG_DEFAULT & csr_masks.hedeleg;
+
+    vcpu_guest_cpu_user_regs(v)->hstatus = HSTATUS_SPV | HSTATUS_SPVP;
+
+    v->arch.hideleg = HIDELEG_DEFAULT & csr_masks.hideleg;
+
+    /*
+     * VS should access only the time counter directly.
+     * Everything else should trap.
+     */
+    v->arch.hcounteren = HCOUNTEREN_TM;
+
+    if ( riscv_isa_extension_available(NULL, RISCV_ISA_EXT_svpbmt) )
+        v->arch.henvcfg = ENVCFG_PBMTE & csr_masks.henvcfg;
+
+    if ( riscv_isa_extension_available(NULL, RISCV_ISA_EXT_smstateen) )
+    {
+        /* Allow guest to access CSR_SENVCFG */
+        register_t hstateen0 = SMSTATEEN0_HSENVCFG;
+
+        if ( riscv_isa_extension_available(NULL, RISCV_ISA_EXT_ssaia) )
+            /*
+             * If the hypervisor extension is implemented, the same three
+             * bits are defined also in hypervisor CSR hstateen0 but concern
+             * only the state potentially accessible to a virtual machine
+             * executing in privilege modes VS and VU:
+             *      bit 60 CSRs siselect and sireg (really vsiselect and
+             *             vsireg)
+             *      bit 59 CSRs siph and sieh (RV32 only) and stopi (really
+             *             vsiph, vsieh, and vstopi)
+             *      bit 58 all state of IMSIC guest interrupt files, including
+             *             CSR stopei (really vstopei)
+             * If one of these bits is zero in hstateen0, and the same bit is
+             * one in mstateen0, then an attempt to access the corresponding
+             * state from VS or VU-mode raises a virtual instruction exception.
+             */
+            hstateen0 |= SMSTATEEN0_AIA | SMSTATEEN0_IMSIC | SMSTATEEN0_SVSLCT;
+
+        v->arch.hstateen0 = (hstateen0 & csr_masks.hstateen0) |
+                            csr_masks.ro_one.hstateen0;
+    }
+}
+
 static void continue_new_vcpu(struct vcpu *prev)
 {
     BUG_ON("unimplemented\n");
@@ -84,6 +145,8 @@ int arch_vcpu_create(struct vcpu *v)
     if ( is_idle_vcpu(v) )
         return 0;
 
+    vcpu_csr_init(v);
+
     /*
      * As the vtimer and interrupt controller (IC) are not yet implemented,
      * return an error.
diff --git a/xen/arch/riscv/include/asm/current.h b/xen/arch/riscv/include/asm/current.h
index 58c9f1506b..5fbee8182c 100644
--- a/xen/arch/riscv/include/asm/current.h
+++ b/xen/arch/riscv/include/asm/current.h
@@ -48,6 +48,8 @@ DECLARE_PER_CPU(struct vcpu *, curr_vcpu);
 #define get_cpu_current(cpu)  per_cpu(curr_vcpu, cpu)
 
 #define guest_cpu_user_regs() ({ BUG_ON("unimplemented"); NULL; })
+#define vcpu_guest_cpu_user_regs(vcpu) \
+    (&(vcpu)->arch.cpu_info->guest_cpu_user_regs)
 
 #define switch_stack_and_jump(stack, fn) do {               \
     asm volatile (                                          \
diff --git a/xen/arch/riscv/include/asm/domain.h b/xen/arch/riscv/include/asm/domain.h
index 5aec627a7a..17be792afe 100644
--- a/xen/arch/riscv/include/asm/domain.h
+++ b/xen/arch/riscv/include/asm/domain.h
@@ -49,6 +49,12 @@ struct arch_vcpu {
 
     struct cpu_info *cpu_info;
 
+    register_t hcounteren;
+    register_t hedeleg;
+    register_t hideleg;
+    register_t henvcfg;
+    register_t hstateen0;
+
     register_t vsatp;
 };
 
diff --git a/xen/arch/riscv/include/asm/riscv_encoding.h b/xen/arch/riscv/include/asm/riscv_encoding.h
index 1f7e612366..dd15731a86 100644
--- a/xen/arch/riscv/include/asm/riscv_encoding.h
+++ b/xen/arch/riscv/include/asm/riscv_encoding.h
@@ -228,6 +228,8 @@
 #define ENVCFG_CBIE_INV			_UL(0x3)
 #define ENVCFG_FIOM			_UL(0x1)
 
+#define HCOUNTEREN_TM BIT(1, U)
+
 /* ===== User-level CSRs ===== */
 
 /* User Trap Setup (N-extension) */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 10 11:44:43 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Mar 2026 11:44:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1250044.1547455 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzvVz-0000Xv-Gz; Tue, 10 Mar 2026 11:44:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1250044.1547455; Tue, 10 Mar 2026 11:44:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzvVz-0000Xm-EJ; Tue, 10 Mar 2026 11:44:43 +0000
Received: by outflank-mailman (input) for mailman id 1250044;
 Tue, 10 Mar 2026 11:44:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vzvVy-0000Xa-6C
 for xen-changelog@lists.xenproject.org; Tue, 10 Mar 2026 11:44:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzvVy-001bVV-1C
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 11:44:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzvVy-001idd-0P
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 11:44:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=G+sPPJDsLm0ZUrhG3o3AEIYtmVPi8w5gHwRCpe7NCkQ=; b=lCSIdTgwhdYludoZQADmWsEQLi
	hjwqz3tNjIBRa6ApxGxTBN2OMQoPaSrJa9qrVpbfNfC/LJ8XjFsQE3DXrUwi0iTH+M4gRPiCEq+uV
	QFa/4n8sNi8vajNsrvpnCfOgfny7G2ALf8cYKfw3ECEaRClvYddK3Xhgctgzzbr5kAJQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/riscv: introduce tracking of pending vCPU interrupts, part 1
Message-Id: <E1vzvVy-001idd-0P@xenbits.xenproject.org>
Date: Tue, 10 Mar 2026 11:44:42 +0000

commit c537959a5cb0178b0a34333892a8c0b47b69274f
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Tue Mar 10 09:25:16 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 10 09:25:16 2026 +0100

    xen/riscv: introduce tracking of pending vCPU interrupts, part 1
    
    Based on Linux kernel v6.16.0.
    Note that smp_wmb() is used instead of smp_mb__before_atomic() as what
    we want to guarantee that if a bit in irqs_pending_mask is obversable
    that the correspondent bit in irqs_pending is observable too.
    
    Add lockless tracking of pending vCPU interrupts using atomic bitops.
    Two bitmaps are introduced:
     - irqs_pending — interrupts currently pending for the vCPU
     - irqs_pending_mask — bits that have changed in irqs_pending
    
    The design follows a multi-producer, single-consumer model, where the
    consumer is the vCPU itself. Producers may set bits in
    irqs_pending_mask without a lock. Clearing bits in irqs_pending_mask is
    performed only by the consumer via xchg(). The consumer must not write
    to irqs_pending and must not act on bits that are not set in the mask.
    Otherwise, extra synchronization should be provided.
    
    On RISC-V interrupts are not injected via guest registers, so pending
    interrupts must be recorded in irqs_pending (using the new
    vcpu_{un}set_interrupt() helpers) and flushed to the guest by updating
    HVIP before returning control to the guest. The consumer side is
    implemented in a follow-up patch.
    
    A barrier between updating irqs_pending and setting the corresponding
    mask bit in vcpu_set_interrupt()/vcpu_unset_interrupt() guarantees
    that if the consumer observes a mask bit set, the corresponding pending
    bit is also visible. This prevents missed interrupts during the flush.
    
    It is possible that a guest could have pending bit in the hardware
    register without being marked pending in irq_pending bitmap as:
      According to the RISC-V ISA specification:
        Bits hip.VSSIP and hie.VSSIE are the interrupt-pending and
        interrupt-enable  bits for VS-level software interrupts. VSSIP in hip
        is an alias (writable) of the same bit in hvip.
      Additionally:
        When bit 2 of hideleg is zero, vsip.SSIP and vsie.SSIE are read-only
        zeros. Else, vsip.SSIP and vsie.SSIE are aliases of hip.VSSIP and
        hie.VSSIE.
    This means the guest may modify vsip.SSIP, which implicitly updates
    hip.VSSIP and the bit being written with 1 would also trigger an interrupt
    as according to the RISC-V spec:
      These conditions for an interrupt trap to occur must be evaluated in a
      bounded   amount of time from when an interrupt becomes, or ceases to be,
      pending in sip,  and must also be evaluated immediately following the
      execution of an SRET  instruction or an explicit write to a CSR on which
      these interrupt trap conditions expressly depend (including sip, sie and
      sstatus).
    What means that IRQ_VS_SOFT must be synchronized separately, what is done
    in vcpu_sync_interrupts(). Note, also, that IRQ_PMU_OVF would want to be
    synced for the similar reason as IRQ_VS_SOFT, but isn't sync-ed now as
    PMU isn't supported now.
    
    For the remaining VS-level interrupt types (IRQ_VS_TIMER and
    IRQ_VS_EXT), the specification states they cannot be modified by the guest
    and are read-only because of:
      Bits hip.VSEIP and hie.VSEIE are the interrupt-pending and interrupt-enable
      bits for VS-level external interrupts. VSEIP is read-only in hip, and is
      the logical-OR of these interrupt sources:
        • bit VSEIP of hvip;
        • the bit of hgeip selected by hstatus.VGEIN; and
        • any other platform-specific external interrupt signal directed to
          VS-level.
      Bits hip.VSTIP and hie.VSTIE are the interrupt-pending and interrupt-enable
      bits for VS-level timer interrupts. VSTIP is read-only in hip, and is the
      logical-OR of hvip.VSTIP and any other platform-specific timer interrupt
      signal directed to VS-level.
    and
      When bit 10 of hideleg is zero, vsip.SEIP and vsie.SEIE are read-only zeros.
      Else, vsip.SEIP and vsie.SEIE are aliases of hip.VSEIP and hie.VSEIE.
    
      When bit 6 of hideleg is zero, vsip.STIP and vsie.STIE are read-only zeros.
      Else, vsip.STIP and vsie.STIE are aliases of hip.VSTIP and hie.VSTIE.
    and also,
      Bits sip.SEIP and sie.SEIE are the interrupt-pending and interrupt-enable
      bits for supervisor-level external interrupts. If implemented, SEIP is
      read-only in sip, and is set and cleared by the execution environment,
      typically through a platform-specific interrupt controller.
    
      Bits sip.STIP and sie.STIE are the interrupt-pending and interrupt-enable
      bits for supervisor-level timer interrupts. If implemented, STIP is
      read-only in sip, and is set and cleared by the execution environment
    Thus, for these interrupt types, it is sufficient to use vcpu_set_interrupt()
    and vcpu_unset_interrupt(), and flush them during the call of
    vcpu_flush_interrupts() (which is introduced in follow up patch).
    
    vcpu_sync_interrupts(), which is called just before entering the VM,
    slightly bends the rule that the irqs_pending bit must be written
    first, followed by updating the corresponding bit in irqs_pending_mask.
    However, it still respects the core guarantee that the producer never
    clears the mask and only writes to irqs_pending if it is the one that
    flipped the corresponding mask bit from 0 to 1.
    Moreover, since the consumer won't run concurrently because
    vcpu_sync_interrupts() and the consumer path are going to be invoked
    sequentially immediately before VM entry, it is safe to slightly relax
    this ordering rule in vcpu_sync_interrupts().
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/domain.c             | 63 +++++++++++++++++++++++++++++++++++++
 xen/arch/riscv/include/asm/domain.h | 22 +++++++++++++
 xen/arch/riscv/traps.c              |  4 +++
 3 files changed, 89 insertions(+)

diff --git a/xen/arch/riscv/domain.c b/xen/arch/riscv/domain.c
index 14cc85093b..694a03ab74 100644
--- a/xen/arch/riscv/domain.c
+++ b/xen/arch/riscv/domain.c
@@ -6,6 +6,7 @@
 #include <xen/sched.h>
 #include <xen/vmap.h>
 
+#include <asm/bitops.h>
 #include <asm/cpufeature.h>
 #include <asm/csr.h>
 #include <asm/riscv_encoding.h>
@@ -168,6 +169,68 @@ void arch_vcpu_destroy(struct vcpu *v)
     vfree((void *)&v->arch.cpu_info[1] - STACK_SIZE);
 }
 
+int vcpu_set_interrupt(struct vcpu *v, unsigned int irq)
+{
+    bool kick_vcpu;
+
+    /* We only allow VS-mode software, timer, and external interrupts */
+    if ( irq != IRQ_VS_SOFT &&
+         irq != IRQ_VS_TIMER &&
+         irq != IRQ_VS_EXT )
+        return -EINVAL;
+
+    kick_vcpu = !test_and_set_bit(irq, v->arch.irqs_pending);
+
+    /*
+     * The counterpart of this barrier is the one encoded implicitly in xchg()
+     * which is used in consumer part (vcpu_flush_interrupts()).
+     */
+    smp_wmb();
+
+    kick_vcpu |= !test_and_set_bit(irq, v->arch.irqs_pending_mask);
+
+    if ( kick_vcpu )
+        vcpu_kick(v);
+
+    return 0;
+}
+
+int vcpu_unset_interrupt(struct vcpu *v, unsigned int irq)
+{
+    /* We only allow VS-mode software, timer, external interrupts */
+    if ( irq != IRQ_VS_SOFT &&
+         irq != IRQ_VS_TIMER &&
+         irq != IRQ_VS_EXT )
+        return -EINVAL;
+
+    clear_bit(irq, v->arch.irqs_pending);
+    /*
+     * The counterpart of this barrier is the one encoded implicitly in xchg()
+     * which is used in consumer part (vcpu_flush_interrupts()).
+     */
+    smp_wmb();
+    set_bit(irq, v->arch.irqs_pending_mask);
+
+    return 0;
+}
+
+void vcpu_sync_interrupts(struct vcpu *curr)
+{
+    unsigned long hvip = csr_read(CSR_HVIP);
+
+    ASSERT(curr == current);
+
+    /* Sync-up HVIP.VSSIP bit changes done by Guest */
+    if ( ((curr->arch.hvip ^ hvip) & BIT(IRQ_VS_SOFT, UL)) &&
+         !test_and_set_bit(IRQ_VS_SOFT, &curr->arch.irqs_pending_mask) )
+    {
+        if ( hvip & BIT(IRQ_VS_SOFT, UL) )
+            set_bit(IRQ_VS_SOFT, &curr->arch.irqs_pending);
+        else
+            clear_bit(IRQ_VS_SOFT, &curr->arch.irqs_pending);
+    }
+}
+
 static void __init __maybe_unused build_assertions(void)
 {
     /*
diff --git a/xen/arch/riscv/include/asm/domain.h b/xen/arch/riscv/include/asm/domain.h
index 17be792afe..1ecfe18c85 100644
--- a/xen/arch/riscv/include/asm/domain.h
+++ b/xen/arch/riscv/include/asm/domain.h
@@ -54,8 +54,25 @@ struct arch_vcpu {
     register_t hideleg;
     register_t henvcfg;
     register_t hstateen0;
+    register_t hvip;
 
     register_t vsatp;
+
+    /*
+     * VCPU interrupts
+     *
+     * We have a lockless approach for tracking pending VCPU interrupts
+     * implemented using atomic bitops. The irqs_pending bitmap represent
+     * pending interrupts whereas irqs_pending_mask represent bits changed
+     * in irqs_pending. Our approach is modeled around multiple producer
+     * and single consumer problem where the consumer is the VCPU itself.
+     *
+     * DECLARE_BITMAP() is needed here to support 64 vCPU local interrupts
+     * on RV32 host.
+     */
+#define RISCV_VCPU_NR_IRQS MAX(BITS_PER_LONG, 64)
+    DECLARE_BITMAP(irqs_pending, RISCV_VCPU_NR_IRQS);
+    DECLARE_BITMAP(irqs_pending_mask, RISCV_VCPU_NR_IRQS);
 };
 
 struct paging_domain {
@@ -94,6 +111,11 @@ static inline void update_guest_memory_policy(struct vcpu *v,
 
 static inline void arch_vcpu_block(struct vcpu *v) {}
 
+int vcpu_set_interrupt(struct vcpu *v, unsigned int irq);
+int vcpu_unset_interrupt(struct vcpu *v, unsigned int irq);
+
+void vcpu_sync_interrupts(struct vcpu *curr);
+
 #endif /* ASM__RISCV__DOMAIN_H */
 
 /*
diff --git a/xen/arch/riscv/traps.c b/xen/arch/riscv/traps.c
index 9fca941526..551f886e3a 100644
--- a/xen/arch/riscv/traps.c
+++ b/xen/arch/riscv/traps.c
@@ -171,6 +171,10 @@ static void do_unexpected_trap(const struct cpu_user_regs *regs)
 
 static void check_for_pcpu_work(void)
 {
+    struct vcpu *curr = current;
+
+    vcpu_sync_interrupts(curr);
+
     p2m_handle_vmenter();
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 10 11:44:53 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Mar 2026 11:44:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1250045.1547460 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzvW9-0000a3-Iw; Tue, 10 Mar 2026 11:44:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1250045.1547460; Tue, 10 Mar 2026 11:44:53 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzvW9-0000Zr-Fh; Tue, 10 Mar 2026 11:44:53 +0000
Received: by outflank-mailman (input) for mailman id 1250045;
 Tue, 10 Mar 2026 11:44:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vzvW8-0000Zh-8m
 for xen-changelog@lists.xenproject.org; Tue, 10 Mar 2026 11:44:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzvW8-001bVt-1T
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 11:44:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzvW8-001ifN-0h
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 11:44:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=/7eBuiZHI3cedkojzPfjkfiC/U++hYDdtJx3+j2/SXc=; b=gXlT8UkumvAnx6PTpw5pCdE8S+
	X0ZikOfarPosrDiSS8d2BnCgrX8hENR+upY1PCWNIhDBxQNGP1WMifVIRn5L7nzEcwfw+rxlY7MLA
	Ryco5nirf1DwjiSG7/P2lMzw7OFDg7SxNe0svgiKaIs/YOUI3He5YuhSi2EJsI6C96N0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/riscv: introduce tracking of pending vCPU interrupts, part 2
Message-Id: <E1vzvW8-001ifN-0h@xenbits.xenproject.org>
Date: Tue, 10 Mar 2026 11:44:52 +0000

commit 7379853e0cc91fd760ef3247fc352f7610f16eda
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Fri Mar 6 17:33:21 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 10 09:25:45 2026 +0100

    xen/riscv: introduce tracking of pending vCPU interrupts, part 2
    
    This patch is based on Linux kernel 6.16.0.
    
    Add the consumer side (vcpu_flush_interrupts()) of the lockless pending
    interrupt tracking introduced in part 1 (for producers). According, to the
    design only one consumer is possible, and it is vCPU itself.
    vcpu_flush_interrupts() is expected to be ran (as guests aren't ran now due
    to the lack of functionality) before the hypervisor returns control to the
    guest.
    
    Producers may set bits in irqs_pending_mask without a lock. Clearing bits in
    irqs_pending_mask is performed only by the consumer via xchg() (with aquire
    semantics). The consumer must not write to irqs_pending and must not act on
    bits that are not set in the mask. Otherwise, extra synchronization should
    be provided.
    The worst thing which could happen with such approach is that a new pending
    bit will be set to irqs_pending bitmap during update of hvip variable in
    vcpu_flush_interrupt() but it isn't problem as the new pending bit won't
    be lost and just be proceded during the next flush.
    
    As AIA specs introduced hviph register which would want to be updated when
    guest related AIA code vcpu_update_hvip() is introduced instead of just
    open-code it in vcpu_flush_interrupts().
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/domain.c             | 27 +++++++++++++++++++++++++++
 xen/arch/riscv/include/asm/domain.h |  1 +
 xen/arch/riscv/traps.c              |  2 ++
 3 files changed, 30 insertions(+)

diff --git a/xen/arch/riscv/domain.c b/xen/arch/riscv/domain.c
index 694a03ab74..9c86581ea2 100644
--- a/xen/arch/riscv/domain.c
+++ b/xen/arch/riscv/domain.c
@@ -231,6 +231,33 @@ void vcpu_sync_interrupts(struct vcpu *curr)
     }
 }
 
+void vcpu_flush_interrupts(struct vcpu *curr)
+{
+    ASSERT(curr == current);
+
+    if ( ACCESS_ONCE(curr->arch.irqs_pending_mask[0]) )
+    {
+        unsigned long mask = xchg(&curr->arch.irqs_pending_mask[0], 0UL);
+        unsigned long val = ACCESS_ONCE(curr->arch.irqs_pending[0]) & mask;
+        register_t *hvip = &curr->arch.hvip;
+
+        *hvip &= ~mask;
+        *hvip |= val;
+
+        csr_write(CSR_HVIP, *hvip);
+    }
+
+#ifdef CONFIG_RISCV_32
+    /*
+     * Flush AIA high interrupts.
+     *
+     * It is necessary to do only for CONFIG_RISCV_32 which isn't
+     * supported now.
+     */
+#   error "Update v->arch.hviph"
+#endif
+}
+
 static void __init __maybe_unused build_assertions(void)
 {
     /*
diff --git a/xen/arch/riscv/include/asm/domain.h b/xen/arch/riscv/include/asm/domain.h
index 1ecfe18c85..59d23e4f92 100644
--- a/xen/arch/riscv/include/asm/domain.h
+++ b/xen/arch/riscv/include/asm/domain.h
@@ -115,6 +115,7 @@ int vcpu_set_interrupt(struct vcpu *v, unsigned int irq);
 int vcpu_unset_interrupt(struct vcpu *v, unsigned int irq);
 
 void vcpu_sync_interrupts(struct vcpu *curr);
+void vcpu_flush_interrupts(struct vcpu *curr);
 
 #endif /* ASM__RISCV__DOMAIN_H */
 
diff --git a/xen/arch/riscv/traps.c b/xen/arch/riscv/traps.c
index 551f886e3a..244264c92a 100644
--- a/xen/arch/riscv/traps.c
+++ b/xen/arch/riscv/traps.c
@@ -175,6 +175,8 @@ static void check_for_pcpu_work(void)
 
     vcpu_sync_interrupts(curr);
 
+    vcpu_flush_interrupts(curr);
+
     p2m_handle_vmenter();
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 10 11:45:03 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Mar 2026 11:45:03 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1250046.1547462 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzvWJ-0000bv-Jv; Tue, 10 Mar 2026 11:45:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1250046.1547462; Tue, 10 Mar 2026 11:45:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzvWJ-0000bo-HC; Tue, 10 Mar 2026 11:45:03 +0000
Received: by outflank-mailman (input) for mailman id 1250046;
 Tue, 10 Mar 2026 11:45:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vzvWI-0000bi-Bn
 for xen-changelog@lists.xenproject.org; Tue, 10 Mar 2026 11:45:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzvWI-001bWJ-1l
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 11:45:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzvWI-001igO-0x
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 11:45:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=TMGAiGN5tzTovxo9j2W20nEP6wbYnXCexdATbrzJr6E=; b=W6wn5ytW5g15JVVKiy0pmhEokD
	r00PPMsuZcYee6OJYxu/xGX0S9FAdaXn1vD1VguZFrUHFy7UIOi/lhXd5t+LZ+HXdRFS5FNNgSHjy
	l/JC9ij5ARP9plEuZhpF3fiz5Dt22ICg1iMZaGMBRQML/3fhItUMzLpM7RbsYpCrrAFc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/riscv: introduce basic vtimer infrastructure for guests
Message-Id: <E1vzvWI-001igO-0x@xenbits.xenproject.org>
Date: Tue, 10 Mar 2026 11:45:02 +0000

commit 2473ddf9b4f991859353a2a9641ff19af1dffd93
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Fri Mar 6 17:33:22 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 10 09:25:59 2026 +0100

    xen/riscv: introduce basic vtimer infrastructure for guests
    
    Lay the groundwork for guest timer support by introducing a per-vCPU
    virtual timer backed by Xen’s common timer infrastructure.
    
    The virtual timer is programmed in response to the guest SBI
    sbi_set_timer() call and injects a virtual supervisor timer interrupt
    into the vCPU when it expires.
    
    While a dedicated struct vtimer is not strictly required at present,
    it is expected to become necessary once SSTC support is introduced.
    In particular, it will need to carry additional state such as whether
    SSTC is enabled, the next compare value (e.g. for the VSTIMECMP CSR)
    to be saved and restored across context switches, and time delta state
    (e.g. HTIMEDELTA) required for use cases such as migration. Introducing
    struct vtimer now avoids a later refactoring.
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/Makefile             |  1 +
 xen/arch/riscv/domain.c             | 10 ++++--
 xen/arch/riscv/include/asm/domain.h |  3 ++
 xen/arch/riscv/include/asm/vtimer.h | 17 +++++++++
 xen/arch/riscv/vtimer.c             | 71 +++++++++++++++++++++++++++++++++++++
 5 files changed, 100 insertions(+), 2 deletions(-)

diff --git a/xen/arch/riscv/Makefile b/xen/arch/riscv/Makefile
index bc47e83b26..ffbd7062e2 100644
--- a/xen/arch/riscv/Makefile
+++ b/xen/arch/riscv/Makefile
@@ -22,6 +22,7 @@ obj-y += traps.o
 obj-y += vmid.o
 obj-y += vm_event.o
 obj-y += vsbi/
+obj-y += vtimer.o
 
 $(TARGET): $(TARGET)-syms
 	$(OBJCOPY) -O binary -S $< $@
diff --git a/xen/arch/riscv/domain.c b/xen/arch/riscv/domain.c
index 9c86581ea2..d25938200f 100644
--- a/xen/arch/riscv/domain.c
+++ b/xen/arch/riscv/domain.c
@@ -10,6 +10,7 @@
 #include <asm/cpufeature.h>
 #include <asm/csr.h>
 #include <asm/riscv_encoding.h>
+#include <asm/vtimer.h>
 
 struct csr_masks {
     register_t hedeleg;
@@ -148,11 +149,14 @@ int arch_vcpu_create(struct vcpu *v)
 
     vcpu_csr_init(v);
 
+    if ( (rc = vcpu_vtimer_init(v)) )
+        goto fail;
+
     /*
-     * As the vtimer and interrupt controller (IC) are not yet implemented,
+     * As interrupt controller (IC) is not yet implemented,
      * return an error.
      *
-     * TODO: Drop this once the vtimer and IC are implemented.
+     * TODO: Drop this once IC is implemented.
      */
     rc = -EOPNOTSUPP;
     goto fail;
@@ -166,6 +170,8 @@ int arch_vcpu_create(struct vcpu *v)
 
 void arch_vcpu_destroy(struct vcpu *v)
 {
+    vcpu_timer_destroy(v);
+
     vfree((void *)&v->arch.cpu_info[1] - STACK_SIZE);
 }
 
diff --git a/xen/arch/riscv/include/asm/domain.h b/xen/arch/riscv/include/asm/domain.h
index 59d23e4f92..6c48bf1311 100644
--- a/xen/arch/riscv/include/asm/domain.h
+++ b/xen/arch/riscv/include/asm/domain.h
@@ -8,6 +8,7 @@
 #include <public/hvm/params.h>
 
 #include <asm/p2m.h>
+#include <asm/vtimer.h>
 
 struct vcpu_vmid {
     uint64_t generation;
@@ -49,6 +50,8 @@ struct arch_vcpu {
 
     struct cpu_info *cpu_info;
 
+    struct vtimer vtimer;
+
     register_t hcounteren;
     register_t hedeleg;
     register_t hideleg;
diff --git a/xen/arch/riscv/include/asm/vtimer.h b/xen/arch/riscv/include/asm/vtimer.h
new file mode 100644
index 0000000000..111863610a
--- /dev/null
+++ b/xen/arch/riscv/include/asm/vtimer.h
@@ -0,0 +1,17 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#ifndef ASM__RISCV__VTIMER_H
+#define ASM__RISCV__VTIMER_H
+
+#include <xen/timer.h>
+
+struct vtimer {
+    struct timer timer;
+};
+
+int vcpu_vtimer_init(struct vcpu *v);
+void vcpu_timer_destroy(struct vcpu *v);
+
+void vtimer_set_timer(struct vtimer *t, uint64_t ticks);
+
+#endif /* ASM__RISCV__VTIMER_H */
diff --git a/xen/arch/riscv/vtimer.c b/xen/arch/riscv/vtimer.c
new file mode 100644
index 0000000000..32d142bcdf
--- /dev/null
+++ b/xen/arch/riscv/vtimer.c
@@ -0,0 +1,71 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#include <xen/sched.h>
+#include <xen/timer.h>
+
+#include <asm/vtimer.h>
+
+static void vtimer_expired(void *data)
+{
+    struct vtimer *t = data;
+    struct vcpu *v = container_of(t, struct vcpu, arch.vtimer);
+
+    vcpu_set_interrupt(v, IRQ_VS_TIMER);
+}
+
+int vcpu_vtimer_init(struct vcpu *v)
+{
+    struct vtimer *t = &v->arch.vtimer;
+
+    init_timer(&t->timer, vtimer_expired, t, v->processor);
+
+    return 0;
+}
+
+void vcpu_timer_destroy(struct vcpu *v)
+{
+    struct vtimer *t = &v->arch.vtimer;
+
+    if ( t->timer.status == TIMER_STATUS_invalid )
+        return;
+
+    kill_timer(&v->arch.vtimer.timer);
+}
+
+void vtimer_set_timer(struct vtimer *t, const uint64_t ticks)
+{
+    struct vcpu *v = container_of(t, struct vcpu, arch.vtimer);
+    s_time_t expires = ticks_to_ns(ticks - boot_clock_cycles);
+
+    vcpu_unset_interrupt(v, IRQ_VS_TIMER);
+
+    /*
+     * According to the RISC-V sbi spec:
+     *   If the supervisor wishes to clear the timer interrupt without
+     *   scheduling the next timer event, it can either request a timer
+     *   interrupt infinitely far into the future (i.e., (uint64_t)-1),
+     *   or it can instead mask the timer interrupt by clearing sie.STIE CSR
+     *   bit.
+     */
+    if ( ticks == ((uint64_t)~0) )
+    {
+        stop_timer(&t->timer);
+
+        return;
+    }
+
+    if ( expires < NOW() )
+    {
+        /*
+         * Simplify the logic if the timeout has already expired and just
+         * inject the event.
+         */
+        stop_timer(&t->timer);
+        vcpu_set_interrupt(v, IRQ_VS_TIMER);
+
+        return;
+    }
+
+    migrate_timer(&t->timer, smp_processor_id());
+    set_timer(&t->timer, expires);
+}
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 10 11:45:13 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Mar 2026 11:45:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1250047.1547468 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzvWT-0000eh-Ny; Tue, 10 Mar 2026 11:45:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1250047.1547468; Tue, 10 Mar 2026 11:45:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzvWT-0000eZ-KJ; Tue, 10 Mar 2026 11:45:13 +0000
Received: by outflank-mailman (input) for mailman id 1250047;
 Tue, 10 Mar 2026 11:45:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vzvWS-0000eQ-ER
 for xen-changelog@lists.xenproject.org; Tue, 10 Mar 2026 11:45:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzvWS-001bWO-22
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 11:45:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzvWS-001ih4-1G
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 11:45:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=snZ2RLySoaJnGIq5zq0A7NSXImbSp2rQShj36eaaAiQ=; b=pNFaXULSWryEnHxLpZlBjL/sjm
	Jdw7QQSeNPZ0CpjXOOn8NXHEFr6VdX/8cttsNTWZQ/gJoTypcMgTtkWfwjPOFSJEuGP9l0hWQZzP1
	ahsjkw5/djK8eh8QuNMWzlV2gyfEL1NyN+yqTG+PMDUSe0aW+OW/I8vWML6IU+Ig8JZM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/riscv: introduce vcpu_kick() implementation
Message-Id: <E1vzvWS-001ih4-1G@xenbits.xenproject.org>
Date: Tue, 10 Mar 2026 11:45:12 +0000

commit d81a91b0e4dde994c5ebb0e4d199f7bc44358aec
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Fri Mar 6 17:33:23 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 10 09:26:13 2026 +0100

    xen/riscv: introduce vcpu_kick() implementation
    
    Add a RISC-V implementation of vcpu_kick(), which unblocks the target
    vCPU and sends an event check IPI if the vCPU was running on another
    processor. This mirrors the behavior of Arm and enables proper vCPU
    wakeup handling on RISC-V.
    
    Remove the stub implementation from stubs.c, as it is now provided by
    arch/riscv/domain.c.
    
    Since vcpu_kick() calls perfc_incr(vcpu_kick), add perfcounter for
    vcpu_kick to handle the case when CONFIG_PERF_COUNTERS=y. Although
    CONFIG_PERF_COUNTERS is not enabled by default, it can be enabled,
    for example, by randconfig what will lead to CI build issues.
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/domain.c                 | 14 ++++++++++++++
 xen/arch/riscv/include/asm/Makefile     |  1 -
 xen/arch/riscv/include/asm/perfc_defn.h |  3 +++
 xen/arch/riscv/stubs.c                  |  5 -----
 4 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/xen/arch/riscv/domain.c b/xen/arch/riscv/domain.c
index d25938200f..470eca3ad7 100644
--- a/xen/arch/riscv/domain.c
+++ b/xen/arch/riscv/domain.c
@@ -1,9 +1,11 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 
+#include <xen/cpumask.h>
 #include <xen/init.h>
 #include <xen/mm.h>
 #include <xen/sections.h>
 #include <xen/sched.h>
+#include <xen/smp.h>
 #include <xen/vmap.h>
 
 #include <asm/bitops.h>
@@ -264,6 +266,18 @@ void vcpu_flush_interrupts(struct vcpu *curr)
 #endif
 }
 
+void vcpu_kick(struct vcpu *v)
+{
+    bool running = v->is_running;
+
+    vcpu_unblock(v);
+    if ( running && v != current )
+    {
+        perfc_incr(vcpu_kick);
+        smp_send_event_check_mask(cpumask_of(v->processor));
+    }
+}
+
 static void __init __maybe_unused build_assertions(void)
 {
     /*
diff --git a/xen/arch/riscv/include/asm/Makefile b/xen/arch/riscv/include/asm/Makefile
index 3824f31c39..86c56251d5 100644
--- a/xen/arch/riscv/include/asm/Makefile
+++ b/xen/arch/riscv/include/asm/Makefile
@@ -7,7 +7,6 @@ generic-y += hypercall.h
 generic-y += iocap.h
 generic-y += irq-dt.h
 generic-y += percpu.h
-generic-y += perfc_defn.h
 generic-y += random.h
 generic-y += softirq.h
 generic-y += vm_event.h
diff --git a/xen/arch/riscv/include/asm/perfc_defn.h b/xen/arch/riscv/include/asm/perfc_defn.h
new file mode 100644
index 0000000000..8a4b945df6
--- /dev/null
+++ b/xen/arch/riscv/include/asm/perfc_defn.h
@@ -0,0 +1,3 @@
+/* This file is intended to be included multiple times. */
+
+PERFCOUNTER(vcpu_kick, "vcpu: notify other vcpu")
diff --git a/xen/arch/riscv/stubs.c b/xen/arch/riscv/stubs.c
index daadff0138..eedf8bf935 100644
--- a/xen/arch/riscv/stubs.c
+++ b/xen/arch/riscv/stubs.c
@@ -203,11 +203,6 @@ void vcpu_block_unless_event_pending(struct vcpu *v)
     BUG_ON("unimplemented");
 }
 
-void vcpu_kick(struct vcpu *v)
-{
-    BUG_ON("unimplemented");
-}
-
 unsigned long
 hypercall_create_continuation(unsigned int op, const char *format, ...)
 {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 10 11:45:23 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Mar 2026 11:45:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1250048.1547472 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzvWd-0000h4-PD; Tue, 10 Mar 2026 11:45:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1250048.1547472; Tue, 10 Mar 2026 11:45:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzvWd-0000gw-Lm; Tue, 10 Mar 2026 11:45:23 +0000
Received: by outflank-mailman (input) for mailman id 1250048;
 Tue, 10 Mar 2026 11:45:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vzvWc-0000gq-HS
 for xen-changelog@lists.xenproject.org; Tue, 10 Mar 2026 11:45:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzvWc-001bWV-2L
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 11:45:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzvWc-001ihp-1X
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 11:45:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=v0t4heAVjK14M4VAGo2wJiEtJPXPgijyd42+M06qZGw=; b=vc/fvrHCUFB0O2A+cdnGX7O0yR
	KUgsJF6VtkcOfyNNe+j0SQCsRWghVk+rPF9GA9oQwZ4oCdnP8w2Ojwl88C9HwYQSCgcQaBaos7xSk
	Oi+xkSlP+edUI8ocGP5yFpKOMw8qeg2pCot/GQJAsorM3BJNsi6avTE5kt+0RpzsfTX0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/riscv: add vtimer context switch helpers
Message-Id: <E1vzvWc-001ihp-1X@xenbits.xenproject.org>
Date: Tue, 10 Mar 2026 11:45:22 +0000

commit 4313feae90068fb8fccafe401dd7976cbe117db8
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Fri Mar 6 17:33:24 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 10 09:26:24 2026 +0100

    xen/riscv: add vtimer context switch helpers
    
    Introduce vtimer_ctxt_switch_from() and vtimer_ctxt_switch_to() to handle
    virtual timer state across vCPU context switches.
    
    At present, vtimer_ctxt_switch_from() is a no-op because the RISC-V SSTC
    extension, which provides a virtualization-aware timer, is not yet
    supported. Xen therefore relies the virtual (SBI-based) timer.
    
    The virtual timer uses Xen's internal timer infrastructure and must be
    associated with the pCPU on which the vCPU is currently running so that
    timer events can be delivered efficiently. As a result, vtimer_ctxt_switch_to()
    migrates the timer to the target pCPU when a vCPU is scheduled in.
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/include/asm/vtimer.h |  3 +++
 xen/arch/riscv/vtimer.c             | 15 +++++++++++++++
 2 files changed, 18 insertions(+)

diff --git a/xen/arch/riscv/include/asm/vtimer.h b/xen/arch/riscv/include/asm/vtimer.h
index 111863610a..b4d48d1a17 100644
--- a/xen/arch/riscv/include/asm/vtimer.h
+++ b/xen/arch/riscv/include/asm/vtimer.h
@@ -14,4 +14,7 @@ void vcpu_timer_destroy(struct vcpu *v);
 
 void vtimer_set_timer(struct vtimer *t, uint64_t ticks);
 
+void vtimer_ctxt_switch_from(struct vcpu *p);
+void vtimer_ctxt_switch_to(struct vcpu *n);
+
 #endif /* ASM__RISCV__VTIMER_H */
diff --git a/xen/arch/riscv/vtimer.c b/xen/arch/riscv/vtimer.c
index 32d142bcdf..afd8a53a73 100644
--- a/xen/arch/riscv/vtimer.c
+++ b/xen/arch/riscv/vtimer.c
@@ -1,5 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 
+#include <xen/bug.h>
 #include <xen/sched.h>
 #include <xen/timer.h>
 
@@ -69,3 +70,17 @@ void vtimer_set_timer(struct vtimer *t, const uint64_t ticks)
     migrate_timer(&t->timer, smp_processor_id());
     set_timer(&t->timer, expires);
 }
+
+void vtimer_ctxt_switch_from(struct vcpu *p)
+{
+    ASSERT(!is_idle_vcpu(p));
+
+    /* Nothing to do at the moment as SSTC isn't supported now. */
+}
+
+void vtimer_ctxt_switch_to(struct vcpu *n)
+{
+    ASSERT(!is_idle_vcpu(n));
+
+    migrate_timer(&n->arch.vtimer.timer, n->processor);
+}
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 10 11:45:33 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Mar 2026 11:45:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1250049.1547474 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzvWn-0000j3-Pn; Tue, 10 Mar 2026 11:45:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1250049.1547474; Tue, 10 Mar 2026 11:45:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzvWn-0000iv-NC; Tue, 10 Mar 2026 11:45:33 +0000
Received: by outflank-mailman (input) for mailman id 1250049;
 Tue, 10 Mar 2026 11:45:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vzvWm-0000in-KC
 for xen-changelog@lists.xenproject.org; Tue, 10 Mar 2026 11:45:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzvWm-001bWa-2b
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 11:45:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzvWm-001iid-1q
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 11:45:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=KKnTgmLJxzoQAkOZ17Gx2d/WVORi4GoVqDCmh7rJQmY=; b=vhZux/h2IJlrYCR4t4Y5SMapwS
	dA6OQ2Yas60t4AhMRFvXCbi9eKm/Lhk2hm5ExbcAvF2tunhBcSQudmFOOdxwMp34QTw3Xd0Fnzjpd
	urW+laz6HqljWZVzNkgYBJJ8/HEZnOasNdP9DE9/PEIL1k5QPz7gRPKxWB+ZqWpxysUs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/riscv: implement SBI legacy SET_TIMER support for guests
Message-Id: <E1vzvWm-001iid-1q@xenbits.xenproject.org>
Date: Tue, 10 Mar 2026 11:45:32 +0000

commit 647542cdf13ee31e7d32dcaddba8899cfdc98747
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Fri Mar 6 17:33:25 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 10 09:26:41 2026 +0100

    xen/riscv: implement SBI legacy SET_TIMER support for guests
    
    Add handling of the SBI_EXT_0_1_SET_TIMER function ID to the legacy
    extension ecall handler. The handler now programs the vCPU’s virtual
    timer via vtimer_set_timer() and returns SBI_SUCCESS.
    
    This enables guests using the legacy SBI timer interface to schedule
    timer events correctly.
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/vsbi/legacy-extension.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/xen/arch/riscv/vsbi/legacy-extension.c b/xen/arch/riscv/vsbi/legacy-extension.c
index 2e8df191c2..090c23440c 100644
--- a/xen/arch/riscv/vsbi/legacy-extension.c
+++ b/xen/arch/riscv/vsbi/legacy-extension.c
@@ -7,6 +7,7 @@
 
 #include <asm/processor.h>
 #include <asm/vsbi.h>
+#include <asm/vtimer.h>
 
 static void vsbi_print_char(char c)
 {
@@ -44,6 +45,11 @@ static int vsbi_legacy_ecall_handler(unsigned long eid, unsigned long fid,
         ret = SBI_ERR_NOT_SUPPORTED;
         break;
 
+    case SBI_EXT_0_1_SET_TIMER:
+        vtimer_set_timer(&current->arch.vtimer, regs->a0);
+        regs->a0 = SBI_SUCCESS;
+        break;
+
     default:
         /*
          * TODO: domain_crash() is acceptable here while things are still under
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 10 11:45:43 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Mar 2026 11:45:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1250050.1547479 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzvWx-0000lG-RB; Tue, 10 Mar 2026 11:45:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1250050.1547479; Tue, 10 Mar 2026 11:45:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzvWx-0000l8-Od; Tue, 10 Mar 2026 11:45:43 +0000
Received: by outflank-mailman (input) for mailman id 1250050;
 Tue, 10 Mar 2026 11:45:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vzvWw-0000l2-Mc
 for xen-changelog@lists.xenproject.org; Tue, 10 Mar 2026 11:45:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzvWw-001bYf-2r
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 11:45:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzvWw-001il2-26
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 11:45:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=vhtgOt+60ZeBLavrw7iKuPvmq/6HEiVKhi2eqr+QOlk=; b=F7b4II/a9T90Ocsw08ZSlCbjqi
	9bnuPS4Dze6uHzoN5WGbefdf9Nfrm9tc3hrJbdX/dEmSf/QIeJ9jvB+sfyGCUXztcTaai4ybRKMp/
	K1K5P8GnmQSSrfmtmMV6yeg8ePxp/bATs0HBFYoWNz7WXEUiryssu3MshmlnblbnuJOI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/riscv: introduce sbi_set_timer()
Message-Id: <E1vzvWw-001il2-26@xenbits.xenproject.org>
Date: Tue, 10 Mar 2026 11:45:42 +0000

commit e56decd0a2ccd5c64c05dbead05c78c36815e126
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Fri Mar 6 17:33:26 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 10 09:26:58 2026 +0100

    xen/riscv: introduce sbi_set_timer()
    
    Introduce a function pointer for sbi_set_timer(), since different OpenSBI
    versions may implement the TIME extension with different extension IDs
    and/or function IDs.
    
    If the TIME extension is not available, fall back to the legacy timer
    mechanism. This is useful when Xen runs as a guest under another Xen,
    because the TIME extension is not currently virtualised and therefore
    will not appear as available.
    Despite of the fact that sbi_set_timer_v01 is introduced and used as
    fall back, SBI v0.1 still isn't fully supported (with the current SBI
    calls usage, sbi_rfence_v01 should be introduced too), so panic()
    in sbi_init() isn't removed.
    
    The sbi_set_timer() pointer will be used by reprogram_timer() to program
    Xen’s physical timer as without SSTC extension there is no any other
    option except SBI call to do that as only M-timer is available for us.
    
    Use dprintk() for all the cases to print that a speicifc SBI extension
    is available as it isn't really necessary in case of release builds.
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/include/asm/sbi.h | 22 ++++++++++++++++++++++
 xen/arch/riscv/sbi.c             | 40 +++++++++++++++++++++++++++++++++++++++-
 2 files changed, 61 insertions(+), 1 deletion(-)

diff --git a/xen/arch/riscv/include/asm/sbi.h b/xen/arch/riscv/include/asm/sbi.h
index 79f7ff5c55..ed7af20028 100644
--- a/xen/arch/riscv/include/asm/sbi.h
+++ b/xen/arch/riscv/include/asm/sbi.h
@@ -13,6 +13,7 @@
 #define ASM__RISCV__SBI_H
 
 #include <xen/cpumask.h>
+#include <xen/sections.h>
 
 /* SBI-defined implementation ID */
 #define SBI_XEN_IMPID 7
@@ -29,6 +30,7 @@
 
 #define SBI_EXT_BASE                    0x10
 #define SBI_EXT_RFENCE                  0x52464E43
+#define SBI_EXT_TIME                    0x54494D45
 
 /* SBI function IDs for BASE extension */
 #define SBI_EXT_BASE_GET_SPEC_VERSION   0x0
@@ -48,6 +50,9 @@
 #define SBI_EXT_RFENCE_REMOTE_HFENCE_VVMA       0x5
 #define SBI_EXT_RFENCE_REMOTE_HFENCE_VVMA_ASID  0x6
 
+/* SBI function IDs for TIME extension */
+#define SBI_EXT_TIME_SET_TIMER          0x0
+
 #define SBI_SPEC_VERSION_MAJOR_MASK     0x7f000000
 #define SBI_SPEC_VERSION_MINOR_MASK     0x00ffffff
 
@@ -134,6 +139,23 @@ int sbi_remote_hfence_gvma(const cpumask_t *cpu_mask, vaddr_t start,
 int sbi_remote_hfence_gvma_vmid(const cpumask_t *cpu_mask, vaddr_t start,
                                 size_t size, unsigned long vmid);
 
+/*
+ * Programs the clock for next event at (or after) stime_value. stime_value is
+ * in absolute time. This function must clear the pending timer interrupt bit
+ * as well.
+ *
+ * If the supervisor wishes to clear the timer interrupt without scheduling the
+ * next timer event, it can either request a timer interrupt infinitely far
+ * into the future (i.e., (uint64_t)-1), or it can instead mask the timer
+ * interrupt by clearing sie.STIE CSR bit.
+ *
+ * The stime_value parameter represents absolute time measured in ticks.
+ *
+ * This SBI call returns 0 upon success or an implementation specific negative
+ * error code.
+ */
+extern int (* __ro_after_init sbi_set_timer)(uint64_t stime_value);
+
 /*
  * Initialize SBI library
  *
diff --git a/xen/arch/riscv/sbi.c b/xen/arch/riscv/sbi.c
index 425dce44c6..b4a7ae6940 100644
--- a/xen/arch/riscv/sbi.c
+++ b/xen/arch/riscv/sbi.c
@@ -249,6 +249,38 @@ static int (* __ro_after_init sbi_rfence)(unsigned long fid,
                                           unsigned long arg4,
                                           unsigned long arg5);
 
+static int cf_check sbi_set_timer_v02(uint64_t stime_value)
+{
+    struct sbiret ret;
+
+    ret = sbi_ecall(SBI_EXT_TIME, SBI_EXT_TIME_SET_TIMER, stime_value,
+#ifdef CONFIG_RISCV_32
+                    stime_value >> 32,
+#else
+                    0,
+#endif
+                    0, 0, 0, 0);
+
+    return sbi_err_map_xen_errno(ret.error);
+}
+
+static int cf_check sbi_set_timer_v01(uint64_t stime_value)
+{
+    struct sbiret ret;
+
+    ret = sbi_ecall(SBI_EXT_0_1_SET_TIMER, 0, stime_value,
+#ifdef CONFIG_RISCV_32
+                    stime_value >> 32,
+#else
+                    0,
+#endif
+                    0, 0, 0, 0);
+
+    return sbi_err_map_xen_errno(ret.error);
+}
+
+int (* __ro_after_init sbi_set_timer)(uint64_t stime_value) = sbi_set_timer_v01;
+
 int sbi_remote_sfence_vma(const cpumask_t *cpu_mask, vaddr_t start,
                           size_t size)
 {
@@ -324,7 +356,13 @@ int __init sbi_init(void)
         if ( sbi_probe_extension(SBI_EXT_RFENCE) > 0 )
         {
             sbi_rfence = sbi_rfence_v02;
-            printk("SBI v0.2 RFENCE extension detected\n");
+            dprintk(XENLOG_INFO, "SBI v0.2 RFENCE extension detected\n");
+        }
+
+        if ( sbi_probe_extension(SBI_EXT_TIME) > 0 )
+        {
+            sbi_set_timer = sbi_set_timer_v02;
+            dprintk(XENLOG_INFO, "SBI v0.2 TIME extension detected\n");
         }
     }
     else
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 10 11:45:53 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Mar 2026 11:45:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1250051.1547483 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzvX7-0000nN-SO; Tue, 10 Mar 2026 11:45:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1250051.1547483; Tue, 10 Mar 2026 11:45:53 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzvX7-0000nF-Po; Tue, 10 Mar 2026 11:45:53 +0000
Received: by outflank-mailman (input) for mailman id 1250051;
 Tue, 10 Mar 2026 11:45:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vzvX6-0000n9-PJ
 for xen-changelog@lists.xenproject.org; Tue, 10 Mar 2026 11:45:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzvX6-001bZ3-37
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 11:45:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzvX6-001iln-2L
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 11:45:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=50r/GYg97bGaA1dV/F1KS+AKi/QV5+VJR2lFGwEYm48=; b=hXp7PwSONgSiPnJJWU10gCuNI9
	zLBGwp0Ov1cRwhrzmpG5aWYkrYK2rw9H38FsFo4pBRY/J32nVNcc1TRel7+c7z2P3bypIoreYiexh
	bsRlD+4eEG4mRz3vWqkrMQFp8kAVlE3X1FkvIBJEYOTXqh8ukGChwGLYOTjxj9Ra/Bm0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/riscv: implement reprogram_timer() via SBI
Message-Id: <E1vzvX6-001iln-2L@xenbits.xenproject.org>
Date: Tue, 10 Mar 2026 11:45:52 +0000

commit f3f7359b617c659d4f526d70a6d405ed12e4021d
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Fri Mar 6 17:33:27 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 10 09:27:10 2026 +0100

    xen/riscv: implement reprogram_timer() via SBI
    
    Implement reprogram_timer() on RISC-V using the standard SBI timer call.
    
    The privileged architecture only defines machine-mode timer interrupts
    (using mtime/mtimecmp). Therefore, timer services for S/HS/VS mode must
    be provided by M-mode via SBI calls. SSTC (Supervisor-mode Timer Control)
    is optional and is not supported on the boards available to me, so the
    only viable approach today is to program the timer through SBI.
    
    reprogram_timer() enables/disables the supervisor timer interrupt and
    programs the next timer deadline using sbi_set_timer(). If the SBI call
    fails, the code panics, because sbi_set_timer() is expected to return
    either 0 or -ENOSUPP (this has been stable from early OpenSBI versions to
    the latest ones). The SBI spec does not define a standard negative error
    code for this call, and without SSTC there is no alternative method to
    program the timer, so the SBI timer call must be available.
    
    reprogram_timer() currently returns int for compatibility with the
    existing prototype. While it might be cleaner to return bool, keeping the
    existing signature avoids premature changes in case sbi_set_timer() ever
    needs to return other values (based on which we could try to avoid
    panic-ing) in the future.
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/stubs.c |  5 -----
 xen/arch/riscv/time.c  | 43 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 43 insertions(+), 5 deletions(-)

diff --git a/xen/arch/riscv/stubs.c b/xen/arch/riscv/stubs.c
index eedf8bf935..2f3a0ce76a 100644
--- a/xen/arch/riscv/stubs.c
+++ b/xen/arch/riscv/stubs.c
@@ -21,11 +21,6 @@ nodemask_t __read_mostly node_online_map = { { [0] = 1UL } };
 
 /* time.c */
 
-int reprogram_timer(s_time_t timeout)
-{
-    BUG_ON("unimplemented");
-}
-
 void send_timer_event(struct vcpu *v)
 {
     BUG_ON("unimplemented");
diff --git a/xen/arch/riscv/time.c b/xen/arch/riscv/time.c
index 2c7af0a5d6..7efa76fdbc 100644
--- a/xen/arch/riscv/time.c
+++ b/xen/arch/riscv/time.c
@@ -7,6 +7,9 @@
 #include <xen/time.h>
 #include <xen/types.h>
 
+#include <asm/csr.h>
+#include <asm/sbi.h>
+
 unsigned long __ro_after_init cpu_khz; /* CPU clock frequency in kHz. */
 uint64_t __ro_after_init boot_clock_cycles;
 
@@ -40,6 +43,46 @@ static void __init preinit_dt_xen_time(void)
     cpu_khz = rate / 1000;
 }
 
+int reprogram_timer(s_time_t timeout)
+{
+    uint64_t deadline, now;
+    int rc;
+
+    if ( timeout == 0 )
+    {
+        /* Disable timer interrupt */
+        csr_clear(CSR_SIE, BIT(IRQ_S_TIMER, UL));
+
+        return 1;
+    }
+
+    deadline = ns_to_ticks(timeout) + boot_clock_cycles;
+    now = get_cycles();
+    if ( deadline <= now )
+        return 0;
+
+    /*
+     * TODO: When the SSTC extension is supported, it would be preferable to
+     *       use the supervisor timer registers directly here for better
+     *       performance, since an SBI call and mode switch would no longer
+     *       be required.
+     *
+     *       This would also reduce reliance on a specific SBI implementation.
+     *       For example, it is not ideal to panic() if sbi_set_timer() returns
+     *       a non-zero value. Currently it can return 0 or -ENOSUPP, and
+     *       without SSTC we still need an implementation because only the
+     *       M-mode timer is available, and it can only be programmed in
+     *       M-mode.
+     */
+    if ( (rc = sbi_set_timer(deadline)) )
+        panic("%s: timer wasn't set because: %d\n", __func__, rc);
+
+    /* Enable timer interrupt */
+    csr_set(CSR_SIE, BIT(IRQ_S_TIMER, UL));
+
+    return 1;
+}
+
 void __init preinit_xen_time(void)
 {
     if ( acpi_disabled )
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 10 11:46:03 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Mar 2026 11:46:03 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1250052.1547487 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzvXH-0000pX-U3; Tue, 10 Mar 2026 11:46:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1250052.1547487; Tue, 10 Mar 2026 11:46:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzvXH-0000pP-RE; Tue, 10 Mar 2026 11:46:03 +0000
Received: by outflank-mailman (input) for mailman id 1250052;
 Tue, 10 Mar 2026 11:46:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vzvXG-0000pG-Rm
 for xen-changelog@lists.xenproject.org; Tue, 10 Mar 2026 11:46:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzvXH-001bZI-09
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 11:46:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzvXG-001ims-2b
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 11:46:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=hKNpDmws8VGseEEDBhCXoZbP2v3XM2XeQTU4DqXdzD8=; b=onw7AY1uVSaH8j6swyndr3F7Pv
	rDOlj503cdN8yYNeEVW4R1OqXcNwAYsXuppdrglrt3mL1WsUsIxmlNfIHIHo/seSVhQDy4FCciKJi
	hsRr9bQnxv1cCHtt9Js4O6El1leLz8rDny2VSrF0XXVw+BI9RiXxgOZz1FNaN0jVAwqU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/riscv: handle hypervisor timer interrupts
Message-Id: <E1vzvXG-001ims-2b@xenbits.xenproject.org>
Date: Tue, 10 Mar 2026 11:46:02 +0000

commit cfef4ba93980d9da0f1d97224b233fe988639ddb
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Fri Mar 6 17:33:28 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 10 09:27:22 2026 +0100

    xen/riscv: handle hypervisor timer interrupts
    
    Introduce timer_interrupt() to process IRQ_S_TIMER interrupts.
    The handler disables further timer interrupts by clearing
    SIE.STIE and raises TIMER_SOFTIRQ so the generic timer subsystem
    can perform its processing.
    
    Update do_trap() to dispatch IRQ_S_TIMER to this new handler.
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/traps.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/xen/arch/riscv/traps.c b/xen/arch/riscv/traps.c
index 244264c92a..326f2be628 100644
--- a/xen/arch/riscv/traps.c
+++ b/xen/arch/riscv/traps.c
@@ -10,6 +10,7 @@
 #include <xen/lib.h>
 #include <xen/nospec.h>
 #include <xen/sched.h>
+#include <xen/softirq.h>
 
 #include <asm/cpufeature.h>
 #include <asm/intc.h>
@@ -180,6 +181,15 @@ static void check_for_pcpu_work(void)
     p2m_handle_vmenter();
 }
 
+static void timer_interrupt(void)
+{
+    /* Disable the timer to avoid more interrupts */
+    csr_clear(CSR_SIE, BIT(IRQ_S_TIMER, UL));
+
+    /* Signal the generic timer code to do its work */
+    raise_softirq(TIMER_SOFTIRQ);
+}
+
 void do_trap(struct cpu_user_regs *cpu_regs)
 {
     register_t pc = cpu_regs->sepc;
@@ -221,6 +231,10 @@ void do_trap(struct cpu_user_regs *cpu_regs)
                 intc_handle_external_irqs(cpu_regs);
                 break;
 
+            case IRQ_S_TIMER:
+                timer_interrupt();
+                break;
+
             default:
                 intr_handled = false;
                 break;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 10 11:46:14 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Mar 2026 11:46:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1250053.1547491 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzvXS-0000s6-0J; Tue, 10 Mar 2026 11:46:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1250053.1547491; Tue, 10 Mar 2026 11:46:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzvXR-0000ry-U4; Tue, 10 Mar 2026 11:46:13 +0000
Received: by outflank-mailman (input) for mailman id 1250053;
 Tue, 10 Mar 2026 11:46:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vzvXQ-0000rq-UF
 for xen-changelog@lists.xenproject.org; Tue, 10 Mar 2026 11:46:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzvXR-001bZS-0O
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 11:46:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzvXQ-001inm-2r
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 11:46:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=M90IyQo9JHe36WbAXZBrHzLM4dVFwciEqgz6yvRNeyM=; b=yNv4QTZdoqsNSJBCjlMq7PL5Wf
	GHhW/Fg56mzM3dSJzoW6n4hdsP6sVRIwdvClUnHJGVFRDJlF+M/AS7uoZA7uGpeXoWnyRQKta9Ak9
	MiUg9DK4CIIwWrxf9EgFv7AkMbQPLEL4pQda8YGuxCjrRNz8au1LBEYbU3kr04BR03dE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/riscv: init tasklet subsystem
Message-Id: <E1vzvXQ-001inm-2r@xenbits.xenproject.org>
Date: Tue, 10 Mar 2026 11:46:12 +0000

commit 18964d1bf544129c5fb0f04c96b8502b0f203755
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Fri Mar 6 17:33:29 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 10 09:27:35 2026 +0100

    xen/riscv: init tasklet subsystem
    
    As the tasklet subsystem is now initialized, it is necessary to implement
    sync_local_execstate(), since it is invoked when something calls
    tasklet_softirq_action(), which is registered in tasklet_subsys_init().
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/setup.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/xen/arch/riscv/setup.c b/xen/arch/riscv/setup.c
index bca6ca09ed..cae49bb296 100644
--- a/xen/arch/riscv/setup.c
+++ b/xen/arch/riscv/setup.c
@@ -12,6 +12,7 @@
 #include <xen/serial.h>
 #include <xen/shutdown.h>
 #include <xen/smp.h>
+#include <xen/tasklet.h>
 #include <xen/timer.h>
 #include <xen/vmap.h>
 #include <xen/xvmalloc.h>
@@ -133,6 +134,8 @@ void __init noreturn start_xen(unsigned long bootcpu_id,
         panic("Booting using ACPI isn't supported\n");
     }
 
+    tasklet_subsys_init();
+
     init_IRQ();
 
     riscv_fill_hwcap();
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 10 11:46:24 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Mar 2026 11:46:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1250054.1547494 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzvXc-0000uP-1j; Tue, 10 Mar 2026 11:46:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1250054.1547494; Tue, 10 Mar 2026 11:46:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzvXb-0000uH-VT; Tue, 10 Mar 2026 11:46:23 +0000
Received: by outflank-mailman (input) for mailman id 1250054;
 Tue, 10 Mar 2026 11:46:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vzvXb-0000uB-0R
 for xen-changelog@lists.xenproject.org; Tue, 10 Mar 2026 11:46:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzvXb-001bZX-0e
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 11:46:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzvXa-001ioq-35
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 11:46:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=hQMzAZnGwZ/KaSDAW/1aE0G/tWKCh0hNv3ZIyjOiyLs=; b=ea5ZwTQTk7PQIdbmJJHRTHA2Lq
	h8nTIadExVgpEOk1xwBo67fJ6pnv4g7S83tjjiQ0yRfjBBEL+ev7Orrg09b6q1Zuvnwz8nSb0Dpqo
	EOYHGHIKimfoX6BpA1q0euw5fYms8GdSMPDiiOcEyv6BwI0YT+CwHg+6WXqYsyp7y8Tc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/riscv: implement sync_vcpu_execstate()
Message-Id: <E1vzvXa-001ioq-35@xenbits.xenproject.org>
Date: Tue, 10 Mar 2026 11:46:22 +0000

commit 256479ba567766609435c83b5d5d5596c1c606e0
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Fri Mar 6 17:33:30 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 10 09:27:47 2026 +0100

    xen/riscv: implement sync_vcpu_execstate()
    
    The scheduler may call this function to force synchronization of given
    vCPU's state. RISC-V does not support lazy context switching, so nothing
    is done in sync_vcpu_execstate() and sync_local_execstate().
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/domain.c | 10 ++++++++++
 xen/arch/riscv/stubs.c  | 10 ----------
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/xen/arch/riscv/domain.c b/xen/arch/riscv/domain.c
index 470eca3ad7..c327f44d07 100644
--- a/xen/arch/riscv/domain.c
+++ b/xen/arch/riscv/domain.c
@@ -278,6 +278,16 @@ void vcpu_kick(struct vcpu *v)
     }
 }
 
+void sync_local_execstate(void)
+{
+    /* Nothing to do -- no lazy switching */
+}
+
+void sync_vcpu_execstate(struct vcpu *v)
+{
+    /* Nothing to do -- no lazy switching */
+}
+
 static void __init __maybe_unused build_assertions(void)
 {
     /*
diff --git a/xen/arch/riscv/stubs.c b/xen/arch/riscv/stubs.c
index 2f3a0ce76a..acbb5b9123 100644
--- a/xen/arch/riscv/stubs.c
+++ b/xen/arch/riscv/stubs.c
@@ -91,16 +91,6 @@ void continue_running(struct vcpu *same)
     BUG_ON("unimplemented");
 }
 
-void sync_local_execstate(void)
-{
-    BUG_ON("unimplemented");
-}
-
-void sync_vcpu_execstate(struct vcpu *v)
-{
-    BUG_ON("unimplemented");
-}
-
 void startup_cpu_idle_loop(void)
 {
     BUG_ON("unimplemented");
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 10 11:46:35 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Mar 2026 11:46:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1250055.1547499 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzvXn-0000wK-3A; Tue, 10 Mar 2026 11:46:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1250055.1547499; Tue, 10 Mar 2026 11:46:35 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzvXn-0000wC-0b; Tue, 10 Mar 2026 11:46:35 +0000
Received: by outflank-mailman (input) for mailman id 1250055;
 Tue, 10 Mar 2026 11:46:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vzvXl-0000w4-38
 for xen-changelog@lists.xenproject.org; Tue, 10 Mar 2026 11:46:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzvXl-001bZh-0t
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 11:46:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzvXl-001ipz-08
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 11:46:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=vScXFk1tMSboMgPLu2nFFYTjQPphagf1q1FXEF1pyiY=; b=NxCqlID0V3MRVGegF7hfQzdqhf
	qCmbPHrhf5AqSp5vUzWKSfo43UOarW1kApmpClSAf6gs3qHVerShQev/Ew8KTm3giOj7nj1rjIpm+
	hFG735wb8JSpTISRPbXmEVqEsCGrn93qsmL4a0EhAnLE23tXd3dUdeoVlh2btNHN/zAU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/tests/x86_emulator: avoid duplicate symbol error with clang: use -Og
Message-Id: <E1vzvXl-001ipz-08@xenbits.xenproject.org>
Date: Tue, 10 Mar 2026 11:46:33 +0000

commit 442f3481fe3979e3e563bd7d221498a3d52133cc
Author:     Edwin Török <edwin.torok@citrix.com>
AuthorDate: Tue Mar 10 09:28:09 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 10 09:28:09 2026 +0100

    tools/tests/x86_emulator: avoid duplicate symbol error with clang: use -Og
    
    clang would duplicate the loop body and end up with a double definition
    of the symbol:
    ```
    /tmp/test_x86_emulator-0f3576.s:27823: Error: symbol `vmovsh_to_mem' is already defined
    /tmp/test_x86_emulator-0f3576.s:27825: Error: symbol `.Lvmovsh_to_mem_end' is already defined
    ```
    
    Until a better solution is found: reduce optimizations in the test runner.
    
    Using -Os might also work, but we can't rely on the size optimization
    always avoiding the duplication of asm blocks.
    This is test code, not performance critical code, and -O0 is more future
    proof.
    However for debugging -Og is recommended over -O0, and this still avoids
    the duplicate label problem.
    
    Signed-off-by: Edwin Török <edwin.torok@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 tools/tests/x86_emulator/Makefile | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/tools/tests/x86_emulator/Makefile b/tools/tests/x86_emulator/Makefile
index 5003c464f3..8210e83345 100644
--- a/tools/tests/x86_emulator/Makefile
+++ b/tools/tests/x86_emulator/Makefile
@@ -323,4 +323,11 @@ x86-emulate.o x86_emulate/%.o: HOSTCFLAGS += -D__XEN_TOOLS__
 $(call cc-option-add,HOSTCFLAGS-toplevel,HOSTCC,-fno-toplevel-reorder)
 test_x86_emulator.o: HOSTCFLAGS += $(HOSTCFLAGS-toplevel)
 
+# When unrolling loops, compilers may duplicate inline assembly. put_insn()
+# emits labels, which may not be emitted multiple times.
+# The default HOSTCFLAGS from $(XEN_ROOT)/Config.mk would set a non-zero
+# optimisation level.
+# Until a better solution is found: reduce optimizations in the test runner.
+test_x86_emulator.o: HOSTCFLAGS += -Og
+
 test_x86_emulator.o: $(addsuffix .h,$(TESTCASES)) $(addsuffix -opmask.h,$(OPMASK))
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 10 12:44:09 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Mar 2026 12:44:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1250091.1547521 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzwRP-0000gS-Eh; Tue, 10 Mar 2026 12:44:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1250091.1547521; Tue, 10 Mar 2026 12:44:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzwRP-0000gK-CB; Tue, 10 Mar 2026 12:44:03 +0000
Received: by outflank-mailman (input) for mailman id 1250091;
 Tue, 10 Mar 2026 12:44:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vzwRO-0000gE-4S
 for xen-changelog@lists.xenproject.org; Tue, 10 Mar 2026 12:44:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzwRO-001cae-0m
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 12:44:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzwRN-001mhx-3C
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 12:44:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Zro5BT5GDL7Tf9qHb4pc46961B5R939jl4wsxlGFUFQ=; b=x9Z0ElssYT8SG84hpm+F+sZDI0
	wVpvmdmO6yqFzU3jIlb8VSo3kbWtqDFBCKNZvHNAK26tZOM3gOAWr8YS0M/lrUQWjpzJTpPkSEX+l
	0iFtksi9Jrn/8CTBi9uJZyr0fGunpESSrWbHQyXA4W/YklC2GovgQarr19i3HEHQrq90=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/pv: Adjust GS handling for FRED mode
Message-Id: <E1vzwRN-001mhx-3C@xenbits.xenproject.org>
Date: Tue, 10 Mar 2026 12:44:01 +0000

commit 9ea7d7f9393c52de36ee9c42b52c235949453a2a
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Aug 11 23:46:01 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 10 11:57:31 2026 +0000

    x86/pv: Adjust GS handling for FRED mode
    
    When FRED is active, hardware automatically swaps GS when changing privilege,
    and the SWAPGS instruction is disallowed.
    
    For native OSes using GS as the thread local pointer this is a massive
    improvement on the pre-FRED architecture, but under Xen it makes handling PV
    guests more complicated.  Specifically, it means that GS_BASE and GS_SHADOW
    are the opposite way around in FRED mode, as opposed to IDT mode.
    
    This leads to the following changes:
    
      * In load_segments(), we already load both GSes.  Account for FRED in the
        SWAP() condition and avoid the path with SWAGS.
    
      * In save_segments(), we need to read GS_SHADOW rather than GS_BASE.
    
      * In toggle_guest_mode(), we need to emulate SWAPGS.
    
      * In {read,write}_msr() which access the live registers, GS_SHADOW and
        GS_BASE need swapping.
    
      * In do_set_segment_base(), merge the SEGBASE_GS_{USER,KERNEL} cases and
        take FRED into account when choosing which base to update.
    
        SEGBASE_GS_USER_SEL was already an LKGS invocation (decades before FRED)
        so under FRED needs to be just a MOV %gs.  Simply skip the SWAPGSes.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/domain.c             | 16 +++++++++++-----
 xen/arch/x86/pv/domain.c          | 22 ++++++++++++++++++++--
 xen/arch/x86/pv/emul-priv-op.c    | 26 +++++++++++++++++---------
 xen/arch/x86/pv/misc-hypercalls.c | 23 +++++++++++++++--------
 4 files changed, 63 insertions(+), 24 deletions(-)

diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index e658c2d647..9c1f6ef76d 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -1791,9 +1791,10 @@ static void load_segments(struct vcpu *n)
 
         /*
          * Figure out which way around gsb/gss want to be.  gsb needs to be
-         * the active context, and gss needs to be the inactive context.
+         * the active context, and gss needs to be the inactive context,
+         * unless we're in FRED mode where they're reversed.
          */
-        if ( !(n->arch.flags & TF_kernel_mode) )
+        if ( !(n->arch.flags & TF_kernel_mode) ^ opt_fred )
             SWAP(gsb, gss);
 
         if ( using_svm() && (n->arch.pv.fs | n->arch.pv.gs) <= 3 )
@@ -1814,7 +1815,9 @@ static void load_segments(struct vcpu *n)
 
     if ( !fs_gs_done && !compat )
     {
-        if ( read_cr4() & X86_CR4_FSGSBASE )
+        unsigned long cr4 = read_cr4();
+
+        if ( !(cr4 & X86_CR4_FRED) && (cr4 & X86_CR4_FSGSBASE) )
         {
             __wrgsbase(gss);
             __wrfsbase(n->arch.pv.fs_base);
@@ -1931,6 +1934,9 @@ static void load_segments(struct vcpu *n)
  * Guests however cannot use SWAPGS, so there is no mechanism to modify the
  * inactive GS base behind Xen's back.  Therefore, Xen's copy of the inactive
  * GS base is still accurate, and doesn't need reading back from hardware.
+ *
+ * Under FRED, hardware automatically swaps GS for us, so SHADOW_GS is the
+ * active GS from the guest's point of view.
  */
 static void save_segments(struct vcpu *v)
 {
@@ -1946,12 +1952,12 @@ static void save_segments(struct vcpu *v)
         if ( read_cr4() & X86_CR4_FSGSBASE )
         {
             fs_base = __rdfsbase();
-            gs_base = __rdgsbase();
+            gs_base = opt_fred ? rdmsr(MSR_SHADOW_GS_BASE) : __rdgsbase();
         }
         else
         {
             fs_base = rdmsr(MSR_FS_BASE);
-            gs_base = rdmsr(MSR_GS_BASE);
+            gs_base = opt_fred ? rdmsr(MSR_SHADOW_GS_BASE) : rdmsr(MSR_GS_BASE);
         }
 
         v->arch.pv.fs_base = fs_base;
diff --git a/xen/arch/x86/pv/domain.c b/xen/arch/x86/pv/domain.c
index d16583a745..b85abb5ed9 100644
--- a/xen/arch/x86/pv/domain.c
+++ b/xen/arch/x86/pv/domain.c
@@ -14,9 +14,10 @@
 #include <asm/cpufeature.h>
 #include <asm/fsgsbase.h>
 #include <asm/invpcid.h>
-#include <asm/spec_ctrl.h>
 #include <asm/pv/domain.h>
 #include <asm/shadow.h>
+#include <asm/spec_ctrl.h>
+#include <asm/traps.h>
 
 #ifdef CONFIG_PV32
 int8_t __read_mostly opt_pv32 = -1;
@@ -514,11 +515,28 @@ void toggle_guest_mode(struct vcpu *v)
      * subsequent context switch won't bother re-reading it.
      */
     gs_base = read_gs_base();
+
+    /*
+     * In FRED mode, not only are the two GSes the other way around (i.e. we
+     * want to read GS_SHADOW here), the SWAPGS instruction is disallowed so
+     * we have to emulate it.
+     */
+    if ( opt_fred )
+    {
+        unsigned long gs_shadow = rdmsr(MSR_SHADOW_GS_BASE);
+
+        wrmsrns(MSR_SHADOW_GS_BASE, gs_base);
+        write_gs_base(gs_shadow);
+
+        gs_base = gs_shadow;
+    }
+    else
+        asm volatile ( "swapgs" );
+
     if ( v->arch.flags & TF_kernel_mode )
         v->arch.pv.gs_base_kernel = gs_base;
     else
         v->arch.pv.gs_base_user = gs_base;
-    asm volatile ( "swapgs" );
 
     _toggle_guest_pt(v);
 
diff --git a/xen/arch/x86/pv/emul-priv-op.c b/xen/arch/x86/pv/emul-priv-op.c
index 64d47ab677..53676b3021 100644
--- a/xen/arch/x86/pv/emul-priv-op.c
+++ b/xen/arch/x86/pv/emul-priv-op.c
@@ -25,6 +25,7 @@
 #include <asm/pv/traps.h>
 #include <asm/shared.h>
 #include <asm/stubs.h>
+#include <asm/traps.h>
 
 #include <xsm/xsm.h>
 
@@ -926,7 +927,8 @@ static int cf_check read_msr(
     case MSR_GS_BASE:
         if ( !cp->extd.lm )
             break;
-        *val = read_gs_base();
+        /* Under FRED, GS is automatically swapped on privilege change. */
+        *val = opt_fred ? rdmsr(MSR_SHADOW_GS_BASE) : read_gs_base();
         return X86EMUL_OKAY;
 
     case MSR_SHADOW_GS_BASE:
@@ -1066,17 +1068,23 @@ static int cf_check write_msr(
         if ( !cp->extd.lm || !is_canonical_address(val) )
             break;
 
-        if ( reg == MSR_FS_BASE )
-            write_fs_base(val);
-        else if ( reg == MSR_GS_BASE )
-            write_gs_base(val);
-        else if ( reg == MSR_SHADOW_GS_BASE )
+        switch ( reg )
         {
-            write_gs_shadow(val);
+        case MSR_FS_BASE:
+            write_fs_base(val);
+            break;
+
+        case MSR_SHADOW_GS_BASE:
             curr->arch.pv.gs_base_user = val;
+            fallthrough;
+        case MSR_GS_BASE:
+            /* Under FRED, GS is automatically swapped on privilege change. */
+            if ( (reg == MSR_GS_BASE) ^ opt_fred )
+                write_gs_base(val);
+            else
+                write_gs_shadow(val);
+            break;
         }
-        else
-            ASSERT_UNREACHABLE();
         return X86EMUL_OKAY;
 
     case MSR_EFER:
diff --git a/xen/arch/x86/pv/misc-hypercalls.c b/xen/arch/x86/pv/misc-hypercalls.c
index 4c2abeb4ad..7e915d86b7 100644
--- a/xen/arch/x86/pv/misc-hypercalls.c
+++ b/xen/arch/x86/pv/misc-hypercalls.c
@@ -11,6 +11,7 @@
 
 #include <asm/debugreg.h>
 #include <asm/fsgsbase.h>
+#include <asm/traps.h>
 
 long do_set_debugreg(int reg, unsigned long value)
 {
@@ -192,11 +193,13 @@ long do_set_segment_base(unsigned int which, unsigned long base)
 
         case SEGBASE_GS_USER:
             v->arch.pv.gs_base_user = base;
-            write_gs_shadow(base);
-            break;
-
+            fallthrough;
         case SEGBASE_GS_KERNEL:
-            write_gs_base(base);
+            /* Under FRED, GS is automatically swapped on privilege change. */
+            if ( (which == SEGBASE_GS_KERNEL) ^ opt_fred )
+                write_gs_base(base);
+            else
+                write_gs_shadow(base);
             break;
         }
         break;
@@ -206,10 +209,13 @@ long do_set_segment_base(unsigned int which, unsigned long base)
         unsigned int sel = (uint16_t)base;
 
         /*
-         * We wish to update the user %gs from the GDT/LDT.  Currently, the
-         * guest kernel's GS_BASE is in context.
+         * We wish to update the user %gs from the GDT/LDT.  Currently, we are
+         * in guest kernel context.
+         *
+         * Under IDT, this means updating GS_SHADOW.  Under FRED, plain GS.
          */
-        asm volatile ( "swapgs" );
+        if ( !opt_fred )
+            asm volatile ( "swapgs" );
 
         if ( sel > 3 )
             /* Fix up RPL for non-NUL selectors. */
@@ -247,7 +253,8 @@ long do_set_segment_base(unsigned int which, unsigned long base)
         /* Update the cache of the inactive base, as read from the GDT/LDT. */
         v->arch.pv.gs_base_user = read_gs_base();
 
-        asm volatile ( safe_swapgs );
+        if ( !opt_fred )
+            asm volatile ( safe_swapgs );
         break;
     }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 10 12:44:14 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Mar 2026 12:44:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1250092.1547525 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzwRZ-0000i5-GP; Tue, 10 Mar 2026 12:44:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1250092.1547525; Tue, 10 Mar 2026 12:44:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzwRZ-0000hx-Da; Tue, 10 Mar 2026 12:44:13 +0000
Received: by outflank-mailman (input) for mailman id 1250092;
 Tue, 10 Mar 2026 12:44:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vzwRY-0000hf-53
 for xen-changelog@lists.xenproject.org; Tue, 10 Mar 2026 12:44:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzwRY-001cal-14
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 12:44:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzwRY-001mjX-0H
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 12:44:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=mP1yLM8MzRa4yocVPorNKTAzKf45kCDRU7D9jobiWQ4=; b=Rra46Wh6VxhzfZ1cPp3kQJjc0d
	V7vhoIBePK2dj6hhpip80g4fZHL7sxKTOKAwhuqXkl3UBDFbwSTVUIXKvO5Qo6PgNjzzhUgdVOtM2
	95az5NyHBYIRu4z+p3oj103X6t12H0DaWvjGPA/1hrbTWevW+s15nR8gAA90mvVC56EU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/pv: Guest exception handling in FRED mode
Message-Id: <E1vzwRY-001mjX-0H@xenbits.xenproject.org>
Date: Tue, 10 Mar 2026 12:44:12 +0000

commit 87cfcbe9f0b522f9498101b6a698dd8fbf6509b7
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Aug 11 15:55:24 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 10 11:57:53 2026 +0000

    x86/pv: Guest exception handling in FRED mode
    
    Under FRED, entry_from_pv() handles everything.  To start with, implement
    exception handling in the same manner as entry_from_xen(), although we can
    unconditionally enable interrupts after the async/fatal events.
    
    After entry_from_pv() returns, test_all_events() needs to run to perform
    exception and interrupt injection.  Split entry_FRED_R3() into two and
    introduce eretu_exit_to_guest() as the latter half, coming unilaterally from
    restore_all_guest().
    
    For all of this, there is a slightly complicated relationship with CONFIG_PV.
    entry_FRED_R3() must exist irrespective of CONFIG_PV, because it's the
    entrypoint registered with hardware.  For simplicity, entry_from_pv() is
    always called, but it collapses into fatal_trap() in the !PV case.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/traps.c             | 78 +++++++++++++++++++++++++++++++++++++++-
 xen/arch/x86/x86_64/entry-fred.S | 13 ++++++-
 xen/arch/x86/x86_64/entry.S      |  4 ++-
 3 files changed, 92 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index e40b51d693..77af9b90f1 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -2267,9 +2267,85 @@ void asmlinkage check_ist_exit(const struct cpu_user_regs *regs, bool ist_exit)
 
 void asmlinkage entry_from_pv(struct cpu_user_regs *regs)
 {
+    struct fred_info *fi = cpu_regs_fred_info(regs);
+    uint8_t type = regs->fred_ss.type;
+    uint8_t vec = regs->fred_ss.vector;
+
     /* Copy fred_ss.vector into entry_vector as IDT delivery would have done. */
-    regs->entry_vector = regs->fred_ss.vector;
+    regs->entry_vector = vec;
+
+    if ( !IS_ENABLED(CONFIG_PV) )
+        goto fatal;
+
+    /*
+     * First, handle the asynchronous or fatal events.  These are either
+     * unrelated to the interrupted context, or may not have valid context
+     * recorded, and all have special rules on how/whether to re-enable IRQs.
+     */
+    if ( regs->fred_ss.nested )
+        goto fatal;
+
+    switch ( type )
+    {
+    case X86_ET_EXT_INTR:
+        return do_IRQ(regs);
+
+    case X86_ET_NMI:
+        return do_nmi(regs);
+
+    case X86_ET_HW_EXC:
+        switch ( vec )
+        {
+        case X86_EXC_DF: return do_double_fault(regs);
+        case X86_EXC_MC: return do_machine_check(regs);
+        }
+        break;
+    }
 
+    /*
+     * With the asynchronous events handled, what remains are the synchronous
+     * ones.  PV guest context always had interrupts enabled.
+     */
+    local_irq_enable();
+
+    switch ( type )
+    {
+    case X86_ET_HW_EXC:
+    case X86_ET_PRIV_SW_EXC:
+    case X86_ET_SW_EXC:
+        switch ( vec )
+        {
+        case X86_EXC_PF:  handle_PF(regs, fi->edata); break;
+        case X86_EXC_GP:  do_general_protection(regs); break;
+        case X86_EXC_UD:  do_invalid_op(regs); break;
+        case X86_EXC_NM:  do_device_not_available(regs); break;
+        case X86_EXC_BP:  do_int3(regs); break;
+        case X86_EXC_DB:  handle_DB(regs, fi->edata); break;
+        case X86_EXC_CP:  do_entry_CP(regs); break;
+
+        case X86_EXC_DE:
+        case X86_EXC_OF:
+        case X86_EXC_BR:
+        case X86_EXC_NP:
+        case X86_EXC_SS:
+        case X86_EXC_MF:
+        case X86_EXC_AC:
+        case X86_EXC_XM:
+            do_trap(regs);
+            break;
+
+        default:
+            goto fatal;
+        }
+        break;
+
+    default:
+        goto fatal;
+    }
+
+    return;
+
+ fatal:
     fatal_trap(regs, false);
 }
 
diff --git a/xen/arch/x86/x86_64/entry-fred.S b/xen/arch/x86/x86_64/entry-fred.S
index 3c3320df22..a1ff9a4a97 100644
--- a/xen/arch/x86/x86_64/entry-fred.S
+++ b/xen/arch/x86/x86_64/entry-fred.S
@@ -15,9 +15,20 @@ FUNC(entry_FRED_R3, 4096)
         mov     %rsp, %rdi
         call    entry_from_pv
 
+#ifdef CONFIG_PV
+        GET_STACK_END(14)
+        movq    STACK_CPUINFO_FIELD(current_vcpu)(%r14), %rbx
+
+        jmp     test_all_events
+#else
+        BUG     /* Not Reached */
+#endif
+END(entry_FRED_R3)
+
+FUNC(eretu_exit_to_guest)
         POP_GPRS
         eretu
-END(entry_FRED_R3)
+END(eretu_exit_to_guest)
 
         /* The Ring0 entrypoint is at Ring3 + 0x100. */
         .org entry_FRED_R3 + 0x100, 0xcc
diff --git a/xen/arch/x86/x86_64/entry.S b/xen/arch/x86/x86_64/entry.S
index 8b83082413..17ca6a4939 100644
--- a/xen/arch/x86/x86_64/entry.S
+++ b/xen/arch/x86/x86_64/entry.S
@@ -63,7 +63,7 @@ UNLIKELY_END(syscall_no_callback)
         /* Conditionally clear DF */
         and   %esi, UREGS_eflags(%rsp)
 /* %rbx: struct vcpu */
-test_all_events:
+LABEL(test_all_events, 0)
         ASSERT_NOT_IN_ATOMIC
         cli                             # tests must not race interrupts
 /*test_softirqs:*/
@@ -152,6 +152,8 @@ END(switch_to_kernel)
 FUNC_LOCAL(restore_all_guest)
         ASSERT_INTERRUPTS_DISABLED
 
+        ALTERNATIVE "", "jmp eretu_exit_to_guest", X86_FEATURE_XEN_FRED
+
         /* Stash guest SPEC_CTRL value while we can read struct vcpu. */
         mov VCPU_arch_msrs(%rbx), %rdx
         mov VCPUMSR_spec_ctrl_raw(%rdx), %r15d
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 10 12:44:23 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Mar 2026 12:44:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1250093.1547529 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzwRj-0000kc-Hm; Tue, 10 Mar 2026 12:44:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1250093.1547529; Tue, 10 Mar 2026 12:44:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzwRj-0000kU-Ev; Tue, 10 Mar 2026 12:44:23 +0000
Received: by outflank-mailman (input) for mailman id 1250093;
 Tue, 10 Mar 2026 12:44:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vzwRi-0000kJ-8V
 for xen-changelog@lists.xenproject.org; Tue, 10 Mar 2026 12:44:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzwRi-001car-1R
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 12:44:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzwRi-001ml1-0Z
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 12:44:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=FBJZuZ412AfJg4JbwjDRF8SgUKbP/fmqDSLMquisIs8=; b=j+yRTn5TFeRT/cpLI5VYzJy03L
	NYLc+UFxGo4Rw6U9V628ijM+13Qp+TDiiGtCA2mL8KeDKyBY3TXsHZc3eXDYJ+UqbPkEIHL35dIvi
	69YVhhdXeodzUCItLWtQ9ELni/EsFN1r4wm+qOvwy5BdbKN428Vnt9OmpcQDkPvrygDo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/pv: ERETU error handling
Message-Id: <E1vzwRi-001ml1-0Z@xenbits.xenproject.org>
Date: Tue, 10 Mar 2026 12:44:22 +0000

commit 99edc6c2a0f5886474e017dd0bdd5829e0605455
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Aug 13 15:02:26 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 10 11:58:07 2026 +0000

    x86/pv: ERETU error handling
    
    ERETU can fault for guest reasons, and like IRET needs special handling to
    forward the error into the guest.
    
    As this is largely written in C, take the opportunity to better classify the
    sources of error, and in particular, not forward errors that are actually
    Xen's fault into the guest, opting for a domain crash instead.
    
    Because ERETU does not enable NMIs if it faults, a corner case exists if an
    NMI was taken while in guest context, and the ERETU back out faults.  Recovery
    must involve an ERETS with the interrupted context's NMI flag.
    
    See the comments for full details.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/traps.c             | 115 +++++++++++++++++++++++++++++++++++++++
 xen/arch/x86/x86_64/entry-fred.S |  13 +++++
 2 files changed, 128 insertions(+)

diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index 77af9b90f1..e85c9198cd 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -2349,6 +2349,113 @@ void asmlinkage entry_from_pv(struct cpu_user_regs *regs)
     fatal_trap(regs, false);
 }
 
+void nocall eretu_error_dom_crash(void);
+
+/*
+ * Classify an event at the ERETU instruction, and handle if possible.
+ * Returns @true if handled, @false if the event should continue down the
+ * normal handlers.
+ */
+static bool handle_eretu_event(struct cpu_user_regs *regs)
+{
+    unsigned long recover;
+
+    /*
+     * WARNING: The GPRs in gregs overlaps with regs.  Only gregs->error_code
+     *          and later are legitimate to access.
+     */
+    struct cpu_user_regs *gregs =
+        _p(regs->rsp - offsetof(struct cpu_user_regs, error_code));
+
+    /*
+     * The asynchronous or fatal events (INTR, NMI, #MC, #DF) have been dealt
+     * with, meaning we only have synchronous ones to consider.  Anything
+     * which isn't a hardware exception (e.g. #BP) wants handling normally.
+     */
+    if ( regs->fred_ss.type != X86_ET_HW_EXC )
+        return false;
+
+    /*
+     * Guests are permitted to write non-present GDT/LDT entries.  Therefore
+     * #NP[sel] (%cs) and #SS[sel] (%ss) must be handled as guest errors.  The
+     * only other source of #SS is for a bad %ss-relative memory access in
+     * Xen, and if the stack is that bad, we'll have escalated to #DF.
+     *
+     * #PF can happen from ERETU accessing the GDT/LDT.  Xen may translate
+     * these into #GP for the guest, so must be handled as guest errors.  In
+     * theory we can get #PF for a bad instruction fetch or bad stack access,
+     * but either of these will be fatal and not end up here.
+     */
+    switch ( regs->fred_ss.vector )
+    {
+    case X86_EXC_GP:
+        /*
+         * #GP[0] can occur because of a NULL %cs or %ss (which are a guest
+         * error), but some #GP[0]'s are errors in Xen (ERETU at SL != 0), or
+         * errors of Xen's handling of guest state (bad metadata).
+         *
+         * These magic numbers came from the FRED Spec; they check that ERETU
+         * is trying to return to Ring 3, and that reserved or inapplicable
+         * bits are 0.
+         */
+        if ( regs->error_code == 0 && (gregs->cs & ~3) && (gregs->ss & ~3) &&
+             (regs->fred_cs.sl != 0 ||
+              (gregs->csx    & 0xffffffffffff0003UL) != 3 ||
+              (gregs->rflags & 0xffffffffffc2b02aUL) != 2 ||
+              (gregs->ssx    &         0xfff80003UL) != 3) )
+        {
+            recover = (unsigned long)eretu_error_dom_crash;
+
+            if ( regs->fred_cs.sl )
+                gprintk(XENLOG_ERR, "ERETU at SL %u\n", regs->fred_cs.sl);
+            else
+                gprintk(XENLOG_ERR, "Bad return state: csx %#lx, rflags %#lx, ssx %#x\n",
+                        gregs->csx, gregs->rflags, (unsigned int)gregs->ssx);
+            break;
+        }
+        fallthrough;
+    case X86_EXC_NP:
+    case X86_EXC_SS:
+    case X86_EXC_PF:
+        recover = (unsigned long)entry_FRED_R3;
+        break;
+
+        /*
+         * Handle everything else normally.  e.g. #DB would be debugging
+         * activities in Xen.  In theory we can get #UD if CR4.FRED gets
+         * cleared, but in practice if that were the case we wouldn't be here
+         * handling the result.
+         */
+    default:
+        return false;
+    }
+
+    this_cpu(last_extable_addr) = regs->rip;
+
+    /*
+     * If an NMI was taken in guest context and the ERETU faulted, NMIs will
+     * still be blocked.  Therefore we copy the interrupted frame's NMI status
+     * into our own, and must ERETS as part of recovery.
+     */
+    regs->fred_ss.nmi = gregs->fred_ss.nmi;
+
+    /*
+     * Next, copy the exception information from the current frame back onto
+     * the interrupted frame, preserving the interrupted frame's %cs and %ss.
+     */
+    *cpu_regs_fred_info(regs) = *cpu_regs_fred_info(gregs);
+    gregs->ssx = (regs->ssx & ~0xffff) | gregs->ss;
+    gregs->csx = (regs->csx & ~0xffff) | gregs->cs;
+    gregs->error_code   = regs->error_code;
+    gregs->entry_vector = regs->entry_vector;
+
+    fixup_exception_return(regs, recover, 0);
+
+    return true;
+}
+
+void nocall eretu(void);
+
 void asmlinkage entry_from_xen(struct cpu_user_regs *regs)
 {
     struct fred_info *fi = cpu_regs_fred_info(regs);
@@ -2390,6 +2497,14 @@ void asmlinkage entry_from_xen(struct cpu_user_regs *regs)
     if ( regs->eflags & X86_EFLAGS_IF )
         local_irq_enable();
 
+    /*
+     * An event taken at the ERETU instruction may be because of bad guest
+     * state.  If so, it will need special handling.
+     */
+    if ( unlikely(regs->rip == (unsigned long)eretu) &&
+         handle_eretu_event(regs) )
+        return;
+
     switch ( type )
     {
     case X86_ET_HW_EXC:
diff --git a/xen/arch/x86/x86_64/entry-fred.S b/xen/arch/x86/x86_64/entry-fred.S
index a1ff9a4a97..2fa57beb93 100644
--- a/xen/arch/x86/x86_64/entry-fred.S
+++ b/xen/arch/x86/x86_64/entry-fred.S
@@ -27,9 +27,22 @@ END(entry_FRED_R3)
 
 FUNC(eretu_exit_to_guest)
         POP_GPRS
+
+        /*
+         * Exceptions here are handled by redirecting either to
+         * entry_FRED_R3() (for an error to be passed to the guest), or to
+         * eretu_error_dom_crash() (for a Xen error handling guest state).
+         */
+LABEL(eretu, 0)
         eretu
 END(eretu_exit_to_guest)
 
+FUNC(eretu_error_dom_crash)
+        PUSH_AND_CLEAR_GPRS
+        sti
+        call    asm_domain_crash_synchronous  /* Does not return */
+END(eretu_error_dom_crash)
+
         /* The Ring0 entrypoint is at Ring3 + 0x100. */
         .org entry_FRED_R3 + 0x100, 0xcc
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 10 12:44:33 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Mar 2026 12:44:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1250094.1547533 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzwRt-0000oL-J1; Tue, 10 Mar 2026 12:44:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1250094.1547533; Tue, 10 Mar 2026 12:44:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzwRt-0000oD-GG; Tue, 10 Mar 2026 12:44:33 +0000
Received: by outflank-mailman (input) for mailman id 1250094;
 Tue, 10 Mar 2026 12:44:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vzwRs-0000o1-Bh
 for xen-changelog@lists.xenproject.org; Tue, 10 Mar 2026 12:44:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzwRs-001cav-1k
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 12:44:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzwRs-001mmF-0w
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 12:44:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=nYjQapH8TSxDP9cBCPH5EM3ZCasBh/gsmPa2tHGNy/A=; b=ylO0BOL5WhUK2BbZALHiG7Zszk
	bAve89OOG4EbzkBjVEzRmusf5m5c5W1WFJKR4F6MbiAUDd1mtgUdpX4WLy11fAcSf5paDnpLlJS8Y
	cnS+7qu2Isblj7f4HfeoUSFhfG0s5u1gNPU4lnbEWMNOnYPM/QKXb1A7kwEG09UJx1Xk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/pv: System call handling in FRED mode
Message-Id: <E1vzwRs-001mmF-0w@xenbits.xenproject.org>
Date: Tue, 10 Mar 2026 12:44:32 +0000

commit 76193ef47d9165a2c85b1f0c9e40c6018c5ef943
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Aug 11 15:55:24 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 10 11:58:23 2026 +0000

    x86/pv: System call handling in FRED mode
    
    Under FRED, entry_from_pv() handles everything, even system call instructions.
    This means more of our logic is written in C now, rather than assembly.
    
    In order to facilitate this, introduce pv_inject_callback(), which reuses
    struct trap_bounce infrastructure to inject the syscall/sysenter callbacks.
    This in turns requires some !PV compatibility for pv_inject_callback() and
    pv_hypercall() which can both be ASSERT_UNREACHABLE().
    
    For each of INT $N, SYSCALL and SYSENTER, FRED gives us interrupted context
    which was previously lost.  As the guest can't see FRED, Xen has to lose state
    in the same way to maintain the prior behaviour.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/include/asm/domain.h    |   2 +
 xen/arch/x86/include/asm/hypercall.h |   2 -
 xen/arch/x86/pv/traps.c              |  39 +++++++++++
 xen/arch/x86/traps.c                 | 126 +++++++++++++++++++++++++++++++++++
 4 files changed, 167 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/include/asm/domain.h b/xen/arch/x86/include/asm/domain.h
index 94b0cf7f1d..ad7f6adb2c 100644
--- a/xen/arch/x86/include/asm/domain.h
+++ b/xen/arch/x86/include/asm/domain.h
@@ -725,6 +725,8 @@ void arch_vcpu_regs_init(struct vcpu *v);
 struct vcpu_hvm_context;
 int arch_set_info_hvm_guest(struct vcpu *v, const struct vcpu_hvm_context *ctx);
 
+void pv_inject_callback(unsigned int type);
+
 #ifdef CONFIG_PV
 void pv_inject_event(const struct x86_event *event);
 #else
diff --git a/xen/arch/x86/include/asm/hypercall.h b/xen/arch/x86/include/asm/hypercall.h
index bf2f0e169a..d042a61d17 100644
--- a/xen/arch/x86/include/asm/hypercall.h
+++ b/xen/arch/x86/include/asm/hypercall.h
@@ -18,9 +18,7 @@
 
 #define __HYPERVISOR_paging_domctl_cont __HYPERVISOR_arch_1
 
-#ifdef CONFIG_PV
 void pv_hypercall(struct cpu_user_regs *regs);
-#endif
 
 void pv_ring1_init_hypercall_page(void *p);
 void pv_ring3_init_hypercall_page(void *p);
diff --git a/xen/arch/x86/pv/traps.c b/xen/arch/x86/pv/traps.c
index b0395b9914..c863ab9d37 100644
--- a/xen/arch/x86/pv/traps.c
+++ b/xen/arch/x86/pv/traps.c
@@ -20,6 +20,8 @@
 #include <asm/shared.h>
 #include <asm/traps.h>
 
+#include <public/callback.h>
+
 void pv_inject_event(const struct x86_event *event)
 {
     struct vcpu *curr = current;
@@ -96,6 +98,43 @@ void pv_inject_event(const struct x86_event *event)
     }
 }
 
+void pv_inject_callback(unsigned int type)
+{
+    struct vcpu *curr = current;
+    struct trap_bounce *tb = &curr->arch.pv.trap_bounce;
+    unsigned long rip;
+    bool irq;
+
+    ASSERT(is_pv_64bit_vcpu(curr));
+
+    switch ( type )
+    {
+    case CALLBACKTYPE_syscall:
+        rip = curr->arch.pv.syscall_callback_eip;
+        irq = curr->arch.pv.vgc_flags & VGCF_syscall_disables_events;
+        break;
+
+    case CALLBACKTYPE_syscall32:
+        rip = curr->arch.pv.syscall32_callback_eip;
+        irq = curr->arch.pv.syscall32_disables_events;
+        break;
+
+    case CALLBACKTYPE_sysenter:
+        rip = curr->arch.pv.sysenter_callback_eip;
+        irq = curr->arch.pv.sysenter_disables_events;
+        break;
+
+    default:
+        ASSERT_UNREACHABLE();
+        rip = 0;
+        irq = false;
+        break;
+    }
+
+    tb->flags = TBF_EXCEPTION | (irq ? TBF_INTERRUPT : 0);
+    tb->eip = rip;
+}
+
 /*
  * Called from asm to set up the MCE trapbounce info.
  * Returns false no callback is set up, else true.
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index e85c9198cd..f5523fec0a 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -18,6 +18,7 @@
 #include <xen/delay.h>
 #include <xen/domain_page.h>
 #include <xen/guest_access.h>
+#include <xen/hypercall.h>
 #include <xen/init.h>
 #include <xen/mm.h>
 #include <xen/paging.h>
@@ -51,6 +52,8 @@
 #include <asm/traps.h>
 #include <asm/uaccess.h>
 
+#include <public/callback.h>
+
 /*
  * opt_nmi: one of 'ignore', 'dom0', or 'fatal'.
  *  fatal:  Xen prints diagnostic message and then hangs.
@@ -2268,6 +2271,7 @@ void asmlinkage check_ist_exit(const struct cpu_user_regs *regs, bool ist_exit)
 void asmlinkage entry_from_pv(struct cpu_user_regs *regs)
 {
     struct fred_info *fi = cpu_regs_fred_info(regs);
+    struct vcpu *curr = current;
     uint8_t type = regs->fred_ss.type;
     uint8_t vec = regs->fred_ss.vector;
 
@@ -2310,6 +2314,38 @@ void asmlinkage entry_from_pv(struct cpu_user_regs *regs)
 
     switch ( type )
     {
+    case X86_ET_SW_INT:
+        /*
+         * For better or worse, Xen writes IDT vectors 3 and 4 with DPL3 (so
+         * INT3/INTO work), making INT $3/4 indistinguishable, and the guest
+         * choice of DPL for these vectors is ignored.
+         *
+         * Have them fall through into X86_ET_HW_EXC, as #BP in particular
+         * needs handling by do_int3() in case an external debugger is
+         * attached.
+         *
+         * As the event type is provided, INT $N instructions don't need #GP
+         * tricks to spot, and INT $0x80 doesn't need a fastpath.  As the
+         * guest is necessary PV64, INT $0x82 has no special meaning either.
+         *
+         * When converting to a fault, hardware finally gives us enough
+         * information to account for prefixes, so provide the more correct
+         * behaviour rather than assuming the instruction was two bytes long.
+         */
+        if ( vec != X86_EXC_BP && vec != X86_EXC_OF )
+        {
+            const struct trap_info *ti = &curr->arch.pv.trap_ctxt[vec];
+
+            if ( permit_softint(TI_GET_DPL(ti), curr, regs) )
+                pv_inject_sw_interrupt(vec);
+            else
+            {
+                regs->rip -= regs->fred_ss.insnlen;
+                pv_inject_hw_exception(X86_EXC_GP, (vec << 3) | X86_XEC_IDT);
+            }
+            break;
+        }
+        fallthrough;
     case X86_ET_HW_EXC:
     case X86_ET_PRIV_SW_EXC:
     case X86_ET_SW_EXC:
@@ -2339,6 +2375,96 @@ void asmlinkage entry_from_pv(struct cpu_user_regs *regs)
         }
         break;
 
+    case X86_ET_OTHER:
+        switch ( regs->fred_ss.vector )
+        {
+        case 1: /* SYSCALL */
+        {
+            /*
+             * FRED delivery preserves the interrupted %cs/%ss, but previously
+             * SYSCALL lost the interrupted selectors, and SYSRET forced the
+             * use of the ones in MSR_STAR.
+             *
+             * The guest isn't aware of FRED, so recreate the legacy
+             * behaviour.
+             *
+             * The non-FRED SYSCALL path sets TRAP_syscall in entry_vector to
+             * signal that SYSRET can be used, but this isn't relevant in FRED
+             * mode.
+             *
+             * When setting the selectors, clear all upper metadata again for
+             * backwards compatibility.  In particular fred_ss.swint becomes
+             * pend_DB on ERETx, and nothing else in the pv_hypercall() would
+             * clean up.
+             *
+             * When converting to a fault, hardware finally gives us enough
+             * information to account for prefixes, so provide the more
+             * correct behaviour rather than assuming the instruction was two
+             * bytes long.
+             */
+            bool l = regs->fred_ss.l;
+            unsigned int len = regs->fred_ss.insnlen;
+
+            regs->ssx = l ? FLAT_KERNEL_SS   : FLAT_USER_SS32;
+            regs->csx = l ? FLAT_KERNEL_CS64 : FLAT_USER_CS32;
+
+            if ( guest_kernel_mode(curr, regs) )
+                pv_hypercall(regs);
+            else if ( (l ? curr->arch.pv.syscall_callback_eip
+                         : curr->arch.pv.syscall32_callback_eip) == 0 )
+            {
+                regs->rip -= len;
+                pv_inject_hw_exception(X86_EXC_UD, X86_EVENT_NO_EC);
+            }
+            else
+            {
+                /*
+                 * The PV ABI, given no virtual SYSCALL_MASK, hardcodes that
+                 * DF is cleared.  Other flags are handled in the same way as
+                 * interrupts and exceptions in create_bounce_frame().
+                 */
+                regs->eflags &= ~X86_EFLAGS_DF;
+                pv_inject_callback(l ? CALLBACKTYPE_syscall
+                                     : CALLBACKTYPE_syscall32);
+            }
+            break;
+        }
+
+        case 2: /* SYSENTER */
+        {
+            /*
+             * FRED delivery preserves the interrupted state, but previously
+             * SYSENTER discarded almost everything.
+             *
+             * The guest isn't aware of FRED, so recreate the legacy
+             * behaviour.
+             *
+             * When setting the selectors, clear all upper metadata.  In
+             * particular fred_ss.swint becomes pend_DB on ERETx.
+             *
+             * When converting to a fault, hardware finally gives us enough
+             * information to account for prefixes, so provide the more
+             * correct behaviour rather than assuming the instruction was two
+             * bytes long.
+             */
+            regs->ssx = FLAT_USER_SS;
+            regs->rsp = 0;
+            regs->eflags &= ~(X86_EFLAGS_VM | X86_EFLAGS_IF);
+            regs->csx = 3;
+            regs->rip = 0;
+
+            if ( !curr->arch.pv.sysenter_callback_eip )
+                pv_inject_hw_exception(X86_EXC_GP, 0);
+            else
+                pv_inject_callback(CALLBACKTYPE_sysenter);
+            break;
+        }
+
+        default:
+            goto fatal;
+        }
+        break;
+
     default:
         goto fatal;
     }
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 10 12:44:43 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Mar 2026 12:44:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1250095.1547537 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzwS3-0000qy-Ls; Tue, 10 Mar 2026 12:44:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1250095.1547537; Tue, 10 Mar 2026 12:44:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzwS3-0000qq-JD; Tue, 10 Mar 2026 12:44:43 +0000
Received: by outflank-mailman (input) for mailman id 1250095;
 Tue, 10 Mar 2026 12:44:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vzwS2-0000qj-FK
 for xen-changelog@lists.xenproject.org; Tue, 10 Mar 2026 12:44:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzwS2-001cb0-27
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 12:44:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzwS2-001moH-1G
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 12:44:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=KikQ+fhRYR6Vt5ezFMspT8Z1TMow3SrtTfRHJRX2tmY=; b=luL2JzcktESGC6Z4E4fsjHfgBt
	4F4bETbnbxabNLv9rXSsYHkapa8beytHjE02zbhkDbP9EHqW/uEv2sDwnvGurXkrtqzr7TsQNqtYr
	LZitYqVLOPeCp+6HlvPGGjfdfMaFcauJZE4ptrAx+P5B9JR34VBNEBwPgG1yLTAMAGPQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/traps: Use fatal_trap() for #UD and #GP
Message-Id: <E1vzwS2-001moH-1G@xenbits.xenproject.org>
Date: Tue, 10 Mar 2026 12:44:42 +0000

commit 705784e51212cd77031e95ee4ec8799c25e69fb5
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Feb 10 14:50:56 2026 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 10 11:58:33 2026 +0000

    x86/traps: Use fatal_trap() for #UD and #GP
    
    This renders the diagnostics in a more uniform way.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/traps.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index f5523fec0a..b6b1197697 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -1375,8 +1375,7 @@ void asmlinkage do_invalid_op(struct cpu_user_regs *regs)
     if ( likely(extable_fixup(regs, true)) )
         return;
 
-    show_execution_state(regs);
-    panic("FATAL TRAP: vector = %d (invalid opcode)\n", X86_EXC_UD);
+    fatal_trap(regs, false);
 }
 
 void asmlinkage do_int3(struct cpu_user_regs *regs)
@@ -1475,8 +1474,7 @@ void do_general_protection(struct cpu_user_regs *regs)
         return;
 
  hardware_gp:
-    show_execution_state(regs);
-    panic("GENERAL PROTECTION FAULT\n[error_code=%04x]\n", regs->error_code);
+    fatal_trap(regs, false);
 }
 
 #ifdef CONFIG_PV
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 10 13:55:10 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Mar 2026 13:55:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1250123.1547549 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzxY7-0000pg-Lj; Tue, 10 Mar 2026 13:55:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1250123.1547549; Tue, 10 Mar 2026 13:55:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzxY7-0000pY-JE; Tue, 10 Mar 2026 13:55:03 +0000
Received: by outflank-mailman (input) for mailman id 1250123;
 Tue, 10 Mar 2026 13:55:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vzxY6-0000pS-KG
 for xen-changelog@lists.xenproject.org; Tue, 10 Mar 2026 13:55:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzxY6-001dqB-2W
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 13:55:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzxY6-001rFI-1V
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 13:55:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=RWE27cVrmyPfkeTBUDgp8kREhe4JY68EDNn4TvUOrTE=; b=uLm6ot8wnKouFwa+WNye+f+Qav
	dWS9QfgFu4KEOwJ5gy7tg3I1VaLx+Kdeey9LBogw/TGrjLw9vCxhcFj56J8xrbw4qcL0cai2hbXe8
	QQetWo+6NPbbqwrDtEVQ3dZr2H3gbReTEg1PpsxO36XZwV6IwS5n21lw/FHMqugMr6ag=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.21] x86/MCE: restore CPU vendor reporting to the outside world
Message-Id: <E1vzxY6-001rFI-1V@xenbits.xenproject.org>
Date: Tue, 10 Mar 2026 13:55:02 +0000

commit 93614ffa48f2577f5a9bb3043884ebc7432d0b8e
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Mar 10 14:36:11 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 10 14:36:11 2026 +0100

    x86/MCE: restore CPU vendor reporting to the outside world
    
    The records reported used to contain Linux enumerators. We first broke
    that connection when purging unused ones, and then again when switching to
    the bit mask forms.
    
    Fixes: 408413051144 ("x86/cpu: Drop unused X86_VENDOR_* values")
    Fixes: 0cd074144cbb ("x86/cpu: Renumber X86_VENDOR_* to form a bitmap")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
    master commit: a94c5fd8290a55461c599b8baad309df0d929f1f
    master date: 2026-02-23 08:39:58 +0100
---
 xen/arch/x86/cpu/mcheck/mce.c | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/cpu/mcheck/mce.c b/xen/arch/x86/cpu/mcheck/mce.c
index 9277781bff..9a91807cfb 100644
--- a/xen/arch/x86/cpu/mcheck/mce.c
+++ b/xen/arch/x86/cpu/mcheck/mce.c
@@ -858,6 +858,22 @@ void *x86_mcinfo_reserve(struct mc_info *mi,
     return mic_index;
 }
 
+/* Linux values need using when reporting CPU vendors to the outside. */
+static unsigned int xen2linux_vendor(unsigned int vendor)
+{
+    switch ( vendor )
+    {
+    case X86_VENDOR_INTEL:    return 0;
+    case X86_VENDOR_AMD:      return 2;
+    case X86_VENDOR_CENTAUR:  return 5;
+    case X86_VENDOR_HYGON:    return 9;
+    case X86_VENDOR_SHANGHAI: return 10; /* X86_VENDOR_ZHAOXIN */
+    default: break;
+    }
+
+    return 0xff; /* X86_VENDOR_UNKNOWN */
+}
+
 static void x86_mcinfo_apei_save(
     struct mcinfo_global *mc_global, struct mcinfo_bank *mc_bank)
 {
@@ -866,7 +882,7 @@ static void x86_mcinfo_apei_save(
     memset(&m, 0, sizeof(struct mce));
 
     m.cpu = mc_global->mc_coreid;
-    m.cpuvendor = boot_cpu_data.x86_vendor;
+    m.cpuvendor = xen2linux_vendor(boot_cpu_data.x86_vendor);
     m.cpuid = cpuid_eax(1);
     m.socketid = mc_global->mc_socketid;
     m.apicid = mc_global->mc_apicid;
@@ -968,7 +984,7 @@ static void cf_check __maybe_unused do_mc_get_cpu_info(void *v)
                         &xcp->mc_ncores_active, &xcp->mc_nthreads);
     xcp->mc_cpuid_level = c->cpuid_level;
     xcp->mc_family = c->x86;
-    xcp->mc_vendor = c->x86_vendor;
+    xcp->mc_vendor = xen2linux_vendor(c->x86_vendor);
     xcp->mc_model = c->x86_model;
     xcp->mc_step = c->x86_mask;
     xcp->mc_cache_size = c->x86_cache_size;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.21


From xen-changelog-bounces@lists.xenproject.org Tue Mar 10 13:55:14 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Mar 2026 13:55:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1250124.1547554 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzxYI-0000rC-NF; Tue, 10 Mar 2026 13:55:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1250124.1547554; Tue, 10 Mar 2026 13:55:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzxYI-0000r4-Kc; Tue, 10 Mar 2026 13:55:14 +0000
Received: by outflank-mailman (input) for mailman id 1250124;
 Tue, 10 Mar 2026 13:55:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vzxYG-0000qr-MU
 for xen-changelog@lists.xenproject.org; Tue, 10 Mar 2026 13:55:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzxYG-001dqJ-2p
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 13:55:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzxYG-001rGE-21
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 13:55:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=7LE42ebxdyXe00fg1ryER4aO9Qv7Fz8ehhDcVzK3HFE=; b=z+5LzK7qWRb1QxFwBFoIQe+sVa
	kNYayKNlGZMKo7qTh0bFtZpElk04wsilQT9IzdklfMhE70v/fC6z5d8pxkAg4VNTAlDPIdN1nKSYO
	YpZIWNKZWYlBDBdAu6rlBttddtyTXfiZciinpCaHTeTTIilFrUfUOt3Q5lXWOwWg337M=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.21] x86/pv: Don't assume that INT $imm8 instructions are two bytes long
Message-Id: <E1vzxYG-001rGE-21@xenbits.xenproject.org>
Date: Tue, 10 Mar 2026 13:55:12 +0000

commit 805e2b8ada7c4e44a08e9c36117fc1b2180df675
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Mar 10 14:36:41 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 10 14:36:41 2026 +0100

    x86/pv: Don't assume that INT $imm8 instructions are two bytes long
    
    For INT $N instructions (besides $0x80 for which there is a dedicated fast
    path), handling is mostly fault-based because of DPL0 gates in the IDT.  This
    means that when the guest kernel allows the instruction too, Xen must
    increment %rip to the end of the instruction before passing a trap to the
    guest kernel.
    
    When an INT $N instruction has a prefix, it's longer than two bytes, and Xen
    will deliver the "trap" with %rip pointing into the middle of the instruction.
    
    Introduce a new pv_emulate_sw_interrupt() which uses x86_insn_length() to
    determine the instruction length, rather than assuming two.
    
    This is a change in behaviour for PV guests, but the prior behaviour cannot
    reasonably be said to be intentional.
    
    This change does not affect the INT $0x80 fastpath.  Prefixed INT $N
    instructions occur almost exclusively in test code or exploits, and INT $0x80
    appears to be the only user-usable interrupt gate in contemporary PV guests.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: a934a600c45486b7acfe8abc3658e284e64e5dd5
    master date: 2026-03-03 15:15:53 +0000
---
 xen/arch/x86/include/asm/pv/traps.h |  2 ++
 xen/arch/x86/pv/emul-priv-op.c      | 49 +++++++++++++++++++++++++++++++++++++
 xen/arch/x86/traps.c                |  3 +--
 3 files changed, 52 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/include/asm/pv/traps.h b/xen/arch/x86/include/asm/pv/traps.h
index 8c31d5a793..dbfb22e6d2 100644
--- a/xen/arch/x86/include/asm/pv/traps.h
+++ b/xen/arch/x86/include/asm/pv/traps.h
@@ -17,6 +17,7 @@
 int pv_raise_nmi(struct vcpu *v);
 
 int pv_emulate_privileged_op(struct cpu_user_regs *regs);
+void pv_emulate_sw_interrupt(struct cpu_user_regs *regs);
 void pv_emulate_gate_op(struct cpu_user_regs *regs);
 bool pv_emulate_invalid_op(struct cpu_user_regs *regs);
 
@@ -33,6 +34,7 @@ static inline bool pv_trap_callback_registered(const struct vcpu *v,
 static inline int pv_raise_nmi(struct vcpu *v) { return -EOPNOTSUPP; }
 
 static inline int pv_emulate_privileged_op(struct cpu_user_regs *regs) { return 0; }
+static inline void pv_emulate_sw_interrupt(struct cpu_user_regs *regs) {}
 static inline void pv_emulate_gate_op(struct cpu_user_regs *regs) {}
 static inline bool pv_emulate_invalid_op(struct cpu_user_regs *regs) { return true; }
 
diff --git a/xen/arch/x86/pv/emul-priv-op.c b/xen/arch/x86/pv/emul-priv-op.c
index 225d4cff03..0ba446d812 100644
--- a/xen/arch/x86/pv/emul-priv-op.c
+++ b/xen/arch/x86/pv/emul-priv-op.c
@@ -8,6 +8,7 @@
  */
 
 #include <xen/domain_page.h>
+#include <xen/err.h>
 #include <xen/event.h>
 #include <xen/guest_access.h>
 #include <xen/hypercall.h>
@@ -1384,6 +1385,54 @@ int pv_emulate_privileged_op(struct cpu_user_regs *regs)
     return 0;
 }
 
+/*
+ * Hardware already decoded the INT $N instruction and determined that there
+ * was a permission issue (i.e. the DPL violation intended to trigger #GP).
+ * Xen has already determined that the guest kernel has permitted this
+ * software interrupt.
+ *
+ * All that is needed is the instruction length, to turn the fault into a
+ * trap.  All errors are turned back into the original #GP, as that's the
+ * action that really happened.
+ */
+void pv_emulate_sw_interrupt(struct cpu_user_regs *regs)
+{
+    struct vcpu *curr = current;
+    struct domain *currd = curr->domain;
+    struct priv_op_ctxt ctxt = {
+        .ctxt.regs = regs,
+        .ctxt.lma = !is_pv_32bit_domain(currd),
+    };
+    struct x86_emulate_state *state;
+    uint8_t vector = regs->error_code >> 3;
+    unsigned int len, ar;
+
+    if ( !pv_emul_read_descriptor(regs->cs, curr, &ctxt.cs.base,
+                                  &ctxt.cs.limit, &ar, 1) ||
+         !(ar & _SEGMENT_S) ||
+         !(ar & _SEGMENT_P) ||
+         !(ar & _SEGMENT_CODE) )
+        goto error;
+
+    state = x86_decode_insn(&ctxt.ctxt, insn_fetch);
+    if ( IS_ERR_OR_NULL(state) )
+        goto error;
+
+    len = x86_insn_length(state, &ctxt.ctxt);
+    x86_emulate_free_state(state);
+
+    /* Note: Checked slightly late to simplify 'state' handling. */
+    if ( ctxt.ctxt.opcode != 0xcd /* INT $imm8 */ )
+        goto error;
+
+    regs->rip += len;
+    pv_inject_sw_interrupt(vector);
+    return;
+
+ error:
+    pv_inject_hw_exception(X86_EXC_GP, regs->error_code);
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index 0c5393cb21..6f6ce387a1 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -1365,8 +1365,7 @@ void do_general_protection(struct cpu_user_regs *regs)
 
         if ( permit_softint(TI_GET_DPL(ti), v, regs) )
         {
-            regs->rip += 2;
-            pv_inject_sw_interrupt(vector);
+            pv_emulate_sw_interrupt(regs);
             return;
         }
     }
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.21


From xen-changelog-bounces@lists.xenproject.org Tue Mar 10 13:55:24 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Mar 2026 13:55:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1250126.1547558 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzxYS-0000u0-Od; Tue, 10 Mar 2026 13:55:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1250126.1547558; Tue, 10 Mar 2026 13:55:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzxYS-0000ts-Ly; Tue, 10 Mar 2026 13:55:24 +0000
Received: by outflank-mailman (input) for mailman id 1250126;
 Tue, 10 Mar 2026 13:55:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vzxYQ-0000tf-Pw
 for xen-changelog@lists.xenproject.org; Tue, 10 Mar 2026 13:55:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzxYQ-001dqN-38
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 13:55:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzxYQ-001rHd-2K
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 13:55:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=efg9y6IDFZwmGye5bOzlnsfupS+K/VfVRyvEIkfW5oQ=; b=Sl1nXsdnrbgiCE8PfjrRZAFYzj
	29I95hLYIlly0hI9+hJN/fjSAj5+dKjrz/v0UGST/uwJq6DeVfY8hksrG2jWIro95rUlzRV9W7c96
	9ajSWs4wRQ9TQMeQtxY/G1BLoIjrD7yJTQtsqKbgM2H9JBnpTDVIMhPiLAZXeRr76Kz4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.21] x86/ucode: Support discrete modules being CPIO archives
Message-Id: <E1vzxYQ-001rHd-2K@xenbits.xenproject.org>
Date: Tue, 10 Mar 2026 13:55:22 +0000

commit 8f3b6375919a6e99b5259457df5d760c2eed61e0
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Mar 10 14:37:00 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 10 14:37:00 2026 +0100

    x86/ucode: Support discrete modules being CPIO archives
    
    Multiple downstream distros have tried passing discrete CPIO archives and
    tripped over this not working.  It turns out to be easy to support, so do so.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Tested-by: Teddy Astie <teddy.astie@vates.tech>
    [jb: doc change dropped as inapplicable to the older form]
    master commit: 878a9cfa451878dcba6108ae5b7879c80f049661
    master date: 2026-03-03 15:15:53 +0000
---
 CHANGELOG.md                      |  6 ++++++
 xen/arch/x86/cpu/microcode/core.c | 20 +++++++++++++++++++-
 2 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 572f985685..527a51ec13 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,12 @@ Notable changes to Xen will be documented in this file.
 
 The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
 
+## [4.21.1](https://xenbits.xenproject.org/gitweb/?p=xen.git;a=shortlog;h=RELEASE-4.21.1)
+
+### Added
+ - On x86:
+   - Support for CPIO microcode in discrete multiboot modules.
+
 ## [4.21.0](https://xenbits.xenproject.org/gitweb/?p=xen.git;a=shortlog;h=RELEASE-4.21.0) - 2025-11-19
 
 ### Changed
diff --git a/xen/arch/x86/cpu/microcode/core.c b/xen/arch/x86/cpu/microcode/core.c
index ecee400f28..17540fc2e6 100644
--- a/xen/arch/x86/cpu/microcode/core.c
+++ b/xen/arch/x86/cpu/microcode/core.c
@@ -749,6 +749,7 @@ static int __init early_microcode_load(struct boot_info *bi)
     void *data = NULL;
     size_t size;
     struct microcode_patch *patch;
+    struct cpio_data cd;
     int idx = opt_mod_idx;
     int rc;
 
@@ -765,7 +766,6 @@ static int __init early_microcode_load(struct boot_info *bi)
         for ( idx = 0; idx < bi->nr_modules; ++idx )
         {
             const struct boot_module *bm = &bi->mods[idx];
-            struct cpio_data cd;
 
             /* Search anything unclaimed or likely to be a CPIO archive. */
             if ( bm->kind != BOOTMOD_UNKNOWN && bm->kind != BOOTMOD_RAMDISK )
@@ -833,6 +833,24 @@ static int __init early_microcode_load(struct boot_info *bi)
                    idx, size);
             return -ENODEV;
         }
+
+        /*
+         * If this blob appears to be a CPIO archive, try interpreting it as
+         * one.  Otherwise treat it as a raw vendor blob.
+         */
+        cd = find_cpio_data(ucode_ops.cpio_path, data, size);
+        if ( cd.data )
+        {
+            data = cd.data;
+            size = cd.size;
+
+            /*
+             * (Ab)use opt_scan to inform microcode_init_cache() that
+             * early_mod_idx refers to a CPIO archive.
+             */
+            opt_scan = true;
+        }
+
         goto found;
     }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.21


From xen-changelog-bounces@lists.xenproject.org Tue Mar 10 13:55:34 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Mar 2026 13:55:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1250128.1547561 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzxYc-0000wP-Py; Tue, 10 Mar 2026 13:55:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1250128.1547561; Tue, 10 Mar 2026 13:55:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzxYc-0000wH-NL; Tue, 10 Mar 2026 13:55:34 +0000
Received: by outflank-mailman (input) for mailman id 1250128;
 Tue, 10 Mar 2026 13:55:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vzxYa-0000w5-SS
 for xen-changelog@lists.xenproject.org; Tue, 10 Mar 2026 13:55:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzxYb-001dqS-0C
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 13:55:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzxYa-001rIc-2c
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 13:55:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=bbKfnyocyWqHYonWqFsjD2grK5k22CUyPyaKXWIRvkE=; b=0W8o5Fjlrjiq5BfqHwmsXeXtha
	s2IPV0m0L4zo6Ts/e3le7weH3FjiqLszzldKUPwFQl4eZvF7UEIExcpOcOSeekMhWcu2N9XONa2E4
	eGQ9uljh/SXu6P1VLwWB11qythSMw1xnMb0fqa2GOAuMHnEl+8Nw+2NfIsRGiwgLCzT4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.21] vpci/msix: check for BARs enabled in vpci_make_msix_hole
Message-Id: <E1vzxYa-001rIc-2c@xenbits.xenproject.org>
Date: Tue, 10 Mar 2026 13:55:32 +0000

commit 999c6fadf71485ea070add4cdb76926b6a9574ff
Author:     Stewart Hildebrand <stewart.hildebrand@amd.com>
AuthorDate: Tue Mar 10 14:37:20 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 10 14:37:20 2026 +0100

    vpci/msix: check for BARs enabled in vpci_make_msix_hole
    
    A hotplugged PCI device may be added uninitialized. In particular,
    memory decoding might be disabled and the BARs might be zeroed. In this
    case, the BARs will not be mapped in p2m. However, vpci_make_msix_hole()
    unconditionally attempts to punch holes in p2m, leading to init_msix()
    failing:
    
    (XEN) d0v0 0000:01:00.0: existing mapping (mfn: 1c1880 type: 0) at 0 clobbers MSIX MMIO area
    (XEN) d0 0000:01:00.0: init legacy cap 17 fail rc=-17, mask it
    
    vpci_make_msix_hole() should only attempt to punch holes if the BARs
    containing the MSI-X/PBA tables are mapped in p2m. Introduce a helper
    for checking if a BAR is enabled, and add a check for the situation
    inside vpci_make_msix_hole().
    
    As a result of the newly introduced checks in vpci_make_msix_hole(),
    move the call to vpci_make_msix_hole() within modify_decoding() to after
    setting ->enabled.
    
    Fixes: ee2eb6849d50 ("vpci: Refactor REGISTER_VPCI_INIT")
    Signed-off-by: Stewart Hildebrand <stewart.hildebrand@amd.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 7c24d58a6e641e2979978c5abb312bff877dede3
    master date: 2026-03-05 09:27:50 +0100
---
 xen/drivers/vpci/header.c | 26 +++++++++++++-------------
 xen/drivers/vpci/msix.c   |  3 +++
 xen/include/xen/vpci.h    |  6 ++++++
 3 files changed, 22 insertions(+), 13 deletions(-)

diff --git a/xen/drivers/vpci/header.c b/xen/drivers/vpci/header.c
index aae663bbf5..a3e8d0ec82 100644
--- a/xen/drivers/vpci/header.c
+++ b/xen/drivers/vpci/header.c
@@ -122,19 +122,6 @@ static void modify_decoding(const struct pci_dev *pdev, uint16_t cmd,
     bool map = cmd & PCI_COMMAND_MEMORY;
     unsigned int i;
 
-    /*
-     * Make sure there are no mappings in the MSIX MMIO areas, so that accesses
-     * can be trapped (and emulated) by Xen when the memory decoding bit is
-     * enabled.
-     *
-     * FIXME: punching holes after the p2m has been set up might be racy for
-     * DomU usage, needs to be revisited.
-     */
-#ifdef CONFIG_HAS_PCI_MSI
-    if ( map && !rom_only && vpci_make_msix_hole(pdev) )
-        return;
-#endif
-
     for ( i = 0; i < ARRAY_SIZE(header->bars); i++ )
     {
         struct vpci_bar *bar = &header->bars[i];
@@ -164,6 +151,19 @@ static void modify_decoding(const struct pci_dev *pdev, uint16_t cmd,
             bar->enabled = map;
     }
 
+    /*
+     * Make sure there are no mappings in the MSIX MMIO areas, so that accesses
+     * can be trapped (and emulated) by Xen when the memory decoding bit is
+     * enabled.
+     *
+     * FIXME: punching holes after the p2m has been set up might be racy for
+     * DomU usage, needs to be revisited.
+     */
+#ifdef CONFIG_HAS_PCI_MSI
+    if ( map && !rom_only && vpci_make_msix_hole(pdev) )
+        return;
+#endif
+
     if ( !rom_only )
     {
         pci_conf_write16(pdev->sbdf, PCI_COMMAND, cmd);
diff --git a/xen/drivers/vpci/msix.c b/xen/drivers/vpci/msix.c
index 032e471bb1..955fad3304 100644
--- a/xen/drivers/vpci/msix.c
+++ b/xen/drivers/vpci/msix.c
@@ -605,6 +605,9 @@ int vpci_make_msix_hole(const struct pci_dev *pdev)
         unsigned long end = PFN_DOWN(vmsix_table_addr(pdev->vpci, i) +
                                      vmsix_table_size(pdev->vpci, i) - 1);
 
+        if ( !vmsix_table_bar_valid(pdev->vpci, i) )
+            continue;
+
         for ( ; start <= end; start++ )
         {
             p2m_type_t t;
diff --git a/xen/include/xen/vpci.h b/xen/include/xen/vpci.h
index 9ae75d946a..50d0ad05a6 100644
--- a/xen/include/xen/vpci.h
+++ b/xen/include/xen/vpci.h
@@ -271,6 +271,12 @@ static inline paddr_t vmsix_table_addr(const struct vpci *vpci, unsigned int nr)
            (vpci->msix->tables[nr] & ~PCI_MSIX_BIRMASK);
 }
 
+static inline bool vmsix_table_bar_valid(const struct vpci *vpci,
+                                         unsigned int nr)
+{
+    return vpci->header.bars[vpci->msix->tables[nr] & PCI_MSIX_BIRMASK].enabled;
+}
+
 /*
  * Note regarding the size calculation of the PBA: the spec mentions "The last
  * QWORD will not necessarily be fully populated", so it implies that the PBA
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.21


From xen-changelog-bounces@lists.xenproject.org Tue Mar 10 13:55:44 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Mar 2026 13:55:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1250129.1547566 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzxYm-0000yc-Re; Tue, 10 Mar 2026 13:55:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1250129.1547566; Tue, 10 Mar 2026 13:55:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzxYm-0000yU-Om; Tue, 10 Mar 2026 13:55:44 +0000
Received: by outflank-mailman (input) for mailman id 1250129;
 Tue, 10 Mar 2026 13:55:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vzxYk-0000yG-V4
 for xen-changelog@lists.xenproject.org; Tue, 10 Mar 2026 13:55:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzxYl-001dsV-0T
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 13:55:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzxYk-001rLG-2u
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 13:55:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=/04C/Sm5GcvTz7eaiL2J8UwICg/7PnmX7EdxFCCTI3k=; b=B6T9DqO5MqbAap1d7UTo7HciJJ
	TdCuM3yDJtqvvrPx7rFn+7SSWk6rThS2k5VzCvUUjQTgEYV4YDrT/0N4Ge1Pq2GGCXNRd6Rdq2IpL
	q5AQgsZU+bnaimyXshOXZr9fZfZkRMuBubaTYhVozh979TZo3Qv40dIPrVPS09AzDmYw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.21] domain: move vmtrace_alloc_buffer() invocation in vcpu_create()
Message-Id: <E1vzxYk-001rLG-2u@xenbits.xenproject.org>
Date: Tue, 10 Mar 2026 13:55:42 +0000

commit 1c72306b1f0b4dc533954f678361044f8083dccc
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Mar 10 14:37:45 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 10 14:37:45 2026 +0100

    domain: move vmtrace_alloc_buffer() invocation in vcpu_create()
    
    The label used upon the function failing is wrong. Instead of correcting
    the label, move the invocation up a little, to also avoid it altogether
    for the idle domain (where ->vmtrace_size would be zero, and hence the
    function would bail right away anyway).
    
    Fixes: 217dd79ee292 ("xen/domain: Add vmtrace_size domain creation parameter")
    Reported-by: Roger Pau Monné <roger.pau@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: adfbdaa347d05e53c8c61ad00a6851bd5b82c760
    master date: 2026-03-10 09:23:25 +0100
---
 xen/common/domain.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/xen/common/domain.c b/xen/common/domain.c
index ac06532544..75c7da16e2 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -452,14 +452,14 @@ struct vcpu *vcpu_create(struct domain *d, unsigned int vcpu_id)
         set_bit(_VPF_down, &v->pause_flags);
         vcpu_info_reset(v);
         init_waitqueue_vcpu(v);
+
+        if ( vmtrace_alloc_buffer(v) != 0 )
+            goto fail_wq;
     }
 
     if ( sched_init_vcpu(v) != 0 )
         goto fail_wq;
 
-    if ( vmtrace_alloc_buffer(v) != 0 )
-        goto fail_wq;
-
     if ( arch_vcpu_create(v) != 0 )
         goto fail_sched;
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.21


From xen-changelog-bounces@lists.xenproject.org Tue Mar 10 13:55:54 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Mar 2026 13:55:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1250130.1547570 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzxYw-000118-U1; Tue, 10 Mar 2026 13:55:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1250130.1547570; Tue, 10 Mar 2026 13:55:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzxYw-00010y-RN; Tue, 10 Mar 2026 13:55:54 +0000
Received: by outflank-mailman (input) for mailman id 1250130;
 Tue, 10 Mar 2026 13:55:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vzxYv-00010m-C9
 for xen-changelog@lists.xenproject.org; Tue, 10 Mar 2026 13:55:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzxYv-001dsv-1o
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 13:55:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzxYv-001rMq-12
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 13:55:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Q27qbkAaHx31sbEzjWXU1YQAnkmIRTHGz7yjJnULN38=; b=TAnlKs94AnSfGCdBRPWSxu9Sta
	QvNcls6MYOusDuOXE5V3b0uWMtaQ19iWzTYKd1eXzYPSRO2K6t/5zLDY7w21Noo/iNJ5iX/KW9PqH
	HSad7oQ6MlajFOSkzwZ34kUwfqjG5vpsDsGkVUo0N+VP/Xb6Ja4lb2OefkHcR3VEXCZc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.20] x86/MCE: restore CPU vendor reporting to the outside world
Message-Id: <E1vzxYv-001rMq-12@xenbits.xenproject.org>
Date: Tue, 10 Mar 2026 13:55:53 +0000

commit 1c762d6c46a12fc24a1febe4b0d7055f781cd775
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Mar 10 14:38:36 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 10 14:38:36 2026 +0100

    x86/MCE: restore CPU vendor reporting to the outside world
    
    The records reported used to contain Linux enumerators. We first broke
    that connection when purging unused ones, and then again when switching to
    the bit mask forms.
    
    Fixes: 408413051144 ("x86/cpu: Drop unused X86_VENDOR_* values")
    Fixes: 0cd074144cbb ("x86/cpu: Renumber X86_VENDOR_* to form a bitmap")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
    master commit: a94c5fd8290a55461c599b8baad309df0d929f1f
    master date: 2026-02-23 08:39:58 +0100
---
 xen/arch/x86/cpu/mcheck/mce.c | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/cpu/mcheck/mce.c b/xen/arch/x86/cpu/mcheck/mce.c
index 84238cd0ef..1ccb96958e 100644
--- a/xen/arch/x86/cpu/mcheck/mce.c
+++ b/xen/arch/x86/cpu/mcheck/mce.c
@@ -854,6 +854,22 @@ void *x86_mcinfo_reserve(struct mc_info *mi,
     return mic_index;
 }
 
+/* Linux values need using when reporting CPU vendors to the outside. */
+static unsigned int xen2linux_vendor(unsigned int vendor)
+{
+    switch ( vendor )
+    {
+    case X86_VENDOR_INTEL:    return 0;
+    case X86_VENDOR_AMD:      return 2;
+    case X86_VENDOR_CENTAUR:  return 5;
+    case X86_VENDOR_HYGON:    return 9;
+    case X86_VENDOR_SHANGHAI: return 10; /* X86_VENDOR_ZHAOXIN */
+    default: break;
+    }
+
+    return 0xff; /* X86_VENDOR_UNKNOWN */
+}
+
 static void x86_mcinfo_apei_save(
     struct mcinfo_global *mc_global, struct mcinfo_bank *mc_bank)
 {
@@ -862,7 +878,7 @@ static void x86_mcinfo_apei_save(
     memset(&m, 0, sizeof(struct mce));
 
     m.cpu = mc_global->mc_coreid;
-    m.cpuvendor = boot_cpu_data.x86_vendor;
+    m.cpuvendor = xen2linux_vendor(boot_cpu_data.x86_vendor);
     m.cpuid = cpuid_eax(1);
     m.socketid = mc_global->mc_socketid;
     m.apicid = mc_global->mc_apicid;
@@ -964,7 +980,7 @@ static void cf_check __maybe_unused do_mc_get_cpu_info(void *v)
                         &xcp->mc_ncores_active, &xcp->mc_nthreads);
     xcp->mc_cpuid_level = c->cpuid_level;
     xcp->mc_family = c->x86;
-    xcp->mc_vendor = c->x86_vendor;
+    xcp->mc_vendor = xen2linux_vendor(c->x86_vendor);
     xcp->mc_model = c->x86_model;
     xcp->mc_step = c->x86_mask;
     xcp->mc_cache_size = c->x86_cache_size;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.20


From xen-changelog-bounces@lists.xenproject.org Tue Mar 10 13:56:04 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Mar 2026 13:56:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1250131.1547574 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzxZ6-00013F-VI; Tue, 10 Mar 2026 13:56:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1250131.1547574; Tue, 10 Mar 2026 13:56:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzxZ6-000137-Sg; Tue, 10 Mar 2026 13:56:04 +0000
Received: by outflank-mailman (input) for mailman id 1250131;
 Tue, 10 Mar 2026 13:56:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vzxZ5-00012z-F9
 for xen-changelog@lists.xenproject.org; Tue, 10 Mar 2026 13:56:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzxZ5-001dtA-24
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 13:56:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzxZ5-001rOd-1I
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 13:56:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=beuMM+ttAqChZM1VSM6DEOMIg+vNDrnhpxNX4llIKHQ=; b=i4Y7IYjv52tKUVZ4ydCkcuYjZE
	LRiD7QZtI7VdLdRneNZc4v0PQEMbN/qsHxfHHfpP2YUxPnltye3li2K0o3ts0jATV2qorJPKvtfKL
	Iymg1N+YQxrqKzoOeHAEdbJ23Li1RUOdtR6xwLeGzqXguj3N3xh5pHLxcvxWKqGbbqdM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.20] x86/ucode: Support discrete modules being CPIO archives
Message-Id: <E1vzxZ5-001rOd-1I@xenbits.xenproject.org>
Date: Tue, 10 Mar 2026 13:56:03 +0000

commit 51eb3e246e33bfa3d55f750283eedb267e72ed5e
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Mar 10 14:38:59 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 10 14:38:59 2026 +0100

    x86/ucode: Support discrete modules being CPIO archives
    
    Multiple downstream distros have tried passing discrete CPIO archives and
    tripped over this not working.  It turns out to be easy to support, so do so.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Tested-by: Teddy Astie <teddy.astie@vates.tech>
    [jb: doc change dropped as inapplicable to the older form]
    master commit: 878a9cfa451878dcba6108ae5b7879c80f049661
    master date: 2026-03-03 15:15:53 +0000
---
 CHANGELOG.md                      |  6 ++++++
 xen/arch/x86/cpu/microcode/core.c | 20 +++++++++++++++++++-
 2 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index d098e7c5ac..8324c5c5cb 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,12 @@ Notable changes to Xen will be documented in this file.
 
 The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
 
+## [4.20.3](https://xenbits.xenproject.org/gitweb/?p=xen.git;a=shortlog;h=RELEASE-4.20.3)
+
+### Added
+ - On x86:
+   - Support for CPIO microcode in discrete multiboot modules.
+
 ## [4.20.1](https://xenbits.xenproject.org/gitweb/?p=xen.git;a=shortlog;h=RELEASE-4.20.1)
 
 ### Added
diff --git a/xen/arch/x86/cpu/microcode/core.c b/xen/arch/x86/cpu/microcode/core.c
index dc913ff333..d565fa3e48 100644
--- a/xen/arch/x86/cpu/microcode/core.c
+++ b/xen/arch/x86/cpu/microcode/core.c
@@ -749,6 +749,7 @@ static int __init early_microcode_load(struct boot_info *bi)
     void *data = NULL;
     size_t size;
     struct microcode_patch *patch;
+    struct cpio_data cd;
     int idx = opt_mod_idx;
     int rc;
 
@@ -765,7 +766,6 @@ static int __init early_microcode_load(struct boot_info *bi)
         for ( idx = 0; idx < bi->nr_modules; ++idx )
         {
             const struct boot_module *bm = &bi->mods[idx];
-            struct cpio_data cd;
 
             /* Search anything unclaimed or likely to be a CPIO archive. */
             if ( bm->type != BOOTMOD_UNKNOWN &&
@@ -834,6 +834,24 @@ static int __init early_microcode_load(struct boot_info *bi)
                    idx, size);
             return -ENODEV;
         }
+
+        /*
+         * If this blob appears to be a CPIO archive, try interpreting it as
+         * one.  Otherwise treat it as a raw vendor blob.
+         */
+        cd = find_cpio_data(ucode_ops.cpio_path, data, size);
+        if ( cd.data )
+        {
+            data = cd.data;
+            size = cd.size;
+
+            /*
+             * (Ab)use opt_scan to inform microcode_init_cache() that
+             * early_mod_idx refers to a CPIO archive.
+             */
+            opt_scan = true;
+        }
+
         goto found;
     }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.20


From xen-changelog-bounces@lists.xenproject.org Tue Mar 10 13:56:15 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Mar 2026 13:56:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1250132.1547578 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzxZH-00015I-0X; Tue, 10 Mar 2026 13:56:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1250132.1547578; Tue, 10 Mar 2026 13:56:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzxZG-00015A-U7; Tue, 10 Mar 2026 13:56:14 +0000
Received: by outflank-mailman (input) for mailman id 1250132;
 Tue, 10 Mar 2026 13:56:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vzxZF-000152-Hi
 for xen-changelog@lists.xenproject.org; Tue, 10 Mar 2026 13:56:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzxZF-001dtU-2L
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 13:56:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzxZF-001rQy-1Z
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 13:56:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=dR26jCyaDpUa2Tg/UL4CaXwPZw7P8xcCCqf/NVluQCU=; b=ONgTgTO4LgNnHvUkychspSQUxt
	dJXOXhgW3TvY5zzn10A0mIeCLkmLJmSxtS3TCgpa3bDP+ZjQGIkCVrvboaEMxfQzMU2JLCobi/LnT
	j/MfWMHleifiRLNlwMgf9oC1eB3qd2mwHR2MRu9uKA87Mt/heqnIIQ7VZqDHsLTSDpb4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.20] x86/pv: Don't assume that INT $imm8 instructions are two bytes long
Message-Id: <E1vzxZF-001rQy-1Z@xenbits.xenproject.org>
Date: Tue, 10 Mar 2026 13:56:13 +0000

commit 45d18b05c09b412fa53142cadf4ddd2275283564
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Mar 10 14:39:14 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 10 14:39:14 2026 +0100

    x86/pv: Don't assume that INT $imm8 instructions are two bytes long
    
    For INT $N instructions (besides $0x80 for which there is a dedicated fast
    path), handling is mostly fault-based because of DPL0 gates in the IDT.  This
    means that when the guest kernel allows the instruction too, Xen must
    increment %rip to the end of the instruction before passing a trap to the
    guest kernel.
    
    When an INT $N instruction has a prefix, it's longer than two bytes, and Xen
    will deliver the "trap" with %rip pointing into the middle of the instruction.
    
    Introduce a new pv_emulate_sw_interrupt() which uses x86_insn_length() to
    determine the instruction length, rather than assuming two.
    
    This is a change in behaviour for PV guests, but the prior behaviour cannot
    reasonably be said to be intentional.
    
    This change does not affect the INT $0x80 fastpath.  Prefixed INT $N
    instructions occur almost exclusively in test code or exploits, and INT $0x80
    appears to be the only user-usable interrupt gate in contemporary PV guests.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: a934a600c45486b7acfe8abc3658e284e64e5dd5
    master date: 2026-03-03 15:15:53 +0000
---
 xen/arch/x86/include/asm/pv/traps.h |  2 ++
 xen/arch/x86/pv/emul-priv-op.c      | 49 +++++++++++++++++++++++++++++++++++++
 xen/arch/x86/traps.c                |  3 +--
 3 files changed, 52 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/include/asm/pv/traps.h b/xen/arch/x86/include/asm/pv/traps.h
index 404f5b169c..5892dc9ef8 100644
--- a/xen/arch/x86/include/asm/pv/traps.h
+++ b/xen/arch/x86/include/asm/pv/traps.h
@@ -19,6 +19,7 @@ void pv_trap_init(void);
 int pv_raise_nmi(struct vcpu *v);
 
 int pv_emulate_privileged_op(struct cpu_user_regs *regs);
+void pv_emulate_sw_interrupt(struct cpu_user_regs *regs);
 void pv_emulate_gate_op(struct cpu_user_regs *regs);
 bool pv_emulate_invalid_op(struct cpu_user_regs *regs);
 
@@ -37,6 +38,7 @@ static inline void pv_trap_init(void) {}
 static inline int pv_raise_nmi(struct vcpu *v) { return -EOPNOTSUPP; }
 
 static inline int pv_emulate_privileged_op(struct cpu_user_regs *regs) { return 0; }
+static inline void pv_emulate_sw_interrupt(struct cpu_user_regs *regs) {}
 static inline void pv_emulate_gate_op(struct cpu_user_regs *regs) {}
 static inline bool pv_emulate_invalid_op(struct cpu_user_regs *regs) { return true; }
 
diff --git a/xen/arch/x86/pv/emul-priv-op.c b/xen/arch/x86/pv/emul-priv-op.c
index a21d499519..7753e44477 100644
--- a/xen/arch/x86/pv/emul-priv-op.c
+++ b/xen/arch/x86/pv/emul-priv-op.c
@@ -8,6 +8,7 @@
  */
 
 #include <xen/domain_page.h>
+#include <xen/err.h>
 #include <xen/event.h>
 #include <xen/guest_access.h>
 #include <xen/hypercall.h>
@@ -1381,6 +1382,54 @@ int pv_emulate_privileged_op(struct cpu_user_regs *regs)
     return 0;
 }
 
+/*
+ * Hardware already decoded the INT $N instruction and determined that there
+ * was a permission issue (i.e. the DPL violation intended to trigger #GP).
+ * Xen has already determined that the guest kernel has permitted this
+ * software interrupt.
+ *
+ * All that is needed is the instruction length, to turn the fault into a
+ * trap.  All errors are turned back into the original #GP, as that's the
+ * action that really happened.
+ */
+void pv_emulate_sw_interrupt(struct cpu_user_regs *regs)
+{
+    struct vcpu *curr = current;
+    struct domain *currd = curr->domain;
+    struct priv_op_ctxt ctxt = {
+        .ctxt.regs = regs,
+        .ctxt.lma = !is_pv_32bit_domain(currd),
+    };
+    struct x86_emulate_state *state;
+    uint8_t vector = regs->error_code >> 3;
+    unsigned int len, ar;
+
+    if ( !pv_emul_read_descriptor(regs->cs, curr, &ctxt.cs.base,
+                                  &ctxt.cs.limit, &ar, 1) ||
+         !(ar & _SEGMENT_S) ||
+         !(ar & _SEGMENT_P) ||
+         !(ar & _SEGMENT_CODE) )
+        goto error;
+
+    state = x86_decode_insn(&ctxt.ctxt, insn_fetch);
+    if ( IS_ERR_OR_NULL(state) )
+        goto error;
+
+    len = x86_insn_length(state, &ctxt.ctxt);
+    x86_emulate_free_state(state);
+
+    /* Note: Checked slightly late to simplify 'state' handling. */
+    if ( ctxt.ctxt.opcode != 0xcd /* INT $imm8 */ )
+        goto error;
+
+    regs->rip += len;
+    pv_inject_sw_interrupt(vector);
+    return;
+
+ error:
+    pv_inject_hw_exception(X86_EXC_GP, regs->error_code);
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index 9eb7bd2e07..b6d2c5b3ea 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -1298,8 +1298,7 @@ void do_general_protection(struct cpu_user_regs *regs)
 
         if ( permit_softint(TI_GET_DPL(ti), v, regs) )
         {
-            regs->rip += 2;
-            pv_inject_sw_interrupt(vector);
+            pv_emulate_sw_interrupt(regs);
             return;
         }
     }
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.20


From xen-changelog-bounces@lists.xenproject.org Tue Mar 10 13:56:25 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Mar 2026 13:56:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1250133.1547583 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzxZR-00017V-27; Tue, 10 Mar 2026 13:56:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1250133.1547583; Tue, 10 Mar 2026 13:56:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzxZQ-00017N-VY; Tue, 10 Mar 2026 13:56:24 +0000
Received: by outflank-mailman (input) for mailman id 1250133;
 Tue, 10 Mar 2026 13:56:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vzxZP-00017D-K8
 for xen-changelog@lists.xenproject.org; Tue, 10 Mar 2026 13:56:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzxZP-001dtc-2b
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 13:56:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzxZP-001rSC-1q
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 13:56:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=aMnftDiADu1GKcp548f1V4Cm8+/u4ePrIIUq/+apo/8=; b=rUS9tmvJhqTF4VnZIA7Fk3HlSh
	+Fhu0LgBxSNWbQ2DW9iNIw2x/rtjpHyxNSQRkQ/nVtGG2eVRb8NYfyOBogSgF7JWQD8IQ0+M3P1PI
	bXlYLSU52ghrZ6d1l7KhLb3WokOhV/tMglUVdoUfHoMCyGEPIpCXEBi0R+zww+oRB8nM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.20] domain: move vmtrace_alloc_buffer() invocation in vcpu_create()
Message-Id: <E1vzxZP-001rSC-1q@xenbits.xenproject.org>
Date: Tue, 10 Mar 2026 13:56:23 +0000

commit ab68afe62d09df65df7f980fa3ba33770ef3b12b
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Mar 10 14:39:52 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 10 14:43:47 2026 +0100

    domain: move vmtrace_alloc_buffer() invocation in vcpu_create()
    
    The label used upon the function failing is wrong. Instead of correcting
    the label, move the invocation up a little, to also avoid it altogether
    for the idle domain (where ->vmtrace_size would be zero, and hence the
    function would bail right away anyway).
    
    Fixes: 217dd79ee292 ("xen/domain: Add vmtrace_size domain creation parameter")
    Reported-by: Roger Pau Monné <roger.pau@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: adfbdaa347d05e53c8c61ad00a6851bd5b82c760
    master date: 2026-03-10 09:23:25 +0100
---
 xen/common/domain.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/xen/common/domain.c b/xen/common/domain.c
index 68e8677962..1a5a7d15bf 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -316,14 +316,14 @@ struct vcpu *vcpu_create(struct domain *d, unsigned int vcpu_id)
         set_bit(_VPF_down, &v->pause_flags);
         vcpu_info_reset(v);
         init_waitqueue_vcpu(v);
+
+        if ( vmtrace_alloc_buffer(v) != 0 )
+            goto fail_wq;
     }
 
     if ( sched_init_vcpu(v) != 0 )
         goto fail_wq;
 
-    if ( vmtrace_alloc_buffer(v) != 0 )
-        goto fail_wq;
-
     if ( arch_vcpu_create(v) != 0 )
         goto fail_sched;
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.20


From xen-changelog-bounces@lists.xenproject.org Tue Mar 10 13:56:35 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Mar 2026 13:56:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1250134.1547586 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzxZb-00019e-3L; Tue, 10 Mar 2026 13:56:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1250134.1547586; Tue, 10 Mar 2026 13:56:35 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzxZb-00019W-0b; Tue, 10 Mar 2026 13:56:35 +0000
Received: by outflank-mailman (input) for mailman id 1250134;
 Tue, 10 Mar 2026 13:56:34 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vzxZa-00019M-11
 for xen-changelog@lists.xenproject.org; Tue, 10 Mar 2026 13:56:34 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzxZa-001dtp-0g
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 13:56:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzxZZ-001rT7-39
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 13:56:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=/Fu9bTaAI6hQpByiHyH0SClsSdw9dXIXH+13MNrzCKM=; b=cAMV0orsrjdmEbGjRHAkRKxpxe
	/9O9JqVc85hV3ET9UYezYyZnO2BT2VJRMV4OANLN0T5XsuElmDZOsNrVU6YgsE34+JrAGY17J1oKE
	w1F7cT4oStKjg5Qy51QK6qzGYhhBl8L8TYRMoNG8Rjl7+E/924K/GNSvptp658lcqETU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] x86/MCE: restore CPU vendor reporting to the outside world
Message-Id: <E1vzxZZ-001rT7-39@xenbits.xenproject.org>
Date: Tue, 10 Mar 2026 13:56:33 +0000

commit b74f88c938f928278575bb674df4daac9d6ff5a8
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Mar 10 14:45:02 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 10 14:45:02 2026 +0100

    x86/MCE: restore CPU vendor reporting to the outside world
    
    The records reported used to contain Linux enumerators. We first broke
    that connection when purging unused ones, and then again when switching to
    the bit mask forms.
    
    Fixes: 408413051144 ("x86/cpu: Drop unused X86_VENDOR_* values")
    Fixes: 0cd074144cbb ("x86/cpu: Renumber X86_VENDOR_* to form a bitmap")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
    master commit: a94c5fd8290a55461c599b8baad309df0d929f1f
    master date: 2026-02-23 08:39:58 +0100
---
 xen/arch/x86/cpu/mcheck/mce.c | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/cpu/mcheck/mce.c b/xen/arch/x86/cpu/mcheck/mce.c
index 5a59e79cbc..533425cf51 100644
--- a/xen/arch/x86/cpu/mcheck/mce.c
+++ b/xen/arch/x86/cpu/mcheck/mce.c
@@ -854,6 +854,22 @@ void *x86_mcinfo_reserve(struct mc_info *mi,
     return mic_index;
 }
 
+/* Linux values need using when reporting CPU vendors to the outside. */
+static unsigned int xen2linux_vendor(unsigned int vendor)
+{
+    switch ( vendor )
+    {
+    case X86_VENDOR_INTEL:    return 0;
+    case X86_VENDOR_AMD:      return 2;
+    case X86_VENDOR_CENTAUR:  return 5;
+    case X86_VENDOR_HYGON:    return 9;
+    case X86_VENDOR_SHANGHAI: return 10; /* X86_VENDOR_ZHAOXIN */
+    default: break;
+    }
+
+    return 0xff; /* X86_VENDOR_UNKNOWN */
+}
+
 static void x86_mcinfo_apei_save(
     struct mcinfo_global *mc_global, struct mcinfo_bank *mc_bank)
 {
@@ -862,7 +878,7 @@ static void x86_mcinfo_apei_save(
     memset(&m, 0, sizeof(struct mce));
 
     m.cpu = mc_global->mc_coreid;
-    m.cpuvendor = boot_cpu_data.x86_vendor;
+    m.cpuvendor = xen2linux_vendor(boot_cpu_data.x86_vendor);
     m.cpuid = cpuid_eax(1);
     m.socketid = mc_global->mc_socketid;
     m.apicid = mc_global->mc_apicid;
@@ -964,7 +980,7 @@ static void cf_check do_mc_get_cpu_info(void *v)
                         &xcp->mc_ncores_active, &xcp->mc_nthreads);
     xcp->mc_cpuid_level = c->cpuid_level;
     xcp->mc_family = c->x86;
-    xcp->mc_vendor = c->x86_vendor;
+    xcp->mc_vendor = xen2linux_vendor(c->x86_vendor);
     xcp->mc_model = c->x86_model;
     xcp->mc_step = c->x86_mask;
     xcp->mc_cache_size = c->x86_cache_size;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Tue Mar 10 13:56:45 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Mar 2026 13:56:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1250135.1547590 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzxZl-0001C9-4o; Tue, 10 Mar 2026 13:56:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1250135.1547590; Tue, 10 Mar 2026 13:56:45 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzxZl-0001C0-24; Tue, 10 Mar 2026 13:56:45 +0000
Received: by outflank-mailman (input) for mailman id 1250135;
 Tue, 10 Mar 2026 13:56:44 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vzxZk-0001Bu-3a
 for xen-changelog@lists.xenproject.org; Tue, 10 Mar 2026 13:56:44 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzxZk-001du2-0x
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 13:56:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzxZk-001rUP-0B
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 13:56:44 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=DTJdpS767Vt95qCfZlnKsHOPz7OFah3z+rbXZStEGVY=; b=2+T9ZFo4GJkku90Dpq22qV8REU
	dYRzwkdbmGPFrbqDcIrKUXNZRqoCFN4enWVisE/RsXS/fQVyRgi3itrxvOav0O8bvnnbm9Pec23e9
	52XdUKY/KBPoScenk3SkL9OHML2cbxj4vuYfrTeGuLFgPIzQVt248JS6fbM3rFcbo6Aw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] x86/pv: Don't assume that INT $imm8 instructions are two bytes long
Message-Id: <E1vzxZk-001rUP-0B@xenbits.xenproject.org>
Date: Tue, 10 Mar 2026 13:56:44 +0000

commit 260740e1aa1ff414dab65798e2d2d698c5e78b03
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Mar 10 14:45:29 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 10 14:45:29 2026 +0100

    x86/pv: Don't assume that INT $imm8 instructions are two bytes long
    
    For INT $N instructions (besides $0x80 for which there is a dedicated fast
    path), handling is mostly fault-based because of DPL0 gates in the IDT.  This
    means that when the guest kernel allows the instruction too, Xen must
    increment %rip to the end of the instruction before passing a trap to the
    guest kernel.
    
    When an INT $N instruction has a prefix, it's longer than two bytes, and Xen
    will deliver the "trap" with %rip pointing into the middle of the instruction.
    
    Introduce a new pv_emulate_sw_interrupt() which uses x86_insn_length() to
    determine the instruction length, rather than assuming two.
    
    This is a change in behaviour for PV guests, but the prior behaviour cannot
    reasonably be said to be intentional.
    
    This change does not affect the INT $0x80 fastpath.  Prefixed INT $N
    instructions occur almost exclusively in test code or exploits, and INT $0x80
    appears to be the only user-usable interrupt gate in contemporary PV guests.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: a934a600c45486b7acfe8abc3658e284e64e5dd5
    master date: 2026-03-03 15:15:53 +0000
---
 xen/arch/x86/include/asm/pv/traps.h |  2 ++
 xen/arch/x86/pv/emul-priv-op.c      | 49 +++++++++++++++++++++++++++++++++++++
 xen/arch/x86/traps.c                |  3 +--
 3 files changed, 52 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/include/asm/pv/traps.h b/xen/arch/x86/include/asm/pv/traps.h
index 404f5b169c..5892dc9ef8 100644
--- a/xen/arch/x86/include/asm/pv/traps.h
+++ b/xen/arch/x86/include/asm/pv/traps.h
@@ -19,6 +19,7 @@ void pv_trap_init(void);
 int pv_raise_nmi(struct vcpu *v);
 
 int pv_emulate_privileged_op(struct cpu_user_regs *regs);
+void pv_emulate_sw_interrupt(struct cpu_user_regs *regs);
 void pv_emulate_gate_op(struct cpu_user_regs *regs);
 bool pv_emulate_invalid_op(struct cpu_user_regs *regs);
 
@@ -37,6 +38,7 @@ static inline void pv_trap_init(void) {}
 static inline int pv_raise_nmi(struct vcpu *v) { return -EOPNOTSUPP; }
 
 static inline int pv_emulate_privileged_op(struct cpu_user_regs *regs) { return 0; }
+static inline void pv_emulate_sw_interrupt(struct cpu_user_regs *regs) {}
 static inline void pv_emulate_gate_op(struct cpu_user_regs *regs) {}
 static inline bool pv_emulate_invalid_op(struct cpu_user_regs *regs) { return true; }
 
diff --git a/xen/arch/x86/pv/emul-priv-op.c b/xen/arch/x86/pv/emul-priv-op.c
index a21d499519..7753e44477 100644
--- a/xen/arch/x86/pv/emul-priv-op.c
+++ b/xen/arch/x86/pv/emul-priv-op.c
@@ -8,6 +8,7 @@
  */
 
 #include <xen/domain_page.h>
+#include <xen/err.h>
 #include <xen/event.h>
 #include <xen/guest_access.h>
 #include <xen/hypercall.h>
@@ -1381,6 +1382,54 @@ int pv_emulate_privileged_op(struct cpu_user_regs *regs)
     return 0;
 }
 
+/*
+ * Hardware already decoded the INT $N instruction and determined that there
+ * was a permission issue (i.e. the DPL violation intended to trigger #GP).
+ * Xen has already determined that the guest kernel has permitted this
+ * software interrupt.
+ *
+ * All that is needed is the instruction length, to turn the fault into a
+ * trap.  All errors are turned back into the original #GP, as that's the
+ * action that really happened.
+ */
+void pv_emulate_sw_interrupt(struct cpu_user_regs *regs)
+{
+    struct vcpu *curr = current;
+    struct domain *currd = curr->domain;
+    struct priv_op_ctxt ctxt = {
+        .ctxt.regs = regs,
+        .ctxt.lma = !is_pv_32bit_domain(currd),
+    };
+    struct x86_emulate_state *state;
+    uint8_t vector = regs->error_code >> 3;
+    unsigned int len, ar;
+
+    if ( !pv_emul_read_descriptor(regs->cs, curr, &ctxt.cs.base,
+                                  &ctxt.cs.limit, &ar, 1) ||
+         !(ar & _SEGMENT_S) ||
+         !(ar & _SEGMENT_P) ||
+         !(ar & _SEGMENT_CODE) )
+        goto error;
+
+    state = x86_decode_insn(&ctxt.ctxt, insn_fetch);
+    if ( IS_ERR_OR_NULL(state) )
+        goto error;
+
+    len = x86_insn_length(state, &ctxt.ctxt);
+    x86_emulate_free_state(state);
+
+    /* Note: Checked slightly late to simplify 'state' handling. */
+    if ( ctxt.ctxt.opcode != 0xcd /* INT $imm8 */ )
+        goto error;
+
+    regs->rip += len;
+    pv_inject_sw_interrupt(vector);
+    return;
+
+ error:
+    pv_inject_hw_exception(X86_EXC_GP, regs->error_code);
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index af90d8b27d..0c8c935ee9 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -1300,8 +1300,7 @@ void do_general_protection(struct cpu_user_regs *regs)
 
         if ( permit_softint(TI_GET_DPL(ti), v, regs) )
         {
-            regs->rip += 2;
-            pv_inject_sw_interrupt(vector);
+            pv_emulate_sw_interrupt(regs);
             return;
         }
     }
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Tue Mar 10 13:56:55 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Mar 2026 13:56:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1250136.1547594 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzxZv-0001Ea-7O; Tue, 10 Mar 2026 13:56:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1250136.1547594; Tue, 10 Mar 2026 13:56:55 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzxZv-0001ES-4k; Tue, 10 Mar 2026 13:56:55 +0000
Received: by outflank-mailman (input) for mailman id 1250136;
 Tue, 10 Mar 2026 13:56:54 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vzxZu-0001EJ-68
 for xen-changelog@lists.xenproject.org; Tue, 10 Mar 2026 13:56:54 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzxZu-001duP-1C
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 13:56:54 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzxZu-001rUs-0R
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 13:56:54 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=MJaJpJLp7srS0lEDA9OUTO9Rs8/Mo99Gk0qyZXPTdOI=; b=hi52RKrqbeJfBhASGiA7SGFUdM
	anNRsLywNVXGkL+8wgULRdc0QLmAlDAGK21x1DsSdiNzl6Shdiv4bFz9+3rRh15FuIYji5Mf//xQA
	lZMBfyhAaDbY4/Fq8UwWUK3ACyVn/1p49wrikStjx+DGUMPDLXWOh2J01gpP48MTHy9c=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] domain: move vmtrace_alloc_buffer() invocation in vcpu_create()
Message-Id: <E1vzxZu-001rUs-0R@xenbits.xenproject.org>
Date: Tue, 10 Mar 2026 13:56:54 +0000

commit a38f51516848c86fae75f295af8be1a50f96cabd
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Mar 10 14:45:42 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 10 14:45:42 2026 +0100

    domain: move vmtrace_alloc_buffer() invocation in vcpu_create()
    
    The label used upon the function failing is wrong. Instead of correcting
    the label, move the invocation up a little, to also avoid it altogether
    for the idle domain (where ->vmtrace_size would be zero, and hence the
    function would bail right away anyway).
    
    Fixes: 217dd79ee292 ("xen/domain: Add vmtrace_size domain creation parameter")
    Reported-by: Roger Pau Monné <roger.pau@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: adfbdaa347d05e53c8c61ad00a6851bd5b82c760
    master date: 2026-03-10 09:23:25 +0100
---
 xen/common/domain.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/xen/common/domain.c b/xen/common/domain.c
index 168f709423..77dacffd22 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -262,14 +262,14 @@ struct vcpu *vcpu_create(struct domain *d, unsigned int vcpu_id)
         set_bit(_VPF_down, &v->pause_flags);
         vcpu_info_reset(v);
         init_waitqueue_vcpu(v);
+
+        if ( vmtrace_alloc_buffer(v) != 0 )
+            goto fail_wq;
     }
 
     if ( sched_init_vcpu(v) != 0 )
         goto fail_wq;
 
-    if ( vmtrace_alloc_buffer(v) != 0 )
-        goto fail_wq;
-
     if ( arch_vcpu_create(v) != 0 )
         goto fail_sched;
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Tue Mar 10 14:00:02 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Mar 2026 14:00:02 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1250149.1547607 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzxcw-00025Z-Nl; Tue, 10 Mar 2026 14:00:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1250149.1547607; Tue, 10 Mar 2026 14:00:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzxcw-00025J-Kv; Tue, 10 Mar 2026 14:00:02 +0000
Received: by outflank-mailman (input) for mailman id 1250149;
 Tue, 10 Mar 2026 14:00:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vzxcw-0001y3-3W
 for xen-changelog@lists.xenproject.org; Tue, 10 Mar 2026 14:00:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzxcw-001dzM-0w
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 14:00:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzxcw-001rnR-08
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 14:00:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=H+9JSfv8Uhud1ExVM7Pvm8JiCmbNekMsKVgJzmQssus=; b=1ok9kLdVmNlUAznyswr7HZjp8R
	eZ5A3Fci56hqVAJi8GHTt9l7jvNmSN2/0hSRo3KC8VtkbDf+C61/dDnjCLI2bVyWTMATp4BsvV36L
	RYvk/u7dNvzHBAen/qUOGj4gnYp+ztHn/Pc7rkVON933+1P1pKTHS0d2s8qaEjAILqiQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/pv: Adjust GS handling for FRED mode
Message-Id: <E1vzxcw-001rnR-08@xenbits.xenproject.org>
Date: Tue, 10 Mar 2026 14:00:02 +0000

commit 9ea7d7f9393c52de36ee9c42b52c235949453a2a
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Aug 11 23:46:01 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 10 11:57:31 2026 +0000

    x86/pv: Adjust GS handling for FRED mode
    
    When FRED is active, hardware automatically swaps GS when changing privilege,
    and the SWAPGS instruction is disallowed.
    
    For native OSes using GS as the thread local pointer this is a massive
    improvement on the pre-FRED architecture, but under Xen it makes handling PV
    guests more complicated.  Specifically, it means that GS_BASE and GS_SHADOW
    are the opposite way around in FRED mode, as opposed to IDT mode.
    
    This leads to the following changes:
    
      * In load_segments(), we already load both GSes.  Account for FRED in the
        SWAP() condition and avoid the path with SWAGS.
    
      * In save_segments(), we need to read GS_SHADOW rather than GS_BASE.
    
      * In toggle_guest_mode(), we need to emulate SWAPGS.
    
      * In {read,write}_msr() which access the live registers, GS_SHADOW and
        GS_BASE need swapping.
    
      * In do_set_segment_base(), merge the SEGBASE_GS_{USER,KERNEL} cases and
        take FRED into account when choosing which base to update.
    
        SEGBASE_GS_USER_SEL was already an LKGS invocation (decades before FRED)
        so under FRED needs to be just a MOV %gs.  Simply skip the SWAPGSes.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/domain.c             | 16 +++++++++++-----
 xen/arch/x86/pv/domain.c          | 22 ++++++++++++++++++++--
 xen/arch/x86/pv/emul-priv-op.c    | 26 +++++++++++++++++---------
 xen/arch/x86/pv/misc-hypercalls.c | 23 +++++++++++++++--------
 4 files changed, 63 insertions(+), 24 deletions(-)

diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index e658c2d647..9c1f6ef76d 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -1791,9 +1791,10 @@ static void load_segments(struct vcpu *n)
 
         /*
          * Figure out which way around gsb/gss want to be.  gsb needs to be
-         * the active context, and gss needs to be the inactive context.
+         * the active context, and gss needs to be the inactive context,
+         * unless we're in FRED mode where they're reversed.
          */
-        if ( !(n->arch.flags & TF_kernel_mode) )
+        if ( !(n->arch.flags & TF_kernel_mode) ^ opt_fred )
             SWAP(gsb, gss);
 
         if ( using_svm() && (n->arch.pv.fs | n->arch.pv.gs) <= 3 )
@@ -1814,7 +1815,9 @@ static void load_segments(struct vcpu *n)
 
     if ( !fs_gs_done && !compat )
     {
-        if ( read_cr4() & X86_CR4_FSGSBASE )
+        unsigned long cr4 = read_cr4();
+
+        if ( !(cr4 & X86_CR4_FRED) && (cr4 & X86_CR4_FSGSBASE) )
         {
             __wrgsbase(gss);
             __wrfsbase(n->arch.pv.fs_base);
@@ -1931,6 +1934,9 @@ static void load_segments(struct vcpu *n)
  * Guests however cannot use SWAPGS, so there is no mechanism to modify the
  * inactive GS base behind Xen's back.  Therefore, Xen's copy of the inactive
  * GS base is still accurate, and doesn't need reading back from hardware.
+ *
+ * Under FRED, hardware automatically swaps GS for us, so SHADOW_GS is the
+ * active GS from the guest's point of view.
  */
 static void save_segments(struct vcpu *v)
 {
@@ -1946,12 +1952,12 @@ static void save_segments(struct vcpu *v)
         if ( read_cr4() & X86_CR4_FSGSBASE )
         {
             fs_base = __rdfsbase();
-            gs_base = __rdgsbase();
+            gs_base = opt_fred ? rdmsr(MSR_SHADOW_GS_BASE) : __rdgsbase();
         }
         else
         {
             fs_base = rdmsr(MSR_FS_BASE);
-            gs_base = rdmsr(MSR_GS_BASE);
+            gs_base = opt_fred ? rdmsr(MSR_SHADOW_GS_BASE) : rdmsr(MSR_GS_BASE);
         }
 
         v->arch.pv.fs_base = fs_base;
diff --git a/xen/arch/x86/pv/domain.c b/xen/arch/x86/pv/domain.c
index d16583a745..b85abb5ed9 100644
--- a/xen/arch/x86/pv/domain.c
+++ b/xen/arch/x86/pv/domain.c
@@ -14,9 +14,10 @@
 #include <asm/cpufeature.h>
 #include <asm/fsgsbase.h>
 #include <asm/invpcid.h>
-#include <asm/spec_ctrl.h>
 #include <asm/pv/domain.h>
 #include <asm/shadow.h>
+#include <asm/spec_ctrl.h>
+#include <asm/traps.h>
 
 #ifdef CONFIG_PV32
 int8_t __read_mostly opt_pv32 = -1;
@@ -514,11 +515,28 @@ void toggle_guest_mode(struct vcpu *v)
      * subsequent context switch won't bother re-reading it.
      */
     gs_base = read_gs_base();
+
+    /*
+     * In FRED mode, not only are the two GSes the other way around (i.e. we
+     * want to read GS_SHADOW here), the SWAPGS instruction is disallowed so
+     * we have to emulate it.
+     */
+    if ( opt_fred )
+    {
+        unsigned long gs_shadow = rdmsr(MSR_SHADOW_GS_BASE);
+
+        wrmsrns(MSR_SHADOW_GS_BASE, gs_base);
+        write_gs_base(gs_shadow);
+
+        gs_base = gs_shadow;
+    }
+    else
+        asm volatile ( "swapgs" );
+
     if ( v->arch.flags & TF_kernel_mode )
         v->arch.pv.gs_base_kernel = gs_base;
     else
         v->arch.pv.gs_base_user = gs_base;
-    asm volatile ( "swapgs" );
 
     _toggle_guest_pt(v);
 
diff --git a/xen/arch/x86/pv/emul-priv-op.c b/xen/arch/x86/pv/emul-priv-op.c
index 64d47ab677..53676b3021 100644
--- a/xen/arch/x86/pv/emul-priv-op.c
+++ b/xen/arch/x86/pv/emul-priv-op.c
@@ -25,6 +25,7 @@
 #include <asm/pv/traps.h>
 #include <asm/shared.h>
 #include <asm/stubs.h>
+#include <asm/traps.h>
 
 #include <xsm/xsm.h>
 
@@ -926,7 +927,8 @@ static int cf_check read_msr(
     case MSR_GS_BASE:
         if ( !cp->extd.lm )
             break;
-        *val = read_gs_base();
+        /* Under FRED, GS is automatically swapped on privilege change. */
+        *val = opt_fred ? rdmsr(MSR_SHADOW_GS_BASE) : read_gs_base();
         return X86EMUL_OKAY;
 
     case MSR_SHADOW_GS_BASE:
@@ -1066,17 +1068,23 @@ static int cf_check write_msr(
         if ( !cp->extd.lm || !is_canonical_address(val) )
             break;
 
-        if ( reg == MSR_FS_BASE )
-            write_fs_base(val);
-        else if ( reg == MSR_GS_BASE )
-            write_gs_base(val);
-        else if ( reg == MSR_SHADOW_GS_BASE )
+        switch ( reg )
         {
-            write_gs_shadow(val);
+        case MSR_FS_BASE:
+            write_fs_base(val);
+            break;
+
+        case MSR_SHADOW_GS_BASE:
             curr->arch.pv.gs_base_user = val;
+            fallthrough;
+        case MSR_GS_BASE:
+            /* Under FRED, GS is automatically swapped on privilege change. */
+            if ( (reg == MSR_GS_BASE) ^ opt_fred )
+                write_gs_base(val);
+            else
+                write_gs_shadow(val);
+            break;
         }
-        else
-            ASSERT_UNREACHABLE();
         return X86EMUL_OKAY;
 
     case MSR_EFER:
diff --git a/xen/arch/x86/pv/misc-hypercalls.c b/xen/arch/x86/pv/misc-hypercalls.c
index 4c2abeb4ad..7e915d86b7 100644
--- a/xen/arch/x86/pv/misc-hypercalls.c
+++ b/xen/arch/x86/pv/misc-hypercalls.c
@@ -11,6 +11,7 @@
 
 #include <asm/debugreg.h>
 #include <asm/fsgsbase.h>
+#include <asm/traps.h>
 
 long do_set_debugreg(int reg, unsigned long value)
 {
@@ -192,11 +193,13 @@ long do_set_segment_base(unsigned int which, unsigned long base)
 
         case SEGBASE_GS_USER:
             v->arch.pv.gs_base_user = base;
-            write_gs_shadow(base);
-            break;
-
+            fallthrough;
         case SEGBASE_GS_KERNEL:
-            write_gs_base(base);
+            /* Under FRED, GS is automatically swapped on privilege change. */
+            if ( (which == SEGBASE_GS_KERNEL) ^ opt_fred )
+                write_gs_base(base);
+            else
+                write_gs_shadow(base);
             break;
         }
         break;
@@ -206,10 +209,13 @@ long do_set_segment_base(unsigned int which, unsigned long base)
         unsigned int sel = (uint16_t)base;
 
         /*
-         * We wish to update the user %gs from the GDT/LDT.  Currently, the
-         * guest kernel's GS_BASE is in context.
+         * We wish to update the user %gs from the GDT/LDT.  Currently, we are
+         * in guest kernel context.
+         *
+         * Under IDT, this means updating GS_SHADOW.  Under FRED, plain GS.
          */
-        asm volatile ( "swapgs" );
+        if ( !opt_fred )
+            asm volatile ( "swapgs" );
 
         if ( sel > 3 )
             /* Fix up RPL for non-NUL selectors. */
@@ -247,7 +253,8 @@ long do_set_segment_base(unsigned int which, unsigned long base)
         /* Update the cache of the inactive base, as read from the GDT/LDT. */
         v->arch.pv.gs_base_user = read_gs_base();
 
-        asm volatile ( safe_swapgs );
+        if ( !opt_fred )
+            asm volatile ( safe_swapgs );
         break;
     }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 10 14:00:15 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Mar 2026 14:00:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1250150.1547611 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzxd7-0002sc-PK; Tue, 10 Mar 2026 14:00:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1250150.1547611; Tue, 10 Mar 2026 14:00:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzxd7-0002sU-Mb; Tue, 10 Mar 2026 14:00:13 +0000
Received: by outflank-mailman (input) for mailman id 1250150;
 Tue, 10 Mar 2026 14:00:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vzxd6-0002sK-7y
 for xen-changelog@lists.xenproject.org; Tue, 10 Mar 2026 14:00:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzxd6-001e3C-1E
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 14:00:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzxd6-001roi-0S
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 14:00:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=+FL5JzuubvDaDkYyl+41rouZNdckiw6nwj6ndPPReeI=; b=R5eQj2guP6/rjMbbrkutdIunYj
	5bubyjmHHy1ViTBXTdvTp+5of11bOgpRmPYVbCE8FR2/+CtuNRfr87QvIAEcPoo1a/W+MvwJhKDtM
	s+uJ6o4So2sxYU3lj+DHbD1EzLIRji3TouSNRnwHaYzU8Kr+CwTW9lXeRFXOxKWipqUQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/pv: Guest exception handling in FRED mode
Message-Id: <E1vzxd6-001roi-0S@xenbits.xenproject.org>
Date: Tue, 10 Mar 2026 14:00:12 +0000

commit 87cfcbe9f0b522f9498101b6a698dd8fbf6509b7
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Aug 11 15:55:24 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 10 11:57:53 2026 +0000

    x86/pv: Guest exception handling in FRED mode
    
    Under FRED, entry_from_pv() handles everything.  To start with, implement
    exception handling in the same manner as entry_from_xen(), although we can
    unconditionally enable interrupts after the async/fatal events.
    
    After entry_from_pv() returns, test_all_events() needs to run to perform
    exception and interrupt injection.  Split entry_FRED_R3() into two and
    introduce eretu_exit_to_guest() as the latter half, coming unilaterally from
    restore_all_guest().
    
    For all of this, there is a slightly complicated relationship with CONFIG_PV.
    entry_FRED_R3() must exist irrespective of CONFIG_PV, because it's the
    entrypoint registered with hardware.  For simplicity, entry_from_pv() is
    always called, but it collapses into fatal_trap() in the !PV case.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/traps.c             | 78 +++++++++++++++++++++++++++++++++++++++-
 xen/arch/x86/x86_64/entry-fred.S | 13 ++++++-
 xen/arch/x86/x86_64/entry.S      |  4 ++-
 3 files changed, 92 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index e40b51d693..77af9b90f1 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -2267,9 +2267,85 @@ void asmlinkage check_ist_exit(const struct cpu_user_regs *regs, bool ist_exit)
 
 void asmlinkage entry_from_pv(struct cpu_user_regs *regs)
 {
+    struct fred_info *fi = cpu_regs_fred_info(regs);
+    uint8_t type = regs->fred_ss.type;
+    uint8_t vec = regs->fred_ss.vector;
+
     /* Copy fred_ss.vector into entry_vector as IDT delivery would have done. */
-    regs->entry_vector = regs->fred_ss.vector;
+    regs->entry_vector = vec;
+
+    if ( !IS_ENABLED(CONFIG_PV) )
+        goto fatal;
+
+    /*
+     * First, handle the asynchronous or fatal events.  These are either
+     * unrelated to the interrupted context, or may not have valid context
+     * recorded, and all have special rules on how/whether to re-enable IRQs.
+     */
+    if ( regs->fred_ss.nested )
+        goto fatal;
+
+    switch ( type )
+    {
+    case X86_ET_EXT_INTR:
+        return do_IRQ(regs);
+
+    case X86_ET_NMI:
+        return do_nmi(regs);
+
+    case X86_ET_HW_EXC:
+        switch ( vec )
+        {
+        case X86_EXC_DF: return do_double_fault(regs);
+        case X86_EXC_MC: return do_machine_check(regs);
+        }
+        break;
+    }
 
+    /*
+     * With the asynchronous events handled, what remains are the synchronous
+     * ones.  PV guest context always had interrupts enabled.
+     */
+    local_irq_enable();
+
+    switch ( type )
+    {
+    case X86_ET_HW_EXC:
+    case X86_ET_PRIV_SW_EXC:
+    case X86_ET_SW_EXC:
+        switch ( vec )
+        {
+        case X86_EXC_PF:  handle_PF(regs, fi->edata); break;
+        case X86_EXC_GP:  do_general_protection(regs); break;
+        case X86_EXC_UD:  do_invalid_op(regs); break;
+        case X86_EXC_NM:  do_device_not_available(regs); break;
+        case X86_EXC_BP:  do_int3(regs); break;
+        case X86_EXC_DB:  handle_DB(regs, fi->edata); break;
+        case X86_EXC_CP:  do_entry_CP(regs); break;
+
+        case X86_EXC_DE:
+        case X86_EXC_OF:
+        case X86_EXC_BR:
+        case X86_EXC_NP:
+        case X86_EXC_SS:
+        case X86_EXC_MF:
+        case X86_EXC_AC:
+        case X86_EXC_XM:
+            do_trap(regs);
+            break;
+
+        default:
+            goto fatal;
+        }
+        break;
+
+    default:
+        goto fatal;
+    }
+
+    return;
+
+ fatal:
     fatal_trap(regs, false);
 }
 
diff --git a/xen/arch/x86/x86_64/entry-fred.S b/xen/arch/x86/x86_64/entry-fred.S
index 3c3320df22..a1ff9a4a97 100644
--- a/xen/arch/x86/x86_64/entry-fred.S
+++ b/xen/arch/x86/x86_64/entry-fred.S
@@ -15,9 +15,20 @@ FUNC(entry_FRED_R3, 4096)
         mov     %rsp, %rdi
         call    entry_from_pv
 
+#ifdef CONFIG_PV
+        GET_STACK_END(14)
+        movq    STACK_CPUINFO_FIELD(current_vcpu)(%r14), %rbx
+
+        jmp     test_all_events
+#else
+        BUG     /* Not Reached */
+#endif
+END(entry_FRED_R3)
+
+FUNC(eretu_exit_to_guest)
         POP_GPRS
         eretu
-END(entry_FRED_R3)
+END(eretu_exit_to_guest)
 
         /* The Ring0 entrypoint is at Ring3 + 0x100. */
         .org entry_FRED_R3 + 0x100, 0xcc
diff --git a/xen/arch/x86/x86_64/entry.S b/xen/arch/x86/x86_64/entry.S
index 8b83082413..17ca6a4939 100644
--- a/xen/arch/x86/x86_64/entry.S
+++ b/xen/arch/x86/x86_64/entry.S
@@ -63,7 +63,7 @@ UNLIKELY_END(syscall_no_callback)
         /* Conditionally clear DF */
         and   %esi, UREGS_eflags(%rsp)
 /* %rbx: struct vcpu */
-test_all_events:
+LABEL(test_all_events, 0)
         ASSERT_NOT_IN_ATOMIC
         cli                             # tests must not race interrupts
 /*test_softirqs:*/
@@ -152,6 +152,8 @@ END(switch_to_kernel)
 FUNC_LOCAL(restore_all_guest)
         ASSERT_INTERRUPTS_DISABLED
 
+        ALTERNATIVE "", "jmp eretu_exit_to_guest", X86_FEATURE_XEN_FRED
+
         /* Stash guest SPEC_CTRL value while we can read struct vcpu. */
         mov VCPU_arch_msrs(%rbx), %rdx
         mov VCPUMSR_spec_ctrl_raw(%rdx), %r15d
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 10 14:00:23 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Mar 2026 14:00:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1250151.1547614 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzxdH-0002uv-Qc; Tue, 10 Mar 2026 14:00:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1250151.1547614; Tue, 10 Mar 2026 14:00:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzxdH-0002un-O4; Tue, 10 Mar 2026 14:00:23 +0000
Received: by outflank-mailman (input) for mailman id 1250151;
 Tue, 10 Mar 2026 14:00:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vzxdG-0002uh-98
 for xen-changelog@lists.xenproject.org; Tue, 10 Mar 2026 14:00:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzxdG-001e3I-1V
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 14:00:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzxdG-001rqK-0j
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 14:00:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=nIrZHt6EdiF6LgN5Q9Ge7hFas6lJ0/L9bCunI2QkaWk=; b=QJwRscxep1qhqr4+jwTB68W0Jq
	bmYeKv96cqsQQYhfL30sJKtQ/P9r5NVSttee20a1sGNvwc8kloy16OGa49igOYnOT2OBX7zp8RpQP
	PJ+kGIuCcOZuClNGd28ubMdWN9Ndk/gGATwDvfRq+Alb8+ropxEcmUH4OpGwmtb250m0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/pv: ERETU error handling
Message-Id: <E1vzxdG-001rqK-0j@xenbits.xenproject.org>
Date: Tue, 10 Mar 2026 14:00:22 +0000

commit 99edc6c2a0f5886474e017dd0bdd5829e0605455
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Aug 13 15:02:26 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 10 11:58:07 2026 +0000

    x86/pv: ERETU error handling
    
    ERETU can fault for guest reasons, and like IRET needs special handling to
    forward the error into the guest.
    
    As this is largely written in C, take the opportunity to better classify the
    sources of error, and in particular, not forward errors that are actually
    Xen's fault into the guest, opting for a domain crash instead.
    
    Because ERETU does not enable NMIs if it faults, a corner case exists if an
    NMI was taken while in guest context, and the ERETU back out faults.  Recovery
    must involve an ERETS with the interrupted context's NMI flag.
    
    See the comments for full details.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/traps.c             | 115 +++++++++++++++++++++++++++++++++++++++
 xen/arch/x86/x86_64/entry-fred.S |  13 +++++
 2 files changed, 128 insertions(+)

diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index 77af9b90f1..e85c9198cd 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -2349,6 +2349,113 @@ void asmlinkage entry_from_pv(struct cpu_user_regs *regs)
     fatal_trap(regs, false);
 }
 
+void nocall eretu_error_dom_crash(void);
+
+/*
+ * Classify an event at the ERETU instruction, and handle if possible.
+ * Returns @true if handled, @false if the event should continue down the
+ * normal handlers.
+ */
+static bool handle_eretu_event(struct cpu_user_regs *regs)
+{
+    unsigned long recover;
+
+    /*
+     * WARNING: The GPRs in gregs overlaps with regs.  Only gregs->error_code
+     *          and later are legitimate to access.
+     */
+    struct cpu_user_regs *gregs =
+        _p(regs->rsp - offsetof(struct cpu_user_regs, error_code));
+
+    /*
+     * The asynchronous or fatal events (INTR, NMI, #MC, #DF) have been dealt
+     * with, meaning we only have synchronous ones to consider.  Anything
+     * which isn't a hardware exception (e.g. #BP) wants handling normally.
+     */
+    if ( regs->fred_ss.type != X86_ET_HW_EXC )
+        return false;
+
+    /*
+     * Guests are permitted to write non-present GDT/LDT entries.  Therefore
+     * #NP[sel] (%cs) and #SS[sel] (%ss) must be handled as guest errors.  The
+     * only other source of #SS is for a bad %ss-relative memory access in
+     * Xen, and if the stack is that bad, we'll have escalated to #DF.
+     *
+     * #PF can happen from ERETU accessing the GDT/LDT.  Xen may translate
+     * these into #GP for the guest, so must be handled as guest errors.  In
+     * theory we can get #PF for a bad instruction fetch or bad stack access,
+     * but either of these will be fatal and not end up here.
+     */
+    switch ( regs->fred_ss.vector )
+    {
+    case X86_EXC_GP:
+        /*
+         * #GP[0] can occur because of a NULL %cs or %ss (which are a guest
+         * error), but some #GP[0]'s are errors in Xen (ERETU at SL != 0), or
+         * errors of Xen's handling of guest state (bad metadata).
+         *
+         * These magic numbers came from the FRED Spec; they check that ERETU
+         * is trying to return to Ring 3, and that reserved or inapplicable
+         * bits are 0.
+         */
+        if ( regs->error_code == 0 && (gregs->cs & ~3) && (gregs->ss & ~3) &&
+             (regs->fred_cs.sl != 0 ||
+              (gregs->csx    & 0xffffffffffff0003UL) != 3 ||
+              (gregs->rflags & 0xffffffffffc2b02aUL) != 2 ||
+              (gregs->ssx    &         0xfff80003UL) != 3) )
+        {
+            recover = (unsigned long)eretu_error_dom_crash;
+
+            if ( regs->fred_cs.sl )
+                gprintk(XENLOG_ERR, "ERETU at SL %u\n", regs->fred_cs.sl);
+            else
+                gprintk(XENLOG_ERR, "Bad return state: csx %#lx, rflags %#lx, ssx %#x\n",
+                        gregs->csx, gregs->rflags, (unsigned int)gregs->ssx);
+            break;
+        }
+        fallthrough;
+    case X86_EXC_NP:
+    case X86_EXC_SS:
+    case X86_EXC_PF:
+        recover = (unsigned long)entry_FRED_R3;
+        break;
+
+        /*
+         * Handle everything else normally.  e.g. #DB would be debugging
+         * activities in Xen.  In theory we can get #UD if CR4.FRED gets
+         * cleared, but in practice if that were the case we wouldn't be here
+         * handling the result.
+         */
+    default:
+        return false;
+    }
+
+    this_cpu(last_extable_addr) = regs->rip;
+
+    /*
+     * If an NMI was taken in guest context and the ERETU faulted, NMIs will
+     * still be blocked.  Therefore we copy the interrupted frame's NMI status
+     * into our own, and must ERETS as part of recovery.
+     */
+    regs->fred_ss.nmi = gregs->fred_ss.nmi;
+
+    /*
+     * Next, copy the exception information from the current frame back onto
+     * the interrupted frame, preserving the interrupted frame's %cs and %ss.
+     */
+    *cpu_regs_fred_info(regs) = *cpu_regs_fred_info(gregs);
+    gregs->ssx = (regs->ssx & ~0xffff) | gregs->ss;
+    gregs->csx = (regs->csx & ~0xffff) | gregs->cs;
+    gregs->error_code   = regs->error_code;
+    gregs->entry_vector = regs->entry_vector;
+
+    fixup_exception_return(regs, recover, 0);
+
+    return true;
+}
+
+void nocall eretu(void);
+
 void asmlinkage entry_from_xen(struct cpu_user_regs *regs)
 {
     struct fred_info *fi = cpu_regs_fred_info(regs);
@@ -2390,6 +2497,14 @@ void asmlinkage entry_from_xen(struct cpu_user_regs *regs)
     if ( regs->eflags & X86_EFLAGS_IF )
         local_irq_enable();
 
+    /*
+     * An event taken at the ERETU instruction may be because of bad guest
+     * state.  If so, it will need special handling.
+     */
+    if ( unlikely(regs->rip == (unsigned long)eretu) &&
+         handle_eretu_event(regs) )
+        return;
+
     switch ( type )
     {
     case X86_ET_HW_EXC:
diff --git a/xen/arch/x86/x86_64/entry-fred.S b/xen/arch/x86/x86_64/entry-fred.S
index a1ff9a4a97..2fa57beb93 100644
--- a/xen/arch/x86/x86_64/entry-fred.S
+++ b/xen/arch/x86/x86_64/entry-fred.S
@@ -27,9 +27,22 @@ END(entry_FRED_R3)
 
 FUNC(eretu_exit_to_guest)
         POP_GPRS
+
+        /*
+         * Exceptions here are handled by redirecting either to
+         * entry_FRED_R3() (for an error to be passed to the guest), or to
+         * eretu_error_dom_crash() (for a Xen error handling guest state).
+         */
+LABEL(eretu, 0)
         eretu
 END(eretu_exit_to_guest)
 
+FUNC(eretu_error_dom_crash)
+        PUSH_AND_CLEAR_GPRS
+        sti
+        call    asm_domain_crash_synchronous  /* Does not return */
+END(eretu_error_dom_crash)
+
         /* The Ring0 entrypoint is at Ring3 + 0x100. */
         .org entry_FRED_R3 + 0x100, 0xcc
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 10 14:00:33 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Mar 2026 14:00:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1250152.1547619 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzxdR-0002xr-TS; Tue, 10 Mar 2026 14:00:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1250152.1547619; Tue, 10 Mar 2026 14:00:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzxdR-0002xj-Ql; Tue, 10 Mar 2026 14:00:33 +0000
Received: by outflank-mailman (input) for mailman id 1250152;
 Tue, 10 Mar 2026 14:00:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vzxdQ-0002xT-C6
 for xen-changelog@lists.xenproject.org; Tue, 10 Mar 2026 14:00:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzxdQ-001e3P-1n
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 14:00:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzxdQ-001rqp-10
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 14:00:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=hlW8vIi+7VcuhaMFL3KxfPviwrfdBb4EUoQqTmTmdPM=; b=OskznhedNAzHy5KNgbQsYm0VYN
	EpKWZ8BcFjxkbIXBuu2TuM5lDnZEMpjqefLqWt4d7EtIgPXBMgdgiumgzkdob1JZn4g2dY9tyDApU
	Wrgg0IT5hPbXVtQRW+jTB6oiBUtyJxVSxdGSf0HDPCrgisLBysf2fKr6h5feewnB2W8M=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/pv: System call handling in FRED mode
Message-Id: <E1vzxdQ-001rqp-10@xenbits.xenproject.org>
Date: Tue, 10 Mar 2026 14:00:32 +0000

commit 76193ef47d9165a2c85b1f0c9e40c6018c5ef943
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Aug 11 15:55:24 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 10 11:58:23 2026 +0000

    x86/pv: System call handling in FRED mode
    
    Under FRED, entry_from_pv() handles everything, even system call instructions.
    This means more of our logic is written in C now, rather than assembly.
    
    In order to facilitate this, introduce pv_inject_callback(), which reuses
    struct trap_bounce infrastructure to inject the syscall/sysenter callbacks.
    This in turns requires some !PV compatibility for pv_inject_callback() and
    pv_hypercall() which can both be ASSERT_UNREACHABLE().
    
    For each of INT $N, SYSCALL and SYSENTER, FRED gives us interrupted context
    which was previously lost.  As the guest can't see FRED, Xen has to lose state
    in the same way to maintain the prior behaviour.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/include/asm/domain.h    |   2 +
 xen/arch/x86/include/asm/hypercall.h |   2 -
 xen/arch/x86/pv/traps.c              |  39 +++++++++++
 xen/arch/x86/traps.c                 | 126 +++++++++++++++++++++++++++++++++++
 4 files changed, 167 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/include/asm/domain.h b/xen/arch/x86/include/asm/domain.h
index 94b0cf7f1d..ad7f6adb2c 100644
--- a/xen/arch/x86/include/asm/domain.h
+++ b/xen/arch/x86/include/asm/domain.h
@@ -725,6 +725,8 @@ void arch_vcpu_regs_init(struct vcpu *v);
 struct vcpu_hvm_context;
 int arch_set_info_hvm_guest(struct vcpu *v, const struct vcpu_hvm_context *ctx);
 
+void pv_inject_callback(unsigned int type);
+
 #ifdef CONFIG_PV
 void pv_inject_event(const struct x86_event *event);
 #else
diff --git a/xen/arch/x86/include/asm/hypercall.h b/xen/arch/x86/include/asm/hypercall.h
index bf2f0e169a..d042a61d17 100644
--- a/xen/arch/x86/include/asm/hypercall.h
+++ b/xen/arch/x86/include/asm/hypercall.h
@@ -18,9 +18,7 @@
 
 #define __HYPERVISOR_paging_domctl_cont __HYPERVISOR_arch_1
 
-#ifdef CONFIG_PV
 void pv_hypercall(struct cpu_user_regs *regs);
-#endif
 
 void pv_ring1_init_hypercall_page(void *p);
 void pv_ring3_init_hypercall_page(void *p);
diff --git a/xen/arch/x86/pv/traps.c b/xen/arch/x86/pv/traps.c
index b0395b9914..c863ab9d37 100644
--- a/xen/arch/x86/pv/traps.c
+++ b/xen/arch/x86/pv/traps.c
@@ -20,6 +20,8 @@
 #include <asm/shared.h>
 #include <asm/traps.h>
 
+#include <public/callback.h>
+
 void pv_inject_event(const struct x86_event *event)
 {
     struct vcpu *curr = current;
@@ -96,6 +98,43 @@ void pv_inject_event(const struct x86_event *event)
     }
 }
 
+void pv_inject_callback(unsigned int type)
+{
+    struct vcpu *curr = current;
+    struct trap_bounce *tb = &curr->arch.pv.trap_bounce;
+    unsigned long rip;
+    bool irq;
+
+    ASSERT(is_pv_64bit_vcpu(curr));
+
+    switch ( type )
+    {
+    case CALLBACKTYPE_syscall:
+        rip = curr->arch.pv.syscall_callback_eip;
+        irq = curr->arch.pv.vgc_flags & VGCF_syscall_disables_events;
+        break;
+
+    case CALLBACKTYPE_syscall32:
+        rip = curr->arch.pv.syscall32_callback_eip;
+        irq = curr->arch.pv.syscall32_disables_events;
+        break;
+
+    case CALLBACKTYPE_sysenter:
+        rip = curr->arch.pv.sysenter_callback_eip;
+        irq = curr->arch.pv.sysenter_disables_events;
+        break;
+
+    default:
+        ASSERT_UNREACHABLE();
+        rip = 0;
+        irq = false;
+        break;
+    }
+
+    tb->flags = TBF_EXCEPTION | (irq ? TBF_INTERRUPT : 0);
+    tb->eip = rip;
+}
+
 /*
  * Called from asm to set up the MCE trapbounce info.
  * Returns false no callback is set up, else true.
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index e85c9198cd..f5523fec0a 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -18,6 +18,7 @@
 #include <xen/delay.h>
 #include <xen/domain_page.h>
 #include <xen/guest_access.h>
+#include <xen/hypercall.h>
 #include <xen/init.h>
 #include <xen/mm.h>
 #include <xen/paging.h>
@@ -51,6 +52,8 @@
 #include <asm/traps.h>
 #include <asm/uaccess.h>
 
+#include <public/callback.h>
+
 /*
  * opt_nmi: one of 'ignore', 'dom0', or 'fatal'.
  *  fatal:  Xen prints diagnostic message and then hangs.
@@ -2268,6 +2271,7 @@ void asmlinkage check_ist_exit(const struct cpu_user_regs *regs, bool ist_exit)
 void asmlinkage entry_from_pv(struct cpu_user_regs *regs)
 {
     struct fred_info *fi = cpu_regs_fred_info(regs);
+    struct vcpu *curr = current;
     uint8_t type = regs->fred_ss.type;
     uint8_t vec = regs->fred_ss.vector;
 
@@ -2310,6 +2314,38 @@ void asmlinkage entry_from_pv(struct cpu_user_regs *regs)
 
     switch ( type )
     {
+    case X86_ET_SW_INT:
+        /*
+         * For better or worse, Xen writes IDT vectors 3 and 4 with DPL3 (so
+         * INT3/INTO work), making INT $3/4 indistinguishable, and the guest
+         * choice of DPL for these vectors is ignored.
+         *
+         * Have them fall through into X86_ET_HW_EXC, as #BP in particular
+         * needs handling by do_int3() in case an external debugger is
+         * attached.
+         *
+         * As the event type is provided, INT $N instructions don't need #GP
+         * tricks to spot, and INT $0x80 doesn't need a fastpath.  As the
+         * guest is necessary PV64, INT $0x82 has no special meaning either.
+         *
+         * When converting to a fault, hardware finally gives us enough
+         * information to account for prefixes, so provide the more correct
+         * behaviour rather than assuming the instruction was two bytes long.
+         */
+        if ( vec != X86_EXC_BP && vec != X86_EXC_OF )
+        {
+            const struct trap_info *ti = &curr->arch.pv.trap_ctxt[vec];
+
+            if ( permit_softint(TI_GET_DPL(ti), curr, regs) )
+                pv_inject_sw_interrupt(vec);
+            else
+            {
+                regs->rip -= regs->fred_ss.insnlen;
+                pv_inject_hw_exception(X86_EXC_GP, (vec << 3) | X86_XEC_IDT);
+            }
+            break;
+        }
+        fallthrough;
     case X86_ET_HW_EXC:
     case X86_ET_PRIV_SW_EXC:
     case X86_ET_SW_EXC:
@@ -2339,6 +2375,96 @@ void asmlinkage entry_from_pv(struct cpu_user_regs *regs)
         }
         break;
 
+    case X86_ET_OTHER:
+        switch ( regs->fred_ss.vector )
+        {
+        case 1: /* SYSCALL */
+        {
+            /*
+             * FRED delivery preserves the interrupted %cs/%ss, but previously
+             * SYSCALL lost the interrupted selectors, and SYSRET forced the
+             * use of the ones in MSR_STAR.
+             *
+             * The guest isn't aware of FRED, so recreate the legacy
+             * behaviour.
+             *
+             * The non-FRED SYSCALL path sets TRAP_syscall in entry_vector to
+             * signal that SYSRET can be used, but this isn't relevant in FRED
+             * mode.
+             *
+             * When setting the selectors, clear all upper metadata again for
+             * backwards compatibility.  In particular fred_ss.swint becomes
+             * pend_DB on ERETx, and nothing else in the pv_hypercall() would
+             * clean up.
+             *
+             * When converting to a fault, hardware finally gives us enough
+             * information to account for prefixes, so provide the more
+             * correct behaviour rather than assuming the instruction was two
+             * bytes long.
+             */
+            bool l = regs->fred_ss.l;
+            unsigned int len = regs->fred_ss.insnlen;
+
+            regs->ssx = l ? FLAT_KERNEL_SS   : FLAT_USER_SS32;
+            regs->csx = l ? FLAT_KERNEL_CS64 : FLAT_USER_CS32;
+
+            if ( guest_kernel_mode(curr, regs) )
+                pv_hypercall(regs);
+            else if ( (l ? curr->arch.pv.syscall_callback_eip
+                         : curr->arch.pv.syscall32_callback_eip) == 0 )
+            {
+                regs->rip -= len;
+                pv_inject_hw_exception(X86_EXC_UD, X86_EVENT_NO_EC);
+            }
+            else
+            {
+                /*
+                 * The PV ABI, given no virtual SYSCALL_MASK, hardcodes that
+                 * DF is cleared.  Other flags are handled in the same way as
+                 * interrupts and exceptions in create_bounce_frame().
+                 */
+                regs->eflags &= ~X86_EFLAGS_DF;
+                pv_inject_callback(l ? CALLBACKTYPE_syscall
+                                     : CALLBACKTYPE_syscall32);
+            }
+            break;
+        }
+
+        case 2: /* SYSENTER */
+        {
+            /*
+             * FRED delivery preserves the interrupted state, but previously
+             * SYSENTER discarded almost everything.
+             *
+             * The guest isn't aware of FRED, so recreate the legacy
+             * behaviour.
+             *
+             * When setting the selectors, clear all upper metadata.  In
+             * particular fred_ss.swint becomes pend_DB on ERETx.
+             *
+             * When converting to a fault, hardware finally gives us enough
+             * information to account for prefixes, so provide the more
+             * correct behaviour rather than assuming the instruction was two
+             * bytes long.
+             */
+            regs->ssx = FLAT_USER_SS;
+            regs->rsp = 0;
+            regs->eflags &= ~(X86_EFLAGS_VM | X86_EFLAGS_IF);
+            regs->csx = 3;
+            regs->rip = 0;
+
+            if ( !curr->arch.pv.sysenter_callback_eip )
+                pv_inject_hw_exception(X86_EXC_GP, 0);
+            else
+                pv_inject_callback(CALLBACKTYPE_sysenter);
+            break;
+        }
+
+        default:
+            goto fatal;
+        }
+        break;
+
     default:
         goto fatal;
     }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 10 14:00:43 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Mar 2026 14:00:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1250154.1547623 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzxdb-000307-Uq; Tue, 10 Mar 2026 14:00:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1250154.1547623; Tue, 10 Mar 2026 14:00:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzxdb-0002zz-SB; Tue, 10 Mar 2026 14:00:43 +0000
Received: by outflank-mailman (input) for mailman id 1250154;
 Tue, 10 Mar 2026 14:00:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vzxda-0002zn-Ex
 for xen-changelog@lists.xenproject.org; Tue, 10 Mar 2026 14:00:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzxda-001e5T-25
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 14:00:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzxda-001rtX-1J
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 14:00:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=AIW4JW+X0dSzCuoS+RyCklsE8gAa+3XoVdsD1p6ct/c=; b=Lc2E2/EKoJnWuiezMC0hD5IAlL
	/nzaz793HGgQ+Cl6Xebye7s/Vga/IWSlfF1BQwXmY7qXNJsDMyjN5DR0my0seMVftNx6Pn+QwVXJX
	EHDf6C+F1pEV1nnvgYXZTvcnRQnPbqL6qGYnI2sfzPyNgpWxNTfDAkuF1mbZAuYDjv4s=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/traps: Use fatal_trap() for #UD and #GP
Message-Id: <E1vzxda-001rtX-1J@xenbits.xenproject.org>
Date: Tue, 10 Mar 2026 14:00:42 +0000

commit 705784e51212cd77031e95ee4ec8799c25e69fb5
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Feb 10 14:50:56 2026 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 10 11:58:33 2026 +0000

    x86/traps: Use fatal_trap() for #UD and #GP
    
    This renders the diagnostics in a more uniform way.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/traps.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index f5523fec0a..b6b1197697 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -1375,8 +1375,7 @@ void asmlinkage do_invalid_op(struct cpu_user_regs *regs)
     if ( likely(extable_fixup(regs, true)) )
         return;
 
-    show_execution_state(regs);
-    panic("FATAL TRAP: vector = %d (invalid opcode)\n", X86_EXC_UD);
+    fatal_trap(regs, false);
 }
 
 void asmlinkage do_int3(struct cpu_user_regs *regs)
@@ -1475,8 +1474,7 @@ void do_general_protection(struct cpu_user_regs *regs)
         return;
 
  hardware_gp:
-    show_execution_state(regs);
-    panic("GENERAL PROTECTION FAULT\n[error_code=%04x]\n", regs->error_code);
+    fatal_trap(regs, false);
 }
 
 #ifdef CONFIG_PV
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 10 14:55:08 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Mar 2026 14:55:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1250187.1547645 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzyUC-0001St-1x; Tue, 10 Mar 2026 14:55:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1250187.1547645; Tue, 10 Mar 2026 14:55:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzyUB-0001Sl-VG; Tue, 10 Mar 2026 14:55:03 +0000
Received: by outflank-mailman (input) for mailman id 1250187;
 Tue, 10 Mar 2026 14:55:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vzyUA-0001Sf-6J
 for xen-changelog@lists.xenproject.org; Tue, 10 Mar 2026 14:55:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzyUA-001f09-0o
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 14:55:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzyU9-001vaM-32
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 14:55:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=2OUD/fTBA/CZWFpF8NvpfL0YTmeR+P8LTkj795JFDZw=; b=iLrEnd7BcJ/mf70XE8DwOd4WP6
	UGCOZbdPKqCXMw0ZSz+WeNLTmS40Ke3JkhAAqd2G4cWcM5AzrTdjf+hD0RJKVgd/GLAJYAcaxHS3n
	NKeYVYGnqpIcRgouQ0ryLcR3gha/qaw5sj138G/M+XE4/5bVreGg2rN+Tplb26J3W0PQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.21] x86/MCE: restore CPU vendor reporting to the outside world
Message-Id: <E1vzyU9-001vaM-32@xenbits.xenproject.org>
Date: Tue, 10 Mar 2026 14:55:01 +0000

commit 93614ffa48f2577f5a9bb3043884ebc7432d0b8e
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Mar 10 14:36:11 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 10 14:36:11 2026 +0100

    x86/MCE: restore CPU vendor reporting to the outside world
    
    The records reported used to contain Linux enumerators. We first broke
    that connection when purging unused ones, and then again when switching to
    the bit mask forms.
    
    Fixes: 408413051144 ("x86/cpu: Drop unused X86_VENDOR_* values")
    Fixes: 0cd074144cbb ("x86/cpu: Renumber X86_VENDOR_* to form a bitmap")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
    master commit: a94c5fd8290a55461c599b8baad309df0d929f1f
    master date: 2026-02-23 08:39:58 +0100
---
 xen/arch/x86/cpu/mcheck/mce.c | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/cpu/mcheck/mce.c b/xen/arch/x86/cpu/mcheck/mce.c
index 9277781bff..9a91807cfb 100644
--- a/xen/arch/x86/cpu/mcheck/mce.c
+++ b/xen/arch/x86/cpu/mcheck/mce.c
@@ -858,6 +858,22 @@ void *x86_mcinfo_reserve(struct mc_info *mi,
     return mic_index;
 }
 
+/* Linux values need using when reporting CPU vendors to the outside. */
+static unsigned int xen2linux_vendor(unsigned int vendor)
+{
+    switch ( vendor )
+    {
+    case X86_VENDOR_INTEL:    return 0;
+    case X86_VENDOR_AMD:      return 2;
+    case X86_VENDOR_CENTAUR:  return 5;
+    case X86_VENDOR_HYGON:    return 9;
+    case X86_VENDOR_SHANGHAI: return 10; /* X86_VENDOR_ZHAOXIN */
+    default: break;
+    }
+
+    return 0xff; /* X86_VENDOR_UNKNOWN */
+}
+
 static void x86_mcinfo_apei_save(
     struct mcinfo_global *mc_global, struct mcinfo_bank *mc_bank)
 {
@@ -866,7 +882,7 @@ static void x86_mcinfo_apei_save(
     memset(&m, 0, sizeof(struct mce));
 
     m.cpu = mc_global->mc_coreid;
-    m.cpuvendor = boot_cpu_data.x86_vendor;
+    m.cpuvendor = xen2linux_vendor(boot_cpu_data.x86_vendor);
     m.cpuid = cpuid_eax(1);
     m.socketid = mc_global->mc_socketid;
     m.apicid = mc_global->mc_apicid;
@@ -968,7 +984,7 @@ static void cf_check __maybe_unused do_mc_get_cpu_info(void *v)
                         &xcp->mc_ncores_active, &xcp->mc_nthreads);
     xcp->mc_cpuid_level = c->cpuid_level;
     xcp->mc_family = c->x86;
-    xcp->mc_vendor = c->x86_vendor;
+    xcp->mc_vendor = xen2linux_vendor(c->x86_vendor);
     xcp->mc_model = c->x86_model;
     xcp->mc_step = c->x86_mask;
     xcp->mc_cache_size = c->x86_cache_size;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.21


From xen-changelog-bounces@lists.xenproject.org Tue Mar 10 14:55:22 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Mar 2026 14:55:22 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1250188.1547648 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzyUM-0001Uk-36; Tue, 10 Mar 2026 14:55:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1250188.1547648; Tue, 10 Mar 2026 14:55:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzyUM-0001Uc-0V; Tue, 10 Mar 2026 14:55:14 +0000
Received: by outflank-mailman (input) for mailman id 1250188;
 Tue, 10 Mar 2026 14:55:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vzyUK-0001UJ-67
 for xen-changelog@lists.xenproject.org; Tue, 10 Mar 2026 14:55:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzyUK-001f0D-19
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 14:55:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzyUK-001vbI-0J
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 14:55:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=4QyY+jT40rXb8i5zaivnu+GnPtCcayZpYSMKc07wIrM=; b=4jF6+CtZlwYE31mR8/LrwgXoSE
	/pdLvw6uu+Uz/IkK73jclevW0SjJF/mDXV+JZa/Ta1E4UVZtuQICEcVa1ECoQAla7bNkSdjgnPkt0
	a63vq29av8IBdhOyhcMVkvBFbigtqrd2pEaCdH0Kzn8DsIdF7k7oKA0cLN2SSLMtOnNs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.21] x86/pv: Don't assume that INT $imm8 instructions are two bytes long
Message-Id: <E1vzyUK-001vbI-0J@xenbits.xenproject.org>
Date: Tue, 10 Mar 2026 14:55:12 +0000

commit 805e2b8ada7c4e44a08e9c36117fc1b2180df675
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Mar 10 14:36:41 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 10 14:36:41 2026 +0100

    x86/pv: Don't assume that INT $imm8 instructions are two bytes long
    
    For INT $N instructions (besides $0x80 for which there is a dedicated fast
    path), handling is mostly fault-based because of DPL0 gates in the IDT.  This
    means that when the guest kernel allows the instruction too, Xen must
    increment %rip to the end of the instruction before passing a trap to the
    guest kernel.
    
    When an INT $N instruction has a prefix, it's longer than two bytes, and Xen
    will deliver the "trap" with %rip pointing into the middle of the instruction.
    
    Introduce a new pv_emulate_sw_interrupt() which uses x86_insn_length() to
    determine the instruction length, rather than assuming two.
    
    This is a change in behaviour for PV guests, but the prior behaviour cannot
    reasonably be said to be intentional.
    
    This change does not affect the INT $0x80 fastpath.  Prefixed INT $N
    instructions occur almost exclusively in test code or exploits, and INT $0x80
    appears to be the only user-usable interrupt gate in contemporary PV guests.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: a934a600c45486b7acfe8abc3658e284e64e5dd5
    master date: 2026-03-03 15:15:53 +0000
---
 xen/arch/x86/include/asm/pv/traps.h |  2 ++
 xen/arch/x86/pv/emul-priv-op.c      | 49 +++++++++++++++++++++++++++++++++++++
 xen/arch/x86/traps.c                |  3 +--
 3 files changed, 52 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/include/asm/pv/traps.h b/xen/arch/x86/include/asm/pv/traps.h
index 8c31d5a793..dbfb22e6d2 100644
--- a/xen/arch/x86/include/asm/pv/traps.h
+++ b/xen/arch/x86/include/asm/pv/traps.h
@@ -17,6 +17,7 @@
 int pv_raise_nmi(struct vcpu *v);
 
 int pv_emulate_privileged_op(struct cpu_user_regs *regs);
+void pv_emulate_sw_interrupt(struct cpu_user_regs *regs);
 void pv_emulate_gate_op(struct cpu_user_regs *regs);
 bool pv_emulate_invalid_op(struct cpu_user_regs *regs);
 
@@ -33,6 +34,7 @@ static inline bool pv_trap_callback_registered(const struct vcpu *v,
 static inline int pv_raise_nmi(struct vcpu *v) { return -EOPNOTSUPP; }
 
 static inline int pv_emulate_privileged_op(struct cpu_user_regs *regs) { return 0; }
+static inline void pv_emulate_sw_interrupt(struct cpu_user_regs *regs) {}
 static inline void pv_emulate_gate_op(struct cpu_user_regs *regs) {}
 static inline bool pv_emulate_invalid_op(struct cpu_user_regs *regs) { return true; }
 
diff --git a/xen/arch/x86/pv/emul-priv-op.c b/xen/arch/x86/pv/emul-priv-op.c
index 225d4cff03..0ba446d812 100644
--- a/xen/arch/x86/pv/emul-priv-op.c
+++ b/xen/arch/x86/pv/emul-priv-op.c
@@ -8,6 +8,7 @@
  */
 
 #include <xen/domain_page.h>
+#include <xen/err.h>
 #include <xen/event.h>
 #include <xen/guest_access.h>
 #include <xen/hypercall.h>
@@ -1384,6 +1385,54 @@ int pv_emulate_privileged_op(struct cpu_user_regs *regs)
     return 0;
 }
 
+/*
+ * Hardware already decoded the INT $N instruction and determined that there
+ * was a permission issue (i.e. the DPL violation intended to trigger #GP).
+ * Xen has already determined that the guest kernel has permitted this
+ * software interrupt.
+ *
+ * All that is needed is the instruction length, to turn the fault into a
+ * trap.  All errors are turned back into the original #GP, as that's the
+ * action that really happened.
+ */
+void pv_emulate_sw_interrupt(struct cpu_user_regs *regs)
+{
+    struct vcpu *curr = current;
+    struct domain *currd = curr->domain;
+    struct priv_op_ctxt ctxt = {
+        .ctxt.regs = regs,
+        .ctxt.lma = !is_pv_32bit_domain(currd),
+    };
+    struct x86_emulate_state *state;
+    uint8_t vector = regs->error_code >> 3;
+    unsigned int len, ar;
+
+    if ( !pv_emul_read_descriptor(regs->cs, curr, &ctxt.cs.base,
+                                  &ctxt.cs.limit, &ar, 1) ||
+         !(ar & _SEGMENT_S) ||
+         !(ar & _SEGMENT_P) ||
+         !(ar & _SEGMENT_CODE) )
+        goto error;
+
+    state = x86_decode_insn(&ctxt.ctxt, insn_fetch);
+    if ( IS_ERR_OR_NULL(state) )
+        goto error;
+
+    len = x86_insn_length(state, &ctxt.ctxt);
+    x86_emulate_free_state(state);
+
+    /* Note: Checked slightly late to simplify 'state' handling. */
+    if ( ctxt.ctxt.opcode != 0xcd /* INT $imm8 */ )
+        goto error;
+
+    regs->rip += len;
+    pv_inject_sw_interrupt(vector);
+    return;
+
+ error:
+    pv_inject_hw_exception(X86_EXC_GP, regs->error_code);
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index 0c5393cb21..6f6ce387a1 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -1365,8 +1365,7 @@ void do_general_protection(struct cpu_user_regs *regs)
 
         if ( permit_softint(TI_GET_DPL(ti), v, regs) )
         {
-            regs->rip += 2;
-            pv_inject_sw_interrupt(vector);
+            pv_emulate_sw_interrupt(regs);
             return;
         }
     }
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.21


From xen-changelog-bounces@lists.xenproject.org Tue Mar 10 14:55:24 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Mar 2026 14:55:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1250189.1547654 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzyUW-0001X5-5Y; Tue, 10 Mar 2026 14:55:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1250189.1547654; Tue, 10 Mar 2026 14:55:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzyUW-0001Wv-1w; Tue, 10 Mar 2026 14:55:24 +0000
Received: by outflank-mailman (input) for mailman id 1250189;
 Tue, 10 Mar 2026 14:55:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vzyUU-0001Wa-8n
 for xen-changelog@lists.xenproject.org; Tue, 10 Mar 2026 14:55:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzyUU-001f0H-1T
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 14:55:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzyUU-001vcH-0e
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 14:55:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=REZbuZhxWz7c6YUUrI04sagyDiwc+bC/3MI/dxCYYIw=; b=4KCNH2hkeegC8kzUvagJyLcnQP
	XdOjKOzZxlUEWGJBFC29B/OpG7O2PVY0jSKR2TXAgZqeQFRofEL+q1HBDQ31iJwX6BeQ5ib7RzfGy
	cAjd0/FW3SuLv0frzfCBu8QeaYKUVeRlJNB3vNVB7/WNmO+oVKuBY9y2hogJTgiF+Sy8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.21] x86/ucode: Support discrete modules being CPIO archives
Message-Id: <E1vzyUU-001vcH-0e@xenbits.xenproject.org>
Date: Tue, 10 Mar 2026 14:55:22 +0000

commit 8f3b6375919a6e99b5259457df5d760c2eed61e0
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Mar 10 14:37:00 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 10 14:37:00 2026 +0100

    x86/ucode: Support discrete modules being CPIO archives
    
    Multiple downstream distros have tried passing discrete CPIO archives and
    tripped over this not working.  It turns out to be easy to support, so do so.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Tested-by: Teddy Astie <teddy.astie@vates.tech>
    [jb: doc change dropped as inapplicable to the older form]
    master commit: 878a9cfa451878dcba6108ae5b7879c80f049661
    master date: 2026-03-03 15:15:53 +0000
---
 CHANGELOG.md                      |  6 ++++++
 xen/arch/x86/cpu/microcode/core.c | 20 +++++++++++++++++++-
 2 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 572f985685..527a51ec13 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,12 @@ Notable changes to Xen will be documented in this file.
 
 The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
 
+## [4.21.1](https://xenbits.xenproject.org/gitweb/?p=xen.git;a=shortlog;h=RELEASE-4.21.1)
+
+### Added
+ - On x86:
+   - Support for CPIO microcode in discrete multiboot modules.
+
 ## [4.21.0](https://xenbits.xenproject.org/gitweb/?p=xen.git;a=shortlog;h=RELEASE-4.21.0) - 2025-11-19
 
 ### Changed
diff --git a/xen/arch/x86/cpu/microcode/core.c b/xen/arch/x86/cpu/microcode/core.c
index ecee400f28..17540fc2e6 100644
--- a/xen/arch/x86/cpu/microcode/core.c
+++ b/xen/arch/x86/cpu/microcode/core.c
@@ -749,6 +749,7 @@ static int __init early_microcode_load(struct boot_info *bi)
     void *data = NULL;
     size_t size;
     struct microcode_patch *patch;
+    struct cpio_data cd;
     int idx = opt_mod_idx;
     int rc;
 
@@ -765,7 +766,6 @@ static int __init early_microcode_load(struct boot_info *bi)
         for ( idx = 0; idx < bi->nr_modules; ++idx )
         {
             const struct boot_module *bm = &bi->mods[idx];
-            struct cpio_data cd;
 
             /* Search anything unclaimed or likely to be a CPIO archive. */
             if ( bm->kind != BOOTMOD_UNKNOWN && bm->kind != BOOTMOD_RAMDISK )
@@ -833,6 +833,24 @@ static int __init early_microcode_load(struct boot_info *bi)
                    idx, size);
             return -ENODEV;
         }
+
+        /*
+         * If this blob appears to be a CPIO archive, try interpreting it as
+         * one.  Otherwise treat it as a raw vendor blob.
+         */
+        cd = find_cpio_data(ucode_ops.cpio_path, data, size);
+        if ( cd.data )
+        {
+            data = cd.data;
+            size = cd.size;
+
+            /*
+             * (Ab)use opt_scan to inform microcode_init_cache() that
+             * early_mod_idx refers to a CPIO archive.
+             */
+            opt_scan = true;
+        }
+
         goto found;
     }
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.21


From xen-changelog-bounces@lists.xenproject.org Tue Mar 10 14:55:34 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Mar 2026 14:55:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1250190.1547657 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzyUg-0001Zx-7Z; Tue, 10 Mar 2026 14:55:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1250190.1547657; Tue, 10 Mar 2026 14:55:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzyUg-0001Zp-4m; Tue, 10 Mar 2026 14:55:34 +0000
Received: by outflank-mailman (input) for mailman id 1250190;
 Tue, 10 Mar 2026 14:55:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vzyUe-0001Za-BY
 for xen-changelog@lists.xenproject.org; Tue, 10 Mar 2026 14:55:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzyUe-001f0M-1l
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 14:55:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzyUe-001vdH-0y
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 14:55:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Rr7lkcKVo8it0lkqJMvXzJPEG6GTaIlqvhIR359jMaU=; b=VUFXKtQXwnHdeTMHvwCBWODfAT
	Rr1ZJqWfMm8zXQL2+U0610oeSoS/mZp2mSM9okIxJEPKYM7uJTHKts2Vsoj2pRISysahm+OBbMJPk
	i5ASu6X8EmyCQ5nAFhhqpEdn3VW4wYN+CdSv2mwJUIMKNEZzSZkzoXjECIrnp9lMXwu0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.21] vpci/msix: check for BARs enabled in vpci_make_msix_hole
Message-Id: <E1vzyUe-001vdH-0y@xenbits.xenproject.org>
Date: Tue, 10 Mar 2026 14:55:32 +0000

commit 999c6fadf71485ea070add4cdb76926b6a9574ff
Author:     Stewart Hildebrand <stewart.hildebrand@amd.com>
AuthorDate: Tue Mar 10 14:37:20 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 10 14:37:20 2026 +0100

    vpci/msix: check for BARs enabled in vpci_make_msix_hole
    
    A hotplugged PCI device may be added uninitialized. In particular,
    memory decoding might be disabled and the BARs might be zeroed. In this
    case, the BARs will not be mapped in p2m. However, vpci_make_msix_hole()
    unconditionally attempts to punch holes in p2m, leading to init_msix()
    failing:
    
    (XEN) d0v0 0000:01:00.0: existing mapping (mfn: 1c1880 type: 0) at 0 clobbers MSIX MMIO area
    (XEN) d0 0000:01:00.0: init legacy cap 17 fail rc=-17, mask it
    
    vpci_make_msix_hole() should only attempt to punch holes if the BARs
    containing the MSI-X/PBA tables are mapped in p2m. Introduce a helper
    for checking if a BAR is enabled, and add a check for the situation
    inside vpci_make_msix_hole().
    
    As a result of the newly introduced checks in vpci_make_msix_hole(),
    move the call to vpci_make_msix_hole() within modify_decoding() to after
    setting ->enabled.
    
    Fixes: ee2eb6849d50 ("vpci: Refactor REGISTER_VPCI_INIT")
    Signed-off-by: Stewart Hildebrand <stewart.hildebrand@amd.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 7c24d58a6e641e2979978c5abb312bff877dede3
    master date: 2026-03-05 09:27:50 +0100
---
 xen/drivers/vpci/header.c | 26 +++++++++++++-------------
 xen/drivers/vpci/msix.c   |  3 +++
 xen/include/xen/vpci.h    |  6 ++++++
 3 files changed, 22 insertions(+), 13 deletions(-)

diff --git a/xen/drivers/vpci/header.c b/xen/drivers/vpci/header.c
index aae663bbf5..a3e8d0ec82 100644
--- a/xen/drivers/vpci/header.c
+++ b/xen/drivers/vpci/header.c
@@ -122,19 +122,6 @@ static void modify_decoding(const struct pci_dev *pdev, uint16_t cmd,
     bool map = cmd & PCI_COMMAND_MEMORY;
     unsigned int i;
 
-    /*
-     * Make sure there are no mappings in the MSIX MMIO areas, so that accesses
-     * can be trapped (and emulated) by Xen when the memory decoding bit is
-     * enabled.
-     *
-     * FIXME: punching holes after the p2m has been set up might be racy for
-     * DomU usage, needs to be revisited.
-     */
-#ifdef CONFIG_HAS_PCI_MSI
-    if ( map && !rom_only && vpci_make_msix_hole(pdev) )
-        return;
-#endif
-
     for ( i = 0; i < ARRAY_SIZE(header->bars); i++ )
     {
         struct vpci_bar *bar = &header->bars[i];
@@ -164,6 +151,19 @@ static void modify_decoding(const struct pci_dev *pdev, uint16_t cmd,
             bar->enabled = map;
     }
 
+    /*
+     * Make sure there are no mappings in the MSIX MMIO areas, so that accesses
+     * can be trapped (and emulated) by Xen when the memory decoding bit is
+     * enabled.
+     *
+     * FIXME: punching holes after the p2m has been set up might be racy for
+     * DomU usage, needs to be revisited.
+     */
+#ifdef CONFIG_HAS_PCI_MSI
+    if ( map && !rom_only && vpci_make_msix_hole(pdev) )
+        return;
+#endif
+
     if ( !rom_only )
     {
         pci_conf_write16(pdev->sbdf, PCI_COMMAND, cmd);
diff --git a/xen/drivers/vpci/msix.c b/xen/drivers/vpci/msix.c
index 032e471bb1..955fad3304 100644
--- a/xen/drivers/vpci/msix.c
+++ b/xen/drivers/vpci/msix.c
@@ -605,6 +605,9 @@ int vpci_make_msix_hole(const struct pci_dev *pdev)
         unsigned long end = PFN_DOWN(vmsix_table_addr(pdev->vpci, i) +
                                      vmsix_table_size(pdev->vpci, i) - 1);
 
+        if ( !vmsix_table_bar_valid(pdev->vpci, i) )
+            continue;
+
         for ( ; start <= end; start++ )
         {
             p2m_type_t t;
diff --git a/xen/include/xen/vpci.h b/xen/include/xen/vpci.h
index 9ae75d946a..50d0ad05a6 100644
--- a/xen/include/xen/vpci.h
+++ b/xen/include/xen/vpci.h
@@ -271,6 +271,12 @@ static inline paddr_t vmsix_table_addr(const struct vpci *vpci, unsigned int nr)
            (vpci->msix->tables[nr] & ~PCI_MSIX_BIRMASK);
 }
 
+static inline bool vmsix_table_bar_valid(const struct vpci *vpci,
+                                         unsigned int nr)
+{
+    return vpci->header.bars[vpci->msix->tables[nr] & PCI_MSIX_BIRMASK].enabled;
+}
+
 /*
  * Note regarding the size calculation of the PBA: the spec mentions "The last
  * QWORD will not necessarily be fully populated", so it implies that the PBA
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.21


From xen-changelog-bounces@lists.xenproject.org Tue Mar 10 14:55:43 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Mar 2026 14:55:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1250191.1547661 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzyUp-0001bw-8x; Tue, 10 Mar 2026 14:55:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1250191.1547661; Tue, 10 Mar 2026 14:55:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzyUp-0001bo-6E; Tue, 10 Mar 2026 14:55:43 +0000
Received: by outflank-mailman (input) for mailman id 1250191;
 Tue, 10 Mar 2026 14:55:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vzyUo-0001bi-Eo
 for xen-changelog@lists.xenproject.org; Tue, 10 Mar 2026 14:55:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzyUo-001f2P-23
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 14:55:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzyUo-001vgN-1F
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 14:55:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=YerWGwctrl15OaHt6QItrEQAMyrQus4KinZWgY/QChM=; b=dZ6xXuk1cK+i4xz9cjeTqCxnIx
	CmZ7JE2A2PkkIlLmyz6dNR3sjPaIJzdWHngyds5PGnlsmsm2J8QQ3U6zli6GPwq8veOp+XO44Ep0b
	ROyrT2oOQSjHxXpmIior/edQzmjnqkBbd+HWQyzlQ+ZJph9SI3rS98OfkVVMLbIPvO+M=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.21] domain: move vmtrace_alloc_buffer() invocation in vcpu_create()
Message-Id: <E1vzyUo-001vgN-1F@xenbits.xenproject.org>
Date: Tue, 10 Mar 2026 14:55:42 +0000

commit 1c72306b1f0b4dc533954f678361044f8083dccc
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Mar 10 14:37:45 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 10 14:37:45 2026 +0100

    domain: move vmtrace_alloc_buffer() invocation in vcpu_create()
    
    The label used upon the function failing is wrong. Instead of correcting
    the label, move the invocation up a little, to also avoid it altogether
    for the idle domain (where ->vmtrace_size would be zero, and hence the
    function would bail right away anyway).
    
    Fixes: 217dd79ee292 ("xen/domain: Add vmtrace_size domain creation parameter")
    Reported-by: Roger Pau Monné <roger.pau@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: adfbdaa347d05e53c8c61ad00a6851bd5b82c760
    master date: 2026-03-10 09:23:25 +0100
---
 xen/common/domain.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/xen/common/domain.c b/xen/common/domain.c
index ac06532544..75c7da16e2 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -452,14 +452,14 @@ struct vcpu *vcpu_create(struct domain *d, unsigned int vcpu_id)
         set_bit(_VPF_down, &v->pause_flags);
         vcpu_info_reset(v);
         init_waitqueue_vcpu(v);
+
+        if ( vmtrace_alloc_buffer(v) != 0 )
+            goto fail_wq;
     }
 
     if ( sched_init_vcpu(v) != 0 )
         goto fail_wq;
 
-    if ( vmtrace_alloc_buffer(v) != 0 )
-        goto fail_wq;
-
     if ( arch_vcpu_create(v) != 0 )
         goto fail_sched;
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.21


From xen-changelog-bounces@lists.xenproject.org Tue Mar 10 15:33:05 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Mar 2026 15:33:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1250207.1547674 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzz4w-0006YI-Vp; Tue, 10 Mar 2026 15:33:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1250207.1547674; Tue, 10 Mar 2026 15:33:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzz4w-0006YA-T8; Tue, 10 Mar 2026 15:33:02 +0000
Received: by outflank-mailman (input) for mailman id 1250207;
 Tue, 10 Mar 2026 15:33:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vzz4v-0006Y4-QY
 for xen-changelog@lists.xenproject.org; Tue, 10 Mar 2026 15:33:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzz4v-001fyc-33
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 15:33:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzz4v-001xa4-2E
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 15:33:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=wEZbJs6sLZBc/tz/5btzepabBa1PsOYzDy8Ju4WfLfQ=; b=hDQta/3EF4f5lyp0ajl7/quDcz
	79+8+UyhNC2/o+XyY+8k1uR2f/JBsrysFaHd2dokCkX6tSUcGBmnIhxlD9aMa926E3eVuYWuswP4o
	9X5nKdy0+aRujzFpCerOSuF+IsGU0muB2n/aRN6qgQjuuCjGyVXVAV9Znw5rP9HZLxDg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.20] x86/MCE: restore CPU vendor reporting to the outside world
Message-Id: <E1vzz4v-001xa4-2E@xenbits.xenproject.org>
Date: Tue, 10 Mar 2026 15:33:01 +0000

commit 1c762d6c46a12fc24a1febe4b0d7055f781cd775
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Mar 10 14:38:36 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 10 14:38:36 2026 +0100

    x86/MCE: restore CPU vendor reporting to the outside world
    
    The records reported used to contain Linux enumerators. We first broke
    that connection when purging unused ones, and then again when switching to
    the bit mask forms.
    
    Fixes: 408413051144 ("x86/cpu: Drop unused X86_VENDOR_* values")
    Fixes: 0cd074144cbb ("x86/cpu: Renumber X86_VENDOR_* to form a bitmap")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
    master commit: a94c5fd8290a55461c599b8baad309df0d929f1f
    master date: 2026-02-23 08:39:58 +0100
---
 xen/arch/x86/cpu/mcheck/mce.c | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/cpu/mcheck/mce.c b/xen/arch/x86/cpu/mcheck/mce.c
index 84238cd0ef..1ccb96958e 100644
--- a/xen/arch/x86/cpu/mcheck/mce.c
+++ b/xen/arch/x86/cpu/mcheck/mce.c
@@ -854,6 +854,22 @@ void *x86_mcinfo_reserve(struct mc_info *mi,
     return mic_index;
 }
 
+/* Linux values need using when reporting CPU vendors to the outside. */
+static unsigned int xen2linux_vendor(unsigned int vendor)
+{
+    switch ( vendor )
+    {
+    case X86_VENDOR_INTEL:    return 0;
+    case X86_VENDOR_AMD:      return 2;
+    case X86_VENDOR_CENTAUR:  return 5;
+    case X86_VENDOR_HYGON:    return 9;
+    case X86_VENDOR_SHANGHAI: return 10; /* X86_VENDOR_ZHAOXIN */
+    default: break;
+    }
+
+    return 0xff; /* X86_VENDOR_UNKNOWN */
+}
+
 static void x86_mcinfo_apei_save(
     struct mcinfo_global *mc_global, struct mcinfo_bank *mc_bank)
 {
@@ -862,7 +878,7 @@ static void x86_mcinfo_apei_save(
     memset(&m, 0, sizeof(struct mce));
 
     m.cpu = mc_global->mc_coreid;
-    m.cpuvendor = boot_cpu_data.x86_vendor;
+    m.cpuvendor = xen2linux_vendor(boot_cpu_data.x86_vendor);
     m.cpuid = cpuid_eax(1);
     m.socketid = mc_global->mc_socketid;
     m.apicid = mc_global->mc_apicid;
@@ -964,7 +980,7 @@ static void cf_check __maybe_unused do_mc_get_cpu_info(void *v)
                         &xcp->mc_ncores_active, &xcp->mc_nthreads);
     xcp->mc_cpuid_level = c->cpuid_level;
     xcp->mc_family = c->x86;
-    xcp->mc_vendor = c->x86_vendor;
+    xcp->mc_vendor = xen2linux_vendor(c->x86_vendor);
     xcp->mc_model = c->x86_model;
     xcp->mc_step = c->x86_mask;
     xcp->mc_cache_size = c->x86_cache_size;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.20


From xen-changelog-bounces@lists.xenproject.org Tue Mar 10 15:33:13 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Mar 2026 15:33:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1250208.1547678 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzz57-0006aM-13; Tue, 10 Mar 2026 15:33:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1250208.1547678; Tue, 10 Mar 2026 15:33:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzz56-0006aC-UY; Tue, 10 Mar 2026 15:33:12 +0000
Received: by outflank-mailman (input) for mailman id 1250208;
 Tue, 10 Mar 2026 15:33:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vzz55-0006Zu-Rw
 for xen-changelog@lists.xenproject.org; Tue, 10 Mar 2026 15:33:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzz56-001fyg-07
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 15:33:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzz55-001xab-2Y
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 15:33:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=n5kMr4MtMerboRew43OdsvmJOh4FUkQIViV7w/e/oxI=; b=qvTTafUahuuWE0EOyTmyOrr0Jj
	xMyf/o5NNaZqT7L2FoRNB2l2IY+CIJvQUZb8wsfOJ6O9TemG29/RoCnW360XJ1CkL5HwvsOEvjjEO
	tL/z1OUXzxGt+HwvmRpPOdty839pLMZhpoXESimmJIyahXUwID5jHmE4PNLXhppU9k5Y=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.20] x86/ucode: Support discrete modules being CPIO archives
Message-Id: <E1vzz55-001xab-2Y@xenbits.xenproject.org>
Date: Tue, 10 Mar 2026 15:33:11 +0000

commit 51eb3e246e33bfa3d55f750283eedb267e72ed5e
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Mar 10 14:38:59 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 10 14:38:59 2026 +0100

    x86/ucode: Support discrete modules being CPIO archives
    
    Multiple downstream distros have tried passing discrete CPIO archives and
    tripped over this not working.  It turns out to be easy to support, so do so.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Tested-by: Teddy Astie <teddy.astie@vates.tech>
    [jb: doc change dropped as inapplicable to the older form]
    master commit: 878a9cfa451878dcba6108ae5b7879c80f049661
    master date: 2026-03-03 15:15:53 +0000
---
 CHANGELOG.md                      |  6 ++++++
 xen/arch/x86/cpu/microcode/core.c | 20 +++++++++++++++++++-
 2 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index d098e7c5ac..8324c5c5cb 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,12 @@ Notable changes to Xen will be documented in this file.
 
 The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
 
+## [4.20.3](https://xenbits.xenproject.org/gitweb/?p=xen.git;a=shortlog;h=RELEASE-4.20.3)
+
+### Added
+ - On x86:
+   - Support for CPIO microcode in discrete multiboot modules.
+
 ## [4.20.1](https://xenbits.xenproject.org/gitweb/?p=xen.git;a=shortlog;h=RELEASE-4.20.1)
 
 ### Added
diff --git a/xen/arch/x86/cpu/microcode/core.c b/xen/arch/x86/cpu/microcode/core.c
index dc913ff333..d565fa3e48 100644
--- a/xen/arch/x86/cpu/microcode/core.c
+++ b/xen/arch/x86/cpu/microcode/core.c
@@ -749,6 +749,7 @@ static int __init early_microcode_load(struct boot_info *bi)
     void *data = NULL;
     size_t size;
     struct microcode_patch *patch;
+    struct cpio_data cd;
     int idx = opt_mod_idx;
     int rc;
 
@@ -765,7 +766,6 @@ static int __init early_microcode_load(struct boot_info *bi)
         for ( idx = 0; idx < bi->nr_modules; ++idx )
         {
             const struct boot_module *bm = &bi->mods[idx];
-            struct cpio_data cd;
 
             /* Search anything unclaimed or likely to be a CPIO archive. */
             if ( bm->type != BOOTMOD_UNKNOWN &&
@@ -834,6 +834,24 @@ static int __init early_microcode_load(struct boot_info *bi)
                    idx, size);
             return -ENODEV;
         }
+
+        /*
+         * If this blob appears to be a CPIO archive, try interpreting it as
+         * one.  Otherwise treat it as a raw vendor blob.
+         */
+        cd = find_cpio_data(ucode_ops.cpio_path, data, size);
+        if ( cd.data )
+        {
+            data = cd.data;
+            size = cd.size;
+
+            /*
+             * (Ab)use opt_scan to inform microcode_init_cache() that
+             * early_mod_idx refers to a CPIO archive.
+             */
+            opt_scan = true;
+        }
+
         goto found;
     }
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.20


From xen-changelog-bounces@lists.xenproject.org Tue Mar 10 15:33:23 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Mar 2026 15:33:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1250210.1547690 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzz5H-0006rQ-A0; Tue, 10 Mar 2026 15:33:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1250210.1547690; Tue, 10 Mar 2026 15:33:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzz5H-0006rJ-6z; Tue, 10 Mar 2026 15:33:23 +0000
Received: by outflank-mailman (input) for mailman id 1250210;
 Tue, 10 Mar 2026 15:33:21 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vzz5F-0006qa-UO
 for xen-changelog@lists.xenproject.org; Tue, 10 Mar 2026 15:33:21 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzz5G-001fyk-0O
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 15:33:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzz5F-001xb5-2q
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 15:33:21 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=cAVuWJFz77VbIpp5cU6A8OlmpDEKjueLkDKqBbnlFB4=; b=6O+kMz5ItiGojhPuKrbC3/GsAJ
	3NFlYrX190MAAD4EhvxPH4Gs71lgak72esDUExt/v81cCqQ91cMUiLbxx8hEGS7VJKjFK+DIoIsTh
	qDfxPhjkoIR7lpGZb0A5HELONpDxklg4ribL75cIS0KcRM/Kytdy860+ZlGghK3HLFjE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.20] x86/pv: Don't assume that INT $imm8 instructions are two bytes long
Message-Id: <E1vzz5F-001xb5-2q@xenbits.xenproject.org>
Date: Tue, 10 Mar 2026 15:33:21 +0000

commit 45d18b05c09b412fa53142cadf4ddd2275283564
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Mar 10 14:39:14 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 10 14:39:14 2026 +0100

    x86/pv: Don't assume that INT $imm8 instructions are two bytes long
    
    For INT $N instructions (besides $0x80 for which there is a dedicated fast
    path), handling is mostly fault-based because of DPL0 gates in the IDT.  This
    means that when the guest kernel allows the instruction too, Xen must
    increment %rip to the end of the instruction before passing a trap to the
    guest kernel.
    
    When an INT $N instruction has a prefix, it's longer than two bytes, and Xen
    will deliver the "trap" with %rip pointing into the middle of the instruction.
    
    Introduce a new pv_emulate_sw_interrupt() which uses x86_insn_length() to
    determine the instruction length, rather than assuming two.
    
    This is a change in behaviour for PV guests, but the prior behaviour cannot
    reasonably be said to be intentional.
    
    This change does not affect the INT $0x80 fastpath.  Prefixed INT $N
    instructions occur almost exclusively in test code or exploits, and INT $0x80
    appears to be the only user-usable interrupt gate in contemporary PV guests.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: a934a600c45486b7acfe8abc3658e284e64e5dd5
    master date: 2026-03-03 15:15:53 +0000
---
 xen/arch/x86/include/asm/pv/traps.h |  2 ++
 xen/arch/x86/pv/emul-priv-op.c      | 49 +++++++++++++++++++++++++++++++++++++
 xen/arch/x86/traps.c                |  3 +--
 3 files changed, 52 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/include/asm/pv/traps.h b/xen/arch/x86/include/asm/pv/traps.h
index 404f5b169c..5892dc9ef8 100644
--- a/xen/arch/x86/include/asm/pv/traps.h
+++ b/xen/arch/x86/include/asm/pv/traps.h
@@ -19,6 +19,7 @@ void pv_trap_init(void);
 int pv_raise_nmi(struct vcpu *v);
 
 int pv_emulate_privileged_op(struct cpu_user_regs *regs);
+void pv_emulate_sw_interrupt(struct cpu_user_regs *regs);
 void pv_emulate_gate_op(struct cpu_user_regs *regs);
 bool pv_emulate_invalid_op(struct cpu_user_regs *regs);
 
@@ -37,6 +38,7 @@ static inline void pv_trap_init(void) {}
 static inline int pv_raise_nmi(struct vcpu *v) { return -EOPNOTSUPP; }
 
 static inline int pv_emulate_privileged_op(struct cpu_user_regs *regs) { return 0; }
+static inline void pv_emulate_sw_interrupt(struct cpu_user_regs *regs) {}
 static inline void pv_emulate_gate_op(struct cpu_user_regs *regs) {}
 static inline bool pv_emulate_invalid_op(struct cpu_user_regs *regs) { return true; }
 
diff --git a/xen/arch/x86/pv/emul-priv-op.c b/xen/arch/x86/pv/emul-priv-op.c
index a21d499519..7753e44477 100644
--- a/xen/arch/x86/pv/emul-priv-op.c
+++ b/xen/arch/x86/pv/emul-priv-op.c
@@ -8,6 +8,7 @@
  */
 
 #include <xen/domain_page.h>
+#include <xen/err.h>
 #include <xen/event.h>
 #include <xen/guest_access.h>
 #include <xen/hypercall.h>
@@ -1381,6 +1382,54 @@ int pv_emulate_privileged_op(struct cpu_user_regs *regs)
     return 0;
 }
 
+/*
+ * Hardware already decoded the INT $N instruction and determined that there
+ * was a permission issue (i.e. the DPL violation intended to trigger #GP).
+ * Xen has already determined that the guest kernel has permitted this
+ * software interrupt.
+ *
+ * All that is needed is the instruction length, to turn the fault into a
+ * trap.  All errors are turned back into the original #GP, as that's the
+ * action that really happened.
+ */
+void pv_emulate_sw_interrupt(struct cpu_user_regs *regs)
+{
+    struct vcpu *curr = current;
+    struct domain *currd = curr->domain;
+    struct priv_op_ctxt ctxt = {
+        .ctxt.regs = regs,
+        .ctxt.lma = !is_pv_32bit_domain(currd),
+    };
+    struct x86_emulate_state *state;
+    uint8_t vector = regs->error_code >> 3;
+    unsigned int len, ar;
+
+    if ( !pv_emul_read_descriptor(regs->cs, curr, &ctxt.cs.base,
+                                  &ctxt.cs.limit, &ar, 1) ||
+         !(ar & _SEGMENT_S) ||
+         !(ar & _SEGMENT_P) ||
+         !(ar & _SEGMENT_CODE) )
+        goto error;
+
+    state = x86_decode_insn(&ctxt.ctxt, insn_fetch);
+    if ( IS_ERR_OR_NULL(state) )
+        goto error;
+
+    len = x86_insn_length(state, &ctxt.ctxt);
+    x86_emulate_free_state(state);
+
+    /* Note: Checked slightly late to simplify 'state' handling. */
+    if ( ctxt.ctxt.opcode != 0xcd /* INT $imm8 */ )
+        goto error;
+
+    regs->rip += len;
+    pv_inject_sw_interrupt(vector);
+    return;
+
+ error:
+    pv_inject_hw_exception(X86_EXC_GP, regs->error_code);
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index 9eb7bd2e07..b6d2c5b3ea 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -1298,8 +1298,7 @@ void do_general_protection(struct cpu_user_regs *regs)
 
         if ( permit_softint(TI_GET_DPL(ti), v, regs) )
         {
-            regs->rip += 2;
-            pv_inject_sw_interrupt(vector);
+            pv_emulate_sw_interrupt(regs);
             return;
         }
     }
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.20


From xen-changelog-bounces@lists.xenproject.org Tue Mar 10 15:33:33 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Mar 2026 15:33:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1250213.1547696 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzz5R-0006wa-BZ; Tue, 10 Mar 2026 15:33:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1250213.1547696; Tue, 10 Mar 2026 15:33:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzz5R-0006wP-8X; Tue, 10 Mar 2026 15:33:33 +0000
Received: by outflank-mailman (input) for mailman id 1250213;
 Tue, 10 Mar 2026 15:33:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vzz5Q-0006vv-12
 for xen-changelog@lists.xenproject.org; Tue, 10 Mar 2026 15:33:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzz5Q-001fyp-0g
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 15:33:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzz5P-001xbk-38
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 15:33:31 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=gD1+/QyIEAdoL4JXjJ0VWP8QIyj9NamGhY4z1iXug0M=; b=U5dY1PS7X/WB9ebJGj/nXWBUor
	s6eWuoqZDjiin3wLFPGxYWItwRqdwmIMs7D0G6/3rA/g6adEctv0XErPro9UmZJrNkRz790YxdlEp
	DOOAYkBtz2nOO4YeGrElogndjkH+DFeCTq6MEGCmSMB8R9/WKclZBYTB3EWaQvbk+AHA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.20] domain: move vmtrace_alloc_buffer() invocation in vcpu_create()
Message-Id: <E1vzz5P-001xbk-38@xenbits.xenproject.org>
Date: Tue, 10 Mar 2026 15:33:31 +0000

commit ab68afe62d09df65df7f980fa3ba33770ef3b12b
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Mar 10 14:39:52 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 10 14:43:47 2026 +0100

    domain: move vmtrace_alloc_buffer() invocation in vcpu_create()
    
    The label used upon the function failing is wrong. Instead of correcting
    the label, move the invocation up a little, to also avoid it altogether
    for the idle domain (where ->vmtrace_size would be zero, and hence the
    function would bail right away anyway).
    
    Fixes: 217dd79ee292 ("xen/domain: Add vmtrace_size domain creation parameter")
    Reported-by: Roger Pau Monné <roger.pau@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: adfbdaa347d05e53c8c61ad00a6851bd5b82c760
    master date: 2026-03-10 09:23:25 +0100
---
 xen/common/domain.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/xen/common/domain.c b/xen/common/domain.c
index 68e8677962..1a5a7d15bf 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -316,14 +316,14 @@ struct vcpu *vcpu_create(struct domain *d, unsigned int vcpu_id)
         set_bit(_VPF_down, &v->pause_flags);
         vcpu_info_reset(v);
         init_waitqueue_vcpu(v);
+
+        if ( vmtrace_alloc_buffer(v) != 0 )
+            goto fail_wq;
     }
 
     if ( sched_init_vcpu(v) != 0 )
         goto fail_wq;
 
-    if ( vmtrace_alloc_buffer(v) != 0 )
-        goto fail_wq;
-
     if ( arch_vcpu_create(v) != 0 )
         goto fail_sched;
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.20


From xen-changelog-bounces@lists.xenproject.org Tue Mar 10 16:22:07 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Mar 2026 16:22:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1250300.1547762 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzzqO-0000J2-9t; Tue, 10 Mar 2026 16:22:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1250300.1547762; Tue, 10 Mar 2026 16:22:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzzqO-0000Iu-7F; Tue, 10 Mar 2026 16:22:04 +0000
Received: by outflank-mailman (input) for mailman id 1250300;
 Tue, 10 Mar 2026 16:22:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vzzqM-0000Io-6v
 for xen-changelog@lists.xenproject.org; Tue, 10 Mar 2026 16:22:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzzqM-001hPd-1F
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 16:22:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzzqM-0020S7-0S
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 16:22:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=vIHBRWvb3f+CVTmO2UdGBbmjRTHEUm8ICTm5mcnT8J4=; b=y9h/s64y1bnBqCEPHB4upPw9y5
	WlgdJt1rjhS+jYWrWbcuH1roje7rYlJGt5Khe2H8tBT/DHj3JIBEv0hXHuuBgR8RcJ9FNpY74tmsC
	EaKg0sWYEKWta8pnedNqGdWEaO2KOfq3vWo92Dvkh8qrhDePl6YG/l9Xo2u4aBL3pVA4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] x86/MCE: restore CPU vendor reporting to the outside world
Message-Id: <E1vzzqM-0020S7-0S@xenbits.xenproject.org>
Date: Tue, 10 Mar 2026 16:22:02 +0000

commit b74f88c938f928278575bb674df4daac9d6ff5a8
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Mar 10 14:45:02 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 10 14:45:02 2026 +0100

    x86/MCE: restore CPU vendor reporting to the outside world
    
    The records reported used to contain Linux enumerators. We first broke
    that connection when purging unused ones, and then again when switching to
    the bit mask forms.
    
    Fixes: 408413051144 ("x86/cpu: Drop unused X86_VENDOR_* values")
    Fixes: 0cd074144cbb ("x86/cpu: Renumber X86_VENDOR_* to form a bitmap")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
    master commit: a94c5fd8290a55461c599b8baad309df0d929f1f
    master date: 2026-02-23 08:39:58 +0100
---
 xen/arch/x86/cpu/mcheck/mce.c | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/cpu/mcheck/mce.c b/xen/arch/x86/cpu/mcheck/mce.c
index 5a59e79cbc..533425cf51 100644
--- a/xen/arch/x86/cpu/mcheck/mce.c
+++ b/xen/arch/x86/cpu/mcheck/mce.c
@@ -854,6 +854,22 @@ void *x86_mcinfo_reserve(struct mc_info *mi,
     return mic_index;
 }
 
+/* Linux values need using when reporting CPU vendors to the outside. */
+static unsigned int xen2linux_vendor(unsigned int vendor)
+{
+    switch ( vendor )
+    {
+    case X86_VENDOR_INTEL:    return 0;
+    case X86_VENDOR_AMD:      return 2;
+    case X86_VENDOR_CENTAUR:  return 5;
+    case X86_VENDOR_HYGON:    return 9;
+    case X86_VENDOR_SHANGHAI: return 10; /* X86_VENDOR_ZHAOXIN */
+    default: break;
+    }
+
+    return 0xff; /* X86_VENDOR_UNKNOWN */
+}
+
 static void x86_mcinfo_apei_save(
     struct mcinfo_global *mc_global, struct mcinfo_bank *mc_bank)
 {
@@ -862,7 +878,7 @@ static void x86_mcinfo_apei_save(
     memset(&m, 0, sizeof(struct mce));
 
     m.cpu = mc_global->mc_coreid;
-    m.cpuvendor = boot_cpu_data.x86_vendor;
+    m.cpuvendor = xen2linux_vendor(boot_cpu_data.x86_vendor);
     m.cpuid = cpuid_eax(1);
     m.socketid = mc_global->mc_socketid;
     m.apicid = mc_global->mc_apicid;
@@ -964,7 +980,7 @@ static void cf_check do_mc_get_cpu_info(void *v)
                         &xcp->mc_ncores_active, &xcp->mc_nthreads);
     xcp->mc_cpuid_level = c->cpuid_level;
     xcp->mc_family = c->x86;
-    xcp->mc_vendor = c->x86_vendor;
+    xcp->mc_vendor = xen2linux_vendor(c->x86_vendor);
     xcp->mc_model = c->x86_model;
     xcp->mc_step = c->x86_mask;
     xcp->mc_cache_size = c->x86_cache_size;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Tue Mar 10 16:22:14 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Mar 2026 16:22:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1250301.1547766 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzzqY-0000Ks-B7; Tue, 10 Mar 2026 16:22:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1250301.1547766; Tue, 10 Mar 2026 16:22:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzzqY-0000Kk-8Z; Tue, 10 Mar 2026 16:22:14 +0000
Received: by outflank-mailman (input) for mailman id 1250301;
 Tue, 10 Mar 2026 16:22:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vzzqW-0000KY-9W
 for xen-changelog@lists.xenproject.org; Tue, 10 Mar 2026 16:22:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzzqW-001hPi-1X
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 16:22:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzzqW-0020Sv-0k
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 16:22:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=N9R0iZ382S6VpO1i2O/aRXAz3Ifq6lj9JtfcXgLCBOA=; b=viNLd02LeOwU6yUXh51JvzxL+5
	cgWd0vCxQeEl2miDemzBaN75EBJSILdEp+L/r0KnUiA+uuVxII/EVvsxzaMOV9rFgCrntGn2+nyrr
	yoRk6J7EI5zNRXggrxMmnpIRL+Lqvf6ns2j393V8XypE9c8znQ/z8IfeeuAhB/hZlzlU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] x86/pv: Don't assume that INT $imm8 instructions are two bytes long
Message-Id: <E1vzzqW-0020Sv-0k@xenbits.xenproject.org>
Date: Tue, 10 Mar 2026 16:22:12 +0000

commit 260740e1aa1ff414dab65798e2d2d698c5e78b03
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Mar 10 14:45:29 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 10 14:45:29 2026 +0100

    x86/pv: Don't assume that INT $imm8 instructions are two bytes long
    
    For INT $N instructions (besides $0x80 for which there is a dedicated fast
    path), handling is mostly fault-based because of DPL0 gates in the IDT.  This
    means that when the guest kernel allows the instruction too, Xen must
    increment %rip to the end of the instruction before passing a trap to the
    guest kernel.
    
    When an INT $N instruction has a prefix, it's longer than two bytes, and Xen
    will deliver the "trap" with %rip pointing into the middle of the instruction.
    
    Introduce a new pv_emulate_sw_interrupt() which uses x86_insn_length() to
    determine the instruction length, rather than assuming two.
    
    This is a change in behaviour for PV guests, but the prior behaviour cannot
    reasonably be said to be intentional.
    
    This change does not affect the INT $0x80 fastpath.  Prefixed INT $N
    instructions occur almost exclusively in test code or exploits, and INT $0x80
    appears to be the only user-usable interrupt gate in contemporary PV guests.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: a934a600c45486b7acfe8abc3658e284e64e5dd5
    master date: 2026-03-03 15:15:53 +0000
---
 xen/arch/x86/include/asm/pv/traps.h |  2 ++
 xen/arch/x86/pv/emul-priv-op.c      | 49 +++++++++++++++++++++++++++++++++++++
 xen/arch/x86/traps.c                |  3 +--
 3 files changed, 52 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/include/asm/pv/traps.h b/xen/arch/x86/include/asm/pv/traps.h
index 404f5b169c..5892dc9ef8 100644
--- a/xen/arch/x86/include/asm/pv/traps.h
+++ b/xen/arch/x86/include/asm/pv/traps.h
@@ -19,6 +19,7 @@ void pv_trap_init(void);
 int pv_raise_nmi(struct vcpu *v);
 
 int pv_emulate_privileged_op(struct cpu_user_regs *regs);
+void pv_emulate_sw_interrupt(struct cpu_user_regs *regs);
 void pv_emulate_gate_op(struct cpu_user_regs *regs);
 bool pv_emulate_invalid_op(struct cpu_user_regs *regs);
 
@@ -37,6 +38,7 @@ static inline void pv_trap_init(void) {}
 static inline int pv_raise_nmi(struct vcpu *v) { return -EOPNOTSUPP; }
 
 static inline int pv_emulate_privileged_op(struct cpu_user_regs *regs) { return 0; }
+static inline void pv_emulate_sw_interrupt(struct cpu_user_regs *regs) {}
 static inline void pv_emulate_gate_op(struct cpu_user_regs *regs) {}
 static inline bool pv_emulate_invalid_op(struct cpu_user_regs *regs) { return true; }
 
diff --git a/xen/arch/x86/pv/emul-priv-op.c b/xen/arch/x86/pv/emul-priv-op.c
index a21d499519..7753e44477 100644
--- a/xen/arch/x86/pv/emul-priv-op.c
+++ b/xen/arch/x86/pv/emul-priv-op.c
@@ -8,6 +8,7 @@
  */
 
 #include <xen/domain_page.h>
+#include <xen/err.h>
 #include <xen/event.h>
 #include <xen/guest_access.h>
 #include <xen/hypercall.h>
@@ -1381,6 +1382,54 @@ int pv_emulate_privileged_op(struct cpu_user_regs *regs)
     return 0;
 }
 
+/*
+ * Hardware already decoded the INT $N instruction and determined that there
+ * was a permission issue (i.e. the DPL violation intended to trigger #GP).
+ * Xen has already determined that the guest kernel has permitted this
+ * software interrupt.
+ *
+ * All that is needed is the instruction length, to turn the fault into a
+ * trap.  All errors are turned back into the original #GP, as that's the
+ * action that really happened.
+ */
+void pv_emulate_sw_interrupt(struct cpu_user_regs *regs)
+{
+    struct vcpu *curr = current;
+    struct domain *currd = curr->domain;
+    struct priv_op_ctxt ctxt = {
+        .ctxt.regs = regs,
+        .ctxt.lma = !is_pv_32bit_domain(currd),
+    };
+    struct x86_emulate_state *state;
+    uint8_t vector = regs->error_code >> 3;
+    unsigned int len, ar;
+
+    if ( !pv_emul_read_descriptor(regs->cs, curr, &ctxt.cs.base,
+                                  &ctxt.cs.limit, &ar, 1) ||
+         !(ar & _SEGMENT_S) ||
+         !(ar & _SEGMENT_P) ||
+         !(ar & _SEGMENT_CODE) )
+        goto error;
+
+    state = x86_decode_insn(&ctxt.ctxt, insn_fetch);
+    if ( IS_ERR_OR_NULL(state) )
+        goto error;
+
+    len = x86_insn_length(state, &ctxt.ctxt);
+    x86_emulate_free_state(state);
+
+    /* Note: Checked slightly late to simplify 'state' handling. */
+    if ( ctxt.ctxt.opcode != 0xcd /* INT $imm8 */ )
+        goto error;
+
+    regs->rip += len;
+    pv_inject_sw_interrupt(vector);
+    return;
+
+ error:
+    pv_inject_hw_exception(X86_EXC_GP, regs->error_code);
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index af90d8b27d..0c8c935ee9 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -1300,8 +1300,7 @@ void do_general_protection(struct cpu_user_regs *regs)
 
         if ( permit_softint(TI_GET_DPL(ti), v, regs) )
         {
-            regs->rip += 2;
-            pv_inject_sw_interrupt(vector);
+            pv_emulate_sw_interrupt(regs);
             return;
         }
     }
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Tue Mar 10 16:22:24 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Mar 2026 16:22:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1250302.1547770 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzzqi-0000Nb-CX; Tue, 10 Mar 2026 16:22:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1250302.1547770; Tue, 10 Mar 2026 16:22:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1vzzqi-0000NT-9z; Tue, 10 Mar 2026 16:22:24 +0000
Received: by outflank-mailman (input) for mailman id 1250302;
 Tue, 10 Mar 2026 16:22:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1vzzqg-0000NL-CC
 for xen-changelog@lists.xenproject.org; Tue, 10 Mar 2026 16:22:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzzqg-001hPt-1o
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 16:22:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1vzzqg-0020TS-11
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Mar 2026 16:22:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=mSeNApwCA78KyUBXMTFLRADqeS9Q8mOe694QtEh9DJY=; b=ogQw7jwu3jaD5wQSD7uoH0KTAP
	N67CbiHMMwyvdKrPM5ISiKlsWICUwg/iBPx0Q48RwIjHfUHxMCZiIufl5Nt77rCTk6YI6a3XUZW23
	sR++nuR6xai0Oml6OeCbPX6uHbFN4Qd6H5R9jBWpsdsTmyS6r/SMYN6l3Q8FEBQ/FSaA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] domain: move vmtrace_alloc_buffer() invocation in vcpu_create()
Message-Id: <E1vzzqg-0020TS-11@xenbits.xenproject.org>
Date: Tue, 10 Mar 2026 16:22:22 +0000

commit a38f51516848c86fae75f295af8be1a50f96cabd
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Mar 10 14:45:42 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 10 14:45:42 2026 +0100

    domain: move vmtrace_alloc_buffer() invocation in vcpu_create()
    
    The label used upon the function failing is wrong. Instead of correcting
    the label, move the invocation up a little, to also avoid it altogether
    for the idle domain (where ->vmtrace_size would be zero, and hence the
    function would bail right away anyway).
    
    Fixes: 217dd79ee292 ("xen/domain: Add vmtrace_size domain creation parameter")
    Reported-by: Roger Pau Monné <roger.pau@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: adfbdaa347d05e53c8c61ad00a6851bd5b82c760
    master date: 2026-03-10 09:23:25 +0100
---
 xen/common/domain.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/xen/common/domain.c b/xen/common/domain.c
index 168f709423..77dacffd22 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -262,14 +262,14 @@ struct vcpu *vcpu_create(struct domain *d, unsigned int vcpu_id)
         set_bit(_VPF_down, &v->pause_flags);
         vcpu_info_reset(v);
         init_waitqueue_vcpu(v);
+
+        if ( vmtrace_alloc_buffer(v) != 0 )
+            goto fail_wq;
     }
 
     if ( sched_init_vcpu(v) != 0 )
         goto fail_wq;
 
-    if ( vmtrace_alloc_buffer(v) != 0 )
-        goto fail_wq;
-
     if ( arch_vcpu_create(v) != 0 )
         goto fail_sched;
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Mar 11 10:33:09 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 11 Mar 2026 10:33:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1250990.1548308 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w0GsB-0002oT-SQ; Wed, 11 Mar 2026 10:33:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1250990.1548308; Wed, 11 Mar 2026 10:33:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w0GsB-0002oL-Pi; Wed, 11 Mar 2026 10:33:03 +0000
Received: by outflank-mailman (input) for mailman id 1250990;
 Wed, 11 Mar 2026 10:33:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w0GsA-0002oF-0W
 for xen-changelog@lists.xenproject.org; Wed, 11 Mar 2026 10:33:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w0GsA-003AVd-0X
 for xen-changelog@lists.xenproject.org;
 Wed, 11 Mar 2026 10:33:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w0Gs9-003D30-2v
 for xen-changelog@lists.xenproject.org;
 Wed, 11 Mar 2026 10:33:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=mQ1JjZG7J19SYPvKmP99tVEOMiQ3IUecsPVZYFRi97k=; b=Co1nrPMDR3555ME8f0AKKFSMKu
	udwmB2Wu2b72qIjZQjU4pmUAL8XGd3zR6vyarLCVxWEtDG6FnsD+kVfGiZVQz6CbxULvIolEUj+N3
	SnXBZFlDD5U9FMlP3F66mCnpFqdMiqWXoMomm7HvelsjP2nrFfzIgK7Q7xBxgvyWSX78=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] core-parking: shrink core_parking_cpunum[]
Message-Id: <E1w0Gs9-003D30-2v@xenbits.xenproject.org>
Date: Wed, 11 Mar 2026 10:33:01 +0000

commit 5bfd96ddc650513d2ba5b123a3d214e789f96df1
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Mar 11 10:00:46 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 11 10:00:46 2026 +0100

    core-parking: shrink core_parking_cpunum[]
    
    This NR_CPUS-dimensioned array is likely unused on most installations.
    Therefore it is especially wasteful for it to consume more space than
    really needed. Allocate it dynamically ahead of registering the hooks.
    
    Further the array having all fields set to -1 is actually useless. Nothing
    relies on it, and core_parking_remove() doesn't restore the sentinel for
    vacated slots. Drop the initializers altogether, rather than replacing
    them.
    
    Also take the opportunity and update an adjacent variable's type, where
    a fixed-width type was pretty clearly inappropriate to use.
    
    Finally drop the redundant initializer from core_parking_init().
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/common/core_parking.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/xen/common/core_parking.c b/xen/common/core_parking.c
index 7d6a18cdcf..08003a536f 100644
--- a/xen/common/core_parking.c
+++ b/xen/common/core_parking.c
@@ -20,6 +20,7 @@
 #include <xen/cpumask.h>
 #include <xen/init.h>
 #include <xen/param.h>
+#include <xen/xvmalloc.h>
 
 #include <asm/smp.h>
 
@@ -27,8 +28,8 @@
 #define CORE_PARKING_DECREMENT 2
 
 static DEFINE_SPINLOCK(accounting_lock);
-static uint32_t cur_idle_nums;
-static unsigned int core_parking_cpunum[NR_CPUS] = {[0 ... NR_CPUS-1] = -1};
+static unsigned int cur_idle_nums;
+static unsigned int *__ro_after_init core_parking_cpunum;
 
 struct cp_policy {
     char name[30];
@@ -188,7 +189,7 @@ long cf_check core_parking_helper(void *data)
             return ret;
 
         spin_lock(&accounting_lock);
-        BUG_ON(cur_idle_nums >= ARRAY_SIZE(core_parking_cpunum));
+        BUG_ON(cur_idle_nums >= nr_cpu_ids);
         core_parking_cpunum[cur_idle_nums++] = cpu;
         spin_unlock(&accounting_lock);
     }
@@ -263,9 +264,12 @@ static int __init register_core_parking_policy(const struct cp_policy *policy)
 
 static int __init cf_check core_parking_init(void)
 {
-    int ret = 0;
+    int ret;
 
-    if ( core_parking_controller == PERFORMANCE_FIRST )
+    core_parking_cpunum = xvzalloc_array(unsigned int, nr_cpu_ids);
+    if ( !core_parking_cpunum )
+        ret = -ENOMEM;
+    else if ( core_parking_controller == PERFORMANCE_FIRST )
         ret = register_core_parking_policy(&performance_first);
     else
         ret = register_core_parking_policy(&power_first);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Mar 11 10:33:13 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 11 Mar 2026 10:33:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1250991.1548312 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w0GsL-0002q0-Tv; Wed, 11 Mar 2026 10:33:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1250991.1548312; Wed, 11 Mar 2026 10:33:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w0GsL-0002ps-R4; Wed, 11 Mar 2026 10:33:13 +0000
Received: by outflank-mailman (input) for mailman id 1250991;
 Wed, 11 Mar 2026 10:33:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w0GsK-0002pc-4I
 for xen-changelog@lists.xenproject.org; Wed, 11 Mar 2026 10:33:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w0GsK-003AVx-0x
 for xen-changelog@lists.xenproject.org;
 Wed, 11 Mar 2026 10:33:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w0GsK-003D3z-06
 for xen-changelog@lists.xenproject.org;
 Wed, 11 Mar 2026 10:33:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=5jY/SiephDbzxeyq2P5oqmwyEjDdS0gWet9fGIp+AyM=; b=ayYExJqY2/LthRTCqPzRpqI885
	eXfLqTPeITg2mWA/cm0E1tk8XABmqWjF8gdgeWu/8NYUfxbn2Wu8RnzlNO1Kd88BU+2cPd5Uw1HxY
	cbTAfYTV9Em0vI07fXgbM7IzPjJH3QazzJ/xSoH2igzuwUXsw2gMwpZfJoRWUnw9re4I=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86: Remove x86 prefixed names misc
Message-Id: <E1w0GsK-003D3z-06@xenbits.xenproject.org>
Date: Wed, 11 Mar 2026 10:33:12 +0000

commit bfb33fa6d4eb4110cd7dd47ec71d2e550739e126
Author:     Kevin Lampis <kevin.lampis@citrix.com>
AuthorDate: Wed Mar 11 10:03:37 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 11 10:03:37 2026 +0100

    x86: Remove x86 prefixed names misc
    
    struct cpuinfo_x86
      .x86        => .family
      .x86_vendor => .vendor
      .x86_model  => .model
      .x86_mask   => .stepping
    
    No functional change.
    
    This work is part of making Xen safe for Intel family 18/19.
    
    Signed-off-by: Kevin Lampis <kevin.lampis@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/alternative.c               |  8 ++++----
 xen/arch/x86/apic.c                      |  2 +-
 xen/arch/x86/cpuid.c                     |  2 +-
 xen/arch/x86/dom0_build.c                |  4 ++--
 xen/arch/x86/domain.c                    | 12 ++++++------
 xen/arch/x86/e820.c                      |  2 +-
 xen/arch/x86/i8259.c                     |  2 +-
 xen/arch/x86/irq.c                       |  4 ++--
 xen/arch/x86/mpparse.c                   |  6 +++---
 xen/arch/x86/msr.c                       |  4 ++--
 xen/arch/x86/nmi.c                       | 15 +++++++++------
 xen/arch/x86/platform_hypercall.c        |  8 ++++----
 xen/arch/x86/pv/domain.c                 |  2 +-
 xen/arch/x86/setup.c                     |  6 +++---
 xen/arch/x86/traps-setup.c               |  4 ++--
 xen/arch/x86/tsx.c                       |  4 ++--
 xen/drivers/passthrough/amd/iommu_init.c |  6 +++---
 17 files changed, 47 insertions(+), 44 deletions(-)

diff --git a/xen/arch/x86/alternative.c b/xen/arch/x86/alternative.c
index 9f844241bc..5ed0c26725 100644
--- a/xen/arch/x86/alternative.c
+++ b/xen/arch/x86/alternative.c
@@ -89,7 +89,7 @@ static bool init_or_livepatch_read_mostly toolchain_nops_are_ideal;
 
 static void __init arch_init_ideal_nops(void)
 {
-    switch ( boot_cpu_data.x86_vendor )
+    switch ( boot_cpu_data.vendor )
     {
     case X86_VENDOR_INTEL:
         /*
@@ -97,10 +97,10 @@ static void __init arch_init_ideal_nops(void)
          * actually perform better with the "k8_nops" than with the SDM-
          * recommended NOPs.
          */
-        if ( boot_cpu_data.x86 != 6 )
+        if ( boot_cpu_data.family != 6 )
             break;
 
-        switch ( boot_cpu_data.x86_model )
+        switch ( boot_cpu_data.model )
         {
         case 0x0f ... 0x1b:
         case 0x1d ... 0x25:
@@ -111,7 +111,7 @@ static void __init arch_init_ideal_nops(void)
         break;
 
     case X86_VENDOR_AMD:
-        if ( boot_cpu_data.x86 <= 0xf )
+        if ( boot_cpu_data.family <= 0xf )
             ideal_nops = k8_nops;
         break;
     }
diff --git a/xen/arch/x86/apic.c b/xen/arch/x86/apic.c
index fb38be7ec3..d69ef9e16a 100644
--- a/xen/arch/x86/apic.c
+++ b/xen/arch/x86/apic.c
@@ -406,7 +406,7 @@ void __init init_bsp_APIC(void)
     value |= APIC_SPIV_APIC_ENABLED;
     
     /* This bit is reserved on P4/Xeon and should be cleared */
-    if ((boot_cpu_data.x86_vendor == X86_VENDOR_INTEL) && (boot_cpu_data.x86 == 15))
+    if ((boot_cpu_data.vendor == X86_VENDOR_INTEL) && (boot_cpu_data.family == 15))
         value &= ~APIC_SPIV_FOCUS_DISABLED;
     else
         value |= APIC_SPIV_FOCUS_DISABLED;
diff --git a/xen/arch/x86/cpuid.c b/xen/arch/x86/cpuid.c
index 5decfad8cd..6e9b15c9c3 100644
--- a/xen/arch/x86/cpuid.c
+++ b/xen/arch/x86/cpuid.c
@@ -437,7 +437,7 @@ void guest_cpuid(const struct vcpu *v, uint32_t leaf,
 
     case 0xa:
         /* TODO: Rework vPMU control in terms of toolstack choices. */
-        if ( boot_cpu_data.x86_vendor != X86_VENDOR_INTEL ||
+        if ( boot_cpu_data.vendor != X86_VENDOR_INTEL ||
              !vpmu_available(v) )
             *res = EMPTY_LEAF;
         else
diff --git a/xen/arch/x86/dom0_build.c b/xen/arch/x86/dom0_build.c
index 0b467fd4a4..864dd9e53e 100644
--- a/xen/arch/x86/dom0_build.c
+++ b/xen/arch/x86/dom0_build.c
@@ -572,10 +572,10 @@ int __init dom0_setup_permissions(struct domain *d)
             rc |= iomem_deny_access(d, mfn, mfn);
     }
     /* HyperTransport range. */
-    if ( boot_cpu_data.x86_vendor & (X86_VENDOR_AMD | X86_VENDOR_HYGON) )
+    if ( boot_cpu_data.vendor & (X86_VENDOR_AMD | X86_VENDOR_HYGON) )
     {
         mfn = paddr_to_pfn(1UL <<
-                           (boot_cpu_data.x86 < 0x17 ? 40 : paddr_bits));
+                           (boot_cpu_data.family < 0x17 ? 40 : paddr_bits));
         rc |= iomem_deny_access(d, mfn - paddr_to_pfn(3UL << 32), mfn - 1);
     }
 
diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index 9c1f6ef76d..868c26036d 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -319,7 +319,7 @@ void domain_cpu_policy_changed(struct domain *d)
             if ( cpu_has_htt )
                 edx |= cpufeat_mask(X86_FEATURE_HTT);
 
-            switch ( boot_cpu_data.x86_vendor )
+            switch ( boot_cpu_data.vendor )
             {
             case X86_VENDOR_INTEL:
                 /*
@@ -372,7 +372,7 @@ void domain_cpu_policy_changed(struct domain *d)
         {
             uint64_t mask = cpuidmask_defaults._6c;
 
-            if ( boot_cpu_data.x86_vendor == X86_VENDOR_AMD )
+            if ( boot_cpu_data.vendor == X86_VENDOR_AMD )
                 mask &= (~0ULL << 32) | p->basic.raw[6].c;
 
             d->arch.pv.cpuidmasks->_6c = mask;
@@ -387,7 +387,7 @@ void domain_cpu_policy_changed(struct domain *d)
              * wholesale from the policy, but clamp the features in 7[0].ebx
              * per usual.
              */
-            if ( boot_cpu_data.x86_vendor &
+            if ( boot_cpu_data.vendor &
                  (X86_VENDOR_AMD | X86_VENDOR_HYGON) )
                 mask = (((uint64_t)p->feat.max_subleaf << 32) |
                         ((uint32_t)mask & p->feat._7b0));
@@ -400,7 +400,7 @@ void domain_cpu_policy_changed(struct domain *d)
             uint64_t mask = cpuidmask_defaults.Da1;
             uint32_t eax = p->xstate.Da1;
 
-            if ( boot_cpu_data.x86_vendor == X86_VENDOR_INTEL )
+            if ( boot_cpu_data.vendor == X86_VENDOR_INTEL )
                 mask &= (~0ULL << 32) | eax;
 
             d->arch.pv.cpuidmasks->Da1 = mask;
@@ -427,7 +427,7 @@ void domain_cpu_policy_changed(struct domain *d)
             if ( !(p->x86_vendor & (X86_VENDOR_AMD | X86_VENDOR_HYGON)) )
                 edx &= ~CPUID_COMMON_1D_FEATURES;
 
-            switch ( boot_cpu_data.x86_vendor )
+            switch ( boot_cpu_data.vendor )
             {
             case X86_VENDOR_INTEL:
                 mask &= ((uint64_t)edx << 32) | ecx;
@@ -457,7 +457,7 @@ void domain_cpu_policy_changed(struct domain *d)
         cpu_policy_updated(v);
 
         /* If PMU version is zero then the guest doesn't have VPMU */
-        if ( boot_cpu_data.x86_vendor == X86_VENDOR_INTEL &&
+        if ( boot_cpu_data.vendor == X86_VENDOR_INTEL &&
              p->basic.pmu_version == 0 )
             vpmu_destroy(v);
     }
diff --git a/xen/arch/x86/e820.c b/xen/arch/x86/e820.c
index ca577c0bde..872208ab37 100644
--- a/xen/arch/x86/e820.c
+++ b/xen/arch/x86/e820.c
@@ -426,7 +426,7 @@ static uint64_t __init mtrr_top_of_ram(void)
 
     /* By default we check only Intel systems. */
     if ( e820_mtrr_clip == -1 )
-        e820_mtrr_clip = boot_cpu_data.x86_vendor == X86_VENDOR_INTEL;
+        e820_mtrr_clip = boot_cpu_data.vendor == X86_VENDOR_INTEL;
 
     if ( !e820_mtrr_clip )
         return 0;
diff --git a/xen/arch/x86/i8259.c b/xen/arch/x86/i8259.c
index 5c7e21a751..d2a08661f8 100644
--- a/xen/arch/x86/i8259.c
+++ b/xen/arch/x86/i8259.c
@@ -419,7 +419,7 @@ void __init init_IRQ(void)
          * the interrupt.
          */
         cpumask_copy(desc->arch.cpu_mask,
-                     (boot_cpu_data.x86_vendor &
+                     (boot_cpu_data.vendor &
                       (X86_VENDOR_AMD | X86_VENDOR_HYGON) ? &cpumask_all
                                                           : cpumask_of(cpu)));
         desc->arch.vector = LEGACY_VECTOR(irq);
diff --git a/xen/arch/x86/irq.c b/xen/arch/x86/irq.c
index cc2934bfca..739fc04bd1 100644
--- a/xen/arch/x86/irq.c
+++ b/xen/arch/x86/irq.c
@@ -2011,8 +2011,8 @@ void do_IRQ(struct cpu_user_regs *regs)
                      * interrupts have been delivered to CPUs
                      * different than the BSP.
                      */
-                    (boot_cpu_data.x86_vendor & (X86_VENDOR_AMD |
-                                                 X86_VENDOR_HYGON))) &&
+                    (boot_cpu_data.vendor & (X86_VENDOR_AMD |
+                                             X86_VENDOR_HYGON))) &&
                    bogus_8259A_irq(vector - FIRST_LEGACY_VECTOR)) )
             {
                 printk("CPU%u: No irq handler for vector %02x (IRQ %d%s)\n",
diff --git a/xen/arch/x86/mpparse.c b/xen/arch/x86/mpparse.c
index c1171f7a3a..1b41aa573f 100644
--- a/xen/arch/x86/mpparse.c
+++ b/xen/arch/x86/mpparse.c
@@ -511,9 +511,9 @@ static inline void __init construct_default_ISA_mptable(int mpc_default_type)
 	/* Either an integrated APIC or a discrete 82489DX. */
 	processor.mpc_apicver = mpc_default_type > 4 ? 0x10 : 0x01;
 	processor.mpc_cpuflag = CPU_ENABLED;
-	processor.mpc_cpufeature = (boot_cpu_data.x86 << 8) |
-				   (boot_cpu_data.x86_model << 4) |
-				   boot_cpu_data.x86_mask;
+	processor.mpc_cpufeature = (boot_cpu_data.family << 8) |
+				   (boot_cpu_data.model << 4) |
+				   boot_cpu_data.stepping;
 	processor.mpc_featureflag =
             boot_cpu_data.x86_capability[FEATURESET_1d];
 	processor.mpc_reserved[0] = 0;
diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index ad75a2e108..6a97be59d5 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -170,7 +170,7 @@ int guest_rdmsr(struct vcpu *v, uint32_t msr, uint64_t *val)
 
     case MSR_IA32_PLATFORM_ID:
         if ( !(cp->x86_vendor & X86_VENDOR_INTEL) ||
-             !(boot_cpu_data.x86_vendor & X86_VENDOR_INTEL) )
+             !(boot_cpu_data.vendor & X86_VENDOR_INTEL) )
             goto gp_fault;
         rdmsrl(MSR_IA32_PLATFORM_ID, *val);
         break;
@@ -190,7 +190,7 @@ int guest_rdmsr(struct vcpu *v, uint32_t msr, uint64_t *val)
          * the guest.
          */
         if ( !(cp->x86_vendor & (X86_VENDOR_INTEL | X86_VENDOR_AMD)) ||
-             !(boot_cpu_data.x86_vendor &
+             !(boot_cpu_data.vendor &
                (X86_VENDOR_INTEL | X86_VENDOR_AMD)) ||
              rdmsr_safe(MSR_AMD_PATCHLEVEL, val) )
             goto gp_fault;
diff --git a/xen/arch/x86/nmi.c b/xen/arch/x86/nmi.c
index a0c9194ff0..91f95fe6d0 100644
--- a/xen/arch/x86/nmi.c
+++ b/xen/arch/x86/nmi.c
@@ -216,12 +216,14 @@ void disable_lapic_nmi_watchdog(void)
 {
     if (nmi_active <= 0)
         return;
-    switch (boot_cpu_data.x86_vendor) {
+    switch ( boot_cpu_data.vendor )
+    {
     case X86_VENDOR_AMD:
         wrmsrns(MSR_K7_EVNTSEL0, 0);
         break;
     case X86_VENDOR_INTEL:
-        switch (boot_cpu_data.x86) {
+        switch ( boot_cpu_data.family )
+        {
         case 6:
             wrmsrns(MSR_P6_EVNTSEL(0), 0);
             break;
@@ -362,7 +364,7 @@ static void setup_p4_watchdog(void)
         clear_msr_range(0x3F1, 2);
     /* MSR 0x3F0 seems to have a default value of 0xFC00, but current
        docs doesn't fully define it, so leave it alone for now. */
-    if (boot_cpu_data.x86_model >= 0x3) {
+    if (boot_cpu_data.model >= 0x3) {
         /* MSR_P4_IQ_ESCR0/1 (0x3ba/0x3bb) removed */
         clear_msr_range(0x3A0, 26);
         clear_msr_range(0x3BC, 3);
@@ -387,16 +389,17 @@ void setup_apic_nmi_watchdog(void)
     if ( nmi_watchdog == NMI_NONE )
         return;
 
-    switch ( boot_cpu_data.x86_vendor )
+    switch ( boot_cpu_data.vendor )
     {
     case X86_VENDOR_AMD:
         setup_k7_watchdog();
         break;
 
     case X86_VENDOR_INTEL:
-        switch (boot_cpu_data.x86) {
+        switch ( boot_cpu_data.family )
+        {
         case 6:
-            setup_p6_watchdog((boot_cpu_data.x86_model < 14) 
+            setup_p6_watchdog((boot_cpu_data.model < 14)
                               ? P6_EVENT_CPU_CLOCKS_NOT_HALTED
                               : CORE_EVENT_CPU_CLOCKS_NOT_HALTED);
             break;
diff --git a/xen/arch/x86/platform_hypercall.c b/xen/arch/x86/platform_hypercall.c
index cd4f0ae5e5..0431f875af 100644
--- a/xen/arch/x86/platform_hypercall.c
+++ b/xen/arch/x86/platform_hypercall.c
@@ -104,7 +104,7 @@ static bool msr_read_allowed(unsigned int msr)
      * the platform doesn't actually support this MSR.
      */
     case MSR_TEMPERATURE_TARGET:
-        return boot_cpu_data.x86_vendor == X86_VENDOR_INTEL &&
+        return boot_cpu_data.vendor == X86_VENDOR_INTEL &&
                host_cpu_policy.basic.digital_temp_sensor;
 
     case MSR_PACKAGE_THERM_STATUS:
@@ -688,9 +688,9 @@ ret_t do_platform_op(
             const struct cpuinfo_x86 *c = &cpu_data[ver->xen_cpuid];
 
             memcpy(ver->vendor_id, c->x86_vendor_id, sizeof(ver->vendor_id));
-            ver->family = c->x86;
-            ver->model = c->x86_model;
-            ver->stepping = c->x86_mask;
+            ver->family = c->family;
+            ver->model = c->model;
+            ver->stepping = c->stepping;
         }
 
         ver->max_present = cpumask_last(&cpu_present_map);
diff --git a/xen/arch/x86/pv/domain.c b/xen/arch/x86/pv/domain.c
index b85abb5ed9..5027c32e1a 100644
--- a/xen/arch/x86/pv/domain.c
+++ b/xen/arch/x86/pv/domain.c
@@ -175,7 +175,7 @@ static int __init cf_check pge_init(void)
 {
     if ( opt_global_pages == -1 )
         opt_global_pages = !cpu_has_hypervisor ||
-                           !(boot_cpu_data.x86_vendor &
+                           !(boot_cpu_data.vendor &
                              (X86_VENDOR_AMD | X86_VENDOR_HYGON));
 
     return 0;
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 8e59c9801a..d041cbd5f6 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -1409,7 +1409,7 @@ void asmlinkage __init noreturn __start_xen(void)
          * supervisor shadow stacks are now safe to use.
          */
         bool cpu_has_bug_shstk_fracture =
-            boot_cpu_data.x86_vendor == X86_VENDOR_INTEL &&
+            boot_cpu_data.vendor == X86_VENDOR_INTEL &&
             !boot_cpu_has(X86_FEATURE_CET_SSS);
 
         ASSERT(opt_fred >= 0); /* Confirm that FRED-ness has been resolved */
@@ -2044,10 +2044,10 @@ void asmlinkage __init noreturn __start_xen(void)
 
     /* Do not enable SMEP/SMAP in PV shim on AMD and Hygon by default */
     if ( opt_smep == -1 )
-        opt_smep = !pv_shim || !(boot_cpu_data.x86_vendor &
+        opt_smep = !pv_shim || !(boot_cpu_data.vendor &
                                  (X86_VENDOR_AMD | X86_VENDOR_HYGON));
     if ( opt_smap == -1 )
-        opt_smap = !pv_shim || !(boot_cpu_data.x86_vendor &
+        opt_smap = !pv_shim || !(boot_cpu_data.vendor &
                                  (X86_VENDOR_AMD | X86_VENDOR_HYGON));
 
     if ( !opt_smep )
diff --git a/xen/arch/x86/traps-setup.c b/xen/arch/x86/traps-setup.c
index 9b8301c23e..ccbd53fd9d 100644
--- a/xen/arch/x86/traps-setup.c
+++ b/xen/arch/x86/traps-setup.c
@@ -247,10 +247,10 @@ static void __init init_ler(void)
      * Intel Pentium 4 is the only known CPU to not use the architectural MSR
      * indicies.
      */
-    switch ( boot_cpu_data.x86_vendor )
+    switch ( boot_cpu_data.vendor )
     {
     case X86_VENDOR_INTEL:
-        if ( boot_cpu_data.x86 == 0xf )
+        if ( boot_cpu_data.family == 0xf )
         {
             msr = MSR_P4_LER_FROM_LIP;
             break;
diff --git a/xen/arch/x86/tsx.c b/xen/arch/x86/tsx.c
index fe9f0ab4f7..38371487b9 100644
--- a/xen/arch/x86/tsx.c
+++ b/xen/arch/x86/tsx.c
@@ -148,8 +148,8 @@ void tsx_init(void)
             {
                 printk(XENLOG_ERR
                        "FIRMWARE BUG: CPU %02x-%02x-%02x, ucode 0x%08x: RTM_ALWAYS_ABORT vs RTM mismatch\n",
-                       boot_cpu_data.x86, boot_cpu_data.x86_model,
-                       boot_cpu_data.x86_mask, this_cpu(cpu_sig).rev);
+                       boot_cpu_data.family, boot_cpu_data.model,
+                       boot_cpu_data.stepping, this_cpu(cpu_sig).rev);
 
                 setup_clear_cpu_cap(X86_FEATURE_RTM_ALWAYS_ABORT);
                 setup_clear_cpu_cap(X86_FEATURE_TSX_FORCE_ABORT);
diff --git a/xen/drivers/passthrough/amd/iommu_init.c b/xen/drivers/passthrough/amd/iommu_init.c
index 00d2c46cbc..d77dd85112 100644
--- a/xen/drivers/passthrough/amd/iommu_init.c
+++ b/xen/drivers/passthrough/amd/iommu_init.c
@@ -840,9 +840,9 @@ static void amd_iommu_erratum_746_workaround(struct amd_iommu *iommu)
 {
     u32 value;
 
-    if ( (boot_cpu_data.x86 != 0x15) ||
-         (boot_cpu_data.x86_model < 0x10) ||
-         (boot_cpu_data.x86_model > 0x1f) )
+    if ( (boot_cpu_data.family != 0x15) ||
+         (boot_cpu_data.model < 0x10) ||
+         (boot_cpu_data.model > 0x1f) )
         return;
 
     pci_conf_write32(iommu->sbdf, 0xf0, 0x90);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Mar 11 11:44:07 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 11 Mar 2026 11:44:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1251057.1548352 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w0Hyt-0004Yj-N6; Wed, 11 Mar 2026 11:44:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1251057.1548352; Wed, 11 Mar 2026 11:44:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w0Hyt-0004Ya-KN; Wed, 11 Mar 2026 11:44:03 +0000
Received: by outflank-mailman (input) for mailman id 1251057;
 Wed, 11 Mar 2026 11:44:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w0Hyr-0004YT-M1
 for xen-changelog@lists.xenproject.org; Wed, 11 Mar 2026 11:44:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w0Hyr-003Bpm-2g
 for xen-changelog@lists.xenproject.org;
 Wed, 11 Mar 2026 11:44:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w0Hyr-003ID1-1q
 for xen-changelog@lists.xenproject.org;
 Wed, 11 Mar 2026 11:44:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=twv7D/o6lSU/lzDf69GhMIgh9Rumi1uJLRACBYPbKqU=; b=t1DvhK8qkW8aAwXoWDJiewKLjl
	wZBnjraZLDu/inpZlnXoxshHpXxD/DJadqCR5AFXucF2Z4xpGFeuL19uNvD/Sr8q2+DYVtxNbz4tR
	A4eB+7lVDlDqp1rEg2BO4sjxicJYGxk+NL9jbY3+T4Afkw7NKB/uuEJZzavciRTGMpoM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] core-parking: shrink core_parking_cpunum[]
Message-Id: <E1w0Hyr-003ID1-1q@xenbits.xenproject.org>
Date: Wed, 11 Mar 2026 11:44:01 +0000

commit 5bfd96ddc650513d2ba5b123a3d214e789f96df1
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Mar 11 10:00:46 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 11 10:00:46 2026 +0100

    core-parking: shrink core_parking_cpunum[]
    
    This NR_CPUS-dimensioned array is likely unused on most installations.
    Therefore it is especially wasteful for it to consume more space than
    really needed. Allocate it dynamically ahead of registering the hooks.
    
    Further the array having all fields set to -1 is actually useless. Nothing
    relies on it, and core_parking_remove() doesn't restore the sentinel for
    vacated slots. Drop the initializers altogether, rather than replacing
    them.
    
    Also take the opportunity and update an adjacent variable's type, where
    a fixed-width type was pretty clearly inappropriate to use.
    
    Finally drop the redundant initializer from core_parking_init().
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/common/core_parking.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/xen/common/core_parking.c b/xen/common/core_parking.c
index 7d6a18cdcf..08003a536f 100644
--- a/xen/common/core_parking.c
+++ b/xen/common/core_parking.c
@@ -20,6 +20,7 @@
 #include <xen/cpumask.h>
 #include <xen/init.h>
 #include <xen/param.h>
+#include <xen/xvmalloc.h>
 
 #include <asm/smp.h>
 
@@ -27,8 +28,8 @@
 #define CORE_PARKING_DECREMENT 2
 
 static DEFINE_SPINLOCK(accounting_lock);
-static uint32_t cur_idle_nums;
-static unsigned int core_parking_cpunum[NR_CPUS] = {[0 ... NR_CPUS-1] = -1};
+static unsigned int cur_idle_nums;
+static unsigned int *__ro_after_init core_parking_cpunum;
 
 struct cp_policy {
     char name[30];
@@ -188,7 +189,7 @@ long cf_check core_parking_helper(void *data)
             return ret;
 
         spin_lock(&accounting_lock);
-        BUG_ON(cur_idle_nums >= ARRAY_SIZE(core_parking_cpunum));
+        BUG_ON(cur_idle_nums >= nr_cpu_ids);
         core_parking_cpunum[cur_idle_nums++] = cpu;
         spin_unlock(&accounting_lock);
     }
@@ -263,9 +264,12 @@ static int __init register_core_parking_policy(const struct cp_policy *policy)
 
 static int __init cf_check core_parking_init(void)
 {
-    int ret = 0;
+    int ret;
 
-    if ( core_parking_controller == PERFORMANCE_FIRST )
+    core_parking_cpunum = xvzalloc_array(unsigned int, nr_cpu_ids);
+    if ( !core_parking_cpunum )
+        ret = -ENOMEM;
+    else if ( core_parking_controller == PERFORMANCE_FIRST )
         ret = register_core_parking_policy(&performance_first);
     else
         ret = register_core_parking_policy(&power_first);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Mar 11 11:44:13 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 11 Mar 2026 11:44:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1251058.1548357 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w0Hz3-0004ad-Oi; Wed, 11 Mar 2026 11:44:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1251058.1548357; Wed, 11 Mar 2026 11:44:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w0Hz3-0004aV-Li; Wed, 11 Mar 2026 11:44:13 +0000
Received: by outflank-mailman (input) for mailman id 1251058;
 Wed, 11 Mar 2026 11:44:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w0Hz1-0004aI-PM
 for xen-changelog@lists.xenproject.org; Wed, 11 Mar 2026 11:44:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w0Hz1-003BqB-36
 for xen-changelog@lists.xenproject.org;
 Wed, 11 Mar 2026 11:44:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w0Hz1-003IF3-2G
 for xen-changelog@lists.xenproject.org;
 Wed, 11 Mar 2026 11:44:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=xCBybISu4Sx46oSTESja+0UFCRGND8oaBkqxaiHr3es=; b=T/bhHI0fi6TqfgT7+HokEF7c3q
	rTYBvL4Bz94f18Py20OXNgqvPRROS2nRTfjb1WfwlRLiC8ISzool30Ld94Wzyc/nXz4tw1hvxIxC6
	AmQlD2FZW6g+aUZegT/41+5VYL+2ITAEMPQP6oFHIItibbcEqEA4MObHpCGniyorJR2g=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86: Remove x86 prefixed names misc
Message-Id: <E1w0Hz1-003IF3-2G@xenbits.xenproject.org>
Date: Wed, 11 Mar 2026 11:44:11 +0000

commit bfb33fa6d4eb4110cd7dd47ec71d2e550739e126
Author:     Kevin Lampis <kevin.lampis@citrix.com>
AuthorDate: Wed Mar 11 10:03:37 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 11 10:03:37 2026 +0100

    x86: Remove x86 prefixed names misc
    
    struct cpuinfo_x86
      .x86        => .family
      .x86_vendor => .vendor
      .x86_model  => .model
      .x86_mask   => .stepping
    
    No functional change.
    
    This work is part of making Xen safe for Intel family 18/19.
    
    Signed-off-by: Kevin Lampis <kevin.lampis@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/alternative.c               |  8 ++++----
 xen/arch/x86/apic.c                      |  2 +-
 xen/arch/x86/cpuid.c                     |  2 +-
 xen/arch/x86/dom0_build.c                |  4 ++--
 xen/arch/x86/domain.c                    | 12 ++++++------
 xen/arch/x86/e820.c                      |  2 +-
 xen/arch/x86/i8259.c                     |  2 +-
 xen/arch/x86/irq.c                       |  4 ++--
 xen/arch/x86/mpparse.c                   |  6 +++---
 xen/arch/x86/msr.c                       |  4 ++--
 xen/arch/x86/nmi.c                       | 15 +++++++++------
 xen/arch/x86/platform_hypercall.c        |  8 ++++----
 xen/arch/x86/pv/domain.c                 |  2 +-
 xen/arch/x86/setup.c                     |  6 +++---
 xen/arch/x86/traps-setup.c               |  4 ++--
 xen/arch/x86/tsx.c                       |  4 ++--
 xen/drivers/passthrough/amd/iommu_init.c |  6 +++---
 17 files changed, 47 insertions(+), 44 deletions(-)

diff --git a/xen/arch/x86/alternative.c b/xen/arch/x86/alternative.c
index 9f844241bc..5ed0c26725 100644
--- a/xen/arch/x86/alternative.c
+++ b/xen/arch/x86/alternative.c
@@ -89,7 +89,7 @@ static bool init_or_livepatch_read_mostly toolchain_nops_are_ideal;
 
 static void __init arch_init_ideal_nops(void)
 {
-    switch ( boot_cpu_data.x86_vendor )
+    switch ( boot_cpu_data.vendor )
     {
     case X86_VENDOR_INTEL:
         /*
@@ -97,10 +97,10 @@ static void __init arch_init_ideal_nops(void)
          * actually perform better with the "k8_nops" than with the SDM-
          * recommended NOPs.
          */
-        if ( boot_cpu_data.x86 != 6 )
+        if ( boot_cpu_data.family != 6 )
             break;
 
-        switch ( boot_cpu_data.x86_model )
+        switch ( boot_cpu_data.model )
         {
         case 0x0f ... 0x1b:
         case 0x1d ... 0x25:
@@ -111,7 +111,7 @@ static void __init arch_init_ideal_nops(void)
         break;
 
     case X86_VENDOR_AMD:
-        if ( boot_cpu_data.x86 <= 0xf )
+        if ( boot_cpu_data.family <= 0xf )
             ideal_nops = k8_nops;
         break;
     }
diff --git a/xen/arch/x86/apic.c b/xen/arch/x86/apic.c
index fb38be7ec3..d69ef9e16a 100644
--- a/xen/arch/x86/apic.c
+++ b/xen/arch/x86/apic.c
@@ -406,7 +406,7 @@ void __init init_bsp_APIC(void)
     value |= APIC_SPIV_APIC_ENABLED;
     
     /* This bit is reserved on P4/Xeon and should be cleared */
-    if ((boot_cpu_data.x86_vendor == X86_VENDOR_INTEL) && (boot_cpu_data.x86 == 15))
+    if ((boot_cpu_data.vendor == X86_VENDOR_INTEL) && (boot_cpu_data.family == 15))
         value &= ~APIC_SPIV_FOCUS_DISABLED;
     else
         value |= APIC_SPIV_FOCUS_DISABLED;
diff --git a/xen/arch/x86/cpuid.c b/xen/arch/x86/cpuid.c
index 5decfad8cd..6e9b15c9c3 100644
--- a/xen/arch/x86/cpuid.c
+++ b/xen/arch/x86/cpuid.c
@@ -437,7 +437,7 @@ void guest_cpuid(const struct vcpu *v, uint32_t leaf,
 
     case 0xa:
         /* TODO: Rework vPMU control in terms of toolstack choices. */
-        if ( boot_cpu_data.x86_vendor != X86_VENDOR_INTEL ||
+        if ( boot_cpu_data.vendor != X86_VENDOR_INTEL ||
              !vpmu_available(v) )
             *res = EMPTY_LEAF;
         else
diff --git a/xen/arch/x86/dom0_build.c b/xen/arch/x86/dom0_build.c
index 0b467fd4a4..864dd9e53e 100644
--- a/xen/arch/x86/dom0_build.c
+++ b/xen/arch/x86/dom0_build.c
@@ -572,10 +572,10 @@ int __init dom0_setup_permissions(struct domain *d)
             rc |= iomem_deny_access(d, mfn, mfn);
     }
     /* HyperTransport range. */
-    if ( boot_cpu_data.x86_vendor & (X86_VENDOR_AMD | X86_VENDOR_HYGON) )
+    if ( boot_cpu_data.vendor & (X86_VENDOR_AMD | X86_VENDOR_HYGON) )
     {
         mfn = paddr_to_pfn(1UL <<
-                           (boot_cpu_data.x86 < 0x17 ? 40 : paddr_bits));
+                           (boot_cpu_data.family < 0x17 ? 40 : paddr_bits));
         rc |= iomem_deny_access(d, mfn - paddr_to_pfn(3UL << 32), mfn - 1);
     }
 
diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index 9c1f6ef76d..868c26036d 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -319,7 +319,7 @@ void domain_cpu_policy_changed(struct domain *d)
             if ( cpu_has_htt )
                 edx |= cpufeat_mask(X86_FEATURE_HTT);
 
-            switch ( boot_cpu_data.x86_vendor )
+            switch ( boot_cpu_data.vendor )
             {
             case X86_VENDOR_INTEL:
                 /*
@@ -372,7 +372,7 @@ void domain_cpu_policy_changed(struct domain *d)
         {
             uint64_t mask = cpuidmask_defaults._6c;
 
-            if ( boot_cpu_data.x86_vendor == X86_VENDOR_AMD )
+            if ( boot_cpu_data.vendor == X86_VENDOR_AMD )
                 mask &= (~0ULL << 32) | p->basic.raw[6].c;
 
             d->arch.pv.cpuidmasks->_6c = mask;
@@ -387,7 +387,7 @@ void domain_cpu_policy_changed(struct domain *d)
              * wholesale from the policy, but clamp the features in 7[0].ebx
              * per usual.
              */
-            if ( boot_cpu_data.x86_vendor &
+            if ( boot_cpu_data.vendor &
                  (X86_VENDOR_AMD | X86_VENDOR_HYGON) )
                 mask = (((uint64_t)p->feat.max_subleaf << 32) |
                         ((uint32_t)mask & p->feat._7b0));
@@ -400,7 +400,7 @@ void domain_cpu_policy_changed(struct domain *d)
             uint64_t mask = cpuidmask_defaults.Da1;
             uint32_t eax = p->xstate.Da1;
 
-            if ( boot_cpu_data.x86_vendor == X86_VENDOR_INTEL )
+            if ( boot_cpu_data.vendor == X86_VENDOR_INTEL )
                 mask &= (~0ULL << 32) | eax;
 
             d->arch.pv.cpuidmasks->Da1 = mask;
@@ -427,7 +427,7 @@ void domain_cpu_policy_changed(struct domain *d)
             if ( !(p->x86_vendor & (X86_VENDOR_AMD | X86_VENDOR_HYGON)) )
                 edx &= ~CPUID_COMMON_1D_FEATURES;
 
-            switch ( boot_cpu_data.x86_vendor )
+            switch ( boot_cpu_data.vendor )
             {
             case X86_VENDOR_INTEL:
                 mask &= ((uint64_t)edx << 32) | ecx;
@@ -457,7 +457,7 @@ void domain_cpu_policy_changed(struct domain *d)
         cpu_policy_updated(v);
 
         /* If PMU version is zero then the guest doesn't have VPMU */
-        if ( boot_cpu_data.x86_vendor == X86_VENDOR_INTEL &&
+        if ( boot_cpu_data.vendor == X86_VENDOR_INTEL &&
              p->basic.pmu_version == 0 )
             vpmu_destroy(v);
     }
diff --git a/xen/arch/x86/e820.c b/xen/arch/x86/e820.c
index ca577c0bde..872208ab37 100644
--- a/xen/arch/x86/e820.c
+++ b/xen/arch/x86/e820.c
@@ -426,7 +426,7 @@ static uint64_t __init mtrr_top_of_ram(void)
 
     /* By default we check only Intel systems. */
     if ( e820_mtrr_clip == -1 )
-        e820_mtrr_clip = boot_cpu_data.x86_vendor == X86_VENDOR_INTEL;
+        e820_mtrr_clip = boot_cpu_data.vendor == X86_VENDOR_INTEL;
 
     if ( !e820_mtrr_clip )
         return 0;
diff --git a/xen/arch/x86/i8259.c b/xen/arch/x86/i8259.c
index 5c7e21a751..d2a08661f8 100644
--- a/xen/arch/x86/i8259.c
+++ b/xen/arch/x86/i8259.c
@@ -419,7 +419,7 @@ void __init init_IRQ(void)
          * the interrupt.
          */
         cpumask_copy(desc->arch.cpu_mask,
-                     (boot_cpu_data.x86_vendor &
+                     (boot_cpu_data.vendor &
                       (X86_VENDOR_AMD | X86_VENDOR_HYGON) ? &cpumask_all
                                                           : cpumask_of(cpu)));
         desc->arch.vector = LEGACY_VECTOR(irq);
diff --git a/xen/arch/x86/irq.c b/xen/arch/x86/irq.c
index cc2934bfca..739fc04bd1 100644
--- a/xen/arch/x86/irq.c
+++ b/xen/arch/x86/irq.c
@@ -2011,8 +2011,8 @@ void do_IRQ(struct cpu_user_regs *regs)
                      * interrupts have been delivered to CPUs
                      * different than the BSP.
                      */
-                    (boot_cpu_data.x86_vendor & (X86_VENDOR_AMD |
-                                                 X86_VENDOR_HYGON))) &&
+                    (boot_cpu_data.vendor & (X86_VENDOR_AMD |
+                                             X86_VENDOR_HYGON))) &&
                    bogus_8259A_irq(vector - FIRST_LEGACY_VECTOR)) )
             {
                 printk("CPU%u: No irq handler for vector %02x (IRQ %d%s)\n",
diff --git a/xen/arch/x86/mpparse.c b/xen/arch/x86/mpparse.c
index c1171f7a3a..1b41aa573f 100644
--- a/xen/arch/x86/mpparse.c
+++ b/xen/arch/x86/mpparse.c
@@ -511,9 +511,9 @@ static inline void __init construct_default_ISA_mptable(int mpc_default_type)
 	/* Either an integrated APIC or a discrete 82489DX. */
 	processor.mpc_apicver = mpc_default_type > 4 ? 0x10 : 0x01;
 	processor.mpc_cpuflag = CPU_ENABLED;
-	processor.mpc_cpufeature = (boot_cpu_data.x86 << 8) |
-				   (boot_cpu_data.x86_model << 4) |
-				   boot_cpu_data.x86_mask;
+	processor.mpc_cpufeature = (boot_cpu_data.family << 8) |
+				   (boot_cpu_data.model << 4) |
+				   boot_cpu_data.stepping;
 	processor.mpc_featureflag =
             boot_cpu_data.x86_capability[FEATURESET_1d];
 	processor.mpc_reserved[0] = 0;
diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index ad75a2e108..6a97be59d5 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -170,7 +170,7 @@ int guest_rdmsr(struct vcpu *v, uint32_t msr, uint64_t *val)
 
     case MSR_IA32_PLATFORM_ID:
         if ( !(cp->x86_vendor & X86_VENDOR_INTEL) ||
-             !(boot_cpu_data.x86_vendor & X86_VENDOR_INTEL) )
+             !(boot_cpu_data.vendor & X86_VENDOR_INTEL) )
             goto gp_fault;
         rdmsrl(MSR_IA32_PLATFORM_ID, *val);
         break;
@@ -190,7 +190,7 @@ int guest_rdmsr(struct vcpu *v, uint32_t msr, uint64_t *val)
          * the guest.
          */
         if ( !(cp->x86_vendor & (X86_VENDOR_INTEL | X86_VENDOR_AMD)) ||
-             !(boot_cpu_data.x86_vendor &
+             !(boot_cpu_data.vendor &
                (X86_VENDOR_INTEL | X86_VENDOR_AMD)) ||
              rdmsr_safe(MSR_AMD_PATCHLEVEL, val) )
             goto gp_fault;
diff --git a/xen/arch/x86/nmi.c b/xen/arch/x86/nmi.c
index a0c9194ff0..91f95fe6d0 100644
--- a/xen/arch/x86/nmi.c
+++ b/xen/arch/x86/nmi.c
@@ -216,12 +216,14 @@ void disable_lapic_nmi_watchdog(void)
 {
     if (nmi_active <= 0)
         return;
-    switch (boot_cpu_data.x86_vendor) {
+    switch ( boot_cpu_data.vendor )
+    {
     case X86_VENDOR_AMD:
         wrmsrns(MSR_K7_EVNTSEL0, 0);
         break;
     case X86_VENDOR_INTEL:
-        switch (boot_cpu_data.x86) {
+        switch ( boot_cpu_data.family )
+        {
         case 6:
             wrmsrns(MSR_P6_EVNTSEL(0), 0);
             break;
@@ -362,7 +364,7 @@ static void setup_p4_watchdog(void)
         clear_msr_range(0x3F1, 2);
     /* MSR 0x3F0 seems to have a default value of 0xFC00, but current
        docs doesn't fully define it, so leave it alone for now. */
-    if (boot_cpu_data.x86_model >= 0x3) {
+    if (boot_cpu_data.model >= 0x3) {
         /* MSR_P4_IQ_ESCR0/1 (0x3ba/0x3bb) removed */
         clear_msr_range(0x3A0, 26);
         clear_msr_range(0x3BC, 3);
@@ -387,16 +389,17 @@ void setup_apic_nmi_watchdog(void)
     if ( nmi_watchdog == NMI_NONE )
         return;
 
-    switch ( boot_cpu_data.x86_vendor )
+    switch ( boot_cpu_data.vendor )
     {
     case X86_VENDOR_AMD:
         setup_k7_watchdog();
         break;
 
     case X86_VENDOR_INTEL:
-        switch (boot_cpu_data.x86) {
+        switch ( boot_cpu_data.family )
+        {
         case 6:
-            setup_p6_watchdog((boot_cpu_data.x86_model < 14) 
+            setup_p6_watchdog((boot_cpu_data.model < 14)
                               ? P6_EVENT_CPU_CLOCKS_NOT_HALTED
                               : CORE_EVENT_CPU_CLOCKS_NOT_HALTED);
             break;
diff --git a/xen/arch/x86/platform_hypercall.c b/xen/arch/x86/platform_hypercall.c
index cd4f0ae5e5..0431f875af 100644
--- a/xen/arch/x86/platform_hypercall.c
+++ b/xen/arch/x86/platform_hypercall.c
@@ -104,7 +104,7 @@ static bool msr_read_allowed(unsigned int msr)
      * the platform doesn't actually support this MSR.
      */
     case MSR_TEMPERATURE_TARGET:
-        return boot_cpu_data.x86_vendor == X86_VENDOR_INTEL &&
+        return boot_cpu_data.vendor == X86_VENDOR_INTEL &&
                host_cpu_policy.basic.digital_temp_sensor;
 
     case MSR_PACKAGE_THERM_STATUS:
@@ -688,9 +688,9 @@ ret_t do_platform_op(
             const struct cpuinfo_x86 *c = &cpu_data[ver->xen_cpuid];
 
             memcpy(ver->vendor_id, c->x86_vendor_id, sizeof(ver->vendor_id));
-            ver->family = c->x86;
-            ver->model = c->x86_model;
-            ver->stepping = c->x86_mask;
+            ver->family = c->family;
+            ver->model = c->model;
+            ver->stepping = c->stepping;
         }
 
         ver->max_present = cpumask_last(&cpu_present_map);
diff --git a/xen/arch/x86/pv/domain.c b/xen/arch/x86/pv/domain.c
index b85abb5ed9..5027c32e1a 100644
--- a/xen/arch/x86/pv/domain.c
+++ b/xen/arch/x86/pv/domain.c
@@ -175,7 +175,7 @@ static int __init cf_check pge_init(void)
 {
     if ( opt_global_pages == -1 )
         opt_global_pages = !cpu_has_hypervisor ||
-                           !(boot_cpu_data.x86_vendor &
+                           !(boot_cpu_data.vendor &
                              (X86_VENDOR_AMD | X86_VENDOR_HYGON));
 
     return 0;
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 8e59c9801a..d041cbd5f6 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -1409,7 +1409,7 @@ void asmlinkage __init noreturn __start_xen(void)
          * supervisor shadow stacks are now safe to use.
          */
         bool cpu_has_bug_shstk_fracture =
-            boot_cpu_data.x86_vendor == X86_VENDOR_INTEL &&
+            boot_cpu_data.vendor == X86_VENDOR_INTEL &&
             !boot_cpu_has(X86_FEATURE_CET_SSS);
 
         ASSERT(opt_fred >= 0); /* Confirm that FRED-ness has been resolved */
@@ -2044,10 +2044,10 @@ void asmlinkage __init noreturn __start_xen(void)
 
     /* Do not enable SMEP/SMAP in PV shim on AMD and Hygon by default */
     if ( opt_smep == -1 )
-        opt_smep = !pv_shim || !(boot_cpu_data.x86_vendor &
+        opt_smep = !pv_shim || !(boot_cpu_data.vendor &
                                  (X86_VENDOR_AMD | X86_VENDOR_HYGON));
     if ( opt_smap == -1 )
-        opt_smap = !pv_shim || !(boot_cpu_data.x86_vendor &
+        opt_smap = !pv_shim || !(boot_cpu_data.vendor &
                                  (X86_VENDOR_AMD | X86_VENDOR_HYGON));
 
     if ( !opt_smep )
diff --git a/xen/arch/x86/traps-setup.c b/xen/arch/x86/traps-setup.c
index 9b8301c23e..ccbd53fd9d 100644
--- a/xen/arch/x86/traps-setup.c
+++ b/xen/arch/x86/traps-setup.c
@@ -247,10 +247,10 @@ static void __init init_ler(void)
      * Intel Pentium 4 is the only known CPU to not use the architectural MSR
      * indicies.
      */
-    switch ( boot_cpu_data.x86_vendor )
+    switch ( boot_cpu_data.vendor )
     {
     case X86_VENDOR_INTEL:
-        if ( boot_cpu_data.x86 == 0xf )
+        if ( boot_cpu_data.family == 0xf )
         {
             msr = MSR_P4_LER_FROM_LIP;
             break;
diff --git a/xen/arch/x86/tsx.c b/xen/arch/x86/tsx.c
index fe9f0ab4f7..38371487b9 100644
--- a/xen/arch/x86/tsx.c
+++ b/xen/arch/x86/tsx.c
@@ -148,8 +148,8 @@ void tsx_init(void)
             {
                 printk(XENLOG_ERR
                        "FIRMWARE BUG: CPU %02x-%02x-%02x, ucode 0x%08x: RTM_ALWAYS_ABORT vs RTM mismatch\n",
-                       boot_cpu_data.x86, boot_cpu_data.x86_model,
-                       boot_cpu_data.x86_mask, this_cpu(cpu_sig).rev);
+                       boot_cpu_data.family, boot_cpu_data.model,
+                       boot_cpu_data.stepping, this_cpu(cpu_sig).rev);
 
                 setup_clear_cpu_cap(X86_FEATURE_RTM_ALWAYS_ABORT);
                 setup_clear_cpu_cap(X86_FEATURE_TSX_FORCE_ABORT);
diff --git a/xen/drivers/passthrough/amd/iommu_init.c b/xen/drivers/passthrough/amd/iommu_init.c
index 00d2c46cbc..d77dd85112 100644
--- a/xen/drivers/passthrough/amd/iommu_init.c
+++ b/xen/drivers/passthrough/amd/iommu_init.c
@@ -840,9 +840,9 @@ static void amd_iommu_erratum_746_workaround(struct amd_iommu *iommu)
 {
     u32 value;
 
-    if ( (boot_cpu_data.x86 != 0x15) ||
-         (boot_cpu_data.x86_model < 0x10) ||
-         (boot_cpu_data.x86_model > 0x1f) )
+    if ( (boot_cpu_data.family != 0x15) ||
+         (boot_cpu_data.model < 0x10) ||
+         (boot_cpu_data.model > 0x1f) )
         return;
 
     pci_conf_write32(iommu->sbdf, 0xf0, 0x90);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Mar 11 16:33:13 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 11 Mar 2026 16:33:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1251335.1548510 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w0MUj-0004cu-Ib; Wed, 11 Mar 2026 16:33:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1251335.1548510; Wed, 11 Mar 2026 16:33:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w0MUj-0004cn-G1; Wed, 11 Mar 2026 16:33:13 +0000
Received: by outflank-mailman (input) for mailman id 1251335;
 Wed, 11 Mar 2026 16:33:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w0MUi-0004cf-6y
 for xen-changelog@lists.xenproject.org; Wed, 11 Mar 2026 16:33:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w0MUi-003HvT-1H
 for xen-changelog@lists.xenproject.org;
 Wed, 11 Mar 2026 16:33:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w0MUi-003aLt-0T
 for xen-changelog@lists.xenproject.org;
 Wed, 11 Mar 2026 16:33:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=q0Fr7z8AgRngkJFM4b0dlgZNOE6N6o+EGrTrQ120jQU=; b=v6AaogNk3GtjBZPP2w1r12QGeJ
	uACe5h06f6qWpwTCY4kxZwKvm2diEO7TQvr0dXWPUlm6+2DujJAo9eQoUIZCi2QhgQsmv0dWZKdn1
	zP+x6goER62V1VN8rGmPDcUJTpYBoTMs13uOWO+m1vnuHeo2KAGKkMtoj/ssvGJSgJj0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] libxl: constify some local variables for building with glibc 2.43
Message-Id: <E1w0MUi-003aLt-0T@xenbits.xenproject.org>
Date: Wed, 11 Mar 2026 16:33:12 +0000

commit 8f7158589979041f96da2f73e7a5f69bc06d46b7
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Thu Feb 26 13:31:48 2026 +0100
Commit:     Anthony PERARD <anthony.perard@vates.tech>
CommitDate: Wed Mar 11 16:48:33 2026 +0100

    libxl: constify some local variables for building with glibc 2.43
    
    Archlinux just updated glibc to 2.43+r5+g856c426a7534-1 and that
    causes libxl build failure:
    
        libxl_cpuid.c: In function ‘libxl_cpuid_parse_config_xend’:
        libxl_cpuid.c:447:16: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
          447 |         endptr = strchr(str, '=');
              |                ^
        libxl_cpuid.c:452:16: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
          452 |         endptr = strchr(str, ',');
              |                ^
        libxl_cpuid.c:454:20: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
          454 |             endptr = strchr(str, 0);
              |                    ^
        cc1: all warnings being treated as errors
    
    Add missing consts. Note in libxl_cpuid_parse_config_xend() non-const
    endptr still is needed, to be compatible with the second argument to
    strtoul(). Add second variable for this reason.
    
    And while at it, move semicolon to its own line
    
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Anthony PERARD <anthony.perard@vates.tech>
    (cherry picked from commit 44da0e3b4ff7fa15ad28b628f57412a05dae653c)
---
 tools/libs/light/libxl_cpuid.c    | 21 ++++++++++++---------
 tools/libs/light/libxl_internal.c |  2 +-
 2 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/tools/libs/light/libxl_cpuid.c b/tools/libs/light/libxl_cpuid.c
index f738e17b19..ba428e5ebb 100644
--- a/tools/libs/light/libxl_cpuid.c
+++ b/tools/libs/light/libxl_cpuid.c
@@ -440,29 +440,32 @@ int libxl_cpuid_parse_config_xend(libxl_cpuid_policy_list *policy,
     str = endptr + 1;
     entry = cpuid_find_match(policy, leaf, subleaf);
     for (str = endptr + 1; *str != 0;) {
+        const char *endptrc;
+
         if (str[0] != 'e' || str[2] != 'x') {
             return 4;
         }
         value = str[1] - 'a';
-        endptr = strchr(str, '=');
-        if (value > 3 || endptr == NULL) {
+        endptrc = strchr(str, '=');
+        if (value > 3 || endptrc == NULL) {
             return 4;
         }
-        str = endptr + 1;
-        endptr = strchr(str, ',');
-        if (endptr == NULL) {
-            endptr = strchr(str, 0);
+        str = endptrc + 1;
+        endptrc = strchr(str, ',');
+        if (endptrc == NULL) {
+            endptrc = strchr(str, 0);
         }
-        if (endptr - str != 32) {
+        if (endptrc - str != 32) {
             return 5;
         }
         entry->policy[value] = calloc(32 + 1, 1);
         strncpy(entry->policy[value], str, 32);
         entry->policy[value][32] = 0;
-        if (*endptr == 0) {
+        if (*endptrc == 0) {
             break;
         }
-        for (str = endptr + 1; *str == ' ' || *str == '\n'; str++);
+        for (str = endptrc + 1; *str == ' ' || *str == '\n'; str++)
+            ;
     }
     return 0;
 }
diff --git a/tools/libs/light/libxl_internal.c b/tools/libs/light/libxl_internal.c
index c95624933f..7e3c0eaae5 100644
--- a/tools/libs/light/libxl_internal.c
+++ b/tools/libs/light/libxl_internal.c
@@ -204,7 +204,7 @@ char *libxl__strndup(libxl__gc *gc, const char *c, size_t n)
 
 char *libxl__dirname(libxl__gc *gc, const char *s)
 {
-    char *c = strrchr(s, '/');
+    const char *c = strrchr(s, '/');
 
     if (!c)
         return NULL;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Mar 11 16:33:13 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 11 Mar 2026 16:33:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1251334.1548507 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w0MUZ-0004bf-HX; Wed, 11 Mar 2026 16:33:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1251334.1548507; Wed, 11 Mar 2026 16:33:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w0MUZ-0004bW-EI; Wed, 11 Mar 2026 16:33:03 +0000
Received: by outflank-mailman (input) for mailman id 1251334;
 Wed, 11 Mar 2026 16:33:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w0MUY-0004bQ-4V
 for xen-changelog@lists.xenproject.org; Wed, 11 Mar 2026 16:33:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w0MUY-003Hv7-0y
 for xen-changelog@lists.xenproject.org;
 Wed, 11 Mar 2026 16:33:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w0MUY-003aJU-0A
 for xen-changelog@lists.xenproject.org;
 Wed, 11 Mar 2026 16:33:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=jSfAStewNRyYWnVSVQ5exCw03gp4/iJWuG1uP18ScrU=; b=GnqfJgkHYcucUHWbA0SjVXcOXP
	VKJ2UMcPHTMh8k66pcY8RUIhTOhaKwjHsw75utWU8xbrVMsqaBZC0egUiM8z38TWqWOVdJPC6gN5H
	sMUnPZpI08OlpRuVSrLvw/pU+eDn4PGLLQ5ey8Vf/u/DyKw3Wdde1PxYnSRMuJzA3xRc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] libxl: Fix device_add QMP calls with QEMU 9.2 and newer
Message-Id: <E1w0MUY-003aJU-0A@xenbits.xenproject.org>
Date: Wed, 11 Mar 2026 16:33:02 +0000

commit 49068c5f70608f2dedfa60af135a6c4bbc970001
Author:     Anthony PERARD <anthony.perard@vates.tech>
AuthorDate: Mon Dec 15 14:51:24 2025 +0100
Commit:     Anthony PERARD <anthony.perard@vates.tech>
CommitDate: Wed Mar 11 16:48:33 2026 +0100

    libxl: Fix device_add QMP calls with QEMU 9.2 and newer
    
    QEMU used to ignore JSON types and do conversion string <-> integer
    automatically for the command "device_add", but that was removed in
    QEMU 9.2 (428d1789df91 ("docs/about: Belatedly document tightening of
    QMP device_add checking")).
    
    Fixes: 9718ab394d5d ("libxl_usb: Make libxl__device_usbctrl_add uses ev_qmp")
    Fixes: 40c7eca10a82 ("libxl_usb: Make libxl__device_usbdev_add uses ev_qmp")
    Signed-off-by: Anthony PERARD <anthony.perard@vates.tech>
    Tested-by: Maximilian Engelhardt <maxi@daemonizer.de>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    (cherry picked from commit 85e12104f47276b588d5efd33599c987c545eeb1)
---
 tools/libs/light/libxl_usb.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/tools/libs/light/libxl_usb.c b/tools/libs/light/libxl_usb.c
index c5ae59681c..4e7c409fe6 100644
--- a/tools/libs/light/libxl_usb.c
+++ b/tools/libs/light/libxl_usb.c
@@ -367,10 +367,10 @@ static int libxl__device_usbctrl_add_hvm(libxl__egc *egc, libxl__ev_qmp *qmp,
     case 3:
         libxl__qmp_param_add_string(gc, &qmp_args,
                                     "driver", "nec-usb-xhci");
-        libxl__qmp_param_add_string(gc, &qmp_args, "p2",
-                                    GCSPRINTF("%d", usbctrl->ports));
-        libxl__qmp_param_add_string(gc, &qmp_args, "p3",
-                                    GCSPRINTF("%d", usbctrl->ports));
+        libxl__qmp_param_add_integer(gc, &qmp_args, "p2",
+                                     usbctrl->ports);
+        libxl__qmp_param_add_integer(gc, &qmp_args, "p3",
+                                     usbctrl->ports);
         break;
     default:
         abort(); /* Should not be possible. */
@@ -411,10 +411,10 @@ static int libxl__device_usbdev_add_hvm(libxl__egc *egc, libxl__ev_qmp *qmp,
         GCSPRINTF("xenusb-%d.0", usbdev->ctrl));
     libxl__qmp_param_add_string(gc, &qmp_args, "port",
         GCSPRINTF("%d", usbdev->port));
-    libxl__qmp_param_add_string(gc, &qmp_args, "hostbus",
-        GCSPRINTF("%d", usbdev->u.hostdev.hostbus));
-    libxl__qmp_param_add_string(gc, &qmp_args, "hostaddr",
-        GCSPRINTF("%d", usbdev->u.hostdev.hostaddr));
+    libxl__qmp_param_add_integer(gc, &qmp_args, "hostbus",
+                                 usbdev->u.hostdev.hostbus);
+    libxl__qmp_param_add_integer(gc, &qmp_args, "hostaddr",
+                                 usbdev->u.hostdev.hostaddr);
 
     return libxl__ev_qmp_send(egc, qmp, "device_add", qmp_args);
 }
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Mar 11 16:33:23 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 11 Mar 2026 16:33:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1251336.1548515 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w0MUt-0004fU-K9; Wed, 11 Mar 2026 16:33:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1251336.1548515; Wed, 11 Mar 2026 16:33:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w0MUt-0004fM-HV; Wed, 11 Mar 2026 16:33:23 +0000
Received: by outflank-mailman (input) for mailman id 1251336;
 Wed, 11 Mar 2026 16:33:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w0MUs-0004f9-9f
 for xen-changelog@lists.xenproject.org; Wed, 11 Mar 2026 16:33:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w0MUs-003HvY-1Y
 for xen-changelog@lists.xenproject.org;
 Wed, 11 Mar 2026 16:33:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w0MUs-003aMh-0l
 for xen-changelog@lists.xenproject.org;
 Wed, 11 Mar 2026 16:33:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=yHpBspwtQ/Qp+4bz8vHgIhbJmh+bsAE9wEQDqEwQAbQ=; b=q1rD2Z7E2tdGtoDD/8wU6uuB+K
	7035GODBWw4o6t2kWebpfoBdLTe6r1SR1FXOPVVj/zCG+9brQPVrbYFtDXQATjHTRoA0JUzi+44ui
	6hLo5wDGWVoKpSBFVmizQKKpJ+aC+9WE+fdGdR5rU/BhTiwvc87315uOg68Pt4+s6nis=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] tools/sd-notify.h: Include string.h too
Message-Id: <E1w0MUs-003aMh-0l@xenbits.xenproject.org>
Date: Wed, 11 Mar 2026 16:33:22 +0000

commit da800c182026642a87f3e6c1c1d0a0f3bc594c44
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Dec 5 21:33:25 2025 +0000
Commit:     Anthony PERARD <anthony.perard@vates.tech>
CommitDate: Wed Mar 11 16:48:33 2026 +0100

    tools/sd-notify.h: Include string.h too
    
    Alpine Linux, when using --enable-systemd to get the init files, fails with:
    
      tools/include/xen-sd-notify.h:69:3: error: call to undeclared library
      function 'memcpy' with type 'void *(void *, const void *, unsigned long)';
      ISO C99 and later do not support implicit function declarations
      [-Wimplicit-function-declaration]
         69 |   memcpy(socket_addr.sun.sun_path, socket_path, path_length);
            |   ^
    
    This will be down to using musl rather than glibc.  Include the appropriate
    header.
    
    Fixes: 78510f3a1522 ("tools: Import stand-alone sd_notify() implementation from systemd")
    Reported-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Acked-by: Anthony PERARD <anthony.perard@vates.tech>
    (cherry picked from commit 8efff5a69ab7596f6c63031d0aef292114948cd9)
---
 tools/include/xen-sd-notify.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/include/xen-sd-notify.h b/tools/include/xen-sd-notify.h
index 28c9b20f15..20441d0ec9 100644
--- a/tools/include/xen-sd-notify.h
+++ b/tools/include/xen-sd-notify.h
@@ -20,6 +20,7 @@
 #include <errno.h>
 #include <stddef.h>
 #include <stdlib.h>
+#include <string.h>
 #include <sys/socket.h>
 #include <sys/un.h>
 #include <unistd.h>
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Mar 11 16:33:33 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 11 Mar 2026 16:33:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1251337.1548519 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w0MV3-0004hg-LY; Wed, 11 Mar 2026 16:33:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1251337.1548519; Wed, 11 Mar 2026 16:33:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w0MV3-0004hY-Ir; Wed, 11 Mar 2026 16:33:33 +0000
Received: by outflank-mailman (input) for mailman id 1251337;
 Wed, 11 Mar 2026 16:33:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w0MV2-0004hL-Ce
 for xen-changelog@lists.xenproject.org; Wed, 11 Mar 2026 16:33:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w0MV2-003Hve-1q
 for xen-changelog@lists.xenproject.org;
 Wed, 11 Mar 2026 16:33:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w0MV2-003aOO-12
 for xen-changelog@lists.xenproject.org;
 Wed, 11 Mar 2026 16:33:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Veo4u+9Q1ndt0Qjmxu7JjIPQHeI3Rx6CTvw+zeAeRjs=; b=yrWKeNlkok8yAIQKBwqVhamPJr
	Bf6D1Qqv6xARXdqfVzjqC5xcZc/wc24KA9TLnDpvqTZz5LsFgeV8cU4E/9FtmasBywajz9W4NPaqD
	0wkuHsXkRWEU11FXJmxLROcoPVok3KMqS5zMbmMjDjwXQHdqdGZAvmiwxB9aqvyhFxh0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] tools/ocaml: fix 32-bit truncation bug in stub_xc_domain_setmaxmem()
Message-Id: <E1w0MV2-003aOO-12@xenbits.xenproject.org>
Date: Wed, 11 Mar 2026 16:33:32 +0000

commit 638f4f81af102365737c778cf6ce0dc78130e580
Author:     Edwin Török <edwin.torok@citrix.com>
AuthorDate: Thu Feb 5 13:56:45 2026 +0000
Commit:     Anthony PERARD <anthony.perard@vates.tech>
CommitDate: Wed Mar 11 16:48:33 2026 +0100

    tools/ocaml: fix 32-bit truncation bug in stub_xc_domain_setmaxmem()
    
    Observed when attempting to boot a >4TiB VM:
    
    After a call to domain_setmaxmem with 6370254848 (KiB), the domain's maxmem
    got set to 2075287552, which is exactly 2^32 smaller.
    
    xc_domain_setmaxmem takes an uint64_t as a parameter, and the OCaml value
    is 64-bit already, so fix the C variable to match the type and avoid the
    truncation.
    
    Fixes: f5b43e95facd ("libxl: fix "xl mem-set" regression from 0c029c4da2")
    Signed-off-by: Edwin Török <edwin.torok@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@cloud.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    (cherry picked from commit 381b4ff16f7ff83a2dc44f16b8dd0208f3255ec7)
---
 tools/ocaml/libs/xc/xenctrl_stubs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/ocaml/libs/xc/xenctrl_stubs.c b/tools/ocaml/libs/xc/xenctrl_stubs.c
index c6da9bb091..56a14aada2 100644
--- a/tools/ocaml/libs/xc/xenctrl_stubs.c
+++ b/tools/ocaml/libs/xc/xenctrl_stubs.c
@@ -938,7 +938,7 @@ CAMLprim value stub_xc_domain_setmaxmem(value xch_val, value domid,
 	int retval;
 
 	uint32_t c_domid = Int_val(domid);
-	unsigned int c_max_memkb = Int64_val(max_memkb);
+	uint64_t c_max_memkb = Int64_val(max_memkb);
 	caml_enter_blocking_section();
 	retval = xc_domain_setmaxmem(xch, c_domid, c_max_memkb);
 	caml_leave_blocking_section();
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Mar 11 17:11:05 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 11 Mar 2026 17:11:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1251379.1548540 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w0N5L-0001w5-Lx; Wed, 11 Mar 2026 17:11:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1251379.1548540; Wed, 11 Mar 2026 17:11:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w0N5L-0001vx-JV; Wed, 11 Mar 2026 17:11:03 +0000
Received: by outflank-mailman (input) for mailman id 1251379;
 Wed, 11 Mar 2026 17:11:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w0N5K-0001vr-4j
 for xen-changelog@lists.xenproject.org; Wed, 11 Mar 2026 17:11:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w0N5K-003IdD-0p
 for xen-changelog@lists.xenproject.org;
 Wed, 11 Mar 2026 17:11:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w0N5K-003kmW-02
 for xen-changelog@lists.xenproject.org;
 Wed, 11 Mar 2026 17:11:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=CfdMzkVHxZRnPPWwVdazGGwEqIW8vZco441YEJGZBCs=; b=35iG37g1zqFW/sFJr8hc6mIhUF
	GV6NV/tcfAA8+jWFbPDTPPpW+VasQ7xVsgWtYnQF1mMtCqSfuYnoWtHAY+qX3H8SMILlRdm5F6oDL
	WJfHMhiNhfGXKo+MO4G0b8gb9mOOLy4YxKcRYz4TtR7ZOGr012agsRh3DAAw2nWLm7mU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] libxl: Fix device_add QMP calls with QEMU 9.2 and newer
Message-Id: <E1w0N5K-003kmW-02@xenbits.xenproject.org>
Date: Wed, 11 Mar 2026 17:11:02 +0000

commit 49068c5f70608f2dedfa60af135a6c4bbc970001
Author:     Anthony PERARD <anthony.perard@vates.tech>
AuthorDate: Mon Dec 15 14:51:24 2025 +0100
Commit:     Anthony PERARD <anthony.perard@vates.tech>
CommitDate: Wed Mar 11 16:48:33 2026 +0100

    libxl: Fix device_add QMP calls with QEMU 9.2 and newer
    
    QEMU used to ignore JSON types and do conversion string <-> integer
    automatically for the command "device_add", but that was removed in
    QEMU 9.2 (428d1789df91 ("docs/about: Belatedly document tightening of
    QMP device_add checking")).
    
    Fixes: 9718ab394d5d ("libxl_usb: Make libxl__device_usbctrl_add uses ev_qmp")
    Fixes: 40c7eca10a82 ("libxl_usb: Make libxl__device_usbdev_add uses ev_qmp")
    Signed-off-by: Anthony PERARD <anthony.perard@vates.tech>
    Tested-by: Maximilian Engelhardt <maxi@daemonizer.de>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    (cherry picked from commit 85e12104f47276b588d5efd33599c987c545eeb1)
---
 tools/libs/light/libxl_usb.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/tools/libs/light/libxl_usb.c b/tools/libs/light/libxl_usb.c
index c5ae59681c..4e7c409fe6 100644
--- a/tools/libs/light/libxl_usb.c
+++ b/tools/libs/light/libxl_usb.c
@@ -367,10 +367,10 @@ static int libxl__device_usbctrl_add_hvm(libxl__egc *egc, libxl__ev_qmp *qmp,
     case 3:
         libxl__qmp_param_add_string(gc, &qmp_args,
                                     "driver", "nec-usb-xhci");
-        libxl__qmp_param_add_string(gc, &qmp_args, "p2",
-                                    GCSPRINTF("%d", usbctrl->ports));
-        libxl__qmp_param_add_string(gc, &qmp_args, "p3",
-                                    GCSPRINTF("%d", usbctrl->ports));
+        libxl__qmp_param_add_integer(gc, &qmp_args, "p2",
+                                     usbctrl->ports);
+        libxl__qmp_param_add_integer(gc, &qmp_args, "p3",
+                                     usbctrl->ports);
         break;
     default:
         abort(); /* Should not be possible. */
@@ -411,10 +411,10 @@ static int libxl__device_usbdev_add_hvm(libxl__egc *egc, libxl__ev_qmp *qmp,
         GCSPRINTF("xenusb-%d.0", usbdev->ctrl));
     libxl__qmp_param_add_string(gc, &qmp_args, "port",
         GCSPRINTF("%d", usbdev->port));
-    libxl__qmp_param_add_string(gc, &qmp_args, "hostbus",
-        GCSPRINTF("%d", usbdev->u.hostdev.hostbus));
-    libxl__qmp_param_add_string(gc, &qmp_args, "hostaddr",
-        GCSPRINTF("%d", usbdev->u.hostdev.hostaddr));
+    libxl__qmp_param_add_integer(gc, &qmp_args, "hostbus",
+                                 usbdev->u.hostdev.hostbus);
+    libxl__qmp_param_add_integer(gc, &qmp_args, "hostaddr",
+                                 usbdev->u.hostdev.hostaddr);
 
     return libxl__ev_qmp_send(egc, qmp, "device_add", qmp_args);
 }
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Mar 11 17:11:13 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 11 Mar 2026 17:11:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1251380.1548546 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w0N5V-0001xp-Nw; Wed, 11 Mar 2026 17:11:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1251380.1548546; Wed, 11 Mar 2026 17:11:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w0N5V-0001xd-Kq; Wed, 11 Mar 2026 17:11:13 +0000
Received: by outflank-mailman (input) for mailman id 1251380;
 Wed, 11 Mar 2026 17:11:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w0N5U-0001xP-6A
 for xen-changelog@lists.xenproject.org; Wed, 11 Mar 2026 17:11:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w0N5U-003Ide-1A
 for xen-changelog@lists.xenproject.org;
 Wed, 11 Mar 2026 17:11:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w0N5U-003knF-0K
 for xen-changelog@lists.xenproject.org;
 Wed, 11 Mar 2026 17:11:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Dae9OVhKKA/3e7kWxXmocPczOTEP1Khic3hdEc3BiPg=; b=hK5URfMgXkKCD2R3Xb0lNv0GoQ
	osth8UFRTp/unxD18qeYSvQA8G1k4qB/cfsD6QGiFocg1bmMDFBczXRFDjEbFD/yJWDJpQaIF//gR
	0bzP5fRifWnzpPL+ugQSYrWHpln6Jv0u6U+FmJ5Vt6cI4tc6/aMyNcRd2Dz9qT64LCGw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] libxl: constify some local variables for building with glibc 2.43
Message-Id: <E1w0N5U-003knF-0K@xenbits.xenproject.org>
Date: Wed, 11 Mar 2026 17:11:12 +0000

commit 8f7158589979041f96da2f73e7a5f69bc06d46b7
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Thu Feb 26 13:31:48 2026 +0100
Commit:     Anthony PERARD <anthony.perard@vates.tech>
CommitDate: Wed Mar 11 16:48:33 2026 +0100

    libxl: constify some local variables for building with glibc 2.43
    
    Archlinux just updated glibc to 2.43+r5+g856c426a7534-1 and that
    causes libxl build failure:
    
        libxl_cpuid.c: In function ‘libxl_cpuid_parse_config_xend’:
        libxl_cpuid.c:447:16: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
          447 |         endptr = strchr(str, '=');
              |                ^
        libxl_cpuid.c:452:16: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
          452 |         endptr = strchr(str, ',');
              |                ^
        libxl_cpuid.c:454:20: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
          454 |             endptr = strchr(str, 0);
              |                    ^
        cc1: all warnings being treated as errors
    
    Add missing consts. Note in libxl_cpuid_parse_config_xend() non-const
    endptr still is needed, to be compatible with the second argument to
    strtoul(). Add second variable for this reason.
    
    And while at it, move semicolon to its own line
    
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Anthony PERARD <anthony.perard@vates.tech>
    (cherry picked from commit 44da0e3b4ff7fa15ad28b628f57412a05dae653c)
---
 tools/libs/light/libxl_cpuid.c    | 21 ++++++++++++---------
 tools/libs/light/libxl_internal.c |  2 +-
 2 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/tools/libs/light/libxl_cpuid.c b/tools/libs/light/libxl_cpuid.c
index f738e17b19..ba428e5ebb 100644
--- a/tools/libs/light/libxl_cpuid.c
+++ b/tools/libs/light/libxl_cpuid.c
@@ -440,29 +440,32 @@ int libxl_cpuid_parse_config_xend(libxl_cpuid_policy_list *policy,
     str = endptr + 1;
     entry = cpuid_find_match(policy, leaf, subleaf);
     for (str = endptr + 1; *str != 0;) {
+        const char *endptrc;
+
         if (str[0] != 'e' || str[2] != 'x') {
             return 4;
         }
         value = str[1] - 'a';
-        endptr = strchr(str, '=');
-        if (value > 3 || endptr == NULL) {
+        endptrc = strchr(str, '=');
+        if (value > 3 || endptrc == NULL) {
             return 4;
         }
-        str = endptr + 1;
-        endptr = strchr(str, ',');
-        if (endptr == NULL) {
-            endptr = strchr(str, 0);
+        str = endptrc + 1;
+        endptrc = strchr(str, ',');
+        if (endptrc == NULL) {
+            endptrc = strchr(str, 0);
         }
-        if (endptr - str != 32) {
+        if (endptrc - str != 32) {
             return 5;
         }
         entry->policy[value] = calloc(32 + 1, 1);
         strncpy(entry->policy[value], str, 32);
         entry->policy[value][32] = 0;
-        if (*endptr == 0) {
+        if (*endptrc == 0) {
             break;
         }
-        for (str = endptr + 1; *str == ' ' || *str == '\n'; str++);
+        for (str = endptrc + 1; *str == ' ' || *str == '\n'; str++)
+            ;
     }
     return 0;
 }
diff --git a/tools/libs/light/libxl_internal.c b/tools/libs/light/libxl_internal.c
index c95624933f..7e3c0eaae5 100644
--- a/tools/libs/light/libxl_internal.c
+++ b/tools/libs/light/libxl_internal.c
@@ -204,7 +204,7 @@ char *libxl__strndup(libxl__gc *gc, const char *c, size_t n)
 
 char *libxl__dirname(libxl__gc *gc, const char *s)
 {
-    char *c = strrchr(s, '/');
+    const char *c = strrchr(s, '/');
 
     if (!c)
         return NULL;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Mar 11 17:11:23 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 11 Mar 2026 17:11:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1251381.1548548 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w0N5f-000204-PN; Wed, 11 Mar 2026 17:11:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1251381.1548548; Wed, 11 Mar 2026 17:11:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w0N5f-0001zy-MY; Wed, 11 Mar 2026 17:11:23 +0000
Received: by outflank-mailman (input) for mailman id 1251381;
 Wed, 11 Mar 2026 17:11:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w0N5e-0001zp-8u
 for xen-changelog@lists.xenproject.org; Wed, 11 Mar 2026 17:11:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w0N5e-003Idj-1U
 for xen-changelog@lists.xenproject.org;
 Wed, 11 Mar 2026 17:11:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w0N5e-003koo-0e
 for xen-changelog@lists.xenproject.org;
 Wed, 11 Mar 2026 17:11:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=lz5V8MeLHCc+PfT00WF5PLA9W/C2MPEGZdhZSpm8TFU=; b=Ym38MYwEJuKPj5zXtJviOWAFFc
	gR8yqsv4nthuB58+JWWc9Mal+i2bGymlpObZA3FWT4NwUaHdYr+4tblq6GkqV0eXQPP7dwLUwAq84
	o7V4aT0tWoOU2pDzxHHTnjrlNRfGQMtZy5bk/73huQU7I8f2C5rSd81udgbd6bms9434=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] tools/sd-notify.h: Include string.h too
Message-Id: <E1w0N5e-003koo-0e@xenbits.xenproject.org>
Date: Wed, 11 Mar 2026 17:11:22 +0000

commit da800c182026642a87f3e6c1c1d0a0f3bc594c44
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Dec 5 21:33:25 2025 +0000
Commit:     Anthony PERARD <anthony.perard@vates.tech>
CommitDate: Wed Mar 11 16:48:33 2026 +0100

    tools/sd-notify.h: Include string.h too
    
    Alpine Linux, when using --enable-systemd to get the init files, fails with:
    
      tools/include/xen-sd-notify.h:69:3: error: call to undeclared library
      function 'memcpy' with type 'void *(void *, const void *, unsigned long)';
      ISO C99 and later do not support implicit function declarations
      [-Wimplicit-function-declaration]
         69 |   memcpy(socket_addr.sun.sun_path, socket_path, path_length);
            |   ^
    
    This will be down to using musl rather than glibc.  Include the appropriate
    header.
    
    Fixes: 78510f3a1522 ("tools: Import stand-alone sd_notify() implementation from systemd")
    Reported-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Acked-by: Anthony PERARD <anthony.perard@vates.tech>
    (cherry picked from commit 8efff5a69ab7596f6c63031d0aef292114948cd9)
---
 tools/include/xen-sd-notify.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/include/xen-sd-notify.h b/tools/include/xen-sd-notify.h
index 28c9b20f15..20441d0ec9 100644
--- a/tools/include/xen-sd-notify.h
+++ b/tools/include/xen-sd-notify.h
@@ -20,6 +20,7 @@
 #include <errno.h>
 #include <stddef.h>
 #include <stdlib.h>
+#include <string.h>
 #include <sys/socket.h>
 #include <sys/un.h>
 #include <unistd.h>
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Mar 11 17:11:33 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 11 Mar 2026 17:11:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1251382.1548552 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w0N5p-00022b-Rb; Wed, 11 Mar 2026 17:11:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1251382.1548552; Wed, 11 Mar 2026 17:11:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w0N5p-00022V-P8; Wed, 11 Mar 2026 17:11:33 +0000
Received: by outflank-mailman (input) for mailman id 1251382;
 Wed, 11 Mar 2026 17:11:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w0N5o-00022N-Bz
 for xen-changelog@lists.xenproject.org; Wed, 11 Mar 2026 17:11:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w0N5o-003Ids-1n
 for xen-changelog@lists.xenproject.org;
 Wed, 11 Mar 2026 17:11:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w0N5o-003kpR-0y
 for xen-changelog@lists.xenproject.org;
 Wed, 11 Mar 2026 17:11:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Et8uJRvy7y4+PWImcajBdrVxDf4y95Ji8QZ0Aikrd8Q=; b=ALlsrMdt+h0rx3EW3EEE5qDPSq
	AWNksm5Og9QLRtJmk8QKaEbWoPpnoGDhmWQgBEbHfizSVFMHn2CHV+XJr0gZEaEaOgvun+560J+PG
	AkTNgEVvCmZeXU/cAjM3woI21mOW4zFlmNnyiWGoHgDdsbR6VZnkZNSONVAQQ80K5CLk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] tools/ocaml: fix 32-bit truncation bug in stub_xc_domain_setmaxmem()
Message-Id: <E1w0N5o-003kpR-0y@xenbits.xenproject.org>
Date: Wed, 11 Mar 2026 17:11:32 +0000

commit 638f4f81af102365737c778cf6ce0dc78130e580
Author:     Edwin Török <edwin.torok@citrix.com>
AuthorDate: Thu Feb 5 13:56:45 2026 +0000
Commit:     Anthony PERARD <anthony.perard@vates.tech>
CommitDate: Wed Mar 11 16:48:33 2026 +0100

    tools/ocaml: fix 32-bit truncation bug in stub_xc_domain_setmaxmem()
    
    Observed when attempting to boot a >4TiB VM:
    
    After a call to domain_setmaxmem with 6370254848 (KiB), the domain's maxmem
    got set to 2075287552, which is exactly 2^32 smaller.
    
    xc_domain_setmaxmem takes an uint64_t as a parameter, and the OCaml value
    is 64-bit already, so fix the C variable to match the type and avoid the
    truncation.
    
    Fixes: f5b43e95facd ("libxl: fix "xl mem-set" regression from 0c029c4da2")
    Signed-off-by: Edwin Török <edwin.torok@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@cloud.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    (cherry picked from commit 381b4ff16f7ff83a2dc44f16b8dd0208f3255ec7)
---
 tools/ocaml/libs/xc/xenctrl_stubs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/ocaml/libs/xc/xenctrl_stubs.c b/tools/ocaml/libs/xc/xenctrl_stubs.c
index c6da9bb091..56a14aada2 100644
--- a/tools/ocaml/libs/xc/xenctrl_stubs.c
+++ b/tools/ocaml/libs/xc/xenctrl_stubs.c
@@ -938,7 +938,7 @@ CAMLprim value stub_xc_domain_setmaxmem(value xch_val, value domid,
 	int retval;
 
 	uint32_t c_domid = Int_val(domid);
-	unsigned int c_max_memkb = Int64_val(max_memkb);
+	uint64_t c_max_memkb = Int64_val(max_memkb);
 	caml_enter_blocking_section();
 	retval = xc_domain_setmaxmem(xch, c_domid, c_max_memkb);
 	caml_leave_blocking_section();
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Mar 12 08:33:07 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 12 Mar 2026 08:33:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1251814.1548672 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w0bTb-0002Fj-7t; Thu, 12 Mar 2026 08:33:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1251814.1548672; Thu, 12 Mar 2026 08:33:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w0bTb-0002FZ-4E; Thu, 12 Mar 2026 08:33:03 +0000
Received: by outflank-mailman (input) for mailman id 1251814;
 Thu, 12 Mar 2026 08:33:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w0bTa-0002FT-E8
 for xen-changelog@lists.xenproject.org; Thu, 12 Mar 2026 08:33:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w0bTa-004iks-1j
 for xen-changelog@lists.xenproject.org;
 Thu, 12 Mar 2026 08:33:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w0bTa-004wBp-0p
 for xen-changelog@lists.xenproject.org;
 Thu, 12 Mar 2026 08:33:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=6N3YmaDkM1FhLDDC72aRDFLsi6L7zGIyvVKF9x78D8w=; b=GEsW0DHKcxT6uVPmstgtGBXrf3
	OGX+82/IYEOwPk/l8D8DBJf6ObFKSGpeYjbIm+/Yp5i+bsVVa6M0cOnzW5F6+eUqDn+UXrjQI8IFe
	/UM+F2lqBTtWxch1wHOkAVtcg6u6Fjil/6eiVmDDSRMXTt+E5nVfB76ezx5kpx3zEBN0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: fix unmapped access trapping on GICv2 hardware
Message-Id: <E1w0bTa-004wBp-0p@xenbits.xenproject.org>
Date: Thu, 12 Mar 2026 08:33:02 +0000

commit 17a9070d22d21b2faa68231e7fd835748b36fc73
Author:     Stewart Hildebrand <stewart.hildebrand@amd.com>
AuthorDate: Thu Feb 5 20:01:27 2026 +0100
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Thu Mar 12 09:09:16 2026 +0100

    xen/arm: fix unmapped access trapping on GICv2 hardware
    
    Since 4dbcb0653621, the vGICv2 CPU interface is mapped in a deferred
    manner. On domains with XEN_DOMCTL_CDF_trap_unmapped_accesses unset on
    GICv2 hardware, the vGICv2 CPU interface fails to be mapped. A visible
    symptom is that a domU gets stuck at:
    
      [    0.177983] smp: Bringing up secondary CPUs ...
    
    Move the 2nd check_p2m earlier so it's prioritized over try_handle_mmio.
    
    Fixes: 980aff4e8fcd ("xen/arm: Add way to disable traps on accesses to unmapped addresses")
    Signed-off-by: Stewart Hildebrand <stewart.hildebrand@amd.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
 xen/arch/arm/traps.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
index 040c0f2e0d..0c01f37ad6 100644
--- a/xen/arch/arm/traps.c
+++ b/xen/arch/arm/traps.c
@@ -1915,6 +1915,14 @@ static void do_trap_stage2_abort_guest(struct cpu_user_regs *regs,
         if ( info.dabt_instr.state == INSTR_ERROR )
             goto inject_abt;
 
+        /*
+         * If the instruction syndrome was invalid, then we already checked if
+         * this was due to a P2M fault. So no point to check again as the result
+         * will be the same.
+         */
+        if ( (info.dabt_instr.state == INSTR_VALID) && check_p2m(is_data, gpa) )
+            return;
+
         state = try_handle_mmio(regs, &info);
 
         switch ( state )
@@ -1939,14 +1947,6 @@ static void do_trap_stage2_abort_guest(struct cpu_user_regs *regs,
                 break;
         }
 
-        /*
-         * If the instruction syndrome was invalid, then we already checked if
-         * this was due to a P2M fault. So no point to check again as the result
-         * will be the same.
-         */
-        if ( (info.dabt_instr.state == INSTR_VALID) && check_p2m(is_data, gpa) )
-            return;
-
         break;
     }
     default:
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Mar 12 10:22:11 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 12 Mar 2026 10:22:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1251955.1548756 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w0dB4-0003KS-UK; Thu, 12 Mar 2026 10:22:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1251955.1548756; Thu, 12 Mar 2026 10:22:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w0dB4-0003KK-Rc; Thu, 12 Mar 2026 10:22:02 +0000
Received: by outflank-mailman (input) for mailman id 1251955;
 Thu, 12 Mar 2026 10:22:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w0dB3-0003KE-GL
 for xen-changelog@lists.xenproject.org; Thu, 12 Mar 2026 10:22:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w0dB3-004kvu-24
 for xen-changelog@lists.xenproject.org;
 Thu, 12 Mar 2026 10:22:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w0dB3-0053pR-1E
 for xen-changelog@lists.xenproject.org;
 Thu, 12 Mar 2026 10:22:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=S6cjn3aaYLxsuLT4c/b/WNYeWQQLAi/yPh5A06EE1Fg=; b=aexl1n94pbeUq79JVcMANzkS3B
	tMfT2a5+bvPxY6QcFvxDGllLW+hKK7Yvw59DuX6gt6m9ijQst+i2gbIcIvVW7zUeeUCTRqKPiQkjO
	GAPCN9hPaeXUMXNhKrsqdg3FgnTLEwYMsFoC90mNoZkhGWifsaGqSPKK6gJ4961GUooI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: fix unmapped access trapping on GICv2 hardware
Message-Id: <E1w0dB3-0053pR-1E@xenbits.xenproject.org>
Date: Thu, 12 Mar 2026 10:22:01 +0000

commit 17a9070d22d21b2faa68231e7fd835748b36fc73
Author:     Stewart Hildebrand <stewart.hildebrand@amd.com>
AuthorDate: Thu Feb 5 20:01:27 2026 +0100
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Thu Mar 12 09:09:16 2026 +0100

    xen/arm: fix unmapped access trapping on GICv2 hardware
    
    Since 4dbcb0653621, the vGICv2 CPU interface is mapped in a deferred
    manner. On domains with XEN_DOMCTL_CDF_trap_unmapped_accesses unset on
    GICv2 hardware, the vGICv2 CPU interface fails to be mapped. A visible
    symptom is that a domU gets stuck at:
    
      [    0.177983] smp: Bringing up secondary CPUs ...
    
    Move the 2nd check_p2m earlier so it's prioritized over try_handle_mmio.
    
    Fixes: 980aff4e8fcd ("xen/arm: Add way to disable traps on accesses to unmapped addresses")
    Signed-off-by: Stewart Hildebrand <stewart.hildebrand@amd.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
 xen/arch/arm/traps.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
index 040c0f2e0d..0c01f37ad6 100644
--- a/xen/arch/arm/traps.c
+++ b/xen/arch/arm/traps.c
@@ -1915,6 +1915,14 @@ static void do_trap_stage2_abort_guest(struct cpu_user_regs *regs,
         if ( info.dabt_instr.state == INSTR_ERROR )
             goto inject_abt;
 
+        /*
+         * If the instruction syndrome was invalid, then we already checked if
+         * this was due to a P2M fault. So no point to check again as the result
+         * will be the same.
+         */
+        if ( (info.dabt_instr.state == INSTR_VALID) && check_p2m(is_data, gpa) )
+            return;
+
         state = try_handle_mmio(regs, &info);
 
         switch ( state )
@@ -1939,14 +1947,6 @@ static void do_trap_stage2_abort_guest(struct cpu_user_regs *regs,
                 break;
         }
 
-        /*
-         * If the instruction syndrome was invalid, then we already checked if
-         * this was due to a P2M fault. So no point to check again as the result
-         * will be the same.
-         */
-        if ( (info.dabt_instr.state == INSTR_VALID) && check_p2m(is_data, gpa) )
-            return;
-
         break;
     }
     default:
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Mar 12 10:22:13 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 12 Mar 2026 10:22:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1251956.1548760 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w0dBE-0003Lu-Vl; Thu, 12 Mar 2026 10:22:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1251956.1548760; Thu, 12 Mar 2026 10:22:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w0dBE-0003Lm-T5; Thu, 12 Mar 2026 10:22:12 +0000
Received: by outflank-mailman (input) for mailman id 1251956;
 Thu, 12 Mar 2026 10:22:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w0dBD-0003La-Uy
 for xen-changelog@lists.xenproject.org; Thu, 12 Mar 2026 10:22:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w0dBE-004kwF-0R
 for xen-changelog@lists.xenproject.org;
 Thu, 12 Mar 2026 10:22:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w0dBD-0053rt-2s
 for xen-changelog@lists.xenproject.org;
 Thu, 12 Mar 2026 10:22:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=TkUlh2WLc1jTjFcs81XIav967YqJ2ZaYtJ1j+e0zC8U=; b=dseaoUoPPah8BLIXXKgt7ffPhf
	nwRpzaSsso2xMvz40cifGG9hpQxwgdtDGhe2CHGWfkhW0HYaePpn7dqb2aJiFXQC/Mu9O7xENM9cd
	GFgkJlyl+Vde/wmig+UU7FgtlXdL8rdTHRhpSlk30sDw2+RRp2Y5s8hD5j9ENd9vwBsc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tests/pdx: fix overflow from conversion from page index to address on 32bit
Message-Id: <E1w0dBD-0053rt-2s@xenbits.xenproject.org>
Date: Thu, 12 Mar 2026 10:22:11 +0000

commit 87774bbc3982a637081187583f1512c31e7e62d6
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Thu Mar 12 08:45:41 2026 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Thu Mar 12 11:16:11 2026 +0100

    tests/pdx: fix overflow from conversion from page index to address on 32bit
    
    When building the PDX test harness as a 32bit executable the page shifts
    done on unsigned long types can overflow.  Instead use pfn_to_paddr(),
    which casts the values to paddr_t previous to doing the shift.
    
    Fixes: cb50e4033717 ("test/pdx: add PDX compression unit tests")
    Reported-by: Edwin Török <edwin.torok@citrix.com>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 tools/tests/pdx/test-pdx.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/tests/pdx/test-pdx.c b/tools/tests/pdx/test-pdx.c
index eefd54c768..066bd3e7e5 100644
--- a/tools/tests/pdx/test-pdx.c
+++ b/tools/tests/pdx/test-pdx.c
@@ -208,8 +208,8 @@ int main(int argc, char **argv)
             if ( !tests[i].ranges[j].start && !tests[i].ranges[j].end )
                 break;
 
-            pfn_pdx_add_region(tests[i].ranges[j].start << PAGE_SHIFT,
-                               size << PAGE_SHIFT);
+            pfn_pdx_add_region(pfn_to_paddr(tests[i].ranges[j].start),
+                               pfn_to_paddr(size));
         }
 
         if ( pfn_pdx_compression_setup(0) != tests[i].compress )
@@ -233,8 +233,8 @@ int main(int argc, char **argv)
             if ( !start && !end )
                 break;
 
-            if ( !pdx_is_region_compressible(start << PAGE_SHIFT, 1) ||
-                 !pdx_is_region_compressible((end - 1) << PAGE_SHIFT, 1) )
+            if ( !pdx_is_region_compressible(pfn_to_paddr(start), 1) ||
+                 !pdx_is_region_compressible(pfn_to_paddr(end - 1), 1) )
             {
                 printf(
     "PFN compression invalid, pages %#lx and %#lx should be compressible\n",
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Mar 12 10:22:23 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 12 Mar 2026 10:22:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1251957.1548763 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w0dBP-0003ON-0h; Thu, 12 Mar 2026 10:22:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1251957.1548763; Thu, 12 Mar 2026 10:22:22 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w0dBO-0003OF-US; Thu, 12 Mar 2026 10:22:22 +0000
Received: by outflank-mailman (input) for mailman id 1251957;
 Thu, 12 Mar 2026 10:22:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w0dBO-0003O7-1S
 for xen-changelog@lists.xenproject.org; Thu, 12 Mar 2026 10:22:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w0dBO-004kwR-0i
 for xen-changelog@lists.xenproject.org;
 Thu, 12 Mar 2026 10:22:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w0dBN-0053sr-39
 for xen-changelog@lists.xenproject.org;
 Thu, 12 Mar 2026 10:22:21 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=KXKAScJdybeY+M9SZJnz5R5FGWGk6HOLtDpyTQd/hDY=; b=nUf690r3OSQKTE/+G/eV7jtCe2
	VXwwTZPqmb3YlcWJe7A4uaFXT/3vIBNkBbEEzUyOqfb11cAxQmphWcpz4KQH0rCfW63csl7CWqu/K
	lfGzJNz8XrxQkWVARsXLGscPLwgITA4A+GVl5CAo3rJxtYvo61NUJu4sjXSWpk8NX1/c=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tests/pdx: allow more tests on 32bit build
Message-Id: <E1w0dBN-0053sr-39@xenbits.xenproject.org>
Date: Thu, 12 Mar 2026 10:22:21 +0000

commit a3a1e61ce9a00c5a0c8003bad8f1285360399cf4
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Thu Mar 12 09:42:40 2026 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Thu Mar 12 11:16:31 2026 +0100

    tests/pdx: allow more tests on 32bit build
    
    The limitation of which tests can be build on 32bit is too strict.  Move
    some tests out of the 64bit explicit region, as they can also be built on
    32bits.
    
    Fixes: cb50e4033717 ("test/pdx: add PDX compression unit tests")
    Reported-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 tools/tests/pdx/test-pdx.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/tools/tests/pdx/test-pdx.c b/tools/tests/pdx/test-pdx.c
index 066bd3e7e5..d783186577 100644
--- a/tools/tests/pdx/test-pdx.c
+++ b/tools/tests/pdx/test-pdx.c
@@ -77,6 +77,17 @@ int main(int argc, char **argv)
             },
             .compress = true,
         },
+        /* Two ranges with the same high bit set. */
+        {
+        .ranges = {
+                { .start = (1UL << (51 - PAGE_SHIFT)) + (1 << MAX_ORDER) * 0,
+                  .end =   (1UL << (51 - PAGE_SHIFT)) + (1 << MAX_ORDER) * 1 },
+                { .start = (1UL << (51 - PAGE_SHIFT)) + (1 << MAX_ORDER) * 3,
+                  .end =   (1UL << (51 - PAGE_SHIFT)) + (1 << MAX_ORDER) * 4 },
+            },
+            .compress = true,
+        },
+#endif
         /* PDX compression, 2 ranges covered by the lower mask. */
         {
             .ranges = {
@@ -132,17 +143,6 @@ int main(int argc, char **argv)
             },
             .compress = true,
         },
-        /* Two ranges with the same high bit set. */
-        {
-        .ranges = {
-                { .start = (1UL << (51 - PAGE_SHIFT)) + (1 << MAX_ORDER) * 0,
-                  .end =   (1UL << (51 - PAGE_SHIFT)) + (1 << MAX_ORDER) * 1 },
-                { .start = (1UL << (51 - PAGE_SHIFT)) + (1 << MAX_ORDER) * 3,
-                  .end =   (1UL << (51 - PAGE_SHIFT)) + (1 << MAX_ORDER) * 4 },
-            },
-            .compress = true,
-        },
-#endif
         /* AMD Naples Epyc 7281 2 sockets, 8 NUMA nodes. */
         {
             .ranges = {
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Mar 12 11:55:06 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 12 Mar 2026 11:55:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1252232.1548984 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w0ed4-0001qM-9e; Thu, 12 Mar 2026 11:55:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1252232.1548984; Thu, 12 Mar 2026 11:55:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w0ed4-0001qE-6s; Thu, 12 Mar 2026 11:55:02 +0000
Received: by outflank-mailman (input) for mailman id 1252232;
 Thu, 12 Mar 2026 11:55:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w0ed3-0001q6-Gy
 for xen-changelog@lists.xenproject.org; Thu, 12 Mar 2026 11:55:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w0ed3-004mjk-29
 for xen-changelog@lists.xenproject.org;
 Thu, 12 Mar 2026 11:55:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w0ed3-005ADw-1H
 for xen-changelog@lists.xenproject.org;
 Thu, 12 Mar 2026 11:55:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=w9TxcPajUi36dj2hQvvVifBxEIezTRWtOaUQU/VVk9s=; b=ZIZ+zEdGVU/30UcO4x4qJRZ2+o
	d6m3alJ0M86ypxjFwLyD1qYlDpmxFejs5+GbO1pr2zsIySmtpJFlqqEiIuECDU2DfdLnfTS4kPuuK
	ikG5YtqwJZpSHUqgTYkZ74EQ4O1ViCwt7cO72s7yARhoIRhdg9iTX189RZCGFEx7/U34=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tests/pdx: fix overflow from conversion from page index to address on 32bit
Message-Id: <E1w0ed3-005ADw-1H@xenbits.xenproject.org>
Date: Thu, 12 Mar 2026 11:55:01 +0000

commit 87774bbc3982a637081187583f1512c31e7e62d6
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Thu Mar 12 08:45:41 2026 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Thu Mar 12 11:16:11 2026 +0100

    tests/pdx: fix overflow from conversion from page index to address on 32bit
    
    When building the PDX test harness as a 32bit executable the page shifts
    done on unsigned long types can overflow.  Instead use pfn_to_paddr(),
    which casts the values to paddr_t previous to doing the shift.
    
    Fixes: cb50e4033717 ("test/pdx: add PDX compression unit tests")
    Reported-by: Edwin Török <edwin.torok@citrix.com>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 tools/tests/pdx/test-pdx.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/tests/pdx/test-pdx.c b/tools/tests/pdx/test-pdx.c
index eefd54c768..066bd3e7e5 100644
--- a/tools/tests/pdx/test-pdx.c
+++ b/tools/tests/pdx/test-pdx.c
@@ -208,8 +208,8 @@ int main(int argc, char **argv)
             if ( !tests[i].ranges[j].start && !tests[i].ranges[j].end )
                 break;
 
-            pfn_pdx_add_region(tests[i].ranges[j].start << PAGE_SHIFT,
-                               size << PAGE_SHIFT);
+            pfn_pdx_add_region(pfn_to_paddr(tests[i].ranges[j].start),
+                               pfn_to_paddr(size));
         }
 
         if ( pfn_pdx_compression_setup(0) != tests[i].compress )
@@ -233,8 +233,8 @@ int main(int argc, char **argv)
             if ( !start && !end )
                 break;
 
-            if ( !pdx_is_region_compressible(start << PAGE_SHIFT, 1) ||
-                 !pdx_is_region_compressible((end - 1) << PAGE_SHIFT, 1) )
+            if ( !pdx_is_region_compressible(pfn_to_paddr(start), 1) ||
+                 !pdx_is_region_compressible(pfn_to_paddr(end - 1), 1) )
             {
                 printf(
     "PFN compression invalid, pages %#lx and %#lx should be compressible\n",
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Mar 12 11:55:13 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 12 Mar 2026 11:55:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1252233.1548988 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w0edF-0001sW-BI; Thu, 12 Mar 2026 11:55:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1252233.1548988; Thu, 12 Mar 2026 11:55:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w0edF-0001sO-8K; Thu, 12 Mar 2026 11:55:13 +0000
Received: by outflank-mailman (input) for mailman id 1252233;
 Thu, 12 Mar 2026 11:55:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w0edD-0001sB-IQ
 for xen-changelog@lists.xenproject.org; Thu, 12 Mar 2026 11:55:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w0edD-004mjo-2Q
 for xen-changelog@lists.xenproject.org;
 Thu, 12 Mar 2026 11:55:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w0edD-005AEP-1e
 for xen-changelog@lists.xenproject.org;
 Thu, 12 Mar 2026 11:55:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=tkbXqb65rW2fzwk6Qe9ZH6ZDk8AYassFbVtbz55RJ50=; b=lnTFuKzrbHoDPgm5s2Ry5Mphjk
	iIibneZ8tC0UKZ2vTDpa5hGDlWm784A1DUmt+b7jnxkjN8wv5FB2lN1fQdP7DKQMxOkWttgSvSJr8
	xENGyRnq/0Sk+B3uEeZlx1qL99IBlOGqurXjcjWdtVlGP51Ba/7JiK8Ly8RFmL0Tf3YE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tests/pdx: allow more tests on 32bit build
Message-Id: <E1w0edD-005AEP-1e@xenbits.xenproject.org>
Date: Thu, 12 Mar 2026 11:55:11 +0000

commit a3a1e61ce9a00c5a0c8003bad8f1285360399cf4
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Thu Mar 12 09:42:40 2026 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Thu Mar 12 11:16:31 2026 +0100

    tests/pdx: allow more tests on 32bit build
    
    The limitation of which tests can be build on 32bit is too strict.  Move
    some tests out of the 64bit explicit region, as they can also be built on
    32bits.
    
    Fixes: cb50e4033717 ("test/pdx: add PDX compression unit tests")
    Reported-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 tools/tests/pdx/test-pdx.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/tools/tests/pdx/test-pdx.c b/tools/tests/pdx/test-pdx.c
index 066bd3e7e5..d783186577 100644
--- a/tools/tests/pdx/test-pdx.c
+++ b/tools/tests/pdx/test-pdx.c
@@ -77,6 +77,17 @@ int main(int argc, char **argv)
             },
             .compress = true,
         },
+        /* Two ranges with the same high bit set. */
+        {
+        .ranges = {
+                { .start = (1UL << (51 - PAGE_SHIFT)) + (1 << MAX_ORDER) * 0,
+                  .end =   (1UL << (51 - PAGE_SHIFT)) + (1 << MAX_ORDER) * 1 },
+                { .start = (1UL << (51 - PAGE_SHIFT)) + (1 << MAX_ORDER) * 3,
+                  .end =   (1UL << (51 - PAGE_SHIFT)) + (1 << MAX_ORDER) * 4 },
+            },
+            .compress = true,
+        },
+#endif
         /* PDX compression, 2 ranges covered by the lower mask. */
         {
             .ranges = {
@@ -132,17 +143,6 @@ int main(int argc, char **argv)
             },
             .compress = true,
         },
-        /* Two ranges with the same high bit set. */
-        {
-        .ranges = {
-                { .start = (1UL << (51 - PAGE_SHIFT)) + (1 << MAX_ORDER) * 0,
-                  .end =   (1UL << (51 - PAGE_SHIFT)) + (1 << MAX_ORDER) * 1 },
-                { .start = (1UL << (51 - PAGE_SHIFT)) + (1 << MAX_ORDER) * 3,
-                  .end =   (1UL << (51 - PAGE_SHIFT)) + (1 << MAX_ORDER) * 4 },
-            },
-            .compress = true,
-        },
-#endif
         /* AMD Naples Epyc 7281 2 sockets, 8 NUMA nodes. */
         {
             .ranges = {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 13 17:22:07 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Mar 2026 17:22:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1254275.1550198 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w16D4-0001LC-OS; Fri, 13 Mar 2026 17:22:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1254275.1550198; Fri, 13 Mar 2026 17:22:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w16D4-0001L4-Lp; Fri, 13 Mar 2026 17:22:02 +0000
Received: by outflank-mailman (input) for mailman id 1254275;
 Fri, 13 Mar 2026 17:22:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w16D3-0001Ky-Tn
 for xen-changelog@lists.xenproject.org; Fri, 13 Mar 2026 17:22:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w16D4-006ZF8-0C
 for xen-changelog@lists.xenproject.org;
 Fri, 13 Mar 2026 17:22:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w16D3-007k5w-2P
 for xen-changelog@lists.xenproject.org;
 Fri, 13 Mar 2026 17:22:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=JRMVWfm4LdLT3V0EfVLNYyjuk4HgXMhetCLevmzn3OA=; b=ROLRDD2PNaaYYwUKidBH035+ig
	26y5X37u62BcOfR9OuJORxZdqFBUD8L5BReq7+4nNnbCHps+K6y0iCqUQuy2+oqtfadR8WVsbBggM
	DD3eEiRQaJDfmiCUlxhe+9RvA9Fqhp1VarOWZi9BiRg7XGFVM9uPE8fMtUEGUGEx0NeY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86: Clamp bits in eflags more aggressively
Message-Id: <E1w16D3-007k5w-2P@xenbits.xenproject.org>
Date: Fri, 13 Mar 2026 17:22:01 +0000

commit dbd936248f3846449c0d0e192d544b592c1c44d5
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue May 27 15:58:46 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 13 17:18:04 2026 +0000

    x86: Clamp bits in eflags more aggressively
    
    In FRED mode, ERET is stricter than IRET about flags.  Notably this means:
    
     * The vm86 bit (bit 17) and IOPL (bits 12,13) must be clear.
     * The sticky-1 reserved bit (bit 2) must be set, so dom0_construct() needs to
       set X86_EFLAGS_MBS in order for a PV dom0 to start.
     * All other reserved bits must be clear.
    
    Xen has been overly lax with reserved bit handling.  Adjust
    arch_set_info_guest*() and hypercall_iret() which consume flags to clamp the
    reserved bits for all guest types.
    
    This is a minor ABI change, but by the same argument as commit
    9f892f84c279 ("x86/domctl: Stop using XLAT_cpu_user_regs()"); the reserved
    bits would get clamped like this naturally by hardware when the vCPU is run.
    
    The handling of vm86 is also different.  Guests under 32bit Xen really could
    use vm86 mode, but Long Mode disallows vm86 mode and IRET simply ignores the
    bit.  Xen's behaviour for a PV32 guest trying to use vm86 mode under a 64bit
    Xen is to arrange to deliver #GP at the target of the IRET, rather than to
    fail the IRET itself.
    
    However there's no filtering in arch_set_info_guest() itself, and it can't
    arrange to queue a #GP at the target, so do the next best thing and fail the
    hypercall.  This is not expected to create an issue for PV guests, as the
    result of such an arch_set_info_guest() previously would be to run supposedly
    Real Mode code as Protected Mode code.
    
    This allows PV guests to start when Xen is using FRED mode.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/domain.c                | 24 ++++++++++++++++++++++--
 xen/arch/x86/hvm/domain.c            |  4 ++--
 xen/arch/x86/include/asm/x86-defns.h |  7 +++++++
 xen/arch/x86/pv/dom0_build.c         |  2 +-
 xen/arch/x86/pv/iret.c               |  8 +++++---
 5 files changed, 37 insertions(+), 8 deletions(-)

diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index 868c26036d..4664264b2f 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -1193,6 +1193,14 @@ int arch_set_info_guest(
 
             if ( !__addr_ok(c.nat->ldt_base) )
                 return -EINVAL;
+
+            /*
+             * IRET in Long Mode discards EFLAGS.VM, but in FRED mode ERET
+             * cares that it is zero.
+             *
+             * Guests can't see FRED, so emulate IRET behaviour.
+             */
+            c.nat->user_regs.rflags &= ~X86_EFLAGS_VM;
         }
 #ifdef CONFIG_COMPAT
         else
@@ -1205,6 +1213,18 @@ int arch_set_info_guest(
 
             for ( i = 0; i < ARRAY_SIZE(c.cmp->trap_ctxt); i++ )
                 fixup_guest_code_selector(d, c.cmp->trap_ctxt[i].cs);
+
+            /*
+             * Under 32bit Xen, PV guests could really use vm86 mode.  Under
+             * 64bit Xen, vm86 mode can't be entered even by PV32 guests.
+             *
+             * For backwards compatibility, compat HYPERCALL_iret will arrange
+             * to deliver #GP at the target of the IRET rather than to fail
+             * the IRET itself, but we can't arrange for the same behaviour
+             * here.  Reject the hypercall as the next best option.
+             */
+            if ( c.cmp->user_regs.eflags & X86_EFLAGS_VM )
+                return -EINVAL;
         }
 #endif
 
@@ -1244,7 +1264,7 @@ int arch_set_info_guest(
         v->arch.user_regs.rax               = c.nat->user_regs.rax;
         v->arch.user_regs.rip               = c.nat->user_regs.rip;
         v->arch.user_regs.cs                = c.nat->user_regs.cs;
-        v->arch.user_regs.rflags            = c.nat->user_regs.rflags;
+        v->arch.user_regs.rflags            = (c.nat->user_regs.rflags & X86_EFLAGS_ALL) | X86_EFLAGS_MBS;
         v->arch.user_regs.rsp               = c.nat->user_regs.rsp;
         v->arch.user_regs.ss                = c.nat->user_regs.ss;
         v->arch.pv.es                       = c.nat->user_regs.es;
@@ -1268,7 +1288,7 @@ int arch_set_info_guest(
         v->arch.user_regs.eax               = c.cmp->user_regs.eax;
         v->arch.user_regs.eip               = c.cmp->user_regs.eip;
         v->arch.user_regs.cs                = c.cmp->user_regs.cs;
-        v->arch.user_regs.eflags            = c.cmp->user_regs.eflags;
+        v->arch.user_regs.eflags            = (c.cmp->user_regs.eflags & X86_EFLAGS_ALL) | X86_EFLAGS_MBS;
         v->arch.user_regs.esp               = c.cmp->user_regs.esp;
         v->arch.user_regs.ss                = c.cmp->user_regs.ss;
         v->arch.pv.es                       = c.cmp->user_regs.es;
diff --git a/xen/arch/x86/hvm/domain.c b/xen/arch/x86/hvm/domain.c
index 155d61db13..a0e811ea47 100644
--- a/xen/arch/x86/hvm/domain.c
+++ b/xen/arch/x86/hvm/domain.c
@@ -194,7 +194,7 @@ int arch_set_info_hvm_guest(struct vcpu *v, const struct vcpu_hvm_context *ctx)
         uregs->rsi    = regs->esi;
         uregs->rdi    = regs->edi;
         uregs->rip    = regs->eip;
-        uregs->rflags = regs->eflags;
+        uregs->rflags = (regs->eflags & X86_EFLAGS_ALL) | X86_EFLAGS_MBS;
 
         v->arch.hvm.guest_cr[0] = regs->cr0;
         v->arch.hvm.guest_cr[3] = regs->cr3;
@@ -245,7 +245,7 @@ int arch_set_info_hvm_guest(struct vcpu *v, const struct vcpu_hvm_context *ctx)
         uregs->rsi    = regs->rsi;
         uregs->rdi    = regs->rdi;
         uregs->rip    = regs->rip;
-        uregs->rflags = regs->rflags;
+        uregs->rflags = (regs->rflags & X86_EFLAGS_ALL) | X86_EFLAGS_MBS;
 
         v->arch.hvm.guest_cr[0] = regs->cr0;
         v->arch.hvm.guest_cr[3] = regs->cr3;
diff --git a/xen/arch/x86/include/asm/x86-defns.h b/xen/arch/x86/include/asm/x86-defns.h
index 0a0ba83de7..edeb0b4ff9 100644
--- a/xen/arch/x86/include/asm/x86-defns.h
+++ b/xen/arch/x86/include/asm/x86-defns.h
@@ -27,6 +27,13 @@
     (X86_EFLAGS_CF | X86_EFLAGS_PF | X86_EFLAGS_AF |   \
      X86_EFLAGS_ZF | X86_EFLAGS_SF | X86_EFLAGS_OF)
 
+#define X86_EFLAGS_ALL                                          \
+    (X86_EFLAGS_ARITH_MASK | X86_EFLAGS_TF | X86_EFLAGS_IF |    \
+     X86_EFLAGS_DF | X86_EFLAGS_OF | X86_EFLAGS_IOPL |          \
+     X86_EFLAGS_NT | X86_EFLAGS_RF | X86_EFLAGS_VM |            \
+     X86_EFLAGS_AC | X86_EFLAGS_VIF | X86_EFLAGS_VIP |          \
+     X86_EFLAGS_ID)
+
 /*
  * Intel CPU flags in CR0
  */
diff --git a/xen/arch/x86/pv/dom0_build.c b/xen/arch/x86/pv/dom0_build.c
index 9a11a0a16b..075a3646c2 100644
--- a/xen/arch/x86/pv/dom0_build.c
+++ b/xen/arch/x86/pv/dom0_build.c
@@ -1024,7 +1024,7 @@ static int __init dom0_construct(const struct boot_domain *bd)
     regs->rip = parms.virt_entry;
     regs->rsp = vstack_end;
     regs->rsi = vstartinfo_start;
-    regs->eflags = X86_EFLAGS_IF;
+    regs->eflags = X86_EFLAGS_IF | X86_EFLAGS_MBS;
 
     /*
      * We don't call arch_set_info_guest(), so some initialisation needs doing
diff --git a/xen/arch/x86/pv/iret.c b/xen/arch/x86/pv/iret.c
index d3a1fb2c68..39ce316b8d 100644
--- a/xen/arch/x86/pv/iret.c
+++ b/xen/arch/x86/pv/iret.c
@@ -80,8 +80,9 @@ long do_iret(void)
 
     regs->rip    = iret_saved.rip;
     regs->cs     = iret_saved.cs | 3; /* force guest privilege */
-    regs->rflags = ((iret_saved.rflags & ~(X86_EFLAGS_IOPL|X86_EFLAGS_VM))
-                    | X86_EFLAGS_IF);
+    regs->rflags = ((iret_saved.rflags & X86_EFLAGS_ALL &
+                     ~(X86_EFLAGS_IOPL | X86_EFLAGS_VM)) |
+                    X86_EFLAGS_IF | X86_EFLAGS_MBS);
     regs->rsp    = iret_saved.rsp;
     regs->ss     = iret_saved.ss | 3; /* force guest privilege */
 
@@ -143,7 +144,8 @@ int compat_iret(void)
     if ( VM_ASSIST(v->domain, architectural_iopl) )
         v->arch.pv.iopl = eflags & X86_EFLAGS_IOPL;
 
-    regs->eflags = (eflags & ~X86_EFLAGS_IOPL) | X86_EFLAGS_IF;
+    regs->eflags = ((eflags & X86_EFLAGS_ALL & ~X86_EFLAGS_IOPL) |
+                    X86_EFLAGS_IF | X86_EFLAGS_MBS);
 
     if ( unlikely(eflags & X86_EFLAGS_VM) )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Mar 13 17:22:12 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Mar 2026 17:22:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1254276.1550202 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w16DE-0001N8-Q2; Fri, 13 Mar 2026 17:22:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1254276.1550202; Fri, 13 Mar 2026 17:22:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w16DE-0001N0-NF; Fri, 13 Mar 2026 17:22:12 +0000
Received: by outflank-mailman (input) for mailman id 1254276;
 Fri, 13 Mar 2026 17:22:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w16DD-0001Ms-Vq
 for xen-changelog@lists.xenproject.org; Fri, 13 Mar 2026 17:22:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w16DE-006ZFD-0U
 for xen-changelog@lists.xenproject.org;
 Fri, 13 Mar 2026 17:22:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w16DD-007k76-2v
 for xen-changelog@lists.xenproject.org;
 Fri, 13 Mar 2026 17:22:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=w9BprKxHAFqxx6LqTgFWRvurtibSnaPqMVHHfYZXN5M=; b=H+nQiekgFHcdrzyRGK9YZ8s2N5
	jBwHSZPOw3xDe7+WWjueVdpVk1KdX6EcbjHFnskw8ZYlHaatbuRX5U3pJb4fqEpau9XY/sMSu+yVN
	8gwDwk1w9ZP1oBIay0myhMhd9wfLgUCzzY0tGTfOVdAFcZKf7axT77NKTCw0ouHXdsvQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/argo: Fix MISRA violations around function parameters
Message-Id: <E1w16DD-007k76-2v@xenbits.xenproject.org>
Date: Fri, 13 Mar 2026 17:22:11 +0000

commit f03a9e3bd94f50724655ae892816410688340837
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Sat Jan 3 19:52:11 2026 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 13 17:18:04 2026 +0000

    xen/argo: Fix MISRA violations around function parameters
    
    For the ARM build only, Eclair reports a R8.4 violation because do_argo_op()
    cannot see its declaration.  This means that x86 is picking hypercall-defs.h
    up transitively while ARM is not.  Include xen/hypercall.h explicitly.
    
    Eclair also reports a R8.3 violation because of arg3 and arg4 differing in
    name with a raw_ prefix.  Because hypercall-defs.h generates both do_argo_op()
    and compat_argo_op() from a single description, it's not possible to simply
    rename to raw_ in the declaration, as that would force doing the same rename
    in compat_argo_op().
    
    In do_argo_op(), drop the split parameter handling, and perform the 32bit
    range check via an explicit cast.  While adjusting the surrounding logic, drop
    unnecessary casts to void * for already pointer arguments in argo_printk().
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Daniel P. Smith <dpsmith@apertussolutions.com>
---
 xen/common/argo.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/xen/common/argo.c b/xen/common/argo.c
index 029a82825b..28626e00a8 100644
--- a/xen/common/argo.c
+++ b/xen/common/argo.c
@@ -21,6 +21,7 @@
 #include <xen/errno.h>
 #include <xen/event.h>
 #include <xen/guest_access.h>
+#include <xen/hypercall.h>
 #include <xen/lib.h>
 #include <xen/nospec.h>
 #include <xen/param.h>
@@ -2084,18 +2085,17 @@ sendv(struct domain *src_d, xen_argo_addr_t *src_addr,
 
 long
 do_argo_op(unsigned int cmd, XEN_GUEST_HANDLE_PARAM(void) arg1,
-           XEN_GUEST_HANDLE_PARAM(void) arg2, unsigned long raw_arg3,
-           unsigned long raw_arg4)
+           XEN_GUEST_HANDLE_PARAM(void) arg2, unsigned long arg3,
+           unsigned long arg4)
 {
     struct domain *currd = current->domain;
     long rc;
-    unsigned int arg3 = raw_arg3, arg4 = raw_arg4;
 
     argo_dprintk("->do_argo_op(%u,%p,%p,%lu,0x%lx)\n", cmd,
-                 (void *)arg1.p, (void *)arg2.p, raw_arg3, raw_arg4);
+                 arg1.p, arg2.p, arg3, arg4);
 
     /* Reject numeric hypercall args outside 32-bit range */
-    if ( (arg3 != raw_arg3) || (arg4 != raw_arg4) )
+    if ( (arg3 != (uint32_t)arg3) || (arg4 != (uint32_t)arg4) )
         return -EINVAL;
 
     if ( unlikely(!opt_argo) )
@@ -2248,7 +2248,7 @@ compat_argo_op(unsigned int cmd, XEN_GUEST_HANDLE_PARAM(void) arg1,
         return rc;
 
     argo_dprintk("->compat_argo_op(%u,%p,%p,%lu,0x%lx)\n", cmd,
-                 (void *)arg1.p, (void *)arg2.p, arg3, arg4);
+                 arg1.p, arg2.p, arg3, arg4);
 
     send_addr_hnd = guest_handle_cast(arg1, xen_argo_send_addr_t);
     /* arg2: iovs, arg3: niov, arg4: message_type */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Mar 13 17:22:23 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Mar 2026 17:22:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1254277.1550206 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w16DP-0001PV-RE; Fri, 13 Mar 2026 17:22:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1254277.1550206; Fri, 13 Mar 2026 17:22:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w16DP-0001PN-Of; Fri, 13 Mar 2026 17:22:23 +0000
Received: by outflank-mailman (input) for mailman id 1254277;
 Fri, 13 Mar 2026 17:22:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w16DO-0001PG-2T
 for xen-changelog@lists.xenproject.org; Fri, 13 Mar 2026 17:22:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w16DO-006ZFN-0p
 for xen-changelog@lists.xenproject.org;
 Fri, 13 Mar 2026 17:22:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w16DO-007k8J-01
 for xen-changelog@lists.xenproject.org;
 Fri, 13 Mar 2026 17:22:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=jnokj8gw+yQee8Vb7mq17Bp7tWmFPxBcyamHn/hWu7s=; b=H/7y/z8kUBkZzHAgElzVK1mM8P
	QvwTA7/BgICaMsBAm9gl/2hq4/cy+EHl/mztt9BpkdzDXSOt6vh81jKZKYMqI7XgHCrF8/WIved/4
	3oPojcliagljb7Gfx6z4CONluN62cHh/GANKlEYIMLmwUWf4JcAh3jv3fxbW1GjLTar0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen: Bracket uses of macro parameters
Message-Id: <E1w16DO-007k8J-01@xenbits.xenproject.org>
Date: Fri, 13 Mar 2026 17:22:22 +0000

commit 2429e82c718e00b646166e9dd13f6130fc02bf8d
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Feb 20 11:52:21 2026 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 13 17:18:04 2026 +0000

    xen: Bracket uses of macro parameters
    
    Fixing Rule 20.7 violations.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
 xen/arch/arm/pci/pci-access.c       |  6 +++---
 xen/arch/x86/include/asm/bootinfo.h |  2 +-
 xen/arch/x86/mm/shadow/multi.c      |  2 +-
 xen/common/kimage.c                 | 11 ++++++-----
 xen/common/livepatch.c              |  7 ++++---
 xen/crypto/vmac.c                   |  8 ++++----
 xen/include/xen/libfdt/libfdt.h     |  6 +++---
 7 files changed, 22 insertions(+), 20 deletions(-)

diff --git a/xen/arch/arm/pci/pci-access.c b/xen/arch/arm/pci/pci-access.c
index 2b23d552bb..7bd6877596 100644
--- a/xen/arch/arm/pci/pci-access.c
+++ b/xen/arch/arm/pci/pci-access.c
@@ -16,7 +16,7 @@
 #include <asm/io.h>
 
 #define INVALID_VALUE (~0U)
-#define PCI_ERR_VALUE(len) GENMASK(0, len * 8)
+#define PCI_ERR_VALUE(len) GENMASK(0, (len) * 8)
 
 static const struct pci_ops *get_ops(struct pci_host_bridge *bridge,
                                      pci_sbdf_t sbdf)
@@ -139,14 +139,14 @@ static void pci_config_write(pci_sbdf_t sbdf, unsigned int reg,
     void pci_conf_write##size(pci_sbdf_t sbdf,              \
                               unsigned int reg, type data)  \
 {                                                           \
-    pci_config_write(sbdf, reg, size / 8, data);            \
+    pci_config_write(sbdf, reg, (size) / 8, data);          \
 }
 
 #define PCI_OP_READ(size, type)                             \
     type pci_conf_read##size(pci_sbdf_t sbdf,               \
                               unsigned int reg)             \
 {                                                           \
-    return pci_config_read(sbdf, reg, size / 8);            \
+    return pci_config_read(sbdf, reg, (size) / 8);          \
 }
 
 PCI_OP_READ(8, uint8_t)
diff --git a/xen/arch/x86/include/asm/bootinfo.h b/xen/arch/x86/include/asm/bootinfo.h
index 4f2cc5906e..b3a6b2acf3 100644
--- a/xen/arch/x86/include/asm/bootinfo.h
+++ b/xen/arch/x86/include/asm/bootinfo.h
@@ -75,7 +75,7 @@ static inline unsigned int __init next_boot_module_index(
 #define for_each_boot_module_by_type(i, b, t)           \
     for ( (i) = first_boot_module_index(b, t);          \
           (i) <= (b)->nr_modules;                       \
-          (i) = next_boot_module_index(b, t, i + 1) )
+          (i) = next_boot_module_index(b, t, (i) + 1) )
 
 #endif /* X86_BOOTINFO_H */
 
diff --git a/xen/arch/x86/mm/shadow/multi.c b/xen/arch/x86/mm/shadow/multi.c
index f95da9ffd2..80cd3299fa 100644
--- a/xen/arch/x86/mm/shadow/multi.c
+++ b/xen/arch/x86/mm/shadow/multi.c
@@ -796,7 +796,7 @@ do {                                                                    \
 do {                                                                    \
     int __done = 0;                                                     \
     _FOREACH_PRESENT_L1E(_sl1mfn, _sl1e, _gl1p,                         \
-                         ({ (__done = _done); }), _code);               \
+                         ({ __done = (_done); }), _code);               \
     _sl1mfn = sh_next_page(_sl1mfn);                                    \
     if ( !__done )                                                      \
         _FOREACH_PRESENT_L1E(_sl1mfn, _sl1e, _gl1p, _done, _code);      \
diff --git a/xen/common/kimage.c b/xen/common/kimage.c
index e1aec5a18a..6202491f7e 100644
--- a/xen/common/kimage.c
+++ b/xen/common/kimage.c
@@ -491,11 +491,12 @@ static void kimage_terminate(struct kexec_image *image)
  * Call unmap_domain_page(ptr) after the loop exits.
  */
 #define for_each_kimage_entry(image, ptr, entry)                        \
-    for ( ptr = map_domain_page(_mfn(paddr_to_pfn(image->head)));       \
-          (entry = *ptr) && !(entry & IND_DONE);                        \
-          ptr = (entry & IND_INDIRECTION) ?                             \
-              (unmap_domain_page(ptr), map_domain_page(_mfn(paddr_to_pfn(entry)))) \
-              : ptr + 1 )
+    for ( (ptr) = map_domain_page(_mfn(paddr_to_pfn((image)->head)));   \
+          (entry = *(ptr)) && !((entry) & IND_DONE);                    \
+          (ptr) = (((entry) & IND_INDIRECTION)                          \
+                   ? (unmap_domain_page(ptr),                           \
+                      map_domain_page(_mfn(paddr_to_pfn(entry))))       \
+                   : (ptr) + 1) )
 
 static void kimage_free_entry(kimage_entry_t entry)
 {
diff --git a/xen/common/livepatch.c b/xen/common/livepatch.c
index 7446533c8c..7515a040ad 100644
--- a/xen/common/livepatch.c
+++ b/xen/common/livepatch.c
@@ -664,7 +664,8 @@ static inline int livepatch_check_expectations(const struct payload *payload)
     const struct livepatch_elf_sec *__sec = livepatch_elf_sec_by_name(elf, section_name); \
     if ( !__sec )                                                                         \
         break;                                                                            \
-    if ( !section_ok(elf, __sec, sizeof(*hook)) || __sec->sec->sh_size != sizeof(*hook) ) \
+    if ( !section_ok(elf, __sec, sizeof(*(hook))) ||                                      \
+         __sec->sec->sh_size != sizeof(*(hook)) )                                         \
         return -EINVAL;                                                                   \
     hook = __sec->addr;                                                                   \
 } while (0)
@@ -678,10 +679,10 @@ static inline int livepatch_check_expectations(const struct payload *payload)
     const struct livepatch_elf_sec *__sec = livepatch_elf_sec_by_name(elf, section_name); \
     if ( !__sec )                                                                         \
         break;                                                                            \
-    if ( !section_ok(elf, __sec, sizeof(*hook)) )                                         \
+    if ( !section_ok(elf, __sec, sizeof(*(hook))) )                                       \
         return -EINVAL;                                                                   \
     hook = __sec->addr;                                                                   \
-    nhooks = __sec->sec->sh_size / sizeof(*hook);                                         \
+    nhooks = __sec->sec->sh_size / sizeof(*(hook));                                       \
 } while (0)
 
 static int prepare_payload(struct payload *payload,
diff --git a/xen/crypto/vmac.c b/xen/crypto/vmac.c
index c9914d2c7c..c7aa1e9be3 100644
--- a/xen/crypto/vmac.c
+++ b/xen/crypto/vmac.c
@@ -203,7 +203,7 @@ const uint64_t mpoly = UINT64_C(0x1fffffff1fffffff);  /* Poly key mask     */
 #define nh_16(mp, kp, nw, rh, rl)                                            \
 {   int i; uint64_t th, tl;                                                  \
     rh = rl = 0;                                                             \
-    for (i = 0; i < nw; i+= 2) {                                             \
+    for (i = 0; i < (nw); i+= 2) {                                           \
         MUL64(th,tl,get64PE((mp)+i  )+(kp)[i  ],get64PE((mp)+i+1)+(kp)[i+1]);\
         ADD128(rh,rl,th,tl);                                                 \
     }                                                                        \
@@ -211,7 +211,7 @@ const uint64_t mpoly = UINT64_C(0x1fffffff1fffffff);  /* Poly key mask     */
 #define nh_16_2(mp, kp, nw, rh, rl, rh1, rl1)                                \
 {   int i; uint64_t th, tl;                                                  \
     rh1 = rl1 = rh = rl = 0;                                                 \
-    for (i = 0; i < nw; i+= 2) {                                             \
+    for (i = 0; i < (nw); i+= 2) {                                           \
         MUL64(th,tl,get64PE((mp)+i  )+(kp)[i  ],get64PE((mp)+i+1)+(kp)[i+1]);\
         ADD128(rh,rl,th,tl);                                                 \
         MUL64(th,tl,get64PE((mp)+i  )+(kp)[i+2],get64PE((mp)+i+1)+(kp)[i+3]);\
@@ -223,7 +223,7 @@ const uint64_t mpoly = UINT64_C(0x1fffffff1fffffff);  /* Poly key mask     */
 #define nh_vmac_nhbytes(mp, kp, nw, rh, rl)                                  \
 {   int i; uint64_t th, tl;                                                  \
     rh = rl = 0;                                                             \
-    for (i = 0; i < nw; i+= 8) {                                             \
+    for (i = 0; i < (nw); i+= 8) {                                           \
         MUL64(th,tl,get64PE((mp)+i  )+(kp)[i  ],get64PE((mp)+i+1)+(kp)[i+1]);\
         ADD128(rh,rl,th,tl);                                                 \
         MUL64(th,tl,get64PE((mp)+i+2)+(kp)[i+2],get64PE((mp)+i+3)+(kp)[i+3]);\
@@ -237,7 +237,7 @@ const uint64_t mpoly = UINT64_C(0x1fffffff1fffffff);  /* Poly key mask     */
 #define nh_vmac_nhbytes_2(mp, kp, nw, rh, rl, rh1, rl1)                      \
 {   int i; uint64_t th, tl;                                                  \
     rh1 = rl1 = rh = rl = 0;                                                 \
-    for (i = 0; i < nw; i+= 8) {                                             \
+    for (i = 0; i < (nw); i+= 8) {                                           \
         MUL64(th,tl,get64PE((mp)+i  )+(kp)[i  ],get64PE((mp)+i+1)+(kp)[i+1]);\
         ADD128(rh,rl,th,tl);                                                 \
         MUL64(th,tl,get64PE((mp)+i  )+(kp)[i+2],get64PE((mp)+i+1)+(kp)[i+3]);\
diff --git a/xen/include/xen/libfdt/libfdt.h b/xen/include/xen/libfdt/libfdt.h
index fabddbee8c..1b09bba28e 100644
--- a/xen/include/xen/libfdt/libfdt.h
+++ b/xen/include/xen/libfdt/libfdt.h
@@ -230,9 +230,9 @@ int fdt_next_subnode(const void *fdt, int offset);
  * literal.
  */
 #define fdt_for_each_subnode(node, fdt, parent)		\
-	for (node = fdt_first_subnode(fdt, parent);	\
-	     node >= 0;					\
-	     node = fdt_next_subnode(fdt, node))
+	for ((node) = fdt_first_subnode(fdt, parent);	\
+	     (node) >= 0;				\
+	     (node) = fdt_next_subnode(fdt, node))
 
 /**********************************************************************/
 /* General functions                                                  */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Mar 13 17:22:33 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Mar 2026 17:22:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1254278.1550209 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w16DZ-0001RU-Sm; Fri, 13 Mar 2026 17:22:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1254278.1550209; Fri, 13 Mar 2026 17:22:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w16DZ-0001RM-Q2; Fri, 13 Mar 2026 17:22:33 +0000
Received: by outflank-mailman (input) for mailman id 1254278;
 Fri, 13 Mar 2026 17:22:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w16DY-0001R7-5g
 for xen-changelog@lists.xenproject.org; Fri, 13 Mar 2026 17:22:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w16DY-006ZFT-18
 for xen-changelog@lists.xenproject.org;
 Fri, 13 Mar 2026 17:22:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w16DY-007k9B-0J
 for xen-changelog@lists.xenproject.org;
 Fri, 13 Mar 2026 17:22:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=4zqQYOCwTBBvgWuQNNNKaJoE6siW+iaVPddBDi91B0M=; b=tYP49EnlBzK5ZxxANkw/xROopy
	SbJCsevhFu7JQyifkNU3pEsfXa/V3mU4zy8PWwRU5ajt9ZesGXgob9DKstglhacb3hogWCejmLwfK
	HTRAImTb+aQ84LGGjDW6QMmPUthrHVlNRwd0b78FEdumKB2Y5IxUzU3JUWSw92z82lAw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] arm/ffa: deviate violation of MISRA C Rule 20.12
Message-Id: <E1w16DY-007k9B-0J@xenbits.xenproject.org>
Date: Fri, 13 Mar 2026 17:22:32 +0000

commit 195d7541708918cf0b77ef2afc3d065b16f061a1
Author:     Dmytro Prokopchuk1 <dmytro_prokopchuk1@epam.com>
AuthorDate: Fri Mar 13 09:47:38 2026 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 13 17:18:04 2026 +0000

    arm/ffa: deviate violation of MISRA C Rule 20.12
    
    MISRA C Rule 20.12 states: "A macro parameter used as an operand to
    the # or ## operators, which is itself subject to further macro replacement,
    shall only be used as an operand to these operators".
    
    In this case the 'FFA_*' macros are used both as a regular macro argument and
    as an operand for '#' stringification in the expansion of 'FW_ABI()'.
    This is deviated using a SAF-x-safe comment.
    
    No functional changes.
    
    Signed-off-by: Dmytro Prokopchuk <dmytro_prokopchuk1@epam.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 xen/arch/arm/tee/ffa.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/xen/arch/arm/tee/ffa.c b/xen/arch/arm/tee/ffa.c
index aa43ae2595..d4a77206c6 100644
--- a/xen/arch/arm/tee/ffa.c
+++ b/xen/arch/arm/tee/ffa.c
@@ -80,6 +80,7 @@ struct ffa_fw_abi {
     const char *name;
 };
 
+/* SAF-6-safe Rule 20.12 expansion of macro FFA_* with FW_ABI */
 #define FW_ABI(abi) {abi,#abi}
 
 /* List of ABI we use from the firmware */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Mar 13 17:22:44 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Mar 2026 17:22:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1254279.1550214 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w16Dj-0001UA-Ve; Fri, 13 Mar 2026 17:22:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1254279.1550214; Fri, 13 Mar 2026 17:22:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w16Dj-0001U2-Sl; Fri, 13 Mar 2026 17:22:43 +0000
Received: by outflank-mailman (input) for mailman id 1254279;
 Fri, 13 Mar 2026 17:22:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w16Di-0001To-8n
 for xen-changelog@lists.xenproject.org; Fri, 13 Mar 2026 17:22:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w16Di-006ZFa-1S
 for xen-changelog@lists.xenproject.org;
 Fri, 13 Mar 2026 17:22:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w16Di-007kAl-0d
 for xen-changelog@lists.xenproject.org;
 Fri, 13 Mar 2026 17:22:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=brsqjYrRko3eP2fYKgZqYrAgikQxqWmtYFOIAc9H+2Y=; b=mlGe4QRW5fnZqBqcF6qjqhmLjL
	ujXctp74QHwfTTSpWUezh5DBc9ipv/vR6kl+EbcVL5gvgsMK2U2P0yoiCBUm8VNiG8hrXOE8XNZFB
	FBrhhZlhYKkc7Oje4LkCvXDI96A4zjF4JKs7WnggMXzh8pM4pdWutQefRPxr00tGFMwU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] docs: add -h parameter description to xenstore-* man pages
Message-Id: <E1w16Di-007kAl-0d@xenbits.xenproject.org>
Date: Fri, 13 Mar 2026 17:22:42 +0000

commit 48899ad6966c6dfdf4291d48b8be004fd96d2cb4
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Thu Mar 12 16:50:55 2026 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 13 17:18:04 2026 +0000

    docs: add -h parameter description to xenstore-* man pages
    
    The "-h" parameter is missing in the man pages of the xenstore-*
    programs.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 docs/man/xenstore-chmod.1.pod | 4 ++++
 docs/man/xenstore-ls.1.pod    | 4 ++++
 docs/man/xenstore-read.1.pod  | 4 ++++
 docs/man/xenstore-write.1.pod | 4 ++++
 4 files changed, 16 insertions(+)

diff --git a/docs/man/xenstore-chmod.1.pod b/docs/man/xenstore-chmod.1.pod
index d221f5dffc..ca1a2172f9 100644
--- a/docs/man/xenstore-chmod.1.pod
+++ b/docs/man/xenstore-chmod.1.pod
@@ -42,6 +42,10 @@ write, and set permissions).
 
 =over
 
+=item B<-h>
+
+Show the usage information for xenstore-chmod and exit the program.
+
 =item B<-r>
 
 Apply the permissions to the key and all its I<children>.
diff --git a/docs/man/xenstore-ls.1.pod b/docs/man/xenstore-ls.1.pod
index a9f8b32653..b070e8368c 100644
--- a/docs/man/xenstore-ls.1.pod
+++ b/docs/man/xenstore-ls.1.pod
@@ -13,6 +13,10 @@ using a nested, tree-like view.
 
 =over
 
+=item B<-h>
+
+Show the usage information for xenstore-ls and exit the program.
+
 =item B<-f>
 
 Show the full path for all keys.
diff --git a/docs/man/xenstore-read.1.pod b/docs/man/xenstore-read.1.pod
index c7768cbbe5..7fe63268bd 100644
--- a/docs/man/xenstore-read.1.pod
+++ b/docs/man/xenstore-read.1.pod
@@ -12,6 +12,10 @@ Read values of one or more Xenstore I<PATH>s.
 
 =over
 
+=item B<-h>
+
+Show the usage information for xenstore-read and exit the program.
+
 =item B<-p>
 
 Prefix value with key name.
diff --git a/docs/man/xenstore-write.1.pod b/docs/man/xenstore-write.1.pod
index 74f80f7b1b..33a8af2db4 100644
--- a/docs/man/xenstore-write.1.pod
+++ b/docs/man/xenstore-write.1.pod
@@ -13,6 +13,10 @@ provided to write them at once - in one Xenstore transaction.
 
 =over
 
+=item B<-h>
+
+Show the usage information for xenstore-write and exit the program.
+
 =item B<-R>
 
 Write raw value, skip parsing escaped characters (\x..).
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Mar 13 17:22:54 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Mar 2026 17:22:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1254280.1550217 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w16Du-0001WC-0m; Fri, 13 Mar 2026 17:22:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1254280.1550217; Fri, 13 Mar 2026 17:22:53 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w16Dt-0001W4-UC; Fri, 13 Mar 2026 17:22:53 +0000
Received: by outflank-mailman (input) for mailman id 1254280;
 Fri, 13 Mar 2026 17:22:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w16Ds-0001Vq-Bc
 for xen-changelog@lists.xenproject.org; Fri, 13 Mar 2026 17:22:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w16Ds-006ZFx-1j
 for xen-changelog@lists.xenproject.org;
 Fri, 13 Mar 2026 17:22:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w16Ds-007kBd-0x
 for xen-changelog@lists.xenproject.org;
 Fri, 13 Mar 2026 17:22:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=KwVzpbm0RWx8lr315LDNbi2+hJRB3wTbsM4h26qjHFM=; b=pmQ3emvB2Q6DiIIzPSL1wT1HPw
	7Y/+fc5TxLck+y4YSQz+TTqaiSg0tztBaxJNrAqaczMaGO3W7aBJ41lEWK2qp5hk4OFo3f+VEfSny
	1ru+C11ci2rHRMklcIaWNiZEGuF2ZhgQTLnA/LkKQpSVhiCyMwr8PH4OqEdB8HmE35Ow=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] docs: add man page for xenstore-exists
Message-Id: <E1w16Ds-007kBd-0x@xenbits.xenproject.org>
Date: Fri, 13 Mar 2026 17:22:52 +0000

commit 94b31456bf278c9a59152f36cafef368855251f2
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Thu Mar 12 16:50:56 2026 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 13 17:18:04 2026 +0000

    docs: add man page for xenstore-exists
    
    There is no man page for xenstore-exists, add it.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 docs/man/xenstore-exists.1.pod | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/docs/man/xenstore-exists.1.pod b/docs/man/xenstore-exists.1.pod
new file mode 100644
index 0000000000..a6eeb7ff96
--- /dev/null
+++ b/docs/man/xenstore-exists.1.pod
@@ -0,0 +1,25 @@
+=head1 NAME
+
+xenstore-exists - test whether Xenstore key exists
+
+=head1 SYNOPSIS
+
+B<xenstore-exists> I<PATH>
+
+=head1 DESCRIPTION
+
+Tests whether the specified Xenstore I<PATH> is readable and sets
+the exit value accordingly (B<0> if I<PTAH> is readable, B<1> if not).
+
+=over
+
+=item B<-h>
+
+Show the usage information for xenstore-exists and exit the program.
+
+=back
+
+=head1 BUGS
+
+Send bugs to xen-devel@lists.xenproject.org, see
+https://wiki.xenproject.org/wiki/Reporting_Bugs_against_Xen_Project on how to send bug reports.
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Mar 13 17:23:04 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Mar 2026 17:23:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1254282.1550221 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w16E4-0001YL-1v; Fri, 13 Mar 2026 17:23:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1254282.1550221; Fri, 13 Mar 2026 17:23:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w16E3-0001YD-Vc; Fri, 13 Mar 2026 17:23:03 +0000
Received: by outflank-mailman (input) for mailman id 1254282;
 Fri, 13 Mar 2026 17:23:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w16E2-0001Y5-E3
 for xen-changelog@lists.xenproject.org; Fri, 13 Mar 2026 17:23:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w16E2-006ZGK-20
 for xen-changelog@lists.xenproject.org;
 Fri, 13 Mar 2026 17:23:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w16E2-007kCs-1E
 for xen-changelog@lists.xenproject.org;
 Fri, 13 Mar 2026 17:23:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=kpXg5MTbrrmAwhIv3AGENBkOrR1iwnCH/a+EBbhZnZY=; b=BdpGMOwNzO1DMaypqwuefBRNHJ
	TJDCzB1IspszudFsayQgiUdWZ01FMHU26Immi6ifOCBQSZwCA7yieTqmWI/HfWqnLMOiOXwWWE8Zn
	L8DPC0fA8GqBm/nWOViwZaY4R9S7PTmr9zFqTOJCS64OeGgLmLZ+NanqkIxgNfji1eho=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] docs: add man page for xenstore-list
Message-Id: <E1w16E2-007kCs-1E@xenbits.xenproject.org>
Date: Fri, 13 Mar 2026 17:23:02 +0000

commit 6d8731c3842a1a534be87bbb4b28131076c502a9
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Thu Mar 12 16:50:57 2026 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 13 17:18:04 2026 +0000

    docs: add man page for xenstore-list
    
    There is no man page for xenstore-list, add it.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 docs/man/xenstore-list.1.pod | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/docs/man/xenstore-list.1.pod b/docs/man/xenstore-list.1.pod
new file mode 100644
index 0000000000..ea2853a1fc
--- /dev/null
+++ b/docs/man/xenstore-list.1.pod
@@ -0,0 +1,28 @@
+=head1 NAME
+
+xenstore-list - list Xenstore key children
+
+=head1 SYNOPSIS
+
+B<xenstore-list> [I<OPTION>]... [I<PATH>]...
+
+=head1 DESCRIPTION
+
+List direct children of one or more Xenstore I<PATH>s, one child per line.
+
+=over
+
+=item B<-h>
+
+Show the usage information for xenstore-list and exit the program.
+
+=item B<-p>
+
+List the full Xenstore path of each listed path.
+
+=back
+
+=head1 BUGS
+
+Send bugs to xen-devel@lists.xenproject.org, see
+https://wiki.xenproject.org/wiki/Reporting_Bugs_against_Xen_Project on how to send bug reports.
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Mar 13 17:23:14 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Mar 2026 17:23:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1254283.1550226 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w16EE-0001aE-3b; Fri, 13 Mar 2026 17:23:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1254283.1550226; Fri, 13 Mar 2026 17:23:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w16EE-0001a4-0n; Fri, 13 Mar 2026 17:23:14 +0000
Received: by outflank-mailman (input) for mailman id 1254283;
 Fri, 13 Mar 2026 17:23:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w16EC-0001Zw-Go
 for xen-changelog@lists.xenproject.org; Fri, 13 Mar 2026 17:23:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w16EC-006ZGQ-2G
 for xen-changelog@lists.xenproject.org;
 Fri, 13 Mar 2026 17:23:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w16EC-007kE1-1V
 for xen-changelog@lists.xenproject.org;
 Fri, 13 Mar 2026 17:23:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=7RSBj3ehzXaMk1Ch42SFmdpG7nAxZF9kA16cwM1LTVU=; b=sJiNpFmYwvIFVyJw64wcUqf2VS
	YvGREH0L1nIxYQ3QZ9wd04BoAjvyKclpqWx81WS1Opu5c1cYMORELapf3svBwFFwBC7DSvjcMKcE+
	kup5X2Qi5Z22FUttcTo+8Q1wHTlBT6noGcCq77uKlbHMhL4COXM7k288WXARTYaIO36U=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] docs: add man page for xenstore-rm
Message-Id: <E1w16EC-007kE1-1V@xenbits.xenproject.org>
Date: Fri, 13 Mar 2026 17:23:12 +0000

commit a2e95641abead60e52a171d5803e8764fdb57a86
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Thu Mar 12 16:50:58 2026 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 13 17:18:04 2026 +0000

    docs: add man page for xenstore-rm
    
    There is no man page for xenstore-rm, add it.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 docs/man/xenstore-rm.1.pod | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/docs/man/xenstore-rm.1.pod b/docs/man/xenstore-rm.1.pod
new file mode 100644
index 0000000000..ad080ee1f6
--- /dev/null
+++ b/docs/man/xenstore-rm.1.pod
@@ -0,0 +1,28 @@
+=head1 NAME
+
+xenstore-rm - remove Xenstore keys
+
+=head1 SYNOPSIS
+
+B<xenstore-rm> [I<OPTION>]... [I<PATH>]...
+
+=head1 DESCRIPTION
+
+Remove one or more Xenstore B<PATH>s.
+
+=over
+
+=item B<-h>
+
+Show the usage information for xenstore-rm and exit the program.
+
+=item B<-t>
+
+Tidy up (i.e. remove) Xenstore keys which had all children removed.
+
+=back
+
+=head1 BUGS
+
+Send bugs to xen-devel@lists.xenproject.org, see
+https://wiki.xenproject.org/wiki/Reporting_Bugs_against_Xen_Project on how to send bug reports.
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Mar 13 17:23:24 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Mar 2026 17:23:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1254284.1550230 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w16EO-0001cf-4j; Fri, 13 Mar 2026 17:23:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1254284.1550230; Fri, 13 Mar 2026 17:23:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w16EO-0001cY-25; Fri, 13 Mar 2026 17:23:24 +0000
Received: by outflank-mailman (input) for mailman id 1254284;
 Fri, 13 Mar 2026 17:23:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w16EM-0001cR-JX
 for xen-changelog@lists.xenproject.org; Fri, 13 Mar 2026 17:23:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w16EM-006ZGU-2X
 for xen-changelog@lists.xenproject.org;
 Fri, 13 Mar 2026 17:23:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w16EM-007kH4-1l
 for xen-changelog@lists.xenproject.org;
 Fri, 13 Mar 2026 17:23:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=7OJANIaI9jU/DRKXBuA0Hw5Kuv9LVMJuAhOtnqeOqOo=; b=kcV7Ag8kWYpNiEVafouK+oxDWn
	2rufzMAQU3l2Fyz2kXw+0pEva1P73cWu/r8Ptr6PZY1V6/L6tkbWcKtvIxqXzfWuMg8cjkbXBdrH1
	W9CmbTlMjPBVM7NkpqUpXBAHMKBTsV0dtr8v71Do4twFcJicKpZFhEjT5qKLVBdm0w1k=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] docs: add man page for xenstore-watch
Message-Id: <E1w16EM-007kH4-1l@xenbits.xenproject.org>
Date: Fri, 13 Mar 2026 17:23:22 +0000

commit 66eed7cbd4f55382a9ce9fca1d75f4dc4010b4c9
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Thu Mar 12 16:50:59 2026 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 13 17:18:04 2026 +0000

    docs: add man page for xenstore-watch
    
    There is no man page for xenstore-watch, add it.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 docs/man/xenstore-watch.1.pod | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/docs/man/xenstore-watch.1.pod b/docs/man/xenstore-watch.1.pod
new file mode 100644
index 0000000000..de28d380b7
--- /dev/null
+++ b/docs/man/xenstore-watch.1.pod
@@ -0,0 +1,29 @@
+=head1 NAME
+
+xenstore-watch - wait for Xenstore watch events
+
+=head1 SYNOPSIS
+
+B<xenstore-watch> [I<OPTION>]... [I<PATH>]...
+
+=head1 DESCRIPTION
+
+Set Xenstore watches to the specified I<PATH>s and print the path for each
+event happening.
+
+=over
+
+=item B<-h>
+
+Show the usage information for xenstore-watch and exit the program.
+
+=item B<-n> B<NR>
+
+Stop waiting after having received B<NR> watch events.
+
+=back
+
+=head1 BUGS
+
+Send bugs to xen-devel@lists.xenproject.org, see
+https://wiki.xenproject.org/wiki/Reporting_Bugs_against_Xen_Project on how to send bug reports.
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Mar 13 17:23:34 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Mar 2026 17:23:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1254286.1550234 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w16EY-0001em-6M; Fri, 13 Mar 2026 17:23:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1254286.1550234; Fri, 13 Mar 2026 17:23:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w16EY-0001ee-3o; Fri, 13 Mar 2026 17:23:34 +0000
Received: by outflank-mailman (input) for mailman id 1254286;
 Fri, 13 Mar 2026 17:23:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w16EW-0001eR-MY
 for xen-changelog@lists.xenproject.org; Fri, 13 Mar 2026 17:23:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w16EW-006ZGY-2n
 for xen-changelog@lists.xenproject.org;
 Fri, 13 Mar 2026 17:23:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w16EW-007kI9-21
 for xen-changelog@lists.xenproject.org;
 Fri, 13 Mar 2026 17:23:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=45mnJ6+XXdZCu0y6DpEuUvhElp/0Cj/CbpAUWF8PbBw=; b=f/hBhwyyIsr7NbfeeHahZCFM2q
	hsBVGElzpTxnWSEITJkwECOtTkdAlTiLjQhMHcsucsFBBUyYS9lCbAqKIv7qKNyik1D5CxDwIFpZa
	Lt6qiVtNABADcdNsEPpbqISNOA3/MIMLmK0XZfWoqfXniempB4unkSCSarRafIv1cOSc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/xs-clients: don't exit with error when using -h parameter
Message-Id: <E1w16EW-007kI9-21@xenbits.xenproject.org>
Date: Fri, 13 Mar 2026 17:23:32 +0000

commit 7fb8e76f399af994357dd1eeb4b923c646e42131
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Thu Mar 12 16:51:00 2026 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 13 17:18:04 2026 +0000

    tools/xs-clients: don't exit with error when using -h parameter
    
    The "-h" parameter of the xenstore-* programs is explicitly meant to
    show the usage information of the programs. This use case should not
    result in an error of the program's exit code.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/xs-clients/xenstore_client.c | 40 +++++++++++++++++++-------------------
 1 file changed, 20 insertions(+), 20 deletions(-)

diff --git a/tools/xs-clients/xenstore_client.c b/tools/xs-clients/xenstore_client.c
index a104cf6487..d15390933a 100644
--- a/tools/xs-clients/xenstore_client.c
+++ b/tools/xs-clients/xenstore_client.c
@@ -214,37 +214,37 @@ output_raw(const char *data, int len)
 }
 
 static void
-usage(enum mode mode, int incl_mode, const char *progname)
+usage(int err_val, enum mode mode, int incl_mode, const char *progname)
 {
     const char *mstr = NULL;
 
     switch (mode) {
     case MODE_unknown:
-	errx(1, "Usage: %s <mode> [-h] [...]", progname);
+	errx(err_val, "Usage: %s <mode> [-h] [...]", progname);
     case MODE_read:
 	mstr = incl_mode ? "read " : "";
-	errx(1, "Usage: %s %s[-h] [-p] [-R] key [...]", progname, mstr);
+	errx(err_val, "Usage: %s %s[-h] [-p] [-R] key [...]", progname, mstr);
     case MODE_write:
 	mstr = incl_mode ? "write " : "";
-	errx(1, "Usage: %s %s[-h] [-R] key value [...]", progname, mstr);
+	errx(err_val, "Usage: %s %s[-h] [-R] key value [...]", progname, mstr);
     case MODE_rm:
 	mstr = incl_mode ? "rm " : "";
-	errx(1, "Usage: %s %s[-h] [-t] key [...]", progname, mstr);
+	errx(err_val, "Usage: %s %s[-h] [-t] key [...]", progname, mstr);
     case MODE_exists:
 	mstr = incl_mode ? "exists " : "";
 	/* fallthrough */
     case MODE_list:
 	mstr = mstr ? : incl_mode ? "list " : "";
-	errx(1, "Usage: %s %s[-h] [-p] key [...]", progname, mstr);
+	errx(err_val, "Usage: %s %s[-h] [-p] key [...]", progname, mstr);
     case MODE_ls:
 	mstr = mstr ? : incl_mode ? "ls " : "";
-	errx(1, "Usage: %s %s[-h] [-f] [-p] [path]", progname, mstr);
+	errx(err_val, "Usage: %s %s[-h] [-f] [-p] [path]", progname, mstr);
     case MODE_chmod:
 	mstr = incl_mode ? "chmod " : "";
-	errx(1, "Usage: %s %s[-h] [-u] [-r] key <mode [modes...]>", progname, mstr);
+	errx(err_val, "Usage: %s %s[-h] [-u] [-r] key <mode [modes...]>", progname, mstr);
     case MODE_watch:
 	mstr = incl_mode ? "watch " : "";
-	errx(1, "Usage: %s %s[-h] [-n NR] key", progname, mstr);
+	errx(err_val, "Usage: %s %s[-h] [-n NR] key", progname, mstr);
     }
 }
 
@@ -685,7 +685,7 @@ main(int argc, char **argv)
 	command = command + strlen("xenstore-");
     }
     else if (argc < 2)
-	usage(MODE_unknown, 0, argv[0]);
+	usage(1, MODE_unknown, 0, argv[0]);
     else
     {
 	command = argv[1];
@@ -715,7 +715,7 @@ main(int argc, char **argv)
 
 	switch (c) {
 	case 'h':
-	    usage(mode, switch_argv, argv[0]);
+	    usage(0, mode, switch_argv, argv[0]);
 	    /* NOTREACHED */
         case 'f':
 	    if ( mode == MODE_ls ) {
@@ -723,44 +723,44 @@ main(int argc, char **argv)
 		desired_width = 0;
 		show_whole_path = 1;
 	    } else {
-		usage(mode, switch_argv, argv[0]);
+		usage(1, mode, switch_argv, argv[0]);
 	    }
             break;
 	case 'p':
 	    if ( mode == MODE_read || mode == MODE_list || mode == MODE_ls )
 		prefix = 1;
 	    else
-		usage(mode, switch_argv, argv[0]);
+		usage(1, mode, switch_argv, argv[0]);
 	    break;
 	case 't':
 	    if ( mode == MODE_rm )
 		tidy = 1;
 	    else
-		usage(mode, switch_argv, argv[0]);
+		usage(1, mode, switch_argv, argv[0]);
 	    break;
 	case 'u':
 	    if ( mode == MODE_chmod )
 		upto = 1;
 	    else
-		usage(mode, switch_argv, argv[0]);
+		usage(1, mode, switch_argv, argv[0]);
 	    break;
 	case 'r':
 	    if ( mode == MODE_chmod )
 		recurse = 1;
 	    else
-		usage(mode, switch_argv, argv[0]);
+		usage(1, mode, switch_argv, argv[0]);
 	    break;
 	case 'n':
 	    if ( mode == MODE_watch )
 		nr_watches = atoi(optarg);
 	    else
-		usage(mode, switch_argv, argv[0]);
+		usage(1, mode, switch_argv, argv[0]);
 	    break;
 	case 'R':
 	    if ( mode == MODE_read || mode == MODE_write )
 		raw = 1;
 	    else
-		usage(mode, switch_argv, argv[0]);
+		usage(1, mode, switch_argv, argv[0]);
 	    break;
 	}
     }
@@ -770,13 +770,13 @@ main(int argc, char **argv)
 	break;
     case MODE_write:
 	if ((argc - switch_argv - optind) % 2 == 1) {
-	    usage(mode, switch_argv, argv[0]);
+	    usage(1, mode, switch_argv, argv[0]);
 	    /* NOTREACHED */
 	}
 	/* DROP-THRU */
     default:
 	if (optind == argc - switch_argv) {
-	    usage(mode, switch_argv, argv[0]);
+	    usage(1, mode, switch_argv, argv[0]);
 	    /* NOTREACHED */
 	}
     }
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Mar 13 17:23:44 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Mar 2026 17:23:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1254287.1550238 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w16Ei-0001gl-7j; Fri, 13 Mar 2026 17:23:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1254287.1550238; Fri, 13 Mar 2026 17:23:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w16Ei-0001gd-5C; Fri, 13 Mar 2026 17:23:44 +0000
Received: by outflank-mailman (input) for mailman id 1254287;
 Fri, 13 Mar 2026 17:23:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w16Eg-0001gU-OW
 for xen-changelog@lists.xenproject.org; Fri, 13 Mar 2026 17:23:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w16Eg-006ZGc-32
 for xen-changelog@lists.xenproject.org;
 Fri, 13 Mar 2026 17:23:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w16Eg-007kKH-2I
 for xen-changelog@lists.xenproject.org;
 Fri, 13 Mar 2026 17:23:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=dq+UpW751ROl+6BZ0tzO5ryxBJuFmpn2pCJc9czvlOA=; b=7HALovTrZvKAv7YtsU9ry6zyDx
	IjIR+UjntP4cVOXdIIcNekb+O31tcZn3DFm87OSolAz2CBOkWRWJjNZTibrrjvGxLGszQUMoNaphB
	/pjkqyM9aQJJpGFXLFYnsYwiuc22tnqwNRR9ti5kR9FONJXDpyD/T+QT2nIb+Xwf31uw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/xs-clients: fix usage information of xenstore-exists
Message-Id: <E1w16Eg-007kKH-2I@xenbits.xenproject.org>
Date: Fri, 13 Mar 2026 17:23:42 +0000

commit a772a005eda6321349ed27fc9a8ccfa0c669577e
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Thu Mar 12 16:51:01 2026 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 13 17:18:04 2026 +0000

    tools/xs-clients: fix usage information of xenstore-exists
    
    The usage information of xenstore-exists is just wrong, as the "-p"
    option is not supported by xenstore-exists.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/xs-clients/xenstore_client.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/xs-clients/xenstore_client.c b/tools/xs-clients/xenstore_client.c
index d15390933a..b02597a506 100644
--- a/tools/xs-clients/xenstore_client.c
+++ b/tools/xs-clients/xenstore_client.c
@@ -232,7 +232,7 @@ usage(int err_val, enum mode mode, int incl_mode, const char *progname)
 	errx(err_val, "Usage: %s %s[-h] [-t] key [...]", progname, mstr);
     case MODE_exists:
 	mstr = incl_mode ? "exists " : "";
-	/* fallthrough */
+	errx(err_val, "Usage: %s %s[-h] key", progname, mstr);
     case MODE_list:
 	mstr = mstr ? : incl_mode ? "list " : "";
 	errx(err_val, "Usage: %s %s[-h] [-p] key [...]", progname, mstr);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Mar 13 17:23:54 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Mar 2026 17:23:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1254288.1550242 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w16Es-0001jL-9F; Fri, 13 Mar 2026 17:23:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1254288.1550242; Fri, 13 Mar 2026 17:23:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w16Es-0001jD-6W; Fri, 13 Mar 2026 17:23:54 +0000
Received: by outflank-mailman (input) for mailman id 1254288;
 Fri, 13 Mar 2026 17:23:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w16Eq-0001j5-Rm
 for xen-changelog@lists.xenproject.org; Fri, 13 Mar 2026 17:23:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w16Er-006ZGz-07
 for xen-changelog@lists.xenproject.org;
 Fri, 13 Mar 2026 17:23:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w16Eq-007kNy-2X
 for xen-changelog@lists.xenproject.org;
 Fri, 13 Mar 2026 17:23:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=C0WPa1LjQh9mDIAJv8HcidgpF9VJMEB5CPpriktJwVA=; b=aHmbGqDkLtJYVTDNkPFpqmnIw5
	00sS/SSLsRw9c/bywhRH8vHBIoEtdjoQhAI6vWANrmL4185+AkrjdaqE0On4k3e33oP5YOJfW3xW6
	d+jvDodnLjsD7sB4se0IpNvjOQDt6qzqbR+Qb7ap4dtuzrdlPRNePPMECLH7V5D0KBcw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/xs-clients: fix output of "xenstore-list -p /"
Message-Id: <E1w16Eq-007kNy-2X@xenbits.xenproject.org>
Date: Fri, 13 Mar 2026 17:23:52 +0000

commit a3a3e7bdd753d0da161a44d55b02fb5c46a559c2
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Thu Mar 12 16:51:02 2026 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 13 17:18:04 2026 +0000

    tools/xs-clients: fix output of "xenstore-list -p /"
    
    When calling "xenstore-list -p /" it will prepend all listed keys
    with "//" instead of "/".
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/xs-clients/xenstore_client.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/tools/xs-clients/xenstore_client.c b/tools/xs-clients/xenstore_client.c
index b02597a506..9a25704b91 100644
--- a/tools/xs-clients/xenstore_client.c
+++ b/tools/xs-clients/xenstore_client.c
@@ -568,13 +568,17 @@ perform(enum mode mode, int optind, int argc, char **argv, struct xs_handle *xsh
         case MODE_list: {
             unsigned int i, num;
             char **list = xs_directory(xsh, xth, argv[optind], &num);
+            const char *pref = argv[optind];
+
             if (list == NULL) {
                 warnx("could not list path %s", argv[optind]);
                 return 1;
             }
+            if (prefix && !strcmp(pref, "/"))
+                pref = "";
             for (i = 0; i < num; i++) {
                 if (prefix)
-                    output("%s/", argv[optind]);
+                    output("%s/", pref);
                 output("%s\n", list[i]);
             }
             free(list);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Mar 13 19:22:11 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Mar 2026 19:22:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1254464.1550263 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w185C-0001Iy-Ld; Fri, 13 Mar 2026 19:22:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1254464.1550263; Fri, 13 Mar 2026 19:22:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w185C-0001Iq-J5; Fri, 13 Mar 2026 19:22:02 +0000
Received: by outflank-mailman (input) for mailman id 1254464;
 Fri, 13 Mar 2026 19:22:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w185C-0001Ik-2c
 for xen-changelog@lists.xenproject.org; Fri, 13 Mar 2026 19:22:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w185C-006ba3-0i
 for xen-changelog@lists.xenproject.org;
 Fri, 13 Mar 2026 19:22:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w185B-007un4-31
 for xen-changelog@lists.xenproject.org;
 Fri, 13 Mar 2026 19:22:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=i0P0kdqueu4w5mIuRclExtfXZV1atWicq31+B9wpbKI=; b=Uhndt0c0TfMZl77XRgEaKpqM+9
	cgO/C7tWN6DAcVEc1f9qB9dMAzYQ1+TCb5CY/TozNJd3ptfwFA809xehVy8sLLADgRI5L0tCCvrcC
	TZjwUKZYfA9elheDalg1WznCUlX2Ib/iuiFYJxiVVBjMGwdtQPNRR7Cxtnu/zWGRGO2o=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86: Clamp bits in eflags more aggressively
Message-Id: <E1w185B-007un4-31@xenbits.xenproject.org>
Date: Fri, 13 Mar 2026 19:22:01 +0000

commit dbd936248f3846449c0d0e192d544b592c1c44d5
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue May 27 15:58:46 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 13 17:18:04 2026 +0000

    x86: Clamp bits in eflags more aggressively
    
    In FRED mode, ERET is stricter than IRET about flags.  Notably this means:
    
     * The vm86 bit (bit 17) and IOPL (bits 12,13) must be clear.
     * The sticky-1 reserved bit (bit 2) must be set, so dom0_construct() needs to
       set X86_EFLAGS_MBS in order for a PV dom0 to start.
     * All other reserved bits must be clear.
    
    Xen has been overly lax with reserved bit handling.  Adjust
    arch_set_info_guest*() and hypercall_iret() which consume flags to clamp the
    reserved bits for all guest types.
    
    This is a minor ABI change, but by the same argument as commit
    9f892f84c279 ("x86/domctl: Stop using XLAT_cpu_user_regs()"); the reserved
    bits would get clamped like this naturally by hardware when the vCPU is run.
    
    The handling of vm86 is also different.  Guests under 32bit Xen really could
    use vm86 mode, but Long Mode disallows vm86 mode and IRET simply ignores the
    bit.  Xen's behaviour for a PV32 guest trying to use vm86 mode under a 64bit
    Xen is to arrange to deliver #GP at the target of the IRET, rather than to
    fail the IRET itself.
    
    However there's no filtering in arch_set_info_guest() itself, and it can't
    arrange to queue a #GP at the target, so do the next best thing and fail the
    hypercall.  This is not expected to create an issue for PV guests, as the
    result of such an arch_set_info_guest() previously would be to run supposedly
    Real Mode code as Protected Mode code.
    
    This allows PV guests to start when Xen is using FRED mode.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/domain.c                | 24 ++++++++++++++++++++++--
 xen/arch/x86/hvm/domain.c            |  4 ++--
 xen/arch/x86/include/asm/x86-defns.h |  7 +++++++
 xen/arch/x86/pv/dom0_build.c         |  2 +-
 xen/arch/x86/pv/iret.c               |  8 +++++---
 5 files changed, 37 insertions(+), 8 deletions(-)

diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index 868c26036d..4664264b2f 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -1193,6 +1193,14 @@ int arch_set_info_guest(
 
             if ( !__addr_ok(c.nat->ldt_base) )
                 return -EINVAL;
+
+            /*
+             * IRET in Long Mode discards EFLAGS.VM, but in FRED mode ERET
+             * cares that it is zero.
+             *
+             * Guests can't see FRED, so emulate IRET behaviour.
+             */
+            c.nat->user_regs.rflags &= ~X86_EFLAGS_VM;
         }
 #ifdef CONFIG_COMPAT
         else
@@ -1205,6 +1213,18 @@ int arch_set_info_guest(
 
             for ( i = 0; i < ARRAY_SIZE(c.cmp->trap_ctxt); i++ )
                 fixup_guest_code_selector(d, c.cmp->trap_ctxt[i].cs);
+
+            /*
+             * Under 32bit Xen, PV guests could really use vm86 mode.  Under
+             * 64bit Xen, vm86 mode can't be entered even by PV32 guests.
+             *
+             * For backwards compatibility, compat HYPERCALL_iret will arrange
+             * to deliver #GP at the target of the IRET rather than to fail
+             * the IRET itself, but we can't arrange for the same behaviour
+             * here.  Reject the hypercall as the next best option.
+             */
+            if ( c.cmp->user_regs.eflags & X86_EFLAGS_VM )
+                return -EINVAL;
         }
 #endif
 
@@ -1244,7 +1264,7 @@ int arch_set_info_guest(
         v->arch.user_regs.rax               = c.nat->user_regs.rax;
         v->arch.user_regs.rip               = c.nat->user_regs.rip;
         v->arch.user_regs.cs                = c.nat->user_regs.cs;
-        v->arch.user_regs.rflags            = c.nat->user_regs.rflags;
+        v->arch.user_regs.rflags            = (c.nat->user_regs.rflags & X86_EFLAGS_ALL) | X86_EFLAGS_MBS;
         v->arch.user_regs.rsp               = c.nat->user_regs.rsp;
         v->arch.user_regs.ss                = c.nat->user_regs.ss;
         v->arch.pv.es                       = c.nat->user_regs.es;
@@ -1268,7 +1288,7 @@ int arch_set_info_guest(
         v->arch.user_regs.eax               = c.cmp->user_regs.eax;
         v->arch.user_regs.eip               = c.cmp->user_regs.eip;
         v->arch.user_regs.cs                = c.cmp->user_regs.cs;
-        v->arch.user_regs.eflags            = c.cmp->user_regs.eflags;
+        v->arch.user_regs.eflags            = (c.cmp->user_regs.eflags & X86_EFLAGS_ALL) | X86_EFLAGS_MBS;
         v->arch.user_regs.esp               = c.cmp->user_regs.esp;
         v->arch.user_regs.ss                = c.cmp->user_regs.ss;
         v->arch.pv.es                       = c.cmp->user_regs.es;
diff --git a/xen/arch/x86/hvm/domain.c b/xen/arch/x86/hvm/domain.c
index 155d61db13..a0e811ea47 100644
--- a/xen/arch/x86/hvm/domain.c
+++ b/xen/arch/x86/hvm/domain.c
@@ -194,7 +194,7 @@ int arch_set_info_hvm_guest(struct vcpu *v, const struct vcpu_hvm_context *ctx)
         uregs->rsi    = regs->esi;
         uregs->rdi    = regs->edi;
         uregs->rip    = regs->eip;
-        uregs->rflags = regs->eflags;
+        uregs->rflags = (regs->eflags & X86_EFLAGS_ALL) | X86_EFLAGS_MBS;
 
         v->arch.hvm.guest_cr[0] = regs->cr0;
         v->arch.hvm.guest_cr[3] = regs->cr3;
@@ -245,7 +245,7 @@ int arch_set_info_hvm_guest(struct vcpu *v, const struct vcpu_hvm_context *ctx)
         uregs->rsi    = regs->rsi;
         uregs->rdi    = regs->rdi;
         uregs->rip    = regs->rip;
-        uregs->rflags = regs->rflags;
+        uregs->rflags = (regs->rflags & X86_EFLAGS_ALL) | X86_EFLAGS_MBS;
 
         v->arch.hvm.guest_cr[0] = regs->cr0;
         v->arch.hvm.guest_cr[3] = regs->cr3;
diff --git a/xen/arch/x86/include/asm/x86-defns.h b/xen/arch/x86/include/asm/x86-defns.h
index 0a0ba83de7..edeb0b4ff9 100644
--- a/xen/arch/x86/include/asm/x86-defns.h
+++ b/xen/arch/x86/include/asm/x86-defns.h
@@ -27,6 +27,13 @@
     (X86_EFLAGS_CF | X86_EFLAGS_PF | X86_EFLAGS_AF |   \
      X86_EFLAGS_ZF | X86_EFLAGS_SF | X86_EFLAGS_OF)
 
+#define X86_EFLAGS_ALL                                          \
+    (X86_EFLAGS_ARITH_MASK | X86_EFLAGS_TF | X86_EFLAGS_IF |    \
+     X86_EFLAGS_DF | X86_EFLAGS_OF | X86_EFLAGS_IOPL |          \
+     X86_EFLAGS_NT | X86_EFLAGS_RF | X86_EFLAGS_VM |            \
+     X86_EFLAGS_AC | X86_EFLAGS_VIF | X86_EFLAGS_VIP |          \
+     X86_EFLAGS_ID)
+
 /*
  * Intel CPU flags in CR0
  */
diff --git a/xen/arch/x86/pv/dom0_build.c b/xen/arch/x86/pv/dom0_build.c
index 9a11a0a16b..075a3646c2 100644
--- a/xen/arch/x86/pv/dom0_build.c
+++ b/xen/arch/x86/pv/dom0_build.c
@@ -1024,7 +1024,7 @@ static int __init dom0_construct(const struct boot_domain *bd)
     regs->rip = parms.virt_entry;
     regs->rsp = vstack_end;
     regs->rsi = vstartinfo_start;
-    regs->eflags = X86_EFLAGS_IF;
+    regs->eflags = X86_EFLAGS_IF | X86_EFLAGS_MBS;
 
     /*
      * We don't call arch_set_info_guest(), so some initialisation needs doing
diff --git a/xen/arch/x86/pv/iret.c b/xen/arch/x86/pv/iret.c
index d3a1fb2c68..39ce316b8d 100644
--- a/xen/arch/x86/pv/iret.c
+++ b/xen/arch/x86/pv/iret.c
@@ -80,8 +80,9 @@ long do_iret(void)
 
     regs->rip    = iret_saved.rip;
     regs->cs     = iret_saved.cs | 3; /* force guest privilege */
-    regs->rflags = ((iret_saved.rflags & ~(X86_EFLAGS_IOPL|X86_EFLAGS_VM))
-                    | X86_EFLAGS_IF);
+    regs->rflags = ((iret_saved.rflags & X86_EFLAGS_ALL &
+                     ~(X86_EFLAGS_IOPL | X86_EFLAGS_VM)) |
+                    X86_EFLAGS_IF | X86_EFLAGS_MBS);
     regs->rsp    = iret_saved.rsp;
     regs->ss     = iret_saved.ss | 3; /* force guest privilege */
 
@@ -143,7 +144,8 @@ int compat_iret(void)
     if ( VM_ASSIST(v->domain, architectural_iopl) )
         v->arch.pv.iopl = eflags & X86_EFLAGS_IOPL;
 
-    regs->eflags = (eflags & ~X86_EFLAGS_IOPL) | X86_EFLAGS_IF;
+    regs->eflags = ((eflags & X86_EFLAGS_ALL & ~X86_EFLAGS_IOPL) |
+                    X86_EFLAGS_IF | X86_EFLAGS_MBS);
 
     if ( unlikely(eflags & X86_EFLAGS_VM) )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 13 19:22:13 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Mar 2026 19:22:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1254465.1550268 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w185N-0001Kv-NM; Fri, 13 Mar 2026 19:22:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1254465.1550268; Fri, 13 Mar 2026 19:22:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w185N-0001Ko-Kg; Fri, 13 Mar 2026 19:22:13 +0000
Received: by outflank-mailman (input) for mailman id 1254465;
 Fri, 13 Mar 2026 19:22:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w185M-0001KY-4N
 for xen-changelog@lists.xenproject.org; Fri, 13 Mar 2026 19:22:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w185M-006ba8-11
 for xen-changelog@lists.xenproject.org;
 Fri, 13 Mar 2026 19:22:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w185M-007unr-0D
 for xen-changelog@lists.xenproject.org;
 Fri, 13 Mar 2026 19:22:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=VwNe/OvWrGsec1nlF/HYb+UxuPuwIbfMdIXuY5GVl6g=; b=fUyoEjgunSsUawgLs+fwV7NpJf
	JTLg3HXkR+d0qmGEByZVewxdK1rZJecJWTnZSuzJBoWgiggKWlKkS0WOXn1hKKcaZrV1gMOwSElFX
	0SZKiHt8jTN2an+sZ5lfcEu2XHnypdrjisz1Px/N/8axOVERu59k757b8Okqm2bF7LmE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/argo: Fix MISRA violations around function parameters
Message-Id: <E1w185M-007unr-0D@xenbits.xenproject.org>
Date: Fri, 13 Mar 2026 19:22:12 +0000

commit f03a9e3bd94f50724655ae892816410688340837
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Sat Jan 3 19:52:11 2026 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 13 17:18:04 2026 +0000

    xen/argo: Fix MISRA violations around function parameters
    
    For the ARM build only, Eclair reports a R8.4 violation because do_argo_op()
    cannot see its declaration.  This means that x86 is picking hypercall-defs.h
    up transitively while ARM is not.  Include xen/hypercall.h explicitly.
    
    Eclair also reports a R8.3 violation because of arg3 and arg4 differing in
    name with a raw_ prefix.  Because hypercall-defs.h generates both do_argo_op()
    and compat_argo_op() from a single description, it's not possible to simply
    rename to raw_ in the declaration, as that would force doing the same rename
    in compat_argo_op().
    
    In do_argo_op(), drop the split parameter handling, and perform the 32bit
    range check via an explicit cast.  While adjusting the surrounding logic, drop
    unnecessary casts to void * for already pointer arguments in argo_printk().
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Daniel P. Smith <dpsmith@apertussolutions.com>
---
 xen/common/argo.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/xen/common/argo.c b/xen/common/argo.c
index 029a82825b..28626e00a8 100644
--- a/xen/common/argo.c
+++ b/xen/common/argo.c
@@ -21,6 +21,7 @@
 #include <xen/errno.h>
 #include <xen/event.h>
 #include <xen/guest_access.h>
+#include <xen/hypercall.h>
 #include <xen/lib.h>
 #include <xen/nospec.h>
 #include <xen/param.h>
@@ -2084,18 +2085,17 @@ sendv(struct domain *src_d, xen_argo_addr_t *src_addr,
 
 long
 do_argo_op(unsigned int cmd, XEN_GUEST_HANDLE_PARAM(void) arg1,
-           XEN_GUEST_HANDLE_PARAM(void) arg2, unsigned long raw_arg3,
-           unsigned long raw_arg4)
+           XEN_GUEST_HANDLE_PARAM(void) arg2, unsigned long arg3,
+           unsigned long arg4)
 {
     struct domain *currd = current->domain;
     long rc;
-    unsigned int arg3 = raw_arg3, arg4 = raw_arg4;
 
     argo_dprintk("->do_argo_op(%u,%p,%p,%lu,0x%lx)\n", cmd,
-                 (void *)arg1.p, (void *)arg2.p, raw_arg3, raw_arg4);
+                 arg1.p, arg2.p, arg3, arg4);
 
     /* Reject numeric hypercall args outside 32-bit range */
-    if ( (arg3 != raw_arg3) || (arg4 != raw_arg4) )
+    if ( (arg3 != (uint32_t)arg3) || (arg4 != (uint32_t)arg4) )
         return -EINVAL;
 
     if ( unlikely(!opt_argo) )
@@ -2248,7 +2248,7 @@ compat_argo_op(unsigned int cmd, XEN_GUEST_HANDLE_PARAM(void) arg1,
         return rc;
 
     argo_dprintk("->compat_argo_op(%u,%p,%p,%lu,0x%lx)\n", cmd,
-                 (void *)arg1.p, (void *)arg2.p, arg3, arg4);
+                 arg1.p, arg2.p, arg3, arg4);
 
     send_addr_hnd = guest_handle_cast(arg1, xen_argo_send_addr_t);
     /* arg2: iovs, arg3: niov, arg4: message_type */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 13 19:22:23 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Mar 2026 19:22:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1254466.1550272 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w185X-0001NJ-P0; Fri, 13 Mar 2026 19:22:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1254466.1550272; Fri, 13 Mar 2026 19:22:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w185X-0001NB-MG; Fri, 13 Mar 2026 19:22:23 +0000
Received: by outflank-mailman (input) for mailman id 1254466;
 Fri, 13 Mar 2026 19:22:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w185W-0001N3-7e
 for xen-changelog@lists.xenproject.org; Fri, 13 Mar 2026 19:22:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w185W-006baM-1L
 for xen-changelog@lists.xenproject.org;
 Fri, 13 Mar 2026 19:22:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w185W-007uoM-0Y
 for xen-changelog@lists.xenproject.org;
 Fri, 13 Mar 2026 19:22:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=SvPK6M6Sqm/WL0Kp4W4xY0UURqtXbQLkujTjyOYEDb8=; b=A3DY8yCd5fylvI14Oi030FpPsJ
	eCIdTZN44JEuoDDR49ZYdUcrjZlvSTI+atbHD+QLY7W+D4VyLyOzxpy7OROe1+RR+IbwgecnWkkNT
	8kmWdbaxPUOqIA2dzZLz+vaikto53NhFpElr7F34V+AJXFejOtIpD10SSiKaE6nw7zCk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen: Bracket uses of macro parameters
Message-Id: <E1w185W-007uoM-0Y@xenbits.xenproject.org>
Date: Fri, 13 Mar 2026 19:22:22 +0000

commit 2429e82c718e00b646166e9dd13f6130fc02bf8d
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Feb 20 11:52:21 2026 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 13 17:18:04 2026 +0000

    xen: Bracket uses of macro parameters
    
    Fixing Rule 20.7 violations.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
 xen/arch/arm/pci/pci-access.c       |  6 +++---
 xen/arch/x86/include/asm/bootinfo.h |  2 +-
 xen/arch/x86/mm/shadow/multi.c      |  2 +-
 xen/common/kimage.c                 | 11 ++++++-----
 xen/common/livepatch.c              |  7 ++++---
 xen/crypto/vmac.c                   |  8 ++++----
 xen/include/xen/libfdt/libfdt.h     |  6 +++---
 7 files changed, 22 insertions(+), 20 deletions(-)

diff --git a/xen/arch/arm/pci/pci-access.c b/xen/arch/arm/pci/pci-access.c
index 2b23d552bb..7bd6877596 100644
--- a/xen/arch/arm/pci/pci-access.c
+++ b/xen/arch/arm/pci/pci-access.c
@@ -16,7 +16,7 @@
 #include <asm/io.h>
 
 #define INVALID_VALUE (~0U)
-#define PCI_ERR_VALUE(len) GENMASK(0, len * 8)
+#define PCI_ERR_VALUE(len) GENMASK(0, (len) * 8)
 
 static const struct pci_ops *get_ops(struct pci_host_bridge *bridge,
                                      pci_sbdf_t sbdf)
@@ -139,14 +139,14 @@ static void pci_config_write(pci_sbdf_t sbdf, unsigned int reg,
     void pci_conf_write##size(pci_sbdf_t sbdf,              \
                               unsigned int reg, type data)  \
 {                                                           \
-    pci_config_write(sbdf, reg, size / 8, data);            \
+    pci_config_write(sbdf, reg, (size) / 8, data);          \
 }
 
 #define PCI_OP_READ(size, type)                             \
     type pci_conf_read##size(pci_sbdf_t sbdf,               \
                               unsigned int reg)             \
 {                                                           \
-    return pci_config_read(sbdf, reg, size / 8);            \
+    return pci_config_read(sbdf, reg, (size) / 8);          \
 }
 
 PCI_OP_READ(8, uint8_t)
diff --git a/xen/arch/x86/include/asm/bootinfo.h b/xen/arch/x86/include/asm/bootinfo.h
index 4f2cc5906e..b3a6b2acf3 100644
--- a/xen/arch/x86/include/asm/bootinfo.h
+++ b/xen/arch/x86/include/asm/bootinfo.h
@@ -75,7 +75,7 @@ static inline unsigned int __init next_boot_module_index(
 #define for_each_boot_module_by_type(i, b, t)           \
     for ( (i) = first_boot_module_index(b, t);          \
           (i) <= (b)->nr_modules;                       \
-          (i) = next_boot_module_index(b, t, i + 1) )
+          (i) = next_boot_module_index(b, t, (i) + 1) )
 
 #endif /* X86_BOOTINFO_H */
 
diff --git a/xen/arch/x86/mm/shadow/multi.c b/xen/arch/x86/mm/shadow/multi.c
index f95da9ffd2..80cd3299fa 100644
--- a/xen/arch/x86/mm/shadow/multi.c
+++ b/xen/arch/x86/mm/shadow/multi.c
@@ -796,7 +796,7 @@ do {                                                                    \
 do {                                                                    \
     int __done = 0;                                                     \
     _FOREACH_PRESENT_L1E(_sl1mfn, _sl1e, _gl1p,                         \
-                         ({ (__done = _done); }), _code);               \
+                         ({ __done = (_done); }), _code);               \
     _sl1mfn = sh_next_page(_sl1mfn);                                    \
     if ( !__done )                                                      \
         _FOREACH_PRESENT_L1E(_sl1mfn, _sl1e, _gl1p, _done, _code);      \
diff --git a/xen/common/kimage.c b/xen/common/kimage.c
index e1aec5a18a..6202491f7e 100644
--- a/xen/common/kimage.c
+++ b/xen/common/kimage.c
@@ -491,11 +491,12 @@ static void kimage_terminate(struct kexec_image *image)
  * Call unmap_domain_page(ptr) after the loop exits.
  */
 #define for_each_kimage_entry(image, ptr, entry)                        \
-    for ( ptr = map_domain_page(_mfn(paddr_to_pfn(image->head)));       \
-          (entry = *ptr) && !(entry & IND_DONE);                        \
-          ptr = (entry & IND_INDIRECTION) ?                             \
-              (unmap_domain_page(ptr), map_domain_page(_mfn(paddr_to_pfn(entry)))) \
-              : ptr + 1 )
+    for ( (ptr) = map_domain_page(_mfn(paddr_to_pfn((image)->head)));   \
+          (entry = *(ptr)) && !((entry) & IND_DONE);                    \
+          (ptr) = (((entry) & IND_INDIRECTION)                          \
+                   ? (unmap_domain_page(ptr),                           \
+                      map_domain_page(_mfn(paddr_to_pfn(entry))))       \
+                   : (ptr) + 1) )
 
 static void kimage_free_entry(kimage_entry_t entry)
 {
diff --git a/xen/common/livepatch.c b/xen/common/livepatch.c
index 7446533c8c..7515a040ad 100644
--- a/xen/common/livepatch.c
+++ b/xen/common/livepatch.c
@@ -664,7 +664,8 @@ static inline int livepatch_check_expectations(const struct payload *payload)
     const struct livepatch_elf_sec *__sec = livepatch_elf_sec_by_name(elf, section_name); \
     if ( !__sec )                                                                         \
         break;                                                                            \
-    if ( !section_ok(elf, __sec, sizeof(*hook)) || __sec->sec->sh_size != sizeof(*hook) ) \
+    if ( !section_ok(elf, __sec, sizeof(*(hook))) ||                                      \
+         __sec->sec->sh_size != sizeof(*(hook)) )                                         \
         return -EINVAL;                                                                   \
     hook = __sec->addr;                                                                   \
 } while (0)
@@ -678,10 +679,10 @@ static inline int livepatch_check_expectations(const struct payload *payload)
     const struct livepatch_elf_sec *__sec = livepatch_elf_sec_by_name(elf, section_name); \
     if ( !__sec )                                                                         \
         break;                                                                            \
-    if ( !section_ok(elf, __sec, sizeof(*hook)) )                                         \
+    if ( !section_ok(elf, __sec, sizeof(*(hook))) )                                       \
         return -EINVAL;                                                                   \
     hook = __sec->addr;                                                                   \
-    nhooks = __sec->sec->sh_size / sizeof(*hook);                                         \
+    nhooks = __sec->sec->sh_size / sizeof(*(hook));                                       \
 } while (0)
 
 static int prepare_payload(struct payload *payload,
diff --git a/xen/crypto/vmac.c b/xen/crypto/vmac.c
index c9914d2c7c..c7aa1e9be3 100644
--- a/xen/crypto/vmac.c
+++ b/xen/crypto/vmac.c
@@ -203,7 +203,7 @@ const uint64_t mpoly = UINT64_C(0x1fffffff1fffffff);  /* Poly key mask     */
 #define nh_16(mp, kp, nw, rh, rl)                                            \
 {   int i; uint64_t th, tl;                                                  \
     rh = rl = 0;                                                             \
-    for (i = 0; i < nw; i+= 2) {                                             \
+    for (i = 0; i < (nw); i+= 2) {                                           \
         MUL64(th,tl,get64PE((mp)+i  )+(kp)[i  ],get64PE((mp)+i+1)+(kp)[i+1]);\
         ADD128(rh,rl,th,tl);                                                 \
     }                                                                        \
@@ -211,7 +211,7 @@ const uint64_t mpoly = UINT64_C(0x1fffffff1fffffff);  /* Poly key mask     */
 #define nh_16_2(mp, kp, nw, rh, rl, rh1, rl1)                                \
 {   int i; uint64_t th, tl;                                                  \
     rh1 = rl1 = rh = rl = 0;                                                 \
-    for (i = 0; i < nw; i+= 2) {                                             \
+    for (i = 0; i < (nw); i+= 2) {                                           \
         MUL64(th,tl,get64PE((mp)+i  )+(kp)[i  ],get64PE((mp)+i+1)+(kp)[i+1]);\
         ADD128(rh,rl,th,tl);                                                 \
         MUL64(th,tl,get64PE((mp)+i  )+(kp)[i+2],get64PE((mp)+i+1)+(kp)[i+3]);\
@@ -223,7 +223,7 @@ const uint64_t mpoly = UINT64_C(0x1fffffff1fffffff);  /* Poly key mask     */
 #define nh_vmac_nhbytes(mp, kp, nw, rh, rl)                                  \
 {   int i; uint64_t th, tl;                                                  \
     rh = rl = 0;                                                             \
-    for (i = 0; i < nw; i+= 8) {                                             \
+    for (i = 0; i < (nw); i+= 8) {                                           \
         MUL64(th,tl,get64PE((mp)+i  )+(kp)[i  ],get64PE((mp)+i+1)+(kp)[i+1]);\
         ADD128(rh,rl,th,tl);                                                 \
         MUL64(th,tl,get64PE((mp)+i+2)+(kp)[i+2],get64PE((mp)+i+3)+(kp)[i+3]);\
@@ -237,7 +237,7 @@ const uint64_t mpoly = UINT64_C(0x1fffffff1fffffff);  /* Poly key mask     */
 #define nh_vmac_nhbytes_2(mp, kp, nw, rh, rl, rh1, rl1)                      \
 {   int i; uint64_t th, tl;                                                  \
     rh1 = rl1 = rh = rl = 0;                                                 \
-    for (i = 0; i < nw; i+= 8) {                                             \
+    for (i = 0; i < (nw); i+= 8) {                                           \
         MUL64(th,tl,get64PE((mp)+i  )+(kp)[i  ],get64PE((mp)+i+1)+(kp)[i+1]);\
         ADD128(rh,rl,th,tl);                                                 \
         MUL64(th,tl,get64PE((mp)+i  )+(kp)[i+2],get64PE((mp)+i+1)+(kp)[i+3]);\
diff --git a/xen/include/xen/libfdt/libfdt.h b/xen/include/xen/libfdt/libfdt.h
index fabddbee8c..1b09bba28e 100644
--- a/xen/include/xen/libfdt/libfdt.h
+++ b/xen/include/xen/libfdt/libfdt.h
@@ -230,9 +230,9 @@ int fdt_next_subnode(const void *fdt, int offset);
  * literal.
  */
 #define fdt_for_each_subnode(node, fdt, parent)		\
-	for (node = fdt_first_subnode(fdt, parent);	\
-	     node >= 0;					\
-	     node = fdt_next_subnode(fdt, node))
+	for ((node) = fdt_first_subnode(fdt, parent);	\
+	     (node) >= 0;				\
+	     (node) = fdt_next_subnode(fdt, node))
 
 /**********************************************************************/
 /* General functions                                                  */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 13 19:22:33 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Mar 2026 19:22:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1254467.1550276 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w185h-0001PM-RK; Fri, 13 Mar 2026 19:22:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1254467.1550276; Fri, 13 Mar 2026 19:22:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w185h-0001PF-Na; Fri, 13 Mar 2026 19:22:33 +0000
Received: by outflank-mailman (input) for mailman id 1254467;
 Fri, 13 Mar 2026 19:22:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w185g-0001P9-Ar
 for xen-changelog@lists.xenproject.org; Fri, 13 Mar 2026 19:22:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w185g-006baS-1f
 for xen-changelog@lists.xenproject.org;
 Fri, 13 Mar 2026 19:22:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w185g-007uos-0q
 for xen-changelog@lists.xenproject.org;
 Fri, 13 Mar 2026 19:22:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=TmX3eQSCG+skgcZCfIaVhHQiK1gZ4/w7TNnFhy94gXg=; b=3dvIF0eG8J+GQ8NYONM6YWp8yL
	s0jeeSqq8C0mvSz1l7dK92GAHU+V2vy2yLQXNeb25nI2/kHhK5xxOIYNlNdUCzZYWS5i+tnXdLIw+
	UpEo/K99Dk8QEkLa1l/RUAZUwjpiEYei5byWvTa50ML3AYDraYT7+k2rxpNjsdW31J04=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] arm/ffa: deviate violation of MISRA C Rule 20.12
Message-Id: <E1w185g-007uos-0q@xenbits.xenproject.org>
Date: Fri, 13 Mar 2026 19:22:32 +0000

commit 195d7541708918cf0b77ef2afc3d065b16f061a1
Author:     Dmytro Prokopchuk1 <dmytro_prokopchuk1@epam.com>
AuthorDate: Fri Mar 13 09:47:38 2026 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 13 17:18:04 2026 +0000

    arm/ffa: deviate violation of MISRA C Rule 20.12
    
    MISRA C Rule 20.12 states: "A macro parameter used as an operand to
    the # or ## operators, which is itself subject to further macro replacement,
    shall only be used as an operand to these operators".
    
    In this case the 'FFA_*' macros are used both as a regular macro argument and
    as an operand for '#' stringification in the expansion of 'FW_ABI()'.
    This is deviated using a SAF-x-safe comment.
    
    No functional changes.
    
    Signed-off-by: Dmytro Prokopchuk <dmytro_prokopchuk1@epam.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 xen/arch/arm/tee/ffa.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/xen/arch/arm/tee/ffa.c b/xen/arch/arm/tee/ffa.c
index aa43ae2595..d4a77206c6 100644
--- a/xen/arch/arm/tee/ffa.c
+++ b/xen/arch/arm/tee/ffa.c
@@ -80,6 +80,7 @@ struct ffa_fw_abi {
     const char *name;
 };
 
+/* SAF-6-safe Rule 20.12 expansion of macro FFA_* with FW_ABI */
 #define FW_ABI(abi) {abi,#abi}
 
 /* List of ABI we use from the firmware */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 13 19:22:43 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Mar 2026 19:22:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1254468.1550279 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w185r-0001SU-Te; Fri, 13 Mar 2026 19:22:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1254468.1550279; Fri, 13 Mar 2026 19:22:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w185r-0001SM-R7; Fri, 13 Mar 2026 19:22:43 +0000
Received: by outflank-mailman (input) for mailman id 1254468;
 Fri, 13 Mar 2026 19:22:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w185q-0001SF-Da
 for xen-changelog@lists.xenproject.org; Fri, 13 Mar 2026 19:22:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w185q-006baZ-1w
 for xen-changelog@lists.xenproject.org;
 Fri, 13 Mar 2026 19:22:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w185q-007upV-19
 for xen-changelog@lists.xenproject.org;
 Fri, 13 Mar 2026 19:22:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=+JuZDzWoClExWRFWVqek0cqKok8pYdvrYm2q5/Vzz7Q=; b=JZpbwdOlGXi2sHp0REIty1iB57
	+o76GUlXrxaCg7Emp2ll5cfBXUsemu4yhIVjQWR7kVQyyHi/gI/63Q2VH9XcejRk3NgIsHOEEQEsj
	ye+7Z/HOvXqyUAzBHLwLW9R6J40Lh46TmT01eVVwyG27rvdiJWCDWKImUgrdvtYk6XrA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] docs: add -h parameter description to xenstore-* man pages
Message-Id: <E1w185q-007upV-19@xenbits.xenproject.org>
Date: Fri, 13 Mar 2026 19:22:42 +0000

commit 48899ad6966c6dfdf4291d48b8be004fd96d2cb4
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Thu Mar 12 16:50:55 2026 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 13 17:18:04 2026 +0000

    docs: add -h parameter description to xenstore-* man pages
    
    The "-h" parameter is missing in the man pages of the xenstore-*
    programs.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 docs/man/xenstore-chmod.1.pod | 4 ++++
 docs/man/xenstore-ls.1.pod    | 4 ++++
 docs/man/xenstore-read.1.pod  | 4 ++++
 docs/man/xenstore-write.1.pod | 4 ++++
 4 files changed, 16 insertions(+)

diff --git a/docs/man/xenstore-chmod.1.pod b/docs/man/xenstore-chmod.1.pod
index d221f5dffc..ca1a2172f9 100644
--- a/docs/man/xenstore-chmod.1.pod
+++ b/docs/man/xenstore-chmod.1.pod
@@ -42,6 +42,10 @@ write, and set permissions).
 
 =over
 
+=item B<-h>
+
+Show the usage information for xenstore-chmod and exit the program.
+
 =item B<-r>
 
 Apply the permissions to the key and all its I<children>.
diff --git a/docs/man/xenstore-ls.1.pod b/docs/man/xenstore-ls.1.pod
index a9f8b32653..b070e8368c 100644
--- a/docs/man/xenstore-ls.1.pod
+++ b/docs/man/xenstore-ls.1.pod
@@ -13,6 +13,10 @@ using a nested, tree-like view.
 
 =over
 
+=item B<-h>
+
+Show the usage information for xenstore-ls and exit the program.
+
 =item B<-f>
 
 Show the full path for all keys.
diff --git a/docs/man/xenstore-read.1.pod b/docs/man/xenstore-read.1.pod
index c7768cbbe5..7fe63268bd 100644
--- a/docs/man/xenstore-read.1.pod
+++ b/docs/man/xenstore-read.1.pod
@@ -12,6 +12,10 @@ Read values of one or more Xenstore I<PATH>s.
 
 =over
 
+=item B<-h>
+
+Show the usage information for xenstore-read and exit the program.
+
 =item B<-p>
 
 Prefix value with key name.
diff --git a/docs/man/xenstore-write.1.pod b/docs/man/xenstore-write.1.pod
index 74f80f7b1b..33a8af2db4 100644
--- a/docs/man/xenstore-write.1.pod
+++ b/docs/man/xenstore-write.1.pod
@@ -13,6 +13,10 @@ provided to write them at once - in one Xenstore transaction.
 
 =over
 
+=item B<-h>
+
+Show the usage information for xenstore-write and exit the program.
+
 =item B<-R>
 
 Write raw value, skip parsing escaped characters (\x..).
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 13 19:22:53 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Mar 2026 19:22:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1254469.1550284 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w1861-0001Ux-V6; Fri, 13 Mar 2026 19:22:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1254469.1550284; Fri, 13 Mar 2026 19:22:53 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w1861-0001Uq-SZ; Fri, 13 Mar 2026 19:22:53 +0000
Received: by outflank-mailman (input) for mailman id 1254469;
 Fri, 13 Mar 2026 19:22:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w1860-0001Uh-GW
 for xen-changelog@lists.xenproject.org; Fri, 13 Mar 2026 19:22:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w1860-006baz-2F
 for xen-changelog@lists.xenproject.org;
 Fri, 13 Mar 2026 19:22:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w1860-007uq4-1Q
 for xen-changelog@lists.xenproject.org;
 Fri, 13 Mar 2026 19:22:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=sTd9KI+HcsbIFf3Kr73nexwuj0YkApZG2aonUjNzfjo=; b=B6BJ0neiDE2uaaTth3JEYxy3yb
	dbSp7zxpCGwA9vFXOndZ1ASuwDd/J7AhJ3LCwWX0Xz5BtrcAUosXn0xIphza5uFBpbgRHWWkmELtd
	L2TwDEfXDahBV84iRqyRc5/fzfn4QwTdx/4qobeWusZb29JtnZ1JVlD8HCeJWrCQ/hT8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] docs: add man page for xenstore-exists
Message-Id: <E1w1860-007uq4-1Q@xenbits.xenproject.org>
Date: Fri, 13 Mar 2026 19:22:52 +0000

commit 94b31456bf278c9a59152f36cafef368855251f2
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Thu Mar 12 16:50:56 2026 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 13 17:18:04 2026 +0000

    docs: add man page for xenstore-exists
    
    There is no man page for xenstore-exists, add it.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 docs/man/xenstore-exists.1.pod | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/docs/man/xenstore-exists.1.pod b/docs/man/xenstore-exists.1.pod
new file mode 100644
index 0000000000..a6eeb7ff96
--- /dev/null
+++ b/docs/man/xenstore-exists.1.pod
@@ -0,0 +1,25 @@
+=head1 NAME
+
+xenstore-exists - test whether Xenstore key exists
+
+=head1 SYNOPSIS
+
+B<xenstore-exists> I<PATH>
+
+=head1 DESCRIPTION
+
+Tests whether the specified Xenstore I<PATH> is readable and sets
+the exit value accordingly (B<0> if I<PTAH> is readable, B<1> if not).
+
+=over
+
+=item B<-h>
+
+Show the usage information for xenstore-exists and exit the program.
+
+=back
+
+=head1 BUGS
+
+Send bugs to xen-devel@lists.xenproject.org, see
+https://wiki.xenproject.org/wiki/Reporting_Bugs_against_Xen_Project on how to send bug reports.
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 13 19:23:04 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Mar 2026 19:23:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1254470.1550288 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w186C-0001X0-0U; Fri, 13 Mar 2026 19:23:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1254470.1550288; Fri, 13 Mar 2026 19:23:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w186B-0001Wt-UB; Fri, 13 Mar 2026 19:23:03 +0000
Received: by outflank-mailman (input) for mailman id 1254470;
 Fri, 13 Mar 2026 19:23:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w186A-0001Wm-JF
 for xen-changelog@lists.xenproject.org; Fri, 13 Mar 2026 19:23:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w186A-006bbN-2V
 for xen-changelog@lists.xenproject.org;
 Fri, 13 Mar 2026 19:23:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w186A-007uqo-1j
 for xen-changelog@lists.xenproject.org;
 Fri, 13 Mar 2026 19:23:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=slXf4Edul3VE5yw22b7jBQSuXfjtgi++LrirHuLny2s=; b=iF9pWHlO4ZX6OMNIZeFxlTt7as
	KgttoJNBFkgJMU9gfFGPBA5pPAkfCPxS8M3bGUms5ohIKsLneDbkwomIhig93ba5Q52X8MoBgX3Nx
	Oq/Z8XfgjLx5oqPF8GMDNE9VUqNKgiPQrZUOeS7E/svW/K75gr2u0q1UjoQyItqiA8m0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] docs: add man page for xenstore-list
Message-Id: <E1w186A-007uqo-1j@xenbits.xenproject.org>
Date: Fri, 13 Mar 2026 19:23:02 +0000

commit 6d8731c3842a1a534be87bbb4b28131076c502a9
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Thu Mar 12 16:50:57 2026 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 13 17:18:04 2026 +0000

    docs: add man page for xenstore-list
    
    There is no man page for xenstore-list, add it.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 docs/man/xenstore-list.1.pod | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/docs/man/xenstore-list.1.pod b/docs/man/xenstore-list.1.pod
new file mode 100644
index 0000000000..ea2853a1fc
--- /dev/null
+++ b/docs/man/xenstore-list.1.pod
@@ -0,0 +1,28 @@
+=head1 NAME
+
+xenstore-list - list Xenstore key children
+
+=head1 SYNOPSIS
+
+B<xenstore-list> [I<OPTION>]... [I<PATH>]...
+
+=head1 DESCRIPTION
+
+List direct children of one or more Xenstore I<PATH>s, one child per line.
+
+=over
+
+=item B<-h>
+
+Show the usage information for xenstore-list and exit the program.
+
+=item B<-p>
+
+List the full Xenstore path of each listed path.
+
+=back
+
+=head1 BUGS
+
+Send bugs to xen-devel@lists.xenproject.org, see
+https://wiki.xenproject.org/wiki/Reporting_Bugs_against_Xen_Project on how to send bug reports.
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 13 19:23:14 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Mar 2026 19:23:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1254471.1550291 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w186M-0001ZJ-2C; Fri, 13 Mar 2026 19:23:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1254471.1550291; Fri, 13 Mar 2026 19:23:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w186L-0001ZB-Ve; Fri, 13 Mar 2026 19:23:13 +0000
Received: by outflank-mailman (input) for mailman id 1254471;
 Fri, 13 Mar 2026 19:23:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w186K-0001Z3-Lf
 for xen-changelog@lists.xenproject.org; Fri, 13 Mar 2026 19:23:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w186K-006bbV-2l
 for xen-changelog@lists.xenproject.org;
 Fri, 13 Mar 2026 19:23:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w186K-007urM-1z
 for xen-changelog@lists.xenproject.org;
 Fri, 13 Mar 2026 19:23:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=0XZuhglVSmBc60ICGbA+4RB7yZueA7TyVBEo8A1Hv/E=; b=VoPGbJqVFOHeekyQZC3Ag1whep
	637ig1cXA8XuZ41E5fVrGJO4xcUbBYe9iGKbYxULespD6e/98PyVNrJiS5BG0ECYRnGElyXlT0XrN
	VKZiKwz7IAi009hXI0gWYzsbipGDUA2yUq5GnFwm85WYIIF2elnZizvvCJ2Ig/5OoUhA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] docs: add man page for xenstore-rm
Message-Id: <E1w186K-007urM-1z@xenbits.xenproject.org>
Date: Fri, 13 Mar 2026 19:23:12 +0000

commit a2e95641abead60e52a171d5803e8764fdb57a86
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Thu Mar 12 16:50:58 2026 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 13 17:18:04 2026 +0000

    docs: add man page for xenstore-rm
    
    There is no man page for xenstore-rm, add it.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 docs/man/xenstore-rm.1.pod | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/docs/man/xenstore-rm.1.pod b/docs/man/xenstore-rm.1.pod
new file mode 100644
index 0000000000..ad080ee1f6
--- /dev/null
+++ b/docs/man/xenstore-rm.1.pod
@@ -0,0 +1,28 @@
+=head1 NAME
+
+xenstore-rm - remove Xenstore keys
+
+=head1 SYNOPSIS
+
+B<xenstore-rm> [I<OPTION>]... [I<PATH>]...
+
+=head1 DESCRIPTION
+
+Remove one or more Xenstore B<PATH>s.
+
+=over
+
+=item B<-h>
+
+Show the usage information for xenstore-rm and exit the program.
+
+=item B<-t>
+
+Tidy up (i.e. remove) Xenstore keys which had all children removed.
+
+=back
+
+=head1 BUGS
+
+Send bugs to xen-devel@lists.xenproject.org, see
+https://wiki.xenproject.org/wiki/Reporting_Bugs_against_Xen_Project on how to send bug reports.
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 13 19:23:24 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Mar 2026 19:23:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1254472.1550296 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w186W-0001bq-3T; Fri, 13 Mar 2026 19:23:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1254472.1550296; Fri, 13 Mar 2026 19:23:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w186W-0001bi-0o; Fri, 13 Mar 2026 19:23:24 +0000
Received: by outflank-mailman (input) for mailman id 1254472;
 Fri, 13 Mar 2026 19:23:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w186U-0001bb-Oa
 for xen-changelog@lists.xenproject.org; Fri, 13 Mar 2026 19:23:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w186U-006bbb-30
 for xen-changelog@lists.xenproject.org;
 Fri, 13 Mar 2026 19:23:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w186U-007uru-2F
 for xen-changelog@lists.xenproject.org;
 Fri, 13 Mar 2026 19:23:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=0BejzRKglOYVL6Y84muqGR0KZTj+awVVXUt17FK2j/I=; b=YIiWJ6MyI47poghqOuG4J8L6xp
	wlkO0m03lxVSHKsAjEAJYK/p35zOk2p2FkmM887UaynNMZSvzqCeW+5sFgnaBaVt7UzZ77eN/lLzU
	dfa9fzFrraWh8WEMhvli4aVjcm1mnfue8iP6eQC4vTvmrqIMLsbUBuT1YlpO5Bz0ceWA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] docs: add man page for xenstore-watch
Message-Id: <E1w186U-007uru-2F@xenbits.xenproject.org>
Date: Fri, 13 Mar 2026 19:23:22 +0000

commit 66eed7cbd4f55382a9ce9fca1d75f4dc4010b4c9
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Thu Mar 12 16:50:59 2026 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 13 17:18:04 2026 +0000

    docs: add man page for xenstore-watch
    
    There is no man page for xenstore-watch, add it.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 docs/man/xenstore-watch.1.pod | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/docs/man/xenstore-watch.1.pod b/docs/man/xenstore-watch.1.pod
new file mode 100644
index 0000000000..de28d380b7
--- /dev/null
+++ b/docs/man/xenstore-watch.1.pod
@@ -0,0 +1,29 @@
+=head1 NAME
+
+xenstore-watch - wait for Xenstore watch events
+
+=head1 SYNOPSIS
+
+B<xenstore-watch> [I<OPTION>]... [I<PATH>]...
+
+=head1 DESCRIPTION
+
+Set Xenstore watches to the specified I<PATH>s and print the path for each
+event happening.
+
+=over
+
+=item B<-h>
+
+Show the usage information for xenstore-watch and exit the program.
+
+=item B<-n> B<NR>
+
+Stop waiting after having received B<NR> watch events.
+
+=back
+
+=head1 BUGS
+
+Send bugs to xen-devel@lists.xenproject.org, see
+https://wiki.xenproject.org/wiki/Reporting_Bugs_against_Xen_Project on how to send bug reports.
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 13 19:23:34 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Mar 2026 19:23:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1254474.1550299 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w186g-0001e1-4e; Fri, 13 Mar 2026 19:23:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1254474.1550299; Fri, 13 Mar 2026 19:23:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w186g-0001dt-25; Fri, 13 Mar 2026 19:23:34 +0000
Received: by outflank-mailman (input) for mailman id 1254474;
 Fri, 13 Mar 2026 19:23:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w186e-0001dl-Qv
 for xen-changelog@lists.xenproject.org; Fri, 13 Mar 2026 19:23:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w186f-006bbj-03
 for xen-changelog@lists.xenproject.org;
 Fri, 13 Mar 2026 19:23:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w186e-007usQ-2V
 for xen-changelog@lists.xenproject.org;
 Fri, 13 Mar 2026 19:23:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=gv7mQ14xAgXPcsWxUwk4Jif5soFpyK9maSUPCLMOB6U=; b=LA8HQb5T5m71btNskopEGPCNNN
	FNte/EHWAQ8WN9EkjE4QBwzbxiEYpgSGKEFmRlXng5RTJBO7HYXJCmfldvc12jDw5F3MHl5UgL1d/
	rKLPJaqxAX+vMh/gyy4Wnp40BCyF60YlPbOJibCus0tjpgs/9J0AIlNw1e2QPla+O58Q=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/xs-clients: don't exit with error when using -h parameter
Message-Id: <E1w186e-007usQ-2V@xenbits.xenproject.org>
Date: Fri, 13 Mar 2026 19:23:32 +0000

commit 7fb8e76f399af994357dd1eeb4b923c646e42131
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Thu Mar 12 16:51:00 2026 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 13 17:18:04 2026 +0000

    tools/xs-clients: don't exit with error when using -h parameter
    
    The "-h" parameter of the xenstore-* programs is explicitly meant to
    show the usage information of the programs. This use case should not
    result in an error of the program's exit code.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/xs-clients/xenstore_client.c | 40 +++++++++++++++++++-------------------
 1 file changed, 20 insertions(+), 20 deletions(-)

diff --git a/tools/xs-clients/xenstore_client.c b/tools/xs-clients/xenstore_client.c
index a104cf6487..d15390933a 100644
--- a/tools/xs-clients/xenstore_client.c
+++ b/tools/xs-clients/xenstore_client.c
@@ -214,37 +214,37 @@ output_raw(const char *data, int len)
 }
 
 static void
-usage(enum mode mode, int incl_mode, const char *progname)
+usage(int err_val, enum mode mode, int incl_mode, const char *progname)
 {
     const char *mstr = NULL;
 
     switch (mode) {
     case MODE_unknown:
-	errx(1, "Usage: %s <mode> [-h] [...]", progname);
+	errx(err_val, "Usage: %s <mode> [-h] [...]", progname);
     case MODE_read:
 	mstr = incl_mode ? "read " : "";
-	errx(1, "Usage: %s %s[-h] [-p] [-R] key [...]", progname, mstr);
+	errx(err_val, "Usage: %s %s[-h] [-p] [-R] key [...]", progname, mstr);
     case MODE_write:
 	mstr = incl_mode ? "write " : "";
-	errx(1, "Usage: %s %s[-h] [-R] key value [...]", progname, mstr);
+	errx(err_val, "Usage: %s %s[-h] [-R] key value [...]", progname, mstr);
     case MODE_rm:
 	mstr = incl_mode ? "rm " : "";
-	errx(1, "Usage: %s %s[-h] [-t] key [...]", progname, mstr);
+	errx(err_val, "Usage: %s %s[-h] [-t] key [...]", progname, mstr);
     case MODE_exists:
 	mstr = incl_mode ? "exists " : "";
 	/* fallthrough */
     case MODE_list:
 	mstr = mstr ? : incl_mode ? "list " : "";
-	errx(1, "Usage: %s %s[-h] [-p] key [...]", progname, mstr);
+	errx(err_val, "Usage: %s %s[-h] [-p] key [...]", progname, mstr);
     case MODE_ls:
 	mstr = mstr ? : incl_mode ? "ls " : "";
-	errx(1, "Usage: %s %s[-h] [-f] [-p] [path]", progname, mstr);
+	errx(err_val, "Usage: %s %s[-h] [-f] [-p] [path]", progname, mstr);
     case MODE_chmod:
 	mstr = incl_mode ? "chmod " : "";
-	errx(1, "Usage: %s %s[-h] [-u] [-r] key <mode [modes...]>", progname, mstr);
+	errx(err_val, "Usage: %s %s[-h] [-u] [-r] key <mode [modes...]>", progname, mstr);
     case MODE_watch:
 	mstr = incl_mode ? "watch " : "";
-	errx(1, "Usage: %s %s[-h] [-n NR] key", progname, mstr);
+	errx(err_val, "Usage: %s %s[-h] [-n NR] key", progname, mstr);
     }
 }
 
@@ -685,7 +685,7 @@ main(int argc, char **argv)
 	command = command + strlen("xenstore-");
     }
     else if (argc < 2)
-	usage(MODE_unknown, 0, argv[0]);
+	usage(1, MODE_unknown, 0, argv[0]);
     else
     {
 	command = argv[1];
@@ -715,7 +715,7 @@ main(int argc, char **argv)
 
 	switch (c) {
 	case 'h':
-	    usage(mode, switch_argv, argv[0]);
+	    usage(0, mode, switch_argv, argv[0]);
 	    /* NOTREACHED */
         case 'f':
 	    if ( mode == MODE_ls ) {
@@ -723,44 +723,44 @@ main(int argc, char **argv)
 		desired_width = 0;
 		show_whole_path = 1;
 	    } else {
-		usage(mode, switch_argv, argv[0]);
+		usage(1, mode, switch_argv, argv[0]);
 	    }
             break;
 	case 'p':
 	    if ( mode == MODE_read || mode == MODE_list || mode == MODE_ls )
 		prefix = 1;
 	    else
-		usage(mode, switch_argv, argv[0]);
+		usage(1, mode, switch_argv, argv[0]);
 	    break;
 	case 't':
 	    if ( mode == MODE_rm )
 		tidy = 1;
 	    else
-		usage(mode, switch_argv, argv[0]);
+		usage(1, mode, switch_argv, argv[0]);
 	    break;
 	case 'u':
 	    if ( mode == MODE_chmod )
 		upto = 1;
 	    else
-		usage(mode, switch_argv, argv[0]);
+		usage(1, mode, switch_argv, argv[0]);
 	    break;
 	case 'r':
 	    if ( mode == MODE_chmod )
 		recurse = 1;
 	    else
-		usage(mode, switch_argv, argv[0]);
+		usage(1, mode, switch_argv, argv[0]);
 	    break;
 	case 'n':
 	    if ( mode == MODE_watch )
 		nr_watches = atoi(optarg);
 	    else
-		usage(mode, switch_argv, argv[0]);
+		usage(1, mode, switch_argv, argv[0]);
 	    break;
 	case 'R':
 	    if ( mode == MODE_read || mode == MODE_write )
 		raw = 1;
 	    else
-		usage(mode, switch_argv, argv[0]);
+		usage(1, mode, switch_argv, argv[0]);
 	    break;
 	}
     }
@@ -770,13 +770,13 @@ main(int argc, char **argv)
 	break;
     case MODE_write:
 	if ((argc - switch_argv - optind) % 2 == 1) {
-	    usage(mode, switch_argv, argv[0]);
+	    usage(1, mode, switch_argv, argv[0]);
 	    /* NOTREACHED */
 	}
 	/* DROP-THRU */
     default:
 	if (optind == argc - switch_argv) {
-	    usage(mode, switch_argv, argv[0]);
+	    usage(1, mode, switch_argv, argv[0]);
 	    /* NOTREACHED */
 	}
     }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 13 19:23:44 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Mar 2026 19:23:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1254475.1550303 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w186q-0001g5-63; Fri, 13 Mar 2026 19:23:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1254475.1550303; Fri, 13 Mar 2026 19:23:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w186q-0001fy-3W; Fri, 13 Mar 2026 19:23:44 +0000
Received: by outflank-mailman (input) for mailman id 1254475;
 Fri, 13 Mar 2026 19:23:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w186o-0001fs-Td
 for xen-changelog@lists.xenproject.org; Fri, 13 Mar 2026 19:23:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w186p-006bbn-0K
 for xen-changelog@lists.xenproject.org;
 Fri, 13 Mar 2026 19:23:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w186o-007uso-2l
 for xen-changelog@lists.xenproject.org;
 Fri, 13 Mar 2026 19:23:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Tp1PTb3ykefQs8KDLDjwVjzFo5kF9c/peQDMWCtb9AA=; b=EKi1FaleVe723Vp0m1nfAfk/Aj
	uvigN7BHVPY8zest3i4wTuhbb1i1sBhbIBmaec7vRjQXG6woyMJBE0LcPG+aAEXHZ6BzRyTDW57Ji
	RYh4kv06vXDR7Gi4Pc+JmzQ5LVz4c7XKiryE/dCKPgAyF4SYHqp8difEcJUzzjYQSHlk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/xs-clients: fix usage information of xenstore-exists
Message-Id: <E1w186o-007uso-2l@xenbits.xenproject.org>
Date: Fri, 13 Mar 2026 19:23:42 +0000

commit a772a005eda6321349ed27fc9a8ccfa0c669577e
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Thu Mar 12 16:51:01 2026 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 13 17:18:04 2026 +0000

    tools/xs-clients: fix usage information of xenstore-exists
    
    The usage information of xenstore-exists is just wrong, as the "-p"
    option is not supported by xenstore-exists.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/xs-clients/xenstore_client.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/xs-clients/xenstore_client.c b/tools/xs-clients/xenstore_client.c
index d15390933a..b02597a506 100644
--- a/tools/xs-clients/xenstore_client.c
+++ b/tools/xs-clients/xenstore_client.c
@@ -232,7 +232,7 @@ usage(int err_val, enum mode mode, int incl_mode, const char *progname)
 	errx(err_val, "Usage: %s %s[-h] [-t] key [...]", progname, mstr);
     case MODE_exists:
 	mstr = incl_mode ? "exists " : "";
-	/* fallthrough */
+	errx(err_val, "Usage: %s %s[-h] key", progname, mstr);
     case MODE_list:
 	mstr = mstr ? : incl_mode ? "list " : "";
 	errx(err_val, "Usage: %s %s[-h] [-p] key [...]", progname, mstr);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 13 19:23:54 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Mar 2026 19:23:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1254476.1550308 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w1870-0001iB-7o; Fri, 13 Mar 2026 19:23:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1254476.1550308; Fri, 13 Mar 2026 19:23:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w1870-0001i3-4v; Fri, 13 Mar 2026 19:23:54 +0000
Received: by outflank-mailman (input) for mailman id 1254476;
 Fri, 13 Mar 2026 19:23:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w186y-0001hu-Vx
 for xen-changelog@lists.xenproject.org; Fri, 13 Mar 2026 19:23:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w186z-006bc8-0Z
 for xen-changelog@lists.xenproject.org;
 Fri, 13 Mar 2026 19:23:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w186y-007utG-32
 for xen-changelog@lists.xenproject.org;
 Fri, 13 Mar 2026 19:23:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=PwWAnkpP76QCAtPDaw7q7NjpYm6gRTvbwGr/wO6qL9M=; b=kegXf/JZucetWEIMuwgVh2Er5K
	5wzjjFSYlFi7GrrDDou0AzX0bZJbtYIKLdvMiZkBHnwbGQf1wVx2H7dJkeAWsvioj+LGIrgh4zDpi
	WLwQS6QPgfNIwWWXY5VycBYWEpx+eN1/Qup7PRWVy/UjfZSUbIM9FZ/HRWTtiZYCxxmU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/xs-clients: fix output of "xenstore-list -p /"
Message-Id: <E1w186y-007utG-32@xenbits.xenproject.org>
Date: Fri, 13 Mar 2026 19:23:52 +0000

commit a3a3e7bdd753d0da161a44d55b02fb5c46a559c2
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Thu Mar 12 16:51:02 2026 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 13 17:18:04 2026 +0000

    tools/xs-clients: fix output of "xenstore-list -p /"
    
    When calling "xenstore-list -p /" it will prepend all listed keys
    with "//" instead of "/".
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/xs-clients/xenstore_client.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/tools/xs-clients/xenstore_client.c b/tools/xs-clients/xenstore_client.c
index b02597a506..9a25704b91 100644
--- a/tools/xs-clients/xenstore_client.c
+++ b/tools/xs-clients/xenstore_client.c
@@ -568,13 +568,17 @@ perform(enum mode mode, int optind, int argc, char **argv, struct xs_handle *xsh
         case MODE_list: {
             unsigned int i, num;
             char **list = xs_directory(xsh, xth, argv[optind], &num);
+            const char *pref = argv[optind];
+
             if (list == NULL) {
                 warnx("could not list path %s", argv[optind]);
                 return 1;
             }
+            if (prefix && !strcmp(pref, "/"))
+                pref = "";
             for (i = 0; i < num; i++) {
                 if (prefix)
-                    output("%s/", argv[optind]);
+                    output("%s/", pref);
                 output("%s\n", list[i]);
             }
             free(list);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 17 12:22:05 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 17 Mar 2026 12:22:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1256088.1550759 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w2TQw-0006iN-Tr; Tue, 17 Mar 2026 12:22:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1256088.1550759; Tue, 17 Mar 2026 12:22:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w2TQw-0006iF-RL; Tue, 17 Mar 2026 12:22:02 +0000
Received: by outflank-mailman (input) for mailman id 1256088;
 Tue, 17 Mar 2026 12:22:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w2TQv-0006i9-Tx
 for xen-changelog@lists.xenproject.org; Tue, 17 Mar 2026 12:22:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w2TQw-00D81T-0B
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Mar 2026 12:22:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w2TQv-00Dctl-2X
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Mar 2026 12:22:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=MqsDD/C9UOup4i1kkrLMLo5TG9SuH2ibbwTJv10c+pg=; b=MLiQHN9yb1gRJCkTE5WpCgyJA6
	5bp4X01LBa2K6f6081KPc156Dtlg1vCkS9lCFwQm6F5pjvuqt+jumaIuuCnFMA2L5T1soGFStFI/N
	tSP0rmNjwso0xZWA1T8AShMGoiGzmEuLDTnUQqG0707n1t5l6UYI9kzucmFUBMvWUhjg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/p2m: issue a sync flush before freeing paging pages
Message-Id: <E1w2TQv-00Dctl-2X@xenbits.xenproject.org>
Date: Tue, 17 Mar 2026 12:22:01 +0000

commit 4bc2e5333abb37b9a67e44d7d6c712247e5e5146
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Tue Feb 17 09:33:43 2026 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 17 12:08:07 2026 +0000

    x86/p2m: issue a sync flush before freeing paging pages
    
    In the EPT implementation, the defer flushing logic is used
    unconditionally, and that would lead to paging memory being returned to the
    paging pool before its references had been flushed.
    
    Issue any pending flushes before freeing the paging memory back to the
    pool.
    
    Note AMD (NPT) and Shadow paging are not affected, as they don't implement
    the deferred flushing logic.
    
    This is XSA-480 / CVE-2026-23554
    
    Fixes: 4a59e6bb3a96 ("x86/EPT: squash meaningless TLB flush")
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/mm/p2m.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index e915da26a8..fddecdf978 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -479,6 +479,11 @@ void p2m_free_ptp(struct p2m_domain *p2m, struct page_info *pg)
     ASSERT(p2m->domain);
     ASSERT(p2m->domain->arch.paging.free_page);
 
+    /*
+     * Issue any pending flush here, in case it was deferred before.  The page
+     * will be returned to the paging pool now.
+     */
+    p2m_tlb_flush_sync(p2m);
     page_list_del(pg, &p2m->pages);
     p2m->domain->arch.paging.free_page(p2m->domain, pg);
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 17 12:22:12 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 17 Mar 2026 12:22:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1256089.1550763 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w2TR6-0006kW-VE; Tue, 17 Mar 2026 12:22:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1256089.1550763; Tue, 17 Mar 2026 12:22:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w2TR6-0006kO-Sg; Tue, 17 Mar 2026 12:22:12 +0000
Received: by outflank-mailman (input) for mailman id 1256089;
 Tue, 17 Mar 2026 12:22:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w2TR5-0006k9-Vi
 for xen-changelog@lists.xenproject.org; Tue, 17 Mar 2026 12:22:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w2TR6-00D81x-0V
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Mar 2026 12:22:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w2TR5-00DcvB-2u
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Mar 2026 12:22:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=WNkXo53ZXCpEToQjXxLpVNoAQhSi/8Xiwjsfr8kMuwA=; b=TZDtvr7sIWNyHJN8pxfTgygpFd
	I0teN5dRmMuK9ZxPwTN2hup8HutX0MzaSNlTGQDgQHbNHzkIshC31wee7zevP7mWyJUw+LuxICOxg
	rVs5LMw3jDULPB2zIeAQh8u+5/ZMq2Pjp9FEPBsNPCQevuRon9fVZAn1ivm8hfPyE7Qo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/xenstored: fix canonicalize() error testing
Message-Id: <E1w2TR5-00DcvB-2u@xenbits.xenproject.org>
Date: Tue, 17 Mar 2026 12:22:11 +0000

commit 4c61822b04aac089d1df9ab15ae3a3f6dfb4e305
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Thu Feb 12 08:29:38 2026 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 17 12:08:07 2026 +0000

    tools/xenstored: fix canonicalize() error testing
    
    The setting of errno in canonicalize() is rather fragile and seems to
    be even wrong in one corner case: when the invalid path "/local/domain/"
    is passed, sscanf() will set errno to 0, resulting in canonicalize() to
    return NULL with errno being 0. This can result in triggering the
    assert(conn->in == NULL) in consider_message().
    
    Don't assume the initial setting of errno to "EINVAL" will stay valid
    in all cases and set it to EINVAL only when returning NULL due to an
    invalid path.
    
    This is XSA-481/CVE-2026-23555
    
    Reported-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Julien Grall <julien@xen.org>
---
 tools/xenstored/core.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/xenstored/core.c b/tools/xenstored/core.c
index d509736c32..e4d2fd4876 100644
--- a/tools/xenstored/core.c
+++ b/tools/xenstored/core.c
@@ -1240,11 +1240,10 @@ const char *canonicalize(struct connection *conn, const void *ctx,
 	 * - illegal character in node
 	 * - starts with '@' but no special node allowed
 	 */
-	errno = EINVAL;
 	if (!node ||
 	    !valid_chars(node) ||
 	    (node[0] == '@' && !allow_special))
-		return NULL;
+		goto inval;
 
 	if (node[0] != '/' && node[0] != '@') {
 		name = talloc_asprintf(ctx, "%s/%s", get_implicit_path(conn),
@@ -1272,6 +1271,8 @@ const char *canonicalize(struct connection *conn, const void *ctx,
 	if (name != node)
 		talloc_free(name);
 
+ inval:
+	errno = EINVAL;
 	return NULL;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 17 12:22:24 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 17 Mar 2026 12:22:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1256090.1550767 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w2TRI-0006mg-0Q; Tue, 17 Mar 2026 12:22:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1256090.1550767; Tue, 17 Mar 2026 12:22:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w2TRH-0006mY-U8; Tue, 17 Mar 2026 12:22:23 +0000
Received: by outflank-mailman (input) for mailman id 1256090;
 Tue, 17 Mar 2026 12:22:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w2TRG-0006mQ-Ck
 for xen-changelog@lists.xenproject.org; Tue, 17 Mar 2026 12:22:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w2TRG-00D827-1p
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Mar 2026 12:22:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w2TRG-00Dcwo-11
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Mar 2026 12:22:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=A+IBD7wkOchS8Z9gV5FPDiHrWDHor1FTbXFr0uB8z9E=; b=D/pEvMfhmxbya4891I0tY4quFn
	ejaQ3oyrJZ4p6xekQ/eg9Q13NNN0CAwOtsu92e36KdNIdJzhpRlxZmfFJQkbJn5Can7Zu86Rc8POe
	7Wq5qNnOW3og8/H9WeC/gRWeJdMudDiafRKYv5dC5sxvUDKE53Y1Efhe+pcdB7DkvR+8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.21] x86/p2m: issue a sync flush before freeing paging pages
Message-Id: <E1w2TRG-00Dcwo-11@xenbits.xenproject.org>
Date: Tue, 17 Mar 2026 12:22:22 +0000

commit e5d2817d7a8a2095c792188ff101c4878982300a
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Tue Feb 17 09:33:43 2026 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 17 12:08:28 2026 +0000

    x86/p2m: issue a sync flush before freeing paging pages
    
    In the EPT implementation, the defer flushing logic is used
    unconditionally, and that would lead to paging memory being returned to the
    paging pool before its references had been flushed.
    
    Issue any pending flushes before freeing the paging memory back to the
    pool.
    
    Note AMD (NPT) and Shadow paging are not affected, as they don't implement
    the deferred flushing logic.
    
    This is XSA-480 / CVE-2026-23554
    
    Fixes: 4a59e6bb3a96 ("x86/EPT: squash meaningless TLB flush")
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    (cherry picked from commit 4bc2e5333abb37b9a67e44d7d6c712247e5e5146)
---
 xen/arch/x86/mm/p2m.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index 86d8221b84..743eb02e00 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -479,6 +479,11 @@ void p2m_free_ptp(struct p2m_domain *p2m, struct page_info *pg)
     ASSERT(p2m->domain);
     ASSERT(p2m->domain->arch.paging.free_page);
 
+    /*
+     * Issue any pending flush here, in case it was deferred before.  The page
+     * will be returned to the paging pool now.
+     */
+    p2m_tlb_flush_sync(p2m);
     page_list_del(pg, &p2m->pages);
     p2m->domain->arch.paging.free_page(p2m->domain, pg);
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.21


From xen-changelog-bounces@lists.xenproject.org Tue Mar 17 12:22:34 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 17 Mar 2026 12:22:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1256091.1550771 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w2TRS-0006ok-1t; Tue, 17 Mar 2026 12:22:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1256091.1550771; Tue, 17 Mar 2026 12:22:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w2TRR-0006oc-VU; Tue, 17 Mar 2026 12:22:33 +0000
Received: by outflank-mailman (input) for mailman id 1256091;
 Tue, 17 Mar 2026 12:22:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w2TRQ-0006oU-GC
 for xen-changelog@lists.xenproject.org; Tue, 17 Mar 2026 12:22:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w2TRQ-00D82B-2A
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Mar 2026 12:22:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w2TRQ-00Dcy1-1J
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Mar 2026 12:22:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Ofbo481NZTvjAffQcDf9sPfTTbKwGyo6bK3mGn7+iCM=; b=ZYunGG9r2BUieKdInSMPzmgAEm
	sw7RkHjBUb01s70xWf+cSSwrH0RNZ9MYZpiu9+sZMVmwWb7mg+G8+4x3xCF/k1ErS5c/XpKkyGX5a
	VND/D71s4P18e2AuhnnSzpYIjGqhqh+0D9y5y0Ukh6fLwdY2FQ00ilGlOcjwyNIatTQ0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.21] tools/xenstored: fix canonicalize() error testing
Message-Id: <E1w2TRQ-00Dcy1-1J@xenbits.xenproject.org>
Date: Tue, 17 Mar 2026 12:22:32 +0000

commit d7fc0bd1accbdc840dbe1f9d2a75c4a48bf2204b
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Thu Feb 12 08:29:38 2026 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 17 12:08:28 2026 +0000

    tools/xenstored: fix canonicalize() error testing
    
    The setting of errno in canonicalize() is rather fragile and seems to
    be even wrong in one corner case: when the invalid path "/local/domain/"
    is passed, sscanf() will set errno to 0, resulting in canonicalize() to
    return NULL with errno being 0. This can result in triggering the
    assert(conn->in == NULL) in consider_message().
    
    Don't assume the initial setting of errno to "EINVAL" will stay valid
    in all cases and set it to EINVAL only when returning NULL due to an
    invalid path.
    
    This is XSA-481/CVE-2026-23555
    
    Reported-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Julien Grall <julien@xen.org>
    (cherry picked from commit 4c61822b04aac089d1df9ab15ae3a3f6dfb4e305)
---
 tools/xenstored/core.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/xenstored/core.c b/tools/xenstored/core.c
index d509736c32..e4d2fd4876 100644
--- a/tools/xenstored/core.c
+++ b/tools/xenstored/core.c
@@ -1240,11 +1240,10 @@ const char *canonicalize(struct connection *conn, const void *ctx,
 	 * - illegal character in node
 	 * - starts with '@' but no special node allowed
 	 */
-	errno = EINVAL;
 	if (!node ||
 	    !valid_chars(node) ||
 	    (node[0] == '@' && !allow_special))
-		return NULL;
+		goto inval;
 
 	if (node[0] != '/' && node[0] != '@') {
 		name = talloc_asprintf(ctx, "%s/%s", get_implicit_path(conn),
@@ -1272,6 +1271,8 @@ const char *canonicalize(struct connection *conn, const void *ctx,
 	if (name != node)
 		talloc_free(name);
 
+ inval:
+	errno = EINVAL;
 	return NULL;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.21


From xen-changelog-bounces@lists.xenproject.org Tue Mar 17 12:22:44 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 17 Mar 2026 12:22:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1256092.1550775 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w2TRc-0006qs-35; Tue, 17 Mar 2026 12:22:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1256092.1550775; Tue, 17 Mar 2026 12:22:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w2TRc-0006qk-0W; Tue, 17 Mar 2026 12:22:44 +0000
Received: by outflank-mailman (input) for mailman id 1256092;
 Tue, 17 Mar 2026 12:22:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w2TRa-0006qc-TR
 for xen-changelog@lists.xenproject.org; Tue, 17 Mar 2026 12:22:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w2TRb-00D82I-0F
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Mar 2026 12:22:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w2TRa-00Dcz4-2g
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Mar 2026 12:22:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=WMSeZ0oE/VEGpvvf/Hb/WZNTJ9cQw9JbHTpoMAXOn6U=; b=Z7V7+2s4U3A7aRaNpQL1YIIO8E
	XmIagKwdj9oJjFwGwK3pfhClNzupA5k8SJRYYJ5HQSIzXuP2G3fa+pc0TFR2ZoCl2m9BFEOhzY4TI
	nCC3FzBechlevHrpusIPF2LAqPuwL+Gk57ul1AXb8+XOHxgZ0ekmoTGu7+vU/7pJ6Dks=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.20] x86/p2m: issue a sync flush before freeing paging pages
Message-Id: <E1w2TRa-00Dcz4-2g@xenbits.xenproject.org>
Date: Tue, 17 Mar 2026 12:22:42 +0000

commit 0138bfef5735cd1282596e89b705996f7b8cd58b
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Tue Feb 17 09:33:43 2026 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 17 12:08:33 2026 +0000

    x86/p2m: issue a sync flush before freeing paging pages
    
    In the EPT implementation, the defer flushing logic is used
    unconditionally, and that would lead to paging memory being returned to the
    paging pool before its references had been flushed.
    
    Issue any pending flushes before freeing the paging memory back to the
    pool.
    
    Note AMD (NPT) and Shadow paging are not affected, as they don't implement
    the deferred flushing logic.
    
    This is XSA-480 / CVE-2026-23554
    
    Fixes: 4a59e6bb3a96 ("x86/EPT: squash meaningless TLB flush")
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    (cherry picked from commit 4bc2e5333abb37b9a67e44d7d6c712247e5e5146)
---
 xen/arch/x86/mm/p2m.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index 8d225d2d6c..a317f67ec0 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -464,6 +464,11 @@ void p2m_free_ptp(struct p2m_domain *p2m, struct page_info *pg)
     ASSERT(p2m->domain);
     ASSERT(p2m->domain->arch.paging.free_page);
 
+    /*
+     * Issue any pending flush here, in case it was deferred before.  The page
+     * will be returned to the paging pool now.
+     */
+    p2m_tlb_flush_sync(p2m);
     page_list_del(pg, &p2m->pages);
     p2m->domain->arch.paging.free_page(p2m->domain, pg);
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.20


From xen-changelog-bounces@lists.xenproject.org Tue Mar 17 12:22:54 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 17 Mar 2026 12:22:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1256093.1550778 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w2TRm-0006su-4T; Tue, 17 Mar 2026 12:22:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1256093.1550778; Tue, 17 Mar 2026 12:22:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w2TRm-0006sm-1r; Tue, 17 Mar 2026 12:22:54 +0000
Received: by outflank-mailman (input) for mailman id 1256093;
 Tue, 17 Mar 2026 12:22:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w2TRl-0006sg-0a
 for xen-changelog@lists.xenproject.org; Tue, 17 Mar 2026 12:22:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w2TRl-00D82M-0c
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Mar 2026 12:22:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w2TRk-00Dd0E-31
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Mar 2026 12:22:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=FFPHk8/sCoa+rD+u8m5L0OJqPVZnLJBt0AxOz9PTysE=; b=RRjI7edg2tsvHQMlhPcPLlnKfe
	RZPPnXHXynbkb8Uruq8ukR4HFVMmaCh3DCxIPSw+9gB1BMlXNujloZSAegvwMV5nKw+x6B0CJgu+T
	hotuH/LH+GQoMIuPzxb8YsKWq70g1LDxOCGRvbtICcJJ20Tc1dt6xoGc2uef50ThKun0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.20] tools/xenstored: fix canonicalize() error testing
Message-Id: <E1w2TRk-00Dd0E-31@xenbits.xenproject.org>
Date: Tue, 17 Mar 2026 12:22:52 +0000

commit e046cf1b059586838d36440492dec06d39c088f2
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Thu Feb 12 08:29:38 2026 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 17 12:08:33 2026 +0000

    tools/xenstored: fix canonicalize() error testing
    
    The setting of errno in canonicalize() is rather fragile and seems to
    be even wrong in one corner case: when the invalid path "/local/domain/"
    is passed, sscanf() will set errno to 0, resulting in canonicalize() to
    return NULL with errno being 0. This can result in triggering the
    assert(conn->in == NULL) in consider_message().
    
    Don't assume the initial setting of errno to "EINVAL" will stay valid
    in all cases and set it to EINVAL only when returning NULL due to an
    invalid path.
    
    This is XSA-481/CVE-2026-23555
    
    Reported-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Julien Grall <julien@xen.org>
    (cherry picked from commit 4c61822b04aac089d1df9ab15ae3a3f6dfb4e305)
---
 tools/xenstored/core.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/xenstored/core.c b/tools/xenstored/core.c
index bada1ad9a2..64baec268b 100644
--- a/tools/xenstored/core.c
+++ b/tools/xenstored/core.c
@@ -1242,11 +1242,10 @@ const char *canonicalize(struct connection *conn, const void *ctx,
 	 * - illegal character in node
 	 * - starts with '@' but no special node allowed
 	 */
-	errno = EINVAL;
 	if (!node ||
 	    !valid_chars(node) ||
 	    (node[0] == '@' && !allow_special))
-		return NULL;
+		goto inval;
 
 	if (node[0] != '/' && node[0] != '@') {
 		name = talloc_asprintf(ctx, "%s/%s", get_implicit_path(conn),
@@ -1274,6 +1273,8 @@ const char *canonicalize(struct connection *conn, const void *ctx,
 	if (name != node)
 		talloc_free(name);
 
+ inval:
+	errno = EINVAL;
 	return NULL;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.20


From xen-changelog-bounces@lists.xenproject.org Tue Mar 17 12:23:04 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 17 Mar 2026 12:23:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1256094.1550783 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w2TRw-0006uy-5r; Tue, 17 Mar 2026 12:23:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1256094.1550783; Tue, 17 Mar 2026 12:23:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w2TRw-0006uq-3C; Tue, 17 Mar 2026 12:23:04 +0000
Received: by outflank-mailman (input) for mailman id 1256094;
 Tue, 17 Mar 2026 12:23:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w2TRv-0006ui-Cy
 for xen-changelog@lists.xenproject.org; Tue, 17 Mar 2026 12:23:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w2TRv-00D82k-1s
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Mar 2026 12:23:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w2TRv-00Dd1W-17
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Mar 2026 12:23:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=RnDJyARYUK2H8rCh44nIf1GXeYj9tO68IPkqy2SCxas=; b=fps75jCZBIA5MajOxzaooSfSlC
	Iv7IjpqGfbnwj334g/E9UEZqoYs7vZ2MoRW3Qy41J3Hd4T+y2eOS3xIZWfUtuG8LzqW8SCyezgyV1
	V7n9EASirknVF/1J3phIji680YSXxGMuz4IT7zsZGVwZi7mSlJ8yNJdko+CPn7JgGT5Y=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] x86/p2m: issue a sync flush before freeing paging pages
Message-Id: <E1w2TRv-00Dd1W-17@xenbits.xenproject.org>
Date: Tue, 17 Mar 2026 12:23:03 +0000

commit b4993d7f97699457aae5262d1450c8be573e3daf
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Tue Feb 17 09:33:43 2026 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 17 12:08:41 2026 +0000

    x86/p2m: issue a sync flush before freeing paging pages
    
    In the EPT implementation, the defer flushing logic is used
    unconditionally, and that would lead to paging memory being returned to the
    paging pool before its references had been flushed.
    
    Issue any pending flushes before freeing the paging memory back to the
    pool.
    
    Note AMD (NPT) and Shadow paging are not affected, as they don't implement
    the deferred flushing logic.
    
    This is XSA-480 / CVE-2026-23554
    
    Fixes: 4a59e6bb3a96 ("x86/EPT: squash meaningless TLB flush")
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    (cherry picked from commit 4bc2e5333abb37b9a67e44d7d6c712247e5e5146)
---
 xen/arch/x86/mm/p2m.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index 8d225d2d6c..a317f67ec0 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -464,6 +464,11 @@ void p2m_free_ptp(struct p2m_domain *p2m, struct page_info *pg)
     ASSERT(p2m->domain);
     ASSERT(p2m->domain->arch.paging.free_page);
 
+    /*
+     * Issue any pending flush here, in case it was deferred before.  The page
+     * will be returned to the paging pool now.
+     */
+    p2m_tlb_flush_sync(p2m);
     page_list_del(pg, &p2m->pages);
     p2m->domain->arch.paging.free_page(p2m->domain, pg);
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Tue Mar 17 12:23:15 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 17 Mar 2026 12:23:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1256095.1550786 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w2TS7-0006xK-7V; Tue, 17 Mar 2026 12:23:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1256095.1550786; Tue, 17 Mar 2026 12:23:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w2TS7-0006xC-4h; Tue, 17 Mar 2026 12:23:15 +0000
Received: by outflank-mailman (input) for mailman id 1256095;
 Tue, 17 Mar 2026 12:23:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w2TS5-0006x5-GN
 for xen-changelog@lists.xenproject.org; Tue, 17 Mar 2026 12:23:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w2TS5-00D834-2E
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Mar 2026 12:23:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w2TS5-00Dd21-1N
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Mar 2026 12:23:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=2EVcn1ZxPoqFMpPxGvHbbP5nDDCcQQPjlJvv/RKG+n0=; b=xep/PIyWaEg/Q25NuxwDl8Ny46
	L7wQqmnKeLqYhK5eTX0BININLOKNupMl87CY8wA36ydr1n1eL0u2RpCatik17leC0k5JnxPHq9dD4
	lMVp6y1NyKIKhrSP3pEyBQM0WGMKNKzuu8yXTow5DDoISkV8EGxMp28zqwHwPQv2nI8k=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] tools/xenstored: fix canonicalize() error testing
Message-Id: <E1w2TS5-00Dd21-1N@xenbits.xenproject.org>
Date: Tue, 17 Mar 2026 12:23:13 +0000

commit 7e16c850cd6c91a9490d528146a09d405e1ac0c3
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Thu Feb 12 08:29:38 2026 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 17 12:08:41 2026 +0000

    tools/xenstored: fix canonicalize() error testing
    
    The setting of errno in canonicalize() is rather fragile and seems to
    be even wrong in one corner case: when the invalid path "/local/domain/"
    is passed, sscanf() will set errno to 0, resulting in canonicalize() to
    return NULL with errno being 0. This can result in triggering the
    assert(conn->in == NULL) in consider_message().
    
    Don't assume the initial setting of errno to "EINVAL" will stay valid
    in all cases and set it to EINVAL only when returning NULL due to an
    invalid path.
    
    This is XSA-481/CVE-2026-23555
    
    Reported-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Julien Grall <julien@xen.org>
    (cherry picked from commit 4c61822b04aac089d1df9ab15ae3a3f6dfb4e305)
---
 tools/xenstored/core.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/xenstored/core.c b/tools/xenstored/core.c
index bada1ad9a2..64baec268b 100644
--- a/tools/xenstored/core.c
+++ b/tools/xenstored/core.c
@@ -1242,11 +1242,10 @@ const char *canonicalize(struct connection *conn, const void *ctx,
 	 * - illegal character in node
 	 * - starts with '@' but no special node allowed
 	 */
-	errno = EINVAL;
 	if (!node ||
 	    !valid_chars(node) ||
 	    (node[0] == '@' && !allow_special))
-		return NULL;
+		goto inval;
 
 	if (node[0] != '/' && node[0] != '@') {
 		name = talloc_asprintf(ctx, "%s/%s", get_implicit_path(conn),
@@ -1274,6 +1273,8 @@ const char *canonicalize(struct connection *conn, const void *ctx,
 	if (name != node)
 		talloc_free(name);
 
+ inval:
+	errno = EINVAL;
 	return NULL;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Tue Mar 17 12:23:25 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 17 Mar 2026 12:23:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1256096.1550791 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w2TSH-0006zo-A8; Tue, 17 Mar 2026 12:23:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1256096.1550791; Tue, 17 Mar 2026 12:23:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w2TSH-0006zg-7R; Tue, 17 Mar 2026 12:23:25 +0000
Received: by outflank-mailman (input) for mailman id 1256096;
 Tue, 17 Mar 2026 12:23:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w2TSF-0006za-U8
 for xen-changelog@lists.xenproject.org; Tue, 17 Mar 2026 12:23:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w2TSG-00D83B-0N
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Mar 2026 12:23:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w2TSF-00Dd41-2o
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Mar 2026 12:23:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=AdO7JLRdPOgiBm5P2qA/eTHUPMkPSqdIlsvGsSkfaHo=; b=pSwodQCg3SGRH69OsbjiFwmGS1
	gFBX+tW0HMghTOz661Iwv6lFPdXZuq349mkjPXc/6XMtH3/IOc5k54M9/TGEIZ6s0h6J//rKeb26L
	XmLfycbTv7fM1WjrYOrNb0cz9+GBpIPyOnt3KXHz5bWtTG5RAjj5+7O5tbs/bJo8X2XA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] x86/p2m: issue a sync flush before freeing paging pages
Message-Id: <E1w2TSF-00Dd41-2o@xenbits.xenproject.org>
Date: Tue, 17 Mar 2026 12:23:23 +0000

commit 8b8c324af669f1a350f0d6b6f84619d39b99d653
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Tue Feb 17 09:33:43 2026 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 17 12:11:44 2026 +0000

    x86/p2m: issue a sync flush before freeing paging pages
    
    In the EPT implementation, the defer flushing logic is used
    unconditionally, and that would lead to paging memory being returned to the
    paging pool before its references had been flushed.
    
    Issue any pending flushes before freeing the paging memory back to the
    pool.
    
    Note AMD (NPT) and Shadow paging are not affected, as they don't implement
    the deferred flushing logic.
    
    This is XSA-480 / CVE-2026-23554
    
    Fixes: 4a59e6bb3a96 ("x86/EPT: squash meaningless TLB flush")
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    (cherry picked from commit 4bc2e5333abb37b9a67e44d7d6c712247e5e5146)
---
 xen/arch/x86/mm/p2m.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index ae37e1ec78..8197e9ad45 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -457,6 +457,11 @@ void p2m_free_ptp(struct p2m_domain *p2m, struct page_info *pg)
     ASSERT(p2m->domain);
     ASSERT(p2m->domain->arch.paging.free_page);
 
+    /*
+     * Issue any pending flush here, in case it was deferred before.  The page
+     * will be returned to the paging pool now.
+     */
+    p2m_tlb_flush_sync(p2m);
     page_list_del(pg, &p2m->pages);
     p2m->domain->arch.paging.free_page(p2m->domain, pg);
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Tue Mar 17 12:23:35 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 17 Mar 2026 12:23:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1256097.1550794 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w2TSR-00071v-BK; Tue, 17 Mar 2026 12:23:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1256097.1550794; Tue, 17 Mar 2026 12:23:35 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w2TSR-00071n-8m; Tue, 17 Mar 2026 12:23:35 +0000
Received: by outflank-mailman (input) for mailman id 1256097;
 Tue, 17 Mar 2026 12:23:34 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w2TSQ-00071h-14
 for xen-changelog@lists.xenproject.org; Tue, 17 Mar 2026 12:23:34 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w2TSQ-00D83F-0h
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Mar 2026 12:23:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w2TSP-00Dd58-37
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Mar 2026 12:23:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=IqH6wwZvt77n2OwOl0wZiIcSImAmMwgLgKAoRzMagIk=; b=fKcr3j3AzSAm2TceHTULpS7a/i
	456I4cousPmKc2AVmI/OQax7ay7NVCtHfxDGrOihW50tVgNUS+B1jFDzG69oUCbqDQIqNdIVVBs7y
	SbwBh8TQosKzrRS+hhfVj+K4P0wi2bFoH2z7rbVWnlr/VKTdLml7jPZRQdL9ypgXQOyc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] tools/xenstored: fix canonicalize() error testing
Message-Id: <E1w2TSP-00Dd58-37@xenbits.xenproject.org>
Date: Tue, 17 Mar 2026 12:23:33 +0000

commit 2c5f7fd78ba894c6a2fd3bfc2d164cc792db8f42
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Thu Feb 12 08:29:38 2026 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 17 12:11:44 2026 +0000

    tools/xenstored: fix canonicalize() error testing
    
    The setting of errno in canonicalize() is rather fragile and seems to
    be even wrong in one corner case: when the invalid path "/local/domain/"
    is passed, sscanf() will set errno to 0, resulting in canonicalize() to
    return NULL with errno being 0. This can result in triggering the
    assert(conn->in == NULL) in consider_message().
    
    Don't assume the initial setting of errno to "EINVAL" will stay valid
    in all cases and set it to EINVAL only when returning NULL due to an
    invalid path.
    
    This is XSA-481/CVE-2026-23555
    
    Reported-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Julien Grall <julien@xen.org>
    (cherry picked from commit 4c61822b04aac089d1df9ab15ae3a3f6dfb4e305)
---
 tools/xenstored/core.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/xenstored/core.c b/tools/xenstored/core.c
index dfe98e7bfc..e8a0e3830b 100644
--- a/tools/xenstored/core.c
+++ b/tools/xenstored/core.c
@@ -1262,11 +1262,10 @@ const char *canonicalize(struct connection *conn, const void *ctx,
 	 * - illegal character in node
 	 * - starts with '@' but no special node allowed
 	 */
-	errno = EINVAL;
 	if (!node ||
 	    !valid_chars(node) ||
 	    (node[0] == '@' && !allow_special))
-		return NULL;
+		goto inval;
 
 	if (node[0] != '/' && node[0] != '@') {
 		name = talloc_asprintf(ctx, "%s/%s", get_implicit_path(conn),
@@ -1294,6 +1293,8 @@ const char *canonicalize(struct connection *conn, const void *ctx,
 	if (name != node)
 		talloc_free(name);
 
+ inval:
+	errno = EINVAL;
 	return NULL;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Tue Mar 17 12:23:45 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 17 Mar 2026 12:23:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1256098.1550798 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w2TSb-00073z-Cp; Tue, 17 Mar 2026 12:23:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1256098.1550798; Tue, 17 Mar 2026 12:23:45 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w2TSb-00073r-AB; Tue, 17 Mar 2026 12:23:45 +0000
Received: by outflank-mailman (input) for mailman id 1256098;
 Tue, 17 Mar 2026 12:23:44 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w2TSa-00073j-9H
 for xen-changelog@lists.xenproject.org; Tue, 17 Mar 2026 12:23:44 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w2TSa-00D83J-1W
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Mar 2026 12:23:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w2TSa-00Dd6q-0k
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Mar 2026 12:23:44 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=/jsycklq8lHpWBB3d1s8al57KDGifdbmgX1U8kNnJh8=; b=KItIXlmAvNncdbYMoAyrVbf3g/
	wcgT69HvJbzSQr9w5movMaIOhTz6qbXvtxSnAf/GrjtAQmvIOlU+/Y2aeBi27MGFWyTK+5v43a18m
	YSzLNQR3GF7Ty2vBDJiCCigXYnyqriDJl1awWrXVZ+qsLDZJ6tezbrTkU9v6/cDu0pEg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.17] x86/p2m: issue a sync flush before freeing paging pages
Message-Id: <E1w2TSa-00Dd6q-0k@xenbits.xenproject.org>
Date: Tue, 17 Mar 2026 12:23:44 +0000

commit ca4c5d8b4cb69fb985d7d175e8cecec3ebae9686
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Tue Feb 17 09:33:43 2026 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 17 12:09:55 2026 +0000

    x86/p2m: issue a sync flush before freeing paging pages
    
    In the EPT implementation, the defer flushing logic is used
    unconditionally, and that would lead to paging memory being returned to the
    paging pool before its references had been flushed.
    
    Issue any pending flushes before freeing the paging memory back to the
    pool.
    
    Note AMD (NPT) and Shadow paging are not affected, as they don't implement
    the deferred flushing logic.
    
    This is XSA-480 / CVE-2026-23554
    
    Fixes: 4a59e6bb3a96 ("x86/EPT: squash meaningless TLB flush")
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    (cherry picked from commit 4bc2e5333abb37b9a67e44d7d6c712247e5e5146)
---
 xen/arch/x86/mm/p2m.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index 5014caa173..6412d83367 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -459,6 +459,11 @@ void p2m_free_ptp(struct p2m_domain *p2m, struct page_info *pg)
     ASSERT(p2m->domain);
     ASSERT(p2m->domain->arch.paging.free_page);
 
+    /*
+     * Issue any pending flush here, in case it was deferred before.  The page
+     * will be returned to the paging pool now.
+     */
+    p2m_tlb_flush_sync(p2m);
     page_list_del(pg, &p2m->pages);
     p2m->domain->arch.paging.free_page(p2m->domain, pg);
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.17


From xen-changelog-bounces@lists.xenproject.org Tue Mar 17 13:11:10 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 17 Mar 2026 13:11:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1256111.1550812 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w2UCM-0004ty-R9; Tue, 17 Mar 2026 13:11:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1256111.1550812; Tue, 17 Mar 2026 13:11:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w2UCM-0004tp-OS; Tue, 17 Mar 2026 13:11:02 +0000
Received: by outflank-mailman (input) for mailman id 1256111;
 Tue, 17 Mar 2026 13:11:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w2UCL-0004tj-EN
 for xen-changelog@lists.xenproject.org; Tue, 17 Mar 2026 13:11:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w2UCL-00D8yO-1q
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Mar 2026 13:11:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w2UCL-00DhFo-11
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Mar 2026 13:11:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=F+pN9v/dtFuyu4P6ZcPsVPs1b/NlSsn90PqzF4nzsZ4=; b=w/dWT085UT86HksLKBd+1+8PKQ
	zpbJlHqE2X3V+ZkvaiPqMf/+35HDxGvd2Tkq6mb+yJa3l9U28BE0/5CUPzLlr4388g0LOLxeNtzYv
	n4KiVTQtoSh9JNiMzybmHvgiJCoQDTVoZwoKpGUN4AyEfKIJjUdIYaiKBFhUiX5YCoAE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] x86/p2m: issue a sync flush before freeing paging pages
Message-Id: <E1w2UCL-00DhFo-11@xenbits.xenproject.org>
Date: Tue, 17 Mar 2026 13:11:01 +0000

commit ca4c5d8b4cb69fb985d7d175e8cecec3ebae9686
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Tue Feb 17 09:33:43 2026 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 17 12:09:55 2026 +0000

    x86/p2m: issue a sync flush before freeing paging pages
    
    In the EPT implementation, the defer flushing logic is used
    unconditionally, and that would lead to paging memory being returned to the
    paging pool before its references had been flushed.
    
    Issue any pending flushes before freeing the paging memory back to the
    pool.
    
    Note AMD (NPT) and Shadow paging are not affected, as they don't implement
    the deferred flushing logic.
    
    This is XSA-480 / CVE-2026-23554
    
    Fixes: 4a59e6bb3a96 ("x86/EPT: squash meaningless TLB flush")
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    (cherry picked from commit 4bc2e5333abb37b9a67e44d7d6c712247e5e5146)
---
 xen/arch/x86/mm/p2m.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index 5014caa173..6412d83367 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -459,6 +459,11 @@ void p2m_free_ptp(struct p2m_domain *p2m, struct page_info *pg)
     ASSERT(p2m->domain);
     ASSERT(p2m->domain->arch.paging.free_page);
 
+    /*
+     * Issue any pending flush here, in case it was deferred before.  The page
+     * will be returned to the paging pool now.
+     */
+    p2m_tlb_flush_sync(p2m);
     page_list_del(pg, &p2m->pages);
     p2m->domain->arch.paging.free_page(p2m->domain, pg);
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Tue Mar 17 14:11:06 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 17 Mar 2026 14:11:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1256143.1550842 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w2V8R-0005Eq-Ko; Tue, 17 Mar 2026 14:11:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1256143.1550842; Tue, 17 Mar 2026 14:11:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w2V8R-0005Eg-I9; Tue, 17 Mar 2026 14:11:03 +0000
Received: by outflank-mailman (input) for mailman id 1256143;
 Tue, 17 Mar 2026 14:11:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w2V8P-0005Ea-S0
 for xen-changelog@lists.xenproject.org; Tue, 17 Mar 2026 14:11:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w2V8P-00DAPi-39
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Mar 2026 14:11:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w2V8P-00DkVz-2B
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Mar 2026 14:11:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Jz/XmmIR7C0lXzw5n/kbuAr0XIAfR5KS6doCWuVL6A8=; b=ffDUvfGOu9se9BQj54I4knQ0Gh
	ikLqKqRcSYrEQBbE6NH7vAUATSjR5NeA6VdhdfkqyOTYAJSacw+FmMwoO4dbtBJkuYtTGVSYzyPXN
	b1QAJcmfwkDBTLsfdkLfhIEInf+0Qopy9rZWenKCCr7d8F04S+jHgbIs+VJEkUWAWlOI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.21] x86/p2m: issue a sync flush before freeing paging pages
Message-Id: <E1w2V8P-00DkVz-2B@xenbits.xenproject.org>
Date: Tue, 17 Mar 2026 14:11:01 +0000

commit e5d2817d7a8a2095c792188ff101c4878982300a
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Tue Feb 17 09:33:43 2026 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 17 12:08:28 2026 +0000

    x86/p2m: issue a sync flush before freeing paging pages
    
    In the EPT implementation, the defer flushing logic is used
    unconditionally, and that would lead to paging memory being returned to the
    paging pool before its references had been flushed.
    
    Issue any pending flushes before freeing the paging memory back to the
    pool.
    
    Note AMD (NPT) and Shadow paging are not affected, as they don't implement
    the deferred flushing logic.
    
    This is XSA-480 / CVE-2026-23554
    
    Fixes: 4a59e6bb3a96 ("x86/EPT: squash meaningless TLB flush")
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    (cherry picked from commit 4bc2e5333abb37b9a67e44d7d6c712247e5e5146)
---
 xen/arch/x86/mm/p2m.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index 86d8221b84..743eb02e00 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -479,6 +479,11 @@ void p2m_free_ptp(struct p2m_domain *p2m, struct page_info *pg)
     ASSERT(p2m->domain);
     ASSERT(p2m->domain->arch.paging.free_page);
 
+    /*
+     * Issue any pending flush here, in case it was deferred before.  The page
+     * will be returned to the paging pool now.
+     */
+    p2m_tlb_flush_sync(p2m);
     page_list_del(pg, &p2m->pages);
     p2m->domain->arch.paging.free_page(p2m->domain, pg);
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.21


From xen-changelog-bounces@lists.xenproject.org Tue Mar 17 14:11:19 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 17 Mar 2026 14:11:19 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1256144.1550848 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w2V8b-0005H7-Mc; Tue, 17 Mar 2026 14:11:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1256144.1550848; Tue, 17 Mar 2026 14:11:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w2V8b-0005Gy-JU; Tue, 17 Mar 2026 14:11:13 +0000
Received: by outflank-mailman (input) for mailman id 1256144;
 Tue, 17 Mar 2026 14:11:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w2V8Z-0005Gi-So
 for xen-changelog@lists.xenproject.org; Tue, 17 Mar 2026 14:11:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w2V8a-00DAQD-0C
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Mar 2026 14:11:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w2V8Z-00DkWR-2e
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Mar 2026 14:11:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=4DW23gh/XGCO4mxDuYlC8uof3gpnTon+qjyDCukQwU4=; b=4Kh2L9V1DJhrsG+70hP4J4lUjx
	J2LU1WKA9BglbyxrMP5C6COZjItnJ3foTt25CYZQ9FVLCTtdTtafLq3jLS4vTSYlZfYrRPMEv4xkA
	sYF4g2EVEJwb2MJGCEHMAY8e5ps3EwZFrgh9KV7CaZtgGCo6L60HvQ/gAY9MlmE8zpkI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.21] tools/xenstored: fix canonicalize() error testing
Message-Id: <E1w2V8Z-00DkWR-2e@xenbits.xenproject.org>
Date: Tue, 17 Mar 2026 14:11:11 +0000

commit d7fc0bd1accbdc840dbe1f9d2a75c4a48bf2204b
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Thu Feb 12 08:29:38 2026 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 17 12:08:28 2026 +0000

    tools/xenstored: fix canonicalize() error testing
    
    The setting of errno in canonicalize() is rather fragile and seems to
    be even wrong in one corner case: when the invalid path "/local/domain/"
    is passed, sscanf() will set errno to 0, resulting in canonicalize() to
    return NULL with errno being 0. This can result in triggering the
    assert(conn->in == NULL) in consider_message().
    
    Don't assume the initial setting of errno to "EINVAL" will stay valid
    in all cases and set it to EINVAL only when returning NULL due to an
    invalid path.
    
    This is XSA-481/CVE-2026-23555
    
    Reported-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Julien Grall <julien@xen.org>
    (cherry picked from commit 4c61822b04aac089d1df9ab15ae3a3f6dfb4e305)
---
 tools/xenstored/core.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/xenstored/core.c b/tools/xenstored/core.c
index d509736c32..e4d2fd4876 100644
--- a/tools/xenstored/core.c
+++ b/tools/xenstored/core.c
@@ -1240,11 +1240,10 @@ const char *canonicalize(struct connection *conn, const void *ctx,
 	 * - illegal character in node
 	 * - starts with '@' but no special node allowed
 	 */
-	errno = EINVAL;
 	if (!node ||
 	    !valid_chars(node) ||
 	    (node[0] == '@' && !allow_special))
-		return NULL;
+		goto inval;
 
 	if (node[0] != '/' && node[0] != '@') {
 		name = talloc_asprintf(ctx, "%s/%s", get_implicit_path(conn),
@@ -1272,6 +1271,8 @@ const char *canonicalize(struct connection *conn, const void *ctx,
 	if (name != node)
 		talloc_free(name);
 
+ inval:
+	errno = EINVAL;
 	return NULL;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.21


From xen-changelog-bounces@lists.xenproject.org Tue Mar 17 15:00:07 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 17 Mar 2026 15:00:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1256170.1550872 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w2Vts-0003Zn-8U; Tue, 17 Mar 2026 15:00:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1256170.1550872; Tue, 17 Mar 2026 15:00:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w2Vts-0003Zf-5m; Tue, 17 Mar 2026 15:00:04 +0000
Received: by outflank-mailman (input) for mailman id 1256170;
 Tue, 17 Mar 2026 15:00:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w2Vtq-0003Cd-BR
 for xen-changelog@lists.xenproject.org; Tue, 17 Mar 2026 15:00:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w2Vtq-00DBJY-1X
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Mar 2026 15:00:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w2Vtq-00DnEu-0f
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Mar 2026 15:00:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=WdpB5/Kt/xZh6LH8WX9ChcMmkcQRHcyrTw+9oyRgFWg=; b=W2tRX8Xto2ke3JWh1dC7LUsHfT
	EkW0pC/uNr2xxevBEOS3NzsEcGmkq/iUx6eg5h0NNXCsF4Z8kNtn9aSbV12WFr5LgYbslPvcTt7MD
	eiw8dFWDGQ5acTiVA7csoNpIDANrhMoKR20iBWR0FWiQH2Bodf1K5HxrlTWto51ADST4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.20] x86/p2m: issue a sync flush before freeing paging pages
Message-Id: <E1w2Vtq-00DnEu-0f@xenbits.xenproject.org>
Date: Tue, 17 Mar 2026 15:00:02 +0000

commit 0138bfef5735cd1282596e89b705996f7b8cd58b
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Tue Feb 17 09:33:43 2026 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 17 12:08:33 2026 +0000

    x86/p2m: issue a sync flush before freeing paging pages
    
    In the EPT implementation, the defer flushing logic is used
    unconditionally, and that would lead to paging memory being returned to the
    paging pool before its references had been flushed.
    
    Issue any pending flushes before freeing the paging memory back to the
    pool.
    
    Note AMD (NPT) and Shadow paging are not affected, as they don't implement
    the deferred flushing logic.
    
    This is XSA-480 / CVE-2026-23554
    
    Fixes: 4a59e6bb3a96 ("x86/EPT: squash meaningless TLB flush")
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    (cherry picked from commit 4bc2e5333abb37b9a67e44d7d6c712247e5e5146)
---
 xen/arch/x86/mm/p2m.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index 8d225d2d6c..a317f67ec0 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -464,6 +464,11 @@ void p2m_free_ptp(struct p2m_domain *p2m, struct page_info *pg)
     ASSERT(p2m->domain);
     ASSERT(p2m->domain->arch.paging.free_page);
 
+    /*
+     * Issue any pending flush here, in case it was deferred before.  The page
+     * will be returned to the paging pool now.
+     */
+    p2m_tlb_flush_sync(p2m);
     page_list_del(pg, &p2m->pages);
     p2m->domain->arch.paging.free_page(p2m->domain, pg);
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.20


From xen-changelog-bounces@lists.xenproject.org Tue Mar 17 15:00:14 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 17 Mar 2026 15:00:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1256171.1550876 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w2Vu2-0003wi-AA; Tue, 17 Mar 2026 15:00:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1256171.1550876; Tue, 17 Mar 2026 15:00:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w2Vu2-0003wa-79; Tue, 17 Mar 2026 15:00:14 +0000
Received: by outflank-mailman (input) for mailman id 1256171;
 Tue, 17 Mar 2026 15:00:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w2Vu0-0003wM-CO
 for xen-changelog@lists.xenproject.org; Tue, 17 Mar 2026 15:00:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w2Vu0-00DBJv-1p
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Mar 2026 15:00:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w2Vu0-00DnGE-12
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Mar 2026 15:00:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=RDhX+5OMAjmd0i2yVYbZlltV6x9+sFSjZhvCKcXwRZg=; b=OwrvtbGNHJWwMHQdmKP2VPODl/
	SWAUKcfSrLnFREjM8v5jJzZTHipvGZ/x1gM77PPuqtcvuqZWXXG5W0A3TXVehvcYH9rA19vcjg4cd
	hYXcerii3Xkq6zuL89FtnTGHAWpoSzbyjAsIrfW/LcRn3+0xc/4Y0Kf6tM/8lq7PQI6I=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.20] tools/xenstored: fix canonicalize() error testing
Message-Id: <E1w2Vu0-00DnGE-12@xenbits.xenproject.org>
Date: Tue, 17 Mar 2026 15:00:12 +0000

commit e046cf1b059586838d36440492dec06d39c088f2
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Thu Feb 12 08:29:38 2026 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 17 12:08:33 2026 +0000

    tools/xenstored: fix canonicalize() error testing
    
    The setting of errno in canonicalize() is rather fragile and seems to
    be even wrong in one corner case: when the invalid path "/local/domain/"
    is passed, sscanf() will set errno to 0, resulting in canonicalize() to
    return NULL with errno being 0. This can result in triggering the
    assert(conn->in == NULL) in consider_message().
    
    Don't assume the initial setting of errno to "EINVAL" will stay valid
    in all cases and set it to EINVAL only when returning NULL due to an
    invalid path.
    
    This is XSA-481/CVE-2026-23555
    
    Reported-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Julien Grall <julien@xen.org>
    (cherry picked from commit 4c61822b04aac089d1df9ab15ae3a3f6dfb4e305)
---
 tools/xenstored/core.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/xenstored/core.c b/tools/xenstored/core.c
index bada1ad9a2..64baec268b 100644
--- a/tools/xenstored/core.c
+++ b/tools/xenstored/core.c
@@ -1242,11 +1242,10 @@ const char *canonicalize(struct connection *conn, const void *ctx,
 	 * - illegal character in node
 	 * - starts with '@' but no special node allowed
 	 */
-	errno = EINVAL;
 	if (!node ||
 	    !valid_chars(node) ||
 	    (node[0] == '@' && !allow_special))
-		return NULL;
+		goto inval;
 
 	if (node[0] != '/' && node[0] != '@') {
 		name = talloc_asprintf(ctx, "%s/%s", get_implicit_path(conn),
@@ -1274,6 +1273,8 @@ const char *canonicalize(struct connection *conn, const void *ctx,
 	if (name != node)
 		talloc_free(name);
 
+ inval:
+	errno = EINVAL;
 	return NULL;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.20


From xen-changelog-bounces@lists.xenproject.org Tue Mar 17 15:55:08 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 17 Mar 2026 15:55:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1256188.1550888 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w2Wl5-0001p4-8J; Tue, 17 Mar 2026 15:55:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1256188.1550888; Tue, 17 Mar 2026 15:55:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w2Wl5-0001ox-5n; Tue, 17 Mar 2026 15:55:03 +0000
Received: by outflank-mailman (input) for mailman id 1256188;
 Tue, 17 Mar 2026 15:55:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w2Wl4-0001or-8T
 for xen-changelog@lists.xenproject.org; Tue, 17 Mar 2026 15:55:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w2Wl4-00DCRA-1K
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Mar 2026 15:55:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w2Wl4-00Dqmu-0S
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Mar 2026 15:55:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=dzUVOgeFyVyc0VtOfV8GAK8rbTvtq52by3e3rcsZMjk=; b=0fmQR4MSQwuFMDuzK9uGMqBtu4
	gRhzJEJg/qpx5eDYFXwoTUCccLLH1b20DWzK55vj/Myi0VoHOG+hFo2/GFS5/1EPolGg0GOiY2uoe
	lLVXVHxDASmmRILpUDKw2dz+c3bP+2UFUfeQsMKiFSTwwRNS/r3o72KyyBpERFSXD+zo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] x86/p2m: issue a sync flush before freeing paging pages
Message-Id: <E1w2Wl4-00Dqmu-0S@xenbits.xenproject.org>
Date: Tue, 17 Mar 2026 15:55:02 +0000

commit b4993d7f97699457aae5262d1450c8be573e3daf
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Tue Feb 17 09:33:43 2026 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 17 12:08:41 2026 +0000

    x86/p2m: issue a sync flush before freeing paging pages
    
    In the EPT implementation, the defer flushing logic is used
    unconditionally, and that would lead to paging memory being returned to the
    paging pool before its references had been flushed.
    
    Issue any pending flushes before freeing the paging memory back to the
    pool.
    
    Note AMD (NPT) and Shadow paging are not affected, as they don't implement
    the deferred flushing logic.
    
    This is XSA-480 / CVE-2026-23554
    
    Fixes: 4a59e6bb3a96 ("x86/EPT: squash meaningless TLB flush")
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    (cherry picked from commit 4bc2e5333abb37b9a67e44d7d6c712247e5e5146)
---
 xen/arch/x86/mm/p2m.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index 8d225d2d6c..a317f67ec0 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -464,6 +464,11 @@ void p2m_free_ptp(struct p2m_domain *p2m, struct page_info *pg)
     ASSERT(p2m->domain);
     ASSERT(p2m->domain->arch.paging.free_page);
 
+    /*
+     * Issue any pending flush here, in case it was deferred before.  The page
+     * will be returned to the paging pool now.
+     */
+    p2m_tlb_flush_sync(p2m);
     page_list_del(pg, &p2m->pages);
     p2m->domain->arch.paging.free_page(p2m->domain, pg);
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Tue Mar 17 15:55:13 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 17 Mar 2026 15:55:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1256189.1550893 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w2WlF-0001r5-9k; Tue, 17 Mar 2026 15:55:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1256189.1550893; Tue, 17 Mar 2026 15:55:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w2WlF-0001qy-78; Tue, 17 Mar 2026 15:55:13 +0000
Received: by outflank-mailman (input) for mailman id 1256189;
 Tue, 17 Mar 2026 15:55:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w2WlE-0001qk-AN
 for xen-changelog@lists.xenproject.org; Tue, 17 Mar 2026 15:55:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w2WlE-00DCRY-1c
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Mar 2026 15:55:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w2WlE-00DqnG-0p
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Mar 2026 15:55:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ykKZhUmZEeHlOSLsNv4+UDseVXMqgbrMvggl2PjLfqk=; b=pcCFVOVoKVI+BaUYAvn9yQm/06
	aItnO9c7o/0FK735LH746Y3RLENKYBoM0ttu4iFQowgRH2T37z9judMaDQRGnkxNLQ947wKPqwAnX
	OO1zDZSwJMQ2YAX+O3f0tmhJZ9Ad6QFrFScYejoDMWEA7mCT6/Y2/MIDUH4SpPqCLex8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] tools/xenstored: fix canonicalize() error testing
Message-Id: <E1w2WlE-00DqnG-0p@xenbits.xenproject.org>
Date: Tue, 17 Mar 2026 15:55:12 +0000

commit 7e16c850cd6c91a9490d528146a09d405e1ac0c3
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Thu Feb 12 08:29:38 2026 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 17 12:08:41 2026 +0000

    tools/xenstored: fix canonicalize() error testing
    
    The setting of errno in canonicalize() is rather fragile and seems to
    be even wrong in one corner case: when the invalid path "/local/domain/"
    is passed, sscanf() will set errno to 0, resulting in canonicalize() to
    return NULL with errno being 0. This can result in triggering the
    assert(conn->in == NULL) in consider_message().
    
    Don't assume the initial setting of errno to "EINVAL" will stay valid
    in all cases and set it to EINVAL only when returning NULL due to an
    invalid path.
    
    This is XSA-481/CVE-2026-23555
    
    Reported-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Julien Grall <julien@xen.org>
    (cherry picked from commit 4c61822b04aac089d1df9ab15ae3a3f6dfb4e305)
---
 tools/xenstored/core.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/xenstored/core.c b/tools/xenstored/core.c
index bada1ad9a2..64baec268b 100644
--- a/tools/xenstored/core.c
+++ b/tools/xenstored/core.c
@@ -1242,11 +1242,10 @@ const char *canonicalize(struct connection *conn, const void *ctx,
 	 * - illegal character in node
 	 * - starts with '@' but no special node allowed
 	 */
-	errno = EINVAL;
 	if (!node ||
 	    !valid_chars(node) ||
 	    (node[0] == '@' && !allow_special))
-		return NULL;
+		goto inval;
 
 	if (node[0] != '/' && node[0] != '@') {
 		name = talloc_asprintf(ctx, "%s/%s", get_implicit_path(conn),
@@ -1274,6 +1273,8 @@ const char *canonicalize(struct connection *conn, const void *ctx,
 	if (name != node)
 		talloc_free(name);
 
+ inval:
+	errno = EINVAL;
 	return NULL;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Tue Mar 17 18:22:11 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 17 Mar 2026 18:22:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1256209.1550897 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w2Z3L-0002Rp-48; Tue, 17 Mar 2026 18:22:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1256209.1550897; Tue, 17 Mar 2026 18:22:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w2Z3L-0002Rg-1b; Tue, 17 Mar 2026 18:22:03 +0000
Received: by outflank-mailman (input) for mailman id 1256209;
 Tue, 17 Mar 2026 18:22:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w2Z3J-0002Ra-Mv
 for xen-changelog@lists.xenproject.org; Tue, 17 Mar 2026 18:22:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w2Z3J-00DFsw-2g
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Mar 2026 18:22:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w2Z3J-00E8DA-1o
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Mar 2026 18:22:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=md0KgkkHea9Gd6pKgRMVKyW/YXziTg8SiS5tgBWRELs=; b=Klk7YxQ1vskVQTD02ozjyJ+69B
	DEwfuYDAZI+z3vIrZJPsyxHPEgMiOuqsu8BV/zmJIZkySTr2qzLP/G7pC/GdTml+3Gc91wZqcj6JT
	xR/tvrDlz4hJe+JRwDYbunD47SBr/IEVdNReZarKfmcmUYScD9S/tLVaGSyfS3KeRq5w=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] x86/p2m: issue a sync flush before freeing paging pages
Message-Id: <E1w2Z3J-00E8DA-1o@xenbits.xenproject.org>
Date: Tue, 17 Mar 2026 18:22:01 +0000

commit 8b8c324af669f1a350f0d6b6f84619d39b99d653
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Tue Feb 17 09:33:43 2026 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 17 12:11:44 2026 +0000

    x86/p2m: issue a sync flush before freeing paging pages
    
    In the EPT implementation, the defer flushing logic is used
    unconditionally, and that would lead to paging memory being returned to the
    paging pool before its references had been flushed.
    
    Issue any pending flushes before freeing the paging memory back to the
    pool.
    
    Note AMD (NPT) and Shadow paging are not affected, as they don't implement
    the deferred flushing logic.
    
    This is XSA-480 / CVE-2026-23554
    
    Fixes: 4a59e6bb3a96 ("x86/EPT: squash meaningless TLB flush")
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    (cherry picked from commit 4bc2e5333abb37b9a67e44d7d6c712247e5e5146)
---
 xen/arch/x86/mm/p2m.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index ae37e1ec78..8197e9ad45 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -457,6 +457,11 @@ void p2m_free_ptp(struct p2m_domain *p2m, struct page_info *pg)
     ASSERT(p2m->domain);
     ASSERT(p2m->domain->arch.paging.free_page);
 
+    /*
+     * Issue any pending flush here, in case it was deferred before.  The page
+     * will be returned to the paging pool now.
+     */
+    p2m_tlb_flush_sync(p2m);
     page_list_del(pg, &p2m->pages);
     p2m->domain->arch.paging.free_page(p2m->domain, pg);
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Tue Mar 17 18:22:13 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 17 Mar 2026 18:22:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1256210.1550901 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w2Z3V-0002TH-5e; Tue, 17 Mar 2026 18:22:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1256210.1550901; Tue, 17 Mar 2026 18:22:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w2Z3V-0002T9-2s; Tue, 17 Mar 2026 18:22:13 +0000
Received: by outflank-mailman (input) for mailman id 1256210;
 Tue, 17 Mar 2026 18:22:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w2Z3T-0002Sv-Np
 for xen-changelog@lists.xenproject.org; Tue, 17 Mar 2026 18:22:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w2Z3T-00DFta-2y
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Mar 2026 18:22:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w2Z3T-00E8E4-2A
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Mar 2026 18:22:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=yT759jiBwIfz8qeMUnx2uN5YocbD5oVhyvNFa5vUK7E=; b=oJwAcgK5HdrQ4OmeCqRqGr/xiD
	JVrrVmiGvqaLGab/2ZS4U2aNqJND3Ng+7OQVMknkBZv+y9SvIbPyuEzmNw+HzhjnwzxlQ5HoVP5ds
	fWSmt/i5BZtVyCpxWdJmrdHIi9iozXC/oxUijohyP8jSIc0fituLK3x5riFr3ICh/l00=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] tools/xenstored: fix canonicalize() error testing
Message-Id: <E1w2Z3T-00E8E4-2A@xenbits.xenproject.org>
Date: Tue, 17 Mar 2026 18:22:11 +0000

commit 2c5f7fd78ba894c6a2fd3bfc2d164cc792db8f42
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Thu Feb 12 08:29:38 2026 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 17 12:11:44 2026 +0000

    tools/xenstored: fix canonicalize() error testing
    
    The setting of errno in canonicalize() is rather fragile and seems to
    be even wrong in one corner case: when the invalid path "/local/domain/"
    is passed, sscanf() will set errno to 0, resulting in canonicalize() to
    return NULL with errno being 0. This can result in triggering the
    assert(conn->in == NULL) in consider_message().
    
    Don't assume the initial setting of errno to "EINVAL" will stay valid
    in all cases and set it to EINVAL only when returning NULL due to an
    invalid path.
    
    This is XSA-481/CVE-2026-23555
    
    Reported-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Julien Grall <julien@xen.org>
    (cherry picked from commit 4c61822b04aac089d1df9ab15ae3a3f6dfb4e305)
---
 tools/xenstored/core.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/xenstored/core.c b/tools/xenstored/core.c
index dfe98e7bfc..e8a0e3830b 100644
--- a/tools/xenstored/core.c
+++ b/tools/xenstored/core.c
@@ -1262,11 +1262,10 @@ const char *canonicalize(struct connection *conn, const void *ctx,
 	 * - illegal character in node
 	 * - starts with '@' but no special node allowed
 	 */
-	errno = EINVAL;
 	if (!node ||
 	    !valid_chars(node) ||
 	    (node[0] == '@' && !allow_special))
-		return NULL;
+		goto inval;
 
 	if (node[0] != '/' && node[0] != '@') {
 		name = talloc_asprintf(ctx, "%s/%s", get_implicit_path(conn),
@@ -1294,6 +1293,8 @@ const char *canonicalize(struct connection *conn, const void *ctx,
 	if (name != node)
 		talloc_free(name);
 
+ inval:
+	errno = EINVAL;
 	return NULL;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Tue Mar 17 18:33:05 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 17 Mar 2026 18:33:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1256211.1550905 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w2ZDy-0003d4-UJ; Tue, 17 Mar 2026 18:33:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1256211.1550905; Tue, 17 Mar 2026 18:33:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w2ZDy-0003cw-RW; Tue, 17 Mar 2026 18:33:02 +0000
Received: by outflank-mailman (input) for mailman id 1256211;
 Tue, 17 Mar 2026 18:33:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w2ZDx-0003cq-Vd
 for xen-changelog@lists.xenproject.org; Tue, 17 Mar 2026 18:33:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w2ZDy-00DG5q-0N
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Mar 2026 18:33:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w2ZDx-00E9Qn-2m
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Mar 2026 18:33:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=sr8gDwG3O8f3Uwvh2u/ebbWNeLQEaQ2qnXuJbT8ud1k=; b=cJspD0P4Jou7RT7ev49YV+DL5j
	wPQY5zHvjxMJTiCaTsG7gaAa59ktwp5fMHf8NLBkutC5dXEJs9CfJ0oKXN9LjIa5ZLNfsxCRPW3Gk
	0m/DIP1JfYcpH7SJObLWT0E+t6FDXYyDS5WtcXrdUZ4QP4PVWPQULTJyh8Px3lkZEcns=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] libxl: constify some local variables for building with glibc 2.43
Message-Id: <E1w2ZDx-00E9Qn-2m@xenbits.xenproject.org>
Date: Tue, 17 Mar 2026 18:33:01 +0000

commit 4c8867621b48f1b631d453680eab8f743a5061a0
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Thu Feb 26 13:31:48 2026 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 17 18:23:50 2026 +0000

    libxl: constify some local variables for building with glibc 2.43
    
    Archlinux just updated glibc to 2.43+r5+g856c426a7534-1 and that
    causes libxl build failure:
    
        libxl_cpuid.c: In function ‘libxl_cpuid_parse_config_xend’:
        libxl_cpuid.c:447:16: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
          447 |         endptr = strchr(str, '=');
              |                ^
        libxl_cpuid.c:452:16: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
          452 |         endptr = strchr(str, ',');
              |                ^
        libxl_cpuid.c:454:20: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
          454 |             endptr = strchr(str, 0);
              |                    ^
        cc1: all warnings being treated as errors
    
    Add missing consts. Note in libxl_cpuid_parse_config_xend() non-const
    endptr still is needed, to be compatible with the second argument to
    strtoul(). Add second variable for this reason.
    
    And while at it, move semicolon to its own line
    
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Anthony PERARD <anthony.perard@vates.tech>
    (cherry picked from commit 44da0e3b4ff7fa15ad28b628f57412a05dae653c)
---
 tools/libs/light/libxl_cpuid.c    | 21 ++++++++++++---------
 tools/libs/light/libxl_internal.c |  2 +-
 2 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/tools/libs/light/libxl_cpuid.c b/tools/libs/light/libxl_cpuid.c
index df5529ac1f..d22832fdda 100644
--- a/tools/libs/light/libxl_cpuid.c
+++ b/tools/libs/light/libxl_cpuid.c
@@ -440,29 +440,32 @@ int libxl_cpuid_parse_config_xend(libxl_cpuid_policy_list *policy,
     str = endptr + 1;
     entry = cpuid_find_match(policy, leaf, subleaf);
     for (str = endptr + 1; *str != 0;) {
+        const char *endptrc;
+
         if (str[0] != 'e' || str[2] != 'x') {
             return 4;
         }
         value = str[1] - 'a';
-        endptr = strchr(str, '=');
-        if (value > 3 || endptr == NULL) {
+        endptrc = strchr(str, '=');
+        if (value > 3 || endptrc == NULL) {
             return 4;
         }
-        str = endptr + 1;
-        endptr = strchr(str, ',');
-        if (endptr == NULL) {
-            endptr = strchr(str, 0);
+        str = endptrc + 1;
+        endptrc = strchr(str, ',');
+        if (endptrc == NULL) {
+            endptrc = strchr(str, 0);
         }
-        if (endptr - str != 32) {
+        if (endptrc - str != 32) {
             return 5;
         }
         entry->policy[value] = calloc(32 + 1, 1);
         strncpy(entry->policy[value], str, 32);
         entry->policy[value][32] = 0;
-        if (*endptr == 0) {
+        if (*endptrc == 0) {
             break;
         }
-        for (str = endptr + 1; *str == ' ' || *str == '\n'; str++);
+        for (str = endptrc + 1; *str == ' ' || *str == '\n'; str++)
+            ;
     }
     return 0;
 }
diff --git a/tools/libs/light/libxl_internal.c b/tools/libs/light/libxl_internal.c
index c95624933f..7e3c0eaae5 100644
--- a/tools/libs/light/libxl_internal.c
+++ b/tools/libs/light/libxl_internal.c
@@ -204,7 +204,7 @@ char *libxl__strndup(libxl__gc *gc, const char *c, size_t n)
 
 char *libxl__dirname(libxl__gc *gc, const char *s)
 {
-    char *c = strrchr(s, '/');
+    const char *c = strrchr(s, '/');
 
     if (!c)
         return NULL;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Tue Mar 17 18:33:12 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 17 Mar 2026 18:33:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1256212.1550908 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w2ZE8-0003er-VQ; Tue, 17 Mar 2026 18:33:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1256212.1550908; Tue, 17 Mar 2026 18:33:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w2ZE8-0003ej-Su; Tue, 17 Mar 2026 18:33:12 +0000
Received: by outflank-mailman (input) for mailman id 1256212;
 Tue, 17 Mar 2026 18:33:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w2ZE8-0003eZ-6I
 for xen-changelog@lists.xenproject.org; Tue, 17 Mar 2026 18:33:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w2ZE8-00DG6A-1C
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Mar 2026 18:33:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w2ZE8-00E9RX-0P
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Mar 2026 18:33:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=iyPivltfyfxk9BW7MT9gPJQUZs9tkK/OxB68uhjndtE=; b=xnIA9nn2mu6lNqcJTUvWTH31Jw
	ahRYa43bQ7BNuyMUsKjEEYlOqJ/rWcEomqkrYC9tjSugGL83NpsJxMnWxMj1lZCbyykxliE2WlHG+
	/6bbPJVneUsMQWGV/knOpQjGJacV56A6b8b2P3la95Eh4hMpAbMd2jZ0KVeMSSDy6vuo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.17] libxl: constify some local variables for building with glibc 2.43
Message-Id: <E1w2ZE8-00E9RX-0P@xenbits.xenproject.org>
Date: Tue, 17 Mar 2026 18:33:12 +0000

commit 2319a850204b83b2e1afa089e354748601309141
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Thu Feb 26 13:31:48 2026 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 17 18:24:55 2026 +0000

    libxl: constify some local variables for building with glibc 2.43
    
    Archlinux just updated glibc to 2.43+r5+g856c426a7534-1 and that
    causes libxl build failure:
    
        libxl_cpuid.c: In function ‘libxl_cpuid_parse_config_xend’:
        libxl_cpuid.c:447:16: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
          447 |         endptr = strchr(str, '=');
              |                ^
        libxl_cpuid.c:452:16: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
          452 |         endptr = strchr(str, ',');
              |                ^
        libxl_cpuid.c:454:20: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
          454 |             endptr = strchr(str, 0);
              |                    ^
        cc1: all warnings being treated as errors
    
    Add missing consts. Note in libxl_cpuid_parse_config_xend() non-const
    endptr still is needed, to be compatible with the second argument to
    strtoul(). Add second variable for this reason.
    
    And while at it, move semicolon to its own line
    
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Anthony PERARD <anthony.perard@vates.tech>
    (cherry picked from commit 44da0e3b4ff7fa15ad28b628f57412a05dae653c)
---
 tools/libs/light/libxl_cpuid.c    | 21 ++++++++++++---------
 tools/libs/light/libxl_internal.c |  2 +-
 2 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/tools/libs/light/libxl_cpuid.c b/tools/libs/light/libxl_cpuid.c
index 493f615c9d..f73f653685 100644
--- a/tools/libs/light/libxl_cpuid.c
+++ b/tools/libs/light/libxl_cpuid.c
@@ -442,29 +442,32 @@ int libxl_cpuid_parse_config_xend(libxl_cpuid_policy_list *policy,
     str = endptr + 1;
     entry = cpuid_find_match(policy, leaf, subleaf);
     for (str = endptr + 1; *str != 0;) {
+        const char *endptrc;
+
         if (str[0] != 'e' || str[2] != 'x') {
             return 4;
         }
         value = str[1] - 'a';
-        endptr = strchr(str, '=');
-        if (value > 3 || endptr == NULL) {
+        endptrc = strchr(str, '=');
+        if (value > 3 || endptrc == NULL) {
             return 4;
         }
-        str = endptr + 1;
-        endptr = strchr(str, ',');
-        if (endptr == NULL) {
-            endptr = strchr(str, 0);
+        str = endptrc + 1;
+        endptrc = strchr(str, ',');
+        if (endptrc == NULL) {
+            endptrc = strchr(str, 0);
         }
-        if (endptr - str != 32) {
+        if (endptrc - str != 32) {
             return 5;
         }
         entry->policy[value] = calloc(32 + 1, 1);
         strncpy(entry->policy[value], str, 32);
         entry->policy[value][32] = 0;
-        if (*endptr == 0) {
+        if (*endptrc == 0) {
             break;
         }
-        for (str = endptr + 1; *str == ' ' || *str == '\n'; str++);
+        for (str = endptrc + 1; *str == ' ' || *str == '\n'; str++)
+            ;
     }
     return 0;
 }
diff --git a/tools/libs/light/libxl_internal.c b/tools/libs/light/libxl_internal.c
index 86556b6113..12b4d6569b 100644
--- a/tools/libs/light/libxl_internal.c
+++ b/tools/libs/light/libxl_internal.c
@@ -204,7 +204,7 @@ char *libxl__strndup(libxl__gc *gc, const char *c, size_t n)
 
 char *libxl__dirname(libxl__gc *gc, const char *s)
 {
-    char *c = strrchr(s, '/');
+    const char *c = strrchr(s, '/');
 
     if (!c)
         return NULL;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.17


From xen-changelog-bounces@lists.xenproject.org Tue Mar 17 18:44:06 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 17 Mar 2026 18:44:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1256214.1550912 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w2ZOd-0004oF-OU; Tue, 17 Mar 2026 18:44:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1256214.1550912; Tue, 17 Mar 2026 18:44:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w2ZOd-0004o7-LP; Tue, 17 Mar 2026 18:44:03 +0000
Received: by outflank-mailman (input) for mailman id 1256214;
 Tue, 17 Mar 2026 18:44:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w2ZOc-0004o1-Ea
 for xen-changelog@lists.xenproject.org; Tue, 17 Mar 2026 18:44:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w2ZOc-00DGIB-1z
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Mar 2026 18:44:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w2ZOc-00EAx0-17
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Mar 2026 18:44:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=gGkChQxIy4qRTh3jdfA6iVO98h4EeM3NaE07QamA4b8=; b=qrbnnPizY3hIdJg2Wc6BomLTM+
	k0gZZDOGygcT1tXRbz0b/GohrwdKnEkBgSpznS/QbrkY+HOj+/wTXkBe46u9ZDcS+R559Llqwj+Tg
	n68aEYr3DNVkkqNj0v4JW3dpsdqKLDB1uqj5lxQIwwzkOOl9xjlaREC67est8FswSmvY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/p2m: issue a sync flush before freeing paging pages
Message-Id: <E1w2ZOc-00EAx0-17@xenbits.xenproject.org>
Date: Tue, 17 Mar 2026 18:44:02 +0000

commit 4bc2e5333abb37b9a67e44d7d6c712247e5e5146
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Tue Feb 17 09:33:43 2026 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 17 12:08:07 2026 +0000

    x86/p2m: issue a sync flush before freeing paging pages
    
    In the EPT implementation, the defer flushing logic is used
    unconditionally, and that would lead to paging memory being returned to the
    paging pool before its references had been flushed.
    
    Issue any pending flushes before freeing the paging memory back to the
    pool.
    
    Note AMD (NPT) and Shadow paging are not affected, as they don't implement
    the deferred flushing logic.
    
    This is XSA-480 / CVE-2026-23554
    
    Fixes: 4a59e6bb3a96 ("x86/EPT: squash meaningless TLB flush")
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/mm/p2m.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index e915da26a8..fddecdf978 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -479,6 +479,11 @@ void p2m_free_ptp(struct p2m_domain *p2m, struct page_info *pg)
     ASSERT(p2m->domain);
     ASSERT(p2m->domain->arch.paging.free_page);
 
+    /*
+     * Issue any pending flush here, in case it was deferred before.  The page
+     * will be returned to the paging pool now.
+     */
+    p2m_tlb_flush_sync(p2m);
     page_list_del(pg, &p2m->pages);
     p2m->domain->arch.paging.free_page(p2m->domain, pg);
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 17 18:44:13 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 17 Mar 2026 18:44:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1256215.1550918 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w2ZOn-0004qh-SR; Tue, 17 Mar 2026 18:44:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1256215.1550918; Tue, 17 Mar 2026 18:44:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w2ZOn-0004qZ-Oc; Tue, 17 Mar 2026 18:44:13 +0000
Received: by outflank-mailman (input) for mailman id 1256215;
 Tue, 17 Mar 2026 18:44:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w2ZOm-0004q7-HN
 for xen-changelog@lists.xenproject.org; Tue, 17 Mar 2026 18:44:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w2ZOm-00DGIa-2K
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Mar 2026 18:44:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w2ZOm-00EB02-1U
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Mar 2026 18:44:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=uKCzbyAYIH2HNJrayVmA5u/lI0AEJs+6sLRZRJJ90hU=; b=tidrochd9i167oN+8UNzfDjeFq
	xyX1sNutaGlDaMf7iob3hEl/1k78Nzlu+UtYsiY/vZ2iZp8LdGaTgDM6gM0A9Izt3bEHcjLOzxmfx
	TJoWbIGaz5TYRzkhcfGOxAXEbASEf7h0/q6879M0gejKIBZx5qO5xyL127u6TtxyPgJM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/xenstored: fix canonicalize() error testing
Message-Id: <E1w2ZOm-00EB02-1U@xenbits.xenproject.org>
Date: Tue, 17 Mar 2026 18:44:12 +0000

commit 4c61822b04aac089d1df9ab15ae3a3f6dfb4e305
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Thu Feb 12 08:29:38 2026 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 17 12:08:07 2026 +0000

    tools/xenstored: fix canonicalize() error testing
    
    The setting of errno in canonicalize() is rather fragile and seems to
    be even wrong in one corner case: when the invalid path "/local/domain/"
    is passed, sscanf() will set errno to 0, resulting in canonicalize() to
    return NULL with errno being 0. This can result in triggering the
    assert(conn->in == NULL) in consider_message().
    
    Don't assume the initial setting of errno to "EINVAL" will stay valid
    in all cases and set it to EINVAL only when returning NULL due to an
    invalid path.
    
    This is XSA-481/CVE-2026-23555
    
    Reported-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Julien Grall <julien@xen.org>
---
 tools/xenstored/core.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/xenstored/core.c b/tools/xenstored/core.c
index d509736c32..e4d2fd4876 100644
--- a/tools/xenstored/core.c
+++ b/tools/xenstored/core.c
@@ -1240,11 +1240,10 @@ const char *canonicalize(struct connection *conn, const void *ctx,
 	 * - illegal character in node
 	 * - starts with '@' but no special node allowed
 	 */
-	errno = EINVAL;
 	if (!node ||
 	    !valid_chars(node) ||
 	    (node[0] == '@' && !allow_special))
-		return NULL;
+		goto inval;
 
 	if (node[0] != '/' && node[0] != '@') {
 		name = talloc_asprintf(ctx, "%s/%s", get_implicit_path(conn),
@@ -1272,6 +1271,8 @@ const char *canonicalize(struct connection *conn, const void *ctx,
 	if (name != node)
 		talloc_free(name);
 
+ inval:
+	errno = EINVAL;
 	return NULL;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 17 18:55:05 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 17 Mar 2026 18:55:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1256225.1550930 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w2ZZG-0006a3-Sm; Tue, 17 Mar 2026 18:55:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1256225.1550930; Tue, 17 Mar 2026 18:55:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w2ZZG-0006Zw-Q4; Tue, 17 Mar 2026 18:55:02 +0000
Received: by outflank-mailman (input) for mailman id 1256225;
 Tue, 17 Mar 2026 18:55:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w2ZZF-0006Zq-KX
 for xen-changelog@lists.xenproject.org; Tue, 17 Mar 2026 18:55:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w2ZZF-00DGUi-2D
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Mar 2026 18:55:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w2ZZF-00EBqd-1Q
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Mar 2026 18:55:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=4sj0aBwZ5FlIFzXz+eIZnvpcZGaIqXnhsEnJm2+prdA=; b=okOzrYN0YZuVyXOw9NBLF1+kI+
	khO+fwXHa5s4Dz/8d0KIEwySjlKnQqT9WDzxSUdqYzbtBfj7ohuZQYQeYeuJsrIpEo1jedacV2Q01
	4fB4+ADSYn0Fx7re5OfgHBwJDIEUggvQMEuH8Nf42v41iCQBnYFNqhPjcGMUI1xEZ3d0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] libxl: constify some local variables for building with glibc 2.43
Message-Id: <E1w2ZZF-00EBqd-1Q@xenbits.xenproject.org>
Date: Tue, 17 Mar 2026 18:55:01 +0000

commit 2319a850204b83b2e1afa089e354748601309141
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Thu Feb 26 13:31:48 2026 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 17 18:24:55 2026 +0000

    libxl: constify some local variables for building with glibc 2.43
    
    Archlinux just updated glibc to 2.43+r5+g856c426a7534-1 and that
    causes libxl build failure:
    
        libxl_cpuid.c: In function ‘libxl_cpuid_parse_config_xend’:
        libxl_cpuid.c:447:16: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
          447 |         endptr = strchr(str, '=');
              |                ^
        libxl_cpuid.c:452:16: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
          452 |         endptr = strchr(str, ',');
              |                ^
        libxl_cpuid.c:454:20: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
          454 |             endptr = strchr(str, 0);
              |                    ^
        cc1: all warnings being treated as errors
    
    Add missing consts. Note in libxl_cpuid_parse_config_xend() non-const
    endptr still is needed, to be compatible with the second argument to
    strtoul(). Add second variable for this reason.
    
    And while at it, move semicolon to its own line
    
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Anthony PERARD <anthony.perard@vates.tech>
    (cherry picked from commit 44da0e3b4ff7fa15ad28b628f57412a05dae653c)
---
 tools/libs/light/libxl_cpuid.c    | 21 ++++++++++++---------
 tools/libs/light/libxl_internal.c |  2 +-
 2 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/tools/libs/light/libxl_cpuid.c b/tools/libs/light/libxl_cpuid.c
index 493f615c9d..f73f653685 100644
--- a/tools/libs/light/libxl_cpuid.c
+++ b/tools/libs/light/libxl_cpuid.c
@@ -442,29 +442,32 @@ int libxl_cpuid_parse_config_xend(libxl_cpuid_policy_list *policy,
     str = endptr + 1;
     entry = cpuid_find_match(policy, leaf, subleaf);
     for (str = endptr + 1; *str != 0;) {
+        const char *endptrc;
+
         if (str[0] != 'e' || str[2] != 'x') {
             return 4;
         }
         value = str[1] - 'a';
-        endptr = strchr(str, '=');
-        if (value > 3 || endptr == NULL) {
+        endptrc = strchr(str, '=');
+        if (value > 3 || endptrc == NULL) {
             return 4;
         }
-        str = endptr + 1;
-        endptr = strchr(str, ',');
-        if (endptr == NULL) {
-            endptr = strchr(str, 0);
+        str = endptrc + 1;
+        endptrc = strchr(str, ',');
+        if (endptrc == NULL) {
+            endptrc = strchr(str, 0);
         }
-        if (endptr - str != 32) {
+        if (endptrc - str != 32) {
             return 5;
         }
         entry->policy[value] = calloc(32 + 1, 1);
         strncpy(entry->policy[value], str, 32);
         entry->policy[value][32] = 0;
-        if (*endptr == 0) {
+        if (*endptrc == 0) {
             break;
         }
-        for (str = endptr + 1; *str == ' ' || *str == '\n'; str++);
+        for (str = endptrc + 1; *str == ' ' || *str == '\n'; str++)
+            ;
     }
     return 0;
 }
diff --git a/tools/libs/light/libxl_internal.c b/tools/libs/light/libxl_internal.c
index 86556b6113..12b4d6569b 100644
--- a/tools/libs/light/libxl_internal.c
+++ b/tools/libs/light/libxl_internal.c
@@ -204,7 +204,7 @@ char *libxl__strndup(libxl__gc *gc, const char *c, size_t n)
 
 char *libxl__dirname(libxl__gc *gc, const char *s)
 {
-    char *c = strrchr(s, '/');
+    const char *c = strrchr(s, '/');
 
     if (!c)
         return NULL;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Tue Mar 17 19:22:08 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 17 Mar 2026 19:22:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1256229.1550934 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w2ZzP-0001Vy-Og; Tue, 17 Mar 2026 19:22:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1256229.1550934; Tue, 17 Mar 2026 19:22:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w2ZzP-0001Vq-M7; Tue, 17 Mar 2026 19:22:03 +0000
Received: by outflank-mailman (input) for mailman id 1256229;
 Tue, 17 Mar 2026 19:22:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w2ZzN-0001Vk-Vd
 for xen-changelog@lists.xenproject.org; Tue, 17 Mar 2026 19:22:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w2ZzO-00DH7F-08
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Mar 2026 19:22:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w2ZzN-00EEBo-2U
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Mar 2026 19:22:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=NUnX7mvj4P9yrD+dhdiZtVZj4qgVfxoGUqkkO741tRE=; b=3yCTyidqORC1b+H5PcqbDYJbYk
	SBbHOjNZ5zuc7thj/S+tSaarqvSp8aYIRI1iVGAup0V8ITxatCiVRcCVIXLSec8CYjjRKJ4dGD1K4
	UyLBr/3gkMvsiM4UgQ9dldpWDns3iryzTMaTGvRFY4gk9ZmfxjQIjx4IMAhAE+mxgKmw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] libxl: constify some local variables for building with glibc 2.43
Message-Id: <E1w2ZzN-00EEBo-2U@xenbits.xenproject.org>
Date: Tue, 17 Mar 2026 19:22:01 +0000

commit 4c8867621b48f1b631d453680eab8f743a5061a0
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Thu Feb 26 13:31:48 2026 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 17 18:23:50 2026 +0000

    libxl: constify some local variables for building with glibc 2.43
    
    Archlinux just updated glibc to 2.43+r5+g856c426a7534-1 and that
    causes libxl build failure:
    
        libxl_cpuid.c: In function ‘libxl_cpuid_parse_config_xend’:
        libxl_cpuid.c:447:16: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
          447 |         endptr = strchr(str, '=');
              |                ^
        libxl_cpuid.c:452:16: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
          452 |         endptr = strchr(str, ',');
              |                ^
        libxl_cpuid.c:454:20: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
          454 |             endptr = strchr(str, 0);
              |                    ^
        cc1: all warnings being treated as errors
    
    Add missing consts. Note in libxl_cpuid_parse_config_xend() non-const
    endptr still is needed, to be compatible with the second argument to
    strtoul(). Add second variable for this reason.
    
    And while at it, move semicolon to its own line
    
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Anthony PERARD <anthony.perard@vates.tech>
    (cherry picked from commit 44da0e3b4ff7fa15ad28b628f57412a05dae653c)
---
 tools/libs/light/libxl_cpuid.c    | 21 ++++++++++++---------
 tools/libs/light/libxl_internal.c |  2 +-
 2 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/tools/libs/light/libxl_cpuid.c b/tools/libs/light/libxl_cpuid.c
index df5529ac1f..d22832fdda 100644
--- a/tools/libs/light/libxl_cpuid.c
+++ b/tools/libs/light/libxl_cpuid.c
@@ -440,29 +440,32 @@ int libxl_cpuid_parse_config_xend(libxl_cpuid_policy_list *policy,
     str = endptr + 1;
     entry = cpuid_find_match(policy, leaf, subleaf);
     for (str = endptr + 1; *str != 0;) {
+        const char *endptrc;
+
         if (str[0] != 'e' || str[2] != 'x') {
             return 4;
         }
         value = str[1] - 'a';
-        endptr = strchr(str, '=');
-        if (value > 3 || endptr == NULL) {
+        endptrc = strchr(str, '=');
+        if (value > 3 || endptrc == NULL) {
             return 4;
         }
-        str = endptr + 1;
-        endptr = strchr(str, ',');
-        if (endptr == NULL) {
-            endptr = strchr(str, 0);
+        str = endptrc + 1;
+        endptrc = strchr(str, ',');
+        if (endptrc == NULL) {
+            endptrc = strchr(str, 0);
         }
-        if (endptr - str != 32) {
+        if (endptrc - str != 32) {
             return 5;
         }
         entry->policy[value] = calloc(32 + 1, 1);
         strncpy(entry->policy[value], str, 32);
         entry->policy[value][32] = 0;
-        if (*endptr == 0) {
+        if (*endptrc == 0) {
             break;
         }
-        for (str = endptr + 1; *str == ' ' || *str == '\n'; str++);
+        for (str = endptrc + 1; *str == ' ' || *str == '\n'; str++)
+            ;
     }
     return 0;
 }
diff --git a/tools/libs/light/libxl_internal.c b/tools/libs/light/libxl_internal.c
index c95624933f..7e3c0eaae5 100644
--- a/tools/libs/light/libxl_internal.c
+++ b/tools/libs/light/libxl_internal.c
@@ -204,7 +204,7 @@ char *libxl__strndup(libxl__gc *gc, const char *c, size_t n)
 
 char *libxl__dirname(libxl__gc *gc, const char *s)
 {
-    char *c = strrchr(s, '/');
+    const char *c = strrchr(s, '/');
 
     if (!c)
         return NULL;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Mar 19 13:33:07 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 19 Mar 2026 13:33:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1257185.1551630 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w3DUl-0001zx-OD; Thu, 19 Mar 2026 13:33:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1257185.1551630; Thu, 19 Mar 2026 13:33:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w3DUl-0001zp-Li; Thu, 19 Mar 2026 13:33:03 +0000
Received: by outflank-mailman (input) for mailman id 1257185;
 Thu, 19 Mar 2026 13:33:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w3DUj-0001zh-TR
 for xen-changelog@lists.xenproject.org; Thu, 19 Mar 2026 13:33:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w3DUk-00GUg9-0D
 for xen-changelog@lists.xenproject.org;
 Thu, 19 Mar 2026 13:33:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w3DUj-00HIFk-2a
 for xen-changelog@lists.xenproject.org;
 Thu, 19 Mar 2026 13:33:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=c5KoVUzH4aMiUiIIaQKi6kd7yZCQdskOhEWyHvJMqMU=; b=ZeilC+WjAFxYzoWB2CfV2Vi0Vp
	4asT/ztz+LwbJ6ME5jICYqb1PYYlvZSiJzkShBW85pNn/dIJG15dxPLLpX1Yhp28JJQZJr4TbgC+6
	ekXGkLMvZBHur+AV3jLhORnssY0BtyKW5SMAryO8hy4EWd0KlnyDjGCWm2zwBXcXMqa0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/coverage: Drop support for older GCOV
Message-Id: <E1w3DUj-00HIFk-2a@xenbits.xenproject.org>
Date: Thu, 19 Mar 2026 13:33:01 +0000

commit 6db6211942742dda4b3eef8630f6fc7e692132ba
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Mar 16 23:46:28 2026 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Mar 19 13:20:30 2026 +0000

    xen/coverage: Drop support for older GCOV
    
    With the GCC toolchain baseline now at 5.1, gcc_3_4.o (covering 3.4 through
    4.6) will never get chosen.  Drop it.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Michal Orzel <michal.orzel@amd.com>
---
 xen/common/coverage/Makefile  |   2 +-
 xen/common/coverage/gcc_3_4.c | 367 ------------------------------------------
 2 files changed, 1 insertion(+), 368 deletions(-)

diff --git a/xen/common/coverage/Makefile b/xen/common/coverage/Makefile
index d729afc9c7..26bc1b7c04 100644
--- a/xen/common/coverage/Makefile
+++ b/xen/common/coverage/Makefile
@@ -1,7 +1,7 @@
 obj-y += coverage.o
 ifneq ($(CONFIG_CC_IS_CLANG),y)
 obj-y += gcov_base.o gcov.o
-obj-y += $(call cc-ifversion,-lt,0407, gcc_3_4.o, gcc_4_7.o)
+obj-y += gcc_4_7.o
 else
 obj-y += llvm.o
 endif
diff --git a/xen/common/coverage/gcc_3_4.c b/xen/common/coverage/gcc_3_4.c
deleted file mode 100644
index 3631f4bc25..0000000000
--- a/xen/common/coverage/gcc_3_4.c
+++ /dev/null
@@ -1,367 +0,0 @@
-/*
- *  This code provides functions to handle gcc's profiling data format
- *  introduced with gcc 3.4. Future versions of gcc may change the gcov
- *  format (as happened before), so all format-specific information needs
- *  to be kept modular and easily exchangeable.
- *
- *  This file is based on gcc-internal definitions. Functions and data
- *  structures are defined to be compatible with gcc counterparts.
- *  For a better understanding, refer to gcc source: gcc/gcov-io.h.
- *
- *    Copyright IBM Corp. 2009
- *    Author(s): Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
- *
- *    Uses gcc-internal data definitions.
- *
- *  Imported from Linux and modified for Xen by
- *    Wei Liu <wei.liu2@citrix.com>
- */
-
-
-#include <xen/lib.h>
-
-#include "gcov.h"
-
-#if !(GCC_VERSION >= 30400 && GCC_VERSION < 40700)
-#error "Wrong version of GCC used to compile gcov"
-#endif
-
-#define GCOV_COUNTERS 5
-
-static struct gcov_info *gcov_info_head;
-
-/**
- * struct gcov_fn_info - profiling meta data per function
- * @ident: object file-unique function identifier
- * @checksum: function checksum
- * @n_ctrs: number of values per counter type belonging to this function
- *
- * This data is generated by gcc during compilation and doesn't change
- * at run-time.
- */
-struct gcov_fn_info
-{
-    unsigned int ident;
-    unsigned int checksum;
-    unsigned int n_ctrs[0];
-};
-
-/**
- * struct gcov_ctr_info - profiling data per counter type
- * @num: number of counter values for this type
- * @values: array of counter values for this type
- * @merge: merge function for counter values of this type (unused)
- *
- * This data is generated by gcc during compilation and doesn't change
- * at run-time with the exception of the values array.
- */
-struct gcov_ctr_info
-{
-    unsigned int num;
-    gcov_type *values;
-    void (*merge)(gcov_type *, unsigned int);
-};
-
-/**
- * struct gcov_info - profiling data per object file
- * @version: gcov version magic indicating the gcc version used for compilation
- * @next: list head for a singly-linked list
- * @stamp: time stamp
- * @filename: name of the associated gcov data file
- * @n_functions: number of instrumented functions
- * @functions: function data
- * @ctr_mask: mask specifying which counter types are active
- * @counts: counter data per counter type
- *
- * This data is generated by gcc during compilation and doesn't change
- * at run-time with the exception of the next pointer.
- */
-struct gcov_info
-{
-    unsigned int              version;
-    struct gcov_info          *next;
-    unsigned int              stamp;
-    const char                *filename;
-    unsigned int              n_functions;
-    const struct gcov_fn_info *functions;
-    unsigned int              ctr_mask;
-    struct gcov_ctr_info      counts[0];
-};
-
-/**
- * struct type_info - iterator helper array
- * @ctr_type: counter type
- * @offset: index of the first value of the current function for this type
- *
- * This array is needed to convert the in-memory data format into the in-file
- * data format:
- *
- * In-memory:
- *   for each counter type
- *     for each function
- *       values
- *
- * In-file:
- *   for each function
- *     for each counter type
- *       values
- *
- * See gcc source gcc/gcov-io.h for more information on data organization.
- */
-struct type_info {
-    int ctr_type;
-    unsigned int offset;
-};
-
-/**
- * struct gcov_iterator - specifies current file position in logical records
- * @info: associated profiling data
- * @record: record type
- * @function: function number
- * @type: counter type
- * @count: index into values array
- * @num_types: number of counter types
- * @type_info: helper array to get values-array offset for current function
- */
-struct gcov_iterator {
-    const struct gcov_info *info;
-
-    int record;
-    unsigned int function;
-    unsigned int type;
-    unsigned int count;
-
-    int num_types;
-    struct type_info type_info[GCOV_COUNTERS];
-};
-
-/* Mapping of logical record number to actual file content. */
-#define RECORD_FILE_MAGIC       0
-#define RECORD_GCOV_VERSION     1
-#define RECORD_TIME_STAMP       2
-#define RECORD_FUNCTION_TAG     3
-#define RECORD_FUNCTON_TAG_LEN  4
-#define RECORD_FUNCTION_IDENT   5
-#define RECORD_FUNCTION_CHECK   6
-#define RECORD_COUNT_TAG        7
-#define RECORD_COUNT_LEN        8
-#define RECORD_COUNT            9
-
-static int counter_active(const struct gcov_info *info, unsigned int type)
-{
-    return (1 << type) & info->ctr_mask;
-}
-
-static unsigned int num_counter_active(const struct gcov_info *info)
-{
-    unsigned int i;
-    unsigned int result = 0;
-
-    for ( i = 0; i < GCOV_COUNTERS; i++ )
-        if ( counter_active(info, i) )
-            result++;
-
-    return result;
-}
-
-void gcov_info_link(struct gcov_info *info)
-{
-    info->next = gcov_info_head;
-    gcov_info_head = info;
-}
-
-struct gcov_info *gcov_info_next(const struct gcov_info *info)
-{
-    if ( !info )
-        return gcov_info_head;
-
-    return info->next;
-}
-
-const char *gcov_info_filename(const struct gcov_info *info)
-{
-    return info->filename;
-}
-
-void gcov_info_reset(struct gcov_info *info)
-{
-    unsigned int active = num_counter_active(info);
-    unsigned int i;
-
-    for ( i = 0; i < active; i++ )
-        memset(info->counts[i].values, 0,
-               info->counts[i].num * sizeof(gcov_type));
-}
-
-static size_t get_fn_size(const struct gcov_info *info)
-{
-    size_t size;
-
-    size = sizeof(struct gcov_fn_info) + num_counter_active(info) *
-        sizeof(unsigned int);
-    if ( __alignof__(struct gcov_fn_info) > sizeof(unsigned int) )
-        size = ROUNDUP(size, __alignof__(struct gcov_fn_info));
-    return size;
-}
-
-static struct gcov_fn_info *get_fn_info(const struct gcov_info *info,
-                                        unsigned int fn)
-{
-    return (struct gcov_fn_info *)
-        ((char *) info->functions + fn * get_fn_size(info));
-}
-
-static struct gcov_fn_info *get_func(struct gcov_iterator *iter)
-{
-    return get_fn_info(iter->info, iter->function);
-}
-
-static struct type_info *get_type(struct gcov_iterator *iter)
-{
-    return &iter->type_info[iter->type];
-}
-
-/**
- * gcov_iter_next - advance file iterator to next logical record
- * @iter: file iterator
- *
- * Return zero if new position is valid, non-zero if iterator has reached end.
- */
-static int gcov_iter_next(struct gcov_iterator *iter)
-{
-    switch ( iter->record )
-    {
-    case RECORD_FILE_MAGIC:
-    case RECORD_GCOV_VERSION:
-    case RECORD_FUNCTION_TAG:
-    case RECORD_FUNCTON_TAG_LEN:
-    case RECORD_FUNCTION_IDENT:
-    case RECORD_COUNT_TAG:
-        /* Advance to next record */
-        iter->record++;
-        break;
-    case RECORD_COUNT:
-        /* Advance to next count */
-        iter->count++;
-        /* fall through */
-    case RECORD_COUNT_LEN:
-        if ( iter->count < get_func(iter)->n_ctrs[iter->type] )
-        {
-            iter->record = 9;
-            break;
-        }
-        /* Advance to next counter type */
-        get_type(iter)->offset += iter->count;
-        iter->count = 0;
-        iter->type++;
-        /* fall through */
-    case RECORD_FUNCTION_CHECK:
-        if ( iter->type < iter->num_types )
-        {
-            iter->record = 7;
-            break;
-        }
-        /* Advance to next function */
-        iter->type = 0;
-        iter->function++;
-        /* fall through */
-    case RECORD_TIME_STAMP:
-        if ( iter->function < iter->info->n_functions )
-            iter->record = 3;
-        else
-            iter->record = -1;
-        break;
-    }
-    /* Check for EOF. */
-    if ( iter->record == -1 )
-        return -EINVAL;
-    else
-        return 0;
-}
-
-/**
- * gcov_iter_write - write data to buffer
- * @iter: file iterator
- * @buf: buffer to write to, if it is NULL, nothing is written
- * @pos: position inside buffer to start writing
- *
- * Return number of bytes written into buffer.
- */
-static size_t gcov_iter_write(struct gcov_iterator *iter, char *buf,
-                              size_t pos)
-{
-    size_t ret = 0;
-
-    switch ( iter->record )
-    {
-    case RECORD_FILE_MAGIC:
-        ret = gcov_store_uint32(buf, pos, GCOV_DATA_MAGIC);
-        break;
-    case RECORD_GCOV_VERSION:
-        ret = gcov_store_uint32(buf, pos, iter->info->version);
-        break;
-    case RECORD_TIME_STAMP:
-        ret = gcov_store_uint32(buf, pos, iter->info->stamp);
-        break;
-    case RECORD_FUNCTION_TAG:
-        ret = gcov_store_uint32(buf, pos, GCOV_TAG_FUNCTION);
-        break;
-    case RECORD_FUNCTON_TAG_LEN:
-        ret = gcov_store_uint32(buf, pos, 2);
-        break;
-    case RECORD_FUNCTION_IDENT:
-        ret = gcov_store_uint32(buf, pos, get_func(iter)->ident);
-        break;
-    case RECORD_FUNCTION_CHECK:
-        ret = gcov_store_uint32(buf, pos, get_func(iter)->checksum);
-        break;
-    case RECORD_COUNT_TAG:
-        ret = gcov_store_uint32(buf, pos,
-                                GCOV_TAG_FOR_COUNTER(get_type(iter)->ctr_type));
-        break;
-    case RECORD_COUNT_LEN:
-        ret = gcov_store_uint32(buf, pos,
-                                get_func(iter)->n_ctrs[iter->type] * 2);
-        break;
-    case RECORD_COUNT:
-        ret = gcov_store_uint64(buf, pos, iter->info->counts[iter->type].
-                                values[iter->count + get_type(iter)->offset]);
-        break;
-    }
-
-    return ret;
-}
-
-/* If buffer is NULL, no data is written. */
-size_t gcov_info_to_gcda(char *buffer, const struct gcov_info *info)
-{
-    struct gcov_iterator iter = { .info = info };
-    unsigned int i;
-    size_t pos = 0;
-
-    for ( i = 0; i < GCOV_COUNTERS; i++ )
-    {
-        if ( counter_active(info, i) )
-        {
-            iter.type_info[iter.num_types].ctr_type = i;
-            iter.type_info[iter.num_types].offset = 0;
-            iter.num_types++;
-        }
-    }
-
-    do {
-        pos += gcov_iter_write(&iter, buffer, pos);
-    } while ( gcov_iter_next(&iter) == 0 );
-
-    return pos;
-}
-
-/*
- * Local variables:
- * mode: C
- * c-file-style: "BSD"
- * c-basic-offset: 4
- * tab-width: 4
- * indent-tabs-mode: nil
- * End:
- */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Mar 19 13:33:13 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 19 Mar 2026 13:33:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1257186.1551634 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w3DUv-00023U-PY; Thu, 19 Mar 2026 13:33:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1257186.1551634; Thu, 19 Mar 2026 13:33:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w3DUv-00023M-N5; Thu, 19 Mar 2026 13:33:13 +0000
Received: by outflank-mailman (input) for mailman id 1257186;
 Thu, 19 Mar 2026 13:33:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w3DUt-00023C-VS
 for xen-changelog@lists.xenproject.org; Thu, 19 Mar 2026 13:33:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w3DUu-00GUgG-0V
 for xen-changelog@lists.xenproject.org;
 Thu, 19 Mar 2026 13:33:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w3DUt-00HIHS-2w
 for xen-changelog@lists.xenproject.org;
 Thu, 19 Mar 2026 13:33:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=YtI7NZX52kFj4K2lXfMo+5GYhOP2xwlFFMqkHJCgvHo=; b=KJgemjDfRVC1GtNFcJs6bFq27+
	2Dx8jWBQi4cKsEX/3xSqXRtjAYQST2Hhp+tGuDdYVN3oFjrvDMHILGH710ul4RbvtPvoryvZJOofN
	qnlW/kLLZ8eZk39MEcu0xM3+jLqW0kNUY/jJ98ipSxq66brrnY6JSHwqFDv8Cja/XvPQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/ucode: Exclude Zen6 from entrysign mitigations
Message-Id: <E1w3DUt-00HIHS-2w@xenbits.xenproject.org>
Date: Thu, 19 Mar 2026 13:33:11 +0000

commit bd15fdedafb3a414aeafa918a9212148ac22ebb5
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Mar 16 10:34:23 2026 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Mar 19 13:20:30 2026 +0000

    x86/ucode: Exclude Zen6 from entrysign mitigations
    
    Family 0x1a covers both Zen5 and Zen6, but the latter is not believed to be
    vulnerable to entrysign.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/cpu/microcode/amd.c | 6 ++++--
 xen/arch/x86/include/asm/amd.h   | 4 ++++
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/cpu/microcode/amd.c b/xen/arch/x86/cpu/microcode/amd.c
index 90f10ac8be..2ba1fa825f 100644
--- a/xen/arch/x86/cpu/microcode/amd.c
+++ b/xen/arch/x86/cpu/microcode/amd.c
@@ -20,6 +20,7 @@
 #include <xen/mm.h> /* TODO: Fix asm/tlbflush.h breakage */
 #include <xen/sha2.h>
 
+#include <asm/amd.h>
 #include <asm/msr.h>
 
 #include "private.h"
@@ -576,7 +577,7 @@ void __init ucode_probe_amd(struct microcode_ops *ops)
      */
     if ( IS_ENABLED(CONFIG_MICROCODE_LOADING) &&
          boot_cpu_data.family >= 0x17 && boot_cpu_data.family <= 0x1a &&
-         !opt_digest_check )
+         !is_zen6_uarch() && !opt_digest_check )
     {
         printk(XENLOG_WARNING
                "Microcode patch additional digest checks disabled\n");
@@ -618,7 +619,8 @@ void __init amd_check_entrysign(void)
     if ( !IS_ENABLED(CONFIG_MICROCODE_LOADING)  ||
          boot_cpu_data.vendor != X86_VENDOR_AMD ||
          boot_cpu_data.family < 0x17            ||
-         boot_cpu_data.family > 0x1a )
+         boot_cpu_data.family > 0x1a            ||
+         is_zen6_uarch() )
         return;
 
     /*
diff --git a/xen/arch/x86/include/asm/amd.h b/xen/arch/x86/include/asm/amd.h
index 4036dd5498..d21df0741a 100644
--- a/xen/arch/x86/include/asm/amd.h
+++ b/xen/arch/x86/include/asm/amd.h
@@ -59,6 +59,8 @@
  * For Zen3 and Zen4 (Fam19h) the heuristic is the presence of AutoIBRS, as
  * it's Zen4-specific.
  *
+ * For Zen5 and Zen6 (Fam1ah) the heuristic is the presence of FRED.
+ *
  * The caller is required to perform the appropriate vendor/family checks
  * first.
  */
@@ -66,6 +68,8 @@
 #define is_zen2_uarch()   boot_cpu_has(X86_FEATURE_AMD_STIBP)
 #define is_zen3_uarch() (!boot_cpu_has(X86_FEATURE_AUTO_IBRS))
 #define is_zen4_uarch()   boot_cpu_has(X86_FEATURE_AUTO_IBRS)
+#define is_zen5_uarch() (!boot_cpu_has(X86_FEATURE_FRED))
+#define is_zen6_uarch()   boot_cpu_has(X86_FEATURE_FRED)
 
 struct cpuinfo_x86;
 int cpu_has_amd_erratum(const struct cpuinfo_x86 *cpu, int osvw_id, ...);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Mar 19 15:22:07 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 19 Mar 2026 15:22:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1257314.1551729 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w3FCG-0006eo-AY; Thu, 19 Mar 2026 15:22:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1257314.1551729; Thu, 19 Mar 2026 15:22:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w3FCG-0006ef-7X; Thu, 19 Mar 2026 15:22:04 +0000
Received: by outflank-mailman (input) for mailman id 1257314;
 Thu, 19 Mar 2026 15:22:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w3FCE-0006eZ-Fv
 for xen-changelog@lists.xenproject.org; Thu, 19 Mar 2026 15:22:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w3FCE-00GWqI-22
 for xen-changelog@lists.xenproject.org;
 Thu, 19 Mar 2026 15:22:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w3FCE-00HPmx-1D
 for xen-changelog@lists.xenproject.org;
 Thu, 19 Mar 2026 15:22:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=XNgxghh9iMFHput2nKMzAfwo0TSXfoSWEcsGxehFsys=; b=tPE4ifCKWYyuGoqXMIveUK+q9N
	33TtyzksgSdDpFW93jsKcv+jeGfg/Exv/lwtLkQXAT9XH+xG6A8L8HMEoMfq96+xYk5xyfwhJfgdf
	FqX0ZDMwgSKf0aXtOmyzI5KwZR0bEtYYJp7dr7qqPGrzbcO4TPm4scMP9W1cXEl1f9AA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/coverage: Drop support for older GCOV
Message-Id: <E1w3FCE-00HPmx-1D@xenbits.xenproject.org>
Date: Thu, 19 Mar 2026 15:22:02 +0000

commit 6db6211942742dda4b3eef8630f6fc7e692132ba
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Mar 16 23:46:28 2026 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Mar 19 13:20:30 2026 +0000

    xen/coverage: Drop support for older GCOV
    
    With the GCC toolchain baseline now at 5.1, gcc_3_4.o (covering 3.4 through
    4.6) will never get chosen.  Drop it.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Michal Orzel <michal.orzel@amd.com>
---
 xen/common/coverage/Makefile  |   2 +-
 xen/common/coverage/gcc_3_4.c | 367 ------------------------------------------
 2 files changed, 1 insertion(+), 368 deletions(-)

diff --git a/xen/common/coverage/Makefile b/xen/common/coverage/Makefile
index d729afc9c7..26bc1b7c04 100644
--- a/xen/common/coverage/Makefile
+++ b/xen/common/coverage/Makefile
@@ -1,7 +1,7 @@
 obj-y += coverage.o
 ifneq ($(CONFIG_CC_IS_CLANG),y)
 obj-y += gcov_base.o gcov.o
-obj-y += $(call cc-ifversion,-lt,0407, gcc_3_4.o, gcc_4_7.o)
+obj-y += gcc_4_7.o
 else
 obj-y += llvm.o
 endif
diff --git a/xen/common/coverage/gcc_3_4.c b/xen/common/coverage/gcc_3_4.c
deleted file mode 100644
index 3631f4bc25..0000000000
--- a/xen/common/coverage/gcc_3_4.c
+++ /dev/null
@@ -1,367 +0,0 @@
-/*
- *  This code provides functions to handle gcc's profiling data format
- *  introduced with gcc 3.4. Future versions of gcc may change the gcov
- *  format (as happened before), so all format-specific information needs
- *  to be kept modular and easily exchangeable.
- *
- *  This file is based on gcc-internal definitions. Functions and data
- *  structures are defined to be compatible with gcc counterparts.
- *  For a better understanding, refer to gcc source: gcc/gcov-io.h.
- *
- *    Copyright IBM Corp. 2009
- *    Author(s): Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
- *
- *    Uses gcc-internal data definitions.
- *
- *  Imported from Linux and modified for Xen by
- *    Wei Liu <wei.liu2@citrix.com>
- */
-
-
-#include <xen/lib.h>
-
-#include "gcov.h"
-
-#if !(GCC_VERSION >= 30400 && GCC_VERSION < 40700)
-#error "Wrong version of GCC used to compile gcov"
-#endif
-
-#define GCOV_COUNTERS 5
-
-static struct gcov_info *gcov_info_head;
-
-/**
- * struct gcov_fn_info - profiling meta data per function
- * @ident: object file-unique function identifier
- * @checksum: function checksum
- * @n_ctrs: number of values per counter type belonging to this function
- *
- * This data is generated by gcc during compilation and doesn't change
- * at run-time.
- */
-struct gcov_fn_info
-{
-    unsigned int ident;
-    unsigned int checksum;
-    unsigned int n_ctrs[0];
-};
-
-/**
- * struct gcov_ctr_info - profiling data per counter type
- * @num: number of counter values for this type
- * @values: array of counter values for this type
- * @merge: merge function for counter values of this type (unused)
- *
- * This data is generated by gcc during compilation and doesn't change
- * at run-time with the exception of the values array.
- */
-struct gcov_ctr_info
-{
-    unsigned int num;
-    gcov_type *values;
-    void (*merge)(gcov_type *, unsigned int);
-};
-
-/**
- * struct gcov_info - profiling data per object file
- * @version: gcov version magic indicating the gcc version used for compilation
- * @next: list head for a singly-linked list
- * @stamp: time stamp
- * @filename: name of the associated gcov data file
- * @n_functions: number of instrumented functions
- * @functions: function data
- * @ctr_mask: mask specifying which counter types are active
- * @counts: counter data per counter type
- *
- * This data is generated by gcc during compilation and doesn't change
- * at run-time with the exception of the next pointer.
- */
-struct gcov_info
-{
-    unsigned int              version;
-    struct gcov_info          *next;
-    unsigned int              stamp;
-    const char                *filename;
-    unsigned int              n_functions;
-    const struct gcov_fn_info *functions;
-    unsigned int              ctr_mask;
-    struct gcov_ctr_info      counts[0];
-};
-
-/**
- * struct type_info - iterator helper array
- * @ctr_type: counter type
- * @offset: index of the first value of the current function for this type
- *
- * This array is needed to convert the in-memory data format into the in-file
- * data format:
- *
- * In-memory:
- *   for each counter type
- *     for each function
- *       values
- *
- * In-file:
- *   for each function
- *     for each counter type
- *       values
- *
- * See gcc source gcc/gcov-io.h for more information on data organization.
- */
-struct type_info {
-    int ctr_type;
-    unsigned int offset;
-};
-
-/**
- * struct gcov_iterator - specifies current file position in logical records
- * @info: associated profiling data
- * @record: record type
- * @function: function number
- * @type: counter type
- * @count: index into values array
- * @num_types: number of counter types
- * @type_info: helper array to get values-array offset for current function
- */
-struct gcov_iterator {
-    const struct gcov_info *info;
-
-    int record;
-    unsigned int function;
-    unsigned int type;
-    unsigned int count;
-
-    int num_types;
-    struct type_info type_info[GCOV_COUNTERS];
-};
-
-/* Mapping of logical record number to actual file content. */
-#define RECORD_FILE_MAGIC       0
-#define RECORD_GCOV_VERSION     1
-#define RECORD_TIME_STAMP       2
-#define RECORD_FUNCTION_TAG     3
-#define RECORD_FUNCTON_TAG_LEN  4
-#define RECORD_FUNCTION_IDENT   5
-#define RECORD_FUNCTION_CHECK   6
-#define RECORD_COUNT_TAG        7
-#define RECORD_COUNT_LEN        8
-#define RECORD_COUNT            9
-
-static int counter_active(const struct gcov_info *info, unsigned int type)
-{
-    return (1 << type) & info->ctr_mask;
-}
-
-static unsigned int num_counter_active(const struct gcov_info *info)
-{
-    unsigned int i;
-    unsigned int result = 0;
-
-    for ( i = 0; i < GCOV_COUNTERS; i++ )
-        if ( counter_active(info, i) )
-            result++;
-
-    return result;
-}
-
-void gcov_info_link(struct gcov_info *info)
-{
-    info->next = gcov_info_head;
-    gcov_info_head = info;
-}
-
-struct gcov_info *gcov_info_next(const struct gcov_info *info)
-{
-    if ( !info )
-        return gcov_info_head;
-
-    return info->next;
-}
-
-const char *gcov_info_filename(const struct gcov_info *info)
-{
-    return info->filename;
-}
-
-void gcov_info_reset(struct gcov_info *info)
-{
-    unsigned int active = num_counter_active(info);
-    unsigned int i;
-
-    for ( i = 0; i < active; i++ )
-        memset(info->counts[i].values, 0,
-               info->counts[i].num * sizeof(gcov_type));
-}
-
-static size_t get_fn_size(const struct gcov_info *info)
-{
-    size_t size;
-
-    size = sizeof(struct gcov_fn_info) + num_counter_active(info) *
-        sizeof(unsigned int);
-    if ( __alignof__(struct gcov_fn_info) > sizeof(unsigned int) )
-        size = ROUNDUP(size, __alignof__(struct gcov_fn_info));
-    return size;
-}
-
-static struct gcov_fn_info *get_fn_info(const struct gcov_info *info,
-                                        unsigned int fn)
-{
-    return (struct gcov_fn_info *)
-        ((char *) info->functions + fn * get_fn_size(info));
-}
-
-static struct gcov_fn_info *get_func(struct gcov_iterator *iter)
-{
-    return get_fn_info(iter->info, iter->function);
-}
-
-static struct type_info *get_type(struct gcov_iterator *iter)
-{
-    return &iter->type_info[iter->type];
-}
-
-/**
- * gcov_iter_next - advance file iterator to next logical record
- * @iter: file iterator
- *
- * Return zero if new position is valid, non-zero if iterator has reached end.
- */
-static int gcov_iter_next(struct gcov_iterator *iter)
-{
-    switch ( iter->record )
-    {
-    case RECORD_FILE_MAGIC:
-    case RECORD_GCOV_VERSION:
-    case RECORD_FUNCTION_TAG:
-    case RECORD_FUNCTON_TAG_LEN:
-    case RECORD_FUNCTION_IDENT:
-    case RECORD_COUNT_TAG:
-        /* Advance to next record */
-        iter->record++;
-        break;
-    case RECORD_COUNT:
-        /* Advance to next count */
-        iter->count++;
-        /* fall through */
-    case RECORD_COUNT_LEN:
-        if ( iter->count < get_func(iter)->n_ctrs[iter->type] )
-        {
-            iter->record = 9;
-            break;
-        }
-        /* Advance to next counter type */
-        get_type(iter)->offset += iter->count;
-        iter->count = 0;
-        iter->type++;
-        /* fall through */
-    case RECORD_FUNCTION_CHECK:
-        if ( iter->type < iter->num_types )
-        {
-            iter->record = 7;
-            break;
-        }
-        /* Advance to next function */
-        iter->type = 0;
-        iter->function++;
-        /* fall through */
-    case RECORD_TIME_STAMP:
-        if ( iter->function < iter->info->n_functions )
-            iter->record = 3;
-        else
-            iter->record = -1;
-        break;
-    }
-    /* Check for EOF. */
-    if ( iter->record == -1 )
-        return -EINVAL;
-    else
-        return 0;
-}
-
-/**
- * gcov_iter_write - write data to buffer
- * @iter: file iterator
- * @buf: buffer to write to, if it is NULL, nothing is written
- * @pos: position inside buffer to start writing
- *
- * Return number of bytes written into buffer.
- */
-static size_t gcov_iter_write(struct gcov_iterator *iter, char *buf,
-                              size_t pos)
-{
-    size_t ret = 0;
-
-    switch ( iter->record )
-    {
-    case RECORD_FILE_MAGIC:
-        ret = gcov_store_uint32(buf, pos, GCOV_DATA_MAGIC);
-        break;
-    case RECORD_GCOV_VERSION:
-        ret = gcov_store_uint32(buf, pos, iter->info->version);
-        break;
-    case RECORD_TIME_STAMP:
-        ret = gcov_store_uint32(buf, pos, iter->info->stamp);
-        break;
-    case RECORD_FUNCTION_TAG:
-        ret = gcov_store_uint32(buf, pos, GCOV_TAG_FUNCTION);
-        break;
-    case RECORD_FUNCTON_TAG_LEN:
-        ret = gcov_store_uint32(buf, pos, 2);
-        break;
-    case RECORD_FUNCTION_IDENT:
-        ret = gcov_store_uint32(buf, pos, get_func(iter)->ident);
-        break;
-    case RECORD_FUNCTION_CHECK:
-        ret = gcov_store_uint32(buf, pos, get_func(iter)->checksum);
-        break;
-    case RECORD_COUNT_TAG:
-        ret = gcov_store_uint32(buf, pos,
-                                GCOV_TAG_FOR_COUNTER(get_type(iter)->ctr_type));
-        break;
-    case RECORD_COUNT_LEN:
-        ret = gcov_store_uint32(buf, pos,
-                                get_func(iter)->n_ctrs[iter->type] * 2);
-        break;
-    case RECORD_COUNT:
-        ret = gcov_store_uint64(buf, pos, iter->info->counts[iter->type].
-                                values[iter->count + get_type(iter)->offset]);
-        break;
-    }
-
-    return ret;
-}
-
-/* If buffer is NULL, no data is written. */
-size_t gcov_info_to_gcda(char *buffer, const struct gcov_info *info)
-{
-    struct gcov_iterator iter = { .info = info };
-    unsigned int i;
-    size_t pos = 0;
-
-    for ( i = 0; i < GCOV_COUNTERS; i++ )
-    {
-        if ( counter_active(info, i) )
-        {
-            iter.type_info[iter.num_types].ctr_type = i;
-            iter.type_info[iter.num_types].offset = 0;
-            iter.num_types++;
-        }
-    }
-
-    do {
-        pos += gcov_iter_write(&iter, buffer, pos);
-    } while ( gcov_iter_next(&iter) == 0 );
-
-    return pos;
-}
-
-/*
- * Local variables:
- * mode: C
- * c-file-style: "BSD"
- * c-basic-offset: 4
- * tab-width: 4
- * indent-tabs-mode: nil
- * End:
- */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Mar 19 15:22:14 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 19 Mar 2026 15:22:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1257316.1551733 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w3FCQ-0006h3-Cc; Thu, 19 Mar 2026 15:22:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1257316.1551733; Thu, 19 Mar 2026 15:22:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w3FCQ-0006gv-A5; Thu, 19 Mar 2026 15:22:14 +0000
Received: by outflank-mailman (input) for mailman id 1257316;
 Thu, 19 Mar 2026 15:22:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w3FCO-0006gf-Hw
 for xen-changelog@lists.xenproject.org; Thu, 19 Mar 2026 15:22:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w3FCO-00GWqP-2N
 for xen-changelog@lists.xenproject.org;
 Thu, 19 Mar 2026 15:22:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w3FCO-00HPnt-1Y
 for xen-changelog@lists.xenproject.org;
 Thu, 19 Mar 2026 15:22:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=n7ZiMwan7oM45VkwuL9wnoNb6DSO1wO6X9SOHyEBLDg=; b=fvUKddIzHWivU64LgQx3qhUX/B
	uNa6q8PX9rlNiQyOVodC07AHE8Z8gNq8cJcKUMQqBN05LIytQkYoruTUhobqZWV1DQHH/Dk8RLuZ7
	NwjNg658T5nZXAao6kfzpIVMOyruF3akPKzo82De9fsYsFnP/SfZnp1OWSaw9zk/EJe8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/ucode: Exclude Zen6 from entrysign mitigations
Message-Id: <E1w3FCO-00HPnt-1Y@xenbits.xenproject.org>
Date: Thu, 19 Mar 2026 15:22:12 +0000

commit bd15fdedafb3a414aeafa918a9212148ac22ebb5
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Mar 16 10:34:23 2026 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Mar 19 13:20:30 2026 +0000

    x86/ucode: Exclude Zen6 from entrysign mitigations
    
    Family 0x1a covers both Zen5 and Zen6, but the latter is not believed to be
    vulnerable to entrysign.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/cpu/microcode/amd.c | 6 ++++--
 xen/arch/x86/include/asm/amd.h   | 4 ++++
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/cpu/microcode/amd.c b/xen/arch/x86/cpu/microcode/amd.c
index 90f10ac8be..2ba1fa825f 100644
--- a/xen/arch/x86/cpu/microcode/amd.c
+++ b/xen/arch/x86/cpu/microcode/amd.c
@@ -20,6 +20,7 @@
 #include <xen/mm.h> /* TODO: Fix asm/tlbflush.h breakage */
 #include <xen/sha2.h>
 
+#include <asm/amd.h>
 #include <asm/msr.h>
 
 #include "private.h"
@@ -576,7 +577,7 @@ void __init ucode_probe_amd(struct microcode_ops *ops)
      */
     if ( IS_ENABLED(CONFIG_MICROCODE_LOADING) &&
          boot_cpu_data.family >= 0x17 && boot_cpu_data.family <= 0x1a &&
-         !opt_digest_check )
+         !is_zen6_uarch() && !opt_digest_check )
     {
         printk(XENLOG_WARNING
                "Microcode patch additional digest checks disabled\n");
@@ -618,7 +619,8 @@ void __init amd_check_entrysign(void)
     if ( !IS_ENABLED(CONFIG_MICROCODE_LOADING)  ||
          boot_cpu_data.vendor != X86_VENDOR_AMD ||
          boot_cpu_data.family < 0x17            ||
-         boot_cpu_data.family > 0x1a )
+         boot_cpu_data.family > 0x1a            ||
+         is_zen6_uarch() )
         return;
 
     /*
diff --git a/xen/arch/x86/include/asm/amd.h b/xen/arch/x86/include/asm/amd.h
index 4036dd5498..d21df0741a 100644
--- a/xen/arch/x86/include/asm/amd.h
+++ b/xen/arch/x86/include/asm/amd.h
@@ -59,6 +59,8 @@
  * For Zen3 and Zen4 (Fam19h) the heuristic is the presence of AutoIBRS, as
  * it's Zen4-specific.
  *
+ * For Zen5 and Zen6 (Fam1ah) the heuristic is the presence of FRED.
+ *
  * The caller is required to perform the appropriate vendor/family checks
  * first.
  */
@@ -66,6 +68,8 @@
 #define is_zen2_uarch()   boot_cpu_has(X86_FEATURE_AMD_STIBP)
 #define is_zen3_uarch() (!boot_cpu_has(X86_FEATURE_AUTO_IBRS))
 #define is_zen4_uarch()   boot_cpu_has(X86_FEATURE_AUTO_IBRS)
+#define is_zen5_uarch() (!boot_cpu_has(X86_FEATURE_FRED))
+#define is_zen6_uarch()   boot_cpu_has(X86_FEATURE_FRED)
 
 struct cpuinfo_x86;
 int cpu_has_amd_erratum(const struct cpuinfo_x86 *cpu, int osvw_id, ...);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 20 11:22:12 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 20 Mar 2026 11:22:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1257999.1552205 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w3XvW-0004uB-Lc; Fri, 20 Mar 2026 11:22:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1257999.1552205; Fri, 20 Mar 2026 11:22:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w3XvW-0004tz-Ia; Fri, 20 Mar 2026 11:22:02 +0000
Received: by outflank-mailman (input) for mailman id 1257999;
 Fri, 20 Mar 2026 11:22:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w3XvV-0004tt-Q1
 for xen-changelog@lists.xenproject.org; Fri, 20 Mar 2026 11:22:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w3XvV-000WQv-34
 for xen-changelog@lists.xenproject.org;
 Fri, 20 Mar 2026 11:22:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w3XvV-002iGe-2C
 for xen-changelog@lists.xenproject.org;
 Fri, 20 Mar 2026 11:22:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=GXdnjoR2zNIMPRA0hvoRgRk/nokpCYS81+MukktrbAQ=; b=QNsp6KOn3lSqlf5Bry4/LpDfwu
	JtxeRciiZ5bwEm51HukSa79BMVKFLaBXZDGACPN4sLSUEEpFsnIymCxm7AfoF24cHe+GK2GP6e6Ft
	qJOs0FK7lxhIosI8nMsauqUdl+jBnMED+sdDvHtrGcJahkpkMG+91g2x0S6XFFdOMy+w=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: ffa: Add start_index to VM partinfo helper
Message-Id: <E1w3XvV-002iGe-2C@xenbits.xenproject.org>
Date: Fri, 20 Mar 2026 11:22:01 +0000

commit ed6787f6d2dc07837c003cce81e9bfa85fc13112
Author:     Bertrand Marquis <bertrand.marquis@arm.com>
AuthorDate: Tue Jan 27 16:09:45 2026 +0100
Commit:     Julien Grall <julien@xen.org>
CommitDate: Fri Mar 20 11:12:59 2026 +0000

    xen/arm: ffa: Add start_index to VM partinfo helper
    
    Windowed GET_REGS retrieval needs to emit VM entries starting from an
    arbitrary index, but ffa_get_vm_partinfo() always starts from index 0.
    
    Add a start_index parameter to ffa_get_vm_partinfo() and skip entries
    until the local index reaches start_index. Update
    ffa_handle_partition_info_get() to pass start_index=0 to preserve
    existing behavior.
    
    No functional changes.
    
    Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
    Acked-by: Julien Grall <julien@xen.org>
---
 xen/arch/arm/tee/ffa_partinfo.c | 61 +++++++++++++++++++++++------------------
 1 file changed, 35 insertions(+), 26 deletions(-)

diff --git a/xen/arch/arm/tee/ffa_partinfo.c b/xen/arch/arm/tee/ffa_partinfo.c
index fdb03dae9a..6a6f3ffb82 100644
--- a/xen/arch/arm/tee/ffa_partinfo.c
+++ b/xen/arch/arm/tee/ffa_partinfo.c
@@ -167,14 +167,15 @@ out:
     return ret;
 }
 
-static int32_t ffa_get_vm_partinfo(struct ffa_uuid uuid, uint32_t *vm_count,
-                                   void **dst_buf, void *end_buf,
-                                   uint32_t dst_size)
+static int32_t ffa_get_vm_partinfo(struct ffa_uuid uuid, uint32_t start_index,
+                                   uint32_t *vm_count, void **dst_buf,
+                                   void *end_buf, uint32_t dst_size)
 {
     struct domain *d = current->domain;
     struct ffa_ctx *curr_ctx = d->arch.tee;
     struct ffa_ctx *dest_ctx;
     uint32_t count = 0;
+    uint32_t idx = 0;
     int32_t ret = FFA_RET_OK;
     /*
      * We do not have UUID info for VMs so use the 1.0 structure so that we set
@@ -202,17 +203,21 @@ static int32_t ffa_get_vm_partinfo(struct ffa_uuid uuid, uint32_t *vm_count,
     if ( ACCESS_ONCE(curr_ctx->guest_vers) >= FFA_VERSION_1_2 )
     {
         /* Add caller VM information */
-        info.id = curr_ctx->ffa_id;
-        info.execution_context = curr_ctx->num_vcpus;
-        info.partition_properties = FFA_PART_VM_PROP;
-        if ( is_64bit_domain(d) )
-            info.partition_properties |= FFA_PART_PROP_AARCH64_STATE;
-
-        ret = ffa_copy_info(dst_buf, end_buf, &info, dst_size, sizeof(info));
-        if ( ret )
-            return ret;
+        if ( start_index == 0)
+        {
+            info.id = curr_ctx->ffa_id;
+            info.execution_context = curr_ctx->num_vcpus;
+            info.partition_properties = FFA_PART_VM_PROP;
+            if ( is_64bit_domain(d) )
+                info.partition_properties |= FFA_PART_PROP_AARCH64_STATE;
 
-        count++;
+            ret = ffa_copy_info(dst_buf, end_buf, &info, dst_size,
+                                sizeof(info));
+            if ( ret )
+                return ret;
+            count++;
+        }
+        idx++;
     }
 
     if ( IS_ENABLED(CONFIG_FFA_VM_TO_VM) )
@@ -231,21 +236,25 @@ static int32_t ffa_get_vm_partinfo(struct ffa_uuid uuid, uint32_t *vm_count,
             if ( dest_ctx == curr_ctx )
                 continue;
 
-            info.id = dest_ctx->ffa_id;
-            info.execution_context = dest_ctx->num_vcpus;
-            info.partition_properties = FFA_PART_VM_PROP;
-            if ( dest_ctx->is_64bit )
-                info.partition_properties |= FFA_PART_PROP_AARCH64_STATE;
-
-            ret = ffa_copy_info(dst_buf, end_buf, &info, dst_size,
-                                sizeof(info));
-            if ( ret )
+            if ( idx >= start_index )
             {
-                read_unlock(&ffa_ctx_list_rwlock);
-                return ret;
+                info.id = dest_ctx->ffa_id;
+                info.execution_context = dest_ctx->num_vcpus;
+                info.partition_properties = FFA_PART_VM_PROP;
+                if ( dest_ctx->is_64bit )
+                    info.partition_properties |= FFA_PART_PROP_AARCH64_STATE;
+
+                ret = ffa_copy_info(dst_buf, end_buf, &info, dst_size,
+                                    sizeof(info));
+                if ( ret )
+                {
+                    read_unlock(&ffa_ctx_list_rwlock);
+                    return ret;
+                }
+                count++;
             }
 
-            count++;
+            idx++;
         }
         read_unlock(&ffa_ctx_list_rwlock);
     }
@@ -355,7 +364,7 @@ void ffa_handle_partition_info_get(struct cpu_user_regs *regs)
             goto out_rx_release;
     }
 
-    ret = ffa_get_vm_partinfo(uuid, &ffa_vm_count, &dst_buf, end_buf,
+    ret = ffa_get_vm_partinfo(uuid, 0, &ffa_vm_count, &dst_buf, end_buf,
                               dst_size);
 
 out_rx_release:
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Mar 20 11:22:12 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 20 Mar 2026 11:22:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1258000.1552209 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w3Xvg-0004va-Md; Fri, 20 Mar 2026 11:22:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1258000.1552209; Fri, 20 Mar 2026 11:22:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w3Xvg-0004vS-Jy; Fri, 20 Mar 2026 11:22:12 +0000
Received: by outflank-mailman (input) for mailman id 1258000;
 Fri, 20 Mar 2026 11:22:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w3Xvf-0004v8-SR
 for xen-changelog@lists.xenproject.org; Fri, 20 Mar 2026 11:22:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w3Xvg-000WRR-0C
 for xen-changelog@lists.xenproject.org;
 Fri, 20 Mar 2026 11:22:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w3Xvf-002iKv-2Y
 for xen-changelog@lists.xenproject.org;
 Fri, 20 Mar 2026 11:22:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=8AZ7jFgJOd57/f+oFxV480Mz5ClSAZTR/qa5K24y5z4=; b=XuJFpVrvSMRmnEPcoFb/9bjiTN
	n1wXT6EuDKqjGaxsASuGywdGdcf6anQxqBHN2UrJDJldQnceB14WTdWmqVE+RprhFcJccgvfuivvV
	sP3C8t0mnPnDgf/iJBac4Syk5TdKUgsGUCgz9FqHDPtThYa4yQZ0+ZgOGsw1+L1D62RM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: ffa: Cache SP partition info at init
Message-Id: <E1w3Xvf-002iKv-2Y@xenbits.xenproject.org>
Date: Fri, 20 Mar 2026 11:22:11 +0000

commit cca899b3800e43a080afa1d982d1ae94b87e1dfa
Author:     Bertrand Marquis <bertrand.marquis@arm.com>
AuthorDate: Fri Feb 13 11:52:12 2026 +0100
Commit:     Julien Grall <julien@xen.org>
CommitDate: Fri Mar 20 11:14:15 2026 +0000

    xen/arm: ffa: Cache SP partition info at init
    
    FFA_PARTITION_INFO_GET currently queries the SPMC on each call and walks the
    RX buffer every time. The SP list is expected to be static, so repeated
    firmware calls and validation are unnecessary.
    
    Cache the SPMC partition-info list at init time, keeping only secure
    endpoints, and reuse the cached entries for SP count and partition-info
    responses. Initialize the VM create/destroy subscriber lists from the cached
    list and free the cache on init failure.
    
    SP partition info now reflects the init-time snapshot and will not change.
    
    Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
    Acked-by: Julien Grall <julien@xen.org>
---
 xen/arch/arm/tee/ffa_partinfo.c | 216 +++++++++++++++++++++++++++-------------
 1 file changed, 146 insertions(+), 70 deletions(-)

diff --git a/xen/arch/arm/tee/ffa_partinfo.c b/xen/arch/arm/tee/ffa_partinfo.c
index 6a6f3ffb82..b933becaa5 100644
--- a/xen/arch/arm/tee/ffa_partinfo.c
+++ b/xen/arch/arm/tee/ffa_partinfo.c
@@ -6,6 +6,8 @@
 #include <xen/const.h>
 #include <xen/sizes.h>
 #include <xen/types.h>
+#include <xen/unaligned.h>
+#include <xen/xmalloc.h>
 
 #include <asm/smccc.h>
 #include <asm/regs.h>
@@ -33,6 +35,10 @@ static uint16_t subscr_vm_created_count __read_mostly;
 static uint16_t *subscr_vm_destroyed __read_mostly;
 static uint16_t subscr_vm_destroyed_count __read_mostly;
 
+/* SP list cache (secure endpoints only); populated at init. */
+static void *sp_list __read_mostly;
+static uint32_t sp_list_count __read_mostly;
+static uint32_t sp_list_entry_size __read_mostly;
 static int32_t ffa_partition_info_get(struct ffa_uuid uuid, uint32_t flags,
                                       uint32_t *count, uint32_t *fpi_size)
 {
@@ -79,92 +85,84 @@ static int32_t ffa_copy_info(void **dst, void *dst_end, const void *src,
     return FFA_RET_OK;
 }
 
-static int32_t ffa_get_sp_count(struct ffa_uuid uuid, uint32_t *sp_count)
+static uint16_t ffa_sp_entry_read_id(const void *entry)
 {
-    uint32_t src_size;
-
-    return ffa_partition_info_get(uuid, FFA_PARTITION_INFO_GET_COUNT_FLAG,
-                                  sp_count, &src_size);
+    return get_unaligned_t(uint16_t,
+                           (const uint8_t *)entry +
+                           offsetof(struct ffa_partition_info_1_0, id));
 }
 
-static int32_t ffa_get_sp_partinfo(struct ffa_uuid uuid, uint32_t *sp_count,
-                                   void **dst_buf, void *end_buf,
-                                   uint32_t dst_size)
+static bool ffa_sp_entry_matches_uuid(const void *entry, struct ffa_uuid uuid)
 {
-    int32_t ret;
-    int32_t release_ret;
-    uint32_t src_size, real_sp_count;
-    void *src_buf;
-    uint32_t count = 0;
-    bool notify_fw = false;
+    struct ffa_uuid sp_uuid;
 
-    /* We need to use the RX buffer to receive the list */
-    src_buf = ffa_rxtx_spmc_rx_acquire();
-    if ( !src_buf )
-        return FFA_RET_DENIED;
+    if ( ffa_uuid_is_nil(uuid) )
+        return true;
 
-    ret = ffa_partition_info_get(uuid, 0, &real_sp_count, &src_size);
-    if ( ret )
-        goto out;
-    notify_fw = true;
+    memcpy(&sp_uuid,
+           (const uint8_t *)entry +
+           offsetof(struct ffa_partition_info_1_1, uuid),
+           sizeof(sp_uuid));
+    return ffa_uuid_equal(uuid, sp_uuid);
+}
 
-    /* Validate the src_size we got */
-    if ( src_size < sizeof(struct ffa_partition_info_1_0) ||
-         src_size >= FFA_PAGE_SIZE )
+static int32_t ffa_get_sp_count(struct ffa_uuid uuid, uint32_t *sp_count)
+{
+    uint32_t count = 0;
+    uint32_t n;
+
+    for ( n = 0; n < sp_list_count; n++ )
     {
-        ret = FFA_RET_NOT_SUPPORTED;
-        goto out;
+        void *entry = sp_list + n * sp_list_entry_size;
+
+        if ( ffa_sp_entry_matches_uuid(entry, uuid) )
+            count++;
     }
 
-    /*
-     * Limit the maximum time we hold the CPU by limiting the number of SPs.
-     * We just ignore the extra ones as this is tested during init in
-     * ffa_partinfo_init so the only possible reason is SP have been added
-     * since boot.
-     */
-    if ( real_sp_count > FFA_MAX_NUM_SP )
-        real_sp_count = FFA_MAX_NUM_SP;
+    *sp_count = count;
 
-    /* Make sure the data fits in our buffer */
-    if ( real_sp_count > (FFA_RXTX_PAGE_COUNT * FFA_PAGE_SIZE) / src_size )
-    {
-        ret = FFA_RET_NOT_SUPPORTED;
-        goto out;
-    }
+    if ( !ffa_uuid_is_nil(uuid) && !count )
+        return FFA_RET_INVALID_PARAMETERS;
 
-    for ( uint32_t sp_num = 0; sp_num < real_sp_count; sp_num++ )
-    {
-        struct ffa_partition_info_1_1 *fpi = src_buf;
+    return FFA_RET_OK;
+}
 
-        /* filter out SP not following bit 15 convention if any */
-        if ( FFA_ID_IS_SECURE(fpi->id) )
-        {
-            /*
-             * If VM is 1.0 but firmware is 1.1 we could have several entries
-             * with the same ID but different UUIDs. In this case the VM will
-             * get a list with several time the same ID.
-             * This is a non-compliance to the specification but 1.0 VMs should
-             * handle that on their own to simplify Xen implementation.
-             */
+static int32_t ffa_get_sp_partinfo(struct ffa_uuid uuid, uint32_t *sp_count,
+                                   void **dst_buf, void *end_buf,
+                                   uint32_t dst_size)
+{
+    int32_t ret;
+    uint32_t count = 0;
+    uint32_t n;
 
-            ret = ffa_copy_info(dst_buf, end_buf, src_buf, dst_size, src_size);
-            if ( ret )
-                goto out;
+    for ( n = 0; n < sp_list_count; n++ )
+    {
+        void *entry = sp_list + n * sp_list_entry_size;
 
-            count++;
-        }
+        if ( !ffa_sp_entry_matches_uuid(entry, uuid) )
+            continue;
+
+        /*
+         * If VM is 1.0 but firmware is 1.1 we could have several entries
+         * with the same ID but different UUIDs. In this case the VM will
+         * get a list with several time the same ID.
+         * This is a non-compliance to the specification but 1.0 VMs should
+         * handle that on their own to simplify Xen implementation.
+         */
+        ret = ffa_copy_info(dst_buf, end_buf, entry, dst_size,
+                            sp_list_entry_size);
+        if ( ret )
+            return ret;
 
-        src_buf += src_size;
+        count++;
     }
 
     *sp_count = count;
 
-out:
-    release_ret = ffa_rxtx_spmc_rx_release(notify_fw);
-    if ( release_ret )
-        gprintk(XENLOG_WARNING,
-                "ffa: Error releasing SPMC RX buffer: %d\n", release_ret);
-    return ret;
+    if ( !ffa_uuid_is_nil(uuid) && !count )
+        return FFA_RET_INVALID_PARAMETERS;
+
+    return FFA_RET_OK;
 }
 
 static int32_t ffa_get_vm_partinfo(struct ffa_uuid uuid, uint32_t start_index,
@@ -435,6 +433,13 @@ static int32_t ffa_direct_req_send_vm(uint16_t sp_id, uint16_t vm_id,
     return res;
 }
 
+static void ffa_sp_list_cache_free(void)
+{
+    XFREE(sp_list);
+    sp_list_count = 0;
+    sp_list_entry_size = 0;
+}
+
 static void uninit_subscribers(void)
 {
         subscr_vm_created_count = 0;
@@ -443,6 +448,63 @@ static void uninit_subscribers(void)
         XFREE(subscr_vm_destroyed);
 }
 
+static bool ffa_sp_list_cache_init(const void *buf, uint32_t count,
+                                   uint32_t fpi_size)
+{
+    const uint8_t *src = buf;
+    uint32_t secure_count = 0;
+    uint32_t n, idx = 0;
+
+    if ( fpi_size < sizeof(struct ffa_partition_info_1_1) ||
+         fpi_size >= FFA_PAGE_SIZE )
+        return false;
+
+    if ( count > (FFA_RXTX_PAGE_COUNT * FFA_PAGE_SIZE) / fpi_size )
+        return false;
+
+    for ( n = 0; n < count; n++ )
+    {
+        const uint8_t *entry = src + n * fpi_size;
+        uint16_t id = ffa_sp_entry_read_id(entry);
+
+        if ( !FFA_ID_IS_SECURE(id) )
+        {
+            printk_once(XENLOG_ERR
+                        "ffa: Firmware is not using bit 15 convention for IDs !!\n");
+            printk(XENLOG_ERR
+                   "ffa: Secure partition with id 0x%04x cannot be used\n",
+                   id);
+            continue;
+        }
+
+        secure_count++;
+    }
+
+    if ( secure_count )
+    {
+        sp_list = xzalloc_bytes(secure_count * fpi_size);
+        if ( !sp_list )
+            return false;
+    }
+
+    sp_list_count = secure_count;
+    sp_list_entry_size = fpi_size;
+
+    for ( n = 0; n < count; n++ )
+    {
+        const uint8_t *entry = src + n * fpi_size;
+        uint16_t id = ffa_sp_entry_read_id(entry);
+
+        if ( !FFA_ID_IS_SECURE(id) )
+            continue;
+
+        memcpy(sp_list + idx * fpi_size, entry, fpi_size);
+        idx++;
+    }
+
+    return true;
+}
+
 static bool init_subscribers(void *buf, uint16_t count, uint32_t fpi_size)
 {
     uint16_t n;
@@ -538,7 +600,7 @@ bool ffa_partinfo_init(void)
     if ( e )
     {
         printk(XENLOG_ERR "ffa: Failed to get list of SPs: %d\n", e);
-        goto out;
+        goto out_release_rx;
     }
     notify_fw = true;
 
@@ -546,15 +608,29 @@ bool ffa_partinfo_init(void)
     {
         printk(XENLOG_ERR "ffa: More SPs than the maximum supported: %u - %u\n",
                count, FFA_MAX_NUM_SP);
-        goto out;
+        goto out_release_rx;
+    }
+
+    if ( !ffa_sp_list_cache_init(spmc_rx, count, fpi_size) )
+    {
+        printk(XENLOG_ERR "ffa: Failed to cache SP list\n");
+        goto out_release_rx;
     }
 
-    ret = init_subscribers(spmc_rx, count, fpi_size);
+    if ( !init_subscribers(sp_list, sp_list_count, sp_list_entry_size) )
+        goto out_free_sp_cache;
 
-out:
+    ret = true;
+    goto out_release_rx;
+
+out_free_sp_cache:
+    ffa_sp_list_cache_free();
+
+out_release_rx:
     e = ffa_rxtx_spmc_rx_release(notify_fw);
     if ( e )
         printk(XENLOG_WARNING "ffa: Error releasing SPMC RX buffer: %d\n", e);
+
     return ret;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Mar 20 11:22:22 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 20 Mar 2026 11:22:22 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1258001.1552212 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w3Xvq-0004y6-O5; Fri, 20 Mar 2026 11:22:22 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1258001.1552212; Fri, 20 Mar 2026 11:22:22 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w3Xvq-0004xy-LP; Fri, 20 Mar 2026 11:22:22 +0000
Received: by outflank-mailman (input) for mailman id 1258001;
 Fri, 20 Mar 2026 11:22:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w3Xvp-0004xp-VO
 for xen-changelog@lists.xenproject.org; Fri, 20 Mar 2026 11:22:21 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w3Xvq-000WRb-0U
 for xen-changelog@lists.xenproject.org;
 Fri, 20 Mar 2026 11:22:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w3Xvp-002iOJ-2v
 for xen-changelog@lists.xenproject.org;
 Fri, 20 Mar 2026 11:22:21 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=WcpGSz+79qwWXBKx/qZ68RsrSQOWx3Q9Bqa5mVRAy7s=; b=YeOpzA7+w+8SHFzaKbk5nbk3i7
	+357bJjcgzGmf84yvNYWTz+g3gx8Tv4fYZ1Xt2/SDmOwcdSuiqXNNCo3B8uDDmKF0/MhpQlpefO6F
	YOHxyNQuMgeFG7MIAxwAyDSSjIjYmhgAWyX/0elFnI+rpvlR2rNvhI/9ju1j4yjzvLqs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: ffa: Drop SP subscriber lists
Message-Id: <E1w3Xvp-002iOJ-2v@xenbits.xenproject.org>
Date: Fri, 20 Mar 2026 11:22:21 +0000

commit 71518be79de043a5289e1689cf65caa9d7661b05
Author:     Bertrand Marquis <bertrand.marquis@arm.com>
AuthorDate: Fri Feb 13 11:57:14 2026 +0100
Commit:     Julien Grall <julien@xen.org>
CommitDate: Fri Mar 20 11:14:23 2026 +0000

    xen/arm: ffa: Drop SP subscriber lists
    
    The init-time SP cache already contains partition properties, but the
    code still builds separate subscriber arrays for VM created/destroyed
    notifications. That duplicates state and allocation.
    
    Use the cached SP list directly to:
    - decide which SPs receive created/destroyed notifications
    - build the per-domain destroy bitmap
    - skip destroy notifications for SPs not notified on create
    
    Also switch cached SP entry field reads in VM create/destroy
    notification paths to unaligned-safe helpers, as cache entries are
    variable-size and should not be dereferenced via struct pointers.
    
    No functional changes.
    
    Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
    Acked-by: Julien Grall <julien@xen.org>
---
 xen/arch/arm/tee/ffa_partinfo.c | 170 +++++++++++-----------------------------
 1 file changed, 47 insertions(+), 123 deletions(-)

diff --git a/xen/arch/arm/tee/ffa_partinfo.c b/xen/arch/arm/tee/ffa_partinfo.c
index b933becaa5..419e19510f 100644
--- a/xen/arch/arm/tee/ffa_partinfo.c
+++ b/xen/arch/arm/tee/ffa_partinfo.c
@@ -29,12 +29,6 @@ struct ffa_partition_info_1_1 {
     uint8_t uuid[16];
 };
 
-/* SPs subscribing to VM_CREATE and VM_DESTROYED events */
-static uint16_t *subscr_vm_created __read_mostly;
-static uint16_t subscr_vm_created_count __read_mostly;
-static uint16_t *subscr_vm_destroyed __read_mostly;
-static uint16_t subscr_vm_destroyed_count __read_mostly;
-
 /* SP list cache (secure endpoints only); populated at init. */
 static void *sp_list __read_mostly;
 static uint32_t sp_list_count __read_mostly;
@@ -92,6 +86,14 @@ static uint16_t ffa_sp_entry_read_id(const void *entry)
                            offsetof(struct ffa_partition_info_1_0, id));
 }
 
+static uint32_t ffa_sp_entry_read_partition_properties(const void *entry)
+{
+    return get_unaligned_t(uint32_t,
+                           (const uint8_t *)entry +
+                           offsetof(struct ffa_partition_info_1_0,
+                                    partition_properties));
+}
+
 static bool ffa_sp_entry_matches_uuid(const void *entry, struct ffa_uuid uuid)
 {
     struct ffa_uuid sp_uuid;
@@ -440,14 +442,6 @@ static void ffa_sp_list_cache_free(void)
     sp_list_entry_size = 0;
 }
 
-static void uninit_subscribers(void)
-{
-        subscr_vm_created_count = 0;
-        subscr_vm_destroyed_count = 0;
-        XFREE(subscr_vm_created);
-        XFREE(subscr_vm_destroyed);
-}
-
 static bool ffa_sp_list_cache_init(const void *buf, uint32_t count,
                                    uint32_t fpi_size)
 {
@@ -505,79 +499,6 @@ static bool ffa_sp_list_cache_init(const void *buf, uint32_t count,
     return true;
 }
 
-static bool init_subscribers(void *buf, uint16_t count, uint32_t fpi_size)
-{
-    uint16_t n;
-    uint16_t c_pos;
-    uint16_t d_pos;
-    struct ffa_partition_info_1_1 *fpi;
-
-    if ( fpi_size < sizeof(struct ffa_partition_info_1_1) )
-    {
-        printk(XENLOG_ERR "ffa: partition info size invalid: %u\n", fpi_size);
-        return false;
-    }
-
-    subscr_vm_created_count = 0;
-    subscr_vm_destroyed_count = 0;
-    for ( n = 0; n < count; n++ )
-    {
-        fpi = buf + n * fpi_size;
-
-        /*
-         * We need to have secure partitions using bit 15 set convention for
-         * secure partition IDs.
-         * Inform the user with a log and discard giving created or destroy
-         * event to those IDs.
-         */
-        if ( !FFA_ID_IS_SECURE(fpi->id) )
-        {
-            printk_once(XENLOG_ERR
-                        "ffa: Firmware is not using bit 15 convention for IDs !!\n");
-            printk(XENLOG_ERR
-                   "ffa: Secure partition with id 0x%04x cannot be used\n",
-                   fpi->id);
-        }
-        else
-        {
-            if ( fpi->partition_properties & FFA_PART_PROP_NOTIF_CREATED )
-                subscr_vm_created_count++;
-            if ( fpi->partition_properties & FFA_PART_PROP_NOTIF_DESTROYED )
-                subscr_vm_destroyed_count++;
-        }
-    }
-
-    if ( subscr_vm_created_count )
-        subscr_vm_created = xzalloc_array(uint16_t, subscr_vm_created_count);
-    if ( subscr_vm_destroyed_count )
-        subscr_vm_destroyed = xzalloc_array(uint16_t,
-                                            subscr_vm_destroyed_count);
-    if ( (subscr_vm_created_count && !subscr_vm_created) ||
-         (subscr_vm_destroyed_count && !subscr_vm_destroyed) )
-    {
-        printk(XENLOG_ERR "ffa: Failed to allocate subscription lists\n");
-        uninit_subscribers();
-        return false;
-    }
-
-    for ( c_pos = 0, d_pos = 0, n = 0; n < count; n++ )
-    {
-        fpi = buf + n * fpi_size;
-
-        if ( FFA_ID_IS_SECURE(fpi->id) )
-        {
-            if ( fpi->partition_properties & FFA_PART_PROP_NOTIF_CREATED )
-                subscr_vm_created[c_pos++] = fpi->id;
-            if ( fpi->partition_properties & FFA_PART_PROP_NOTIF_DESTROYED )
-                subscr_vm_destroyed[d_pos++] = fpi->id;
-        }
-    }
-
-    return true;
-}
-
-
-
 bool ffa_partinfo_init(void)
 {
     bool ret = false;
@@ -617,52 +538,39 @@ bool ffa_partinfo_init(void)
         goto out_release_rx;
     }
 
-    if ( !init_subscribers(sp_list, sp_list_count, sp_list_entry_size) )
-        goto out_free_sp_cache;
-
     ret = true;
     goto out_release_rx;
 
-out_free_sp_cache:
-    ffa_sp_list_cache_free();
-
 out_release_rx:
     e = ffa_rxtx_spmc_rx_release(notify_fw);
     if ( e )
         printk(XENLOG_WARNING "ffa: Error releasing SPMC RX buffer: %d\n", e);
-
+    if ( !ret )
+        ffa_sp_list_cache_free();
     return ret;
 }
 
-static bool is_in_subscr_list(const uint16_t *subscr, uint16_t start,
-                              uint16_t end, uint16_t sp_id)
+static void vm_destroy_bitmap_init(struct ffa_ctx *ctx,
+                                   unsigned int first_unnotified)
 {
     unsigned int n;
 
-    for ( n = start; n < end; n++ )
+    for ( n = 0; n < sp_list_count; n++ )
     {
-        if ( subscr[n] == sp_id )
-            return true;
-    }
-
-    return false;
-}
+        const void *entry = sp_list + n * sp_list_entry_size;
+        uint32_t partition_props =
+            ffa_sp_entry_read_partition_properties(entry);
 
-static void vm_destroy_bitmap_init(struct ffa_ctx *ctx,
-                                   unsigned int create_signal_count)
-{
-    unsigned int n;
+        if ( !(partition_props & FFA_PART_PROP_NOTIF_DESTROYED) )
+            continue;
 
-    for ( n = 0; n < subscr_vm_destroyed_count; n++ )
-    {
         /*
          * Skip SPs subscribed to the VM created event that never was
          * notified of the VM creation due to an error during
          * ffa_domain_init().
          */
-        if ( is_in_subscr_list(subscr_vm_created, create_signal_count,
-                               subscr_vm_created_count,
-                               subscr_vm_destroyed[n]) )
+        if ( (partition_props & FFA_PART_PROP_NOTIF_CREATED) &&
+             n >= first_unnotified )
             continue;
 
         set_bit(n, ctx->vm_destroy_bitmap);
@@ -671,32 +579,42 @@ static void vm_destroy_bitmap_init(struct ffa_ctx *ctx,
 
 int32_t ffa_partinfo_domain_init(struct domain *d)
 {
-    unsigned int count = BITS_TO_LONGS(subscr_vm_destroyed_count);
+    unsigned int count = BITS_TO_LONGS(sp_list_count);
     struct ffa_ctx *ctx = d->arch.tee;
     unsigned int n;
+    unsigned int first_unnotified = sp_list_count;
     int32_t res;
 
-    if ( !ffa_fw_supports_fid(FFA_MSG_SEND_DIRECT_REQ_32) )
+    if ( !ffa_fw_supports_fid(FFA_MSG_SEND_DIRECT_REQ_32) || !sp_list_count )
         return 0;
 
     ctx->vm_destroy_bitmap = xzalloc_array(unsigned long, count);
     if ( !ctx->vm_destroy_bitmap )
         return -ENOMEM;
 
-    for ( n = 0; n < subscr_vm_created_count; n++ )
+    for ( n = 0; n < sp_list_count; n++ )
     {
-        res = ffa_direct_req_send_vm(subscr_vm_created[n], ffa_get_vm_id(d),
+        const void *entry = sp_list + n * sp_list_entry_size;
+        uint32_t partition_props =
+            ffa_sp_entry_read_partition_properties(entry);
+        uint16_t id = ffa_sp_entry_read_id(entry);
+
+        if ( !(partition_props & FFA_PART_PROP_NOTIF_CREATED) )
+            continue;
+
+        res = ffa_direct_req_send_vm(id, ffa_get_vm_id(d),
                                      FFA_MSG_SEND_VM_CREATED);
         if ( res )
         {
             printk(XENLOG_ERR "ffa: Failed to report creation of vm_id %u to  %u: res %d\n",
-                   ffa_get_vm_id(d), subscr_vm_created[n], res);
+                   ffa_get_vm_id(d), id, res);
+            first_unnotified = n;
             break;
         }
     }
-    vm_destroy_bitmap_init(ctx, n);
+    vm_destroy_bitmap_init(ctx, first_unnotified);
 
-    if ( n != subscr_vm_created_count )
+    if ( first_unnotified != sp_list_count )
         return -EIO;
 
     return 0;
@@ -711,18 +629,24 @@ bool ffa_partinfo_domain_destroy(struct domain *d)
     if ( !ctx->vm_destroy_bitmap )
         return true;
 
-    for ( n = 0; n < subscr_vm_destroyed_count; n++ )
+    for ( n = 0; n < sp_list_count; n++ )
     {
+        const void *entry;
+        uint16_t id;
+
         if ( !test_bit(n, ctx->vm_destroy_bitmap) )
             continue;
 
-        res = ffa_direct_req_send_vm(subscr_vm_destroyed[n], ffa_get_vm_id(d),
+        entry = sp_list + n * sp_list_entry_size;
+        id = ffa_sp_entry_read_id(entry);
+
+        res = ffa_direct_req_send_vm(id, ffa_get_vm_id(d),
                                      FFA_MSG_SEND_VM_DESTROYED);
 
         if ( res && printk_ratelimit() )
             printk(XENLOG_WARNING
                    "%pd: ffa: Failed to report destruction of vm_id %u to %u: res %d\n",
-                   d, ffa_get_vm_id(d), subscr_vm_destroyed[n], res);
+                   d, ffa_get_vm_id(d), id, res);
 
         /*
          * For these two error codes the hypervisor is expected to resend
@@ -734,7 +658,7 @@ bool ffa_partinfo_domain_destroy(struct domain *d)
             clear_bit(n, ctx->vm_destroy_bitmap);
     }
 
-    if ( bitmap_empty(ctx->vm_destroy_bitmap, subscr_vm_destroyed_count) )
+    if ( bitmap_empty(ctx->vm_destroy_bitmap, sp_list_count) )
         XFREE(ctx->vm_destroy_bitmap);
 
     return !ctx->vm_destroy_bitmap;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Mar 20 11:22:32 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 20 Mar 2026 11:22:32 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1258002.1552217 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w3Xw0-000519-Qw; Fri, 20 Mar 2026 11:22:32 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1258002.1552217; Fri, 20 Mar 2026 11:22:32 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w3Xw0-000510-OC; Fri, 20 Mar 2026 11:22:32 +0000
Received: by outflank-mailman (input) for mailman id 1258002;
 Fri, 20 Mar 2026 11:22:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w3Xw0-00050u-2B
 for xen-changelog@lists.xenproject.org; Fri, 20 Mar 2026 11:22:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w3Xw0-000WRf-0n
 for xen-changelog@lists.xenproject.org;
 Fri, 20 Mar 2026 11:22:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w3Xvz-002iQy-3D
 for xen-changelog@lists.xenproject.org;
 Fri, 20 Mar 2026 11:22:31 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=i5Va3GDoiU1agtwkNgahw172SDBjLTowEFSWreoRIeE=; b=MCWUFuWCnRq6Cu5zylDxMOn1Fh
	usL6CdHA/yFy749cTLsQfRm+lPgDcS2xkvUHyQIr5FRBjRPfN2gd4uDMNI2VH+h7IsqCK6F3hWbjC
	q3OO00NBZPtwLfbapxytf7L4wE8BJkgYoeM2DLill0NFd5hlprdevz7jrnBce3hNf3RA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: ffa: Add cached GET_REGS support
Message-Id: <E1w3Xvz-002iQy-3D@xenbits.xenproject.org>
Date: Fri, 20 Mar 2026 11:22:31 +0000

commit 500ee5fe0f4b362f6c0f9afa6c7d3146b59196ff
Author:     Bertrand Marquis <bertrand.marquis@arm.com>
AuthorDate: Tue Jan 27 16:10:29 2026 +0100
Commit:     Julien Grall <julien@xen.org>
CommitDate: Fri Mar 20 11:14:23 2026 +0000

    xen/arm: ffa: Add cached GET_REGS support
    
    FF-A v1.2 defines PARTITION_INFO_GET_REGS for register-based partition
    info retrieval, but Xen currently only supports the buffer-based GET
    path for guests.
    
    Implement GET_REGS using the cached SP list and VM entries, including
    the register window layout and input validation. Track VM list changes
    via the partinfo tag and use it to validate GET_REGS tag inputs. Ensure
    that when a non-Nil UUID is specified, the UUID fields in both GET and
    GET_REGS results are MBZ as required by the specification.
    
    PARTITION_INFO_GET_REGS is available to v1.2 guests, returning cached SP
    entries and VM entries with UUIDs zeroed for non-Nil UUID queries.
    
    Also publish VM membership updates (VM count, ctx list, and partinfo
    tag) under the same write-locked section so GET_REGS sees coherent state
    and concurrent changes are reliably reported via RETRY.
    
    Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
    Acked-by: Julien Grall <julien@xen.org>
---
 xen/arch/arm/tee/ffa.c          |  23 ++++-
 xen/arch/arm/tee/ffa_partinfo.c | 201 ++++++++++++++++++++++++++++++++++++++++
 xen/arch/arm/tee/ffa_private.h  |   4 +-
 3 files changed, 224 insertions(+), 4 deletions(-)

diff --git a/xen/arch/arm/tee/ffa.c b/xen/arch/arm/tee/ffa.c
index d4a77206c6..1fe33f2645 100644
--- a/xen/arch/arm/tee/ffa.c
+++ b/xen/arch/arm/tee/ffa.c
@@ -44,6 +44,11 @@
  *   - doesn't support signalling the secondary scheduler of pending
  *     notification for secure partitions
  *   - doesn't support notifications for Xen itself
+ * o FFA_PARTITION_INFO_GET/GET_REGS:
+ *   - v1.0 guests may see duplicate SP IDs when firmware provides UUIDs
+ *   - SP list is cached at init; SPMC tag changes are not tracked
+ *     between calls
+ *   - SP list is capped at FFA_MAX_NUM_SP entries
  *
  * There are some large locked sections with ffa_spmc_tx_lock and
  * ffa_spmc_rx_lock. Especially the ffa_spmc_tx_lock spinlock used
@@ -184,10 +189,11 @@ static bool ffa_negotiate_version(struct cpu_user_regs *regs)
 
         if ( IS_ENABLED(CONFIG_FFA_VM_TO_VM) )
         {
-            /* One more VM with FF-A support available */
-            inc_ffa_vm_count();
             write_lock(&ffa_ctx_list_rwlock);
+            /* Publish VM membership changes atomically with tag updates. */
+            inc_ffa_vm_count();
             list_add_tail(&ctx->ctx_list, &ffa_ctx_head);
+            ffa_partinfo_inc_tag();
             write_unlock(&ffa_ctx_list_rwlock);
         }
 
@@ -342,6 +348,12 @@ static void handle_features(struct cpu_user_regs *regs)
     case FFA_FEATURE_SCHEDULE_RECV_INTR:
         ffa_set_regs_success(regs, GUEST_FFA_SCHEDULE_RECV_INTR_ID, 0);
         break;
+    case FFA_PARTITION_INFO_GET_REGS:
+        if ( ACCESS_ONCE(ctx->guest_vers) >= FFA_VERSION_1_2 )
+            ffa_set_regs_success(regs, 0, 0);
+        else
+            ffa_set_regs_error(regs, FFA_RET_NOT_SUPPORTED);
+        break;
 
     case FFA_NOTIFICATION_BIND:
     case FFA_NOTIFICATION_UNBIND:
@@ -403,6 +415,9 @@ static bool ffa_handle_call(struct cpu_user_regs *regs)
     case FFA_PARTITION_INFO_GET:
         ffa_handle_partition_info_get(regs);
         return true;
+    case FFA_PARTITION_INFO_GET_REGS:
+        ffa_handle_partition_info_get_regs(regs);
+        return true;
     case FFA_RX_RELEASE:
         e = ffa_rx_release(ctx);
         break;
@@ -626,9 +641,11 @@ static int ffa_domain_teardown(struct domain *d)
 
     if ( IS_ENABLED(CONFIG_FFA_VM_TO_VM) && ACCESS_ONCE(ctx->guest_vers) )
     {
-        dec_ffa_vm_count();
         write_lock(&ffa_ctx_list_rwlock);
+        /* Publish VM membership changes atomically with tag updates. */
+        dec_ffa_vm_count();
         list_del(&ctx->ctx_list);
+        ffa_partinfo_inc_tag();
         write_unlock(&ffa_ctx_list_rwlock);
     }
 
diff --git a/xen/arch/arm/tee/ffa_partinfo.c b/xen/arch/arm/tee/ffa_partinfo.c
index 419e19510f..4580bd5edb 100644
--- a/xen/arch/arm/tee/ffa_partinfo.c
+++ b/xen/arch/arm/tee/ffa_partinfo.c
@@ -29,10 +29,40 @@ struct ffa_partition_info_1_1 {
     uint8_t uuid[16];
 };
 
+/* Registers a3..a17 (15 regs) carry partition descriptors, 3 regs each. */
+#define FFA_PARTINFO_REG_MAX_ENTRIES \
+    ((15 * sizeof(uint64_t)) / sizeof(struct ffa_partition_info_1_1))
+
 /* SP list cache (secure endpoints only); populated at init. */
 static void *sp_list __read_mostly;
 static uint32_t sp_list_count __read_mostly;
 static uint32_t sp_list_entry_size __read_mostly;
+
+/* SP list is static; tag only moves when VMs are added/removed. */
+static atomic_t ffa_partinfo_tag = ATOMIC_INIT(1);
+
+void ffa_partinfo_inc_tag(void)
+{
+    atomic_inc(&ffa_partinfo_tag);
+}
+
+static inline uint16_t ffa_partinfo_get_tag(void)
+{
+    /*
+     * Tag moves with VM list changes only.
+     *
+     * Limitation: we cannot detect an SPMC tag change between calls because we
+     * do not retain the previous SPMC tag; we only refresh it via the mandatory
+     * start_index=0 call and assume it stays stable while combined_tag (our
+     * VM/SP-count tag) is used for guest validation. This means SPMC tag
+     * changes alone will not trigger RETRY.
+     */
+    if ( IS_ENABLED(CONFIG_FFA_VM_TO_VM) )
+        return atomic_read(&ffa_partinfo_tag) & GENMASK(15, 0);
+    else
+        return 1;
+}
+
 static int32_t ffa_partition_info_get(struct ffa_uuid uuid, uint32_t flags,
                                       uint32_t *count, uint32_t *fpi_size)
 {
@@ -140,6 +170,7 @@ static int32_t ffa_get_sp_partinfo(struct ffa_uuid uuid, uint32_t *sp_count,
     for ( n = 0; n < sp_list_count; n++ )
     {
         void *entry = sp_list + n * sp_list_entry_size;
+        void *dst_pos;
 
         if ( !ffa_sp_entry_matches_uuid(entry, uuid) )
             continue;
@@ -151,11 +182,20 @@ static int32_t ffa_get_sp_partinfo(struct ffa_uuid uuid, uint32_t *sp_count,
          * This is a non-compliance to the specification but 1.0 VMs should
          * handle that on their own to simplify Xen implementation.
          */
+        dst_pos = *dst_buf;
         ret = ffa_copy_info(dst_buf, end_buf, entry, dst_size,
                             sp_list_entry_size);
         if ( ret )
             return ret;
 
+        if ( !ffa_uuid_is_nil(uuid) &&
+             dst_size >= sizeof(struct ffa_partition_info_1_1) )
+        {
+            struct ffa_partition_info_1_1 *fpi = dst_pos;
+
+            memset(fpi->uuid, 0, sizeof(fpi->uuid));
+        }
+
         count++;
     }
 
@@ -167,6 +207,38 @@ static int32_t ffa_get_sp_partinfo(struct ffa_uuid uuid, uint32_t *sp_count,
     return FFA_RET_OK;
 }
 
+static uint16_t ffa_get_sp_partinfo_regs(struct ffa_uuid uuid,
+                                         uint16_t start_index,
+                                         uint64_t *out_regs,
+                                         uint16_t max_entries)
+{
+    uint32_t idx = 0;
+    uint16_t filled = 0;
+    uint32_t n;
+
+    for ( n = 0; n < sp_list_count && filled < max_entries; n++ )
+    {
+        void *entry = sp_list + n * sp_list_entry_size;
+
+        if ( !ffa_sp_entry_matches_uuid(entry, uuid) )
+            continue;
+
+        if ( idx++ < start_index )
+            continue;
+
+        memcpy(&out_regs[filled * 3], entry,
+               sizeof(struct ffa_partition_info_1_1));
+        if ( !ffa_uuid_is_nil(uuid) )
+        {
+            out_regs[filled * 3 + 1] = 0;
+            out_regs[filled * 3 + 2] = 0;
+        }
+        filled++;
+    }
+
+    return filled;
+}
+
 static int32_t ffa_get_vm_partinfo(struct ffa_uuid uuid, uint32_t start_index,
                                    uint32_t *vm_count, void **dst_buf,
                                    void *end_buf, uint32_t dst_size)
@@ -383,6 +455,135 @@ out:
     }
 }
 
+void ffa_handle_partition_info_get_regs(struct cpu_user_regs *regs)
+{
+    struct domain *d = current->domain;
+    struct ffa_ctx *ctx = d->arch.tee;
+    struct ffa_uuid uuid;
+    uint32_t sp_count = 0, vm_count = 0, total_count;
+    uint16_t start_index, tag;
+    uint16_t num_entries = 0;
+    uint64_t x3 = get_user_reg(regs, 3);
+    int32_t ret = FFA_RET_OK;
+    uint64_t out_regs[18] = { 0 };
+    unsigned int n;
+    uint16_t tag_out, tag_end;
+
+    if ( ACCESS_ONCE(ctx->guest_vers) < FFA_VERSION_1_2 )
+    {
+        ret = FFA_RET_NOT_SUPPORTED;
+        goto out;
+    }
+
+    /*
+     * Registers a3..a17 (15 regs) carry partition descriptors, 3 regs each.
+     * For FF-A 1.2, that yields a maximum of 5 entries per GET_REGS call.
+     * Enforce the assumed layout so window sizing stays correct.
+     */
+    BUILD_BUG_ON(FFA_PARTINFO_REG_MAX_ENTRIES != 5);
+
+    start_index = x3 & GENMASK(15, 0);
+    tag = (x3 >> 16) & GENMASK(15, 0);
+
+    /* Start index must allow room for up to 5 entries without overflow. */
+    if ( start_index > (GENMASK(15, 0) - (FFA_PARTINFO_REG_MAX_ENTRIES - 1)) )
+    {
+        ret = FFA_RET_INVALID_PARAMETERS;
+        goto out;
+    }
+
+    uuid.val[0] = get_user_reg(regs, 1);
+    uuid.val[1] = get_user_reg(regs, 2);
+
+    tag_out = ffa_partinfo_get_tag();
+
+    if ( start_index == 0 )
+    {
+        if ( tag )
+        {
+            ret = FFA_RET_INVALID_PARAMETERS;
+            goto out;
+        }
+    }
+    else if ( tag != tag_out )
+    {
+        ret = FFA_RET_RETRY;
+        goto out;
+    }
+
+    if ( ffa_uuid_is_nil(uuid) )
+    {
+        if ( IS_ENABLED(CONFIG_FFA_VM_TO_VM) )
+            vm_count = get_ffa_vm_count();
+        else
+            vm_count = 1; /* Caller VM only */
+    }
+
+    ret = ffa_get_sp_count(uuid, &sp_count);
+    if ( ret )
+        goto out;
+
+    total_count = sp_count + vm_count;
+
+    if ( total_count == 0 || start_index >= total_count )
+    {
+        ret = FFA_RET_INVALID_PARAMETERS;
+        goto out;
+    }
+
+    if ( start_index < sp_count )
+        num_entries = ffa_get_sp_partinfo_regs(uuid, start_index, &out_regs[3],
+                                               FFA_PARTINFO_REG_MAX_ENTRIES);
+
+    if ( num_entries < FFA_PARTINFO_REG_MAX_ENTRIES )
+    {
+        uint32_t vm_start = start_index > sp_count ?
+                            start_index - sp_count : 0;
+        uint32_t filled = 0;
+        void *vm_dst = &out_regs[3 + num_entries * 3];
+        void *vm_end = &out_regs[18];
+
+        ret = ffa_get_vm_partinfo(uuid, vm_start, &filled, &vm_dst, vm_end,
+                                  sizeof(struct ffa_partition_info_1_1));
+        if ( ret != FFA_RET_OK && ret != FFA_RET_NO_MEMORY )
+            goto out;
+
+        num_entries += filled;
+    }
+
+    if ( num_entries == 0 )
+    {
+        ret = FFA_RET_INVALID_PARAMETERS;
+        goto out;
+    }
+
+    /*
+     * Detect list changes while building the response so the caller can retry
+     * with a coherent snapshot tag.
+     */
+    tag_end = ffa_partinfo_get_tag();
+    if ( tag_end != tag_out )
+    {
+        ret = FFA_RET_RETRY;
+        goto out;
+    }
+
+    out_regs[0] = FFA_SUCCESS_64;
+    out_regs[2] = ((uint64_t)sizeof(struct ffa_partition_info_1_1) << 48) |
+                  ((uint64_t)tag_end << 32) |
+                  ((uint64_t)(start_index + num_entries - 1) << 16) |
+                  ((uint64_t)(total_count - 1) & GENMASK(15, 0));
+
+    for ( n = 0; n < ARRAY_SIZE(out_regs); n++ )
+        set_user_reg(regs, n, out_regs[n]);
+
+    return;
+
+out:
+    if ( ret )
+        ffa_set_regs_error(regs, ret);
+}
+
 static int32_t ffa_direct_req_send_vm(uint16_t sp_id, uint16_t vm_id,
                                       uint8_t msg)
 {
diff --git a/xen/arch/arm/tee/ffa_private.h b/xen/arch/arm/tee/ffa_private.h
index 1a632983c8..c291f32b56 100644
--- a/xen/arch/arm/tee/ffa_private.h
+++ b/xen/arch/arm/tee/ffa_private.h
@@ -289,7 +289,7 @@
 #define FFA_MSG_SEND2                   0x84000086U
 #define FFA_CONSOLE_LOG_32              0x8400008AU
 #define FFA_CONSOLE_LOG_64              0xC400008AU
-#define FFA_PARTITION_INFO_GET_REGS     0x8400008BU
+#define FFA_PARTITION_INFO_GET_REGS     0xC400008BU
 #define FFA_MSG_SEND_DIRECT_REQ2        0xC400008DU
 #define FFA_MSG_SEND_DIRECT_RESP2       0xC400008EU
 
@@ -452,6 +452,8 @@ bool ffa_partinfo_init(void);
 int32_t ffa_partinfo_domain_init(struct domain *d);
 bool ffa_partinfo_domain_destroy(struct domain *d);
 void ffa_handle_partition_info_get(struct cpu_user_regs *regs);
+void ffa_handle_partition_info_get_regs(struct cpu_user_regs *regs);
+void ffa_partinfo_inc_tag(void);
 
 int32_t ffa_endpoint_domain_lookup(uint16_t endpoint_id, struct domain **d_out,
                                    struct ffa_ctx **ctx_out);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Mar 20 15:33:13 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 20 Mar 2026 15:33:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1258244.1552383 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w3bqR-0005qd-7D; Fri, 20 Mar 2026 15:33:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1258244.1552383; Fri, 20 Mar 2026 15:33:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w3bqR-0005qV-4a; Fri, 20 Mar 2026 15:33:03 +0000
Received: by outflank-mailman (input) for mailman id 1258244;
 Fri, 20 Mar 2026 15:33:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w3bqP-0005qP-LD
 for xen-changelog@lists.xenproject.org; Fri, 20 Mar 2026 15:33:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w3bqP-000bUC-2R
 for xen-changelog@lists.xenproject.org;
 Fri, 20 Mar 2026 15:33:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w3bqP-003Pcp-1T
 for xen-changelog@lists.xenproject.org;
 Fri, 20 Mar 2026 15:33:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=gcHMtIudap42riIURF4aA/nQtd6zgb41S6G8v+oC7ME=; b=p/bfPmzUwYnnegAMhTBbt4LgyF
	uYTV09xQ6oVZ1kAjTj3mUnRZlnEKXtnXqI4yDktKUk6EgiXd/0GbPFU90tLvoxP/flwpIN+Qob9PR
	Rkni/ISCTvn+QDijNWbJhUUWV/POdQwmzHosLwAUHc2L48s1n8Sk9sgr4k4Nzr5HWeQI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: ffa: Add start_index to VM partinfo helper
Message-Id: <E1w3bqP-003Pcp-1T@xenbits.xenproject.org>
Date: Fri, 20 Mar 2026 15:33:01 +0000

commit ed6787f6d2dc07837c003cce81e9bfa85fc13112
Author:     Bertrand Marquis <bertrand.marquis@arm.com>
AuthorDate: Tue Jan 27 16:09:45 2026 +0100
Commit:     Julien Grall <julien@xen.org>
CommitDate: Fri Mar 20 11:12:59 2026 +0000

    xen/arm: ffa: Add start_index to VM partinfo helper
    
    Windowed GET_REGS retrieval needs to emit VM entries starting from an
    arbitrary index, but ffa_get_vm_partinfo() always starts from index 0.
    
    Add a start_index parameter to ffa_get_vm_partinfo() and skip entries
    until the local index reaches start_index. Update
    ffa_handle_partition_info_get() to pass start_index=0 to preserve
    existing behavior.
    
    No functional changes.
    
    Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
    Acked-by: Julien Grall <julien@xen.org>
---
 xen/arch/arm/tee/ffa_partinfo.c | 61 +++++++++++++++++++++++------------------
 1 file changed, 35 insertions(+), 26 deletions(-)

diff --git a/xen/arch/arm/tee/ffa_partinfo.c b/xen/arch/arm/tee/ffa_partinfo.c
index fdb03dae9a..6a6f3ffb82 100644
--- a/xen/arch/arm/tee/ffa_partinfo.c
+++ b/xen/arch/arm/tee/ffa_partinfo.c
@@ -167,14 +167,15 @@ out:
     return ret;
 }
 
-static int32_t ffa_get_vm_partinfo(struct ffa_uuid uuid, uint32_t *vm_count,
-                                   void **dst_buf, void *end_buf,
-                                   uint32_t dst_size)
+static int32_t ffa_get_vm_partinfo(struct ffa_uuid uuid, uint32_t start_index,
+                                   uint32_t *vm_count, void **dst_buf,
+                                   void *end_buf, uint32_t dst_size)
 {
     struct domain *d = current->domain;
     struct ffa_ctx *curr_ctx = d->arch.tee;
     struct ffa_ctx *dest_ctx;
     uint32_t count = 0;
+    uint32_t idx = 0;
     int32_t ret = FFA_RET_OK;
     /*
      * We do not have UUID info for VMs so use the 1.0 structure so that we set
@@ -202,17 +203,21 @@ static int32_t ffa_get_vm_partinfo(struct ffa_uuid uuid, uint32_t *vm_count,
     if ( ACCESS_ONCE(curr_ctx->guest_vers) >= FFA_VERSION_1_2 )
     {
         /* Add caller VM information */
-        info.id = curr_ctx->ffa_id;
-        info.execution_context = curr_ctx->num_vcpus;
-        info.partition_properties = FFA_PART_VM_PROP;
-        if ( is_64bit_domain(d) )
-            info.partition_properties |= FFA_PART_PROP_AARCH64_STATE;
-
-        ret = ffa_copy_info(dst_buf, end_buf, &info, dst_size, sizeof(info));
-        if ( ret )
-            return ret;
+        if ( start_index == 0)
+        {
+            info.id = curr_ctx->ffa_id;
+            info.execution_context = curr_ctx->num_vcpus;
+            info.partition_properties = FFA_PART_VM_PROP;
+            if ( is_64bit_domain(d) )
+                info.partition_properties |= FFA_PART_PROP_AARCH64_STATE;
 
-        count++;
+            ret = ffa_copy_info(dst_buf, end_buf, &info, dst_size,
+                                sizeof(info));
+            if ( ret )
+                return ret;
+            count++;
+        }
+        idx++;
     }
 
     if ( IS_ENABLED(CONFIG_FFA_VM_TO_VM) )
@@ -231,21 +236,25 @@ static int32_t ffa_get_vm_partinfo(struct ffa_uuid uuid, uint32_t *vm_count,
             if ( dest_ctx == curr_ctx )
                 continue;
 
-            info.id = dest_ctx->ffa_id;
-            info.execution_context = dest_ctx->num_vcpus;
-            info.partition_properties = FFA_PART_VM_PROP;
-            if ( dest_ctx->is_64bit )
-                info.partition_properties |= FFA_PART_PROP_AARCH64_STATE;
-
-            ret = ffa_copy_info(dst_buf, end_buf, &info, dst_size,
-                                sizeof(info));
-            if ( ret )
+            if ( idx >= start_index )
             {
-                read_unlock(&ffa_ctx_list_rwlock);
-                return ret;
+                info.id = dest_ctx->ffa_id;
+                info.execution_context = dest_ctx->num_vcpus;
+                info.partition_properties = FFA_PART_VM_PROP;
+                if ( dest_ctx->is_64bit )
+                    info.partition_properties |= FFA_PART_PROP_AARCH64_STATE;
+
+                ret = ffa_copy_info(dst_buf, end_buf, &info, dst_size,
+                                    sizeof(info));
+                if ( ret )
+                {
+                    read_unlock(&ffa_ctx_list_rwlock);
+                    return ret;
+                }
+                count++;
             }
 
-            count++;
+            idx++;
         }
         read_unlock(&ffa_ctx_list_rwlock);
     }
@@ -355,7 +364,7 @@ void ffa_handle_partition_info_get(struct cpu_user_regs *regs)
             goto out_rx_release;
     }
 
-    ret = ffa_get_vm_partinfo(uuid, &ffa_vm_count, &dst_buf, end_buf,
+    ret = ffa_get_vm_partinfo(uuid, 0, &ffa_vm_count, &dst_buf, end_buf,
                               dst_size);
 
 out_rx_release:
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 20 15:33:14 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 20 Mar 2026 15:33:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1258245.1552388 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w3bqb-0005ru-8y; Fri, 20 Mar 2026 15:33:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1258245.1552388; Fri, 20 Mar 2026 15:33:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w3bqb-0005rm-60; Fri, 20 Mar 2026 15:33:13 +0000
Received: by outflank-mailman (input) for mailman id 1258245;
 Fri, 20 Mar 2026 15:33:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w3bqZ-0005ra-Ll
 for xen-changelog@lists.xenproject.org; Fri, 20 Mar 2026 15:33:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w3bqZ-000bUZ-2k
 for xen-changelog@lists.xenproject.org;
 Fri, 20 Mar 2026 15:33:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w3bqZ-003PeC-1w
 for xen-changelog@lists.xenproject.org;
 Fri, 20 Mar 2026 15:33:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=AY0X98SgfbuENEBVGO9fA/gCUHf/q+wjI7zoiVxI6+M=; b=uDTa8FSXCXusVkTbtkbyxvBWpD
	z+csizqCgYd3SVuVawlq4xB+cGRTR1fTWdbaXHabJJGbsb81XOiXHGEeQBEiZvSJQxHwRoYuL5wHO
	R3NZrw7ybmOBHEft59woL8Jefni+Qtsdsua+OYnNyYbiEsiGm+Czo8HGWHAw+9ZpAH+Y=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: ffa: Cache SP partition info at init
Message-Id: <E1w3bqZ-003PeC-1w@xenbits.xenproject.org>
Date: Fri, 20 Mar 2026 15:33:11 +0000

commit cca899b3800e43a080afa1d982d1ae94b87e1dfa
Author:     Bertrand Marquis <bertrand.marquis@arm.com>
AuthorDate: Fri Feb 13 11:52:12 2026 +0100
Commit:     Julien Grall <julien@xen.org>
CommitDate: Fri Mar 20 11:14:15 2026 +0000

    xen/arm: ffa: Cache SP partition info at init
    
    FFA_PARTITION_INFO_GET currently queries the SPMC on each call and walks the
    RX buffer every time. The SP list is expected to be static, so repeated
    firmware calls and validation are unnecessary.
    
    Cache the SPMC partition-info list at init time, keeping only secure
    endpoints, and reuse the cached entries for SP count and partition-info
    responses. Initialize the VM create/destroy subscriber lists from the cached
    list and free the cache on init failure.
    
    SP partition info now reflects the init-time snapshot and will not change.
    
    Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
    Acked-by: Julien Grall <julien@xen.org>
---
 xen/arch/arm/tee/ffa_partinfo.c | 216 +++++++++++++++++++++++++++-------------
 1 file changed, 146 insertions(+), 70 deletions(-)

diff --git a/xen/arch/arm/tee/ffa_partinfo.c b/xen/arch/arm/tee/ffa_partinfo.c
index 6a6f3ffb82..b933becaa5 100644
--- a/xen/arch/arm/tee/ffa_partinfo.c
+++ b/xen/arch/arm/tee/ffa_partinfo.c
@@ -6,6 +6,8 @@
 #include <xen/const.h>
 #include <xen/sizes.h>
 #include <xen/types.h>
+#include <xen/unaligned.h>
+#include <xen/xmalloc.h>
 
 #include <asm/smccc.h>
 #include <asm/regs.h>
@@ -33,6 +35,10 @@ static uint16_t subscr_vm_created_count __read_mostly;
 static uint16_t *subscr_vm_destroyed __read_mostly;
 static uint16_t subscr_vm_destroyed_count __read_mostly;
 
+/* SP list cache (secure endpoints only); populated at init. */
+static void *sp_list __read_mostly;
+static uint32_t sp_list_count __read_mostly;
+static uint32_t sp_list_entry_size __read_mostly;
 static int32_t ffa_partition_info_get(struct ffa_uuid uuid, uint32_t flags,
                                       uint32_t *count, uint32_t *fpi_size)
 {
@@ -79,92 +85,84 @@ static int32_t ffa_copy_info(void **dst, void *dst_end, const void *src,
     return FFA_RET_OK;
 }
 
-static int32_t ffa_get_sp_count(struct ffa_uuid uuid, uint32_t *sp_count)
+static uint16_t ffa_sp_entry_read_id(const void *entry)
 {
-    uint32_t src_size;
-
-    return ffa_partition_info_get(uuid, FFA_PARTITION_INFO_GET_COUNT_FLAG,
-                                  sp_count, &src_size);
+    return get_unaligned_t(uint16_t,
+                           (const uint8_t *)entry +
+                           offsetof(struct ffa_partition_info_1_0, id));
 }
 
-static int32_t ffa_get_sp_partinfo(struct ffa_uuid uuid, uint32_t *sp_count,
-                                   void **dst_buf, void *end_buf,
-                                   uint32_t dst_size)
+static bool ffa_sp_entry_matches_uuid(const void *entry, struct ffa_uuid uuid)
 {
-    int32_t ret;
-    int32_t release_ret;
-    uint32_t src_size, real_sp_count;
-    void *src_buf;
-    uint32_t count = 0;
-    bool notify_fw = false;
+    struct ffa_uuid sp_uuid;
 
-    /* We need to use the RX buffer to receive the list */
-    src_buf = ffa_rxtx_spmc_rx_acquire();
-    if ( !src_buf )
-        return FFA_RET_DENIED;
+    if ( ffa_uuid_is_nil(uuid) )
+        return true;
 
-    ret = ffa_partition_info_get(uuid, 0, &real_sp_count, &src_size);
-    if ( ret )
-        goto out;
-    notify_fw = true;
+    memcpy(&sp_uuid,
+           (const uint8_t *)entry +
+           offsetof(struct ffa_partition_info_1_1, uuid),
+           sizeof(sp_uuid));
+    return ffa_uuid_equal(uuid, sp_uuid);
+}
 
-    /* Validate the src_size we got */
-    if ( src_size < sizeof(struct ffa_partition_info_1_0) ||
-         src_size >= FFA_PAGE_SIZE )
+static int32_t ffa_get_sp_count(struct ffa_uuid uuid, uint32_t *sp_count)
+{
+    uint32_t count = 0;
+    uint32_t n;
+
+    for ( n = 0; n < sp_list_count; n++ )
     {
-        ret = FFA_RET_NOT_SUPPORTED;
-        goto out;
+        void *entry = sp_list + n * sp_list_entry_size;
+
+        if ( ffa_sp_entry_matches_uuid(entry, uuid) )
+            count++;
     }
 
-    /*
-     * Limit the maximum time we hold the CPU by limiting the number of SPs.
-     * We just ignore the extra ones as this is tested during init in
-     * ffa_partinfo_init so the only possible reason is SP have been added
-     * since boot.
-     */
-    if ( real_sp_count > FFA_MAX_NUM_SP )
-        real_sp_count = FFA_MAX_NUM_SP;
+    *sp_count = count;
 
-    /* Make sure the data fits in our buffer */
-    if ( real_sp_count > (FFA_RXTX_PAGE_COUNT * FFA_PAGE_SIZE) / src_size )
-    {
-        ret = FFA_RET_NOT_SUPPORTED;
-        goto out;
-    }
+    if ( !ffa_uuid_is_nil(uuid) && !count )
+        return FFA_RET_INVALID_PARAMETERS;
 
-    for ( uint32_t sp_num = 0; sp_num < real_sp_count; sp_num++ )
-    {
-        struct ffa_partition_info_1_1 *fpi = src_buf;
+    return FFA_RET_OK;
+}
 
-        /* filter out SP not following bit 15 convention if any */
-        if ( FFA_ID_IS_SECURE(fpi->id) )
-        {
-            /*
-             * If VM is 1.0 but firmware is 1.1 we could have several entries
-             * with the same ID but different UUIDs. In this case the VM will
-             * get a list with several time the same ID.
-             * This is a non-compliance to the specification but 1.0 VMs should
-             * handle that on their own to simplify Xen implementation.
-             */
+static int32_t ffa_get_sp_partinfo(struct ffa_uuid uuid, uint32_t *sp_count,
+                                   void **dst_buf, void *end_buf,
+                                   uint32_t dst_size)
+{
+    int32_t ret;
+    uint32_t count = 0;
+    uint32_t n;
 
-            ret = ffa_copy_info(dst_buf, end_buf, src_buf, dst_size, src_size);
-            if ( ret )
-                goto out;
+    for ( n = 0; n < sp_list_count; n++ )
+    {
+        void *entry = sp_list + n * sp_list_entry_size;
 
-            count++;
-        }
+        if ( !ffa_sp_entry_matches_uuid(entry, uuid) )
+            continue;
+
+        /*
+         * If VM is 1.0 but firmware is 1.1 we could have several entries
+         * with the same ID but different UUIDs. In this case the VM will
+         * get a list with several time the same ID.
+         * This is a non-compliance to the specification but 1.0 VMs should
+         * handle that on their own to simplify Xen implementation.
+         */
+        ret = ffa_copy_info(dst_buf, end_buf, entry, dst_size,
+                            sp_list_entry_size);
+        if ( ret )
+            return ret;
 
-        src_buf += src_size;
+        count++;
     }
 
     *sp_count = count;
 
-out:
-    release_ret = ffa_rxtx_spmc_rx_release(notify_fw);
-    if ( release_ret )
-        gprintk(XENLOG_WARNING,
-                "ffa: Error releasing SPMC RX buffer: %d\n", release_ret);
-    return ret;
+    if ( !ffa_uuid_is_nil(uuid) && !count )
+        return FFA_RET_INVALID_PARAMETERS;
+
+    return FFA_RET_OK;
 }
 
 static int32_t ffa_get_vm_partinfo(struct ffa_uuid uuid, uint32_t start_index,
@@ -435,6 +433,13 @@ static int32_t ffa_direct_req_send_vm(uint16_t sp_id, uint16_t vm_id,
     return res;
 }
 
+static void ffa_sp_list_cache_free(void)
+{
+    XFREE(sp_list);
+    sp_list_count = 0;
+    sp_list_entry_size = 0;
+}
+
 static void uninit_subscribers(void)
 {
         subscr_vm_created_count = 0;
@@ -443,6 +448,63 @@ static void uninit_subscribers(void)
         XFREE(subscr_vm_destroyed);
 }
 
+static bool ffa_sp_list_cache_init(const void *buf, uint32_t count,
+                                   uint32_t fpi_size)
+{
+    const uint8_t *src = buf;
+    uint32_t secure_count = 0;
+    uint32_t n, idx = 0;
+
+    if ( fpi_size < sizeof(struct ffa_partition_info_1_1) ||
+         fpi_size >= FFA_PAGE_SIZE )
+        return false;
+
+    if ( count > (FFA_RXTX_PAGE_COUNT * FFA_PAGE_SIZE) / fpi_size )
+        return false;
+
+    for ( n = 0; n < count; n++ )
+    {
+        const uint8_t *entry = src + n * fpi_size;
+        uint16_t id = ffa_sp_entry_read_id(entry);
+
+        if ( !FFA_ID_IS_SECURE(id) )
+        {
+            printk_once(XENLOG_ERR
+                        "ffa: Firmware is not using bit 15 convention for IDs !!\n");
+            printk(XENLOG_ERR
+                   "ffa: Secure partition with id 0x%04x cannot be used\n",
+                   id);
+            continue;
+        }
+
+        secure_count++;
+    }
+
+    if ( secure_count )
+    {
+        sp_list = xzalloc_bytes(secure_count * fpi_size);
+        if ( !sp_list )
+            return false;
+    }
+
+    sp_list_count = secure_count;
+    sp_list_entry_size = fpi_size;
+
+    for ( n = 0; n < count; n++ )
+    {
+        const uint8_t *entry = src + n * fpi_size;
+        uint16_t id = ffa_sp_entry_read_id(entry);
+
+        if ( !FFA_ID_IS_SECURE(id) )
+            continue;
+
+        memcpy(sp_list + idx * fpi_size, entry, fpi_size);
+        idx++;
+    }
+
+    return true;
+}
+
 static bool init_subscribers(void *buf, uint16_t count, uint32_t fpi_size)
 {
     uint16_t n;
@@ -538,7 +600,7 @@ bool ffa_partinfo_init(void)
     if ( e )
     {
         printk(XENLOG_ERR "ffa: Failed to get list of SPs: %d\n", e);
-        goto out;
+        goto out_release_rx;
     }
     notify_fw = true;
 
@@ -546,15 +608,29 @@ bool ffa_partinfo_init(void)
     {
         printk(XENLOG_ERR "ffa: More SPs than the maximum supported: %u - %u\n",
                count, FFA_MAX_NUM_SP);
-        goto out;
+        goto out_release_rx;
+    }
+
+    if ( !ffa_sp_list_cache_init(spmc_rx, count, fpi_size) )
+    {
+        printk(XENLOG_ERR "ffa: Failed to cache SP list\n");
+        goto out_release_rx;
     }
 
-    ret = init_subscribers(spmc_rx, count, fpi_size);
+    if ( !init_subscribers(sp_list, sp_list_count, sp_list_entry_size) )
+        goto out_free_sp_cache;
 
-out:
+    ret = true;
+    goto out_release_rx;
+
+out_free_sp_cache:
+    ffa_sp_list_cache_free();
+
+out_release_rx:
     e = ffa_rxtx_spmc_rx_release(notify_fw);
     if ( e )
         printk(XENLOG_WARNING "ffa: Error releasing SPMC RX buffer: %d\n", e);
+
     return ret;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 20 15:33:23 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 20 Mar 2026 15:33:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1258247.1552391 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w3bql-0005ut-A7; Fri, 20 Mar 2026 15:33:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1258247.1552391; Fri, 20 Mar 2026 15:33:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w3bql-0005uj-7L; Fri, 20 Mar 2026 15:33:23 +0000
Received: by outflank-mailman (input) for mailman id 1258247;
 Fri, 20 Mar 2026 15:33:21 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w3bqj-0005tz-PB
 for xen-changelog@lists.xenproject.org; Fri, 20 Mar 2026 15:33:21 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w3bqj-000bUj-33
 for xen-changelog@lists.xenproject.org;
 Fri, 20 Mar 2026 15:33:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w3bqj-003PfX-2F
 for xen-changelog@lists.xenproject.org;
 Fri, 20 Mar 2026 15:33:21 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=EGdyhsDBq6im+xUVqxWhU8CgaQ3J7jMQJAgPCjdeJUw=; b=Nk5aSE7KbhgyLnd8+iMxObFO3t
	+l4etN24afI1I4foGp3UCqCPDWgTx+I1+D7f5uAMVPmRXyA1qqMPigHI3fLS2EnNz32UvQQAwZ9OZ
	4UKxQDCJx+GyCdpNgXyPCoe1YAnIhZqeTC/jYBU6BBBH5W+j7WSulBQr4hcmFwz3iJ9U=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: ffa: Drop SP subscriber lists
Message-Id: <E1w3bqj-003PfX-2F@xenbits.xenproject.org>
Date: Fri, 20 Mar 2026 15:33:21 +0000

commit 71518be79de043a5289e1689cf65caa9d7661b05
Author:     Bertrand Marquis <bertrand.marquis@arm.com>
AuthorDate: Fri Feb 13 11:57:14 2026 +0100
Commit:     Julien Grall <julien@xen.org>
CommitDate: Fri Mar 20 11:14:23 2026 +0000

    xen/arm: ffa: Drop SP subscriber lists
    
    The init-time SP cache already contains partition properties, but the
    code still builds separate subscriber arrays for VM created/destroyed
    notifications. That duplicates state and allocation.
    
    Use the cached SP list directly to:
    - decide which SPs receive created/destroyed notifications
    - build the per-domain destroy bitmap
    - skip destroy notifications for SPs not notified on create
    
    Also switch cached SP entry field reads in VM create/destroy
    notification paths to unaligned-safe helpers, as cache entries are
    variable-size and should not be dereferenced via struct pointers.
    
    No functional changes.
    
    Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
    Acked-by: Julien Grall <julien@xen.org>
---
 xen/arch/arm/tee/ffa_partinfo.c | 170 +++++++++++-----------------------------
 1 file changed, 47 insertions(+), 123 deletions(-)

diff --git a/xen/arch/arm/tee/ffa_partinfo.c b/xen/arch/arm/tee/ffa_partinfo.c
index b933becaa5..419e19510f 100644
--- a/xen/arch/arm/tee/ffa_partinfo.c
+++ b/xen/arch/arm/tee/ffa_partinfo.c
@@ -29,12 +29,6 @@ struct ffa_partition_info_1_1 {
     uint8_t uuid[16];
 };
 
-/* SPs subscribing to VM_CREATE and VM_DESTROYED events */
-static uint16_t *subscr_vm_created __read_mostly;
-static uint16_t subscr_vm_created_count __read_mostly;
-static uint16_t *subscr_vm_destroyed __read_mostly;
-static uint16_t subscr_vm_destroyed_count __read_mostly;
-
 /* SP list cache (secure endpoints only); populated at init. */
 static void *sp_list __read_mostly;
 static uint32_t sp_list_count __read_mostly;
@@ -92,6 +86,14 @@ static uint16_t ffa_sp_entry_read_id(const void *entry)
                            offsetof(struct ffa_partition_info_1_0, id));
 }
 
+static uint32_t ffa_sp_entry_read_partition_properties(const void *entry)
+{
+    return get_unaligned_t(uint32_t,
+                           (const uint8_t *)entry +
+                           offsetof(struct ffa_partition_info_1_0,
+                                    partition_properties));
+}
+
 static bool ffa_sp_entry_matches_uuid(const void *entry, struct ffa_uuid uuid)
 {
     struct ffa_uuid sp_uuid;
@@ -440,14 +442,6 @@ static void ffa_sp_list_cache_free(void)
     sp_list_entry_size = 0;
 }
 
-static void uninit_subscribers(void)
-{
-        subscr_vm_created_count = 0;
-        subscr_vm_destroyed_count = 0;
-        XFREE(subscr_vm_created);
-        XFREE(subscr_vm_destroyed);
-}
-
 static bool ffa_sp_list_cache_init(const void *buf, uint32_t count,
                                    uint32_t fpi_size)
 {
@@ -505,79 +499,6 @@ static bool ffa_sp_list_cache_init(const void *buf, uint32_t count,
     return true;
 }
 
-static bool init_subscribers(void *buf, uint16_t count, uint32_t fpi_size)
-{
-    uint16_t n;
-    uint16_t c_pos;
-    uint16_t d_pos;
-    struct ffa_partition_info_1_1 *fpi;
-
-    if ( fpi_size < sizeof(struct ffa_partition_info_1_1) )
-    {
-        printk(XENLOG_ERR "ffa: partition info size invalid: %u\n", fpi_size);
-        return false;
-    }
-
-    subscr_vm_created_count = 0;
-    subscr_vm_destroyed_count = 0;
-    for ( n = 0; n < count; n++ )
-    {
-        fpi = buf + n * fpi_size;
-
-        /*
-         * We need to have secure partitions using bit 15 set convention for
-         * secure partition IDs.
-         * Inform the user with a log and discard giving created or destroy
-         * event to those IDs.
-         */
-        if ( !FFA_ID_IS_SECURE(fpi->id) )
-        {
-            printk_once(XENLOG_ERR
-                        "ffa: Firmware is not using bit 15 convention for IDs !!\n");
-            printk(XENLOG_ERR
-                   "ffa: Secure partition with id 0x%04x cannot be used\n",
-                   fpi->id);
-        }
-        else
-        {
-            if ( fpi->partition_properties & FFA_PART_PROP_NOTIF_CREATED )
-                subscr_vm_created_count++;
-            if ( fpi->partition_properties & FFA_PART_PROP_NOTIF_DESTROYED )
-                subscr_vm_destroyed_count++;
-        }
-    }
-
-    if ( subscr_vm_created_count )
-        subscr_vm_created = xzalloc_array(uint16_t, subscr_vm_created_count);
-    if ( subscr_vm_destroyed_count )
-        subscr_vm_destroyed = xzalloc_array(uint16_t,
-                                            subscr_vm_destroyed_count);
-    if ( (subscr_vm_created_count && !subscr_vm_created) ||
-         (subscr_vm_destroyed_count && !subscr_vm_destroyed) )
-    {
-        printk(XENLOG_ERR "ffa: Failed to allocate subscription lists\n");
-        uninit_subscribers();
-        return false;
-    }
-
-    for ( c_pos = 0, d_pos = 0, n = 0; n < count; n++ )
-    {
-        fpi = buf + n * fpi_size;
-
-        if ( FFA_ID_IS_SECURE(fpi->id) )
-        {
-            if ( fpi->partition_properties & FFA_PART_PROP_NOTIF_CREATED )
-                subscr_vm_created[c_pos++] = fpi->id;
-            if ( fpi->partition_properties & FFA_PART_PROP_NOTIF_DESTROYED )
-                subscr_vm_destroyed[d_pos++] = fpi->id;
-        }
-    }
-
-    return true;
-}
-
-
-
 bool ffa_partinfo_init(void)
 {
     bool ret = false;
@@ -617,52 +538,39 @@ bool ffa_partinfo_init(void)
         goto out_release_rx;
     }
 
-    if ( !init_subscribers(sp_list, sp_list_count, sp_list_entry_size) )
-        goto out_free_sp_cache;
-
     ret = true;
     goto out_release_rx;
 
-out_free_sp_cache:
-    ffa_sp_list_cache_free();
-
 out_release_rx:
     e = ffa_rxtx_spmc_rx_release(notify_fw);
     if ( e )
         printk(XENLOG_WARNING "ffa: Error releasing SPMC RX buffer: %d\n", e);
-
+    if ( !ret )
+        ffa_sp_list_cache_free();
     return ret;
 }
 
-static bool is_in_subscr_list(const uint16_t *subscr, uint16_t start,
-                              uint16_t end, uint16_t sp_id)
+static void vm_destroy_bitmap_init(struct ffa_ctx *ctx,
+                                   unsigned int first_unnotified)
 {
     unsigned int n;
 
-    for ( n = start; n < end; n++ )
+    for ( n = 0; n < sp_list_count; n++ )
     {
-        if ( subscr[n] == sp_id )
-            return true;
-    }
-
-    return false;
-}
+        const void *entry = sp_list + n * sp_list_entry_size;
+        uint32_t partition_props =
+            ffa_sp_entry_read_partition_properties(entry);
 
-static void vm_destroy_bitmap_init(struct ffa_ctx *ctx,
-                                   unsigned int create_signal_count)
-{
-    unsigned int n;
+        if ( !(partition_props & FFA_PART_PROP_NOTIF_DESTROYED) )
+            continue;
 
-    for ( n = 0; n < subscr_vm_destroyed_count; n++ )
-    {
         /*
          * Skip SPs subscribed to the VM created event that never was
          * notified of the VM creation due to an error during
          * ffa_domain_init().
          */
-        if ( is_in_subscr_list(subscr_vm_created, create_signal_count,
-                               subscr_vm_created_count,
-                               subscr_vm_destroyed[n]) )
+        if ( (partition_props & FFA_PART_PROP_NOTIF_CREATED) &&
+             n >= first_unnotified )
             continue;
 
         set_bit(n, ctx->vm_destroy_bitmap);
@@ -671,32 +579,42 @@ static void vm_destroy_bitmap_init(struct ffa_ctx *ctx,
 
 int32_t ffa_partinfo_domain_init(struct domain *d)
 {
-    unsigned int count = BITS_TO_LONGS(subscr_vm_destroyed_count);
+    unsigned int count = BITS_TO_LONGS(sp_list_count);
     struct ffa_ctx *ctx = d->arch.tee;
     unsigned int n;
+    unsigned int first_unnotified = sp_list_count;
     int32_t res;
 
-    if ( !ffa_fw_supports_fid(FFA_MSG_SEND_DIRECT_REQ_32) )
+    if ( !ffa_fw_supports_fid(FFA_MSG_SEND_DIRECT_REQ_32) || !sp_list_count )
         return 0;
 
     ctx->vm_destroy_bitmap = xzalloc_array(unsigned long, count);
     if ( !ctx->vm_destroy_bitmap )
         return -ENOMEM;
 
-    for ( n = 0; n < subscr_vm_created_count; n++ )
+    for ( n = 0; n < sp_list_count; n++ )
     {
-        res = ffa_direct_req_send_vm(subscr_vm_created[n], ffa_get_vm_id(d),
+        const void *entry = sp_list + n * sp_list_entry_size;
+        uint32_t partition_props =
+            ffa_sp_entry_read_partition_properties(entry);
+        uint16_t id = ffa_sp_entry_read_id(entry);
+
+        if ( !(partition_props & FFA_PART_PROP_NOTIF_CREATED) )
+            continue;
+
+        res = ffa_direct_req_send_vm(id, ffa_get_vm_id(d),
                                      FFA_MSG_SEND_VM_CREATED);
         if ( res )
         {
             printk(XENLOG_ERR "ffa: Failed to report creation of vm_id %u to  %u: res %d\n",
-                   ffa_get_vm_id(d), subscr_vm_created[n], res);
+                   ffa_get_vm_id(d), id, res);
+            first_unnotified = n;
             break;
         }
     }
-    vm_destroy_bitmap_init(ctx, n);
+    vm_destroy_bitmap_init(ctx, first_unnotified);
 
-    if ( n != subscr_vm_created_count )
+    if ( first_unnotified != sp_list_count )
         return -EIO;
 
     return 0;
@@ -711,18 +629,24 @@ bool ffa_partinfo_domain_destroy(struct domain *d)
     if ( !ctx->vm_destroy_bitmap )
         return true;
 
-    for ( n = 0; n < subscr_vm_destroyed_count; n++ )
+    for ( n = 0; n < sp_list_count; n++ )
     {
+        const void *entry;
+        uint16_t id;
+
         if ( !test_bit(n, ctx->vm_destroy_bitmap) )
             continue;
 
-        res = ffa_direct_req_send_vm(subscr_vm_destroyed[n], ffa_get_vm_id(d),
+        entry = sp_list + n * sp_list_entry_size;
+        id = ffa_sp_entry_read_id(entry);
+
+        res = ffa_direct_req_send_vm(id, ffa_get_vm_id(d),
                                      FFA_MSG_SEND_VM_DESTROYED);
 
         if ( res && printk_ratelimit() )
             printk(XENLOG_WARNING
                    "%pd: ffa: Failed to report destruction of vm_id %u to %u: res %d\n",
-                   d, ffa_get_vm_id(d), subscr_vm_destroyed[n], res);
+                   d, ffa_get_vm_id(d), id, res);
 
         /*
          * For these two error codes the hypervisor is expected to resend
@@ -734,7 +658,7 @@ bool ffa_partinfo_domain_destroy(struct domain *d)
             clear_bit(n, ctx->vm_destroy_bitmap);
     }
 
-    if ( bitmap_empty(ctx->vm_destroy_bitmap, subscr_vm_destroyed_count) )
+    if ( bitmap_empty(ctx->vm_destroy_bitmap, sp_list_count) )
         XFREE(ctx->vm_destroy_bitmap);
 
     return !ctx->vm_destroy_bitmap;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 20 15:33:33 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 20 Mar 2026 15:33:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1258248.1552395 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w3bqv-0005xh-Cq; Fri, 20 Mar 2026 15:33:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1258248.1552395; Fri, 20 Mar 2026 15:33:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w3bqv-0005xZ-A6; Fri, 20 Mar 2026 15:33:33 +0000
Received: by outflank-mailman (input) for mailman id 1258248;
 Fri, 20 Mar 2026 15:33:31 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w3bqt-0005xQ-Rd
 for xen-changelog@lists.xenproject.org; Fri, 20 Mar 2026 15:33:31 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w3bqu-000bUn-07
 for xen-changelog@lists.xenproject.org;
 Fri, 20 Mar 2026 15:33:31 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w3bqt-003Pgp-2Y
 for xen-changelog@lists.xenproject.org;
 Fri, 20 Mar 2026 15:33:31 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=rlEp/q4Zp/cE/qqyxpP9M50wfkngZbPywNeuI11ShWA=; b=Z0bAvjAtLggMnDIrdU6aN2BD4Q
	wJk5YS73nINipTnIYZxXFmkFPi0MJtwe60Zfu/b8HVlG0tYGcuc49sH2blzkJBZvqDSut2rTXe4xB
	gPdyA/EndLIpoW+X8KBZMXD+b29Sov/tP2f2oENi4lfbf+wR9Uw/9afkdCL43dAw0QHE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: ffa: Add cached GET_REGS support
Message-Id: <E1w3bqt-003Pgp-2Y@xenbits.xenproject.org>
Date: Fri, 20 Mar 2026 15:33:31 +0000

commit 500ee5fe0f4b362f6c0f9afa6c7d3146b59196ff
Author:     Bertrand Marquis <bertrand.marquis@arm.com>
AuthorDate: Tue Jan 27 16:10:29 2026 +0100
Commit:     Julien Grall <julien@xen.org>
CommitDate: Fri Mar 20 11:14:23 2026 +0000

    xen/arm: ffa: Add cached GET_REGS support
    
    FF-A v1.2 defines PARTITION_INFO_GET_REGS for register-based partition
    info retrieval, but Xen currently only supports the buffer-based GET
    path for guests.
    
    Implement GET_REGS using the cached SP list and VM entries, including
    the register window layout and input validation. Track VM list changes
    via the partinfo tag and use it to validate GET_REGS tag inputs. Ensure
    that when a non-Nil UUID is specified, the UUID fields in both GET and
    GET_REGS results are MBZ as required by the specification.
    
    PARTITION_INFO_GET_REGS is available to v1.2 guests, returning cached SP
    entries and VM entries with UUIDs zeroed for non-Nil UUID queries.
    
    Also publish VM membership updates (VM count, ctx list, and partinfo
    tag) under the same write-locked section so GET_REGS sees coherent state
    and concurrent changes are reliably reported via RETRY.
    
    Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
    Acked-by: Julien Grall <julien@xen.org>
---
 xen/arch/arm/tee/ffa.c          |  23 ++++-
 xen/arch/arm/tee/ffa_partinfo.c | 201 ++++++++++++++++++++++++++++++++++++++++
 xen/arch/arm/tee/ffa_private.h  |   4 +-
 3 files changed, 224 insertions(+), 4 deletions(-)

diff --git a/xen/arch/arm/tee/ffa.c b/xen/arch/arm/tee/ffa.c
index d4a77206c6..1fe33f2645 100644
--- a/xen/arch/arm/tee/ffa.c
+++ b/xen/arch/arm/tee/ffa.c
@@ -44,6 +44,11 @@
  *   - doesn't support signalling the secondary scheduler of pending
  *     notification for secure partitions
  *   - doesn't support notifications for Xen itself
+ * o FFA_PARTITION_INFO_GET/GET_REGS:
+ *   - v1.0 guests may see duplicate SP IDs when firmware provides UUIDs
+ *   - SP list is cached at init; SPMC tag changes are not tracked
+ *     between calls
+ *   - SP list is capped at FFA_MAX_NUM_SP entries
  *
  * There are some large locked sections with ffa_spmc_tx_lock and
  * ffa_spmc_rx_lock. Especially the ffa_spmc_tx_lock spinlock used
@@ -184,10 +189,11 @@ static bool ffa_negotiate_version(struct cpu_user_regs *regs)
 
         if ( IS_ENABLED(CONFIG_FFA_VM_TO_VM) )
         {
-            /* One more VM with FF-A support available */
-            inc_ffa_vm_count();
             write_lock(&ffa_ctx_list_rwlock);
+            /* Publish VM membership changes atomically with tag updates. */
+            inc_ffa_vm_count();
             list_add_tail(&ctx->ctx_list, &ffa_ctx_head);
+            ffa_partinfo_inc_tag();
             write_unlock(&ffa_ctx_list_rwlock);
         }
 
@@ -342,6 +348,12 @@ static void handle_features(struct cpu_user_regs *regs)
     case FFA_FEATURE_SCHEDULE_RECV_INTR:
         ffa_set_regs_success(regs, GUEST_FFA_SCHEDULE_RECV_INTR_ID, 0);
         break;
+    case FFA_PARTITION_INFO_GET_REGS:
+        if ( ACCESS_ONCE(ctx->guest_vers) >= FFA_VERSION_1_2 )
+            ffa_set_regs_success(regs, 0, 0);
+        else
+            ffa_set_regs_error(regs, FFA_RET_NOT_SUPPORTED);
+        break;
 
     case FFA_NOTIFICATION_BIND:
     case FFA_NOTIFICATION_UNBIND:
@@ -403,6 +415,9 @@ static bool ffa_handle_call(struct cpu_user_regs *regs)
     case FFA_PARTITION_INFO_GET:
         ffa_handle_partition_info_get(regs);
         return true;
+    case FFA_PARTITION_INFO_GET_REGS:
+        ffa_handle_partition_info_get_regs(regs);
+        return true;
     case FFA_RX_RELEASE:
         e = ffa_rx_release(ctx);
         break;
@@ -626,9 +641,11 @@ static int ffa_domain_teardown(struct domain *d)
 
     if ( IS_ENABLED(CONFIG_FFA_VM_TO_VM) && ACCESS_ONCE(ctx->guest_vers) )
     {
-        dec_ffa_vm_count();
         write_lock(&ffa_ctx_list_rwlock);
+        /* Publish VM membership changes atomically with tag updates. */
+        dec_ffa_vm_count();
         list_del(&ctx->ctx_list);
+        ffa_partinfo_inc_tag();
         write_unlock(&ffa_ctx_list_rwlock);
     }
 
diff --git a/xen/arch/arm/tee/ffa_partinfo.c b/xen/arch/arm/tee/ffa_partinfo.c
index 419e19510f..4580bd5edb 100644
--- a/xen/arch/arm/tee/ffa_partinfo.c
+++ b/xen/arch/arm/tee/ffa_partinfo.c
@@ -29,10 +29,40 @@ struct ffa_partition_info_1_1 {
     uint8_t uuid[16];
 };
 
+/* Registers a3..a17 (15 regs) carry partition descriptors, 3 regs each. */
+#define FFA_PARTINFO_REG_MAX_ENTRIES \
+    ((15 * sizeof(uint64_t)) / sizeof(struct ffa_partition_info_1_1))
+
 /* SP list cache (secure endpoints only); populated at init. */
 static void *sp_list __read_mostly;
 static uint32_t sp_list_count __read_mostly;
 static uint32_t sp_list_entry_size __read_mostly;
+
+/* SP list is static; tag only moves when VMs are added/removed. */
+static atomic_t ffa_partinfo_tag = ATOMIC_INIT(1);
+
+void ffa_partinfo_inc_tag(void)
+{
+    atomic_inc(&ffa_partinfo_tag);
+}
+
+static inline uint16_t ffa_partinfo_get_tag(void)
+{
+    /*
+     * Tag moves with VM list changes only.
+     *
+     * Limitation: we cannot detect an SPMC tag change between calls because we
+     * do not retain the previous SPMC tag; we only refresh it via the mandatory
+     * start_index=0 call and assume it stays stable while combined_tag (our
+     * VM/SP-count tag) is used for guest validation. This means SPMC tag
+     * changes alone will not trigger RETRY.
+     */
+    if ( IS_ENABLED(CONFIG_FFA_VM_TO_VM) )
+        return atomic_read(&ffa_partinfo_tag) & GENMASK(15, 0);
+    else
+        return 1;
+}
+
 static int32_t ffa_partition_info_get(struct ffa_uuid uuid, uint32_t flags,
                                       uint32_t *count, uint32_t *fpi_size)
 {
@@ -140,6 +170,7 @@ static int32_t ffa_get_sp_partinfo(struct ffa_uuid uuid, uint32_t *sp_count,
     for ( n = 0; n < sp_list_count; n++ )
     {
         void *entry = sp_list + n * sp_list_entry_size;
+        void *dst_pos;
 
         if ( !ffa_sp_entry_matches_uuid(entry, uuid) )
             continue;
@@ -151,11 +182,20 @@ static int32_t ffa_get_sp_partinfo(struct ffa_uuid uuid, uint32_t *sp_count,
          * This is a non-compliance to the specification but 1.0 VMs should
          * handle that on their own to simplify Xen implementation.
          */
+        dst_pos = *dst_buf;
         ret = ffa_copy_info(dst_buf, end_buf, entry, dst_size,
                             sp_list_entry_size);
         if ( ret )
             return ret;
 
+        if ( !ffa_uuid_is_nil(uuid) &&
+             dst_size >= sizeof(struct ffa_partition_info_1_1) )
+        {
+            struct ffa_partition_info_1_1 *fpi = dst_pos;
+
+            memset(fpi->uuid, 0, sizeof(fpi->uuid));
+        }
+
         count++;
     }
 
@@ -167,6 +207,38 @@ static int32_t ffa_get_sp_partinfo(struct ffa_uuid uuid, uint32_t *sp_count,
     return FFA_RET_OK;
 }
 
+static uint16_t ffa_get_sp_partinfo_regs(struct ffa_uuid uuid,
+                                         uint16_t start_index,
+                                         uint64_t *out_regs,
+                                         uint16_t max_entries)
+{
+    uint32_t idx = 0;
+    uint16_t filled = 0;
+    uint32_t n;
+
+    for ( n = 0; n < sp_list_count && filled < max_entries; n++ )
+    {
+        void *entry = sp_list + n * sp_list_entry_size;
+
+        if ( !ffa_sp_entry_matches_uuid(entry, uuid) )
+            continue;
+
+        if ( idx++ < start_index )
+            continue;
+
+        memcpy(&out_regs[filled * 3], entry,
+               sizeof(struct ffa_partition_info_1_1));
+        if ( !ffa_uuid_is_nil(uuid) )
+        {
+            out_regs[filled * 3 + 1] = 0;
+            out_regs[filled * 3 + 2] = 0;
+        }
+        filled++;
+    }
+
+    return filled;
+}
+
 static int32_t ffa_get_vm_partinfo(struct ffa_uuid uuid, uint32_t start_index,
                                    uint32_t *vm_count, void **dst_buf,
                                    void *end_buf, uint32_t dst_size)
@@ -383,6 +455,135 @@ out:
     }
 }
 
+void ffa_handle_partition_info_get_regs(struct cpu_user_regs *regs)
+{
+    struct domain *d = current->domain;
+    struct ffa_ctx *ctx = d->arch.tee;
+    struct ffa_uuid uuid;
+    uint32_t sp_count = 0, vm_count = 0, total_count;
+    uint16_t start_index, tag;
+    uint16_t num_entries = 0;
+    uint64_t x3 = get_user_reg(regs, 3);
+    int32_t ret = FFA_RET_OK;
+    uint64_t out_regs[18] = { 0 };
+    unsigned int n;
+    uint16_t tag_out, tag_end;
+
+    if ( ACCESS_ONCE(ctx->guest_vers) < FFA_VERSION_1_2 )
+    {
+        ret = FFA_RET_NOT_SUPPORTED;
+        goto out;
+    }
+
+    /*
+     * Registers a3..a17 (15 regs) carry partition descriptors, 3 regs each.
+     * For FF-A 1.2, that yields a maximum of 5 entries per GET_REGS call.
+     * Enforce the assumed layout so window sizing stays correct.
+     */
+    BUILD_BUG_ON(FFA_PARTINFO_REG_MAX_ENTRIES != 5);
+
+    start_index = x3 & GENMASK(15, 0);
+    tag = (x3 >> 16) & GENMASK(15, 0);
+
+    /* Start index must allow room for up to 5 entries without overflow. */
+    if ( start_index > (GENMASK(15, 0) - (FFA_PARTINFO_REG_MAX_ENTRIES - 1)) )
+    {
+        ret = FFA_RET_INVALID_PARAMETERS;
+        goto out;
+    }
+
+    uuid.val[0] = get_user_reg(regs, 1);
+    uuid.val[1] = get_user_reg(regs, 2);
+
+    tag_out = ffa_partinfo_get_tag();
+
+    if ( start_index == 0 )
+    {
+        if ( tag )
+        {
+            ret = FFA_RET_INVALID_PARAMETERS;
+            goto out;
+        }
+    }
+    else if ( tag != tag_out )
+    {
+        ret = FFA_RET_RETRY;
+        goto out;
+    }
+
+    if ( ffa_uuid_is_nil(uuid) )
+    {
+        if ( IS_ENABLED(CONFIG_FFA_VM_TO_VM) )
+            vm_count = get_ffa_vm_count();
+        else
+            vm_count = 1; /* Caller VM only */
+    }
+
+    ret = ffa_get_sp_count(uuid, &sp_count);
+    if ( ret )
+        goto out;
+
+    total_count = sp_count + vm_count;
+
+    if ( total_count == 0 || start_index >= total_count )
+    {
+        ret = FFA_RET_INVALID_PARAMETERS;
+        goto out;
+    }
+
+    if ( start_index < sp_count )
+        num_entries = ffa_get_sp_partinfo_regs(uuid, start_index, &out_regs[3],
+                                               FFA_PARTINFO_REG_MAX_ENTRIES);
+
+    if ( num_entries < FFA_PARTINFO_REG_MAX_ENTRIES )
+    {
+        uint32_t vm_start = start_index > sp_count ?
+                            start_index - sp_count : 0;
+        uint32_t filled = 0;
+        void *vm_dst = &out_regs[3 + num_entries * 3];
+        void *vm_end = &out_regs[18];
+
+        ret = ffa_get_vm_partinfo(uuid, vm_start, &filled, &vm_dst, vm_end,
+                                  sizeof(struct ffa_partition_info_1_1));
+        if ( ret != FFA_RET_OK && ret != FFA_RET_NO_MEMORY )
+            goto out;
+
+        num_entries += filled;
+    }
+
+    if ( num_entries == 0 )
+    {
+        ret = FFA_RET_INVALID_PARAMETERS;
+        goto out;
+    }
+
+    /*
+     * Detect list changes while building the response so the caller can retry
+     * with a coherent snapshot tag.
+     */
+    tag_end = ffa_partinfo_get_tag();
+    if ( tag_end != tag_out )
+    {
+        ret = FFA_RET_RETRY;
+        goto out;
+    }
+
+    out_regs[0] = FFA_SUCCESS_64;
+    out_regs[2] = ((uint64_t)sizeof(struct ffa_partition_info_1_1) << 48) |
+                  ((uint64_t)tag_end << 32) |
+                  ((uint64_t)(start_index + num_entries - 1) << 16) |
+                  ((uint64_t)(total_count - 1) & GENMASK(15, 0));
+
+    for ( n = 0; n < ARRAY_SIZE(out_regs); n++ )
+        set_user_reg(regs, n, out_regs[n]);
+
+    return;
+
+out:
+    if ( ret )
+        ffa_set_regs_error(regs, ret);
+}
+
 static int32_t ffa_direct_req_send_vm(uint16_t sp_id, uint16_t vm_id,
                                       uint8_t msg)
 {
diff --git a/xen/arch/arm/tee/ffa_private.h b/xen/arch/arm/tee/ffa_private.h
index 1a632983c8..c291f32b56 100644
--- a/xen/arch/arm/tee/ffa_private.h
+++ b/xen/arch/arm/tee/ffa_private.h
@@ -289,7 +289,7 @@
 #define FFA_MSG_SEND2                   0x84000086U
 #define FFA_CONSOLE_LOG_32              0x8400008AU
 #define FFA_CONSOLE_LOG_64              0xC400008AU
-#define FFA_PARTITION_INFO_GET_REGS     0x8400008BU
+#define FFA_PARTITION_INFO_GET_REGS     0xC400008BU
 #define FFA_MSG_SEND_DIRECT_REQ2        0xC400008DU
 #define FFA_MSG_SEND_DIRECT_RESP2       0xC400008EU
 
@@ -452,6 +452,8 @@ bool ffa_partinfo_init(void);
 int32_t ffa_partinfo_domain_init(struct domain *d);
 bool ffa_partinfo_domain_destroy(struct domain *d);
 void ffa_handle_partition_info_get(struct cpu_user_regs *regs);
+void ffa_handle_partition_info_get_regs(struct cpu_user_regs *regs);
+void ffa_partinfo_inc_tag(void);
 
 int32_t ffa_endpoint_domain_lookup(uint16_t endpoint_id, struct domain **d_out,
                                    struct ffa_ctx **ctx_out);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Mar 23 12:22:07 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 23 Mar 2026 12:22:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1259280.1552579 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4eIF-0005hX-D2; Mon, 23 Mar 2026 12:22:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1259280.1552579; Mon, 23 Mar 2026 12:22:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4eIF-0005hP-AT; Mon, 23 Mar 2026 12:22:03 +0000
Received: by outflank-mailman (input) for mailman id 1259280;
 Mon, 23 Mar 2026 12:22:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w4eIE-0005hH-5R
 for xen-changelog@lists.xenproject.org; Mon, 23 Mar 2026 12:22:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4eIE-005XZ3-10
 for xen-changelog@lists.xenproject.org;
 Mon, 23 Mar 2026 12:22:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4eIE-007J9f-09
 for xen-changelog@lists.xenproject.org;
 Mon, 23 Mar 2026 12:22:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=virJxC5LZcO9fl1NxSlG4ua0KikmwjmHzOb1VomrzGg=; b=pY4ZADVUafv2klSHqjO2THbyvx
	VMUjidqZ4DZLVdCiKTxwHN3gNd5mItRgwetMueV1i/tOqTvH/3tzXgTbqQ1tQFOuxb8vmw86snsRJ
	dKEystX/rjJA8djHWUyzvIsdKj59SdoIDlMW7BvyGgWYy2Clmqylew1zj1sjzjWgjSMY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86: relax some CPU checks for non-64 bit CPUs
Message-Id: <E1w4eIE-007J9f-09@xenbits.xenproject.org>
Date: Mon, 23 Mar 2026 12:22:02 +0000

commit 28d61bb2035e7102e37d3fca9dfb4371e9c31c40
Author:     Kevin Lampis <kevin.lampis@citrix.com>
AuthorDate: Mon Mar 23 11:14:37 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Mar 23 11:14:37 2026 +0100

    x86: relax some CPU checks for non-64 bit CPUs
    
    These checks were guarding against non-64 bit CPU models but they are
    not supported by Xen anymore so the checks are no longer needed.
    
    The switch statement was removed from mcheck_init()
    to support Intel family 18/19.
    
    Suggested-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Kevin Lampis <kevin.lampis@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/acpi/cpu_idle.c    | 5 ++---
 xen/arch/x86/cpu/mcheck/mce.c   | 8 +-------
 xen/arch/x86/cpu/mtrr/generic.c | 3 +--
 3 files changed, 4 insertions(+), 12 deletions(-)

diff --git a/xen/arch/x86/acpi/cpu_idle.c b/xen/arch/x86/acpi/cpu_idle.c
index 0b3d0631dd..46749ca337 100644
--- a/xen/arch/x86/acpi/cpu_idle.c
+++ b/xen/arch/x86/acpi/cpu_idle.c
@@ -1059,9 +1059,8 @@ static void acpi_processor_power_init_bm_check(struct acpi_processor_flags *flag
      * is not required while entering C3 type state on
      * P4, Core and beyond CPUs
      */
-    if ( c->x86_vendor == X86_VENDOR_INTEL &&
-        (c->x86 > 0x6 || (c->x86 == 6 && c->x86_model >= 14)) )
-            flags->bm_control = 0;
+    if ( c->x86_vendor == X86_VENDOR_INTEL )
+        flags->bm_control = 0;
 }
 
 #define VENDOR_INTEL                   (1)
diff --git a/xen/arch/x86/cpu/mcheck/mce.c b/xen/arch/x86/cpu/mcheck/mce.c
index 9a91807cfb..c4b3b687a2 100644
--- a/xen/arch/x86/cpu/mcheck/mce.c
+++ b/xen/arch/x86/cpu/mcheck/mce.c
@@ -777,13 +777,7 @@ void mcheck_init(struct cpuinfo_x86 *c, bool bsp)
 
 #ifdef CONFIG_INTEL
     case X86_VENDOR_INTEL:
-        switch ( c->x86 )
-        {
-        case 6:
-        case 15:
-            inited = intel_mcheck_init(c, bsp);
-            break;
-        }
+        inited = intel_mcheck_init(c, bsp);
         break;
 #endif
 
diff --git a/xen/arch/x86/cpu/mtrr/generic.c b/xen/arch/x86/cpu/mtrr/generic.c
index c587e9140e..0ca6a2083f 100644
--- a/xen/arch/x86/cpu/mtrr/generic.c
+++ b/xen/arch/x86/cpu/mtrr/generic.c
@@ -218,8 +218,7 @@ static void __init print_mtrr_state(const char *level)
 			printk("%s  %u disabled\n", level, i);
 	}
 
-	if ((boot_cpu_data.x86_vendor == X86_VENDOR_AMD &&
-	     boot_cpu_data.x86 >= 0xf) ||
+	if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD ||
 	     boot_cpu_data.x86_vendor == X86_VENDOR_HYGON) {
 		uint64_t syscfg, tom2;
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Mar 23 12:22:14 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 23 Mar 2026 12:22:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1259281.1552583 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4eIQ-0005jF-Ec; Mon, 23 Mar 2026 12:22:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1259281.1552583; Mon, 23 Mar 2026 12:22:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4eIQ-0005j9-Br; Mon, 23 Mar 2026 12:22:14 +0000
Received: by outflank-mailman (input) for mailman id 1259281;
 Mon, 23 Mar 2026 12:22:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w4eIO-0005ir-99
 for xen-changelog@lists.xenproject.org; Mon, 23 Mar 2026 12:22:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4eIO-005XZR-1K
 for xen-changelog@lists.xenproject.org;
 Mon, 23 Mar 2026 12:22:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4eIO-007JJ1-0W
 for xen-changelog@lists.xenproject.org;
 Mon, 23 Mar 2026 12:22:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=KjOG4pHMZ4ZP/OLGYKOsTFifsVLG75/Lmiys6qrS8SI=; b=HzT1jSmjDsXKybphSy2q0LTt5R
	Kw2R7hXk/bmNGjnEjQnSWwvmRb0UVdTCP9Lj/3AlFYkrj1Pqoqe8OjwswBCM44HEzXpfV6LBEBR+k
	sj5FVKt5wilZUkzg+JCnHxCmAjh+rkYmmIgkG0wi68XIDTKTodCzFATT0mFNPHNtQPTY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86: Remove x86 prefixed names from acpi code
Message-Id: <E1w4eIO-007JJ1-0W@xenbits.xenproject.org>
Date: Mon, 23 Mar 2026 12:22:12 +0000

commit 7f696351ce1efcd6940c0cc217152a38f215fb88
Author:     Kevin Lampis <kevin.lampis@citrix.com>
AuthorDate: Mon Mar 23 11:15:46 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Mar 23 11:15:46 2026 +0100

    x86: Remove x86 prefixed names from acpi code
    
    struct cpuinfo_x86
      .x86        => .family
      .x86_vendor => .vendor
      .x86_model  => .model
      .x86_mask   => .stepping
    
    No functional change.
    
    This work is part of making Xen safe for Intel family 18/19.
    
    Signed-off-by: Kevin Lampis <kevin.lampis@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/acpi/cpu_idle.c         | 18 +++++++++---------
 xen/arch/x86/acpi/cpufreq/acpi.c     |  2 +-
 xen/arch/x86/acpi/cpufreq/cpufreq.c  |  4 ++--
 xen/arch/x86/acpi/cpufreq/powernow.c |  4 ++--
 4 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/xen/arch/x86/acpi/cpu_idle.c b/xen/arch/x86/acpi/cpu_idle.c
index 46749ca337..3001e98a6e 100644
--- a/xen/arch/x86/acpi/cpu_idle.c
+++ b/xen/arch/x86/acpi/cpu_idle.c
@@ -178,10 +178,10 @@ static void cf_check do_get_hw_residencies(void *arg)
     struct cpuinfo_x86 *c = &current_cpu_data;
     struct hw_residencies *hw_res = arg;
 
-    if ( c->x86_vendor != X86_VENDOR_INTEL || c->x86 != 6 )
+    if ( c->vendor != X86_VENDOR_INTEL || c->family != 6 )
         return;
 
-    switch ( c->x86_model )
+    switch ( c->model )
     {
     /* 4th generation Intel Core (Haswell) */
     case 0x45:
@@ -915,7 +915,7 @@ void cf_check acpi_dead_idle(void)
             mwait(cx->address, 0);
         }
     }
-    else if ( (current_cpu_data.x86_vendor &
+    else if ( (current_cpu_data.vendor &
                (X86_VENDOR_AMD | X86_VENDOR_HYGON)) &&
               cx->entry_method == ACPI_CSTATE_EM_SYSIO )
     {
@@ -1042,8 +1042,8 @@ static void acpi_processor_power_init_bm_check(struct acpi_processor_flags *flag
     flags->bm_check = 0;
     if ( num_online_cpus() == 1 )
         flags->bm_check = 1;
-    else if ( (c->x86_vendor == X86_VENDOR_INTEL) ||
-              ((c->x86_vendor == X86_VENDOR_AMD) && (c->x86 == 0x15)) )
+    else if ( (c->vendor == X86_VENDOR_INTEL) ||
+              ((c->vendor == X86_VENDOR_AMD) && (c->family == 0x15)) )
     {
         /*
          * Today all MP CPUs that support C3 share cache.
@@ -1059,7 +1059,7 @@ static void acpi_processor_power_init_bm_check(struct acpi_processor_flags *flag
      * is not required while entering C3 type state on
      * P4, Core and beyond CPUs
      */
-    if ( c->x86_vendor == X86_VENDOR_INTEL )
+    if ( c->vendor == X86_VENDOR_INTEL )
         flags->bm_control = 0;
 }
 
@@ -1415,12 +1415,12 @@ static void amd_cpuidle_init(struct acpi_processor_power *power)
     if ( vendor_override < 0 )
         return;
 
-    switch ( c->x86 )
+    switch ( c->family )
     {
     case 0x1a:
     case 0x19:
     case 0x18:
-        if ( boot_cpu_data.x86_vendor != X86_VENDOR_HYGON )
+        if ( boot_cpu_data.vendor != X86_VENDOR_HYGON )
         {
     default:
             vendor_override = -1;
@@ -1647,7 +1647,7 @@ static int cf_check cpu_callback(
         break;
 
     case CPU_ONLINE:
-        if ( (boot_cpu_data.x86_vendor &
+        if ( (boot_cpu_data.vendor &
               (X86_VENDOR_AMD | X86_VENDOR_HYGON)) &&
              processor_powers[cpu] )
             amd_cpuidle_init(processor_powers[cpu]);
diff --git a/xen/arch/x86/acpi/cpufreq/acpi.c b/xen/arch/x86/acpi/cpufreq/acpi.c
index d0ca660db1..de67f1aee2 100644
--- a/xen/arch/x86/acpi/cpufreq/acpi.c
+++ b/xen/arch/x86/acpi/cpufreq/acpi.c
@@ -454,7 +454,7 @@ static int cf_check acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)
 
     /* Check for APERF/MPERF support in hardware
      * also check for boost support */
-    if (c->x86_vendor == X86_VENDOR_INTEL && c->cpuid_level >= 6)
+    if (c->vendor == X86_VENDOR_INTEL && c->cpuid_level >= 6)
         on_selected_cpus(cpumask_of(cpu), feature_detect, policy, 1);
 
     /*
diff --git a/xen/arch/x86/acpi/cpufreq/cpufreq.c b/xen/arch/x86/acpi/cpufreq/cpufreq.c
index 5740c0d438..9ef62b3538 100644
--- a/xen/arch/x86/acpi/cpufreq/cpufreq.c
+++ b/xen/arch/x86/acpi/cpufreq/cpufreq.c
@@ -133,7 +133,7 @@ static int __init cf_check cpufreq_driver_init(void)
 
         ret = -ENOENT;
 
-        switch ( boot_cpu_data.x86_vendor )
+        switch ( boot_cpu_data.vendor )
         {
         case X86_VENDOR_INTEL:
             for ( i = 0; i < cpufreq_xen_cnt; i++ )
@@ -252,7 +252,7 @@ __initcall(cpufreq_driver_late_init);
 int cpufreq_cpu_init(unsigned int cpu)
 {
     /* Currently we only handle Intel, AMD and Hygon processor */
-    if ( boot_cpu_data.x86_vendor &
+    if ( boot_cpu_data.vendor &
          (X86_VENDOR_INTEL | X86_VENDOR_AMD | X86_VENDOR_HYGON) )
         return cpufreq_add_cpu(cpu);
 
diff --git a/xen/arch/x86/acpi/cpufreq/powernow.c b/xen/arch/x86/acpi/cpufreq/powernow.c
index beab6cac36..55166eac72 100644
--- a/xen/arch/x86/acpi/cpufreq/powernow.c
+++ b/xen/arch/x86/acpi/cpufreq/powernow.c
@@ -143,7 +143,7 @@ static void amd_fixup_frequency(struct xen_processor_px *px)
     int index = px->control & 0x00000007;
     const struct cpuinfo_x86 *c = &current_cpu_data;
 
-    if ((c->x86 != 0x10 || c->x86_model >= 10) && c->x86 != 0x11)
+    if ((c->family != 0x10 || c->model >= 10) && c->family != 0x11)
         return;
 
     val = rdmsr(MSR_PSTATE_DEF_BASE + index);
@@ -157,7 +157,7 @@ static void amd_fixup_frequency(struct xen_processor_px *px)
 
     fid = val & 0x3f;
     did = (val >> 6) & 7;
-    if (c->x86 == 0x10)
+    if (c->family == 0x10)
         px->core_frequency = (100 * (fid + 16)) >> did;
     else
         px->core_frequency = (100 * (fid + 8)) >> did;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Mar 23 12:22:23 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 23 Mar 2026 12:22:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1259282.1552586 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4eIZ-0005lz-Fo; Mon, 23 Mar 2026 12:22:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1259282.1552586; Mon, 23 Mar 2026 12:22:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4eIZ-0005ls-DF; Mon, 23 Mar 2026 12:22:23 +0000
Received: by outflank-mailman (input) for mailman id 1259282;
 Mon, 23 Mar 2026 12:22:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w4eIY-0005lk-AL
 for xen-changelog@lists.xenproject.org; Mon, 23 Mar 2026 12:22:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4eIY-005XZb-1b
 for xen-changelog@lists.xenproject.org;
 Mon, 23 Mar 2026 12:22:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4eIY-007JRs-0p
 for xen-changelog@lists.xenproject.org;
 Mon, 23 Mar 2026 12:22:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=qsNkSF7974Ljn9OqdrMXI+eXfUZZJjwx9W8+oz8QWPc=; b=e+9O3kNbnJUyvB2PBCysieWBkt
	lpeLz6iu9o4L537Pt9ZjiDNvILYGSrdXfJ6rWThzmHWTr0pgLc5X9FJ3I/i67m48lnrE5cNZLxto0
	ITDqOCsWsbvstNj29zB4NUQWZGc1HIebWIAQRcyUWfUkLCeJR1NfpGb0GUd5t2u+EboI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86: Remove x86 prefixed names from x86/cpu/ files
Message-Id: <E1w4eIY-007JRs-0p@xenbits.xenproject.org>
Date: Mon, 23 Mar 2026 12:22:22 +0000

commit 39a9a49449d7dc0edb0148779aa81955a6db172f
Author:     Kevin Lampis <kevin.lampis@citrix.com>
AuthorDate: Mon Mar 23 11:16:30 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Mar 23 11:16:30 2026 +0100

    x86: Remove x86 prefixed names from x86/cpu/ files
    
    struct cpuinfo_x86
      .x86        => .family
      .x86_vendor => .vendor
      .x86_model  => .model
      .x86_mask   => .stepping
    
    No functional change.
    
    This work is part of making Xen safe for Intel family 18/19.
    
    Signed-off-by: Kevin Lampis <kevin.lampis@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/cpu/centaur.c         | 4 ++--
 xen/arch/x86/cpu/hygon.c           | 4 ++--
 xen/arch/x86/cpu/intel_cacheinfo.c | 6 +++---
 xen/arch/x86/cpu/mtrr/generic.c    | 4 ++--
 xen/arch/x86/cpu/mwait-idle.c      | 4 ++--
 xen/arch/x86/cpu/vpmu.c            | 4 ++--
 xen/arch/x86/cpu/vpmu_amd.c        | 6 +++---
 xen/arch/x86/cpu/vpmu_intel.c      | 4 ++--
 8 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/xen/arch/x86/cpu/centaur.c b/xen/arch/x86/cpu/centaur.c
index d2e7c8ec99..9123b05dc1 100644
--- a/xen/arch/x86/cpu/centaur.c
+++ b/xen/arch/x86/cpu/centaur.c
@@ -41,7 +41,7 @@ static void init_c3(struct cpuinfo_x86 *c)
 		}
 	}
 
-	if (c->x86 == 0x6 && c->x86_model >= 0xf) {
+	if (c->family == 0x6 && c->model >= 0xf) {
 		c->x86_cache_alignment = c->x86_clflush_size * 2;
 		__set_bit(X86_FEATURE_CONSTANT_TSC, c->x86_capability);
 	}
@@ -52,7 +52,7 @@ static void init_c3(struct cpuinfo_x86 *c)
 
 static void cf_check init_centaur(struct cpuinfo_x86 *c)
 {
-	if (c->x86 == 6)
+	if (c->family == 6)
 		init_c3(c);
 }
 
diff --git a/xen/arch/x86/cpu/hygon.c b/xen/arch/x86/cpu/hygon.c
index b99d83ed4d..7a9fc25d31 100644
--- a/xen/arch/x86/cpu/hygon.c
+++ b/xen/arch/x86/cpu/hygon.c
@@ -41,12 +41,12 @@ static void cf_check init_hygon(struct cpuinfo_x86 *c)
 
 	/* Probe for NSCB on Zen2 CPUs when not virtualised */
 	if (!cpu_has_hypervisor && !cpu_has_nscb && c == &boot_cpu_data &&
-	    c->x86 == 0x18)
+	    c->family == 0x18)
 		detect_zen2_null_seg_behaviour();
 
 	/*
 	 * TODO: Check heuristic safety with Hygon first
-	if (c->x86 == 0x18)
+	if (c->family == 0x18)
 		amd_init_spectral_chicken();
 	 */
 
diff --git a/xen/arch/x86/cpu/intel_cacheinfo.c b/xen/arch/x86/cpu/intel_cacheinfo.c
index e88faa7545..a81d0764fb 100644
--- a/xen/arch/x86/cpu/intel_cacheinfo.c
+++ b/xen/arch/x86/cpu/intel_cacheinfo.c
@@ -168,15 +168,15 @@ void init_intel_cacheinfo(struct cpuinfo_x86 *c)
 	 * Don't use cpuid2 if cpuid4 is supported. For P4, we use cpuid2 for
 	 * trace cache
 	 */
-	if ((num_cache_leaves == 0 || c->x86 == 15) && c->cpuid_level > 1 &&
-	    c->x86_vendor != X86_VENDOR_SHANGHAI)
+	if ((num_cache_leaves == 0 || c->family == 15) && c->cpuid_level > 1 &&
+	    c->vendor != X86_VENDOR_SHANGHAI)
 	{
 		/* supports eax=2  call */
 		unsigned int i, j, n, regs[4];
 		unsigned char *dp = (unsigned char *)regs;
 		int only_trace = 0;
 
-		if (num_cache_leaves != 0 && c->x86 == 15)
+		if (num_cache_leaves != 0 && c->family == 15)
 			only_trace = 1;
 
 		/* Number of times to iterate */
diff --git a/xen/arch/x86/cpu/mtrr/generic.c b/xen/arch/x86/cpu/mtrr/generic.c
index 0ca6a2083f..23c279eb9a 100644
--- a/xen/arch/x86/cpu/mtrr/generic.c
+++ b/xen/arch/x86/cpu/mtrr/generic.c
@@ -218,8 +218,8 @@ static void __init print_mtrr_state(const char *level)
 			printk("%s  %u disabled\n", level, i);
 	}
 
-	if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD ||
-	     boot_cpu_data.x86_vendor == X86_VENDOR_HYGON) {
+	if (boot_cpu_data.vendor == X86_VENDOR_AMD ||
+	     boot_cpu_data.vendor == X86_VENDOR_HYGON) {
 		uint64_t syscfg, tom2;
 
 		rdmsrl(MSR_K8_SYSCFG, syscfg);
diff --git a/xen/arch/x86/cpu/mwait-idle.c b/xen/arch/x86/cpu/mwait-idle.c
index 5962ec1db9..6776eeb9ac 100644
--- a/xen/arch/x86/cpu/mwait-idle.c
+++ b/xen/arch/x86/cpu/mwait-idle.c
@@ -1637,7 +1637,7 @@ static int __init mwait_idle_probe(void)
 		lapic_timer_reliable_states = LAPIC_TIMER_ALWAYS_RELIABLE;
 
 	pr_debug(PREFIX "v" MWAIT_IDLE_VERSION " model %#x\n",
-		 boot_cpu_data.x86_model);
+		 boot_cpu_data.model);
 
 	pr_debug(PREFIX "lapic_timer_reliable_states %#x\n",
 		 lapic_timer_reliable_states);
@@ -1816,7 +1816,7 @@ bool __init mwait_pc10_supported(void)
 {
 	unsigned int ecx, edx, dummy;
 
-	if (boot_cpu_data.x86_vendor != X86_VENDOR_INTEL ||
+	if (boot_cpu_data.vendor != X86_VENDOR_INTEL ||
 	    !cpu_has_monitor ||
 	    boot_cpu_data.cpuid_level < CPUID_MWAIT_LEAF)
 		return false;
diff --git a/xen/arch/x86/cpu/vpmu.c b/xen/arch/x86/cpu/vpmu.c
index c28192ea26..470f5ec98d 100644
--- a/xen/arch/x86/cpu/vpmu.c
+++ b/xen/arch/x86/cpu/vpmu.c
@@ -398,7 +398,7 @@ int vpmu_load(struct vcpu *v, bool from_guest)
 static int vpmu_arch_initialise(struct vcpu *v)
 {
     struct vpmu_struct *vpmu = vcpu_vpmu(v);
-    uint8_t vendor = current_cpu_data.x86_vendor;
+    unsigned int vendor = current_cpu_data.vendor;
     int ret;
 
     BUILD_BUG_ON(sizeof(struct xen_pmu_intel_ctxt) > XENPMU_CTXT_PAD_SZ);
@@ -815,7 +815,7 @@ static struct notifier_block cpu_nfb = {
 
 static int __init cf_check vpmu_init(void)
 {
-    int vendor = current_cpu_data.x86_vendor;
+    unsigned int vendor = current_cpu_data.vendor;
     const struct arch_vpmu_ops *ops = NULL;
 
     if ( !opt_vpmu_enabled )
diff --git a/xen/arch/x86/cpu/vpmu_amd.c b/xen/arch/x86/cpu/vpmu_amd.c
index d1f6bd5495..943a0f4ebe 100644
--- a/xen/arch/x86/cpu/vpmu_amd.c
+++ b/xen/arch/x86/cpu/vpmu_amd.c
@@ -532,7 +532,7 @@ static const struct arch_vpmu_ops *__init common_init(void)
     if ( !num_counters )
     {
         printk(XENLOG_WARNING "VPMU: Unsupported CPU family %#x\n",
-               current_cpu_data.x86);
+               current_cpu_data.family);
         return ERR_PTR(-EINVAL);
     }
 
@@ -557,7 +557,7 @@ static const struct arch_vpmu_ops *__init common_init(void)
 
 const struct arch_vpmu_ops *__init amd_vpmu_init(void)
 {
-    switch ( current_cpu_data.x86 )
+    switch ( current_cpu_data.family )
     {
     case 0x15:
     case 0x17:
@@ -585,7 +585,7 @@ const struct arch_vpmu_ops *__init amd_vpmu_init(void)
 
 const struct arch_vpmu_ops *__init hygon_vpmu_init(void)
 {
-    switch ( current_cpu_data.x86 )
+    switch ( current_cpu_data.family )
     {
     case 0x18:
         num_counters = F15H_NUM_COUNTERS;
diff --git a/xen/arch/x86/cpu/vpmu_intel.c b/xen/arch/x86/cpu/vpmu_intel.c
index 1e3b06ef8e..ed9f62b936 100644
--- a/xen/arch/x86/cpu/vpmu_intel.c
+++ b/xen/arch/x86/cpu/vpmu_intel.c
@@ -917,7 +917,7 @@ const struct arch_vpmu_ops *__init core2_vpmu_init(void)
         return ERR_PTR(-EINVAL);
     }
 
-    if ( current_cpu_data.x86 != 6 )
+    if ( current_cpu_data.family != 6 )
     {
         printk(XENLOG_WARNING "VPMU: only family 6 is supported\n");
         return ERR_PTR(-EINVAL);
@@ -958,7 +958,7 @@ const struct arch_vpmu_ops *__init core2_vpmu_init(void)
               sizeof(struct xen_pmu_cntr_pair) * arch_pmc_cnt;
 
     /* TODO: It's clearly incorrect for this to quirk all Intel Fam6 CPUs. */
-    pmc_quirk = current_cpu_data.x86 == 6;
+    pmc_quirk = current_cpu_data.family == 6;
 
     if ( sizeof(struct xen_pmu_data) + sizeof(uint64_t) * fixed_pmc_cnt +
          sizeof(struct xen_pmu_cntr_pair) * arch_pmc_cnt > PAGE_SIZE )
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Mar 23 12:22:33 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 23 Mar 2026 12:22:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1259283.1552592 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4eIj-0005oX-Hm; Mon, 23 Mar 2026 12:22:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1259283.1552592; Mon, 23 Mar 2026 12:22:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4eIj-0005oP-Ef; Mon, 23 Mar 2026 12:22:33 +0000
Received: by outflank-mailman (input) for mailman id 1259283;
 Mon, 23 Mar 2026 12:22:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w4eIi-0005np-EB
 for xen-changelog@lists.xenproject.org; Mon, 23 Mar 2026 12:22:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4eIi-005XZf-20
 for xen-changelog@lists.xenproject.org;
 Mon, 23 Mar 2026 12:22:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4eIi-007JaQ-17
 for xen-changelog@lists.xenproject.org;
 Mon, 23 Mar 2026 12:22:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=NW7joWxklScC/iR89ZRh3aLJnHvriYAudMNt0rkl2yE=; b=WAi9VAdlSU4jPkbSoHY8SXJ5bf
	niD24CtAyIsDCgosUjv1LiqeP5H5FMh5COdmHVJwOg1sqyTIqsBO9Xkrl5ir2XLFJ9EXW6MOZUhNb
	/BJ0wgeglTU6W5ji3yatoLHC17y6bEK8GSqqsHN8e3DlUuBjZBx0OoMAiJuVX9+E5esk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] efi: Enable EFI_SET_VIRTUAL_ADDRESS_MAP by default
Message-Id: <E1w4eIi-007JaQ-17@xenbits.xenproject.org>
Date: Mon, 23 Mar 2026 12:22:32 +0000

commit 05dbc316f6b72e8fe03fc5a8792bec22078a48be
Author:     Teddy Astie <teddy.astie@vates.tech>
AuthorDate: Mon Mar 23 11:16:45 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Mar 23 11:16:45 2026 +0100

    efi: Enable EFI_SET_VIRTUAL_ADDRESS_MAP by default
    
    Many machines fails to boot if this option is disabled.
    It's off by default as it was deemed too risky for being enabled
    by default late in the Xen 4.13 cycle, but found out to be safe.
    As there are no known drawback by having this option on, enable
    it by default.
    
    Signed-off-by: Teddy Astie <teddy.astie@vates.tech>
    Acked-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
---
 xen/common/Kconfig | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/xen/common/Kconfig b/xen/common/Kconfig
index d7e79e752a..0a20aa0a12 100644
--- a/xen/common/Kconfig
+++ b/xen/common/Kconfig
@@ -363,14 +363,13 @@ config KEXEC
 
 config EFI_SET_VIRTUAL_ADDRESS_MAP
     bool "EFI: call SetVirtualAddressMap()" if EXPERT
+    default y
     help
       Call EFI SetVirtualAddressMap() runtime service to setup memory map for
       further runtime services. According to UEFI spec, it isn't strictly
       necessary, but many UEFI implementations misbehave when this call is
       missing.
 
-      If unsure, say N.
-
 config XSM
 	bool "Xen Security Modules support"
 	default ARM
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Mar 23 12:22:43 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 23 Mar 2026 12:22:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1259284.1552595 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4eIt-0005qw-Ic; Mon, 23 Mar 2026 12:22:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1259284.1552595; Mon, 23 Mar 2026 12:22:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4eIt-0005qo-G3; Mon, 23 Mar 2026 12:22:43 +0000
Received: by outflank-mailman (input) for mailman id 1259284;
 Mon, 23 Mar 2026 12:22:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w4eIs-0005qN-IA
 for xen-changelog@lists.xenproject.org; Mon, 23 Mar 2026 12:22:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4eIs-005XZm-2H
 for xen-changelog@lists.xenproject.org;
 Mon, 23 Mar 2026 12:22:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4eIs-007Jkf-1V
 for xen-changelog@lists.xenproject.org;
 Mon, 23 Mar 2026 12:22:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=j78NZtTqe1ClXxsJlNsQc6oZTIzX9ZCL/OV/wv0Dj28=; b=zt8fmVwRVIkS02Y9mkcMZa3E4U
	JKM5hFkSEK5X3wccyvLz7TzSNhBnnuHJjHoE7TyUkGte74pvw8gGDswosXcppibwXV29lH3S0/MjJ
	1q7o8CPzgv4O3Ly0DGfrQvydZ/zrv4y6oqfpmbOY/A37AYG2E7zO3P0v9aTWqwOaLhgY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/hap: Defer NPT P2M TLB flushes
Message-Id: <E1w4eIs-007Jkf-1V@xenbits.xenproject.org>
Date: Mon, 23 Mar 2026 12:22:42 +0000

commit e1604ea8270096e5bb15866a1db75fbe56a730c7
Author:     Ross Lagerwall <ross.lagerwall@citrix.com>
AuthorDate: Mon Mar 23 11:17:06 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Mar 23 11:17:06 2026 +0100

    x86/hap: Defer NPT P2M TLB flushes
    
    Like the EPT code, defer TLB flushes for NPT to reduce the number of
    flushes and avoid holding the P2M lock while flushing. This can
    substantially improve performance in some scenarios.
    
    The cases where the TLB needs to be flushed without deferring are
    already handled by the call to p2m_tlb_flush_sync() in p2m_free_ptp().
    
    Suggested-by: Roger Pau Monne <roger.pau@citrix.com>
    Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/mm/hap/hap.c | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/mm/hap/hap.c b/xen/arch/x86/mm/hap/hap.c
index a337752bf4..5ccb80bda5 100644
--- a/xen/arch/x86/mm/hap/hap.c
+++ b/xen/arch/x86/mm/hap/hap.c
@@ -814,15 +814,33 @@ static void cf_check hap_update_paging_modes(struct vcpu *v)
 static void cf_check
 hap_write_p2m_entry_post(struct p2m_domain *p2m, unsigned int oflags)
 {
-    struct domain *d = p2m->domain;
+    if ( !(oflags & _PAGE_PRESENT) )
+        return;
+
+    if ( unlikely(!p2m->defer_flush) )
+    {
+        const struct domain *d = p2m->domain;
 
-    if ( oflags & _PAGE_PRESENT )
+        ASSERT_UNREACHABLE();
         guest_flush_tlb_mask(d, d->dirty_cpumask);
+        return;
+    }
+
+    p2m->need_flush = true;
+}
+
+static void cf_check
+hap_p2m_tlb_flush(struct p2m_domain *p2m)
+{
+    const struct domain *d = p2m->domain;
+
+    guest_flush_tlb_mask(d, d->dirty_cpumask);
 }
 
 void hap_p2m_init(struct p2m_domain *p2m)
 {
     p2m->write_p2m_entry_post = hap_write_p2m_entry_post;
+    p2m->tlb_flush = hap_p2m_tlb_flush;
 }
 
 static unsigned long cf_check hap_gva_to_gfn_real_mode(
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Mar 23 12:22:53 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 23 Mar 2026 12:22:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1259285.1552599 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4eJ3-0005tR-K1; Mon, 23 Mar 2026 12:22:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1259285.1552599; Mon, 23 Mar 2026 12:22:53 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4eJ3-0005tJ-HM; Mon, 23 Mar 2026 12:22:53 +0000
Received: by outflank-mailman (input) for mailman id 1259285;
 Mon, 23 Mar 2026 12:22:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w4eJ2-0005tD-Jc
 for xen-changelog@lists.xenproject.org; Mon, 23 Mar 2026 12:22:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4eJ2-005XZq-2X
 for xen-changelog@lists.xenproject.org;
 Mon, 23 Mar 2026 12:22:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4eJ2-007Jqj-1l
 for xen-changelog@lists.xenproject.org;
 Mon, 23 Mar 2026 12:22:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=E5okdnSTFkgOiaRQcM+sxxoLpn5y1W/2zKO8emOzYyc=; b=w28ol6LWdpXmkJQGEuqEkZmgaL
	J4wgwIeDIea0L9xBDckM5AzWhDh1/bmnaQeUnQmZOpOxdJbp3lISlSiI+SdSyn09APMdHz0bCaSuW
	SiZd2TcyaHTdTsdI6A38hbMkEDCjUwDKzJFJgs15hC4BKqu4rYG0Q9Tt1L8ELMZEMdRc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/cache-col: address MISRA C Rule 5.3
Message-Id: <E1w4eJ2-007Jqj-1l@xenbits.xenproject.org>
Date: Mon, 23 Mar 2026 12:22:52 +0000

commit a87d5761e27a2c1d6051c681deafcb48a88eaf88
Author:     Dmytro Prokopchuk <dmytro_prokopchuk1@epam.com>
AuthorDate: Mon Mar 23 11:17:24 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Mar 23 11:17:24 2026 +0100

    xen/cache-col: address MISRA C Rule 5.3
    
    MISRA C:2012 Rule 5.3 states as following: An identifier declared in an
    inner scope shall not hide an identifier declared in an outer scope.
    
    Inside the 'if' block, the inner 'i' shadows the outer 'i'.
    Reuse the outer variable and remove the inner declaration to fix that.
    
    No functional change.
    
    Signed-off-by: Dmytro Prokopchuk <dmytro_prokopchuk1@epam.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/common/llc-coloring.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/xen/common/llc-coloring.c b/xen/common/llc-coloring.c
index 77a54beed1..822a6b2ed5 100644
--- a/xen/common/llc-coloring.c
+++ b/xen/common/llc-coloring.c
@@ -193,8 +193,6 @@ void __init llc_coloring_init(void)
 
     if ( !xen_num_colors )
     {
-        unsigned int i;
-
         xen_num_colors = MIN(XEN_DEFAULT_NUM_COLORS, max_nr_colors);
 
         printk(XENLOG_WARNING
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Mar 23 14:55:05 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 23 Mar 2026 14:55:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1259392.1552692 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4ggI-0007VL-2b; Mon, 23 Mar 2026 14:55:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1259392.1552692; Mon, 23 Mar 2026 14:55:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4ggH-0007VD-Vn; Mon, 23 Mar 2026 14:55:01 +0000
Received: by outflank-mailman (input) for mailman id 1259392;
 Mon, 23 Mar 2026 14:55:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w4ggH-0007V7-Q2
 for xen-changelog@lists.xenproject.org; Mon, 23 Mar 2026 14:55:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4ggH-005aix-2x
 for xen-changelog@lists.xenproject.org;
 Mon, 23 Mar 2026 14:55:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4ggH-009DfW-27
 for xen-changelog@lists.xenproject.org;
 Mon, 23 Mar 2026 14:55:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=QY1zEiWNsjxD1ImIvybMXJTYZyRJSswFDg5nK/ozVjM=; b=35diIoZS3VOwVS7pdvVaHi89D5
	GaVohc6PnXq2eHUuewIa8ZqQ1ZParsXigfwtltpVTPJJS3ud7VvKUkSpz/CfuPjZnvkbbRmWrEjBW
	PQBROK/V6aJ4jNLbrGICENFVs44NQkhwOcbykmICmdpq00zjOSvmUhxpM9cJyMTtaD0k=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86: relax some CPU checks for non-64 bit CPUs
Message-Id: <E1w4ggH-009DfW-27@xenbits.xenproject.org>
Date: Mon, 23 Mar 2026 14:55:01 +0000

commit 28d61bb2035e7102e37d3fca9dfb4371e9c31c40
Author:     Kevin Lampis <kevin.lampis@citrix.com>
AuthorDate: Mon Mar 23 11:14:37 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Mar 23 11:14:37 2026 +0100

    x86: relax some CPU checks for non-64 bit CPUs
    
    These checks were guarding against non-64 bit CPU models but they are
    not supported by Xen anymore so the checks are no longer needed.
    
    The switch statement was removed from mcheck_init()
    to support Intel family 18/19.
    
    Suggested-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Kevin Lampis <kevin.lampis@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/acpi/cpu_idle.c    | 5 ++---
 xen/arch/x86/cpu/mcheck/mce.c   | 8 +-------
 xen/arch/x86/cpu/mtrr/generic.c | 3 +--
 3 files changed, 4 insertions(+), 12 deletions(-)

diff --git a/xen/arch/x86/acpi/cpu_idle.c b/xen/arch/x86/acpi/cpu_idle.c
index 0b3d0631dd..46749ca337 100644
--- a/xen/arch/x86/acpi/cpu_idle.c
+++ b/xen/arch/x86/acpi/cpu_idle.c
@@ -1059,9 +1059,8 @@ static void acpi_processor_power_init_bm_check(struct acpi_processor_flags *flag
      * is not required while entering C3 type state on
      * P4, Core and beyond CPUs
      */
-    if ( c->x86_vendor == X86_VENDOR_INTEL &&
-        (c->x86 > 0x6 || (c->x86 == 6 && c->x86_model >= 14)) )
-            flags->bm_control = 0;
+    if ( c->x86_vendor == X86_VENDOR_INTEL )
+        flags->bm_control = 0;
 }
 
 #define VENDOR_INTEL                   (1)
diff --git a/xen/arch/x86/cpu/mcheck/mce.c b/xen/arch/x86/cpu/mcheck/mce.c
index 9a91807cfb..c4b3b687a2 100644
--- a/xen/arch/x86/cpu/mcheck/mce.c
+++ b/xen/arch/x86/cpu/mcheck/mce.c
@@ -777,13 +777,7 @@ void mcheck_init(struct cpuinfo_x86 *c, bool bsp)
 
 #ifdef CONFIG_INTEL
     case X86_VENDOR_INTEL:
-        switch ( c->x86 )
-        {
-        case 6:
-        case 15:
-            inited = intel_mcheck_init(c, bsp);
-            break;
-        }
+        inited = intel_mcheck_init(c, bsp);
         break;
 #endif
 
diff --git a/xen/arch/x86/cpu/mtrr/generic.c b/xen/arch/x86/cpu/mtrr/generic.c
index c587e9140e..0ca6a2083f 100644
--- a/xen/arch/x86/cpu/mtrr/generic.c
+++ b/xen/arch/x86/cpu/mtrr/generic.c
@@ -218,8 +218,7 @@ static void __init print_mtrr_state(const char *level)
 			printk("%s  %u disabled\n", level, i);
 	}
 
-	if ((boot_cpu_data.x86_vendor == X86_VENDOR_AMD &&
-	     boot_cpu_data.x86 >= 0xf) ||
+	if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD ||
 	     boot_cpu_data.x86_vendor == X86_VENDOR_HYGON) {
 		uint64_t syscfg, tom2;
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Mar 23 14:55:13 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 23 Mar 2026 14:55:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1259393.1552696 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4ggT-0007XH-3b; Mon, 23 Mar 2026 14:55:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1259393.1552696; Mon, 23 Mar 2026 14:55:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4ggT-0007X9-0z; Mon, 23 Mar 2026 14:55:13 +0000
Received: by outflank-mailman (input) for mailman id 1259393;
 Mon, 23 Mar 2026 14:55:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w4ggR-0007Wz-Re
 for xen-changelog@lists.xenproject.org; Mon, 23 Mar 2026 14:55:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4ggS-005ajJ-05
 for xen-changelog@lists.xenproject.org;
 Mon, 23 Mar 2026 14:55:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4ggR-009Di0-2T
 for xen-changelog@lists.xenproject.org;
 Mon, 23 Mar 2026 14:55:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=s7gkyG32h2lKjizgWqe0M8JxD5QwaYKklUFospuCj0k=; b=FpywdXQfqNlFB5zjkgpu62IMtr
	TB/6MRyWBiqH6GWLUjRNW85rwfuRzizBA+x4tRFtixORwDQgbYLReud9dcABKNUhWaRJqsLfy7RaG
	2AjPtYeoZk4X15NqPWB5DG0ESzrO6heGbECqiRvp2DIuFtW1g3PGSyQ+PxgLUauCpW6k=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86: Remove x86 prefixed names from acpi code
Message-Id: <E1w4ggR-009Di0-2T@xenbits.xenproject.org>
Date: Mon, 23 Mar 2026 14:55:11 +0000

commit 7f696351ce1efcd6940c0cc217152a38f215fb88
Author:     Kevin Lampis <kevin.lampis@citrix.com>
AuthorDate: Mon Mar 23 11:15:46 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Mar 23 11:15:46 2026 +0100

    x86: Remove x86 prefixed names from acpi code
    
    struct cpuinfo_x86
      .x86        => .family
      .x86_vendor => .vendor
      .x86_model  => .model
      .x86_mask   => .stepping
    
    No functional change.
    
    This work is part of making Xen safe for Intel family 18/19.
    
    Signed-off-by: Kevin Lampis <kevin.lampis@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/acpi/cpu_idle.c         | 18 +++++++++---------
 xen/arch/x86/acpi/cpufreq/acpi.c     |  2 +-
 xen/arch/x86/acpi/cpufreq/cpufreq.c  |  4 ++--
 xen/arch/x86/acpi/cpufreq/powernow.c |  4 ++--
 4 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/xen/arch/x86/acpi/cpu_idle.c b/xen/arch/x86/acpi/cpu_idle.c
index 46749ca337..3001e98a6e 100644
--- a/xen/arch/x86/acpi/cpu_idle.c
+++ b/xen/arch/x86/acpi/cpu_idle.c
@@ -178,10 +178,10 @@ static void cf_check do_get_hw_residencies(void *arg)
     struct cpuinfo_x86 *c = &current_cpu_data;
     struct hw_residencies *hw_res = arg;
 
-    if ( c->x86_vendor != X86_VENDOR_INTEL || c->x86 != 6 )
+    if ( c->vendor != X86_VENDOR_INTEL || c->family != 6 )
         return;
 
-    switch ( c->x86_model )
+    switch ( c->model )
     {
     /* 4th generation Intel Core (Haswell) */
     case 0x45:
@@ -915,7 +915,7 @@ void cf_check acpi_dead_idle(void)
             mwait(cx->address, 0);
         }
     }
-    else if ( (current_cpu_data.x86_vendor &
+    else if ( (current_cpu_data.vendor &
                (X86_VENDOR_AMD | X86_VENDOR_HYGON)) &&
               cx->entry_method == ACPI_CSTATE_EM_SYSIO )
     {
@@ -1042,8 +1042,8 @@ static void acpi_processor_power_init_bm_check(struct acpi_processor_flags *flag
     flags->bm_check = 0;
     if ( num_online_cpus() == 1 )
         flags->bm_check = 1;
-    else if ( (c->x86_vendor == X86_VENDOR_INTEL) ||
-              ((c->x86_vendor == X86_VENDOR_AMD) && (c->x86 == 0x15)) )
+    else if ( (c->vendor == X86_VENDOR_INTEL) ||
+              ((c->vendor == X86_VENDOR_AMD) && (c->family == 0x15)) )
     {
         /*
          * Today all MP CPUs that support C3 share cache.
@@ -1059,7 +1059,7 @@ static void acpi_processor_power_init_bm_check(struct acpi_processor_flags *flag
      * is not required while entering C3 type state on
      * P4, Core and beyond CPUs
      */
-    if ( c->x86_vendor == X86_VENDOR_INTEL )
+    if ( c->vendor == X86_VENDOR_INTEL )
         flags->bm_control = 0;
 }
 
@@ -1415,12 +1415,12 @@ static void amd_cpuidle_init(struct acpi_processor_power *power)
     if ( vendor_override < 0 )
         return;
 
-    switch ( c->x86 )
+    switch ( c->family )
     {
     case 0x1a:
     case 0x19:
     case 0x18:
-        if ( boot_cpu_data.x86_vendor != X86_VENDOR_HYGON )
+        if ( boot_cpu_data.vendor != X86_VENDOR_HYGON )
         {
     default:
             vendor_override = -1;
@@ -1647,7 +1647,7 @@ static int cf_check cpu_callback(
         break;
 
     case CPU_ONLINE:
-        if ( (boot_cpu_data.x86_vendor &
+        if ( (boot_cpu_data.vendor &
               (X86_VENDOR_AMD | X86_VENDOR_HYGON)) &&
              processor_powers[cpu] )
             amd_cpuidle_init(processor_powers[cpu]);
diff --git a/xen/arch/x86/acpi/cpufreq/acpi.c b/xen/arch/x86/acpi/cpufreq/acpi.c
index d0ca660db1..de67f1aee2 100644
--- a/xen/arch/x86/acpi/cpufreq/acpi.c
+++ b/xen/arch/x86/acpi/cpufreq/acpi.c
@@ -454,7 +454,7 @@ static int cf_check acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)
 
     /* Check for APERF/MPERF support in hardware
      * also check for boost support */
-    if (c->x86_vendor == X86_VENDOR_INTEL && c->cpuid_level >= 6)
+    if (c->vendor == X86_VENDOR_INTEL && c->cpuid_level >= 6)
         on_selected_cpus(cpumask_of(cpu), feature_detect, policy, 1);
 
     /*
diff --git a/xen/arch/x86/acpi/cpufreq/cpufreq.c b/xen/arch/x86/acpi/cpufreq/cpufreq.c
index 5740c0d438..9ef62b3538 100644
--- a/xen/arch/x86/acpi/cpufreq/cpufreq.c
+++ b/xen/arch/x86/acpi/cpufreq/cpufreq.c
@@ -133,7 +133,7 @@ static int __init cf_check cpufreq_driver_init(void)
 
         ret = -ENOENT;
 
-        switch ( boot_cpu_data.x86_vendor )
+        switch ( boot_cpu_data.vendor )
         {
         case X86_VENDOR_INTEL:
             for ( i = 0; i < cpufreq_xen_cnt; i++ )
@@ -252,7 +252,7 @@ __initcall(cpufreq_driver_late_init);
 int cpufreq_cpu_init(unsigned int cpu)
 {
     /* Currently we only handle Intel, AMD and Hygon processor */
-    if ( boot_cpu_data.x86_vendor &
+    if ( boot_cpu_data.vendor &
          (X86_VENDOR_INTEL | X86_VENDOR_AMD | X86_VENDOR_HYGON) )
         return cpufreq_add_cpu(cpu);
 
diff --git a/xen/arch/x86/acpi/cpufreq/powernow.c b/xen/arch/x86/acpi/cpufreq/powernow.c
index beab6cac36..55166eac72 100644
--- a/xen/arch/x86/acpi/cpufreq/powernow.c
+++ b/xen/arch/x86/acpi/cpufreq/powernow.c
@@ -143,7 +143,7 @@ static void amd_fixup_frequency(struct xen_processor_px *px)
     int index = px->control & 0x00000007;
     const struct cpuinfo_x86 *c = &current_cpu_data;
 
-    if ((c->x86 != 0x10 || c->x86_model >= 10) && c->x86 != 0x11)
+    if ((c->family != 0x10 || c->model >= 10) && c->family != 0x11)
         return;
 
     val = rdmsr(MSR_PSTATE_DEF_BASE + index);
@@ -157,7 +157,7 @@ static void amd_fixup_frequency(struct xen_processor_px *px)
 
     fid = val & 0x3f;
     did = (val >> 6) & 7;
-    if (c->x86 == 0x10)
+    if (c->family == 0x10)
         px->core_frequency = (100 * (fid + 16)) >> did;
     else
         px->core_frequency = (100 * (fid + 8)) >> did;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Mar 23 14:55:23 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 23 Mar 2026 14:55:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1259394.1552701 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4ggd-0007ZT-56; Mon, 23 Mar 2026 14:55:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1259394.1552701; Mon, 23 Mar 2026 14:55:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4ggd-0007ZK-2Q; Mon, 23 Mar 2026 14:55:23 +0000
Received: by outflank-mailman (input) for mailman id 1259394;
 Mon, 23 Mar 2026 14:55:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w4ggb-0007ZC-V4
 for xen-changelog@lists.xenproject.org; Mon, 23 Mar 2026 14:55:21 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4ggc-005ajN-0Q
 for xen-changelog@lists.xenproject.org;
 Mon, 23 Mar 2026 14:55:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4ggb-009Dlw-2p
 for xen-changelog@lists.xenproject.org;
 Mon, 23 Mar 2026 14:55:21 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=4PrkmkuNQ41Z+uSMt0SUMe5KUKjvyjtstphnMjLSUPs=; b=ZITAXNeOeQWLfvCxu+4xqgaw/Q
	u54uxy8HgutfERA02L9NAsvPVdeFrlFaXCY4CJ1FGtH8KoQz3o1KhzML5cyHgMb1izkx8TErMgTOi
	mdYlGF5FF5s5Vphs0Bj/NOCq77jSpownvm2fFdD2Il4U071pIeRBOTw6bbzAufC1OS9M=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86: Remove x86 prefixed names from x86/cpu/ files
Message-Id: <E1w4ggb-009Dlw-2p@xenbits.xenproject.org>
Date: Mon, 23 Mar 2026 14:55:21 +0000

commit 39a9a49449d7dc0edb0148779aa81955a6db172f
Author:     Kevin Lampis <kevin.lampis@citrix.com>
AuthorDate: Mon Mar 23 11:16:30 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Mar 23 11:16:30 2026 +0100

    x86: Remove x86 prefixed names from x86/cpu/ files
    
    struct cpuinfo_x86
      .x86        => .family
      .x86_vendor => .vendor
      .x86_model  => .model
      .x86_mask   => .stepping
    
    No functional change.
    
    This work is part of making Xen safe for Intel family 18/19.
    
    Signed-off-by: Kevin Lampis <kevin.lampis@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/cpu/centaur.c         | 4 ++--
 xen/arch/x86/cpu/hygon.c           | 4 ++--
 xen/arch/x86/cpu/intel_cacheinfo.c | 6 +++---
 xen/arch/x86/cpu/mtrr/generic.c    | 4 ++--
 xen/arch/x86/cpu/mwait-idle.c      | 4 ++--
 xen/arch/x86/cpu/vpmu.c            | 4 ++--
 xen/arch/x86/cpu/vpmu_amd.c        | 6 +++---
 xen/arch/x86/cpu/vpmu_intel.c      | 4 ++--
 8 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/xen/arch/x86/cpu/centaur.c b/xen/arch/x86/cpu/centaur.c
index d2e7c8ec99..9123b05dc1 100644
--- a/xen/arch/x86/cpu/centaur.c
+++ b/xen/arch/x86/cpu/centaur.c
@@ -41,7 +41,7 @@ static void init_c3(struct cpuinfo_x86 *c)
 		}
 	}
 
-	if (c->x86 == 0x6 && c->x86_model >= 0xf) {
+	if (c->family == 0x6 && c->model >= 0xf) {
 		c->x86_cache_alignment = c->x86_clflush_size * 2;
 		__set_bit(X86_FEATURE_CONSTANT_TSC, c->x86_capability);
 	}
@@ -52,7 +52,7 @@ static void init_c3(struct cpuinfo_x86 *c)
 
 static void cf_check init_centaur(struct cpuinfo_x86 *c)
 {
-	if (c->x86 == 6)
+	if (c->family == 6)
 		init_c3(c);
 }
 
diff --git a/xen/arch/x86/cpu/hygon.c b/xen/arch/x86/cpu/hygon.c
index b99d83ed4d..7a9fc25d31 100644
--- a/xen/arch/x86/cpu/hygon.c
+++ b/xen/arch/x86/cpu/hygon.c
@@ -41,12 +41,12 @@ static void cf_check init_hygon(struct cpuinfo_x86 *c)
 
 	/* Probe for NSCB on Zen2 CPUs when not virtualised */
 	if (!cpu_has_hypervisor && !cpu_has_nscb && c == &boot_cpu_data &&
-	    c->x86 == 0x18)
+	    c->family == 0x18)
 		detect_zen2_null_seg_behaviour();
 
 	/*
 	 * TODO: Check heuristic safety with Hygon first
-	if (c->x86 == 0x18)
+	if (c->family == 0x18)
 		amd_init_spectral_chicken();
 	 */
 
diff --git a/xen/arch/x86/cpu/intel_cacheinfo.c b/xen/arch/x86/cpu/intel_cacheinfo.c
index e88faa7545..a81d0764fb 100644
--- a/xen/arch/x86/cpu/intel_cacheinfo.c
+++ b/xen/arch/x86/cpu/intel_cacheinfo.c
@@ -168,15 +168,15 @@ void init_intel_cacheinfo(struct cpuinfo_x86 *c)
 	 * Don't use cpuid2 if cpuid4 is supported. For P4, we use cpuid2 for
 	 * trace cache
 	 */
-	if ((num_cache_leaves == 0 || c->x86 == 15) && c->cpuid_level > 1 &&
-	    c->x86_vendor != X86_VENDOR_SHANGHAI)
+	if ((num_cache_leaves == 0 || c->family == 15) && c->cpuid_level > 1 &&
+	    c->vendor != X86_VENDOR_SHANGHAI)
 	{
 		/* supports eax=2  call */
 		unsigned int i, j, n, regs[4];
 		unsigned char *dp = (unsigned char *)regs;
 		int only_trace = 0;
 
-		if (num_cache_leaves != 0 && c->x86 == 15)
+		if (num_cache_leaves != 0 && c->family == 15)
 			only_trace = 1;
 
 		/* Number of times to iterate */
diff --git a/xen/arch/x86/cpu/mtrr/generic.c b/xen/arch/x86/cpu/mtrr/generic.c
index 0ca6a2083f..23c279eb9a 100644
--- a/xen/arch/x86/cpu/mtrr/generic.c
+++ b/xen/arch/x86/cpu/mtrr/generic.c
@@ -218,8 +218,8 @@ static void __init print_mtrr_state(const char *level)
 			printk("%s  %u disabled\n", level, i);
 	}
 
-	if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD ||
-	     boot_cpu_data.x86_vendor == X86_VENDOR_HYGON) {
+	if (boot_cpu_data.vendor == X86_VENDOR_AMD ||
+	     boot_cpu_data.vendor == X86_VENDOR_HYGON) {
 		uint64_t syscfg, tom2;
 
 		rdmsrl(MSR_K8_SYSCFG, syscfg);
diff --git a/xen/arch/x86/cpu/mwait-idle.c b/xen/arch/x86/cpu/mwait-idle.c
index 5962ec1db9..6776eeb9ac 100644
--- a/xen/arch/x86/cpu/mwait-idle.c
+++ b/xen/arch/x86/cpu/mwait-idle.c
@@ -1637,7 +1637,7 @@ static int __init mwait_idle_probe(void)
 		lapic_timer_reliable_states = LAPIC_TIMER_ALWAYS_RELIABLE;
 
 	pr_debug(PREFIX "v" MWAIT_IDLE_VERSION " model %#x\n",
-		 boot_cpu_data.x86_model);
+		 boot_cpu_data.model);
 
 	pr_debug(PREFIX "lapic_timer_reliable_states %#x\n",
 		 lapic_timer_reliable_states);
@@ -1816,7 +1816,7 @@ bool __init mwait_pc10_supported(void)
 {
 	unsigned int ecx, edx, dummy;
 
-	if (boot_cpu_data.x86_vendor != X86_VENDOR_INTEL ||
+	if (boot_cpu_data.vendor != X86_VENDOR_INTEL ||
 	    !cpu_has_monitor ||
 	    boot_cpu_data.cpuid_level < CPUID_MWAIT_LEAF)
 		return false;
diff --git a/xen/arch/x86/cpu/vpmu.c b/xen/arch/x86/cpu/vpmu.c
index c28192ea26..470f5ec98d 100644
--- a/xen/arch/x86/cpu/vpmu.c
+++ b/xen/arch/x86/cpu/vpmu.c
@@ -398,7 +398,7 @@ int vpmu_load(struct vcpu *v, bool from_guest)
 static int vpmu_arch_initialise(struct vcpu *v)
 {
     struct vpmu_struct *vpmu = vcpu_vpmu(v);
-    uint8_t vendor = current_cpu_data.x86_vendor;
+    unsigned int vendor = current_cpu_data.vendor;
     int ret;
 
     BUILD_BUG_ON(sizeof(struct xen_pmu_intel_ctxt) > XENPMU_CTXT_PAD_SZ);
@@ -815,7 +815,7 @@ static struct notifier_block cpu_nfb = {
 
 static int __init cf_check vpmu_init(void)
 {
-    int vendor = current_cpu_data.x86_vendor;
+    unsigned int vendor = current_cpu_data.vendor;
     const struct arch_vpmu_ops *ops = NULL;
 
     if ( !opt_vpmu_enabled )
diff --git a/xen/arch/x86/cpu/vpmu_amd.c b/xen/arch/x86/cpu/vpmu_amd.c
index d1f6bd5495..943a0f4ebe 100644
--- a/xen/arch/x86/cpu/vpmu_amd.c
+++ b/xen/arch/x86/cpu/vpmu_amd.c
@@ -532,7 +532,7 @@ static const struct arch_vpmu_ops *__init common_init(void)
     if ( !num_counters )
     {
         printk(XENLOG_WARNING "VPMU: Unsupported CPU family %#x\n",
-               current_cpu_data.x86);
+               current_cpu_data.family);
         return ERR_PTR(-EINVAL);
     }
 
@@ -557,7 +557,7 @@ static const struct arch_vpmu_ops *__init common_init(void)
 
 const struct arch_vpmu_ops *__init amd_vpmu_init(void)
 {
-    switch ( current_cpu_data.x86 )
+    switch ( current_cpu_data.family )
     {
     case 0x15:
     case 0x17:
@@ -585,7 +585,7 @@ const struct arch_vpmu_ops *__init amd_vpmu_init(void)
 
 const struct arch_vpmu_ops *__init hygon_vpmu_init(void)
 {
-    switch ( current_cpu_data.x86 )
+    switch ( current_cpu_data.family )
     {
     case 0x18:
         num_counters = F15H_NUM_COUNTERS;
diff --git a/xen/arch/x86/cpu/vpmu_intel.c b/xen/arch/x86/cpu/vpmu_intel.c
index 1e3b06ef8e..ed9f62b936 100644
--- a/xen/arch/x86/cpu/vpmu_intel.c
+++ b/xen/arch/x86/cpu/vpmu_intel.c
@@ -917,7 +917,7 @@ const struct arch_vpmu_ops *__init core2_vpmu_init(void)
         return ERR_PTR(-EINVAL);
     }
 
-    if ( current_cpu_data.x86 != 6 )
+    if ( current_cpu_data.family != 6 )
     {
         printk(XENLOG_WARNING "VPMU: only family 6 is supported\n");
         return ERR_PTR(-EINVAL);
@@ -958,7 +958,7 @@ const struct arch_vpmu_ops *__init core2_vpmu_init(void)
               sizeof(struct xen_pmu_cntr_pair) * arch_pmc_cnt;
 
     /* TODO: It's clearly incorrect for this to quirk all Intel Fam6 CPUs. */
-    pmc_quirk = current_cpu_data.x86 == 6;
+    pmc_quirk = current_cpu_data.family == 6;
 
     if ( sizeof(struct xen_pmu_data) + sizeof(uint64_t) * fixed_pmc_cnt +
          sizeof(struct xen_pmu_cntr_pair) * arch_pmc_cnt > PAGE_SIZE )
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Mar 23 14:55:33 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 23 Mar 2026 14:55:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1259395.1552704 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4ggn-0007bY-6I; Mon, 23 Mar 2026 14:55:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1259395.1552704; Mon, 23 Mar 2026 14:55:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4ggn-0007bQ-3o; Mon, 23 Mar 2026 14:55:33 +0000
Received: by outflank-mailman (input) for mailman id 1259395;
 Mon, 23 Mar 2026 14:55:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w4ggm-0007bE-15
 for xen-changelog@lists.xenproject.org; Mon, 23 Mar 2026 14:55:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4ggm-005ajT-0h
 for xen-changelog@lists.xenproject.org;
 Mon, 23 Mar 2026 14:55:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4ggl-009Dop-38
 for xen-changelog@lists.xenproject.org;
 Mon, 23 Mar 2026 14:55:31 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=nxnasfcFmP+u4o703NDqZTBCdUufNkTNIoVneuR6BcI=; b=Xvch1rPTKtkGswXaZX1eFwDtU7
	zZb4Zd7Kv93rdqViyXozL2hSkZk4/mba25zBnYu8p3IwzCROhRF7YezUAYv9wPFp8Pq012qF4njN7
	3tPfNv+Szcgi+T+Xo4O6OiGqRuCCOO/IcHWHwHVfbx2mUgjEiuOFH4+tzaGuDozeqhSg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] efi: Enable EFI_SET_VIRTUAL_ADDRESS_MAP by default
Message-Id: <E1w4ggl-009Dop-38@xenbits.xenproject.org>
Date: Mon, 23 Mar 2026 14:55:31 +0000

commit 05dbc316f6b72e8fe03fc5a8792bec22078a48be
Author:     Teddy Astie <teddy.astie@vates.tech>
AuthorDate: Mon Mar 23 11:16:45 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Mar 23 11:16:45 2026 +0100

    efi: Enable EFI_SET_VIRTUAL_ADDRESS_MAP by default
    
    Many machines fails to boot if this option is disabled.
    It's off by default as it was deemed too risky for being enabled
    by default late in the Xen 4.13 cycle, but found out to be safe.
    As there are no known drawback by having this option on, enable
    it by default.
    
    Signed-off-by: Teddy Astie <teddy.astie@vates.tech>
    Acked-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
---
 xen/common/Kconfig | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/xen/common/Kconfig b/xen/common/Kconfig
index d7e79e752a..0a20aa0a12 100644
--- a/xen/common/Kconfig
+++ b/xen/common/Kconfig
@@ -363,14 +363,13 @@ config KEXEC
 
 config EFI_SET_VIRTUAL_ADDRESS_MAP
     bool "EFI: call SetVirtualAddressMap()" if EXPERT
+    default y
     help
       Call EFI SetVirtualAddressMap() runtime service to setup memory map for
       further runtime services. According to UEFI spec, it isn't strictly
       necessary, but many UEFI implementations misbehave when this call is
       missing.
 
-      If unsure, say N.
-
 config XSM
 	bool "Xen Security Modules support"
 	default ARM
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Mar 23 14:55:43 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 23 Mar 2026 14:55:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1259396.1552708 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4ggx-0007dc-7q; Mon, 23 Mar 2026 14:55:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1259396.1552708; Mon, 23 Mar 2026 14:55:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4ggx-0007dU-57; Mon, 23 Mar 2026 14:55:43 +0000
Received: by outflank-mailman (input) for mailman id 1259396;
 Mon, 23 Mar 2026 14:55:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w4ggw-0007dO-3p
 for xen-changelog@lists.xenproject.org; Mon, 23 Mar 2026 14:55:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4ggw-005alu-0y
 for xen-changelog@lists.xenproject.org;
 Mon, 23 Mar 2026 14:55:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4ggw-009DuO-0B
 for xen-changelog@lists.xenproject.org;
 Mon, 23 Mar 2026 14:55:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=FHB7xSRVQpdp3mgBtUM6qNVpCICe13Af+VvarQMAc/g=; b=kMrVuJBOJCS+FP2R/tpO+YFK1d
	lPDoE+SLLBMPEgfpFKz6fYKfCY8ECfYbuzcKiUNl0GceZz+JlvLvJiOEoZmccQuS8BkmP0P8jorqq
	K9TyDNPlxDE5MLWcTCKBeyou6Ki6rKe2O3Mk5KBsWoUiZZwkh3NwRiutYBehDz2RnslA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/hap: Defer NPT P2M TLB flushes
Message-Id: <E1w4ggw-009DuO-0B@xenbits.xenproject.org>
Date: Mon, 23 Mar 2026 14:55:42 +0000

commit e1604ea8270096e5bb15866a1db75fbe56a730c7
Author:     Ross Lagerwall <ross.lagerwall@citrix.com>
AuthorDate: Mon Mar 23 11:17:06 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Mar 23 11:17:06 2026 +0100

    x86/hap: Defer NPT P2M TLB flushes
    
    Like the EPT code, defer TLB flushes for NPT to reduce the number of
    flushes and avoid holding the P2M lock while flushing. This can
    substantially improve performance in some scenarios.
    
    The cases where the TLB needs to be flushed without deferring are
    already handled by the call to p2m_tlb_flush_sync() in p2m_free_ptp().
    
    Suggested-by: Roger Pau Monne <roger.pau@citrix.com>
    Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/mm/hap/hap.c | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/mm/hap/hap.c b/xen/arch/x86/mm/hap/hap.c
index a337752bf4..5ccb80bda5 100644
--- a/xen/arch/x86/mm/hap/hap.c
+++ b/xen/arch/x86/mm/hap/hap.c
@@ -814,15 +814,33 @@ static void cf_check hap_update_paging_modes(struct vcpu *v)
 static void cf_check
 hap_write_p2m_entry_post(struct p2m_domain *p2m, unsigned int oflags)
 {
-    struct domain *d = p2m->domain;
+    if ( !(oflags & _PAGE_PRESENT) )
+        return;
+
+    if ( unlikely(!p2m->defer_flush) )
+    {
+        const struct domain *d = p2m->domain;
 
-    if ( oflags & _PAGE_PRESENT )
+        ASSERT_UNREACHABLE();
         guest_flush_tlb_mask(d, d->dirty_cpumask);
+        return;
+    }
+
+    p2m->need_flush = true;
+}
+
+static void cf_check
+hap_p2m_tlb_flush(struct p2m_domain *p2m)
+{
+    const struct domain *d = p2m->domain;
+
+    guest_flush_tlb_mask(d, d->dirty_cpumask);
 }
 
 void hap_p2m_init(struct p2m_domain *p2m)
 {
     p2m->write_p2m_entry_post = hap_write_p2m_entry_post;
+    p2m->tlb_flush = hap_p2m_tlb_flush;
 }
 
 static unsigned long cf_check hap_gva_to_gfn_real_mode(
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Mar 23 14:55:53 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 23 Mar 2026 14:55:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1259397.1552712 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4gh7-0007g1-9A; Mon, 23 Mar 2026 14:55:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1259397.1552712; Mon, 23 Mar 2026 14:55:53 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4gh7-0007ft-6c; Mon, 23 Mar 2026 14:55:53 +0000
Received: by outflank-mailman (input) for mailman id 1259397;
 Mon, 23 Mar 2026 14:55:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w4gh6-0007fl-6S
 for xen-changelog@lists.xenproject.org; Mon, 23 Mar 2026 14:55:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4gh6-005aly-1E
 for xen-changelog@lists.xenproject.org;
 Mon, 23 Mar 2026 14:55:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4gh6-009Dz4-0S
 for xen-changelog@lists.xenproject.org;
 Mon, 23 Mar 2026 14:55:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=EYj2IQ3nijGoyYKqcTwCTYHwtUqsipt4ytI+x9mv1Hk=; b=YIyjl5+SM08GXdjvrmzVuW2QVG
	ep4pADRAYPsW21gZhYrtq5RX/bmDvtjCrXm6OQUvoyVG1LL2jPhbMjrd02vbD8K8rWIugYN8+irM1
	FXGYbGkiMyU8e9p8sM5p3AI81L+6T3aMJIwf237UFPKbYq4xEppu7y5jqm8A/UJuBOug=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/cache-col: address MISRA C Rule 5.3
Message-Id: <E1w4gh6-009Dz4-0S@xenbits.xenproject.org>
Date: Mon, 23 Mar 2026 14:55:52 +0000

commit a87d5761e27a2c1d6051c681deafcb48a88eaf88
Author:     Dmytro Prokopchuk <dmytro_prokopchuk1@epam.com>
AuthorDate: Mon Mar 23 11:17:24 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Mar 23 11:17:24 2026 +0100

    xen/cache-col: address MISRA C Rule 5.3
    
    MISRA C:2012 Rule 5.3 states as following: An identifier declared in an
    inner scope shall not hide an identifier declared in an outer scope.
    
    Inside the 'if' block, the inner 'i' shadows the outer 'i'.
    Reuse the outer variable and remove the inner declaration to fix that.
    
    No functional change.
    
    Signed-off-by: Dmytro Prokopchuk <dmytro_prokopchuk1@epam.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/common/llc-coloring.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/xen/common/llc-coloring.c b/xen/common/llc-coloring.c
index 77a54beed1..822a6b2ed5 100644
--- a/xen/common/llc-coloring.c
+++ b/xen/common/llc-coloring.c
@@ -193,8 +193,6 @@ void __init llc_coloring_init(void)
 
     if ( !xen_num_colors )
     {
-        unsigned int i;
-
         xen_num_colors = MIN(XEN_DEFAULT_NUM_COLORS, max_nr_colors);
 
         printk(XENLOG_WARNING
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Mar 23 18:33:08 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 23 Mar 2026 18:33:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1259565.1552864 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4k5G-0002Yf-Ua; Mon, 23 Mar 2026 18:33:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1259565.1552864; Mon, 23 Mar 2026 18:33:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4k5G-0002YW-Rt; Mon, 23 Mar 2026 18:33:02 +0000
Received: by outflank-mailman (input) for mailman id 1259565;
 Mon, 23 Mar 2026 18:33:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w4k5F-0002YQ-NU
 for xen-changelog@lists.xenproject.org; Mon, 23 Mar 2026 18:33:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4k5F-005fiH-2h
 for xen-changelog@lists.xenproject.org;
 Mon, 23 Mar 2026 18:33:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4k5F-00AKrQ-1n
 for xen-changelog@lists.xenproject.org;
 Mon, 23 Mar 2026 18:33:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=P1s8Q81p4mjzwYUhZ8fAuTaF3Bx2NfHjDpqouL6lwqE=; b=rFy6JEQlL/GOmv8tfz/hXsr9Xt
	AYEdrxMVDAboS7+lEkur/WN6e9hjymybFLR8dQJAX0AZp9iQXM50GznuZTdhYq88WGUKbgSiJv0Bw
	uDIq6Vs/tLtIcCePRI7OEyzvWY+EnQ+YKhihGRbi3DJ4cwhdXWvaU7CCdTH+NgXDyGGQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/public: Delete duplicate VGCF constants
Message-Id: <E1w4k5F-00AKrQ-1n@xenbits.xenproject.org>
Date: Mon, 23 Mar 2026 18:33:01 +0000

commit efacf86685912a9249e5cd7f2ef748f0d02b9e23
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Mar 23 15:22:14 2026 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Mar 23 18:19:59 2026 +0000

    xen/public: Delete duplicate VGCF constants
    
    Having two spellings of the constants makes following the code unnecessarily
    difficult.  Reduce it to one spelling.
    
    This is an API change in the public headers, but one for the better.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/domain.c                    | 2 +-
 xen/include/public/arch-x86/xen-x86_64.h | 1 -
 xen/include/public/arch-x86/xen.h        | 2 --
 3 files changed, 1 insertion(+), 4 deletions(-)

diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index 4664264b2f..9ba2774762 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -1246,7 +1246,7 @@ int arch_set_info_guest(
          is_pv_64bit_domain(d) )
         v->arch.flags &= ~TF_kernel_mode;
 
-    if ( flags & VGCF_I387_VALID )
+    if ( flags & VGCF_i387_valid )
         vcpu_setup_fpu(v, &c.nat->fpu_ctxt);
     else
         vcpu_reset_fpu(v);
diff --git a/xen/include/public/arch-x86/xen-x86_64.h b/xen/include/public/arch-x86/xen-x86_64.h
index 75f121be0e..9f33d80d31 100644
--- a/xen/include/public/arch-x86/xen-x86_64.h
+++ b/xen/include/public/arch-x86/xen-x86_64.h
@@ -103,7 +103,6 @@
 /* Guest exited in SYSCALL context? Return to guest with SYSRET? */
 #define _VGCF_in_syscall 8
 #define VGCF_in_syscall  (1<<_VGCF_in_syscall)
-#define VGCF_IN_SYSCALL  VGCF_in_syscall
 
 #ifndef __ASSEMBLER__
 
diff --git a/xen/include/public/arch-x86/xen.h b/xen/include/public/arch-x86/xen.h
index a7bf046ee0..4693e47d20 100644
--- a/xen/include/public/arch-x86/xen.h
+++ b/xen/include/public/arch-x86/xen.h
@@ -160,8 +160,6 @@ typedef uint64_t tsc_timestamp_t; /* RDTSC timestamp */
 struct vcpu_guest_context {
     /* FPU registers come first so they can be aligned for FXSAVE/FXRSTOR. */
     struct { char x[512]; } fpu_ctxt;       /* User-level FPU registers     */
-#define VGCF_I387_VALID                (1<<0)
-#define VGCF_IN_KERNEL                 (1<<2)
 #define _VGCF_i387_valid               0
 #define VGCF_i387_valid                (1<<_VGCF_i387_valid)
 #define _VGCF_in_kernel                2
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Mar 23 19:55:10 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 23 Mar 2026 19:55:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1259575.1552868 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4lMd-0003As-EF; Mon, 23 Mar 2026 19:55:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1259575.1552868; Mon, 23 Mar 2026 19:55:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4lMd-0003Ak-B2; Mon, 23 Mar 2026 19:55:03 +0000
Received: by outflank-mailman (input) for mailman id 1259575;
 Mon, 23 Mar 2026 19:55:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w4lMb-0003Ae-RF
 for xen-changelog@lists.xenproject.org; Mon, 23 Mar 2026 19:55:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4lMb-005hNu-3D
 for xen-changelog@lists.xenproject.org;
 Mon, 23 Mar 2026 19:55:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4lMb-00AjtD-2Q
 for xen-changelog@lists.xenproject.org;
 Mon, 23 Mar 2026 19:55:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=0x5Y+C5xZvGXIcJRiLy23EQi4/ArztX6FnRBY/lHGag=; b=JCY/Old+xET8IBLaM3mxxRGi8T
	ealGlC0NcPcKdaz5kB9G0p1mQ9WNyRxWzS422k59IwE6lPqEBRFx9G74D95fqmvnoVHAhiYNbXDaz
	uhAmVrJ9UqiWHaPmSWMTpZS5eJccQoojGJUNbSNGQRyayzeZfaNpvsxpkiT+qdZtSUmI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/public: Delete duplicate VGCF constants
Message-Id: <E1w4lMb-00AjtD-2Q@xenbits.xenproject.org>
Date: Mon, 23 Mar 2026 19:55:01 +0000

commit efacf86685912a9249e5cd7f2ef748f0d02b9e23
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Mar 23 15:22:14 2026 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Mar 23 18:19:59 2026 +0000

    xen/public: Delete duplicate VGCF constants
    
    Having two spellings of the constants makes following the code unnecessarily
    difficult.  Reduce it to one spelling.
    
    This is an API change in the public headers, but one for the better.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/domain.c                    | 2 +-
 xen/include/public/arch-x86/xen-x86_64.h | 1 -
 xen/include/public/arch-x86/xen.h        | 2 --
 3 files changed, 1 insertion(+), 4 deletions(-)

diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index 4664264b2f..9ba2774762 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -1246,7 +1246,7 @@ int arch_set_info_guest(
          is_pv_64bit_domain(d) )
         v->arch.flags &= ~TF_kernel_mode;
 
-    if ( flags & VGCF_I387_VALID )
+    if ( flags & VGCF_i387_valid )
         vcpu_setup_fpu(v, &c.nat->fpu_ctxt);
     else
         vcpu_reset_fpu(v);
diff --git a/xen/include/public/arch-x86/xen-x86_64.h b/xen/include/public/arch-x86/xen-x86_64.h
index 75f121be0e..9f33d80d31 100644
--- a/xen/include/public/arch-x86/xen-x86_64.h
+++ b/xen/include/public/arch-x86/xen-x86_64.h
@@ -103,7 +103,6 @@
 /* Guest exited in SYSCALL context? Return to guest with SYSRET? */
 #define _VGCF_in_syscall 8
 #define VGCF_in_syscall  (1<<_VGCF_in_syscall)
-#define VGCF_IN_SYSCALL  VGCF_in_syscall
 
 #ifndef __ASSEMBLER__
 
diff --git a/xen/include/public/arch-x86/xen.h b/xen/include/public/arch-x86/xen.h
index a7bf046ee0..4693e47d20 100644
--- a/xen/include/public/arch-x86/xen.h
+++ b/xen/include/public/arch-x86/xen.h
@@ -160,8 +160,6 @@ typedef uint64_t tsc_timestamp_t; /* RDTSC timestamp */
 struct vcpu_guest_context {
     /* FPU registers come first so they can be aligned for FXSAVE/FXRSTOR. */
     struct { char x[512]; } fpu_ctxt;       /* User-level FPU registers     */
-#define VGCF_I387_VALID                (1<<0)
-#define VGCF_IN_KERNEL                 (1<<2)
 #define _VGCF_i387_valid               0
 #define VGCF_i387_valid                (1<<_VGCF_i387_valid)
 #define _VGCF_in_kernel                2
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Mar 23 22:00:11 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 23 Mar 2026 22:00:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1259580.1552872 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4nJa-0008WV-Rz; Mon, 23 Mar 2026 22:00:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1259580.1552872; Mon, 23 Mar 2026 22:00:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4nJa-0008W1-P6; Mon, 23 Mar 2026 22:00:02 +0000
Received: by outflank-mailman (input) for mailman id 1259580;
 Mon, 23 Mar 2026 22:00:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w4nJZ-0008M7-TF
 for xen-changelog@lists.xenproject.org; Mon, 23 Mar 2026 22:00:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4nJa-005joY-0C
 for xen-changelog@lists.xenproject.org;
 Mon, 23 Mar 2026 22:00:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4nJZ-00AwA1-2Z
 for xen-changelog@lists.xenproject.org;
 Mon, 23 Mar 2026 22:00:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=3s20k9EwyIa3H/PO/fm5WHgItle+s5x1uWuDlQiB50U=; b=WheNppV3EVXVgjHxz7XequR1Ux
	/JbATwFHb4R3SnknOqDQi4dAmvv9nRiFE+BwY85dKH8ZeHPYhM5pFPpYGNV/Y6vaL2t/UgpqMnO/R
	tcF78jB8Z2pNBAxFKDLlhZBqjQcHMjjhnA25yIFt8Lvjz0h875dEESVKJHdCEGbTgrdU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.21] x86/msr: Change rdmsr() to have normal API
Message-Id: <E1w4nJZ-00AwA1-2Z@xenbits.xenproject.org>
Date: Mon, 23 Mar 2026 22:00:01 +0000

commit 0a1b0b6b99c1db5cf4db55e2c2481201879e5f32
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Sat Jun 23 13:44:43 2018 +0800
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 17 12:13:49 2026 +0000

    x86/msr: Change rdmsr() to have normal API
    
    We want a consistent MSR API, and these want to be named rdmsr() and wrmsr(),
    but not with their current APIs.  The current rdmsr() flavours writing to
    their parameters by name makes code that reads like invalid C, and is
    unergonomic to use in lots of cases.
    
    Change the API, and update the callers all in one go.  Where appropriate,
    update the write side to wrmsrns() as per the recommendation.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    (cherry picked from commit ba342df56ae6ce819eb3aaf026b4837d4cf4ca0d)
---
 xen/arch/x86/acpi/cpufreq/powernow.c | 12 +++++++-----
 xen/arch/x86/cpu/amd.c               |  6 +++---
 xen/arch/x86/cpu/common.c            | 20 ++++++++++++--------
 xen/arch/x86/cpu/intel.c             | 30 +++++++++++++++---------------
 xen/arch/x86/genapic/x2apic.c        |  5 +----
 xen/arch/x86/hvm/vmx/vmcs.c          | 30 +++++++++++++++++++++++-------
 xen/arch/x86/include/asm/msr.h       | 30 ++++++++++++++++++++++++++----
 xen/arch/x86/include/asm/prot-key.h  |  6 +-----
 xen/arch/x86/tsx.c                   | 27 +++++++++++----------------
 9 files changed, 99 insertions(+), 67 deletions(-)

diff --git a/xen/arch/x86/acpi/cpufreq/powernow.c b/xen/arch/x86/acpi/cpufreq/powernow.c
index 12fca45b45..71ac0b4526 100644
--- a/xen/arch/x86/acpi/cpufreq/powernow.c
+++ b/xen/arch/x86/acpi/cpufreq/powernow.c
@@ -140,23 +140,25 @@ static int cf_check powernow_cpufreq_target(
 
 static void amd_fixup_frequency(struct xen_processor_px *px)
 {
-    u32 hi, lo, fid, did;
+    uint64_t val;
+    uint32_t fid, did;
     int index = px->control & 0x00000007;
     const struct cpuinfo_x86 *c = &current_cpu_data;
 
     if ((c->x86 != 0x10 || c->x86_model >= 10) && c->x86 != 0x11)
         return;
 
-    rdmsr(MSR_PSTATE_DEF_BASE + index, lo, hi);
+    val = rdmsr(MSR_PSTATE_DEF_BASE + index);
+
     /*
      * MSR C001_0064+:
      * Bit 63: PstateEn. Read-write. If set, the P-state is valid.
      */
-    if (!(hi & (1U << 31)))
+    if (!(val & (1UL << 63)))
         return;
 
-    fid = lo & 0x3f;
-    did = (lo >> 6) & 7;
+    fid = val & 0x3f;
+    did = (val >> 6) & 7;
     if (c->x86 == 0x10)
         px->core_frequency = (100 * (fid + 16)) >> did;
     else
diff --git a/xen/arch/x86/cpu/amd.c b/xen/arch/x86/cpu/amd.c
index b7c71ebc67..92027a8226 100644
--- a/xen/arch/x86/cpu/amd.c
+++ b/xen/arch/x86/cpu/amd.c
@@ -1360,9 +1360,9 @@ static void cf_check init_amd(struct cpuinfo_x86 *c)
 	}
 
 	if (cpu_has(c, X86_FEATURE_EFRO)) {
-		rdmsr(MSR_K8_HWCR, l, h);
-		l |= (1 << 27); /* Enable read-only APERF/MPERF bit */
-		wrmsr(MSR_K8_HWCR, l, h);
+		/* Enable read-only APERF/MPERF bit */
+		wrmsrns(MSR_K8_HWCR,
+			rdmsr(MSR_K8_HWCR) | (1 << 27));
 	}
 
 	/* Prevent TSC drift in non single-processor, single-core platforms. */
diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c
index 5869fff8f9..9d225ac8d7 100644
--- a/xen/arch/x86/cpu/common.c
+++ b/xen/arch/x86/cpu/common.c
@@ -329,6 +329,7 @@ static inline u32 phys_pkg_id(u32 cpuid_apic, int index_msb)
 void __init early_cpu_init(bool verbose)
 {
 	struct cpuinfo_x86 *c = &boot_cpu_data;
+	uint64_t val;
 	u32 eax, ebx, ecx, edx;
 
 	c->x86_cache_alignment = 32;
@@ -412,10 +413,11 @@ void __init early_cpu_init(bool verbose)
 			    &c->x86_capability[FEATURESET_7c0],
 			    &c->x86_capability[FEATURESET_7d0]);
 
-		if (test_bit(X86_FEATURE_ARCH_CAPS, c->x86_capability))
-			rdmsr(MSR_ARCH_CAPABILITIES,
-			      c->x86_capability[FEATURESET_m10Al],
-			      c->x86_capability[FEATURESET_m10Ah]);
+		if (test_bit(X86_FEATURE_ARCH_CAPS, c->x86_capability)) {
+			val = rdmsr(MSR_ARCH_CAPABILITIES);
+			c->x86_capability[FEATURESET_m10Al] = val;
+			c->x86_capability[FEATURESET_m10Ah] = val >> 32;
+		}
 
 		if (max_subleaf >= 1)
 			cpuid_count(7, 1, &eax, &ebx, &ecx,
@@ -467,6 +469,7 @@ void reset_cpuinfo(struct cpuinfo_x86 *c, bool keep_basic)
 
 static void generic_identify(struct cpuinfo_x86 *c)
 {
+	uint64_t val;
 	u32 eax, ebx, ecx, edx, tmp;
 
 	/* Get vendor name */
@@ -566,10 +569,11 @@ static void generic_identify(struct cpuinfo_x86 *c)
 			    &c->x86_capability[FEATURESET_Da1],
 			    &tmp, &tmp, &tmp);
 
-	if (test_bit(X86_FEATURE_ARCH_CAPS, c->x86_capability))
-		rdmsr(MSR_ARCH_CAPABILITIES,
-		      c->x86_capability[FEATURESET_m10Al],
-		      c->x86_capability[FEATURESET_m10Ah]);
+	if (test_bit(X86_FEATURE_ARCH_CAPS, c->x86_capability)) {
+		val = rdmsr(MSR_ARCH_CAPABILITIES);
+		c->x86_capability[FEATURESET_m10Al] = val;
+		c->x86_capability[FEATURESET_m10Ah] = val >> 32;
+	}
 }
 
 /*
diff --git a/xen/arch/x86/cpu/intel.c b/xen/arch/x86/cpu/intel.c
index b5b0b31eb9..863edac4cd 100644
--- a/xen/arch/x86/cpu/intel.c
+++ b/xen/arch/x86/cpu/intel.c
@@ -23,17 +23,17 @@ static uint32_t __ro_after_init mcu_opt_ctrl_val;
 
 void update_mcu_opt_ctrl(void)
 {
-    uint32_t mask = mcu_opt_ctrl_mask, lo, hi;
+    uint64_t mask = mcu_opt_ctrl_mask, val;
 
     if ( !mask )
         return;
 
-    rdmsr(MSR_MCU_OPT_CTRL, lo, hi);
+    val = rdmsr(MSR_MCU_OPT_CTRL);
 
-    lo &= ~mask;
-    lo |= mcu_opt_ctrl_val;
+    val &= ~mask;
+    val |= mcu_opt_ctrl_val;
 
-    wrmsr(MSR_MCU_OPT_CTRL, lo, hi);
+    wrmsrns(MSR_MCU_OPT_CTRL, val);
 }
 
 void __init set_in_mcu_opt_ctrl(uint32_t mask, uint32_t val)
@@ -51,17 +51,17 @@ static uint32_t __ro_after_init pb_opt_ctrl_val;
 
 void update_pb_opt_ctrl(void)
 {
-    uint32_t mask = pb_opt_ctrl_mask, lo, hi;
+    uint64_t mask = pb_opt_ctrl_mask, val;
 
     if ( !mask )
         return;
 
-    rdmsr(MSR_PB_OPT_CTRL, lo, hi);
+    val = rdmsr(MSR_PB_OPT_CTRL);
 
-    lo &= ~mask;
-    lo |= pb_opt_ctrl_val;
+    val &= ~mask;
+    val |= pb_opt_ctrl_val;
 
-    wrmsr(MSR_PB_OPT_CTRL, lo, hi);
+    wrmsrns(MSR_PB_OPT_CTRL, val);
 }
 
 void __init set_in_pb_opt_ctrl(uint32_t mask, uint32_t val)
@@ -456,15 +456,15 @@ static void __init probe_mwait_errata(void)
  */
 static void Intel_errata_workarounds(struct cpuinfo_x86 *c)
 {
-	unsigned long lo, hi;
+	uint64_t val;
 
 	if ((c->x86 == 15) && (c->x86_model == 1) && (c->x86_mask == 1)) {
-		rdmsr (MSR_IA32_MISC_ENABLE, lo, hi);
-		if ((lo & (1<<9)) == 0) {
+		val = rdmsr(MSR_IA32_MISC_ENABLE);
+		if ((val & (1 << 9)) == 0) {
 			printk (KERN_INFO "CPU: C0 stepping P4 Xeon detected.\n");
 			printk (KERN_INFO "CPU: Disabling hardware prefetching (Errata 037)\n");
-			lo |= (1<<9);	/* Disable hw prefetching */
-			wrmsr (MSR_IA32_MISC_ENABLE, lo, hi);
+			val |= (1 << 9); /* Disable hw prefetching */
+			wrmsrns(MSR_IA32_MISC_ENABLE, val);
 		}
 	}
 
diff --git a/xen/arch/x86/genapic/x2apic.c b/xen/arch/x86/genapic/x2apic.c
index 1d55eb6b8a..58157c217e 100644
--- a/xen/arch/x86/genapic/x2apic.c
+++ b/xen/arch/x86/genapic/x2apic.c
@@ -268,14 +268,11 @@ const struct genapic *__init apic_x2apic_probe(void)
 
 void __init check_x2apic_preenabled(void)
 {
-    u32 lo, hi;
-
     if ( !cpu_has_x2apic )
         return;
 
     /* Check whether x2apic mode was already enabled by the BIOS. */
-    rdmsr(MSR_APIC_BASE, lo, hi);
-    if ( lo & APIC_BASE_EXTD )
+    if ( rdmsr(MSR_APIC_BASE) & APIC_BASE_EXTD )
     {
         printk("x2APIC mode is already enabled by BIOS.\n");
         x2apic_enabled = 1;
diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c
index ab8b1c87ec..b639818b6e 100644
--- a/xen/arch/x86/hvm/vmx/vmcs.c
+++ b/xen/arch/x86/hvm/vmx/vmcs.c
@@ -207,9 +207,13 @@ static void __init vmx_display_features(void)
 static u32 adjust_vmx_controls(
     const char *name, u32 ctl_min, u32 ctl_opt, u32 msr, bool *mismatch)
 {
+    uint64_t val;
     u32 vmx_msr_low, vmx_msr_high, ctl = ctl_min | ctl_opt;
 
-    rdmsr(msr, vmx_msr_low, vmx_msr_high);
+    val = rdmsr(msr);
+
+    vmx_msr_low = val;
+    vmx_msr_high = val >> 32;
 
     ctl &= vmx_msr_high; /* bit == 0 in high word ==> must be zero */
     ctl |= vmx_msr_low;  /* bit == 1 in low word  ==> must be one  */
@@ -258,10 +262,13 @@ static int vmx_init_vmcs_config(bool bsp)
 {
     u32 vmx_basic_msr_low, vmx_basic_msr_high, min, opt;
     struct vmx_caps caps = {};
-    u64 _vmx_misc_cap = 0;
+    uint64_t _vmx_misc_cap = 0, val;
     bool mismatch = false;
 
-    rdmsr(MSR_IA32_VMX_BASIC, vmx_basic_msr_low, vmx_basic_msr_high);
+    val = rdmsr(MSR_IA32_VMX_BASIC);
+
+    vmx_basic_msr_low = val;
+    vmx_basic_msr_high = val >> 32;
 
     min = (PIN_BASED_EXT_INTR_MASK |
            PIN_BASED_NMI_EXITING);
@@ -366,7 +373,10 @@ static int vmx_init_vmcs_config(bool bsp)
     if ( caps.secondary_exec_control & (SECONDARY_EXEC_ENABLE_EPT |
                                         SECONDARY_EXEC_ENABLE_VPID) )
     {
-        rdmsr(MSR_IA32_VMX_EPT_VPID_CAP, caps.ept, caps.vpid);
+        val = rdmsr(MSR_IA32_VMX_EPT_VPID_CAP);
+
+        caps.ept = val;
+        caps.vpid = val >> 32;
 
         if ( !opt_ept_ad )
             caps.ept &= ~VMX_EPT_AD_BIT;
@@ -408,9 +418,15 @@ static int vmx_init_vmcs_config(bool bsp)
          * We check VMX_BASIC_MSR[55] to correctly handle default controls.
          */
         uint32_t must_be_one, must_be_zero, msr = MSR_IA32_VMX_PROCBASED_CTLS;
+
         if ( vmx_basic_msr_high & (VMX_BASIC_DEFAULT1_ZERO >> 32) )
             msr = MSR_IA32_VMX_TRUE_PROCBASED_CTLS;
-        rdmsr(msr, must_be_one, must_be_zero);
+
+        val = rdmsr(msr);
+
+        must_be_one = val;
+        must_be_zero = val >> 32;
+
         if ( must_be_one & (CPU_BASED_INVLPG_EXITING |
                             CPU_BASED_CR3_LOAD_EXITING |
                             CPU_BASED_CR3_STORE_EXITING) )
@@ -699,7 +715,7 @@ void cf_check vmx_cpu_dead(unsigned int cpu)
 
 static int _vmx_cpu_up(bool bsp)
 {
-    u32 eax, edx;
+    uint32_t eax;
     int rc, bios_locked, cpu = smp_processor_id();
     u64 cr0, vmx_cr0_fixed0, vmx_cr0_fixed1;
 
@@ -719,7 +735,7 @@ static int _vmx_cpu_up(bool bsp)
         return -EINVAL;
     }
 
-    rdmsr(MSR_IA32_FEATURE_CONTROL, eax, edx);
+    eax = rdmsr(MSR_IA32_FEATURE_CONTROL);
 
     bios_locked = !!(eax & IA32_FEATURE_CONTROL_LOCK);
     if ( bios_locked )
diff --git a/xen/arch/x86/include/asm/msr.h b/xen/arch/x86/include/asm/msr.h
index 901770555b..188a50f9ce 100644
--- a/xen/arch/x86/include/asm/msr.h
+++ b/xen/arch/x86/include/asm/msr.h
@@ -9,10 +9,32 @@
 #include <asm/asm_defns.h>
 #include <asm/msr-index.h>
 
-#define rdmsr(msr,val1,val2) \
-     __asm__ __volatile__("rdmsr" \
-			  : "=a" (val1), "=d" (val2) \
-			  : "c" (msr))
+/*
+ * MSR APIs.  Most logic is expected to use:
+ *
+ *   uint64_t foo = rdmsr(MSR_BAR);
+ *   wrmsrns(MSR_BAR, foo);
+ *
+ * In addition, *_safe() wrappers exist to cope gracefully with a #GP.
+ *
+ *
+ * All legacy forms are to be phased out:
+ *
+ *  rdmsrl(MSR_FOO, val);
+ *  wrmsr(MSR_FOO, lo, hi);
+ *  wrmsrl(MSR_FOO, val);
+ */
+
+static always_inline uint64_t rdmsr(unsigned int msr)
+{
+    unsigned long lo, hi;
+
+    asm volatile ( "rdmsr"
+                   : "=a" (lo), "=d" (hi)
+                   : "c" (msr) );
+
+    return (hi << 32) | lo;
+}
 
 #define rdmsrl(msr,val) do { unsigned long a__,b__; \
        __asm__ __volatile__("rdmsr" \
diff --git a/xen/arch/x86/include/asm/prot-key.h b/xen/arch/x86/include/asm/prot-key.h
index 3e9c2eaef4..8fb15b5c32 100644
--- a/xen/arch/x86/include/asm/prot-key.h
+++ b/xen/arch/x86/include/asm/prot-key.h
@@ -52,11 +52,7 @@ DECLARE_PER_CPU(uint32_t, pkrs);
 
 static inline uint32_t rdpkrs(void)
 {
-    uint32_t pkrs, tmp;
-
-    rdmsr(MSR_PKRS, pkrs, tmp);
-
-    return pkrs;
+    return rdmsr(MSR_PKRS);
 }
 
 static inline uint32_t rdpkrs_and_cache(void)
diff --git a/xen/arch/x86/tsx.c b/xen/arch/x86/tsx.c
index 2a0c7c08a2..fe9f0ab4f7 100644
--- a/xen/arch/x86/tsx.c
+++ b/xen/arch/x86/tsx.c
@@ -42,6 +42,8 @@ void tsx_init(void)
 {
     static bool __read_mostly once;
 
+    uint64_t val;
+
     /*
      * This function is first called between microcode being loaded, and
      * CPUID being scanned generally. early_cpu_init() has already prepared
@@ -62,8 +64,6 @@ void tsx_init(void)
              * On a TAA-vulnerable or later part with at least the May 2020
              * microcode mitigating SRBDS.
              */
-            uint64_t val;
-
             rdmsrl(MSR_MCU_OPT_CTRL, val);
 
             /*
@@ -118,8 +118,6 @@ void tsx_init(void)
 
         if ( cpu_has_tsx_force_abort )
         {
-            uint64_t val;
-
             /*
              * On an early TSX-enabled Skylake part subject to the memory
              * ordering erratum, with at least the March 2019 microcode.
@@ -250,18 +248,17 @@ void tsx_init(void)
          *    controlled, we have or will set MSR_MCU_OPT_CTRL.RTM_ALLOW to
          *    let TSX_CTRL.RTM_DISABLE be usable.
          */
-        uint32_t hi, lo;
 
-        rdmsr(MSR_TSX_CTRL, lo, hi);
+        val = rdmsr(MSR_TSX_CTRL);
 
         /* Check bottom bit only.  Higher bits are various sentinels. */
         rtm_disabled = !(opt_tsx & 1);
 
-        lo &= ~(TSX_CTRL_RTM_DISABLE | TSX_CTRL_CPUID_CLEAR);
+        val &= ~(TSX_CTRL_RTM_DISABLE | TSX_CTRL_CPUID_CLEAR);
         if ( rtm_disabled )
-            lo |= TSX_CTRL_RTM_DISABLE | TSX_CTRL_CPUID_CLEAR;
+            val |= TSX_CTRL_RTM_DISABLE | TSX_CTRL_CPUID_CLEAR;
 
-        wrmsr(MSR_TSX_CTRL, lo, hi);
+        wrmsrns(MSR_TSX_CTRL, val);
     }
     else if ( cpu_has_tsx_force_abort )
     {
@@ -269,14 +266,12 @@ void tsx_init(void)
          * On an early TSX-enable Skylake part subject to the memory ordering
          * erratum, with at least the March 2019 microcode.
          */
-        uint32_t hi, lo;
-
-        rdmsr(MSR_TSX_FORCE_ABORT, lo, hi);
+        val = rdmsr(MSR_TSX_FORCE_ABORT);
 
         /* Check bottom bit only.  Higher bits are various sentinels. */
         rtm_disabled = !(opt_tsx & 1);
 
-        lo &= ~(TSX_FORCE_ABORT_RTM | TSX_CPUID_CLEAR | TSX_ENABLE_RTM);
+        val &= ~(TSX_FORCE_ABORT_RTM | TSX_CPUID_CLEAR | TSX_ENABLE_RTM);
 
         if ( cpu_has_rtm_always_abort )
         {
@@ -291,7 +286,7 @@ void tsx_init(void)
              *  - TSX_FORCE_ABORT.ENABLE_RTM may be used to opt in to
              *    re-enabling RTM, at the users own risk.
              */
-            lo |= rtm_disabled ? TSX_CPUID_CLEAR : TSX_ENABLE_RTM;
+            val |= rtm_disabled ? TSX_CPUID_CLEAR : TSX_ENABLE_RTM;
         }
         else
         {
@@ -304,10 +299,10 @@ void tsx_init(void)
              *    setting TSX_FORCE_ABORT.FORCE_ABORT_RTM.
              */
             if ( rtm_disabled )
-                lo |= TSX_FORCE_ABORT_RTM;
+                val |= TSX_FORCE_ABORT_RTM;
         }
 
-        wrmsr(MSR_TSX_FORCE_ABORT, lo, hi);
+        wrmsrns(MSR_TSX_FORCE_ABORT, val);
     }
     else if ( opt_tsx >= 0 )
         printk_once(XENLOG_WARNING
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.21


From xen-changelog-bounces@lists.xenproject.org Mon Mar 23 22:00:13 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 23 Mar 2026 22:00:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1259581.1552875 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4nJl-0000rG-T2; Mon, 23 Mar 2026 22:00:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1259581.1552875; Mon, 23 Mar 2026 22:00:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4nJl-0000r8-Qc; Mon, 23 Mar 2026 22:00:13 +0000
Received: by outflank-mailman (input) for mailman id 1259581;
 Mon, 23 Mar 2026 22:00:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w4nJk-0000qs-1j
 for xen-changelog@lists.xenproject.org; Mon, 23 Mar 2026 22:00:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4nJk-005joc-0j
 for xen-changelog@lists.xenproject.org;
 Mon, 23 Mar 2026 22:00:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4nJj-00AwBH-2w
 for xen-changelog@lists.xenproject.org;
 Mon, 23 Mar 2026 22:00:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=2nN9mHEZ2IZEeZjXrUIQqtDTYUc0LYc2Zvfnxpqfj78=; b=VcOrw3r3gYj/p+gecfWT3CcRVF
	SmDMRlc1l+D93Jvfp7U6E/WlYkRksNyaKLqb7iDWoOX3Ernxy2FDfXtW/W0qStLDY+8i5a9fYX8J4
	byo6P1sBB7l1BWcgbA2nD+f9WXWMd46sWs6Qsw8s9bvubjLr4sccBBPi5XI6DAWDVauc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.21] x86/msr: Change wrmsr() to take a single parameter
Message-Id: <E1w4nJj-00AwBH-2w@xenbits.xenproject.org>
Date: Mon, 23 Mar 2026 22:00:11 +0000

commit 6966336691bcbf1a57c66d87369d2f58654d4e81
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Jun 22 12:25:41 2018 +0800
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 17 12:13:49 2026 +0000

    x86/msr: Change wrmsr() to take a single parameter
    
    Mirroring the cleanup to rdmsr(), do the same to wrmsr().  It now has the same
    API as wrmsrl(), but we'll want to drop that wrapper in due course.
    
    It's telling that almost all remaining users pass in 0.  Most are converted
    directly to WRMSRNS, but a few are not.
    
    MSR_VIRT_SPEC_CTRL is unconditionally intercepted and is orders of magnitude
    more expensive than just serialising.  In disable_lapic_nmi_watchdog(), the P4
    case won't run on hardware which has anything more than plain WRMSR.
    
    For CTR_WRITE() in op_model_athlon.c there is a logical change in behaviour,
    but it's fixing a bug.  Peformance counters typically get written to -(count)
    as they generate an interrupt on overflow.  The performance counters even in
    the K8 were 48 bits wide, and this wrmsr() not being a wrmsrl() appears to
    have been an oversight in commit b5103d692aa7 ("x86 oprofile: use
    rdmsrl/wrmsrl") which converted all other users, and appears to be the last
    time there was an attempt to unify the MSR APIs.
    
    No practical change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    (cherry picked from commit 389347a75fbd28c58518d2a0fdaa0af4429ada5f)
---
 xen/arch/x86/cpu/amd.c                  |  2 +-
 xen/arch/x86/hvm/vmx/vmcs.c             |  2 +-
 xen/arch/x86/include/asm/msr.h          | 20 ++++++++++----------
 xen/arch/x86/nmi.c                      | 18 +++++++++---------
 xen/arch/x86/oprofile/op_model_athlon.c |  2 +-
 5 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/xen/arch/x86/cpu/amd.c b/xen/arch/x86/cpu/amd.c
index 92027a8226..8c55d233f3 100644
--- a/xen/arch/x86/cpu/amd.c
+++ b/xen/arch/x86/cpu/amd.c
@@ -895,7 +895,7 @@ void amd_set_legacy_ssbd(bool enable)
 		return;
 
 	if (cpu_has_virt_ssbd)
-		wrmsr(MSR_VIRT_SPEC_CTRL, enable ? SPEC_CTRL_SSBD : 0, 0);
+		wrmsr(MSR_VIRT_SPEC_CTRL, enable ? SPEC_CTRL_SSBD : 0);
 	else if (amd_legacy_ssbd)
 		core_set_legacy_ssbd(enable);
 	else
diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c
index b639818b6e..cd5ac8a5f0 100644
--- a/xen/arch/x86/hvm/vmx/vmcs.c
+++ b/xen/arch/x86/hvm/vmx/vmcs.c
@@ -754,7 +754,7 @@ static int _vmx_cpu_up(bool bsp)
         eax |= IA32_FEATURE_CONTROL_ENABLE_VMXON_OUTSIDE_SMX;
         if ( test_bit(X86_FEATURE_SMX, &boot_cpu_data.x86_capability) )
             eax |= IA32_FEATURE_CONTROL_ENABLE_VMXON_INSIDE_SMX;
-        wrmsr(MSR_IA32_FEATURE_CONTROL, eax, 0);
+        wrmsrns(MSR_IA32_FEATURE_CONTROL, eax);
     }
 
     if ( (rc = vmx_init_vmcs_config(bsp)) != 0 )
diff --git a/xen/arch/x86/include/asm/msr.h b/xen/arch/x86/include/asm/msr.h
index 188a50f9ce..941a7612f4 100644
--- a/xen/arch/x86/include/asm/msr.h
+++ b/xen/arch/x86/include/asm/msr.h
@@ -15,13 +15,17 @@
  *   uint64_t foo = rdmsr(MSR_BAR);
  *   wrmsrns(MSR_BAR, foo);
  *
+ * and, if architectural serialisaition is necessary, or there are other
+ * reasons that WRMSRNS is inapplicable, then:
+ *
+ *   wrmsr(MSR_BAR, foo);
+ *
  * In addition, *_safe() wrappers exist to cope gracefully with a #GP.
  *
  *
  * All legacy forms are to be phased out:
  *
  *  rdmsrl(MSR_FOO, val);
- *  wrmsr(MSR_FOO, lo, hi);
  *  wrmsrl(MSR_FOO, val);
  */
 
@@ -43,17 +47,13 @@ static always_inline uint64_t rdmsr(unsigned int msr)
        val = a__ | ((u64)b__<<32); \
 } while(0)
 
-#define wrmsr(msr,val1,val2) \
-     __asm__ __volatile__("wrmsr" \
-			  : /* no outputs */ \
-			  : "c" (msr), "a" (val1), "d" (val2))
-
-static inline void wrmsrl(unsigned int msr, uint64_t val)
+static inline void wrmsr(unsigned int msr, uint64_t val)
 {
-        uint32_t lo = val, hi = val >> 32;
+    uint32_t lo = val, hi = val >> 32;
 
-        wrmsr(msr, lo, hi);
+    asm volatile ( "wrmsr" :: "a" (lo), "d" (hi), "c" (msr) );
 }
+#define wrmsrl(msr, val) wrmsr(msr, val)
 
 /* Non-serialising WRMSR, when available.  Falls back to a serialising WRMSR. */
 static inline void wrmsrns(uint32_t msr, uint64_t val)
@@ -150,7 +150,7 @@ static inline void wrmsr_tsc_aux(uint32_t val)
 
     if ( *this_tsc_aux != val )
     {
-        wrmsr(MSR_TSC_AUX, val, 0);
+        wrmsrns(MSR_TSC_AUX, val);
         *this_tsc_aux = val;
     }
 }
diff --git a/xen/arch/x86/nmi.c b/xen/arch/x86/nmi.c
index 9793fa2316..a0c9194ff0 100644
--- a/xen/arch/x86/nmi.c
+++ b/xen/arch/x86/nmi.c
@@ -218,16 +218,16 @@ void disable_lapic_nmi_watchdog(void)
         return;
     switch (boot_cpu_data.x86_vendor) {
     case X86_VENDOR_AMD:
-        wrmsr(MSR_K7_EVNTSEL0, 0, 0);
+        wrmsrns(MSR_K7_EVNTSEL0, 0);
         break;
     case X86_VENDOR_INTEL:
         switch (boot_cpu_data.x86) {
         case 6:
-            wrmsr(MSR_P6_EVNTSEL(0), 0, 0);
+            wrmsrns(MSR_P6_EVNTSEL(0), 0);
             break;
         case 15:
-            wrmsr(MSR_P4_IQ_CCCR0, 0, 0);
-            wrmsr(MSR_P4_CRU_ESCR0, 0, 0);
+            wrmsr(MSR_P4_IQ_CCCR0, 0);
+            wrmsr(MSR_P4_CRU_ESCR0, 0);
             break;
         }
         break;
@@ -282,7 +282,7 @@ static void clear_msr_range(unsigned int base, unsigned int n)
     unsigned int i;
 
     for (i = 0; i < n; i++)
-        wrmsr(base+i, 0, 0);
+        wrmsrns(base + i, 0);
 }
 
 static inline void write_watchdog_counter(const char *descr)
@@ -308,11 +308,11 @@ static void setup_k7_watchdog(void)
         | K7_EVNTSEL_USR
         | K7_NMI_EVENT;
 
-    wrmsr(MSR_K7_EVNTSEL0, evntsel, 0);
+    wrmsrns(MSR_K7_EVNTSEL0, evntsel);
     write_watchdog_counter("K7_PERFCTR0");
     apic_write(APIC_LVTPC, APIC_DM_NMI);
     evntsel |= K7_EVNTSEL_ENABLE;
-    wrmsr(MSR_K7_EVNTSEL0, evntsel, 0);
+    wrmsrns(MSR_K7_EVNTSEL0, evntsel);
 }
 
 static void setup_p6_watchdog(unsigned counter)
@@ -338,11 +338,11 @@ static void setup_p6_watchdog(unsigned counter)
         | P6_EVNTSEL_USR
         | counter;
 
-    wrmsr(MSR_P6_EVNTSEL(0), evntsel, 0);
+    wrmsrns(MSR_P6_EVNTSEL(0), evntsel);
     write_watchdog_counter("P6_PERFCTR0");
     apic_write(APIC_LVTPC, APIC_DM_NMI);
     evntsel |= P6_EVNTSEL0_ENABLE;
-    wrmsr(MSR_P6_EVNTSEL(0), evntsel, 0);
+    wrmsrns(MSR_P6_EVNTSEL(0), evntsel);
 }
 
 static void setup_p4_watchdog(void)
diff --git a/xen/arch/x86/oprofile/op_model_athlon.c b/xen/arch/x86/oprofile/op_model_athlon.c
index bf897a4b63..4c016624a6 100644
--- a/xen/arch/x86/oprofile/op_model_athlon.c
+++ b/xen/arch/x86/oprofile/op_model_athlon.c
@@ -34,7 +34,7 @@
 #define MAX_COUNTERS FAM15H_NUM_COUNTERS
 
 #define CTR_READ(msr_content,msrs,c) do {rdmsrl(msrs->counters[(c)].addr, (msr_content));} while (0)
-#define CTR_WRITE(l,msrs,c) do {wrmsr(msrs->counters[(c)].addr, -(unsigned int)(l), -1);} while (0)
+#define CTR_WRITE(l,msrs,c) wrmsr(msrs->counters[(c)].addr, -(l))
 #define CTR_OVERFLOWED(n) (!((n) & (1ULL<<31)))
 
 #define CTRL_READ(msr_content,msrs,c) do {rdmsrl(msrs->controls[(c)].addr, (msr_content));} while (0)
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.21


From xen-changelog-bounces@lists.xenproject.org Mon Mar 23 22:00:24 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 23 Mar 2026 22:00:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1259582.1552879 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4nJv-0000uE-Vz; Mon, 23 Mar 2026 22:00:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1259582.1552879; Mon, 23 Mar 2026 22:00:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4nJv-0000u6-TR; Mon, 23 Mar 2026 22:00:23 +0000
Received: by outflank-mailman (input) for mailman id 1259582;
 Mon, 23 Mar 2026 22:00:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w4nJu-0000tv-6a
 for xen-changelog@lists.xenproject.org; Mon, 23 Mar 2026 22:00:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4nJu-005jp5-13
 for xen-changelog@lists.xenproject.org;
 Mon, 23 Mar 2026 22:00:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4nJu-00AwBo-0E
 for xen-changelog@lists.xenproject.org;
 Mon, 23 Mar 2026 22:00:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ils8NnUe5KgPVm+8vge2I0IKHn5CdHxRudRwRHoattE=; b=WsvkxFBLCjvAzYRSWMxHzGbRrv
	MirKxIeKFVleWrgLuh4go/vwpj5GZ7RGJBe3A8HA367M2wJT1BnRLOIvnn8+Ww4uzwB8+8i8RBTVP
	bcsbYv1Fig54X+uvW8BObcJES9xJhPj3abWpOSpkDrFtR0/eA5KKRZ8Ny7Zv9iI8/8Kk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.21] x86/fsgsbase: Split out __{rd,wr}gs_shadow() helpers
Message-Id: <E1w4nJu-00AwBo-0E@xenbits.xenproject.org>
Date: Mon, 23 Mar 2026 22:00:22 +0000

commit 0a1441643041813b7b34bb35329b0c53b6935e43
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Aug 14 14:32:03 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 17 12:13:49 2026 +0000

    x86/fsgsbase: Split out __{rd,wr}gs_shadow() helpers
    
    Right now they're inline in {read,write}_gs_shadow(), but we're going to need
    to use these elsewhere to support FRED.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    (cherry picked from commit 9900679fa92596660d7d571113d98a6abfd95141)
---
 xen/arch/x86/include/asm/fsgsbase.h | 36 +++++++++++++++++++++++-------------
 1 file changed, 23 insertions(+), 13 deletions(-)

diff --git a/xen/arch/x86/include/asm/fsgsbase.h b/xen/arch/x86/include/asm/fsgsbase.h
index 03e6a85d31..5577038426 100644
--- a/xen/arch/x86/include/asm/fsgsbase.h
+++ b/xen/arch/x86/include/asm/fsgsbase.h
@@ -32,6 +32,17 @@ static inline unsigned long __rdgsbase(void)
     return base;
 }
 
+static inline unsigned long __rdgs_shadow(void)
+{
+    unsigned long base;
+
+    asm_inline volatile ( "swapgs\n\t"
+                          "rdgsbase %0\n\t"
+                          "swapgs" : "=r" (base) );
+
+    return base;
+}
+
 static inline void __wrfsbase(unsigned long base)
 {
     asm volatile ( "wrfsbase %0" :: "r" (base) );
@@ -42,6 +53,14 @@ static inline void __wrgsbase(unsigned long base)
     asm volatile ( "wrgsbase %0" :: "r" (base) );
 }
 
+static inline void __wrgs_shadow(unsigned long base)
+{
+    asm_inline volatile ( "swapgs\n\t"
+                          "wrgsbase %0\n\t"
+                          "swapgs"
+                          :: "r" (base) );
+}
+
 static inline unsigned long read_fs_base(void)
 {
     unsigned long base;
@@ -71,13 +90,9 @@ static inline unsigned long read_gs_shadow(void)
     unsigned long base;
 
     if ( read_cr4() & X86_CR4_FSGSBASE )
-    {
-        asm volatile ( "swapgs" );
-        base = __rdgsbase();
-        asm volatile ( "swapgs" );
-    }
-    else
-        rdmsrl(MSR_SHADOW_GS_BASE, base);
+        return __rdgs_shadow();
+
+    rdmsrl(MSR_SHADOW_GS_BASE, base);
 
     return base;
 }
@@ -101,12 +116,7 @@ static inline void write_gs_base(unsigned long base)
 static inline void write_gs_shadow(unsigned long base)
 {
     if ( read_cr4() & X86_CR4_FSGSBASE )
-    {
-        asm volatile ( "swapgs\n\t"
-                       "wrgsbase %0\n\t"
-                       "swapgs"
-                       :: "r" (base) );
-    }
+        __wrgs_shadow(base);
     else
         wrmsrl(MSR_SHADOW_GS_BASE, base);
 }
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.21


From xen-changelog-bounces@lists.xenproject.org Mon Mar 23 22:00:34 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 23 Mar 2026 22:00:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1259583.1552884 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4nK6-0000wR-1K; Mon, 23 Mar 2026 22:00:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1259583.1552884; Mon, 23 Mar 2026 22:00:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4nK5-0000wJ-Un; Mon, 23 Mar 2026 22:00:33 +0000
Received: by outflank-mailman (input) for mailman id 1259583;
 Mon, 23 Mar 2026 22:00:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w4nK4-0000w4-7y
 for xen-changelog@lists.xenproject.org; Mon, 23 Mar 2026 22:00:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4nK4-005jp9-1N
 for xen-changelog@lists.xenproject.org;
 Mon, 23 Mar 2026 22:00:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4nK4-00AwD4-0a
 for xen-changelog@lists.xenproject.org;
 Mon, 23 Mar 2026 22:00:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=0UP9wvOYgKfmhcbfbUK352LODJ/79KitZtXqnobbfEM=; b=f1dktcW5iMCRQFEM6XBmvYxX/F
	XAAYTUiVNjwnuDJPHfV7CIekkUNEsuzKcnvv9lP7o4dWcjGWuTnbol/s32sO1YonJ/v2E/lmlT83B
	n8Skt6g5irDo/lCasWC0Q2EKg2X9ZEbJEJJYbPzpcAzFt5I+Ruf/Za4IygNelK7bAeU8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.21] x86/fsgsbase: Update fs/gs helpers to use wrmsrns()
Message-Id: <E1w4nK4-00AwD4-0a@xenbits.xenproject.org>
Date: Mon, 23 Mar 2026 22:00:32 +0000

commit 447a046a439aea36a66ce1ea21bad96c21940ac1
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Aug 14 15:26:56 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 17 12:13:49 2026 +0000

    x86/fsgsbase: Update fs/gs helpers to use wrmsrns()
    
    ... and rdmsr() while here.
    
    Most of these accesses are in fastpaths and do not need serialising behaviour,
    but the write side is serialising on all Intel hardware as well as older AMD
    hardware.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    (cherry picked from commit 6b448a92a367839386994def3209c079fc98fe68)
---
 xen/arch/x86/domain.c               | 10 +++++-----
 xen/arch/x86/hvm/vmx/vmx.c          |  4 ++--
 xen/arch/x86/include/asm/fsgsbase.h | 30 +++++++++---------------------
 3 files changed, 16 insertions(+), 28 deletions(-)

diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index d488f08aff..7d74414ada 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -1847,9 +1847,9 @@ static void load_segments(struct vcpu *n)
         }
         else
         {
-            wrmsrl(MSR_FS_BASE, n->arch.pv.fs_base);
-            wrmsrl(MSR_GS_BASE, gsb);
-            wrmsrl(MSR_SHADOW_GS_BASE, gss);
+            wrmsrns(MSR_FS_BASE, n->arch.pv.fs_base);
+            wrmsrns(MSR_GS_BASE, gsb);
+            wrmsrns(MSR_SHADOW_GS_BASE, gss);
         }
     }
 
@@ -1974,8 +1974,8 @@ static void save_segments(struct vcpu *v)
         }
         else
         {
-            rdmsrl(MSR_FS_BASE, fs_base);
-            rdmsrl(MSR_GS_BASE, gs_base);
+            fs_base = rdmsr(MSR_FS_BASE);
+            gs_base = rdmsr(MSR_GS_BASE);
         }
 
         v->arch.pv.fs_base = fs_base;
diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index a4f606720f..1d464324ec 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -2737,8 +2737,8 @@ static uint64_t cf_check vmx_get_reg(struct vcpu *v, unsigned int reg)
     case MSR_SHADOW_GS_BASE:
         if ( v != curr )
             return v->arch.hvm.vmx.shadow_gs;
-        rdmsrl(MSR_SHADOW_GS_BASE, val);
-        return val;
+        else
+            return rdmsr(MSR_SHADOW_GS_BASE);
     }
 
     /* Logic which maybe requires remote VMCS acquisition. */
diff --git a/xen/arch/x86/include/asm/fsgsbase.h b/xen/arch/x86/include/asm/fsgsbase.h
index 5577038426..24862a6bfe 100644
--- a/xen/arch/x86/include/asm/fsgsbase.h
+++ b/xen/arch/x86/include/asm/fsgsbase.h
@@ -63,38 +63,26 @@ static inline void __wrgs_shadow(unsigned long base)
 
 static inline unsigned long read_fs_base(void)
 {
-    unsigned long base;
-
     if ( read_cr4() & X86_CR4_FSGSBASE )
         return __rdfsbase();
-
-    rdmsrl(MSR_FS_BASE, base);
-
-    return base;
+    else
+        return rdmsr(MSR_FS_BASE);
 }
 
 static inline unsigned long read_gs_base(void)
 {
-    unsigned long base;
-
     if ( read_cr4() & X86_CR4_FSGSBASE )
         return __rdgsbase();
-
-    rdmsrl(MSR_GS_BASE, base);
-
-    return base;
+    else
+        return rdmsr(MSR_GS_BASE);
 }
 
 static inline unsigned long read_gs_shadow(void)
 {
-    unsigned long base;
-
     if ( read_cr4() & X86_CR4_FSGSBASE )
         return __rdgs_shadow();
-
-    rdmsrl(MSR_SHADOW_GS_BASE, base);
-
-    return base;
+    else
+        return rdmsr(MSR_SHADOW_GS_BASE);
 }
 
 static inline void write_fs_base(unsigned long base)
@@ -102,7 +90,7 @@ static inline void write_fs_base(unsigned long base)
     if ( read_cr4() & X86_CR4_FSGSBASE )
         __wrfsbase(base);
     else
-        wrmsrl(MSR_FS_BASE, base);
+        wrmsrns(MSR_FS_BASE, base);
 }
 
 static inline void write_gs_base(unsigned long base)
@@ -110,7 +98,7 @@ static inline void write_gs_base(unsigned long base)
     if ( read_cr4() & X86_CR4_FSGSBASE )
         __wrgsbase(base);
     else
-        wrmsrl(MSR_GS_BASE, base);
+        wrmsrns(MSR_GS_BASE, base);
 }
 
 static inline void write_gs_shadow(unsigned long base)
@@ -118,7 +106,7 @@ static inline void write_gs_shadow(unsigned long base)
     if ( read_cr4() & X86_CR4_FSGSBASE )
         __wrgs_shadow(base);
     else
-        wrmsrl(MSR_SHADOW_GS_BASE, base);
+        wrmsrns(MSR_SHADOW_GS_BASE, base);
 }
 
 #endif /* X86_FSGSBASE_H */
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.21


From xen-changelog-bounces@lists.xenproject.org Mon Mar 23 22:00:44 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 23 Mar 2026 22:00:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1259584.1552888 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4nKG-0000yR-2U; Mon, 23 Mar 2026 22:00:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1259584.1552888; Mon, 23 Mar 2026 22:00:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4nKF-0000yJ-WD; Mon, 23 Mar 2026 22:00:44 +0000
Received: by outflank-mailman (input) for mailman id 1259584;
 Mon, 23 Mar 2026 22:00:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w4nKE-0000y7-D6
 for xen-changelog@lists.xenproject.org; Mon, 23 Mar 2026 22:00:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4nKE-005jra-1r
 for xen-changelog@lists.xenproject.org;
 Mon, 23 Mar 2026 22:00:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4nKE-00AwGR-0r
 for xen-changelog@lists.xenproject.org;
 Mon, 23 Mar 2026 22:00:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ecfvjHkb+YpxeXP9Y4Mk7NDy3FelU/BdJEmnjo3N1Yc=; b=xDAT1Cxjc+ZNwv7mD8o72BEIwO
	iGZGSn76YtPP//EnbzqGrOXEn/a+Tso32xl81xHOWHXByOEabsNM1pMQdoGfXBTIjayzrLHnqBMLL
	+a6tUSImTgrQd1WpYzsoN79wY0oh/sDJDTD49gVB4LQ3h7XhKGaUIwrTm0AqyxTNE4Bk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.21] x86/fsgsbase: Improve code generation in read_registers()
Message-Id: <E1w4nKE-00AwGR-0r@xenbits.xenproject.org>
Date: Mon, 23 Mar 2026 22:00:42 +0000

commit e1d84ea373de0d9bf4195cbf29d9fcf46c02d1ca
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Aug 12 12:48:06 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 17 12:13:49 2026 +0000

    x86/fsgsbase: Improve code generation in read_registers()
    
    It turns out that using the higher level helpers adjacent like this leads to
    terrible code generation.  Due to -fno-strict-aliasing, the store into state
    invalidates the read_cr4() address calculation (which is really cpu_info->cr4
    under the hood), meaning that it can't be hoisted.
    
    As a result we get "locate the top of stack block, get cr4, and see if
    FSGSBASE is set" repeated 3 times, and an unreasonable number of basic blocks.
    
    Hoist the calculation manually, which results in two basic blocks.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    (cherry picked from commit 42a0709f374966573851236589583c86b603e704)
---
 xen/arch/x86/traps.c | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index 6f6ce387a1..5a0a16a6b3 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -118,9 +118,24 @@ static void read_registers(struct extra_state *state)
     state->cr3 = read_cr3();
     state->cr4 = read_cr4();
 
-    state->fsb = read_fs_base();
-    state->gsb = read_gs_base();
-    state->gss = read_gs_shadow();
+    /*
+     * Help the optimiser out by opencoding read_*_base() and rearranging the
+     * expression.  -fno-strict-aliasing causes the store into state to
+     * invalidate the read_cr4() address calculation (really cpu_info->cr4
+     * under the hood), forcing the cr4 check to be re-evaluated every time.
+     */
+    if ( state->cr4 & X86_CR4_FSGSBASE )
+    {
+        state->fsb = __rdfsbase();
+        state->gsb = __rdgsbase();
+        state->gss = __rdgs_shadow();
+    }
+    else
+    {
+        state->fsb = rdmsr(MSR_FS_BASE);
+        state->gsb = rdmsr(MSR_GS_BASE);
+        state->gss = rdmsr(MSR_SHADOW_GS_BASE);
+    }
 
     asm ( "mov %%ds, %0" : "=m" (state->ds) );
     asm ( "mov %%es, %0" : "=m" (state->es) );
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.21


From xen-changelog-bounces@lists.xenproject.org Mon Mar 23 22:00:54 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 23 Mar 2026 22:00:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1259585.1552891 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4nKQ-00010t-3l; Mon, 23 Mar 2026 22:00:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1259585.1552891; Mon, 23 Mar 2026 22:00:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4nKQ-00010m-1K; Mon, 23 Mar 2026 22:00:54 +0000
Received: by outflank-mailman (input) for mailman id 1259585;
 Mon, 23 Mar 2026 22:00:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w4nKO-00010f-G7
 for xen-changelog@lists.xenproject.org; Mon, 23 Mar 2026 22:00:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4nKO-005jrg-2B
 for xen-changelog@lists.xenproject.org;
 Mon, 23 Mar 2026 22:00:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4nKO-00AwHE-1M
 for xen-changelog@lists.xenproject.org;
 Mon, 23 Mar 2026 22:00:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=nRvnUYCy6ky/v1aUNm+ysjI14GEBmYOZoJsJmkRZh+k=; b=0tP+yd3KIhsmdgxj9rUkRjEhkI
	swGYNyvGR5ho/1tHJHqvLcP85KBNOIDu6OHPUptGtBeotZqJcNBwzlzyzE37t9uCENmjGz/WtYp2w
	rEJ+cpwN/HaUYTbKO2ejImOvySHSGvlbxTARyefhAFb/Fgcu8JNr2B6SmSms7DpD8LE0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.21] x86/boot: Use RSTORSSP to establish SSP
Message-Id: <E1w4nKO-00AwHE-1M@xenbits.xenproject.org>
Date: Mon, 23 Mar 2026 22:00:52 +0000

commit 4329f8c6034ebc563f3d7b101e7fa0b407e504a2
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon May 26 18:48:26 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 17 12:13:49 2026 +0000

    x86/boot: Use RSTORSSP to establish SSP
    
    Under FRED, SETSSBSY is disallowed, and we want to be setting up FRED prior to
    setting up shadow stacks.  As we still need Supervisor Tokens in IDT mode, we
    need mode-specific logic to establish SSP.
    
    In FRED mode, write a Restore Token, RSTORSSP it, and discard the resulting
    Previous-SSP token.
    
    No change outside of FRED mode.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    (cherry picked from commit 3037d8b7eb3e9c3c9e4a0a257115557c300795fc)
---
 xen/arch/x86/boot/x86_64.S | 23 +++++++++++++++++++++--
 xen/arch/x86/setup.c       | 25 ++++++++++++++++++++++++-
 2 files changed, 45 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/boot/x86_64.S b/xen/arch/x86/boot/x86_64.S
index 11a7e9d3bd..9705d03f84 100644
--- a/xen/arch/x86/boot/x86_64.S
+++ b/xen/arch/x86/boot/x86_64.S
@@ -53,17 +53,21 @@ ENTRY(__high_start)
         mov     %rcx, STACK_CPUINFO_FIELD(cr4)(%r15)
         mov     %rcx, %cr4
 
-        /* WARNING! call/ret now fatal (iff SHSTK) until SETSSBSY loads SSP */
+        /* WARNING! CALL/RET now fatal (iff SHSTK) until SETSSBSY/RSTORSSP loads SSP */
 
 #if defined(CONFIG_XEN_SHSTK)
         test    $CET_SHSTK_EN, %al
         jz      .L_ap_cet_done
 
-        /* Derive the supervisor token address from %rsp. */
+        /* Derive the token address from %rsp. */
         mov     %rsp, %rdx
         and     $~(STACK_SIZE - 1), %rdx
         or      $(PRIMARY_SHSTK_SLOT + 1) * PAGE_SIZE - 8, %rdx
 
+        /* Establishing SSP differs between IDT or FRED mode. */
+        bt      $32 /* ilog2(X86_CR4_FRED) */, %rcx
+        jc      .L_fred_shstk
+
         /*
          * Write a new Supervisor Token.  It doesn't matter the first time a
          * CPU boots, but for S3 resume or hotplug this clears the busy bit so
@@ -71,6 +75,21 @@ ENTRY(__high_start)
          */
         wrssq   %rdx, (%rdx)
         setssbsy
+        jmp     .L_ap_cet_done
+
+.L_fred_shstk:
+
+        /*
+         * Write a Restore Token, value: &token + 8 + 64BIT (bit 0) at the
+         * base of the shstk (which isn't in use yet).
+         */
+        lea     9(%rdx), %rdi
+        wrssq   %rdi, (%rdx)
+        rstorssp (%rdx)
+
+        /* Discard the Previous-SSP Token from the shstk. */
+        mov     $2, %edx
+        incsspd %edx
 
 #endif /* CONFIG_XEN_SHSTK */
 .L_ap_cet_done:
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 872a8c63f9..44da5efa1d 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -49,6 +49,7 @@
 #include <asm/prot-key.h>
 #include <asm/pv/domain.h>
 #include <asm/setup.h>
+#include <asm/shstk.h>
 #include <asm/smp.h>
 #include <asm/spec_ctrl.h>
 #include <asm/stubs.h>
@@ -908,7 +909,29 @@ static void __init noreturn reinit_bsp_stack(void)
     if ( cpu_has_xen_shstk )
     {
         wrmsrl(MSR_S_CET, xen_msr_s_cet_value());
-        asm volatile ("setssbsy" ::: "memory");
+
+        /*
+         * IDT and FRED differ by a Supervisor Token on the shadow stack.
+         *
+         * In IDT mode, we use SETSSBSY (itself using MSR_PL0_SSP, configured
+         * previously) to mark the Supervisor Token as Busy.  In FRED mode,
+         * there is no token, so we need to create a temporary Restore Token
+         * to establish SSP.
+         */
+        if ( opt_fred )
+        {
+            unsigned long *token =
+                (void *)stack + (PRIMARY_SHSTK_SLOT + 1) * PAGE_SIZE - 8;
+
+            wrss((unsigned long)token + 9, token);
+            asm volatile ( "rstorssp %0" : "+m" (*token) );
+            /*
+             * We need to discard the resulting Previous-SSP Token, but
+             * reset_stack_and_jump() will do that for us.
+             */
+        }
+        else
+            asm volatile ( "setssbsy" ::: "memory" );
     }
 
     reset_stack_and_jump(init_done);
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.21


From xen-changelog-bounces@lists.xenproject.org Mon Mar 23 22:01:04 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 23 Mar 2026 22:01:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1259586.1552896 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4nKa-00012t-5R; Mon, 23 Mar 2026 22:01:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1259586.1552896; Mon, 23 Mar 2026 22:01:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4nKa-00012m-2n; Mon, 23 Mar 2026 22:01:04 +0000
Received: by outflank-mailman (input) for mailman id 1259586;
 Mon, 23 Mar 2026 22:01:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w4nKY-00012g-IX
 for xen-changelog@lists.xenproject.org; Mon, 23 Mar 2026 22:01:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4nKY-005jrx-2R
 for xen-changelog@lists.xenproject.org;
 Mon, 23 Mar 2026 22:01:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4nKY-00AwIy-1g
 for xen-changelog@lists.xenproject.org;
 Mon, 23 Mar 2026 22:01:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=LrZYd8EA2kvSfiIT82LMnt79MEoZXLw4gbI7Ta9Xe/o=; b=woRIf6U0Af+1MUmYPIxVPF4hhg
	xA7b/M27mQh9eOJk2ArtGYmyP94Tk0L5vVLfVXX4DHrzIHWtXCOgF30JXoUJNjNiyZuNeh4o6AMtv
	dyY5A+GC+LJljiRnsNecFoKHJk1V9JP+VAQLcsbVQ12JbTAK+/LH3clsG7ao92PQtYlg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.21] x86/pv: Deduplicate is_canonical_address() in do_set_segment_base()
Message-Id: <E1w4nKY-00AwIy-1g@xenbits.xenproject.org>
Date: Mon, 23 Mar 2026 22:01:02 +0000

commit d23e5a7ae264cf56f844005f72522aab5c6277de
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Aug 12 12:48:06 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 17 12:13:49 2026 +0000

    x86/pv: Deduplicate is_canonical_address() in do_set_segment_base()
    
    This is really a rearrangement to make adding FRED support easier.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    (cherry picked from commit 524f3fa35efd7a425e1033d2fa5c927f61224d67)
---
 xen/arch/x86/pv/misc-hypercalls.c | 32 +++++++++++++++++---------------
 1 file changed, 17 insertions(+), 15 deletions(-)

diff --git a/xen/arch/x86/pv/misc-hypercalls.c b/xen/arch/x86/pv/misc-hypercalls.c
index 7a37f16bf0..4c2abeb4ad 100644
--- a/xen/arch/x86/pv/misc-hypercalls.c
+++ b/xen/arch/x86/pv/misc-hypercalls.c
@@ -176,27 +176,29 @@ long do_set_segment_base(unsigned int which, unsigned long base)
     switch ( which )
     {
     case SEGBASE_FS:
-        if ( is_canonical_address(base) )
-            write_fs_base(base);
-        else
+    case SEGBASE_GS_USER:
+    case SEGBASE_GS_KERNEL:
+        if ( !is_canonical_address(base) )
+        {
             ret = -EINVAL;
-        break;
+            break;
+        }
 
-    case SEGBASE_GS_USER:
-        if ( is_canonical_address(base) )
+        switch ( which )
         {
-            write_gs_shadow(base);
+        case SEGBASE_FS:
+            write_fs_base(base);
+            break;
+
+        case SEGBASE_GS_USER:
             v->arch.pv.gs_base_user = base;
-        }
-        else
-            ret = -EINVAL;
-        break;
+            write_gs_shadow(base);
+            break;
 
-    case SEGBASE_GS_KERNEL:
-        if ( is_canonical_address(base) )
+        case SEGBASE_GS_KERNEL:
             write_gs_base(base);
-        else
-            ret = -EINVAL;
+            break;
+        }
         break;
 
     case SEGBASE_GS_USER_SEL:
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.21


From xen-changelog-bounces@lists.xenproject.org Mon Mar 23 22:01:14 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 23 Mar 2026 22:01:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1259587.1552900 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4nKk-00014z-7D; Mon, 23 Mar 2026 22:01:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1259587.1552900; Mon, 23 Mar 2026 22:01:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4nKk-00014s-4O; Mon, 23 Mar 2026 22:01:14 +0000
Received: by outflank-mailman (input) for mailman id 1259587;
 Mon, 23 Mar 2026 22:01:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w4nKi-00014m-LZ
 for xen-changelog@lists.xenproject.org; Mon, 23 Mar 2026 22:01:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4nKi-005js7-2j
 for xen-changelog@lists.xenproject.org;
 Mon, 23 Mar 2026 22:01:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4nKi-00AwJm-1x
 for xen-changelog@lists.xenproject.org;
 Mon, 23 Mar 2026 22:01:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=af3DKOYGukrlQavAbNAEtDSG/o03ZXTzxnph4wfLess=; b=0uKhdLYum+6ltQiqDPLGMdLclZ
	k68EnR7Z01aHxlR/xtyl05xlmUvQqA/chNS3/putGokb7d6Ax27yV7VZ83ae2/k6MS3JbV5vud0c2
	nHcH39Of+EyhLg9SPq5j1sriUBmVbyZPa05AYILCiSTNRNQruC+6BeR5Rei5xmWgk33s=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.21] x86/traps: Make an IDT-specific #DB helper
Message-Id: <E1w4nKi-00AwJm-1x@xenbits.xenproject.org>
Date: Mon, 23 Mar 2026 22:01:12 +0000

commit bf5f349f7b00eb96488c74cf4c0601d8cbf9644d
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Aug 11 12:42:01 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 17 12:13:49 2026 +0000

    x86/traps: Make an IDT-specific #DB helper
    
    FRED provides PENDING_DBG in the the stack frame, avoiding the need to read
    %dr6 manually.
    
    Rename do_debug() to handle_DB(), and update it to take a dbg field using
    positive polarity.
    
    Introduce a new handle_DB_IDT() which reads %dr6.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    (cherry picked from commit d9974d7860868d8a59fc95508ec768d300fed0b1)
---
 xen/arch/x86/traps.c        | 28 +++++++++++++++++-----------
 xen/arch/x86/x86_64/entry.S |  2 +-
 2 files changed, 18 insertions(+), 12 deletions(-)

diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index 5a0a16a6b3..d24bb381fa 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -1997,14 +1997,11 @@ void asmlinkage do_device_not_available(struct cpu_user_regs *regs)
 
 void nocall sysenter_eflags_saved(void);
 
-void asmlinkage do_debug(struct cpu_user_regs *regs)
+/* Handle #DB.  @dbg is PENDING_DBG, a.k.a. %dr6 with positive polarity. */
+static void handle_DB(struct cpu_user_regs *regs, unsigned long dbg)
 {
-    unsigned long dr6;
     struct vcpu *v = current;
 
-    /* Stash dr6 as early as possible. */
-    dr6 = read_debugreg(6);
-
     /*
      * At the time of writing (March 2018), on the subject of %dr6:
      *
@@ -2072,13 +2069,13 @@ void asmlinkage do_debug(struct cpu_user_regs *regs)
          * If however we do, safety measures need to be enacted.  Use a big
          * hammer and clear all debug settings.
          */
-        if ( dr6 & (DR_TRAP3 | DR_TRAP2 | DR_TRAP1 | DR_TRAP0) )
+        if ( dbg & (DR_TRAP3 | DR_TRAP2 | DR_TRAP1 | DR_TRAP0) )
         {
             unsigned int bp, dr7 = read_debugreg(7);
 
             for ( bp = 0; bp < 4; ++bp )
             {
-                if ( (dr6 & (1u << bp)) && /* Breakpoint triggered? */
+                if ( (dbg & (1u << bp)) && /* Breakpoint triggered? */
                      (dr7 & (3u << (bp * DR_ENABLE_SIZE))) && /* Enabled? */
                      ((dr7 & (3u << ((bp * DR_CONTROL_SIZE) + /* Insn? */
                                      DR_CONTROL_SHIFT))) == DR_RW_EXECUTE) )
@@ -2099,9 +2096,9 @@ void asmlinkage do_debug(struct cpu_user_regs *regs)
          * so ensure the message is ratelimited.
          */
         gprintk(XENLOG_WARNING,
-                "Hit #DB in Xen context: %04x:%p [%ps], stk %04x:%p, dr6 %lx\n",
+                "Hit #DB in Xen context: %04x:%p [%ps], stk %04x:%p, dbg %lx\n",
                 regs->cs, _p(regs->rip), _p(regs->rip),
-                regs->ss, _p(regs->rsp), dr6);
+                regs->ss, _p(regs->rsp), dbg);
 
         return;
     }
@@ -2113,7 +2110,7 @@ void asmlinkage do_debug(struct cpu_user_regs *regs)
      * by debugging actions completed behind it's back.
      */
     v->arch.dr6 = x86_merge_dr6(v->domain->arch.cpu_policy,
-                                v->arch.dr6, dr6 ^ X86_DR6_DEFAULT);
+                                v->arch.dr6, dbg);
 
     if ( guest_kernel_mode(v, regs) && v->domain->debugger_attached )
     {
@@ -2121,7 +2118,16 @@ void asmlinkage do_debug(struct cpu_user_regs *regs)
         return;
     }
 
-    pv_inject_DB(dr6 ^ X86_DR6_DEFAULT);
+    pv_inject_DB(dbg);
+}
+
+/*
+ * When using IDT delivery, it is our responsibility to read %dr6.  Convert it
+ * to positive polarity.
+ */
+void asmlinkage handle_DB_IDT(struct cpu_user_regs *regs)
+{
+    handle_DB(regs, read_debugreg(6) ^ X86_DR6_DEFAULT);
 }
 
 void asmlinkage do_entry_CP(struct cpu_user_regs *regs)
diff --git a/xen/arch/x86/x86_64/entry.S b/xen/arch/x86/x86_64/entry.S
index 39c7b9d17f..789687488c 100644
--- a/xen/arch/x86/x86_64/entry.S
+++ b/xen/arch/x86/x86_64/entry.S
@@ -1171,7 +1171,7 @@ FUNC(handle_ist_exception)
 .L_ ## vec ## _done:
 
         DISPATCH(X86_EXC_NMI, do_nmi)
-        DISPATCH(X86_EXC_DB,  do_debug)
+        DISPATCH(X86_EXC_DB,  handle_DB_IDT)
         DISPATCH(X86_EXC_MC,  do_machine_check)
 #undef DISPATCH
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.21


From xen-changelog-bounces@lists.xenproject.org Mon Mar 23 22:01:24 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 23 Mar 2026 22:01:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1259588.1552905 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4nKu-00017X-Af; Mon, 23 Mar 2026 22:01:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1259588.1552905; Mon, 23 Mar 2026 22:01:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4nKu-00017P-7W; Mon, 23 Mar 2026 22:01:24 +0000
Received: by outflank-mailman (input) for mailman id 1259588;
 Mon, 23 Mar 2026 22:01:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w4nKs-00017H-OM
 for xen-changelog@lists.xenproject.org; Mon, 23 Mar 2026 22:01:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4nKs-005jsR-31
 for xen-changelog@lists.xenproject.org;
 Mon, 23 Mar 2026 22:01:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4nKs-00AwKq-2E
 for xen-changelog@lists.xenproject.org;
 Mon, 23 Mar 2026 22:01:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=AGbFJwfb7kSgL0WG1SM5EIowU6/4ywUwp+SZyNDq8qI=; b=cbYPUIzNN4tTxdqy0p5V9rmD6z
	ToIgwVy2WoP0PIlQl6JPMp6CM8B9XqjqUMkhgxqC+jOdYwXLIYjlfhADoIJet/5VxePTTl5eO5jzT
	FdxIurpbKdYgsLDLZQfh7ba/pe9o+q77HYhkA0AX2RELtManb8D3+Sc1Izxwias4JE+E=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.21] x86/traps: Make an IDT-specific #PF helper
Message-Id: <E1w4nKs-00AwKq-2E@xenbits.xenproject.org>
Date: Mon, 23 Mar 2026 22:01:22 +0000

commit 92307f30b05de02b5c6f23577754e57b27560440
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Aug 11 12:42:01 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 17 12:13:50 2026 +0000

    x86/traps: Make an IDT-specific #PF helper
    
    FRED provides %cr2 in the the stack frame, avoiding the need to read %cr2
    manually.
    
    Rename do_page_fault() to handle_PF(), and update it to take cr2, still named
    addr for consistency.
    
    Introduce a new handle_PF_IDT() which reads %cr2 and conditionally re-enables
    interrupts.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    (cherry picked from commit 4153eb7660ad441de75ab6dca50b54eb340d0728)
---
 xen/arch/x86/traps.c        | 26 ++++++++++++++------------
 xen/arch/x86/x86_64/entry.S |  2 +-
 2 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index d24bb381fa..3f038f8e12 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -1675,21 +1675,10 @@ static int fixup_page_fault(unsigned long addr, struct cpu_user_regs *regs)
     return 0;
 }
 
-void asmlinkage do_page_fault(struct cpu_user_regs *regs)
+static void handle_PF(struct cpu_user_regs *regs, unsigned long addr /* cr2 */)
 {
-    unsigned long addr;
     unsigned int error_code;
 
-    addr = read_cr2();
-
-    /*
-     * Don't re-enable interrupts if we were running an IRQ-off region when
-     * we hit the page fault, or we'll break that code.
-     */
-    ASSERT(!local_irq_is_enabled());
-    if ( regs->flags & X86_EFLAGS_IF )
-        local_irq_enable();
-
     /* fixup_page_fault() might change regs->error_code, so cache it here. */
     error_code = regs->error_code;
 
@@ -1750,6 +1739,19 @@ void asmlinkage do_page_fault(struct cpu_user_regs *regs)
     pv_inject_page_fault(regs->error_code, addr);
 }
 
+/*
+ * When using IDT delivery, it is our responsibility to read %cr2.
+ */
+void asmlinkage handle_PF_IDT(struct cpu_user_regs *regs)
+{
+    unsigned long addr = read_cr2();
+
+    if ( regs->flags & X86_EFLAGS_IF )
+        local_irq_enable();
+
+    handle_PF(regs, addr);
+}
+
 /*
  * Early #PF handler to print CR2, error code, and stack.
  *
diff --git a/xen/arch/x86/x86_64/entry.S b/xen/arch/x86/x86_64/entry.S
index 789687488c..c02245ac06 100644
--- a/xen/arch/x86/x86_64/entry.S
+++ b/xen/arch/x86/x86_64/entry.S
@@ -871,7 +871,7 @@ handle_exception_saved:
          * reading %cr2. Otherwise a page fault in the nested interrupt handler
          * would corrupt %cr2.
          */
-        DISPATCH(X86_EXC_PF, do_page_fault)
+        DISPATCH(X86_EXC_PF, handle_PF_IDT)
 
         /* Only re-enable IRQs if they were active before taking the fault */
         testb $X86_EFLAGS_IF >> 8, UREGS_eflags + 1(%rsp)
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.21


From xen-changelog-bounces@lists.xenproject.org Mon Mar 23 22:01:34 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 23 Mar 2026 22:01:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1259589.1552908 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4nL4-00019U-BT; Mon, 23 Mar 2026 22:01:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1259589.1552908; Mon, 23 Mar 2026 22:01:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4nL4-00019M-8o; Mon, 23 Mar 2026 22:01:34 +0000
Received: by outflank-mailman (input) for mailman id 1259589;
 Mon, 23 Mar 2026 22:01:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w4nL2-00019G-Qw
 for xen-changelog@lists.xenproject.org; Mon, 23 Mar 2026 22:01:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4nL3-005jsa-03
 for xen-changelog@lists.xenproject.org;
 Mon, 23 Mar 2026 22:01:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4nL2-00AwMd-2V
 for xen-changelog@lists.xenproject.org;
 Mon, 23 Mar 2026 22:01:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=UmlXw3Uz5qomPTy2F4AhcWrp+GHFBatBkSQrUFN6CzQ=; b=FHybTIVCz/w4bC+wehFD46udyc
	Mlyov2hwBbsGASWp9lkgDbd4+9jDuauC72scFw6sDDJZD7cuuyEb54VReBMui17zBfyrlgp20TKuF
	iZT1urMY5bcIJNv8V1V2HynKQlH1yC5ToFM/k9QtM+zuvTdqk2vq1mYQ/PdX/ZkHqlgg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.21] x86/traps: Alter switch_stack_and_jump() for FRED mode
Message-Id: <E1w4nL2-00AwMd-2V@xenbits.xenproject.org>
Date: Mon, 23 Mar 2026 22:01:32 +0000

commit b7572954da0e09d5289609db0b126c0944593dbd
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon May 26 18:48:26 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 17 12:13:50 2026 +0000

    x86/traps: Alter switch_stack_and_jump() for FRED mode
    
    FRED and IDT differ by a Supervisor Token on the base of the shadow stack.
    This means that switch_stack_and_jump() needs to discard one extra word when
    FRED is active.
    
    Fix a typo in the parameter name, which should be shstk_base.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    (cherry picked from commit 40fbf971771a5c7c973818edbd0be7b50f0eb364)
---
 xen/arch/x86/include/asm/current.h | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/include/asm/current.h b/xen/arch/x86/include/asm/current.h
index c1eb27b1c4..62817e8476 100644
--- a/xen/arch/x86/include/asm/current.h
+++ b/xen/arch/x86/include/asm/current.h
@@ -154,7 +154,9 @@ unsigned long get_stack_dump_bottom (unsigned long sp);
     "rdsspd %[ssp];"                                            \
     "cmp $1, %[ssp];"                                           \
     "je .L_shstk_done.%=;" /* CET not active?  Skip. */         \
-    "mov $%c[skstk_base], %[val];"                              \
+    ALTERNATIVE("mov $%c[shstk_base], %[val];",                 \
+                "mov $%c[shstk_base] + 8, %[val];",             \
+                X86_FEATURE_XEN_FRED)                           \
     "and $%c[stack_mask], %[ssp];"                              \
     "sub %[ssp], %[val];"                                       \
     "shr $3, %[val];"                                           \
@@ -188,7 +190,7 @@ unsigned long get_stack_dump_bottom (unsigned long sp);
               [ssp] "=&r" (tmp)                                         \
             : [stk] "r" (guest_cpu_user_regs()),                        \
               [fun] constr (fn),                                        \
-              [skstk_base] "i"                                          \
+              [shstk_base] "i"                                          \
               ((PRIMARY_SHSTK_SLOT + 1) * PAGE_SIZE - 8),               \
               [stack_mask] "i" (STACK_SIZE - 1),                        \
               _ASM_BUGFRAME_INFO(BUGFRAME_bug, __LINE__,                \
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.21


From xen-changelog-bounces@lists.xenproject.org Mon Mar 23 22:01:44 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 23 Mar 2026 22:01:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1259590.1552911 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4nLE-0001Bc-Cr; Mon, 23 Mar 2026 22:01:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1259590.1552911; Mon, 23 Mar 2026 22:01:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4nLE-0001BU-AD; Mon, 23 Mar 2026 22:01:44 +0000
Received: by outflank-mailman (input) for mailman id 1259590;
 Mon, 23 Mar 2026 22:01:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w4nLC-0001BM-Tf
 for xen-changelog@lists.xenproject.org; Mon, 23 Mar 2026 22:01:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4nLD-005jsh-0K
 for xen-changelog@lists.xenproject.org;
 Mon, 23 Mar 2026 22:01:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4nLC-00AwNV-2m
 for xen-changelog@lists.xenproject.org;
 Mon, 23 Mar 2026 22:01:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=KbPQidGlNvibtwpqqz8YJAzx160ScEVWTrQzgtCL+JY=; b=hCHxebE+ICxNtN7GSogxsK38xX
	YJa7e3Gc8FGDd7+xGyIsSrD35OrlWbnR07UUOGe42Dj2nKyipMLT85ceywcxBG4DjLarfKS6LxQNr
	dhu6K+941lENcpKA4HN6RrtnvIFfp2M4hfPiRV4rp4dcW+HLUKnY6TBtJn9BOUGu96FQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.21] x86/fsgsbase: Make SHADOW_GS accesses safe under FRED
Message-Id: <E1w4nLC-00AwNV-2m@xenbits.xenproject.org>
Date: Mon, 23 Mar 2026 22:01:42 +0000

commit 1fd19a1bc5f64c00dbcf3eb49a601ae6a0e4b61f
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Aug 18 15:44:44 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 17 12:13:50 2026 +0000

    x86/fsgsbase: Make SHADOW_GS accesses safe under FRED
    
    Under FRED, the SWAPGS instruction is disallowed.  Therefore we must use the
    MSR path instead.
    
    read_registers() is in the show_registers() path, so this change allows Xen to
    render it's current state without suffering #UD (and recursing until the stack
    guard page is hit).
    
    All hardware with FRED is expected to have some kind of non-serialising access
    to these registers.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    (cherry picked from commit 3ff1030ea7d40e62edfe09b44dbdba44def5072a)
---
 xen/arch/x86/include/asm/fsgsbase.h | 8 ++++++--
 xen/arch/x86/traps.c                | 2 +-
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/include/asm/fsgsbase.h b/xen/arch/x86/include/asm/fsgsbase.h
index 24862a6bfe..5faa3a3243 100644
--- a/xen/arch/x86/include/asm/fsgsbase.h
+++ b/xen/arch/x86/include/asm/fsgsbase.h
@@ -79,7 +79,9 @@ static inline unsigned long read_gs_base(void)
 
 static inline unsigned long read_gs_shadow(void)
 {
-    if ( read_cr4() & X86_CR4_FSGSBASE )
+    unsigned long cr4 = read_cr4();
+
+    if ( !(cr4 & X86_CR4_FRED) && (cr4 & X86_CR4_FSGSBASE) )
         return __rdgs_shadow();
     else
         return rdmsr(MSR_SHADOW_GS_BASE);
@@ -103,7 +105,9 @@ static inline void write_gs_base(unsigned long base)
 
 static inline void write_gs_shadow(unsigned long base)
 {
-    if ( read_cr4() & X86_CR4_FSGSBASE )
+    unsigned long cr4 = read_cr4();
+
+    if ( !(cr4 & X86_CR4_FRED) && (cr4 & X86_CR4_FSGSBASE) )
         __wrgs_shadow(base);
     else
         wrmsrns(MSR_SHADOW_GS_BASE, base);
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index 3f038f8e12..702a110131 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -124,7 +124,7 @@ static void read_registers(struct extra_state *state)
      * invalidate the read_cr4() address calculation (really cpu_info->cr4
      * under the hood), forcing the cr4 check to be re-evaluated every time.
      */
-    if ( state->cr4 & X86_CR4_FSGSBASE )
+    if ( !(state->cr4 & X86_CR4_FRED) && (state->cr4 & X86_CR4_FSGSBASE) )
     {
         state->fsb = __rdfsbase();
         state->gsb = __rdgsbase();
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.21


From xen-changelog-bounces@lists.xenproject.org Mon Mar 23 22:01:54 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 23 Mar 2026 22:01:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1259591.1552915 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4nLO-0001Du-ED; Mon, 23 Mar 2026 22:01:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1259591.1552915; Mon, 23 Mar 2026 22:01:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4nLO-0001Dm-Bf; Mon, 23 Mar 2026 22:01:54 +0000
Received: by outflank-mailman (input) for mailman id 1259591;
 Mon, 23 Mar 2026 22:01:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w4nLN-0001De-0F
 for xen-changelog@lists.xenproject.org; Mon, 23 Mar 2026 22:01:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4nLN-005jsl-0b
 for xen-changelog@lists.xenproject.org;
 Mon, 23 Mar 2026 22:01:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4nLM-00AwOO-33
 for xen-changelog@lists.xenproject.org;
 Mon, 23 Mar 2026 22:01:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=8q/Rnx5yQmDcy2Q49phxc1S0QrNeWNkYlhvUX+ipLV8=; b=PDJIGr5ysI+9Mviwe0tL9m8eU7
	HFAYY8VygpjhtcByVvkL5Qb1OL18J2/VhZA87Iap/CTNM+zt+Ms1nMhN/Bv11O5EoEqmjn4ZvtlZ5
	9gCjBDA+Fp9gFoh1a0FZ0scElLIaq3PQZ5UrQEpjQgERHAsngQ93UFTpxD2Mm1IYRzkI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.21] x86/boot: Move gdt_l1e caching out of traps_init()
Message-Id: <E1w4nLM-00AwOO-33@xenbits.xenproject.org>
Date: Mon, 23 Mar 2026 22:01:52 +0000

commit f7e0615d83532e0d485d4b0e9e88d8bad335139e
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Feb 13 23:45:28 2026 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 17 12:13:50 2026 +0000

    x86/boot: Move gdt_l1e caching out of traps_init()
    
    Commit 564d261687c0 ("x86/ctxt-switch: Document and improve GDT handling") put
    the initialisation of {,compat_}gdt_l1e into traps_init() but this wasn't a
    great choice.  Instead, put it in smp_prepare_cpus() which performs the BSP
    preparation of variables normally set up by cpu_smpboot_alloc() for APs.
    
    This removes an implicit dependency that prevents traps_init() moving earlier
    than move_xen() in the boot sequence.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    (cherry picked from commit a1e6afbf54283be0ea3db9bf6cb046c683fcf684)
---
 xen/arch/x86/domain.c      |  2 ++
 xen/arch/x86/smpboot.c     | 11 +++++++++++
 xen/arch/x86/traps-setup.c |  7 -------
 3 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index 7d74414ada..bdbf680fe2 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -2053,6 +2053,8 @@ static always_inline bool need_full_gdt(const struct domain *d)
 
 static void update_xen_slot_in_full_gdt(const struct vcpu *v, unsigned int cpu)
 {
+    ASSERT(per_cpu(gdt_l1e, cpu).l1); /* Confirm these have been cached. */
+
     l1e_write(pv_gdt_ptes(v) + FIRST_RESERVED_GDT_PAGE,
               !is_pv_32bit_vcpu(v) ? per_cpu(gdt_l1e, cpu)
                                    : per_cpu(compat_gdt_l1e, cpu));
diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c
index 8d3161248d..7339aeaefd 100644
--- a/xen/arch/x86/smpboot.c
+++ b/xen/arch/x86/smpboot.c
@@ -1167,6 +1167,17 @@ void __init smp_prepare_cpus(void)
     initialize_cpu_data(0); /* Final full version of the data */
     print_cpu_info(0);
 
+    /*
+     * Cache {,compat_}gdt_l1e for the BSP now that physically relocation is
+     * done.  It must be after physical relocation of Xen, and before the
+     * first context_switch().
+     */
+    this_cpu(gdt_l1e) =
+        l1e_from_pfn(virt_to_mfn(boot_gdt), __PAGE_HYPERVISOR_RW);
+    if ( IS_ENABLED(CONFIG_PV32) )
+        this_cpu(compat_gdt_l1e) =
+            l1e_from_pfn(virt_to_mfn(boot_compat_gdt), __PAGE_HYPERVISOR_RW);
+
     boot_cpu_physical_apicid = get_apic_id();
     x86_cpu_to_apicid[0] = boot_cpu_physical_apicid;
 
diff --git a/xen/arch/x86/traps-setup.c b/xen/arch/x86/traps-setup.c
index d77be8f839..c5fc71c75b 100644
--- a/xen/arch/x86/traps-setup.c
+++ b/xen/arch/x86/traps-setup.c
@@ -341,13 +341,6 @@ void __init traps_init(void)
 
     init_ler();
 
-    /* Cache {,compat_}gdt_l1e now that physically relocation is done. */
-    this_cpu(gdt_l1e) =
-        l1e_from_pfn(virt_to_mfn(boot_gdt), __PAGE_HYPERVISOR_RW);
-    if ( IS_ENABLED(CONFIG_PV32) )
-        this_cpu(compat_gdt_l1e) =
-            l1e_from_pfn(virt_to_mfn(boot_compat_gdt), __PAGE_HYPERVISOR_RW);
-
     percpu_traps_init();
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.21


From xen-changelog-bounces@lists.xenproject.org Mon Mar 23 22:02:04 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 23 Mar 2026 22:02:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1259594.1552920 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4nLY-0001GD-Fi; Mon, 23 Mar 2026 22:02:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1259594.1552920; Mon, 23 Mar 2026 22:02:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4nLY-0001G5-D0; Mon, 23 Mar 2026 22:02:04 +0000
Received: by outflank-mailman (input) for mailman id 1259594;
 Mon, 23 Mar 2026 22:02:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w4nLX-0001Fx-57
 for xen-changelog@lists.xenproject.org; Mon, 23 Mar 2026 22:02:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4nLX-005jt0-14
 for xen-changelog@lists.xenproject.org;
 Mon, 23 Mar 2026 22:02:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4nLX-00AwQ3-07
 for xen-changelog@lists.xenproject.org;
 Mon, 23 Mar 2026 22:02:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=4uSxullFeYpIiRBLNuoIi3Laru/lbFkqepb5JsOxsHM=; b=wyqyRzJcnUinLlSawCFsEAgWn9
	e00qg0BbH/OxhvcOfMyXWTTPJSV41c6MU6CSRGrArv7Nr97WpmOuxXKdhVbBdC/a3blRXQPLsTE6E
	Q0uKfPawesd0T6i7FgGYvbi/XypYoe7vOdqOVPOw/RZ/DLhmeVdL/r+X/JtTq659oEVI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.21] x86/boot: Document the ordering dependency of _svm_cpu_up()
Message-Id: <E1w4nLX-00AwQ3-07@xenbits.xenproject.org>
Date: Mon, 23 Mar 2026 22:02:03 +0000

commit 1512e5a19866e850d4e192233b1d6bb4abbf9b9e
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Feb 16 20:57:02 2026 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 17 12:13:50 2026 +0000

    x86/boot: Document the ordering dependency of _svm_cpu_up()
    
    Lets just say this took an unreasonable amount of time and effort to track
    down, when trying to move traps_init() earlier during boot.
    
    When the SYSCALL linkage MSRs are not configured ahead of _svm_cpu_up() on the
    BSP, context switch clobbers the later-set-up linkage with the 0's cached
    here.  Amongst other problems, this causes PV guest to enter at 0 in
    supervisor mode on the user stack.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    (cherry picked from commit c2f15b0fff94ca71fe32792ea933fcf2a907111d)
---
 xen/arch/x86/hvm/svm/svm.c | 14 ++++++++++++++
 xen/arch/x86/setup.c       |  2 +-
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
index b54f9d9af5..f1128a657d 100644
--- a/xen/arch/x86/hvm/svm/svm.c
+++ b/xen/arch/x86/hvm/svm/svm.c
@@ -1579,6 +1579,20 @@ static int _svm_cpu_up(bool bsp)
     /* Initialize OSVW bits to be used by guests */
     svm_host_osvw_init();
 
+    /*
+     * VMSAVE writes out the current full FS, GS, LDTR and TR segments, and
+     * the GS_SHADOW, SYSENTER and SYSCALL linkage MSRs.
+     *
+     * The segment data gets modified by the svm_load_segs() optimisation for
+     * PV context switches, but all values get reloaded at that point, as well
+     * as during context switch from SVM.
+     *
+     * If PV guests are available, it is critical that the SYSCALL linkage
+     * MSRs been configured at this juncture even in FRED mode.
+     */
+    if ( IS_ENABLED(CONFIG_PV) )
+        ASSERT(rdmsr(MSR_STAR) == XEN_MSR_STAR);
+
     svm_vmsave_pa(per_cpu(host_vmcb, cpu));
 
     return 0;
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 44da5efa1d..455eac47d6 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -2078,7 +2078,7 @@ void asmlinkage __init noreturn __start_xen(void)
                                            &this_cpu(stubs).mfn);
     BUG_ON(!this_cpu(stubs.addr));
 
-    traps_init(); /* Needs stubs allocated. */
+    traps_init(); /* Needs stubs allocated, must be before presmp_initcalls. */
 
     cpu_init();
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.21


From xen-changelog-bounces@lists.xenproject.org Mon Mar 23 22:02:14 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 23 Mar 2026 22:02:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1259596.1552924 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4nLi-0001IN-HA; Mon, 23 Mar 2026 22:02:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1259596.1552924; Mon, 23 Mar 2026 22:02:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4nLi-0001IE-ER; Mon, 23 Mar 2026 22:02:14 +0000
Received: by outflank-mailman (input) for mailman id 1259596;
 Mon, 23 Mar 2026 22:02:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w4nLh-0001I6-7f
 for xen-changelog@lists.xenproject.org; Mon, 23 Mar 2026 22:02:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4nLh-005jt9-1M
 for xen-changelog@lists.xenproject.org;
 Mon, 23 Mar 2026 22:02:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4nLh-00AwQm-0a
 for xen-changelog@lists.xenproject.org;
 Mon, 23 Mar 2026 22:02:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=mUhiWPVFZa+VknYkmI/CniT6MDC/va79dNMET3BgL/U=; b=tzzFHRmGUXR7buf4Ax+jagxXgh
	hTMYAZ3a4vLRuHhncD9CctDo9huWTzVFpAJw+pGxnOYnkUDH52+i9RzZ+sXOO0/v0SjXk+QCR/rLv
	kFDGNDQHoSb/N7WeAr6U68aOCvLmL3pYqgBcKLnqeUceCvrOtsNJGHFBmXYzpKKkOIjE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.21] x86/traps: Move traps_init() earlier on boot
Message-Id: <E1w4nLh-00AwQm-0a@xenbits.xenproject.org>
Date: Mon, 23 Mar 2026 22:02:13 +0000

commit f94cc1c429e00e3bd97aadc2b35ec6d1ecb7ced9
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Aug 15 22:56:42 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 17 12:13:50 2026 +0000

    x86/traps: Move traps_init() earlier on boot
    
    We wish to make use of opt_fred earlier on boot, which involves moving
    traps_init() earlier, but this comes with several ordering complications.
    
    The feature word containing FRED needs collecting in early_cpu_init(), and
    legacy_syscall_init() cannot be moved that early because it relies on the
    stubs being allocated, yet must be called ahead of cpu_init() so the SYSCALL
    linkage MSRs are set up before being cached.
    
    Delaying legacy_syscall_init() is easy enough based on a system_state check.
    Reuse bsp_traps_reinit() to cause a call to legacy_syscall_init() to occur at
    the same point as previously.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    (cherry picked from commit 8e4775d118c327782f5bf286e5b353a9de797bef)
---
 xen/arch/x86/cpu/common.c  |  4 +++-
 xen/arch/x86/setup.c       |  4 +++-
 xen/arch/x86/traps-setup.c | 12 +++++++++++-
 3 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c
index 9d225ac8d7..92c709ea69 100644
--- a/xen/arch/x86/cpu/common.c
+++ b/xen/arch/x86/cpu/common.c
@@ -420,7 +420,9 @@ void __init early_cpu_init(bool verbose)
 		}
 
 		if (max_subleaf >= 1)
-			cpuid_count(7, 1, &eax, &ebx, &ecx,
+			cpuid_count(7, 1,
+                                    &c->x86_capability[FEATURESET_7a1],
+                                    &ebx, &ecx,
 				    &c->x86_capability[FEATURESET_7d1]);
 	}
 
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 455eac47d6..c2827fec00 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -1386,6 +1386,8 @@ void asmlinkage __init noreturn __start_xen(void)
     else
         panic("Bootloader provided no memory information\n");
 
+    traps_init();
+
     /* Choose shadow stack early, to set infrastructure up appropriately. */
     if ( !boot_cpu_has(X86_FEATURE_CET_SS) )
         opt_xen_shstk = 0;
@@ -2078,7 +2080,7 @@ void asmlinkage __init noreturn __start_xen(void)
                                            &this_cpu(stubs).mfn);
     BUG_ON(!this_cpu(stubs.addr));
 
-    traps_init(); /* Needs stubs allocated, must be before presmp_initcalls. */
+    bsp_traps_reinit(); /* Needs stubs allocated, must be before presmp_initcalls. */
 
     cpu_init();
 
diff --git a/xen/arch/x86/traps-setup.c b/xen/arch/x86/traps-setup.c
index c5fc71c75b..b2c161943d 100644
--- a/xen/arch/x86/traps-setup.c
+++ b/xen/arch/x86/traps-setup.c
@@ -346,6 +346,10 @@ void __init traps_init(void)
 
 /*
  * Re-initialise all state referencing the early-boot stack.
+ *
+ * This is called twice during boot, first to ensure legacy_syscall_init() has
+ * run (deferred from earlier), and second when the virtual address of the BSP
+ * stack changes.
  */
 void __init bsp_traps_reinit(void)
 {
@@ -359,7 +363,13 @@ void __init bsp_traps_reinit(void)
  */
 void percpu_traps_init(void)
 {
-    legacy_syscall_init();
+    /*
+     * Skip legacy_syscall_init() at early boot.  It requires the stubs being
+     * allocated, limiting the placement of the traps_init() call, and gets
+     * re-done anyway by bsp_traps_reinit().
+     */
+    if ( system_state > SYS_STATE_early_boot )
+        legacy_syscall_init();
 
     if ( cpu_has_xen_lbr )
         wrmsrl(MSR_IA32_DEBUGCTLMSR, IA32_DEBUGCTLMSR_LBR);
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.21


From xen-changelog-bounces@lists.xenproject.org Mon Mar 23 22:02:24 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 23 Mar 2026 22:02:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1259598.1552928 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4nLs-0001KV-IS; Mon, 23 Mar 2026 22:02:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1259598.1552928; Mon, 23 Mar 2026 22:02:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4nLs-0001KN-Fo; Mon, 23 Mar 2026 22:02:24 +0000
Received: by outflank-mailman (input) for mailman id 1259598;
 Mon, 23 Mar 2026 22:02:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w4nLr-0001KH-Ab
 for xen-changelog@lists.xenproject.org; Mon, 23 Mar 2026 22:02:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4nLr-005jtd-1e
 for xen-changelog@lists.xenproject.org;
 Mon, 23 Mar 2026 22:02:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4nLr-00AwSJ-0s
 for xen-changelog@lists.xenproject.org;
 Mon, 23 Mar 2026 22:02:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=mynmv9hZtHES1UbdVsqAHf+5avsqmlHJp6YmAgSDTXk=; b=1nj/VvoqrgPh87fvdOiulnAQMf
	pEk4EC7vz0I4ise7naqqJyADSmgv/UhCanFDZN0Y8M6q9JavWft9/Zd/nadK6XasSb749obYffhWF
	/EzSferuaJfqlW+PxOmXSZA0smOAF/A12UJJkLEwL5lxoGEDLm2m9nz90aQXkigIxS70=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.21] x86/traps: Don't configure Supervisor Shadow Stack tokens in FRED mode
Message-Id: <E1w4nLr-00AwSJ-0s@xenbits.xenproject.org>
Date: Mon, 23 Mar 2026 22:02:23 +0000

commit 08c222e3fa2eecedb5a110aee92b0c532e2918ec
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Aug 15 22:56:42 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 17 12:13:50 2026 +0000

    x86/traps: Don't configure Supervisor Shadow Stack tokens in FRED mode
    
    FRED doesn't use Supervisor Shadow Stack tokens.  This means that:
    
     1) memguard_guard_stack() should not write Supervisor Shadow Stack Tokens.
     2) cpu_has_bug_shstk_fracture is no longer relevant when deciding whether to
        enable Shadow Stacks or not.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    (cherry picked from commit 7634f5662551864a4976d5f0022263a056efd14d)
---
 xen/arch/x86/mm.c    | 14 +++++++++++---
 xen/arch/x86/setup.c | 16 ++++++++++------
 2 files changed, 21 insertions(+), 9 deletions(-)

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index b929d15d00..2b23bf2e7a 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -129,6 +129,7 @@
 #include <asm/shadow.h>
 #include <asm/shared.h>
 #include <asm/trampoline.h>
+#include <asm/traps.h>
 #include <asm/x86_emulate.h>
 
 #include <public/memory.h>
@@ -6441,8 +6442,15 @@ static void write_sss_token(unsigned long *ptr)
 
 void memguard_guard_stack(void *p)
 {
-    /* IST Shadow stacks.  4x 1k in stack page 0. */
-    if ( IS_ENABLED(CONFIG_XEN_SHSTK) )
+    ASSERT(opt_fred >= 0); /* Confirm that FRED-ness has been resolved */
+
+    /*
+     * IST Shadow stacks.  4x 1k in stack page 0.
+     *
+     * With IDT delivery, we need Supervisor Shadow Stack tokens at the base
+     * of each stack.  With FRED delivery, these no longer exist.
+     */
+    if ( IS_ENABLED(CONFIG_XEN_SHSTK) && !opt_fred )
     {
         write_sss_token(p + (IST_MCE * IST_SHSTK_SIZE) - 8);
         write_sss_token(p + (IST_NMI * IST_SHSTK_SIZE) - 8);
@@ -6453,7 +6461,7 @@ void memguard_guard_stack(void *p)
 
     /* Primary Shadow Stack.  1x 4k in stack page 5. */
     p += PRIMARY_SHSTK_SLOT * PAGE_SIZE;
-    if ( IS_ENABLED(CONFIG_XEN_SHSTK) )
+    if ( IS_ENABLED(CONFIG_XEN_SHSTK) && !opt_fred )
         write_sss_token(p + PAGE_SIZE - 8);
 
     map_pages_to_xen((unsigned long)p, virt_to_mfn(p), 1, PAGE_HYPERVISOR_SHSTK);
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index c2827fec00..14c28ba8e7 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -1412,15 +1412,19 @@ void asmlinkage __init noreturn __start_xen(void)
             boot_cpu_data.x86_vendor == X86_VENDOR_INTEL &&
             !boot_cpu_has(X86_FEATURE_CET_SSS);
 
+        ASSERT(opt_fred >= 0); /* Confirm that FRED-ness has been resolved */
+
         /*
-         * On bare metal, assume that Xen won't be impacted by shstk
-         * fracturing problems.  Under virt, be more conservative and disable
-         * shstk by default.
+         * If FRED is in use, Supervisor Shadow Stack tokens are not used and
+         * shstk fracturing is of no consequence.  Otherwise:
+         * - On bare metal, assume that Xen won't be impacted by shstk
+         *   fracturing problems.
+         * - Under virt, be more conservative and disable shstk by default.
          */
         if ( opt_xen_shstk == -1 )
             opt_xen_shstk =
-                cpu_has_hypervisor ? !cpu_has_bug_shstk_fracture
-                                   : true;
+                opt_fred || (cpu_has_hypervisor ? !cpu_has_bug_shstk_fracture
+                                                : true);
 
         if ( opt_xen_shstk )
         {
@@ -1925,7 +1929,7 @@ void asmlinkage __init noreturn __start_xen(void)
 
     system_state = SYS_STATE_boot;
 
-    bsp_stack = cpu_alloc_stack(0);
+    bsp_stack = cpu_alloc_stack(0); /* Needs to know IDT vs FRED */
     if ( !bsp_stack )
         panic("No memory for BSP stack\n");
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.21


From xen-changelog-bounces@lists.xenproject.org Mon Mar 23 22:02:34 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 23 Mar 2026 22:02:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1259600.1552932 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4nM2-0001N1-M9; Mon, 23 Mar 2026 22:02:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1259600.1552932; Mon, 23 Mar 2026 22:02:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4nM2-0001Mt-JA; Mon, 23 Mar 2026 22:02:34 +0000
Received: by outflank-mailman (input) for mailman id 1259600;
 Mon, 23 Mar 2026 22:02:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w4nM1-0001Mn-DF
 for xen-changelog@lists.xenproject.org; Mon, 23 Mar 2026 22:02:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4nM1-005jth-1u
 for xen-changelog@lists.xenproject.org;
 Mon, 23 Mar 2026 22:02:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4nM1-00AwTO-19
 for xen-changelog@lists.xenproject.org;
 Mon, 23 Mar 2026 22:02:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=HNqrihANrUmatKnhU+vNrrTvDUFXdr6TMLLkwdqueQM=; b=XbsVZxK5aLC0uBEFYcRnpHKiPi
	WNYyF0IlN7YHtUlHkyO7YnAqjh5HrHRt4KpkYzOJKRvHt7i85xdghbqv+LAa1kq7pV/Y+T40hCj0J
	uNl2fRTUU7GOieOyeyvRvkRrUlhiRm9x04rXi8LTlCejEyb1YUvObmie8Wk9dNwckxwI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.21] x86/traps: Introduce FRED entrypoints
Message-Id: <E1w4nM1-00AwTO-19@xenbits.xenproject.org>
Date: Mon, 23 Mar 2026 22:02:33 +0000

commit 04048e2a006fb87a4e4df4cc24b01fadceb73288
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Dec 24 11:03:06 2024 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 17 12:13:50 2026 +0000

    x86/traps: Introduce FRED entrypoints
    
    Under FRED, there's one entrypoint from Ring 3, and one from Ring 0.
    
    FRED gives us a good stack (even for SYSCALL/SYSENTER), and a unified event
    frame on the stack with all flags cleared, meaning that all software needs to
    do is spill the GPRs with a line of PUSHes.  Introduce PUSH_AND_CLEAR_GPRS for
    this purpose, along with the matching POP_GPRS.
    
    Introduce entry_FRED_R0() which to a first approximation is complete for all
    event handling within Xen.
    
    entry_FRED_R0() needs deriving from entry_FRED_R3(), so introduce a basic
    Ring3 handler.  There is more work required to make the return-to-guest path
    work under FRED.
    
    Also introduce entry_from_{xen,pv}() to be the C level handlers.  By simply
    copying regs->fred_ss.vector into regs->entry_vector, we can reuse all the
    existing fault handlers.
    
    Extend fatal_trap() to render the event type including name, when FRED is
    active.  This is slightly complicated, because X86_ET_OTHER must not use
    vector_name() or SYSCALL and SYSENTER get rendered as #BP and #DB.
    
    This is sufficient to handle all interrupts and exceptions encountered during
    development, including plenty of Double Faults.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    (cherry picked from commit 0e9cc04453fc2d7234ad3ced51b520c597c7bfbf)
---
 xen/arch/x86/include/asm/asm_defns.h |  63 ++++++++++++++
 xen/arch/x86/traps.c                 | 155 +++++++++++++++++++++++++++++++++++
 xen/arch/x86/x86_64/Makefile         |   1 +
 xen/arch/x86/x86_64/entry-fred.S     |  33 ++++++++
 4 files changed, 252 insertions(+)

diff --git a/xen/arch/x86/include/asm/asm_defns.h b/xen/arch/x86/include/asm/asm_defns.h
index 72a0082d31..82ad691500 100644
--- a/xen/arch/x86/include/asm/asm_defns.h
+++ b/xen/arch/x86/include/asm/asm_defns.h
@@ -315,6 +315,69 @@ static always_inline void stac(void)
         subq  $-(UREGS_error_code-UREGS_r15+\adj), %rsp
 .endm
 
+/*
+ * Push and clear GPRs
+ */
+.macro PUSH_AND_CLEAR_GPRS
+        push  %rdi
+        xor   %edi, %edi
+        push  %rsi
+        xor   %esi, %esi
+        push  %rdx
+        xor   %edx, %edx
+        push  %rcx
+        xor   %ecx, %ecx
+        push  %rax
+        xor   %eax, %eax
+        push  %r8
+        xor   %r8d, %r8d
+        push  %r9
+        xor   %r9d, %r9d
+        push  %r10
+        xor   %r10d, %r10d
+        push  %r11
+        xor   %r11d, %r11d
+        push  %rbx
+        xor   %ebx, %ebx
+        push  %rbp
+#ifdef CONFIG_FRAME_POINTER
+/* Indicate special exception stack frame by inverting the frame pointer. */
+        mov   %rsp, %rbp
+        not   %rbp
+#else
+        xor   %ebp, %ebp
+#endif
+        push  %r12
+        xor   %r12d, %r12d
+        push  %r13
+        xor   %r13d, %r13d
+        push  %r14
+        xor   %r14d, %r14d
+        push  %r15
+        xor   %r15d, %r15d
+.endm
+
+/*
+ * POP GPRs from a UREGS_* frame on the stack.  Does not modify flags.
+ */
+.macro POP_GPRS
+        pop   %r15
+        pop   %r14
+        pop   %r13
+        pop   %r12
+        pop   %rbp
+        pop   %rbx
+        pop   %r11
+        pop   %r10
+        pop   %r9
+        pop   %r8
+        pop   %rax
+        pop   %rcx
+        pop   %rdx
+        pop   %rsi
+        pop   %rdi
+.endm
+
 #ifdef CONFIG_PV32
 #define CR4_PV32_RESTORE                               \
     ALTERNATIVE_2 "",                                  \
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index 702a110131..178169dc5f 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -89,6 +89,13 @@ const unsigned int nmi_cpu;
 #define stack_words_per_line 4
 #define ESP_BEFORE_EXCEPTION(regs) ((unsigned long *)(regs)->rsp)
 
+/* Only valid to use when FRED is active. */
+static inline struct fred_info *cpu_regs_fred_info(struct cpu_user_regs *regs)
+{
+    ASSERT(read_cr4() & X86_CR4_FRED);
+    return &container_of(regs, struct cpu_info, guest_cpu_user_regs)->_fred;
+}
+
 struct extra_state
 {
     unsigned long cr0, cr2, cr3, cr4;
@@ -1029,6 +1036,32 @@ void show_execution_state_nmi(const cpumask_t *mask, bool show_all)
         printk("Non-responding CPUs: {%*pbl}\n", CPUMASK_PR(&show_state_mask));
 }
 
+static const char *x86_et_name(unsigned int type)
+{
+    static const char *const names[] = {
+        [X86_ET_EXT_INTR]    = "EXT_INTR",
+        [X86_ET_NMI]         = "NMI",
+        [X86_ET_HW_EXC]      = "HW_EXC",
+        [X86_ET_SW_INT]      = "SW_INT",
+        [X86_ET_PRIV_SW_EXC] = "PRIV_SW_EXC",
+        [X86_ET_SW_EXC]      = "SW_EXC",
+        [X86_ET_OTHER]       = "OTHER",
+    };
+
+    return (type < ARRAY_SIZE(names) && names[type]) ? names[type] : "???";
+}
+
+static const char *x86_et_other_name(unsigned int what)
+{
+    static const char *const names[] = {
+        [0] = "MTF",
+        [1] = "SYSCALL",
+        [2] = "SYSENTER",
+    };
+
+    return (what < ARRAY_SIZE(names) && names[what]) ? names[what] : "???";
+}
+
 const char *vector_name(unsigned int vec)
 {
     static const char names[][4] = {
@@ -1107,6 +1140,38 @@ void fatal_trap(const struct cpu_user_regs *regs, bool show_remote)
         }
     }
 
+    if ( read_cr4() & X86_CR4_FRED )
+    {
+        bool render_ec = false;
+        const char *vec_name = NULL;
+
+        switch ( regs->fred_ss.type )
+        {
+        case X86_ET_HW_EXC:
+        case X86_ET_PRIV_SW_EXC:
+        case X86_ET_SW_EXC:
+            render_ec = true;
+            vec_name = vector_name(regs->fred_ss.vector);
+            break;
+
+        case X86_ET_OTHER:
+            vec_name = x86_et_other_name(regs->fred_ss.vector);
+            break;
+        }
+
+        if ( render_ec )
+            panic("FATAL TRAP: type %u, %s, vec %u, %s[%04x]%s\n",
+                  regs->fred_ss.type, x86_et_name(regs->fred_ss.type),
+                  regs->fred_ss.vector, vec_name ?: "",
+                  regs->error_code,
+                  (regs->eflags & X86_EFLAGS_IF) ? "" : " IN INTERRUPT CONTEXT");
+        else
+            panic("FATAL TRAP: type %u, %s, vec %u, %s%s\n",
+                  regs->fred_ss.type, x86_et_name(regs->fred_ss.type),
+                  regs->fred_ss.vector, vec_name ?: "",
+                  (regs->eflags & X86_EFLAGS_IF) ? "" : " IN INTERRUPT CONTEXT");
+    }
+
     panic("FATAL TRAP: vec %u, %s[%04x]%s\n",
           trapnr, vector_name(trapnr), regs->error_code,
           (regs->eflags & X86_EFLAGS_IF) ? "" : " IN INTERRUPT CONTEXT");
@@ -2204,6 +2269,96 @@ void asmlinkage check_ist_exit(const struct cpu_user_regs *regs, bool ist_exit)
 }
 #endif
 
+void asmlinkage entry_from_pv(struct cpu_user_regs *regs)
+{
+    /* Copy fred_ss.vector into entry_vector as IDT delivery would have done. */
+    regs->entry_vector = regs->fred_ss.vector;
+
+    fatal_trap(regs, false);
+}
+
+void asmlinkage entry_from_xen(struct cpu_user_regs *regs)
+{
+    struct fred_info *fi = cpu_regs_fred_info(regs);
+    uint8_t type = regs->fred_ss.type;
+
+    /* Copy fred_ss.vector into entry_vector as IDT delivery would have done. */
+    regs->entry_vector = regs->fred_ss.vector;
+
+    /*
+     * First, handle the asynchronous or fatal events.  These are either
+     * unrelated to the interrupted context, or may not have valid context
+     * recorded, and all have special rules on how/whether to re-enable IRQs.
+     */
+    if ( regs->fred_ss.nested )
+        goto fatal;
+
+    switch ( type )
+    {
+    case X86_ET_EXT_INTR:
+        return do_IRQ(regs);
+
+    case X86_ET_NMI:
+        return do_nmi(regs);
+
+    case X86_ET_HW_EXC:
+        switch ( regs->fred_ss.vector )
+        {
+        case X86_EXC_DF: return do_double_fault(regs);
+        case X86_EXC_MC: return do_machine_check(regs);
+        }
+        break;
+    }
+
+    /*
+     * With the asynchronous events handled, what remains are the synchronous
+     * ones.  If we interrupted an IRQs-on region, we should re-enable IRQs
+     * now; for #PF and #DB, %cr2 and PENDING_DBG are on the stack in edata.
+     */
+    if ( regs->eflags & X86_EFLAGS_IF )
+        local_irq_enable();
+
+    switch ( type )
+    {
+    case X86_ET_HW_EXC:
+    case X86_ET_PRIV_SW_EXC:
+    case X86_ET_SW_EXC:
+        switch ( regs->fred_ss.vector )
+        {
+        case X86_EXC_PF:  handle_PF(regs, fi->edata); break;
+        case X86_EXC_GP:  do_general_protection(regs); break;
+        case X86_EXC_UD:  do_invalid_op(regs); break;
+        case X86_EXC_NM:  do_device_not_available(regs); break;
+        case X86_EXC_BP:  do_int3(regs); break;
+        case X86_EXC_DB:  handle_DB(regs, fi->edata); break;
+        case X86_EXC_CP:  do_entry_CP(regs); break;
+
+        case X86_EXC_DE:
+        case X86_EXC_OF:
+        case X86_EXC_BR:
+        case X86_EXC_NP:
+        case X86_EXC_SS:
+        case X86_EXC_MF:
+        case X86_EXC_AC:
+        case X86_EXC_XM:
+            do_trap(regs);
+            break;
+
+        default:
+            goto fatal;
+        }
+        break;
+
+    default:
+        goto fatal;
+    }
+
+    return;
+
+ fatal:
+    fatal_trap(regs, false);
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/xen/arch/x86/x86_64/Makefile b/xen/arch/x86/x86_64/Makefile
index f207630887..c0a0b66032 100644
--- a/xen/arch/x86/x86_64/Makefile
+++ b/xen/arch/x86/x86_64/Makefile
@@ -1,5 +1,6 @@
 obj-$(CONFIG_PV32) += compat/
 
+obj-bin-y += entry-fred.o
 obj-bin-y += entry.o
 obj-$(CONFIG_KEXEC) += machine_kexec.o
 obj-y += pci.o
diff --git a/xen/arch/x86/x86_64/entry-fred.S b/xen/arch/x86/x86_64/entry-fred.S
new file mode 100644
index 0000000000..3c3320df22
--- /dev/null
+++ b/xen/arch/x86/x86_64/entry-fred.S
@@ -0,0 +1,33 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+        .file "x86_64/entry-fred.S"
+
+#include <asm/asm_defns.h>
+#include <asm/page.h>
+
+        .section .text.entry, "ax", @progbits
+
+        /* The Ring3 entry point is required to be 4k aligned. */
+
+FUNC(entry_FRED_R3, 4096)
+        PUSH_AND_CLEAR_GPRS
+
+        mov     %rsp, %rdi
+        call    entry_from_pv
+
+        POP_GPRS
+        eretu
+END(entry_FRED_R3)
+
+        /* The Ring0 entrypoint is at Ring3 + 0x100. */
+        .org entry_FRED_R3 + 0x100, 0xcc
+
+FUNC_LOCAL(entry_FRED_R0, 0)
+        PUSH_AND_CLEAR_GPRS
+
+        mov     %rsp, %rdi
+        call    entry_from_xen
+
+        POP_GPRS
+        erets
+END(entry_FRED_R0)
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.21


From xen-changelog-bounces@lists.xenproject.org Mon Mar 23 22:02:44 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 23 Mar 2026 22:02:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1259602.1552936 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4nMC-0001PL-NF; Mon, 23 Mar 2026 22:02:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1259602.1552936; Mon, 23 Mar 2026 22:02:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4nMC-0001PD-Kd; Mon, 23 Mar 2026 22:02:44 +0000
Received: by outflank-mailman (input) for mailman id 1259602;
 Mon, 23 Mar 2026 22:02:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w4nMB-0001P3-Fs
 for xen-changelog@lists.xenproject.org; Mon, 23 Mar 2026 22:02:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4nMB-005jto-2B
 for xen-changelog@lists.xenproject.org;
 Mon, 23 Mar 2026 22:02:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4nMB-00AwUZ-1P
 for xen-changelog@lists.xenproject.org;
 Mon, 23 Mar 2026 22:02:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=DoHJR7JRnCH8vjZstzlBByDRxX0zGbP9Ql1/LKyu+ic=; b=qrW0zBmXkxgNInfScrpNAvsclH
	wdBVZ3w0rizSYUldfzcCpDiunN8213L0zJkiOc6uFJ0/bPyPOS4HdM4l1sm+XcC4Fb6vaXLRvbggx
	ihxXCL9GHFypvl1oAJjujjMloH5evClttRw7li9GsMdc0QmnsP5aKvBmI2pO7+jMz0oY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.21] x86/traps: Enable FRED when requested
Message-Id: <E1w4nMB-00AwUZ-1P@xenbits.xenproject.org>
Date: Mon, 23 Mar 2026 22:02:43 +0000

commit d151802841a478ae87c84868144d8252f57d944f
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Dec 24 11:03:06 2024 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 17 12:13:50 2026 +0000

    x86/traps: Enable FRED when requested
    
    With the shadow stack and exception handling adjustements in place, we can now
    activate FRED when appropriate.  Note that opt_fred is still disabled by
    default until more development is complete.
    
    Introduce init_fred() to set up all the MSRs relevant for FRED.  FRED uses
    MSR_STAR (entries from Ring3 only), and MSR_FRED_SSP_SL0 aliases MSR_PL0_SSP
    when CET-SS is active.  Otherwise, they're all new MSRs.
    
    Also introduce init_fred_tss().  At this juncture we need a TSS set up, even
    if it is mostly unused.  Reinsert the BUILD_BUG_ON() checking the size of the
    TSS against 0x67, this time with a more precise comment.
    
    With init_fred() existing, load_system_tables() and legacy_syscall_init()
    should only be used when setting up IDT delivery.  Insert ASSERT()s to this
    effect, and adjust the various init functions to make this property true.
    
    The FRED initialisation path still needs to write to all system table
    registers at least once, even if only to invalidate them.  Per the
    documentation, percpu_early_traps_init() is responsible for switching off the
    boot GDT, which also needs doing even in FRED mode.
    
    Finally, set CR4.FRED in traps_init()/percpu_early_traps_init().
    
    Xen can now boot in FRED mode and run a PVH dom0.  PV guests still need more
    work before they can be run under FRED.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    (cherry picked from commit bbfb30f649fc11281b091b91fd353954df1354a0)
---
 xen/arch/x86/include/asm/current.h |   3 +
 xen/arch/x86/include/asm/traps.h   |   2 +
 xen/arch/x86/traps-setup.c         | 130 +++++++++++++++++++++++++++++++++++--
 3 files changed, 130 insertions(+), 5 deletions(-)

diff --git a/xen/arch/x86/include/asm/current.h b/xen/arch/x86/include/asm/current.h
index 62817e8476..6139980ab1 100644
--- a/xen/arch/x86/include/asm/current.h
+++ b/xen/arch/x86/include/asm/current.h
@@ -23,6 +23,9 @@
  * 2 - NMI IST stack
  * 1 - #MC IST stack
  * 0 - IST Shadow Stacks (4x 1k, read-only)
+ *
+ * In FRED mode, #DB and NMI do not need special stacks, so their IST stacks
+ * are unused.
  */
 
 /*
diff --git a/xen/arch/x86/include/asm/traps.h b/xen/arch/x86/include/asm/traps.h
index 73097e957d..5d7504bc44 100644
--- a/xen/arch/x86/include/asm/traps.h
+++ b/xen/arch/x86/include/asm/traps.h
@@ -16,6 +16,8 @@ void traps_init(void);
 void bsp_traps_reinit(void);
 void percpu_traps_init(void);
 
+void nocall entry_FRED_R3(void);
+
 extern unsigned int ler_msr;
 
 const char *vector_name(unsigned int vec);
diff --git a/xen/arch/x86/traps-setup.c b/xen/arch/x86/traps-setup.c
index b2c161943d..9b8301c23e 100644
--- a/xen/arch/x86/traps-setup.c
+++ b/xen/arch/x86/traps-setup.c
@@ -59,6 +59,8 @@ static void load_system_tables(void)
         .limit = sizeof(bsp_idt) - 1,
     };
 
+    ASSERT(opt_fred == 0);
+
     /*
      * Set up the TSS.  Warning - may be live, and the NMI/#MC must remain
      * valid on every instruction boundary.  (Note: these are all
@@ -191,6 +193,8 @@ static void legacy_syscall_init(void)
     unsigned char *stub_page;
     unsigned int offset;
 
+    ASSERT(opt_fred == 0);
+
     /* No PV guests?  No need to set up SYSCALL/SYSENTER infrastructure. */
     if ( !IS_ENABLED(CONFIG_PV) )
         return;
@@ -268,6 +272,76 @@ static void __init init_ler(void)
     setup_force_cpu_cap(X86_FEATURE_XEN_LBR);
 }
 
+/*
+ * Set up all MSRs relevant for FRED event delivery.
+ *
+ * Xen does not use any of the optional config in MSR_FRED_CONFIG, so all that
+ * is needed is the entrypoint.
+ *
+ * Because FRED always provides a good stack, NMI and #DB do not need any
+ * special treatment.  Only #DF needs another stack level, and #MC for the
+ * off-chance that Xen's main stack suffers an uncorrectable error.
+ *
+ * This makes Stack Level 1 unused, but we use #DB's stacks, and with the
+ * regular and shadow stack pointers reversed as poison to guarantee that any
+ * use escalates to #DF.
+ *
+ * FRED reuses MSR_STAR to provide the segment selector values to load on
+ * entry from Ring3.  Entry from Ring0 leave %cs and %ss unmodified.
+ */
+static void init_fred(void)
+{
+    unsigned long stack_top = get_stack_bottom() & ~(STACK_SIZE - 1);
+
+    ASSERT(opt_fred == 1);
+
+    wrmsrns(MSR_STAR, XEN_MSR_STAR);
+    wrmsrns(MSR_FRED_CONFIG, (unsigned long)entry_FRED_R3);
+
+    /*
+     * MSR_FRED_RSP_* all come with an 64-byte alignment check, avoiding the
+     * need for an explicit BUG_ON().
+     */
+    wrmsrns(MSR_FRED_RSP_SL0, (unsigned long)(&get_cpu_info()->_fred + 1));
+    wrmsrns(MSR_FRED_RSP_SL1, stack_top + (IST_DB * IST_SHSTK_SIZE)); /* Poison */
+    wrmsrns(MSR_FRED_RSP_SL2, stack_top + (1 + IST_MCE)  * PAGE_SIZE);
+    wrmsrns(MSR_FRED_RSP_SL3, stack_top + (1 + IST_DF)   * PAGE_SIZE);
+    wrmsrns(MSR_FRED_STK_LVLS, ((2UL << (X86_EXC_MC * 2)) |
+                                (3UL << (X86_EXC_DF * 2))));
+
+    if ( cpu_has_xen_shstk )
+    {
+        wrmsrns(MSR_FRED_SSP_SL0, stack_top + (PRIMARY_SHSTK_SLOT + 1) * PAGE_SIZE);
+        wrmsrns(MSR_FRED_SSP_SL1, stack_top + (1 + IST_DB) * PAGE_SIZE); /* Poison */
+        wrmsrns(MSR_FRED_SSP_SL2, stack_top + (IST_MCE * IST_SHSTK_SIZE));
+        wrmsrns(MSR_FRED_SSP_SL3, stack_top + (IST_DF  * IST_SHSTK_SIZE));
+    }
+}
+
+/*
+ * Set up a minimal TSS and selector for use in FRED mode.
+ *
+ * With FRED moving the stack pointers into MSRs, we would like to avoid
+ * having a TSS at all, but:
+ *  - VT-x VMExit unconditionally sets TR.limit to 0x67, meaning that
+ *    HOST_TR_BASE needs to point to a good TSS.
+ *  - show_stack_overflow() cross-checks tss->rsp0.
+ *
+ * Fill in rsp0 and the bitmap offset, and load a zero-length TR.  If VT-x
+ * does get used, it will clobber TR to refer to this_cpu(tss_page).tss.
+ */
+static void init_fred_tss(void)
+{
+    seg_desc_t *gdt = this_cpu(gdt) - FIRST_RESERVED_GDT_ENTRY;
+    struct tss64 *tss = &this_cpu(tss_page).tss;
+
+    tss->rsp0 = get_stack_bottom();
+    tss->bitmap = IOBMP_INVALID_OFFSET;
+
+    _set_tssldt_desc(gdt + TSS_ENTRY, 0, 0, SYS_DESC_tss_avail);
+    ltr(TSS_SELECTOR);
+}
+
 /*
  * Configure basic exception handling.  This is prior to parsing the command
  * line or configuring a console, and needs to be as simple as possible.
@@ -322,6 +396,8 @@ void __init traps_init(void)
 
     if ( opt_fred )
     {
+        const struct desc_ptr idtr = {};
+
 #ifdef CONFIG_PV32
         if ( opt_pv32 )
         {
@@ -329,16 +405,27 @@ void __init traps_init(void)
             printk(XENLOG_INFO "Disabling PV32 due to FRED\n");
         }
 #endif
+
+        init_fred();
+        set_in_cr4(X86_CR4_FRED);
+
+        /*
+         * Invalidate the IDT as it's not used.  Set up a minimal TSS.  The
+         * LDT was configured by bsp_early_traps_init().
+         */
+        lidt(&idtr);
+        init_fred_tss();
+
         setup_force_cpu_cap(X86_FEATURE_XEN_FRED);
         printk("Using FRED event delivery\n");
     }
     else
     {
+        load_system_tables();
+
         printk("Using IDT event delivery\n");
     }
 
-    load_system_tables();
-
     init_ler();
 
     percpu_traps_init();
@@ -353,7 +440,11 @@ void __init traps_init(void)
  */
 void __init bsp_traps_reinit(void)
 {
-    load_system_tables();
+    if ( opt_fred )
+        init_fred();
+    else
+        load_system_tables();
+
     percpu_traps_init();
 }
 
@@ -368,7 +459,7 @@ void percpu_traps_init(void)
      * allocated, limiting the placement of the traps_init() call, and gets
      * re-done anyway by bsp_traps_reinit().
      */
-    if ( system_state > SYS_STATE_early_boot )
+    if ( !opt_fred && system_state > SYS_STATE_early_boot )
         legacy_syscall_init();
 
     if ( cpu_has_xen_lbr )
@@ -384,7 +475,29 @@ void percpu_traps_init(void)
  */
 void asmlinkage percpu_early_traps_init(void)
 {
-    load_system_tables();
+    if ( opt_fred )
+    {
+        seg_desc_t *gdt = this_cpu(gdt) - FIRST_RESERVED_GDT_ENTRY;
+        const struct desc_ptr gdtr = {
+            .base = (unsigned long)gdt,
+            .limit = LAST_RESERVED_GDT_BYTE,
+        }, idtr = {};
+
+        lgdt(&gdtr);
+
+        init_fred();
+        write_cr4(read_cr4() | X86_CR4_FRED);
+
+        /*
+         * Invalidate the IDT (not used) and LDT (not set up yet).  Set up a
+         * minimal TSS.
+         */
+        lidt(&idtr);
+        init_fred_tss();
+        lldt(0);
+    }
+    else
+        load_system_tables();
 }
 
 static void __init __maybe_unused build_assertions(void)
@@ -403,4 +516,11 @@ static void __init __maybe_unused build_assertions(void)
                   endof_field(struct cpu_info, guest_cpu_user_regs)) & 15);
     BUILD_BUG_ON((sizeof(struct cpu_info) -
                   endof_field(struct cpu_info, _fred)) & 63);
+
+    /*
+     * The x86 architecture is happy with TR.limit being less than 0x67, but
+     * VT-x is not.  VMExit unconditionally sets the limit to 0x67, meaning
+     * that HOST_TR_BASE needs to refer to a good TSS of at least this size.
+     */
+    BUILD_BUG_ON(sizeof(struct tss64) <= 0x67);
 }
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.21


From xen-changelog-bounces@lists.xenproject.org Mon Mar 23 22:02:54 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 23 Mar 2026 22:02:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1259604.1552942 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4nMM-0001Rk-Q3; Mon, 23 Mar 2026 22:02:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1259604.1552942; Mon, 23 Mar 2026 22:02:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4nMM-0001Rc-M7; Mon, 23 Mar 2026 22:02:54 +0000
Received: by outflank-mailman (input) for mailman id 1259604;
 Mon, 23 Mar 2026 22:02:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w4nML-0001RS-Im
 for xen-changelog@lists.xenproject.org; Mon, 23 Mar 2026 22:02:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4nML-005jtx-2S
 for xen-changelog@lists.xenproject.org;
 Mon, 23 Mar 2026 22:02:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4nML-00AwVc-1g
 for xen-changelog@lists.xenproject.org;
 Mon, 23 Mar 2026 22:02:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=7lxewuh2QcwVTJDtgCn9Bxe4E72/mXWqWwd0eeSPHOQ=; b=eSy9WNX20WtFsyWGsiqRy8TPh9
	gzw+pT3K+5MhNprrEQd/9Rox9OiTHSxJzG1KaSbElAfytwlaIaFEEEU1gWH7P7GqByEaLN40mvoxz
	oghtXaEcPwsFOLGhzLjVCD23Dopewmr3P7wkhYnRBqDO7p3EmFsNgGK+go+NLG4Qh6ow=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.21] x86/pv: Adjust GS handling for FRED mode
Message-Id: <E1w4nML-00AwVc-1g@xenbits.xenproject.org>
Date: Mon, 23 Mar 2026 22:02:53 +0000

commit d1d8143d8c8bd80fe21d8bc9e0455bfd0cc4e651
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Aug 11 23:46:01 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 17 12:13:50 2026 +0000

    x86/pv: Adjust GS handling for FRED mode
    
    When FRED is active, hardware automatically swaps GS when changing privilege,
    and the SWAPGS instruction is disallowed.
    
    For native OSes using GS as the thread local pointer this is a massive
    improvement on the pre-FRED architecture, but under Xen it makes handling PV
    guests more complicated.  Specifically, it means that GS_BASE and GS_SHADOW
    are the opposite way around in FRED mode, as opposed to IDT mode.
    
    This leads to the following changes:
    
      * In load_segments(), we already load both GSes.  Account for FRED in the
        SWAP() condition and avoid the path with SWAGS.
    
      * In save_segments(), we need to read GS_SHADOW rather than GS_BASE.
    
      * In toggle_guest_mode(), we need to emulate SWAPGS.
    
      * In {read,write}_msr() which access the live registers, GS_SHADOW and
        GS_BASE need swapping.
    
      * In do_set_segment_base(), merge the SEGBASE_GS_{USER,KERNEL} cases and
        take FRED into account when choosing which base to update.
    
        SEGBASE_GS_USER_SEL was already an LKGS invocation (decades before FRED)
        so under FRED needs to be just a MOV %gs.  Simply skip the SWAPGSes.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    (cherry picked from commit 9ea7d7f9393c52de36ee9c42b52c235949453a2a)
---
 xen/arch/x86/domain.c             | 16 +++++++++++-----
 xen/arch/x86/pv/domain.c          | 22 ++++++++++++++++++++--
 xen/arch/x86/pv/emul-priv-op.c    | 26 +++++++++++++++++---------
 xen/arch/x86/pv/misc-hypercalls.c | 23 +++++++++++++++--------
 4 files changed, 63 insertions(+), 24 deletions(-)

diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index bdbf680fe2..ff990bab49 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -1815,9 +1815,10 @@ static void load_segments(struct vcpu *n)
 
         /*
          * Figure out which way around gsb/gss want to be.  gsb needs to be
-         * the active context, and gss needs to be the inactive context.
+         * the active context, and gss needs to be the inactive context,
+         * unless we're in FRED mode where they're reversed.
          */
-        if ( !(n->arch.flags & TF_kernel_mode) )
+        if ( !(n->arch.flags & TF_kernel_mode) ^ opt_fred )
             SWAP(gsb, gss);
 
         if ( using_svm() && (n->arch.pv.fs | n->arch.pv.gs) <= 3 )
@@ -1838,7 +1839,9 @@ static void load_segments(struct vcpu *n)
 
     if ( !fs_gs_done && !compat )
     {
-        if ( read_cr4() & X86_CR4_FSGSBASE )
+        unsigned long cr4 = read_cr4();
+
+        if ( !(cr4 & X86_CR4_FRED) && (cr4 & X86_CR4_FSGSBASE) )
         {
             __wrgsbase(gss);
             __wrfsbase(n->arch.pv.fs_base);
@@ -1955,6 +1958,9 @@ static void load_segments(struct vcpu *n)
  * Guests however cannot use SWAPGS, so there is no mechanism to modify the
  * inactive GS base behind Xen's back.  Therefore, Xen's copy of the inactive
  * GS base is still accurate, and doesn't need reading back from hardware.
+ *
+ * Under FRED, hardware automatically swaps GS for us, so SHADOW_GS is the
+ * active GS from the guest's point of view.
  */
 static void save_segments(struct vcpu *v)
 {
@@ -1970,12 +1976,12 @@ static void save_segments(struct vcpu *v)
         if ( read_cr4() & X86_CR4_FSGSBASE )
         {
             fs_base = __rdfsbase();
-            gs_base = __rdgsbase();
+            gs_base = opt_fred ? rdmsr(MSR_SHADOW_GS_BASE) : __rdgsbase();
         }
         else
         {
             fs_base = rdmsr(MSR_FS_BASE);
-            gs_base = rdmsr(MSR_GS_BASE);
+            gs_base = opt_fred ? rdmsr(MSR_SHADOW_GS_BASE) : rdmsr(MSR_GS_BASE);
         }
 
         v->arch.pv.fs_base = fs_base;
diff --git a/xen/arch/x86/pv/domain.c b/xen/arch/x86/pv/domain.c
index a97831efe9..ef4f442e73 100644
--- a/xen/arch/x86/pv/domain.c
+++ b/xen/arch/x86/pv/domain.c
@@ -14,9 +14,10 @@
 #include <asm/cpufeature.h>
 #include <asm/fsgsbase.h>
 #include <asm/invpcid.h>
-#include <asm/spec_ctrl.h>
 #include <asm/pv/domain.h>
 #include <asm/shadow.h>
+#include <asm/spec_ctrl.h>
+#include <asm/traps.h>
 
 #ifdef CONFIG_PV32
 int8_t __read_mostly opt_pv32 = -1;
@@ -508,11 +509,28 @@ void toggle_guest_mode(struct vcpu *v)
      * subsequent context switch won't bother re-reading it.
      */
     gs_base = read_gs_base();
+
+    /*
+     * In FRED mode, not only are the two GSes the other way around (i.e. we
+     * want to read GS_SHADOW here), the SWAPGS instruction is disallowed so
+     * we have to emulate it.
+     */
+    if ( opt_fred )
+    {
+        unsigned long gs_shadow = rdmsr(MSR_SHADOW_GS_BASE);
+
+        wrmsrns(MSR_SHADOW_GS_BASE, gs_base);
+        write_gs_base(gs_shadow);
+
+        gs_base = gs_shadow;
+    }
+    else
+        asm volatile ( "swapgs" );
+
     if ( v->arch.flags & TF_kernel_mode )
         v->arch.pv.gs_base_kernel = gs_base;
     else
         v->arch.pv.gs_base_user = gs_base;
-    asm volatile ( "swapgs" );
 
     _toggle_guest_pt(v);
 
diff --git a/xen/arch/x86/pv/emul-priv-op.c b/xen/arch/x86/pv/emul-priv-op.c
index 0ba446d812..548ad16cb8 100644
--- a/xen/arch/x86/pv/emul-priv-op.c
+++ b/xen/arch/x86/pv/emul-priv-op.c
@@ -24,6 +24,7 @@
 #include <asm/pv/trace.h>
 #include <asm/shared.h>
 #include <asm/stubs.h>
+#include <asm/traps.h>
 
 #include <xsm/xsm.h>
 
@@ -910,7 +911,8 @@ static int cf_check read_msr(
     case MSR_GS_BASE:
         if ( !cp->extd.lm )
             break;
-        *val = read_gs_base();
+        /* Under FRED, GS is automatically swapped on privilege change. */
+        *val = opt_fred ? rdmsr(MSR_SHADOW_GS_BASE) : read_gs_base();
         return X86EMUL_OKAY;
 
     case MSR_SHADOW_GS_BASE:
@@ -1049,17 +1051,23 @@ static int cf_check write_msr(
         if ( !cp->extd.lm || !is_canonical_address(val) )
             break;
 
-        if ( reg == MSR_FS_BASE )
-            write_fs_base(val);
-        else if ( reg == MSR_GS_BASE )
-            write_gs_base(val);
-        else if ( reg == MSR_SHADOW_GS_BASE )
+        switch ( reg )
         {
-            write_gs_shadow(val);
+        case MSR_FS_BASE:
+            write_fs_base(val);
+            break;
+
+        case MSR_SHADOW_GS_BASE:
             curr->arch.pv.gs_base_user = val;
+            fallthrough;
+        case MSR_GS_BASE:
+            /* Under FRED, GS is automatically swapped on privilege change. */
+            if ( (reg == MSR_GS_BASE) ^ opt_fred )
+                write_gs_base(val);
+            else
+                write_gs_shadow(val);
+            break;
         }
-        else
-            ASSERT_UNREACHABLE();
         return X86EMUL_OKAY;
 
     case MSR_EFER:
diff --git a/xen/arch/x86/pv/misc-hypercalls.c b/xen/arch/x86/pv/misc-hypercalls.c
index 4c2abeb4ad..7e915d86b7 100644
--- a/xen/arch/x86/pv/misc-hypercalls.c
+++ b/xen/arch/x86/pv/misc-hypercalls.c
@@ -11,6 +11,7 @@
 
 #include <asm/debugreg.h>
 #include <asm/fsgsbase.h>
+#include <asm/traps.h>
 
 long do_set_debugreg(int reg, unsigned long value)
 {
@@ -192,11 +193,13 @@ long do_set_segment_base(unsigned int which, unsigned long base)
 
         case SEGBASE_GS_USER:
             v->arch.pv.gs_base_user = base;
-            write_gs_shadow(base);
-            break;
-
+            fallthrough;
         case SEGBASE_GS_KERNEL:
-            write_gs_base(base);
+            /* Under FRED, GS is automatically swapped on privilege change. */
+            if ( (which == SEGBASE_GS_KERNEL) ^ opt_fred )
+                write_gs_base(base);
+            else
+                write_gs_shadow(base);
             break;
         }
         break;
@@ -206,10 +209,13 @@ long do_set_segment_base(unsigned int which, unsigned long base)
         unsigned int sel = (uint16_t)base;
 
         /*
-         * We wish to update the user %gs from the GDT/LDT.  Currently, the
-         * guest kernel's GS_BASE is in context.
+         * We wish to update the user %gs from the GDT/LDT.  Currently, we are
+         * in guest kernel context.
+         *
+         * Under IDT, this means updating GS_SHADOW.  Under FRED, plain GS.
          */
-        asm volatile ( "swapgs" );
+        if ( !opt_fred )
+            asm volatile ( "swapgs" );
 
         if ( sel > 3 )
             /* Fix up RPL for non-NUL selectors. */
@@ -247,7 +253,8 @@ long do_set_segment_base(unsigned int which, unsigned long base)
         /* Update the cache of the inactive base, as read from the GDT/LDT. */
         v->arch.pv.gs_base_user = read_gs_base();
 
-        asm volatile ( safe_swapgs );
+        if ( !opt_fred )
+            asm volatile ( safe_swapgs );
         break;
     }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.21


From xen-changelog-bounces@lists.xenproject.org Mon Mar 23 22:03:04 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 23 Mar 2026 22:03:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1259606.1552944 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4nMW-0001UT-Ra; Mon, 23 Mar 2026 22:03:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1259606.1552944; Mon, 23 Mar 2026 22:03:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4nMW-0001UL-Oo; Mon, 23 Mar 2026 22:03:04 +0000
Received: by outflank-mailman (input) for mailman id 1259606;
 Mon, 23 Mar 2026 22:03:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w4nMV-0001UF-LU
 for xen-changelog@lists.xenproject.org; Mon, 23 Mar 2026 22:03:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4nMV-005juE-2j
 for xen-changelog@lists.xenproject.org;
 Mon, 23 Mar 2026 22:03:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4nMV-00AwWa-1y
 for xen-changelog@lists.xenproject.org;
 Mon, 23 Mar 2026 22:03:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=U+eIQGUrUljlQYXYr7U6c78Hj1ecqryypVrk79nGarI=; b=w9P6cdpL4VdxcXLQ64MyAbuCHA
	XKQlbF0kc182l3uKLj1emVNuFEn1fZ3GQfBe1SplTtr//MAJv8x+FbUKtoeqLo67hkgXTdcXarsp+
	spYRd0OFiYeU3mo3UwSAo6avcsJk43g2/9DHQru9alxs59fsO11gczJZ0zulFRr+3XVM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.21] x86/pv: Guest exception handling in FRED mode
Message-Id: <E1w4nMV-00AwWa-1y@xenbits.xenproject.org>
Date: Mon, 23 Mar 2026 22:03:03 +0000

commit 889041f06ffae39df3938dc9f97fb8d151b4efb2
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Aug 11 15:55:24 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 17 12:13:50 2026 +0000

    x86/pv: Guest exception handling in FRED mode
    
    Under FRED, entry_from_pv() handles everything.  To start with, implement
    exception handling in the same manner as entry_from_xen(), although we can
    unconditionally enable interrupts after the async/fatal events.
    
    After entry_from_pv() returns, test_all_events() needs to run to perform
    exception and interrupt injection.  Split entry_FRED_R3() into two and
    introduce eretu_exit_to_guest() as the latter half, coming unilaterally from
    restore_all_guest().
    
    For all of this, there is a slightly complicated relationship with CONFIG_PV.
    entry_FRED_R3() must exist irrespective of CONFIG_PV, because it's the
    entrypoint registered with hardware.  For simplicity, entry_from_pv() is
    always called, but it collapses into fatal_trap() in the !PV case.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    (cherry picked from commit 87cfcbe9f0b522f9498101b6a698dd8fbf6509b7)
---
 xen/arch/x86/traps.c             | 78 +++++++++++++++++++++++++++++++++++++++-
 xen/arch/x86/x86_64/entry-fred.S | 13 ++++++-
 xen/arch/x86/x86_64/entry.S      |  4 ++-
 3 files changed, 92 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index 178169dc5f..6a8ebcb3c2 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -2271,9 +2271,85 @@ void asmlinkage check_ist_exit(const struct cpu_user_regs *regs, bool ist_exit)
 
 void asmlinkage entry_from_pv(struct cpu_user_regs *regs)
 {
+    struct fred_info *fi = cpu_regs_fred_info(regs);
+    uint8_t type = regs->fred_ss.type;
+    uint8_t vec = regs->fred_ss.vector;
+
     /* Copy fred_ss.vector into entry_vector as IDT delivery would have done. */
-    regs->entry_vector = regs->fred_ss.vector;
+    regs->entry_vector = vec;
+
+    if ( !IS_ENABLED(CONFIG_PV) )
+        goto fatal;
+
+    /*
+     * First, handle the asynchronous or fatal events.  These are either
+     * unrelated to the interrupted context, or may not have valid context
+     * recorded, and all have special rules on how/whether to re-enable IRQs.
+     */
+    if ( regs->fred_ss.nested )
+        goto fatal;
+
+    switch ( type )
+    {
+    case X86_ET_EXT_INTR:
+        return do_IRQ(regs);
+
+    case X86_ET_NMI:
+        return do_nmi(regs);
+
+    case X86_ET_HW_EXC:
+        switch ( vec )
+        {
+        case X86_EXC_DF: return do_double_fault(regs);
+        case X86_EXC_MC: return do_machine_check(regs);
+        }
+        break;
+    }
 
+    /*
+     * With the asynchronous events handled, what remains are the synchronous
+     * ones.  PV guest context always had interrupts enabled.
+     */
+    local_irq_enable();
+
+    switch ( type )
+    {
+    case X86_ET_HW_EXC:
+    case X86_ET_PRIV_SW_EXC:
+    case X86_ET_SW_EXC:
+        switch ( vec )
+        {
+        case X86_EXC_PF:  handle_PF(regs, fi->edata); break;
+        case X86_EXC_GP:  do_general_protection(regs); break;
+        case X86_EXC_UD:  do_invalid_op(regs); break;
+        case X86_EXC_NM:  do_device_not_available(regs); break;
+        case X86_EXC_BP:  do_int3(regs); break;
+        case X86_EXC_DB:  handle_DB(regs, fi->edata); break;
+        case X86_EXC_CP:  do_entry_CP(regs); break;
+
+        case X86_EXC_DE:
+        case X86_EXC_OF:
+        case X86_EXC_BR:
+        case X86_EXC_NP:
+        case X86_EXC_SS:
+        case X86_EXC_MF:
+        case X86_EXC_AC:
+        case X86_EXC_XM:
+            do_trap(regs);
+            break;
+
+        default:
+            goto fatal;
+        }
+        break;
+
+    default:
+        goto fatal;
+    }
+
+    return;
+
+ fatal:
     fatal_trap(regs, false);
 }
 
diff --git a/xen/arch/x86/x86_64/entry-fred.S b/xen/arch/x86/x86_64/entry-fred.S
index 3c3320df22..a1ff9a4a97 100644
--- a/xen/arch/x86/x86_64/entry-fred.S
+++ b/xen/arch/x86/x86_64/entry-fred.S
@@ -15,9 +15,20 @@ FUNC(entry_FRED_R3, 4096)
         mov     %rsp, %rdi
         call    entry_from_pv
 
+#ifdef CONFIG_PV
+        GET_STACK_END(14)
+        movq    STACK_CPUINFO_FIELD(current_vcpu)(%r14), %rbx
+
+        jmp     test_all_events
+#else
+        BUG     /* Not Reached */
+#endif
+END(entry_FRED_R3)
+
+FUNC(eretu_exit_to_guest)
         POP_GPRS
         eretu
-END(entry_FRED_R3)
+END(eretu_exit_to_guest)
 
         /* The Ring0 entrypoint is at Ring3 + 0x100. */
         .org entry_FRED_R3 + 0x100, 0xcc
diff --git a/xen/arch/x86/x86_64/entry.S b/xen/arch/x86/x86_64/entry.S
index c02245ac06..e10444c1ff 100644
--- a/xen/arch/x86/x86_64/entry.S
+++ b/xen/arch/x86/x86_64/entry.S
@@ -64,7 +64,7 @@ UNLIKELY_END(syscall_no_callback)
         /* Conditionally clear DF */
         and   %esi, UREGS_eflags(%rsp)
 /* %rbx: struct vcpu */
-test_all_events:
+LABEL(test_all_events, 0)
         ASSERT_NOT_IN_ATOMIC
         cli                             # tests must not race interrupts
 /*test_softirqs:*/
@@ -153,6 +153,8 @@ END(switch_to_kernel)
 FUNC_LOCAL(restore_all_guest)
         ASSERT_INTERRUPTS_DISABLED
 
+        ALTERNATIVE "", "jmp eretu_exit_to_guest", X86_FEATURE_XEN_FRED
+
         /* Stash guest SPEC_CTRL value while we can read struct vcpu. */
         mov VCPU_arch_msrs(%rbx), %rdx
         mov VCPUMSR_spec_ctrl_raw(%rdx), %r15d
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.21


From xen-changelog-bounces@lists.xenproject.org Mon Mar 23 22:03:14 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 23 Mar 2026 22:03:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1259608.1552949 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4nMg-0001Wa-TM; Mon, 23 Mar 2026 22:03:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1259608.1552949; Mon, 23 Mar 2026 22:03:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4nMg-0001WS-QL; Mon, 23 Mar 2026 22:03:14 +0000
Received: by outflank-mailman (input) for mailman id 1259608;
 Mon, 23 Mar 2026 22:03:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w4nMf-0001WM-O5
 for xen-changelog@lists.xenproject.org; Mon, 23 Mar 2026 22:03:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4nMf-005juI-30
 for xen-changelog@lists.xenproject.org;
 Mon, 23 Mar 2026 22:03:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4nMf-00AwXk-2F
 for xen-changelog@lists.xenproject.org;
 Mon, 23 Mar 2026 22:03:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=AlBfer5E4VVK3ApLj+snr7k/ck5zNd9ckvbfEyNLsXc=; b=GuVKTyTwiA4V9nooxDKWQ3glp/
	ynb7r+9maPeW4/NopSJhoIZDtXcg3gZMcrzY60yJV23pfEMdOAlkjaIyccclaBdwfQ54Xvw85Hcg2
	kpnXDIZrSWiJxrSVJI5+KeqMilXvu4hkho54q1MQhvdJKYPcC/p58Cy1NOKU4VkgCkiE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.21] x86/pv: ERETU error handling
Message-Id: <E1w4nMf-00AwXk-2F@xenbits.xenproject.org>
Date: Mon, 23 Mar 2026 22:03:13 +0000

commit 6ad825078ee9ea8b6b1fcc241ceacaadfd97a79e
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Aug 13 15:02:26 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 17 12:13:50 2026 +0000

    x86/pv: ERETU error handling
    
    ERETU can fault for guest reasons, and like IRET needs special handling to
    forward the error into the guest.
    
    As this is largely written in C, take the opportunity to better classify the
    sources of error, and in particular, not forward errors that are actually
    Xen's fault into the guest, opting for a domain crash instead.
    
    Because ERETU does not enable NMIs if it faults, a corner case exists if an
    NMI was taken while in guest context, and the ERETU back out faults.  Recovery
    must involve an ERETS with the interrupted context's NMI flag.
    
    See the comments for full details.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    (cherry picked from commit 99edc6c2a0f5886474e017dd0bdd5829e0605455)
---
 xen/arch/x86/traps.c             | 115 +++++++++++++++++++++++++++++++++++++++
 xen/arch/x86/x86_64/entry-fred.S |  13 +++++
 2 files changed, 128 insertions(+)

diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index 6a8ebcb3c2..d470908736 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -2353,6 +2353,113 @@ void asmlinkage entry_from_pv(struct cpu_user_regs *regs)
     fatal_trap(regs, false);
 }
 
+void nocall eretu_error_dom_crash(void);
+
+/*
+ * Classify an event at the ERETU instruction, and handle if possible.
+ * Returns @true if handled, @false if the event should continue down the
+ * normal handlers.
+ */
+static bool handle_eretu_event(struct cpu_user_regs *regs)
+{
+    unsigned long recover;
+
+    /*
+     * WARNING: The GPRs in gregs overlaps with regs.  Only gregs->error_code
+     *          and later are legitimate to access.
+     */
+    struct cpu_user_regs *gregs =
+        _p(regs->rsp - offsetof(struct cpu_user_regs, error_code));
+
+    /*
+     * The asynchronous or fatal events (INTR, NMI, #MC, #DF) have been dealt
+     * with, meaning we only have synchronous ones to consider.  Anything
+     * which isn't a hardware exception (e.g. #BP) wants handling normally.
+     */
+    if ( regs->fred_ss.type != X86_ET_HW_EXC )
+        return false;
+
+    /*
+     * Guests are permitted to write non-present GDT/LDT entries.  Therefore
+     * #NP[sel] (%cs) and #SS[sel] (%ss) must be handled as guest errors.  The
+     * only other source of #SS is for a bad %ss-relative memory access in
+     * Xen, and if the stack is that bad, we'll have escalated to #DF.
+     *
+     * #PF can happen from ERETU accessing the GDT/LDT.  Xen may translate
+     * these into #GP for the guest, so must be handled as guest errors.  In
+     * theory we can get #PF for a bad instruction fetch or bad stack access,
+     * but either of these will be fatal and not end up here.
+     */
+    switch ( regs->fred_ss.vector )
+    {
+    case X86_EXC_GP:
+        /*
+         * #GP[0] can occur because of a NULL %cs or %ss (which are a guest
+         * error), but some #GP[0]'s are errors in Xen (ERETU at SL != 0), or
+         * errors of Xen's handling of guest state (bad metadata).
+         *
+         * These magic numbers came from the FRED Spec; they check that ERETU
+         * is trying to return to Ring 3, and that reserved or inapplicable
+         * bits are 0.
+         */
+        if ( regs->error_code == 0 && (gregs->cs & ~3) && (gregs->ss & ~3) &&
+             (regs->fred_cs.sl != 0 ||
+              (gregs->csx    & 0xffffffffffff0003UL) != 3 ||
+              (gregs->rflags & 0xffffffffffc2b02aUL) != 2 ||
+              (gregs->ssx    &         0xfff80003UL) != 3) )
+        {
+            recover = (unsigned long)eretu_error_dom_crash;
+
+            if ( regs->fred_cs.sl )
+                gprintk(XENLOG_ERR, "ERETU at SL %u\n", regs->fred_cs.sl);
+            else
+                gprintk(XENLOG_ERR, "Bad return state: csx %#lx, rflags %#lx, ssx %#x\n",
+                        gregs->csx, gregs->rflags, (unsigned int)gregs->ssx);
+            break;
+        }
+        fallthrough;
+    case X86_EXC_NP:
+    case X86_EXC_SS:
+    case X86_EXC_PF:
+        recover = (unsigned long)entry_FRED_R3;
+        break;
+
+        /*
+         * Handle everything else normally.  e.g. #DB would be debugging
+         * activities in Xen.  In theory we can get #UD if CR4.FRED gets
+         * cleared, but in practice if that were the case we wouldn't be here
+         * handling the result.
+         */
+    default:
+        return false;
+    }
+
+    this_cpu(last_extable_addr) = regs->rip;
+
+    /*
+     * If an NMI was taken in guest context and the ERETU faulted, NMIs will
+     * still be blocked.  Therefore we copy the interrupted frame's NMI status
+     * into our own, and must ERETS as part of recovery.
+     */
+    regs->fred_ss.nmi = gregs->fred_ss.nmi;
+
+    /*
+     * Next, copy the exception information from the current frame back onto
+     * the interrupted frame, preserving the interrupted frame's %cs and %ss.
+     */
+    *cpu_regs_fred_info(regs) = *cpu_regs_fred_info(gregs);
+    gregs->ssx = (regs->ssx & ~0xffff) | gregs->ss;
+    gregs->csx = (regs->csx & ~0xffff) | gregs->cs;
+    gregs->error_code   = regs->error_code;
+    gregs->entry_vector = regs->entry_vector;
+
+    fixup_exception_return(regs, recover, 0);
+
+    return true;
+}
+
+void nocall eretu(void);
+
 void asmlinkage entry_from_xen(struct cpu_user_regs *regs)
 {
     struct fred_info *fi = cpu_regs_fred_info(regs);
@@ -2394,6 +2501,14 @@ void asmlinkage entry_from_xen(struct cpu_user_regs *regs)
     if ( regs->eflags & X86_EFLAGS_IF )
         local_irq_enable();
 
+    /*
+     * An event taken at the ERETU instruction may be because of bad guest
+     * state.  If so, it will need special handling.
+     */
+    if ( unlikely(regs->rip == (unsigned long)eretu) &&
+         handle_eretu_event(regs) )
+        return;
+
     switch ( type )
     {
     case X86_ET_HW_EXC:
diff --git a/xen/arch/x86/x86_64/entry-fred.S b/xen/arch/x86/x86_64/entry-fred.S
index a1ff9a4a97..2fa57beb93 100644
--- a/xen/arch/x86/x86_64/entry-fred.S
+++ b/xen/arch/x86/x86_64/entry-fred.S
@@ -27,9 +27,22 @@ END(entry_FRED_R3)
 
 FUNC(eretu_exit_to_guest)
         POP_GPRS
+
+        /*
+         * Exceptions here are handled by redirecting either to
+         * entry_FRED_R3() (for an error to be passed to the guest), or to
+         * eretu_error_dom_crash() (for a Xen error handling guest state).
+         */
+LABEL(eretu, 0)
         eretu
 END(eretu_exit_to_guest)
 
+FUNC(eretu_error_dom_crash)
+        PUSH_AND_CLEAR_GPRS
+        sti
+        call    asm_domain_crash_synchronous  /* Does not return */
+END(eretu_error_dom_crash)
+
         /* The Ring0 entrypoint is at Ring3 + 0x100. */
         .org entry_FRED_R3 + 0x100, 0xcc
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.21


From xen-changelog-bounces@lists.xenproject.org Mon Mar 23 22:03:24 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 23 Mar 2026 22:03:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1259610.1552952 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4nMq-0001Yl-Ua; Mon, 23 Mar 2026 22:03:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1259610.1552952; Mon, 23 Mar 2026 22:03:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4nMq-0001Yd-Rr; Mon, 23 Mar 2026 22:03:24 +0000
Received: by outflank-mailman (input) for mailman id 1259610;
 Mon, 23 Mar 2026 22:03:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w4nMp-0001YX-Qn
 for xen-changelog@lists.xenproject.org; Mon, 23 Mar 2026 22:03:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4nMq-005jue-02
 for xen-changelog@lists.xenproject.org;
 Mon, 23 Mar 2026 22:03:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4nMp-00AwYr-2V
 for xen-changelog@lists.xenproject.org;
 Mon, 23 Mar 2026 22:03:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ly5rJbyoRKFG2AtxwIDOf8Q5hdaXtk5W23YKUr5UIP8=; b=QbGAqYoyboQ9JMBar6sI5vwOu9
	5V73FjwEValpb4lSKGJVSoLq03HtUJnHNWtaoPNMv+xA6gnksEjp6yOdTCZq4xUsT+rLo2QUur8oE
	3xLeIiyNdeCKPlxTEZeTSj6j6GnO3og7F40febi3Ofp1SEqjQsWzMImdfDHvOAlA6uMU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.21] x86/pv: System call handling in FRED mode
Message-Id: <E1w4nMp-00AwYr-2V@xenbits.xenproject.org>
Date: Mon, 23 Mar 2026 22:03:23 +0000

commit c8b536ec186fcdaf689861c1513292092f01e216
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Aug 11 15:55:24 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 17 12:13:50 2026 +0000

    x86/pv: System call handling in FRED mode
    
    Under FRED, entry_from_pv() handles everything, even system call instructions.
    This means more of our logic is written in C now, rather than assembly.
    
    In order to facilitate this, introduce pv_inject_callback(), which reuses
    struct trap_bounce infrastructure to inject the syscall/sysenter callbacks.
    This in turns requires some !PV compatibility for pv_inject_callback() and
    pv_hypercall() which can both be ASSERT_UNREACHABLE().
    
    For each of INT $N, SYSCALL and SYSENTER, FRED gives us interrupted context
    which was previously lost.  As the guest can't see FRED, Xen has to lose state
    in the same way to maintain the prior behaviour.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    (cherry picked from commit 76193ef47d9165a2c85b1f0c9e40c6018c5ef943)
---
 xen/arch/x86/include/asm/domain.h    |   2 +
 xen/arch/x86/include/asm/hypercall.h |   2 -
 xen/arch/x86/pv/traps.c              |  39 +++++++++++
 xen/arch/x86/traps.c                 | 126 +++++++++++++++++++++++++++++++++++
 4 files changed, 167 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/include/asm/domain.h b/xen/arch/x86/include/asm/domain.h
index 5df8c78253..828f42c3e4 100644
--- a/xen/arch/x86/include/asm/domain.h
+++ b/xen/arch/x86/include/asm/domain.h
@@ -710,6 +710,8 @@ void arch_vcpu_regs_init(struct vcpu *v);
 struct vcpu_hvm_context;
 int arch_set_info_hvm_guest(struct vcpu *v, const struct vcpu_hvm_context *ctx);
 
+void pv_inject_callback(unsigned int type);
+
 #ifdef CONFIG_PV
 void pv_inject_event(const struct x86_event *event);
 #else
diff --git a/xen/arch/x86/include/asm/hypercall.h b/xen/arch/x86/include/asm/hypercall.h
index f6e9e2313b..ded3c24d40 100644
--- a/xen/arch/x86/include/asm/hypercall.h
+++ b/xen/arch/x86/include/asm/hypercall.h
@@ -18,9 +18,7 @@
 
 #define __HYPERVISOR_paging_domctl_cont __HYPERVISOR_arch_1
 
-#ifdef CONFIG_PV
 void pv_hypercall(struct cpu_user_regs *regs);
-#endif
 
 void pv_ring1_init_hypercall_page(void *ptr);
 void pv_ring3_init_hypercall_page(void *ptr);
diff --git a/xen/arch/x86/pv/traps.c b/xen/arch/x86/pv/traps.c
index c3c0976c44..00de034126 100644
--- a/xen/arch/x86/pv/traps.c
+++ b/xen/arch/x86/pv/traps.c
@@ -19,6 +19,8 @@
 #include <asm/shared.h>
 #include <asm/traps.h>
 
+#include <public/callback.h>
+
 void pv_inject_event(const struct x86_event *event)
 {
     struct vcpu *curr = current;
@@ -95,6 +97,43 @@ void pv_inject_event(const struct x86_event *event)
     }
 }
 
+void pv_inject_callback(unsigned int type)
+{
+    struct vcpu *curr = current;
+    struct trap_bounce *tb = &curr->arch.pv.trap_bounce;
+    unsigned long rip;
+    bool irq;
+
+    ASSERT(is_pv_64bit_vcpu(curr));
+
+    switch ( type )
+    {
+    case CALLBACKTYPE_syscall:
+        rip = curr->arch.pv.syscall_callback_eip;
+        irq = curr->arch.pv.vgc_flags & VGCF_syscall_disables_events;
+        break;
+
+    case CALLBACKTYPE_syscall32:
+        rip = curr->arch.pv.syscall32_callback_eip;
+        irq = curr->arch.pv.syscall32_disables_events;
+        break;
+
+    case CALLBACKTYPE_sysenter:
+        rip = curr->arch.pv.sysenter_callback_eip;
+        irq = curr->arch.pv.sysenter_disables_events;
+        break;
+
+    default:
+        ASSERT_UNREACHABLE();
+        rip = 0;
+        irq = false;
+        break;
+    }
+
+    tb->flags = TBF_EXCEPTION | (irq ? TBF_INTERRUPT : 0);
+    tb->eip = rip;
+}
+
 /*
  * Called from asm to set up the MCE trapbounce info.
  * Returns false no callback is set up, else true.
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index d470908736..ac063b87d5 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -18,6 +18,7 @@
 #include <xen/delay.h>
 #include <xen/domain_page.h>
 #include <xen/guest_access.h>
+#include <xen/hypercall.h>
 #include <xen/init.h>
 #include <xen/mm.h>
 #include <xen/paging.h>
@@ -52,6 +53,8 @@
 #include <asm/uaccess.h>
 #include <asm/xenoprof.h>
 
+#include <public/callback.h>
+
 /*
  * opt_nmi: one of 'ignore', 'dom0', or 'fatal'.
  *  fatal:  Xen prints diagnostic message and then hangs.
@@ -2272,6 +2275,7 @@ void asmlinkage check_ist_exit(const struct cpu_user_regs *regs, bool ist_exit)
 void asmlinkage entry_from_pv(struct cpu_user_regs *regs)
 {
     struct fred_info *fi = cpu_regs_fred_info(regs);
+    struct vcpu *curr = current;
     uint8_t type = regs->fred_ss.type;
     uint8_t vec = regs->fred_ss.vector;
 
@@ -2314,6 +2318,38 @@ void asmlinkage entry_from_pv(struct cpu_user_regs *regs)
 
     switch ( type )
     {
+    case X86_ET_SW_INT:
+        /*
+         * For better or worse, Xen writes IDT vectors 3 and 4 with DPL3 (so
+         * INT3/INTO work), making INT $3/4 indistinguishable, and the guest
+         * choice of DPL for these vectors is ignored.
+         *
+         * Have them fall through into X86_ET_HW_EXC, as #BP in particular
+         * needs handling by do_int3() in case an external debugger is
+         * attached.
+         *
+         * As the event type is provided, INT $N instructions don't need #GP
+         * tricks to spot, and INT $0x80 doesn't need a fastpath.  As the
+         * guest is necessary PV64, INT $0x82 has no special meaning either.
+         *
+         * When converting to a fault, hardware finally gives us enough
+         * information to account for prefixes, so provide the more correct
+         * behaviour rather than assuming the instruction was two bytes long.
+         */
+        if ( vec != X86_EXC_BP && vec != X86_EXC_OF )
+        {
+            const struct trap_info *ti = &curr->arch.pv.trap_ctxt[vec];
+
+            if ( permit_softint(TI_GET_DPL(ti), curr, regs) )
+                pv_inject_sw_interrupt(vec);
+            else
+            {
+                regs->rip -= regs->fred_ss.insnlen;
+                pv_inject_hw_exception(X86_EXC_GP, (vec << 3) | X86_XEC_IDT);
+            }
+            break;
+        }
+        fallthrough;
     case X86_ET_HW_EXC:
     case X86_ET_PRIV_SW_EXC:
     case X86_ET_SW_EXC:
@@ -2343,6 +2379,96 @@ void asmlinkage entry_from_pv(struct cpu_user_regs *regs)
         }
         break;
 
+    case X86_ET_OTHER:
+        switch ( regs->fred_ss.vector )
+        {
+        case 1: /* SYSCALL */
+        {
+            /*
+             * FRED delivery preserves the interrupted %cs/%ss, but previously
+             * SYSCALL lost the interrupted selectors, and SYSRET forced the
+             * use of the ones in MSR_STAR.
+             *
+             * The guest isn't aware of FRED, so recreate the legacy
+             * behaviour.
+             *
+             * The non-FRED SYSCALL path sets TRAP_syscall in entry_vector to
+             * signal that SYSRET can be used, but this isn't relevant in FRED
+             * mode.
+             *
+             * When setting the selectors, clear all upper metadata again for
+             * backwards compatibility.  In particular fred_ss.swint becomes
+             * pend_DB on ERETx, and nothing else in the pv_hypercall() would
+             * clean up.
+             *
+             * When converting to a fault, hardware finally gives us enough
+             * information to account for prefixes, so provide the more
+             * correct behaviour rather than assuming the instruction was two
+             * bytes long.
+             */
+            bool l = regs->fred_ss.l;
+            unsigned int len = regs->fred_ss.insnlen;
+
+            regs->ssx = l ? FLAT_KERNEL_SS   : FLAT_USER_SS32;
+            regs->csx = l ? FLAT_KERNEL_CS64 : FLAT_USER_CS32;
+
+            if ( guest_kernel_mode(curr, regs) )
+                pv_hypercall(regs);
+            else if ( (l ? curr->arch.pv.syscall_callback_eip
+                         : curr->arch.pv.syscall32_callback_eip) == 0 )
+            {
+                regs->rip -= len;
+                pv_inject_hw_exception(X86_EXC_UD, X86_EVENT_NO_EC);
+            }
+            else
+            {
+                /*
+                 * The PV ABI, given no virtual SYSCALL_MASK, hardcodes that
+                 * DF is cleared.  Other flags are handled in the same way as
+                 * interrupts and exceptions in create_bounce_frame().
+                 */
+                regs->eflags &= ~X86_EFLAGS_DF;
+                pv_inject_callback(l ? CALLBACKTYPE_syscall
+                                     : CALLBACKTYPE_syscall32);
+            }
+            break;
+        }
+
+        case 2: /* SYSENTER */
+        {
+            /*
+             * FRED delivery preserves the interrupted state, but previously
+             * SYSENTER discarded almost everything.
+             *
+             * The guest isn't aware of FRED, so recreate the legacy
+             * behaviour.
+             *
+             * When setting the selectors, clear all upper metadata.  In
+             * particular fred_ss.swint becomes pend_DB on ERETx.
+             *
+             * When converting to a fault, hardware finally gives us enough
+             * information to account for prefixes, so provide the more
+             * correct behaviour rather than assuming the instruction was two
+             * bytes long.
+             */
+            regs->ssx = FLAT_USER_SS;
+            regs->rsp = 0;
+            regs->eflags &= ~(X86_EFLAGS_VM | X86_EFLAGS_IF);
+            regs->csx = 3;
+            regs->rip = 0;
+
+            if ( !curr->arch.pv.sysenter_callback_eip )
+                pv_inject_hw_exception(X86_EXC_GP, 0);
+            else
+                pv_inject_callback(CALLBACKTYPE_sysenter);
+            break;
+        }
+
+        default:
+            goto fatal;
+        }
+        break;
+
     default:
         goto fatal;
     }
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.21


From xen-changelog-bounces@lists.xenproject.org Mon Mar 23 22:03:35 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 23 Mar 2026 22:03:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1259612.1552955 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4nN0-0001as-Vz; Mon, 23 Mar 2026 22:03:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1259612.1552955; Mon, 23 Mar 2026 22:03:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4nN0-0001ak-TE; Mon, 23 Mar 2026 22:03:34 +0000
Received: by outflank-mailman (input) for mailman id 1259612;
 Mon, 23 Mar 2026 22:03:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w4nMz-0001ae-TP
 for xen-changelog@lists.xenproject.org; Mon, 23 Mar 2026 22:03:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4nN0-005jui-0J
 for xen-changelog@lists.xenproject.org;
 Mon, 23 Mar 2026 22:03:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4nMz-00AwZu-2m
 for xen-changelog@lists.xenproject.org;
 Mon, 23 Mar 2026 22:03:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=BPTNecrlNEsun+5wxeg0df0C7Y78Phw/zplc64/ILUE=; b=BeiNLDnW4B7SNtb5wQRJwgON+R
	QO5n4aNP2mcNUO2ijOvFrTXds5PfmO3W0W600RVJnQACSsFHYhDL6mhcCsV/L3shiISHonxwbLqAH
	kQKjWXqC+Ve0/wnQxZtlHPSasJTlTr8UZSuLRW/XKpQNoftGjUeMYyFdp0IDSOaL6cNo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.21] x86/traps: Use fatal_trap() for #UD and #GP
Message-Id: <E1w4nMz-00AwZu-2m@xenbits.xenproject.org>
Date: Mon, 23 Mar 2026 22:03:33 +0000

commit 4deb5b83b64164264046ef493e76acbefff0b428
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Feb 10 14:50:56 2026 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 17 12:13:50 2026 +0000

    x86/traps: Use fatal_trap() for #UD and #GP
    
    This renders the diagnostics in a more uniform way.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    (cherry picked from commit 705784e51212cd77031e95ee4ec8799c25e69fb5)
---
 xen/arch/x86/traps.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index ac063b87d5..85d835ab43 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -1376,8 +1376,7 @@ void asmlinkage do_invalid_op(struct cpu_user_regs *regs)
     if ( likely(extable_fixup(regs, true)) )
         return;
 
-    show_execution_state(regs);
-    panic("FATAL TRAP: vector = %d (invalid opcode)\n", X86_EXC_UD);
+    fatal_trap(regs, false);
 }
 
 void asmlinkage do_int3(struct cpu_user_regs *regs)
@@ -1476,8 +1475,7 @@ void do_general_protection(struct cpu_user_regs *regs)
         return;
 
  hardware_gp:
-    show_execution_state(regs);
-    panic("GENERAL PROTECTION FAULT\n[error_code=%04x]\n", regs->error_code);
+    fatal_trap(regs, false);
 }
 
 #ifdef CONFIG_PV
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.21


From xen-changelog-bounces@lists.xenproject.org Mon Mar 23 22:03:45 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 23 Mar 2026 22:03:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1259614.1552961 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4nNB-0001da-3P; Mon, 23 Mar 2026 22:03:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1259614.1552961; Mon, 23 Mar 2026 22:03:45 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4nNB-0001dS-0O; Mon, 23 Mar 2026 22:03:45 +0000
Received: by outflank-mailman (input) for mailman id 1259614;
 Mon, 23 Mar 2026 22:03:44 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w4nN9-0001dM-W4
 for xen-changelog@lists.xenproject.org; Mon, 23 Mar 2026 22:03:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4nNA-005jum-0Z
 for xen-changelog@lists.xenproject.org;
 Mon, 23 Mar 2026 22:03:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4nN9-00Awat-32
 for xen-changelog@lists.xenproject.org;
 Mon, 23 Mar 2026 22:03:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=aVLg7Ru8OKF3N4InlLwce6Nn8sxFsicTA40pajuUiVY=; b=XaMQj4uYRup1U/Eaqd8iKkMDVH
	m3ArvHwoSdcm8I9boiOzOIw0dWkMIlE1dzdxkzCJ0xk1lpOgN20JTfmsW3rm17xAJTAccORVOB1sz
	jpbaYCgcnGkMCXPDVqNvX+eeNuPdyH+fWPl8s3QZO4Z5/mEle0F0TLxoNCrNv4UmZt6g=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.21] x86: Clamp bits in eflags more aggressively
Message-Id: <E1w4nN9-00Awat-32@xenbits.xenproject.org>
Date: Mon, 23 Mar 2026 22:03:43 +0000

commit 16a45172ae9e4880a501df57f4f66fed436e3734
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue May 27 15:58:46 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Mar 19 13:24:48 2026 +0000

    x86: Clamp bits in eflags more aggressively
    
    In FRED mode, ERET is stricter than IRET about flags.  Notably this means:
    
     * The vm86 bit (bit 17) and IOPL (bits 12,13) must be clear.
     * The sticky-1 reserved bit (bit 2) must be set, so dom0_construct() needs to
       set X86_EFLAGS_MBS in order for a PV dom0 to start.
     * All other reserved bits must be clear.
    
    Xen has been overly lax with reserved bit handling.  Adjust
    arch_set_info_guest*() and hypercall_iret() which consume flags to clamp the
    reserved bits for all guest types.
    
    This is a minor ABI change, but by the same argument as commit
    9f892f84c279 ("x86/domctl: Stop using XLAT_cpu_user_regs()"); the reserved
    bits would get clamped like this naturally by hardware when the vCPU is run.
    
    The handling of vm86 is also different.  Guests under 32bit Xen really could
    use vm86 mode, but Long Mode disallows vm86 mode and IRET simply ignores the
    bit.  Xen's behaviour for a PV32 guest trying to use vm86 mode under a 64bit
    Xen is to arrange to deliver #GP at the target of the IRET, rather than to
    fail the IRET itself.
    
    However there's no filtering in arch_set_info_guest() itself, and it can't
    arrange to queue a #GP at the target, so do the next best thing and fail the
    hypercall.  This is not expected to create an issue for PV guests, as the
    result of such an arch_set_info_guest() previously would be to run supposedly
    Real Mode code as Protected Mode code.
    
    This allows PV guests to start when Xen is using FRED mode.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    (cherry picked from commit dbd936248f3846449c0d0e192d544b592c1c44d5)
---
 xen/arch/x86/domain.c                | 24 ++++++++++++++++++++++--
 xen/arch/x86/hvm/domain.c            |  4 ++--
 xen/arch/x86/include/asm/x86-defns.h |  7 +++++++
 xen/arch/x86/pv/dom0_build.c         |  2 +-
 xen/arch/x86/pv/iret.c               |  8 +++++---
 5 files changed, 37 insertions(+), 8 deletions(-)

diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index ff990bab49..9af833b6da 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -1218,6 +1218,14 @@ int arch_set_info_guest(
 
             if ( !__addr_ok(c.nat->ldt_base) )
                 return -EINVAL;
+
+            /*
+             * IRET in Long Mode discards EFLAGS.VM, but in FRED mode ERET
+             * cares that it is zero.
+             *
+             * Guests can't see FRED, so emulate IRET behaviour.
+             */
+            c.nat->user_regs.rflags &= ~X86_EFLAGS_VM;
         }
 #ifdef CONFIG_COMPAT
         else
@@ -1230,6 +1238,18 @@ int arch_set_info_guest(
 
             for ( i = 0; i < ARRAY_SIZE(c.cmp->trap_ctxt); i++ )
                 fixup_guest_code_selector(d, c.cmp->trap_ctxt[i].cs);
+
+            /*
+             * Under 32bit Xen, PV guests could really use vm86 mode.  Under
+             * 64bit Xen, vm86 mode can't be entered even by PV32 guests.
+             *
+             * For backwards compatibility, compat HYPERCALL_iret will arrange
+             * to deliver #GP at the target of the IRET rather than to fail
+             * the IRET itself, but we can't arrange for the same behaviour
+             * here.  Reject the hypercall as the next best option.
+             */
+            if ( c.cmp->user_regs.eflags & X86_EFLAGS_VM )
+                return -EINVAL;
         }
 #endif
 
@@ -1269,7 +1289,7 @@ int arch_set_info_guest(
         v->arch.user_regs.rax               = c.nat->user_regs.rax;
         v->arch.user_regs.rip               = c.nat->user_regs.rip;
         v->arch.user_regs.cs                = c.nat->user_regs.cs;
-        v->arch.user_regs.rflags            = c.nat->user_regs.rflags;
+        v->arch.user_regs.rflags            = (c.nat->user_regs.rflags & X86_EFLAGS_ALL) | X86_EFLAGS_MBS;
         v->arch.user_regs.rsp               = c.nat->user_regs.rsp;
         v->arch.user_regs.ss                = c.nat->user_regs.ss;
         v->arch.pv.es                       = c.nat->user_regs.es;
@@ -1293,7 +1313,7 @@ int arch_set_info_guest(
         v->arch.user_regs.eax               = c.cmp->user_regs.eax;
         v->arch.user_regs.eip               = c.cmp->user_regs.eip;
         v->arch.user_regs.cs                = c.cmp->user_regs.cs;
-        v->arch.user_regs.eflags            = c.cmp->user_regs.eflags;
+        v->arch.user_regs.eflags            = (c.cmp->user_regs.eflags & X86_EFLAGS_ALL) | X86_EFLAGS_MBS;
         v->arch.user_regs.esp               = c.cmp->user_regs.esp;
         v->arch.user_regs.ss                = c.cmp->user_regs.ss;
         v->arch.pv.es                       = c.cmp->user_regs.es;
diff --git a/xen/arch/x86/hvm/domain.c b/xen/arch/x86/hvm/domain.c
index 048f29ae49..1e874d5989 100644
--- a/xen/arch/x86/hvm/domain.c
+++ b/xen/arch/x86/hvm/domain.c
@@ -194,7 +194,7 @@ int arch_set_info_hvm_guest(struct vcpu *v, const struct vcpu_hvm_context *ctx)
         uregs->rsi    = regs->esi;
         uregs->rdi    = regs->edi;
         uregs->rip    = regs->eip;
-        uregs->rflags = regs->eflags;
+        uregs->rflags = (regs->eflags & X86_EFLAGS_ALL) | X86_EFLAGS_MBS;
 
         v->arch.hvm.guest_cr[0] = regs->cr0;
         v->arch.hvm.guest_cr[3] = regs->cr3;
@@ -245,7 +245,7 @@ int arch_set_info_hvm_guest(struct vcpu *v, const struct vcpu_hvm_context *ctx)
         uregs->rsi    = regs->rsi;
         uregs->rdi    = regs->rdi;
         uregs->rip    = regs->rip;
-        uregs->rflags = regs->rflags;
+        uregs->rflags = (regs->rflags & X86_EFLAGS_ALL) | X86_EFLAGS_MBS;
 
         v->arch.hvm.guest_cr[0] = regs->cr0;
         v->arch.hvm.guest_cr[3] = regs->cr3;
diff --git a/xen/arch/x86/include/asm/x86-defns.h b/xen/arch/x86/include/asm/x86-defns.h
index 0a0ba83de7..edeb0b4ff9 100644
--- a/xen/arch/x86/include/asm/x86-defns.h
+++ b/xen/arch/x86/include/asm/x86-defns.h
@@ -27,6 +27,13 @@
     (X86_EFLAGS_CF | X86_EFLAGS_PF | X86_EFLAGS_AF |   \
      X86_EFLAGS_ZF | X86_EFLAGS_SF | X86_EFLAGS_OF)
 
+#define X86_EFLAGS_ALL                                          \
+    (X86_EFLAGS_ARITH_MASK | X86_EFLAGS_TF | X86_EFLAGS_IF |    \
+     X86_EFLAGS_DF | X86_EFLAGS_OF | X86_EFLAGS_IOPL |          \
+     X86_EFLAGS_NT | X86_EFLAGS_RF | X86_EFLAGS_VM |            \
+     X86_EFLAGS_AC | X86_EFLAGS_VIF | X86_EFLAGS_VIP |          \
+     X86_EFLAGS_ID)
+
 /*
  * Intel CPU flags in CR0
  */
diff --git a/xen/arch/x86/pv/dom0_build.c b/xen/arch/x86/pv/dom0_build.c
index 21158ce181..f9bbbea2ff 100644
--- a/xen/arch/x86/pv/dom0_build.c
+++ b/xen/arch/x86/pv/dom0_build.c
@@ -1021,7 +1021,7 @@ static int __init dom0_construct(const struct boot_domain *bd)
     regs->rip = parms.virt_entry;
     regs->rsp = vstack_end;
     regs->rsi = vstartinfo_start;
-    regs->eflags = X86_EFLAGS_IF;
+    regs->eflags = X86_EFLAGS_IF | X86_EFLAGS_MBS;
 
     /*
      * We don't call arch_set_info_guest(), so some initialisation needs doing
diff --git a/xen/arch/x86/pv/iret.c b/xen/arch/x86/pv/iret.c
index d3a1fb2c68..39ce316b8d 100644
--- a/xen/arch/x86/pv/iret.c
+++ b/xen/arch/x86/pv/iret.c
@@ -80,8 +80,9 @@ long do_iret(void)
 
     regs->rip    = iret_saved.rip;
     regs->cs     = iret_saved.cs | 3; /* force guest privilege */
-    regs->rflags = ((iret_saved.rflags & ~(X86_EFLAGS_IOPL|X86_EFLAGS_VM))
-                    | X86_EFLAGS_IF);
+    regs->rflags = ((iret_saved.rflags & X86_EFLAGS_ALL &
+                     ~(X86_EFLAGS_IOPL | X86_EFLAGS_VM)) |
+                    X86_EFLAGS_IF | X86_EFLAGS_MBS);
     regs->rsp    = iret_saved.rsp;
     regs->ss     = iret_saved.ss | 3; /* force guest privilege */
 
@@ -143,7 +144,8 @@ int compat_iret(void)
     if ( VM_ASSIST(v->domain, architectural_iopl) )
         v->arch.pv.iopl = eflags & X86_EFLAGS_IOPL;
 
-    regs->eflags = (eflags & ~X86_EFLAGS_IOPL) | X86_EFLAGS_IF;
+    regs->eflags = ((eflags & X86_EFLAGS_ALL & ~X86_EFLAGS_IOPL) |
+                    X86_EFLAGS_IF | X86_EFLAGS_MBS);
 
     if ( unlikely(eflags & X86_EFLAGS_VM) )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.21


From xen-changelog-bounces@lists.xenproject.org Mon Mar 23 22:03:55 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 23 Mar 2026 22:03:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1259616.1552965 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4nNL-0001fz-4k; Mon, 23 Mar 2026 22:03:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1259616.1552965; Mon, 23 Mar 2026 22:03:55 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4nNL-0001fr-1r; Mon, 23 Mar 2026 22:03:55 +0000
Received: by outflank-mailman (input) for mailman id 1259616;
 Mon, 23 Mar 2026 22:03:54 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w4nNK-0001fj-2I
 for xen-changelog@lists.xenproject.org; Mon, 23 Mar 2026 22:03:54 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4nNK-005jur-0p
 for xen-changelog@lists.xenproject.org;
 Mon, 23 Mar 2026 22:03:54 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4nNK-00Awbw-04
 for xen-changelog@lists.xenproject.org;
 Mon, 23 Mar 2026 22:03:54 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=gQ1TBERxqtA1JbzO0QMYyCjbMoOWzU2U3xnc3kaVqpg=; b=Se9sCoRi9oNT6TKPR8+2LvESX8
	3GY9GnzG3hzNdtLfEgm7QtWdTPC5Cm0MJG8SSxaSD3+X+J5swFmxWTd/IoByIj3FDoHj28pwqAN6O
	IR5kpZOj83yyS69LvCVjLqAnZa6PW8QbDpkYoeVD0Jw11lAqGOFqAzMLRRLT4jD9QYfw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.21] x86/ucode: Exclude Zen6 from entrysign mitigations
Message-Id: <E1w4nNK-00Awbw-04@xenbits.xenproject.org>
Date: Mon, 23 Mar 2026 22:03:54 +0000

commit 74930b4a9d3688cb07b1df8997199d70e3957cee
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Mar 16 10:34:23 2026 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Mar 19 13:26:13 2026 +0000

    x86/ucode: Exclude Zen6 from entrysign mitigations
    
    Family 0x1a covers both Zen5 and Zen6, but the latter is not believed to be
    vulnerable to entrysign.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    (cherry picked from commit bd15fdedafb3a414aeafa918a9212148ac22ebb5)
---
 xen/arch/x86/cpu/microcode/amd.c | 6 ++++--
 xen/arch/x86/include/asm/amd.h   | 4 ++++
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/cpu/microcode/amd.c b/xen/arch/x86/cpu/microcode/amd.c
index e7ae1e8023..34e3a52753 100644
--- a/xen/arch/x86/cpu/microcode/amd.c
+++ b/xen/arch/x86/cpu/microcode/amd.c
@@ -20,6 +20,7 @@
 #include <xen/mm.h> /* TODO: Fix asm/tlbflush.h breakage */
 #include <xen/sha2.h>
 
+#include <asm/amd.h>
 #include <asm/msr.h>
 
 #include "private.h"
@@ -575,7 +576,7 @@ void __init ucode_probe_amd(struct microcode_ops *ops)
      * CPUs.  Taint Xen if digest checking is turned off.
      */
     if ( boot_cpu_data.family >= 0x17 && boot_cpu_data.family <= 0x1a &&
-         !opt_digest_check )
+         !is_zen6_uarch() && !opt_digest_check )
     {
         printk(XENLOG_WARNING
                "Microcode patch additional digest checks disabled\n");
@@ -616,7 +617,8 @@ void __init amd_check_entrysign(void)
 
     if ( boot_cpu_data.vendor != X86_VENDOR_AMD ||
          boot_cpu_data.family < 0x17 ||
-         boot_cpu_data.family > 0x1a )
+         boot_cpu_data.family > 0x1a ||
+         is_zen6_uarch() )
         return;
 
     /*
diff --git a/xen/arch/x86/include/asm/amd.h b/xen/arch/x86/include/asm/amd.h
index 72df42a6f6..5903b21890 100644
--- a/xen/arch/x86/include/asm/amd.h
+++ b/xen/arch/x86/include/asm/amd.h
@@ -149,6 +149,8 @@
  * For Zen3 and Zen4 (Fam19h) the heuristic is the presence of AutoIBRS, as
  * it's Zen4-specific.
  *
+ * For Zen5 and Zen6 (Fam1ah) the heuristic is the presence of FRED.
+ *
  * The caller is required to perform the appropriate vendor/family checks
  * first.
  */
@@ -156,6 +158,8 @@
 #define is_zen2_uarch()   boot_cpu_has(X86_FEATURE_AMD_STIBP)
 #define is_zen3_uarch() (!boot_cpu_has(X86_FEATURE_AUTO_IBRS))
 #define is_zen4_uarch()   boot_cpu_has(X86_FEATURE_AUTO_IBRS)
+#define is_zen5_uarch() (!boot_cpu_has(X86_FEATURE_FRED))
+#define is_zen6_uarch()   boot_cpu_has(X86_FEATURE_FRED)
 
 struct cpuinfo_x86;
 int cpu_has_amd_erratum(const struct cpuinfo_x86 *cpu, int osvw_id, ...);
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.21


From xen-changelog-bounces@lists.xenproject.org Mon Mar 23 22:04:05 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 23 Mar 2026 22:04:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1259618.1552967 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4nNV-0001iA-5q; Mon, 23 Mar 2026 22:04:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1259618.1552967; Mon, 23 Mar 2026 22:04:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4nNV-0001i1-3B; Mon, 23 Mar 2026 22:04:05 +0000
Received: by outflank-mailman (input) for mailman id 1259618;
 Mon, 23 Mar 2026 22:04:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w4nNU-0001hu-AL
 for xen-changelog@lists.xenproject.org; Mon, 23 Mar 2026 22:04:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4nNU-005jvC-1d
 for xen-changelog@lists.xenproject.org;
 Mon, 23 Mar 2026 22:04:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4nNU-00AwdR-0r
 for xen-changelog@lists.xenproject.org;
 Mon, 23 Mar 2026 22:04:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=yJ0AsQNx+j1PVrsaEvFmejR+NTjiFEwhpnxg1s3spqE=; b=z2Bb2N1OY3VIS/swx1QK/pw7it
	PVkqpwiPiW0F0cFSodbtWA4Rz39dF/0J749l8eRDuRrmjlM8hMbSiJy4FtH6L7Yuz2YqDXWVmgbWj
	BF00eXrHUoBiaUFzJx/2DDCexAefbryEDNt1BzYbApKmt2h0ftH6/RqYiaGkFqfzX3KE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.20] x86/ucode: Exclude Zen6 from entrysign mitigations
Message-Id: <E1w4nNU-00AwdR-0r@xenbits.xenproject.org>
Date: Mon, 23 Mar 2026 22:04:04 +0000

commit 4d25f6e10ebb154575b7c7494c2c416142fb2a78
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Mar 16 10:34:23 2026 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Mar 23 12:12:37 2026 +0000

    x86/ucode: Exclude Zen6 from entrysign mitigations
    
    Family 0x1a covers both Zen5 and Zen6, but the latter is not believed to be
    vulnerable to entrysign.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    (cherry picked from commit bd15fdedafb3a414aeafa918a9212148ac22ebb5)
---
 xen/arch/x86/cpu/common.c                   | 4 +++-
 xen/arch/x86/cpu/microcode/amd.c            | 6 ++++--
 xen/arch/x86/include/asm/amd.h              | 4 ++++
 xen/include/public/arch-x86/cpufeatureset.h | 1 +
 4 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c
index eb8f4ef8fe..4efa4fed32 100644
--- a/xen/arch/x86/cpu/common.c
+++ b/xen/arch/x86/cpu/common.c
@@ -382,7 +382,9 @@ void __init early_cpu_init(bool verbose)
 			      c->x86_capability[FEATURESET_m10Ah]);
 
 		if (max_subleaf >= 1)
-			cpuid_count(7, 1, &eax, &ebx, &ecx,
+			cpuid_count(7, 1,
+				    &c->x86_capability[FEATURESET_7a1],
+				    &ebx, &ecx,
 				    &c->x86_capability[FEATURESET_7d1]);
 	}
 
diff --git a/xen/arch/x86/cpu/microcode/amd.c b/xen/arch/x86/cpu/microcode/amd.c
index 995a050e52..eeb2a75fbe 100644
--- a/xen/arch/x86/cpu/microcode/amd.c
+++ b/xen/arch/x86/cpu/microcode/amd.c
@@ -20,6 +20,7 @@
 #include <xen/mm.h> /* TODO: Fix asm/tlbflush.h breakage */
 #include <xen/sha2.h>
 
+#include <asm/amd.h>
 #include <asm/msr.h>
 
 #include "private.h"
@@ -568,7 +569,7 @@ void __init ucode_probe_amd(struct microcode_ops *ops)
      * CPUs.  Taint Xen if digest checking is turned off.
      */
     if ( boot_cpu_data.x86 >= 0x17 && boot_cpu_data.x86 <= 0x1a &&
-         !opt_digest_check )
+         !is_zen6_uarch() && !opt_digest_check )
     {
         printk(XENLOG_WARNING
                "Microcode patch additional digest checks disabled\n");
@@ -609,7 +610,8 @@ void __init amd_check_entrysign(void)
 
     if ( boot_cpu_data.x86_vendor != X86_VENDOR_AMD ||
          boot_cpu_data.x86 < 0x17 ||
-         boot_cpu_data.x86 > 0x1a )
+         boot_cpu_data.x86 > 0x1a ||
+         is_zen6_uarch() )
         return;
 
     /*
diff --git a/xen/arch/x86/include/asm/amd.h b/xen/arch/x86/include/asm/amd.h
index 9c9599a622..7566526ea4 100644
--- a/xen/arch/x86/include/asm/amd.h
+++ b/xen/arch/x86/include/asm/amd.h
@@ -149,6 +149,8 @@
  * For Zen3 and Zen4 (Fam19h) the heuristic is the presence of AutoIBRS, as
  * it's Zen4-specific.
  *
+ * For Zen5 and Zen6 (Fam1ah) the heuristic is the presence of FRED.
+ *
  * The caller is required to perform the appropriate vendor/family checks
  * first.
  */
@@ -156,6 +158,8 @@
 #define is_zen2_uarch()   boot_cpu_has(X86_FEATURE_AMD_STIBP)
 #define is_zen3_uarch() (!boot_cpu_has(X86_FEATURE_AUTO_IBRS))
 #define is_zen4_uarch()   boot_cpu_has(X86_FEATURE_AUTO_IBRS)
+#define is_zen5_uarch() (!boot_cpu_has(X86_FEATURE_FRED))
+#define is_zen6_uarch()   boot_cpu_has(X86_FEATURE_FRED)
 
 struct cpuinfo_x86;
 int cpu_has_amd_erratum(const struct cpuinfo_x86 *cpu, int osvw_id, ...);
diff --git a/xen/include/public/arch-x86/cpufeatureset.h b/xen/include/public/arch-x86/cpufeatureset.h
index 4f94342ad6..618674123b 100644
--- a/xen/include/public/arch-x86/cpufeatureset.h
+++ b/xen/include/public/arch-x86/cpufeatureset.h
@@ -307,6 +307,7 @@ XEN_CPUFEATURE(CMPCCXADD,    10*32+ 7) /*a  CMPccXADD Instructions */
 XEN_CPUFEATURE(FZRM,         10*32+10) /*A  Fast Zero-length REP MOVSB */
 XEN_CPUFEATURE(FSRS,         10*32+11) /*A  Fast Short REP STOSB */
 XEN_CPUFEATURE(FSRCS,        10*32+12) /*A  Fast Short REP CMPSB/SCASB */
+XEN_CPUFEATURE(FRED,         10*32+17) /*   Fast Return and Event Delivery */
 XEN_CPUFEATURE(WRMSRNS,      10*32+19) /*S  WRMSR Non-Serialising */
 XEN_CPUFEATURE(AMX_FP16,     10*32+21) /*   AMX FP16 instruction */
 XEN_CPUFEATURE(AVX_IFMA,     10*32+23) /*A  AVX-IFMA Instructions */
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.20


From xen-changelog-bounces@lists.xenproject.org Mon Mar 23 22:04:16 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 23 Mar 2026 22:04:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1259620.1552972 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4nNg-0001kI-7B; Mon, 23 Mar 2026 22:04:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1259620.1552972; Mon, 23 Mar 2026 22:04:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4nNg-0001kA-4f; Mon, 23 Mar 2026 22:04:16 +0000
Received: by outflank-mailman (input) for mailman id 1259620;
 Mon, 23 Mar 2026 22:04:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w4nNe-0001k2-Ik
 for xen-changelog@lists.xenproject.org; Mon, 23 Mar 2026 22:04:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4nNe-005jvL-2T
 for xen-changelog@lists.xenproject.org;
 Mon, 23 Mar 2026 22:04:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4nNe-00Awed-1i
 for xen-changelog@lists.xenproject.org;
 Mon, 23 Mar 2026 22:04:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=iO5YS9PHxt1vdyXp9LK0NbXjXyVmGVGGTbhS2uejJA4=; b=uN/B/mI3kTxs15TkJGzfnCjZKg
	4B/K1SysWaXT+q9WSbKOdgrcxnLKzVKLw0641SBQUaTQc9u9qyCaD75U+DKB697YXGV/2bHPNBVnX
	gYrT/WiTzyfncneWqAZ8d1amNCDzMCaDVWfCtUVOnegSo5tzZG+3maMmDaJscXUpgMv8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] x86/ucode: Exclude Zen6 from entrysign mitigations
Message-Id: <E1w4nNe-00Awed-1i@xenbits.xenproject.org>
Date: Mon, 23 Mar 2026 22:04:14 +0000

commit 75b97ef09bffd1674023f15e8b5d31100e675b73
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Mar 16 10:34:23 2026 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Mar 23 21:52:33 2026 +0000

    x86/ucode: Exclude Zen6 from entrysign mitigations
    
    Family 0x1a covers both Zen5 and Zen6, but the latter is not believed to be
    vulnerable to entrysign.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    (cherry picked from commit bd15fdedafb3a414aeafa918a9212148ac22ebb5)
---
 xen/arch/x86/cpu/common.c                   | 4 +++-
 xen/arch/x86/cpu/microcode/amd.c            | 6 ++++--
 xen/arch/x86/include/asm/amd.h              | 4 ++++
 xen/include/public/arch-x86/cpufeatureset.h | 1 +
 4 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c
index 130d4e2a35..94afb07e8c 100644
--- a/xen/arch/x86/cpu/common.c
+++ b/xen/arch/x86/cpu/common.c
@@ -383,7 +383,9 @@ void __init early_cpu_init(bool verbose)
 			      c->x86_capability[FEATURESET_m10Ah]);
 
 		if (max_subleaf >= 1)
-			cpuid_count(7, 1, &eax, &ebx, &ecx,
+			cpuid_count(7, 1,
+				    &c->x86_capability[FEATURESET_7a1],
+				    &ebx, &ecx,
 				    &c->x86_capability[FEATURESET_7d1]);
 	}
 
diff --git a/xen/arch/x86/cpu/microcode/amd.c b/xen/arch/x86/cpu/microcode/amd.c
index e1b931fb51..7753af1db0 100644
--- a/xen/arch/x86/cpu/microcode/amd.c
+++ b/xen/arch/x86/cpu/microcode/amd.c
@@ -20,6 +20,7 @@
 #include <xen/mm.h> /* TODO: Fix asm/tlbflush.h breakage */
 #include <xen/sha2.h>
 
+#include <asm/amd.h>
 #include <asm/msr.h>
 
 #include "private.h"
@@ -560,7 +561,7 @@ void __init ucode_probe_amd(struct microcode_ops *ops)
      * CPUs.  Taint Xen if digest checking is turned off.
      */
     if ( boot_cpu_data.x86 >= 0x17 && boot_cpu_data.x86 <= 0x1a &&
-         !opt_digest_check )
+         !is_zen6_uarch() && !opt_digest_check )
     {
         printk(XENLOG_WARNING
                "Microcode patch additional digest checks disabled\n");
@@ -601,7 +602,8 @@ void __init amd_check_entrysign(void)
 
     if ( boot_cpu_data.x86_vendor != X86_VENDOR_AMD ||
          boot_cpu_data.x86 < 0x17 ||
-         boot_cpu_data.x86 > 0x1a )
+         boot_cpu_data.x86 > 0x1a ||
+         is_zen6_uarch() )
         return;
 
     /*
diff --git a/xen/arch/x86/include/asm/amd.h b/xen/arch/x86/include/asm/amd.h
index fa4e0fc766..62dd900cc7 100644
--- a/xen/arch/x86/include/asm/amd.h
+++ b/xen/arch/x86/include/asm/amd.h
@@ -149,6 +149,8 @@
  * For Zen3 and Zen4 (Fam19h) the heuristic is the presence of AutoIBRS, as
  * it's Zen4-specific.
  *
+ * For Zen5 and Zen6 (Fam1ah) the heuristic is the presence of FRED.
+ *
  * The caller is required to perform the appropriate vendor/family checks
  * first.
  */
@@ -156,6 +158,8 @@
 #define is_zen2_uarch()   boot_cpu_has(X86_FEATURE_AMD_STIBP)
 #define is_zen3_uarch() (!boot_cpu_has(X86_FEATURE_AUTO_IBRS))
 #define is_zen4_uarch()   boot_cpu_has(X86_FEATURE_AUTO_IBRS)
+#define is_zen5_uarch() (!boot_cpu_has(X86_FEATURE_FRED))
+#define is_zen6_uarch()   boot_cpu_has(X86_FEATURE_FRED)
 
 struct cpuinfo_x86;
 int cpu_has_amd_erratum(const struct cpuinfo_x86 *cpu, int osvw_id, ...);
diff --git a/xen/include/public/arch-x86/cpufeatureset.h b/xen/include/public/arch-x86/cpufeatureset.h
index 4ea6d95c7a..d61dccc464 100644
--- a/xen/include/public/arch-x86/cpufeatureset.h
+++ b/xen/include/public/arch-x86/cpufeatureset.h
@@ -295,6 +295,7 @@ XEN_CPUFEATURE(AVX512_BF16,  10*32+ 5) /*A  AVX512 BFloat16 Instructions */
 XEN_CPUFEATURE(FZRM,         10*32+10) /*A  Fast Zero-length REP MOVSB */
 XEN_CPUFEATURE(FSRS,         10*32+11) /*A  Fast Short REP STOSB */
 XEN_CPUFEATURE(FSRCS,        10*32+12) /*A  Fast Short REP CMPSB/SCASB */
+XEN_CPUFEATURE(FRED,         10*32+17) /*   Fast Return and Event Delivery */
 XEN_CPUFEATURE(WRMSRNS,      10*32+19) /*S  WRMSR Non-Serialising */
 XEN_CPUFEATURE(AVX_IFMA,     10*32+23) /*A  AVX-IFMA Instructions */
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Mon Mar 23 23:44:11 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 23 Mar 2026 23:44:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1259863.1553193 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4owF-0007jh-4z; Mon, 23 Mar 2026 23:44:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1259863.1553193; Mon, 23 Mar 2026 23:44:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4owF-0007jZ-1K; Mon, 23 Mar 2026 23:44:03 +0000
Received: by outflank-mailman (input) for mailman id 1259863;
 Mon, 23 Mar 2026 23:44:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w4owD-0007jT-FN
 for xen-changelog@lists.xenproject.org; Mon, 23 Mar 2026 23:44:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4owD-005lwA-1h
 for xen-changelog@lists.xenproject.org;
 Mon, 23 Mar 2026 23:44:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4owD-00B3HH-0t
 for xen-changelog@lists.xenproject.org;
 Mon, 23 Mar 2026 23:44:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=dn66HrWY19p72SPSnLk+18mVu6u3xvmHaKeviuql60g=; b=dtbv+gIgfU/lFR++Or0LP1o5SF
	JkIUWZZf8pRwTVyonlrO0a5rutrY3dTa6MRHpUh8xbI/ASpxyTDhEB538wkAEvDU6BkjO7lC2pa5J
	GfRuCYcHcSVnS0xyq4Vcbp14eZCqkLP+algA59jwjooEBD46UBXsn7sUwGFjufFHlBhA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.20] x86/ucode: Exclude Zen6 from entrysign mitigations
Message-Id: <E1w4owD-00B3HH-0t@xenbits.xenproject.org>
Date: Mon, 23 Mar 2026 23:44:01 +0000

commit 4d25f6e10ebb154575b7c7494c2c416142fb2a78
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Mar 16 10:34:23 2026 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Mar 23 12:12:37 2026 +0000

    x86/ucode: Exclude Zen6 from entrysign mitigations
    
    Family 0x1a covers both Zen5 and Zen6, but the latter is not believed to be
    vulnerable to entrysign.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    (cherry picked from commit bd15fdedafb3a414aeafa918a9212148ac22ebb5)
---
 xen/arch/x86/cpu/common.c                   | 4 +++-
 xen/arch/x86/cpu/microcode/amd.c            | 6 ++++--
 xen/arch/x86/include/asm/amd.h              | 4 ++++
 xen/include/public/arch-x86/cpufeatureset.h | 1 +
 4 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c
index eb8f4ef8fe..4efa4fed32 100644
--- a/xen/arch/x86/cpu/common.c
+++ b/xen/arch/x86/cpu/common.c
@@ -382,7 +382,9 @@ void __init early_cpu_init(bool verbose)
 			      c->x86_capability[FEATURESET_m10Ah]);
 
 		if (max_subleaf >= 1)
-			cpuid_count(7, 1, &eax, &ebx, &ecx,
+			cpuid_count(7, 1,
+				    &c->x86_capability[FEATURESET_7a1],
+				    &ebx, &ecx,
 				    &c->x86_capability[FEATURESET_7d1]);
 	}
 
diff --git a/xen/arch/x86/cpu/microcode/amd.c b/xen/arch/x86/cpu/microcode/amd.c
index 995a050e52..eeb2a75fbe 100644
--- a/xen/arch/x86/cpu/microcode/amd.c
+++ b/xen/arch/x86/cpu/microcode/amd.c
@@ -20,6 +20,7 @@
 #include <xen/mm.h> /* TODO: Fix asm/tlbflush.h breakage */
 #include <xen/sha2.h>
 
+#include <asm/amd.h>
 #include <asm/msr.h>
 
 #include "private.h"
@@ -568,7 +569,7 @@ void __init ucode_probe_amd(struct microcode_ops *ops)
      * CPUs.  Taint Xen if digest checking is turned off.
      */
     if ( boot_cpu_data.x86 >= 0x17 && boot_cpu_data.x86 <= 0x1a &&
-         !opt_digest_check )
+         !is_zen6_uarch() && !opt_digest_check )
     {
         printk(XENLOG_WARNING
                "Microcode patch additional digest checks disabled\n");
@@ -609,7 +610,8 @@ void __init amd_check_entrysign(void)
 
     if ( boot_cpu_data.x86_vendor != X86_VENDOR_AMD ||
          boot_cpu_data.x86 < 0x17 ||
-         boot_cpu_data.x86 > 0x1a )
+         boot_cpu_data.x86 > 0x1a ||
+         is_zen6_uarch() )
         return;
 
     /*
diff --git a/xen/arch/x86/include/asm/amd.h b/xen/arch/x86/include/asm/amd.h
index 9c9599a622..7566526ea4 100644
--- a/xen/arch/x86/include/asm/amd.h
+++ b/xen/arch/x86/include/asm/amd.h
@@ -149,6 +149,8 @@
  * For Zen3 and Zen4 (Fam19h) the heuristic is the presence of AutoIBRS, as
  * it's Zen4-specific.
  *
+ * For Zen5 and Zen6 (Fam1ah) the heuristic is the presence of FRED.
+ *
  * The caller is required to perform the appropriate vendor/family checks
  * first.
  */
@@ -156,6 +158,8 @@
 #define is_zen2_uarch()   boot_cpu_has(X86_FEATURE_AMD_STIBP)
 #define is_zen3_uarch() (!boot_cpu_has(X86_FEATURE_AUTO_IBRS))
 #define is_zen4_uarch()   boot_cpu_has(X86_FEATURE_AUTO_IBRS)
+#define is_zen5_uarch() (!boot_cpu_has(X86_FEATURE_FRED))
+#define is_zen6_uarch()   boot_cpu_has(X86_FEATURE_FRED)
 
 struct cpuinfo_x86;
 int cpu_has_amd_erratum(const struct cpuinfo_x86 *cpu, int osvw_id, ...);
diff --git a/xen/include/public/arch-x86/cpufeatureset.h b/xen/include/public/arch-x86/cpufeatureset.h
index 4f94342ad6..618674123b 100644
--- a/xen/include/public/arch-x86/cpufeatureset.h
+++ b/xen/include/public/arch-x86/cpufeatureset.h
@@ -307,6 +307,7 @@ XEN_CPUFEATURE(CMPCCXADD,    10*32+ 7) /*a  CMPccXADD Instructions */
 XEN_CPUFEATURE(FZRM,         10*32+10) /*A  Fast Zero-length REP MOVSB */
 XEN_CPUFEATURE(FSRS,         10*32+11) /*A  Fast Short REP STOSB */
 XEN_CPUFEATURE(FSRCS,        10*32+12) /*A  Fast Short REP CMPSB/SCASB */
+XEN_CPUFEATURE(FRED,         10*32+17) /*   Fast Return and Event Delivery */
 XEN_CPUFEATURE(WRMSRNS,      10*32+19) /*S  WRMSR Non-Serialising */
 XEN_CPUFEATURE(AMX_FP16,     10*32+21) /*   AMX FP16 instruction */
 XEN_CPUFEATURE(AVX_IFMA,     10*32+23) /*A  AVX-IFMA Instructions */
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.20


From xen-changelog-bounces@lists.xenproject.org Tue Mar 24 08:22:07 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Mar 2026 08:22:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1260056.1553367 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4x1X-0005Ec-O2; Tue, 24 Mar 2026 08:22:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1260056.1553367; Tue, 24 Mar 2026 08:22:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4x1X-0005EU-LG; Tue, 24 Mar 2026 08:22:03 +0000
Received: by outflank-mailman (input) for mailman id 1260056;
 Tue, 24 Mar 2026 08:22:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w4x1W-0005EM-9W
 for xen-changelog@lists.xenproject.org; Tue, 24 Mar 2026 08:22:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4x1W-0078xG-1M
 for xen-changelog@lists.xenproject.org;
 Tue, 24 Mar 2026 08:22:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4x1W-00BdcM-0O
 for xen-changelog@lists.xenproject.org;
 Tue, 24 Mar 2026 08:22:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=/5MisOwT8xpk/C1PU6IQ7/i3PJP070g2Mqv8u4FEHXY=; b=cNW50gI8l/WLpj5jAQjnK7ZuiA
	27vnNkT7hzBPsdvPXAoU5DXHLEz3w03NQDV1X7HBRh1d57jr95ivet0ImJfs6eoMcHM892QqZ5kRT
	J0z7scXkdIg8RiA9VcjLJsDpbdyu2xXOwY/777cZLKwpbiEpZ2MHm1q4cusk3OB3O+qA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.21] x86/msr: Change rdmsr() to have normal API
Message-Id: <E1w4x1W-00BdcM-0O@xenbits.xenproject.org>
Date: Tue, 24 Mar 2026 08:22:02 +0000

commit 0a1b0b6b99c1db5cf4db55e2c2481201879e5f32
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Sat Jun 23 13:44:43 2018 +0800
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 17 12:13:49 2026 +0000

    x86/msr: Change rdmsr() to have normal API
    
    We want a consistent MSR API, and these want to be named rdmsr() and wrmsr(),
    but not with their current APIs.  The current rdmsr() flavours writing to
    their parameters by name makes code that reads like invalid C, and is
    unergonomic to use in lots of cases.
    
    Change the API, and update the callers all in one go.  Where appropriate,
    update the write side to wrmsrns() as per the recommendation.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    (cherry picked from commit ba342df56ae6ce819eb3aaf026b4837d4cf4ca0d)
---
 xen/arch/x86/acpi/cpufreq/powernow.c | 12 +++++++-----
 xen/arch/x86/cpu/amd.c               |  6 +++---
 xen/arch/x86/cpu/common.c            | 20 ++++++++++++--------
 xen/arch/x86/cpu/intel.c             | 30 +++++++++++++++---------------
 xen/arch/x86/genapic/x2apic.c        |  5 +----
 xen/arch/x86/hvm/vmx/vmcs.c          | 30 +++++++++++++++++++++++-------
 xen/arch/x86/include/asm/msr.h       | 30 ++++++++++++++++++++++++++----
 xen/arch/x86/include/asm/prot-key.h  |  6 +-----
 xen/arch/x86/tsx.c                   | 27 +++++++++++----------------
 9 files changed, 99 insertions(+), 67 deletions(-)

diff --git a/xen/arch/x86/acpi/cpufreq/powernow.c b/xen/arch/x86/acpi/cpufreq/powernow.c
index 12fca45b45..71ac0b4526 100644
--- a/xen/arch/x86/acpi/cpufreq/powernow.c
+++ b/xen/arch/x86/acpi/cpufreq/powernow.c
@@ -140,23 +140,25 @@ static int cf_check powernow_cpufreq_target(
 
 static void amd_fixup_frequency(struct xen_processor_px *px)
 {
-    u32 hi, lo, fid, did;
+    uint64_t val;
+    uint32_t fid, did;
     int index = px->control & 0x00000007;
     const struct cpuinfo_x86 *c = &current_cpu_data;
 
     if ((c->x86 != 0x10 || c->x86_model >= 10) && c->x86 != 0x11)
         return;
 
-    rdmsr(MSR_PSTATE_DEF_BASE + index, lo, hi);
+    val = rdmsr(MSR_PSTATE_DEF_BASE + index);
+
     /*
      * MSR C001_0064+:
      * Bit 63: PstateEn. Read-write. If set, the P-state is valid.
      */
-    if (!(hi & (1U << 31)))
+    if (!(val & (1UL << 63)))
         return;
 
-    fid = lo & 0x3f;
-    did = (lo >> 6) & 7;
+    fid = val & 0x3f;
+    did = (val >> 6) & 7;
     if (c->x86 == 0x10)
         px->core_frequency = (100 * (fid + 16)) >> did;
     else
diff --git a/xen/arch/x86/cpu/amd.c b/xen/arch/x86/cpu/amd.c
index b7c71ebc67..92027a8226 100644
--- a/xen/arch/x86/cpu/amd.c
+++ b/xen/arch/x86/cpu/amd.c
@@ -1360,9 +1360,9 @@ static void cf_check init_amd(struct cpuinfo_x86 *c)
 	}
 
 	if (cpu_has(c, X86_FEATURE_EFRO)) {
-		rdmsr(MSR_K8_HWCR, l, h);
-		l |= (1 << 27); /* Enable read-only APERF/MPERF bit */
-		wrmsr(MSR_K8_HWCR, l, h);
+		/* Enable read-only APERF/MPERF bit */
+		wrmsrns(MSR_K8_HWCR,
+			rdmsr(MSR_K8_HWCR) | (1 << 27));
 	}
 
 	/* Prevent TSC drift in non single-processor, single-core platforms. */
diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c
index 5869fff8f9..9d225ac8d7 100644
--- a/xen/arch/x86/cpu/common.c
+++ b/xen/arch/x86/cpu/common.c
@@ -329,6 +329,7 @@ static inline u32 phys_pkg_id(u32 cpuid_apic, int index_msb)
 void __init early_cpu_init(bool verbose)
 {
 	struct cpuinfo_x86 *c = &boot_cpu_data;
+	uint64_t val;
 	u32 eax, ebx, ecx, edx;
 
 	c->x86_cache_alignment = 32;
@@ -412,10 +413,11 @@ void __init early_cpu_init(bool verbose)
 			    &c->x86_capability[FEATURESET_7c0],
 			    &c->x86_capability[FEATURESET_7d0]);
 
-		if (test_bit(X86_FEATURE_ARCH_CAPS, c->x86_capability))
-			rdmsr(MSR_ARCH_CAPABILITIES,
-			      c->x86_capability[FEATURESET_m10Al],
-			      c->x86_capability[FEATURESET_m10Ah]);
+		if (test_bit(X86_FEATURE_ARCH_CAPS, c->x86_capability)) {
+			val = rdmsr(MSR_ARCH_CAPABILITIES);
+			c->x86_capability[FEATURESET_m10Al] = val;
+			c->x86_capability[FEATURESET_m10Ah] = val >> 32;
+		}
 
 		if (max_subleaf >= 1)
 			cpuid_count(7, 1, &eax, &ebx, &ecx,
@@ -467,6 +469,7 @@ void reset_cpuinfo(struct cpuinfo_x86 *c, bool keep_basic)
 
 static void generic_identify(struct cpuinfo_x86 *c)
 {
+	uint64_t val;
 	u32 eax, ebx, ecx, edx, tmp;
 
 	/* Get vendor name */
@@ -566,10 +569,11 @@ static void generic_identify(struct cpuinfo_x86 *c)
 			    &c->x86_capability[FEATURESET_Da1],
 			    &tmp, &tmp, &tmp);
 
-	if (test_bit(X86_FEATURE_ARCH_CAPS, c->x86_capability))
-		rdmsr(MSR_ARCH_CAPABILITIES,
-		      c->x86_capability[FEATURESET_m10Al],
-		      c->x86_capability[FEATURESET_m10Ah]);
+	if (test_bit(X86_FEATURE_ARCH_CAPS, c->x86_capability)) {
+		val = rdmsr(MSR_ARCH_CAPABILITIES);
+		c->x86_capability[FEATURESET_m10Al] = val;
+		c->x86_capability[FEATURESET_m10Ah] = val >> 32;
+	}
 }
 
 /*
diff --git a/xen/arch/x86/cpu/intel.c b/xen/arch/x86/cpu/intel.c
index b5b0b31eb9..863edac4cd 100644
--- a/xen/arch/x86/cpu/intel.c
+++ b/xen/arch/x86/cpu/intel.c
@@ -23,17 +23,17 @@ static uint32_t __ro_after_init mcu_opt_ctrl_val;
 
 void update_mcu_opt_ctrl(void)
 {
-    uint32_t mask = mcu_opt_ctrl_mask, lo, hi;
+    uint64_t mask = mcu_opt_ctrl_mask, val;
 
     if ( !mask )
         return;
 
-    rdmsr(MSR_MCU_OPT_CTRL, lo, hi);
+    val = rdmsr(MSR_MCU_OPT_CTRL);
 
-    lo &= ~mask;
-    lo |= mcu_opt_ctrl_val;
+    val &= ~mask;
+    val |= mcu_opt_ctrl_val;
 
-    wrmsr(MSR_MCU_OPT_CTRL, lo, hi);
+    wrmsrns(MSR_MCU_OPT_CTRL, val);
 }
 
 void __init set_in_mcu_opt_ctrl(uint32_t mask, uint32_t val)
@@ -51,17 +51,17 @@ static uint32_t __ro_after_init pb_opt_ctrl_val;
 
 void update_pb_opt_ctrl(void)
 {
-    uint32_t mask = pb_opt_ctrl_mask, lo, hi;
+    uint64_t mask = pb_opt_ctrl_mask, val;
 
     if ( !mask )
         return;
 
-    rdmsr(MSR_PB_OPT_CTRL, lo, hi);
+    val = rdmsr(MSR_PB_OPT_CTRL);
 
-    lo &= ~mask;
-    lo |= pb_opt_ctrl_val;
+    val &= ~mask;
+    val |= pb_opt_ctrl_val;
 
-    wrmsr(MSR_PB_OPT_CTRL, lo, hi);
+    wrmsrns(MSR_PB_OPT_CTRL, val);
 }
 
 void __init set_in_pb_opt_ctrl(uint32_t mask, uint32_t val)
@@ -456,15 +456,15 @@ static void __init probe_mwait_errata(void)
  */
 static void Intel_errata_workarounds(struct cpuinfo_x86 *c)
 {
-	unsigned long lo, hi;
+	uint64_t val;
 
 	if ((c->x86 == 15) && (c->x86_model == 1) && (c->x86_mask == 1)) {
-		rdmsr (MSR_IA32_MISC_ENABLE, lo, hi);
-		if ((lo & (1<<9)) == 0) {
+		val = rdmsr(MSR_IA32_MISC_ENABLE);
+		if ((val & (1 << 9)) == 0) {
 			printk (KERN_INFO "CPU: C0 stepping P4 Xeon detected.\n");
 			printk (KERN_INFO "CPU: Disabling hardware prefetching (Errata 037)\n");
-			lo |= (1<<9);	/* Disable hw prefetching */
-			wrmsr (MSR_IA32_MISC_ENABLE, lo, hi);
+			val |= (1 << 9); /* Disable hw prefetching */
+			wrmsrns(MSR_IA32_MISC_ENABLE, val);
 		}
 	}
 
diff --git a/xen/arch/x86/genapic/x2apic.c b/xen/arch/x86/genapic/x2apic.c
index 1d55eb6b8a..58157c217e 100644
--- a/xen/arch/x86/genapic/x2apic.c
+++ b/xen/arch/x86/genapic/x2apic.c
@@ -268,14 +268,11 @@ const struct genapic *__init apic_x2apic_probe(void)
 
 void __init check_x2apic_preenabled(void)
 {
-    u32 lo, hi;
-
     if ( !cpu_has_x2apic )
         return;
 
     /* Check whether x2apic mode was already enabled by the BIOS. */
-    rdmsr(MSR_APIC_BASE, lo, hi);
-    if ( lo & APIC_BASE_EXTD )
+    if ( rdmsr(MSR_APIC_BASE) & APIC_BASE_EXTD )
     {
         printk("x2APIC mode is already enabled by BIOS.\n");
         x2apic_enabled = 1;
diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c
index ab8b1c87ec..b639818b6e 100644
--- a/xen/arch/x86/hvm/vmx/vmcs.c
+++ b/xen/arch/x86/hvm/vmx/vmcs.c
@@ -207,9 +207,13 @@ static void __init vmx_display_features(void)
 static u32 adjust_vmx_controls(
     const char *name, u32 ctl_min, u32 ctl_opt, u32 msr, bool *mismatch)
 {
+    uint64_t val;
     u32 vmx_msr_low, vmx_msr_high, ctl = ctl_min | ctl_opt;
 
-    rdmsr(msr, vmx_msr_low, vmx_msr_high);
+    val = rdmsr(msr);
+
+    vmx_msr_low = val;
+    vmx_msr_high = val >> 32;
 
     ctl &= vmx_msr_high; /* bit == 0 in high word ==> must be zero */
     ctl |= vmx_msr_low;  /* bit == 1 in low word  ==> must be one  */
@@ -258,10 +262,13 @@ static int vmx_init_vmcs_config(bool bsp)
 {
     u32 vmx_basic_msr_low, vmx_basic_msr_high, min, opt;
     struct vmx_caps caps = {};
-    u64 _vmx_misc_cap = 0;
+    uint64_t _vmx_misc_cap = 0, val;
     bool mismatch = false;
 
-    rdmsr(MSR_IA32_VMX_BASIC, vmx_basic_msr_low, vmx_basic_msr_high);
+    val = rdmsr(MSR_IA32_VMX_BASIC);
+
+    vmx_basic_msr_low = val;
+    vmx_basic_msr_high = val >> 32;
 
     min = (PIN_BASED_EXT_INTR_MASK |
            PIN_BASED_NMI_EXITING);
@@ -366,7 +373,10 @@ static int vmx_init_vmcs_config(bool bsp)
     if ( caps.secondary_exec_control & (SECONDARY_EXEC_ENABLE_EPT |
                                         SECONDARY_EXEC_ENABLE_VPID) )
     {
-        rdmsr(MSR_IA32_VMX_EPT_VPID_CAP, caps.ept, caps.vpid);
+        val = rdmsr(MSR_IA32_VMX_EPT_VPID_CAP);
+
+        caps.ept = val;
+        caps.vpid = val >> 32;
 
         if ( !opt_ept_ad )
             caps.ept &= ~VMX_EPT_AD_BIT;
@@ -408,9 +418,15 @@ static int vmx_init_vmcs_config(bool bsp)
          * We check VMX_BASIC_MSR[55] to correctly handle default controls.
          */
         uint32_t must_be_one, must_be_zero, msr = MSR_IA32_VMX_PROCBASED_CTLS;
+
         if ( vmx_basic_msr_high & (VMX_BASIC_DEFAULT1_ZERO >> 32) )
             msr = MSR_IA32_VMX_TRUE_PROCBASED_CTLS;
-        rdmsr(msr, must_be_one, must_be_zero);
+
+        val = rdmsr(msr);
+
+        must_be_one = val;
+        must_be_zero = val >> 32;
+
         if ( must_be_one & (CPU_BASED_INVLPG_EXITING |
                             CPU_BASED_CR3_LOAD_EXITING |
                             CPU_BASED_CR3_STORE_EXITING) )
@@ -699,7 +715,7 @@ void cf_check vmx_cpu_dead(unsigned int cpu)
 
 static int _vmx_cpu_up(bool bsp)
 {
-    u32 eax, edx;
+    uint32_t eax;
     int rc, bios_locked, cpu = smp_processor_id();
     u64 cr0, vmx_cr0_fixed0, vmx_cr0_fixed1;
 
@@ -719,7 +735,7 @@ static int _vmx_cpu_up(bool bsp)
         return -EINVAL;
     }
 
-    rdmsr(MSR_IA32_FEATURE_CONTROL, eax, edx);
+    eax = rdmsr(MSR_IA32_FEATURE_CONTROL);
 
     bios_locked = !!(eax & IA32_FEATURE_CONTROL_LOCK);
     if ( bios_locked )
diff --git a/xen/arch/x86/include/asm/msr.h b/xen/arch/x86/include/asm/msr.h
index 901770555b..188a50f9ce 100644
--- a/xen/arch/x86/include/asm/msr.h
+++ b/xen/arch/x86/include/asm/msr.h
@@ -9,10 +9,32 @@
 #include <asm/asm_defns.h>
 #include <asm/msr-index.h>
 
-#define rdmsr(msr,val1,val2) \
-     __asm__ __volatile__("rdmsr" \
-			  : "=a" (val1), "=d" (val2) \
-			  : "c" (msr))
+/*
+ * MSR APIs.  Most logic is expected to use:
+ *
+ *   uint64_t foo = rdmsr(MSR_BAR);
+ *   wrmsrns(MSR_BAR, foo);
+ *
+ * In addition, *_safe() wrappers exist to cope gracefully with a #GP.
+ *
+ *
+ * All legacy forms are to be phased out:
+ *
+ *  rdmsrl(MSR_FOO, val);
+ *  wrmsr(MSR_FOO, lo, hi);
+ *  wrmsrl(MSR_FOO, val);
+ */
+
+static always_inline uint64_t rdmsr(unsigned int msr)
+{
+    unsigned long lo, hi;
+
+    asm volatile ( "rdmsr"
+                   : "=a" (lo), "=d" (hi)
+                   : "c" (msr) );
+
+    return (hi << 32) | lo;
+}
 
 #define rdmsrl(msr,val) do { unsigned long a__,b__; \
        __asm__ __volatile__("rdmsr" \
diff --git a/xen/arch/x86/include/asm/prot-key.h b/xen/arch/x86/include/asm/prot-key.h
index 3e9c2eaef4..8fb15b5c32 100644
--- a/xen/arch/x86/include/asm/prot-key.h
+++ b/xen/arch/x86/include/asm/prot-key.h
@@ -52,11 +52,7 @@ DECLARE_PER_CPU(uint32_t, pkrs);
 
 static inline uint32_t rdpkrs(void)
 {
-    uint32_t pkrs, tmp;
-
-    rdmsr(MSR_PKRS, pkrs, tmp);
-
-    return pkrs;
+    return rdmsr(MSR_PKRS);
 }
 
 static inline uint32_t rdpkrs_and_cache(void)
diff --git a/xen/arch/x86/tsx.c b/xen/arch/x86/tsx.c
index 2a0c7c08a2..fe9f0ab4f7 100644
--- a/xen/arch/x86/tsx.c
+++ b/xen/arch/x86/tsx.c
@@ -42,6 +42,8 @@ void tsx_init(void)
 {
     static bool __read_mostly once;
 
+    uint64_t val;
+
     /*
      * This function is first called between microcode being loaded, and
      * CPUID being scanned generally. early_cpu_init() has already prepared
@@ -62,8 +64,6 @@ void tsx_init(void)
              * On a TAA-vulnerable or later part with at least the May 2020
              * microcode mitigating SRBDS.
              */
-            uint64_t val;
-
             rdmsrl(MSR_MCU_OPT_CTRL, val);
 
             /*
@@ -118,8 +118,6 @@ void tsx_init(void)
 
         if ( cpu_has_tsx_force_abort )
         {
-            uint64_t val;
-
             /*
              * On an early TSX-enabled Skylake part subject to the memory
              * ordering erratum, with at least the March 2019 microcode.
@@ -250,18 +248,17 @@ void tsx_init(void)
          *    controlled, we have or will set MSR_MCU_OPT_CTRL.RTM_ALLOW to
          *    let TSX_CTRL.RTM_DISABLE be usable.
          */
-        uint32_t hi, lo;
 
-        rdmsr(MSR_TSX_CTRL, lo, hi);
+        val = rdmsr(MSR_TSX_CTRL);
 
         /* Check bottom bit only.  Higher bits are various sentinels. */
         rtm_disabled = !(opt_tsx & 1);
 
-        lo &= ~(TSX_CTRL_RTM_DISABLE | TSX_CTRL_CPUID_CLEAR);
+        val &= ~(TSX_CTRL_RTM_DISABLE | TSX_CTRL_CPUID_CLEAR);
         if ( rtm_disabled )
-            lo |= TSX_CTRL_RTM_DISABLE | TSX_CTRL_CPUID_CLEAR;
+            val |= TSX_CTRL_RTM_DISABLE | TSX_CTRL_CPUID_CLEAR;
 
-        wrmsr(MSR_TSX_CTRL, lo, hi);
+        wrmsrns(MSR_TSX_CTRL, val);
     }
     else if ( cpu_has_tsx_force_abort )
     {
@@ -269,14 +266,12 @@ void tsx_init(void)
          * On an early TSX-enable Skylake part subject to the memory ordering
          * erratum, with at least the March 2019 microcode.
          */
-        uint32_t hi, lo;
-
-        rdmsr(MSR_TSX_FORCE_ABORT, lo, hi);
+        val = rdmsr(MSR_TSX_FORCE_ABORT);
 
         /* Check bottom bit only.  Higher bits are various sentinels. */
         rtm_disabled = !(opt_tsx & 1);
 
-        lo &= ~(TSX_FORCE_ABORT_RTM | TSX_CPUID_CLEAR | TSX_ENABLE_RTM);
+        val &= ~(TSX_FORCE_ABORT_RTM | TSX_CPUID_CLEAR | TSX_ENABLE_RTM);
 
         if ( cpu_has_rtm_always_abort )
         {
@@ -291,7 +286,7 @@ void tsx_init(void)
              *  - TSX_FORCE_ABORT.ENABLE_RTM may be used to opt in to
              *    re-enabling RTM, at the users own risk.
              */
-            lo |= rtm_disabled ? TSX_CPUID_CLEAR : TSX_ENABLE_RTM;
+            val |= rtm_disabled ? TSX_CPUID_CLEAR : TSX_ENABLE_RTM;
         }
         else
         {
@@ -304,10 +299,10 @@ void tsx_init(void)
              *    setting TSX_FORCE_ABORT.FORCE_ABORT_RTM.
              */
             if ( rtm_disabled )
-                lo |= TSX_FORCE_ABORT_RTM;
+                val |= TSX_FORCE_ABORT_RTM;
         }
 
-        wrmsr(MSR_TSX_FORCE_ABORT, lo, hi);
+        wrmsrns(MSR_TSX_FORCE_ABORT, val);
     }
     else if ( opt_tsx >= 0 )
         printk_once(XENLOG_WARNING
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.21


From xen-changelog-bounces@lists.xenproject.org Tue Mar 24 08:22:13 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Mar 2026 08:22:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1260057.1553372 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4x1h-0005Gk-Pv; Tue, 24 Mar 2026 08:22:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1260057.1553372; Tue, 24 Mar 2026 08:22:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4x1h-0005Ga-Mk; Tue, 24 Mar 2026 08:22:13 +0000
Received: by outflank-mailman (input) for mailman id 1260057;
 Tue, 24 Mar 2026 08:22:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w4x1g-0005Fv-BA
 for xen-changelog@lists.xenproject.org; Tue, 24 Mar 2026 08:22:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4x1g-0078xN-1g
 for xen-changelog@lists.xenproject.org;
 Tue, 24 Mar 2026 08:22:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4x1g-00Bdcx-0s
 for xen-changelog@lists.xenproject.org;
 Tue, 24 Mar 2026 08:22:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=IBDxet25p7f0+LTOC/9wr8mnLv+pqBrOvuSw8BE9RD8=; b=HyjeQVKzVjkSGCG4pmKwgqSOxz
	CUjoIaQChDCuh1z5rNedJ+ooS0POBUW89yfMNFeYQ4QIvfFxxAfZddkGHwxieF9PulOKH5wvxLuSw
	2Z/ucm7l0+kvg5XNbrvMxJaQcEsGONYS6GM8Oplwg8QJgIosIv5v+oP2xCFg7iYAhGL8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.21] x86/msr: Change wrmsr() to take a single parameter
Message-Id: <E1w4x1g-00Bdcx-0s@xenbits.xenproject.org>
Date: Tue, 24 Mar 2026 08:22:12 +0000

commit 6966336691bcbf1a57c66d87369d2f58654d4e81
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Jun 22 12:25:41 2018 +0800
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 17 12:13:49 2026 +0000

    x86/msr: Change wrmsr() to take a single parameter
    
    Mirroring the cleanup to rdmsr(), do the same to wrmsr().  It now has the same
    API as wrmsrl(), but we'll want to drop that wrapper in due course.
    
    It's telling that almost all remaining users pass in 0.  Most are converted
    directly to WRMSRNS, but a few are not.
    
    MSR_VIRT_SPEC_CTRL is unconditionally intercepted and is orders of magnitude
    more expensive than just serialising.  In disable_lapic_nmi_watchdog(), the P4
    case won't run on hardware which has anything more than plain WRMSR.
    
    For CTR_WRITE() in op_model_athlon.c there is a logical change in behaviour,
    but it's fixing a bug.  Peformance counters typically get written to -(count)
    as they generate an interrupt on overflow.  The performance counters even in
    the K8 were 48 bits wide, and this wrmsr() not being a wrmsrl() appears to
    have been an oversight in commit b5103d692aa7 ("x86 oprofile: use
    rdmsrl/wrmsrl") which converted all other users, and appears to be the last
    time there was an attempt to unify the MSR APIs.
    
    No practical change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    (cherry picked from commit 389347a75fbd28c58518d2a0fdaa0af4429ada5f)
---
 xen/arch/x86/cpu/amd.c                  |  2 +-
 xen/arch/x86/hvm/vmx/vmcs.c             |  2 +-
 xen/arch/x86/include/asm/msr.h          | 20 ++++++++++----------
 xen/arch/x86/nmi.c                      | 18 +++++++++---------
 xen/arch/x86/oprofile/op_model_athlon.c |  2 +-
 5 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/xen/arch/x86/cpu/amd.c b/xen/arch/x86/cpu/amd.c
index 92027a8226..8c55d233f3 100644
--- a/xen/arch/x86/cpu/amd.c
+++ b/xen/arch/x86/cpu/amd.c
@@ -895,7 +895,7 @@ void amd_set_legacy_ssbd(bool enable)
 		return;
 
 	if (cpu_has_virt_ssbd)
-		wrmsr(MSR_VIRT_SPEC_CTRL, enable ? SPEC_CTRL_SSBD : 0, 0);
+		wrmsr(MSR_VIRT_SPEC_CTRL, enable ? SPEC_CTRL_SSBD : 0);
 	else if (amd_legacy_ssbd)
 		core_set_legacy_ssbd(enable);
 	else
diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c
index b639818b6e..cd5ac8a5f0 100644
--- a/xen/arch/x86/hvm/vmx/vmcs.c
+++ b/xen/arch/x86/hvm/vmx/vmcs.c
@@ -754,7 +754,7 @@ static int _vmx_cpu_up(bool bsp)
         eax |= IA32_FEATURE_CONTROL_ENABLE_VMXON_OUTSIDE_SMX;
         if ( test_bit(X86_FEATURE_SMX, &boot_cpu_data.x86_capability) )
             eax |= IA32_FEATURE_CONTROL_ENABLE_VMXON_INSIDE_SMX;
-        wrmsr(MSR_IA32_FEATURE_CONTROL, eax, 0);
+        wrmsrns(MSR_IA32_FEATURE_CONTROL, eax);
     }
 
     if ( (rc = vmx_init_vmcs_config(bsp)) != 0 )
diff --git a/xen/arch/x86/include/asm/msr.h b/xen/arch/x86/include/asm/msr.h
index 188a50f9ce..941a7612f4 100644
--- a/xen/arch/x86/include/asm/msr.h
+++ b/xen/arch/x86/include/asm/msr.h
@@ -15,13 +15,17 @@
  *   uint64_t foo = rdmsr(MSR_BAR);
  *   wrmsrns(MSR_BAR, foo);
  *
+ * and, if architectural serialisaition is necessary, or there are other
+ * reasons that WRMSRNS is inapplicable, then:
+ *
+ *   wrmsr(MSR_BAR, foo);
+ *
  * In addition, *_safe() wrappers exist to cope gracefully with a #GP.
  *
  *
  * All legacy forms are to be phased out:
  *
  *  rdmsrl(MSR_FOO, val);
- *  wrmsr(MSR_FOO, lo, hi);
  *  wrmsrl(MSR_FOO, val);
  */
 
@@ -43,17 +47,13 @@ static always_inline uint64_t rdmsr(unsigned int msr)
        val = a__ | ((u64)b__<<32); \
 } while(0)
 
-#define wrmsr(msr,val1,val2) \
-     __asm__ __volatile__("wrmsr" \
-			  : /* no outputs */ \
-			  : "c" (msr), "a" (val1), "d" (val2))
-
-static inline void wrmsrl(unsigned int msr, uint64_t val)
+static inline void wrmsr(unsigned int msr, uint64_t val)
 {
-        uint32_t lo = val, hi = val >> 32;
+    uint32_t lo = val, hi = val >> 32;
 
-        wrmsr(msr, lo, hi);
+    asm volatile ( "wrmsr" :: "a" (lo), "d" (hi), "c" (msr) );
 }
+#define wrmsrl(msr, val) wrmsr(msr, val)
 
 /* Non-serialising WRMSR, when available.  Falls back to a serialising WRMSR. */
 static inline void wrmsrns(uint32_t msr, uint64_t val)
@@ -150,7 +150,7 @@ static inline void wrmsr_tsc_aux(uint32_t val)
 
     if ( *this_tsc_aux != val )
     {
-        wrmsr(MSR_TSC_AUX, val, 0);
+        wrmsrns(MSR_TSC_AUX, val);
         *this_tsc_aux = val;
     }
 }
diff --git a/xen/arch/x86/nmi.c b/xen/arch/x86/nmi.c
index 9793fa2316..a0c9194ff0 100644
--- a/xen/arch/x86/nmi.c
+++ b/xen/arch/x86/nmi.c
@@ -218,16 +218,16 @@ void disable_lapic_nmi_watchdog(void)
         return;
     switch (boot_cpu_data.x86_vendor) {
     case X86_VENDOR_AMD:
-        wrmsr(MSR_K7_EVNTSEL0, 0, 0);
+        wrmsrns(MSR_K7_EVNTSEL0, 0);
         break;
     case X86_VENDOR_INTEL:
         switch (boot_cpu_data.x86) {
         case 6:
-            wrmsr(MSR_P6_EVNTSEL(0), 0, 0);
+            wrmsrns(MSR_P6_EVNTSEL(0), 0);
             break;
         case 15:
-            wrmsr(MSR_P4_IQ_CCCR0, 0, 0);
-            wrmsr(MSR_P4_CRU_ESCR0, 0, 0);
+            wrmsr(MSR_P4_IQ_CCCR0, 0);
+            wrmsr(MSR_P4_CRU_ESCR0, 0);
             break;
         }
         break;
@@ -282,7 +282,7 @@ static void clear_msr_range(unsigned int base, unsigned int n)
     unsigned int i;
 
     for (i = 0; i < n; i++)
-        wrmsr(base+i, 0, 0);
+        wrmsrns(base + i, 0);
 }
 
 static inline void write_watchdog_counter(const char *descr)
@@ -308,11 +308,11 @@ static void setup_k7_watchdog(void)
         | K7_EVNTSEL_USR
         | K7_NMI_EVENT;
 
-    wrmsr(MSR_K7_EVNTSEL0, evntsel, 0);
+    wrmsrns(MSR_K7_EVNTSEL0, evntsel);
     write_watchdog_counter("K7_PERFCTR0");
     apic_write(APIC_LVTPC, APIC_DM_NMI);
     evntsel |= K7_EVNTSEL_ENABLE;
-    wrmsr(MSR_K7_EVNTSEL0, evntsel, 0);
+    wrmsrns(MSR_K7_EVNTSEL0, evntsel);
 }
 
 static void setup_p6_watchdog(unsigned counter)
@@ -338,11 +338,11 @@ static void setup_p6_watchdog(unsigned counter)
         | P6_EVNTSEL_USR
         | counter;
 
-    wrmsr(MSR_P6_EVNTSEL(0), evntsel, 0);
+    wrmsrns(MSR_P6_EVNTSEL(0), evntsel);
     write_watchdog_counter("P6_PERFCTR0");
     apic_write(APIC_LVTPC, APIC_DM_NMI);
     evntsel |= P6_EVNTSEL0_ENABLE;
-    wrmsr(MSR_P6_EVNTSEL(0), evntsel, 0);
+    wrmsrns(MSR_P6_EVNTSEL(0), evntsel);
 }
 
 static void setup_p4_watchdog(void)
diff --git a/xen/arch/x86/oprofile/op_model_athlon.c b/xen/arch/x86/oprofile/op_model_athlon.c
index bf897a4b63..4c016624a6 100644
--- a/xen/arch/x86/oprofile/op_model_athlon.c
+++ b/xen/arch/x86/oprofile/op_model_athlon.c
@@ -34,7 +34,7 @@
 #define MAX_COUNTERS FAM15H_NUM_COUNTERS
 
 #define CTR_READ(msr_content,msrs,c) do {rdmsrl(msrs->counters[(c)].addr, (msr_content));} while (0)
-#define CTR_WRITE(l,msrs,c) do {wrmsr(msrs->counters[(c)].addr, -(unsigned int)(l), -1);} while (0)
+#define CTR_WRITE(l,msrs,c) wrmsr(msrs->counters[(c)].addr, -(l))
 #define CTR_OVERFLOWED(n) (!((n) & (1ULL<<31)))
 
 #define CTRL_READ(msr_content,msrs,c) do {rdmsrl(msrs->controls[(c)].addr, (msr_content));} while (0)
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.21


From xen-changelog-bounces@lists.xenproject.org Tue Mar 24 08:22:23 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Mar 2026 08:22:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1260058.1553375 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4x1r-0005JF-Qs; Tue, 24 Mar 2026 08:22:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1260058.1553375; Tue, 24 Mar 2026 08:22:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4x1r-0005J7-OE; Tue, 24 Mar 2026 08:22:23 +0000
Received: by outflank-mailman (input) for mailman id 1260058;
 Tue, 24 Mar 2026 08:22:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w4x1q-0005Iw-E1
 for xen-changelog@lists.xenproject.org; Tue, 24 Mar 2026 08:22:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4x1q-0078xX-1z
 for xen-changelog@lists.xenproject.org;
 Tue, 24 Mar 2026 08:22:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4x1q-00Bddj-1B
 for xen-changelog@lists.xenproject.org;
 Tue, 24 Mar 2026 08:22:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=fNYAGl+UbsPLCjNifnwQqn0iRRsuf9nNNp0O9Ea4WaA=; b=eJymcWNmAYemW5PBxAFsqysZuh
	pByHxjAJqsjiPnd44Vj6RvIvkMUw9IUcSfvlH9BRY83ry6+U7YKKPI1JERCRZUNtX5Oq793/N0Ml6
	BzCz18WRLeCRSGmZwBakPqDgUFPJ+YoAwuTFR7ZEZtmqGJx3/7nznpikPNj6eWUWasKQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.21] x86/fsgsbase: Split out __{rd,wr}gs_shadow() helpers
Message-Id: <E1w4x1q-00Bddj-1B@xenbits.xenproject.org>
Date: Tue, 24 Mar 2026 08:22:22 +0000

commit 0a1441643041813b7b34bb35329b0c53b6935e43
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Aug 14 14:32:03 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 17 12:13:49 2026 +0000

    x86/fsgsbase: Split out __{rd,wr}gs_shadow() helpers
    
    Right now they're inline in {read,write}_gs_shadow(), but we're going to need
    to use these elsewhere to support FRED.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    (cherry picked from commit 9900679fa92596660d7d571113d98a6abfd95141)
---
 xen/arch/x86/include/asm/fsgsbase.h | 36 +++++++++++++++++++++++-------------
 1 file changed, 23 insertions(+), 13 deletions(-)

diff --git a/xen/arch/x86/include/asm/fsgsbase.h b/xen/arch/x86/include/asm/fsgsbase.h
index 03e6a85d31..5577038426 100644
--- a/xen/arch/x86/include/asm/fsgsbase.h
+++ b/xen/arch/x86/include/asm/fsgsbase.h
@@ -32,6 +32,17 @@ static inline unsigned long __rdgsbase(void)
     return base;
 }
 
+static inline unsigned long __rdgs_shadow(void)
+{
+    unsigned long base;
+
+    asm_inline volatile ( "swapgs\n\t"
+                          "rdgsbase %0\n\t"
+                          "swapgs" : "=r" (base) );
+
+    return base;
+}
+
 static inline void __wrfsbase(unsigned long base)
 {
     asm volatile ( "wrfsbase %0" :: "r" (base) );
@@ -42,6 +53,14 @@ static inline void __wrgsbase(unsigned long base)
     asm volatile ( "wrgsbase %0" :: "r" (base) );
 }
 
+static inline void __wrgs_shadow(unsigned long base)
+{
+    asm_inline volatile ( "swapgs\n\t"
+                          "wrgsbase %0\n\t"
+                          "swapgs"
+                          :: "r" (base) );
+}
+
 static inline unsigned long read_fs_base(void)
 {
     unsigned long base;
@@ -71,13 +90,9 @@ static inline unsigned long read_gs_shadow(void)
     unsigned long base;
 
     if ( read_cr4() & X86_CR4_FSGSBASE )
-    {
-        asm volatile ( "swapgs" );
-        base = __rdgsbase();
-        asm volatile ( "swapgs" );
-    }
-    else
-        rdmsrl(MSR_SHADOW_GS_BASE, base);
+        return __rdgs_shadow();
+
+    rdmsrl(MSR_SHADOW_GS_BASE, base);
 
     return base;
 }
@@ -101,12 +116,7 @@ static inline void write_gs_base(unsigned long base)
 static inline void write_gs_shadow(unsigned long base)
 {
     if ( read_cr4() & X86_CR4_FSGSBASE )
-    {
-        asm volatile ( "swapgs\n\t"
-                       "wrgsbase %0\n\t"
-                       "swapgs"
-                       :: "r" (base) );
-    }
+        __wrgs_shadow(base);
     else
         wrmsrl(MSR_SHADOW_GS_BASE, base);
 }
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.21


From xen-changelog-bounces@lists.xenproject.org Tue Mar 24 08:22:33 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Mar 2026 08:22:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1260059.1553379 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4x21-0005Lz-U9; Tue, 24 Mar 2026 08:22:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1260059.1553379; Tue, 24 Mar 2026 08:22:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4x21-0005Lq-RD; Tue, 24 Mar 2026 08:22:33 +0000
Received: by outflank-mailman (input) for mailman id 1260059;
 Tue, 24 Mar 2026 08:22:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w4x20-0005Lg-Hf
 for xen-changelog@lists.xenproject.org; Tue, 24 Mar 2026 08:22:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4x20-0078xu-2I
 for xen-changelog@lists.xenproject.org;
 Tue, 24 Mar 2026 08:22:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4x20-00BdeH-1V
 for xen-changelog@lists.xenproject.org;
 Tue, 24 Mar 2026 08:22:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=xETCyINFng+h3Ps64qeMGrP6T9VkaJpiTu6MH8AZaz8=; b=CjV0HqTVbSR2RyD9OmVW3xmNrm
	mlWYUqAHt4AFSBazamm3VKorNBeMMW6zdXSJsrx6rj0YviGce1i1S1bjYH79yNIfnfJ5ZI+8S6WFR
	KwcspLf2fVnUzJuP7Wn3yTsmOfeweicE4+KoKCzo0a+dRM0qVHefaKKJ6dbs9OdMOaVU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.21] x86/fsgsbase: Update fs/gs helpers to use wrmsrns()
Message-Id: <E1w4x20-00BdeH-1V@xenbits.xenproject.org>
Date: Tue, 24 Mar 2026 08:22:32 +0000

commit 447a046a439aea36a66ce1ea21bad96c21940ac1
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Aug 14 15:26:56 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 17 12:13:49 2026 +0000

    x86/fsgsbase: Update fs/gs helpers to use wrmsrns()
    
    ... and rdmsr() while here.
    
    Most of these accesses are in fastpaths and do not need serialising behaviour,
    but the write side is serialising on all Intel hardware as well as older AMD
    hardware.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    (cherry picked from commit 6b448a92a367839386994def3209c079fc98fe68)
---
 xen/arch/x86/domain.c               | 10 +++++-----
 xen/arch/x86/hvm/vmx/vmx.c          |  4 ++--
 xen/arch/x86/include/asm/fsgsbase.h | 30 +++++++++---------------------
 3 files changed, 16 insertions(+), 28 deletions(-)

diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index d488f08aff..7d74414ada 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -1847,9 +1847,9 @@ static void load_segments(struct vcpu *n)
         }
         else
         {
-            wrmsrl(MSR_FS_BASE, n->arch.pv.fs_base);
-            wrmsrl(MSR_GS_BASE, gsb);
-            wrmsrl(MSR_SHADOW_GS_BASE, gss);
+            wrmsrns(MSR_FS_BASE, n->arch.pv.fs_base);
+            wrmsrns(MSR_GS_BASE, gsb);
+            wrmsrns(MSR_SHADOW_GS_BASE, gss);
         }
     }
 
@@ -1974,8 +1974,8 @@ static void save_segments(struct vcpu *v)
         }
         else
         {
-            rdmsrl(MSR_FS_BASE, fs_base);
-            rdmsrl(MSR_GS_BASE, gs_base);
+            fs_base = rdmsr(MSR_FS_BASE);
+            gs_base = rdmsr(MSR_GS_BASE);
         }
 
         v->arch.pv.fs_base = fs_base;
diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index a4f606720f..1d464324ec 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -2737,8 +2737,8 @@ static uint64_t cf_check vmx_get_reg(struct vcpu *v, unsigned int reg)
     case MSR_SHADOW_GS_BASE:
         if ( v != curr )
             return v->arch.hvm.vmx.shadow_gs;
-        rdmsrl(MSR_SHADOW_GS_BASE, val);
-        return val;
+        else
+            return rdmsr(MSR_SHADOW_GS_BASE);
     }
 
     /* Logic which maybe requires remote VMCS acquisition. */
diff --git a/xen/arch/x86/include/asm/fsgsbase.h b/xen/arch/x86/include/asm/fsgsbase.h
index 5577038426..24862a6bfe 100644
--- a/xen/arch/x86/include/asm/fsgsbase.h
+++ b/xen/arch/x86/include/asm/fsgsbase.h
@@ -63,38 +63,26 @@ static inline void __wrgs_shadow(unsigned long base)
 
 static inline unsigned long read_fs_base(void)
 {
-    unsigned long base;
-
     if ( read_cr4() & X86_CR4_FSGSBASE )
         return __rdfsbase();
-
-    rdmsrl(MSR_FS_BASE, base);
-
-    return base;
+    else
+        return rdmsr(MSR_FS_BASE);
 }
 
 static inline unsigned long read_gs_base(void)
 {
-    unsigned long base;
-
     if ( read_cr4() & X86_CR4_FSGSBASE )
         return __rdgsbase();
-
-    rdmsrl(MSR_GS_BASE, base);
-
-    return base;
+    else
+        return rdmsr(MSR_GS_BASE);
 }
 
 static inline unsigned long read_gs_shadow(void)
 {
-    unsigned long base;
-
     if ( read_cr4() & X86_CR4_FSGSBASE )
         return __rdgs_shadow();
-
-    rdmsrl(MSR_SHADOW_GS_BASE, base);
-
-    return base;
+    else
+        return rdmsr(MSR_SHADOW_GS_BASE);
 }
 
 static inline void write_fs_base(unsigned long base)
@@ -102,7 +90,7 @@ static inline void write_fs_base(unsigned long base)
     if ( read_cr4() & X86_CR4_FSGSBASE )
         __wrfsbase(base);
     else
-        wrmsrl(MSR_FS_BASE, base);
+        wrmsrns(MSR_FS_BASE, base);
 }
 
 static inline void write_gs_base(unsigned long base)
@@ -110,7 +98,7 @@ static inline void write_gs_base(unsigned long base)
     if ( read_cr4() & X86_CR4_FSGSBASE )
         __wrgsbase(base);
     else
-        wrmsrl(MSR_GS_BASE, base);
+        wrmsrns(MSR_GS_BASE, base);
 }
 
 static inline void write_gs_shadow(unsigned long base)
@@ -118,7 +106,7 @@ static inline void write_gs_shadow(unsigned long base)
     if ( read_cr4() & X86_CR4_FSGSBASE )
         __wrgs_shadow(base);
     else
-        wrmsrl(MSR_SHADOW_GS_BASE, base);
+        wrmsrns(MSR_SHADOW_GS_BASE, base);
 }
 
 #endif /* X86_FSGSBASE_H */
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.21


From xen-changelog-bounces@lists.xenproject.org Tue Mar 24 08:22:43 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Mar 2026 08:22:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1260060.1553383 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4x2B-0005O1-VD; Tue, 24 Mar 2026 08:22:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1260060.1553383; Tue, 24 Mar 2026 08:22:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4x2B-0005Nt-Sb; Tue, 24 Mar 2026 08:22:43 +0000
Received: by outflank-mailman (input) for mailman id 1260060;
 Tue, 24 Mar 2026 08:22:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w4x2A-0005Nl-MA
 for xen-changelog@lists.xenproject.org; Tue, 24 Mar 2026 08:22:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4x2A-0078y1-2c
 for xen-changelog@lists.xenproject.org;
 Tue, 24 Mar 2026 08:22:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4x2A-00Bdez-1n
 for xen-changelog@lists.xenproject.org;
 Tue, 24 Mar 2026 08:22:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=6jSckQZHzQWoJ9i7dnB2LTAgsU3icecfWSPbzwdvVq0=; b=rQN+4gpfCjDLDU281SoGkJmNtg
	sdUokb82NTd9nzhu2jOz78cnO3qnQxdHEEVKXaWgxvTCQiu0G//C4uSctCzHn0cR2mshKqoGZYuNr
	FYNs+dPVC8JKJdgCqZ+FbSTN0MJzSqizuzx1is31R3pX3tFFW2USwUe3RICQuUG3R4Ck=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.21] x86/fsgsbase: Improve code generation in read_registers()
Message-Id: <E1w4x2A-00Bdez-1n@xenbits.xenproject.org>
Date: Tue, 24 Mar 2026 08:22:42 +0000

commit e1d84ea373de0d9bf4195cbf29d9fcf46c02d1ca
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Aug 12 12:48:06 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 17 12:13:49 2026 +0000

    x86/fsgsbase: Improve code generation in read_registers()
    
    It turns out that using the higher level helpers adjacent like this leads to
    terrible code generation.  Due to -fno-strict-aliasing, the store into state
    invalidates the read_cr4() address calculation (which is really cpu_info->cr4
    under the hood), meaning that it can't be hoisted.
    
    As a result we get "locate the top of stack block, get cr4, and see if
    FSGSBASE is set" repeated 3 times, and an unreasonable number of basic blocks.
    
    Hoist the calculation manually, which results in two basic blocks.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    (cherry picked from commit 42a0709f374966573851236589583c86b603e704)
---
 xen/arch/x86/traps.c | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index 6f6ce387a1..5a0a16a6b3 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -118,9 +118,24 @@ static void read_registers(struct extra_state *state)
     state->cr3 = read_cr3();
     state->cr4 = read_cr4();
 
-    state->fsb = read_fs_base();
-    state->gsb = read_gs_base();
-    state->gss = read_gs_shadow();
+    /*
+     * Help the optimiser out by opencoding read_*_base() and rearranging the
+     * expression.  -fno-strict-aliasing causes the store into state to
+     * invalidate the read_cr4() address calculation (really cpu_info->cr4
+     * under the hood), forcing the cr4 check to be re-evaluated every time.
+     */
+    if ( state->cr4 & X86_CR4_FSGSBASE )
+    {
+        state->fsb = __rdfsbase();
+        state->gsb = __rdgsbase();
+        state->gss = __rdgs_shadow();
+    }
+    else
+    {
+        state->fsb = rdmsr(MSR_FS_BASE);
+        state->gsb = rdmsr(MSR_GS_BASE);
+        state->gss = rdmsr(MSR_SHADOW_GS_BASE);
+    }
 
     asm ( "mov %%ds, %0" : "=m" (state->ds) );
     asm ( "mov %%es, %0" : "=m" (state->es) );
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.21


From xen-changelog-bounces@lists.xenproject.org Tue Mar 24 08:22:54 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Mar 2026 08:22:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1260061.1553386 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4x2M-0005Q9-0J; Tue, 24 Mar 2026 08:22:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1260061.1553386; Tue, 24 Mar 2026 08:22:53 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4x2L-0005Q1-U0; Tue, 24 Mar 2026 08:22:53 +0000
Received: by outflank-mailman (input) for mailman id 1260061;
 Tue, 24 Mar 2026 08:22:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w4x2K-0005Pr-NE
 for xen-changelog@lists.xenproject.org; Tue, 24 Mar 2026 08:22:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4x2K-0078y7-2u
 for xen-changelog@lists.xenproject.org;
 Tue, 24 Mar 2026 08:22:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4x2K-00BdhB-27
 for xen-changelog@lists.xenproject.org;
 Tue, 24 Mar 2026 08:22:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=VJDSJOc7lwQ1xpxNDIqxuWbhJDX8ZWFt5GITlno19Dg=; b=jVDqyRPXCMgDPilQajCzHgtfbC
	uIBQAI1OucqE9AHae9rH2pq4buTRnWDsb0OMjHP1UIH+4Ha3xsuiTipnsHqITna1jtD6rX49S8Syk
	Tr50BfN5RnfYzU+kc/DKb9dkfPR2+LKRHw2ucrau3lD+ROTHEHMXS6mISR/yDfW/jkpM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.21] x86/boot: Use RSTORSSP to establish SSP
Message-Id: <E1w4x2K-00BdhB-27@xenbits.xenproject.org>
Date: Tue, 24 Mar 2026 08:22:52 +0000

commit 4329f8c6034ebc563f3d7b101e7fa0b407e504a2
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon May 26 18:48:26 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 17 12:13:49 2026 +0000

    x86/boot: Use RSTORSSP to establish SSP
    
    Under FRED, SETSSBSY is disallowed, and we want to be setting up FRED prior to
    setting up shadow stacks.  As we still need Supervisor Tokens in IDT mode, we
    need mode-specific logic to establish SSP.
    
    In FRED mode, write a Restore Token, RSTORSSP it, and discard the resulting
    Previous-SSP token.
    
    No change outside of FRED mode.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    (cherry picked from commit 3037d8b7eb3e9c3c9e4a0a257115557c300795fc)
---
 xen/arch/x86/boot/x86_64.S | 23 +++++++++++++++++++++--
 xen/arch/x86/setup.c       | 25 ++++++++++++++++++++++++-
 2 files changed, 45 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/boot/x86_64.S b/xen/arch/x86/boot/x86_64.S
index 11a7e9d3bd..9705d03f84 100644
--- a/xen/arch/x86/boot/x86_64.S
+++ b/xen/arch/x86/boot/x86_64.S
@@ -53,17 +53,21 @@ ENTRY(__high_start)
         mov     %rcx, STACK_CPUINFO_FIELD(cr4)(%r15)
         mov     %rcx, %cr4
 
-        /* WARNING! call/ret now fatal (iff SHSTK) until SETSSBSY loads SSP */
+        /* WARNING! CALL/RET now fatal (iff SHSTK) until SETSSBSY/RSTORSSP loads SSP */
 
 #if defined(CONFIG_XEN_SHSTK)
         test    $CET_SHSTK_EN, %al
         jz      .L_ap_cet_done
 
-        /* Derive the supervisor token address from %rsp. */
+        /* Derive the token address from %rsp. */
         mov     %rsp, %rdx
         and     $~(STACK_SIZE - 1), %rdx
         or      $(PRIMARY_SHSTK_SLOT + 1) * PAGE_SIZE - 8, %rdx
 
+        /* Establishing SSP differs between IDT or FRED mode. */
+        bt      $32 /* ilog2(X86_CR4_FRED) */, %rcx
+        jc      .L_fred_shstk
+
         /*
          * Write a new Supervisor Token.  It doesn't matter the first time a
          * CPU boots, but for S3 resume or hotplug this clears the busy bit so
@@ -71,6 +75,21 @@ ENTRY(__high_start)
          */
         wrssq   %rdx, (%rdx)
         setssbsy
+        jmp     .L_ap_cet_done
+
+.L_fred_shstk:
+
+        /*
+         * Write a Restore Token, value: &token + 8 + 64BIT (bit 0) at the
+         * base of the shstk (which isn't in use yet).
+         */
+        lea     9(%rdx), %rdi
+        wrssq   %rdi, (%rdx)
+        rstorssp (%rdx)
+
+        /* Discard the Previous-SSP Token from the shstk. */
+        mov     $2, %edx
+        incsspd %edx
 
 #endif /* CONFIG_XEN_SHSTK */
 .L_ap_cet_done:
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 872a8c63f9..44da5efa1d 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -49,6 +49,7 @@
 #include <asm/prot-key.h>
 #include <asm/pv/domain.h>
 #include <asm/setup.h>
+#include <asm/shstk.h>
 #include <asm/smp.h>
 #include <asm/spec_ctrl.h>
 #include <asm/stubs.h>
@@ -908,7 +909,29 @@ static void __init noreturn reinit_bsp_stack(void)
     if ( cpu_has_xen_shstk )
     {
         wrmsrl(MSR_S_CET, xen_msr_s_cet_value());
-        asm volatile ("setssbsy" ::: "memory");
+
+        /*
+         * IDT and FRED differ by a Supervisor Token on the shadow stack.
+         *
+         * In IDT mode, we use SETSSBSY (itself using MSR_PL0_SSP, configured
+         * previously) to mark the Supervisor Token as Busy.  In FRED mode,
+         * there is no token, so we need to create a temporary Restore Token
+         * to establish SSP.
+         */
+        if ( opt_fred )
+        {
+            unsigned long *token =
+                (void *)stack + (PRIMARY_SHSTK_SLOT + 1) * PAGE_SIZE - 8;
+
+            wrss((unsigned long)token + 9, token);
+            asm volatile ( "rstorssp %0" : "+m" (*token) );
+            /*
+             * We need to discard the resulting Previous-SSP Token, but
+             * reset_stack_and_jump() will do that for us.
+             */
+        }
+        else
+            asm volatile ( "setssbsy" ::: "memory" );
     }
 
     reset_stack_and_jump(init_done);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.21


From xen-changelog-bounces@lists.xenproject.org Tue Mar 24 08:23:04 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Mar 2026 08:23:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1260062.1553392 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4x2W-0005Sa-2c; Tue, 24 Mar 2026 08:23:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1260062.1553392; Tue, 24 Mar 2026 08:23:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4x2V-0005SS-VQ; Tue, 24 Mar 2026 08:23:03 +0000
Received: by outflank-mailman (input) for mailman id 1260062;
 Tue, 24 Mar 2026 08:23:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w4x2U-0005SK-Q2
 for xen-changelog@lists.xenproject.org; Tue, 24 Mar 2026 08:23:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4x2U-0078yT-3A
 for xen-changelog@lists.xenproject.org;
 Tue, 24 Mar 2026 08:23:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4x2U-00Bdhk-2O
 for xen-changelog@lists.xenproject.org;
 Tue, 24 Mar 2026 08:23:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=1OdNTZCc74G21aHi/ppyUA08+uYm8dXo6a4GdxrWhUA=; b=MjlMF6JeEdiDYKUT1XrzyldUzF
	/4tgbBQ8h/V7v1VXpf8EIRNVDu24Z9nU7xluO35Xf9gQSWs7XgSP7oLAyLC6MZAC8vdcXKQKcrnoY
	n3eiSyaBVs9IXGWPaJ0wlAT6ldiHuw7spjarfArI/3WdXXwufKeLwIGPfRg2nN2T74nM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.21] x86/pv: Deduplicate is_canonical_address() in do_set_segment_base()
Message-Id: <E1w4x2U-00Bdhk-2O@xenbits.xenproject.org>
Date: Tue, 24 Mar 2026 08:23:02 +0000

commit d23e5a7ae264cf56f844005f72522aab5c6277de
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Aug 12 12:48:06 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 17 12:13:49 2026 +0000

    x86/pv: Deduplicate is_canonical_address() in do_set_segment_base()
    
    This is really a rearrangement to make adding FRED support easier.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    (cherry picked from commit 524f3fa35efd7a425e1033d2fa5c927f61224d67)
---
 xen/arch/x86/pv/misc-hypercalls.c | 32 +++++++++++++++++---------------
 1 file changed, 17 insertions(+), 15 deletions(-)

diff --git a/xen/arch/x86/pv/misc-hypercalls.c b/xen/arch/x86/pv/misc-hypercalls.c
index 7a37f16bf0..4c2abeb4ad 100644
--- a/xen/arch/x86/pv/misc-hypercalls.c
+++ b/xen/arch/x86/pv/misc-hypercalls.c
@@ -176,27 +176,29 @@ long do_set_segment_base(unsigned int which, unsigned long base)
     switch ( which )
     {
     case SEGBASE_FS:
-        if ( is_canonical_address(base) )
-            write_fs_base(base);
-        else
+    case SEGBASE_GS_USER:
+    case SEGBASE_GS_KERNEL:
+        if ( !is_canonical_address(base) )
+        {
             ret = -EINVAL;
-        break;
+            break;
+        }
 
-    case SEGBASE_GS_USER:
-        if ( is_canonical_address(base) )
+        switch ( which )
         {
-            write_gs_shadow(base);
+        case SEGBASE_FS:
+            write_fs_base(base);
+            break;
+
+        case SEGBASE_GS_USER:
             v->arch.pv.gs_base_user = base;
-        }
-        else
-            ret = -EINVAL;
-        break;
+            write_gs_shadow(base);
+            break;
 
-    case SEGBASE_GS_KERNEL:
-        if ( is_canonical_address(base) )
+        case SEGBASE_GS_KERNEL:
             write_gs_base(base);
-        else
-            ret = -EINVAL;
+            break;
+        }
         break;
 
     case SEGBASE_GS_USER_SEL:
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.21


From xen-changelog-bounces@lists.xenproject.org Tue Mar 24 08:23:14 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Mar 2026 08:23:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1260063.1553396 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4x2g-0005Ur-3S; Tue, 24 Mar 2026 08:23:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1260063.1553396; Tue, 24 Mar 2026 08:23:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4x2g-0005Uj-0X; Tue, 24 Mar 2026 08:23:14 +0000
Received: by outflank-mailman (input) for mailman id 1260063;
 Tue, 24 Mar 2026 08:23:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w4x2e-0005UZ-Sh
 for xen-changelog@lists.xenproject.org; Tue, 24 Mar 2026 08:23:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4x2f-0078yX-0F
 for xen-changelog@lists.xenproject.org;
 Tue, 24 Mar 2026 08:23:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4x2e-00BdiR-2g
 for xen-changelog@lists.xenproject.org;
 Tue, 24 Mar 2026 08:23:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Cl0u0kcvWMX9p0XJfd8eRcujQVMZmMUrYd5xr89Edz8=; b=cOKMtaV5I8VcJj1n1TgS1jHZb1
	fJq3mv6jUvCRpyY7Fz2wd6WYrz6VvQECtu8Ho+MK4GcAl+fj1MYbtRbYNCv5fvgTCgIPeMPPag3Um
	BtYpKOyuT/LExNLOlM7T/WmgWbc9vw5gP7+ePLtAq/3ncmBgrKbmJ9gqZI20Mx6xunOk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.21] x86/traps: Make an IDT-specific #DB helper
Message-Id: <E1w4x2e-00BdiR-2g@xenbits.xenproject.org>
Date: Tue, 24 Mar 2026 08:23:12 +0000

commit bf5f349f7b00eb96488c74cf4c0601d8cbf9644d
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Aug 11 12:42:01 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 17 12:13:49 2026 +0000

    x86/traps: Make an IDT-specific #DB helper
    
    FRED provides PENDING_DBG in the the stack frame, avoiding the need to read
    %dr6 manually.
    
    Rename do_debug() to handle_DB(), and update it to take a dbg field using
    positive polarity.
    
    Introduce a new handle_DB_IDT() which reads %dr6.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    (cherry picked from commit d9974d7860868d8a59fc95508ec768d300fed0b1)
---
 xen/arch/x86/traps.c        | 28 +++++++++++++++++-----------
 xen/arch/x86/x86_64/entry.S |  2 +-
 2 files changed, 18 insertions(+), 12 deletions(-)

diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index 5a0a16a6b3..d24bb381fa 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -1997,14 +1997,11 @@ void asmlinkage do_device_not_available(struct cpu_user_regs *regs)
 
 void nocall sysenter_eflags_saved(void);
 
-void asmlinkage do_debug(struct cpu_user_regs *regs)
+/* Handle #DB.  @dbg is PENDING_DBG, a.k.a. %dr6 with positive polarity. */
+static void handle_DB(struct cpu_user_regs *regs, unsigned long dbg)
 {
-    unsigned long dr6;
     struct vcpu *v = current;
 
-    /* Stash dr6 as early as possible. */
-    dr6 = read_debugreg(6);
-
     /*
      * At the time of writing (March 2018), on the subject of %dr6:
      *
@@ -2072,13 +2069,13 @@ void asmlinkage do_debug(struct cpu_user_regs *regs)
          * If however we do, safety measures need to be enacted.  Use a big
          * hammer and clear all debug settings.
          */
-        if ( dr6 & (DR_TRAP3 | DR_TRAP2 | DR_TRAP1 | DR_TRAP0) )
+        if ( dbg & (DR_TRAP3 | DR_TRAP2 | DR_TRAP1 | DR_TRAP0) )
         {
             unsigned int bp, dr7 = read_debugreg(7);
 
             for ( bp = 0; bp < 4; ++bp )
             {
-                if ( (dr6 & (1u << bp)) && /* Breakpoint triggered? */
+                if ( (dbg & (1u << bp)) && /* Breakpoint triggered? */
                      (dr7 & (3u << (bp * DR_ENABLE_SIZE))) && /* Enabled? */
                      ((dr7 & (3u << ((bp * DR_CONTROL_SIZE) + /* Insn? */
                                      DR_CONTROL_SHIFT))) == DR_RW_EXECUTE) )
@@ -2099,9 +2096,9 @@ void asmlinkage do_debug(struct cpu_user_regs *regs)
          * so ensure the message is ratelimited.
          */
         gprintk(XENLOG_WARNING,
-                "Hit #DB in Xen context: %04x:%p [%ps], stk %04x:%p, dr6 %lx\n",
+                "Hit #DB in Xen context: %04x:%p [%ps], stk %04x:%p, dbg %lx\n",
                 regs->cs, _p(regs->rip), _p(regs->rip),
-                regs->ss, _p(regs->rsp), dr6);
+                regs->ss, _p(regs->rsp), dbg);
 
         return;
     }
@@ -2113,7 +2110,7 @@ void asmlinkage do_debug(struct cpu_user_regs *regs)
      * by debugging actions completed behind it's back.
      */
     v->arch.dr6 = x86_merge_dr6(v->domain->arch.cpu_policy,
-                                v->arch.dr6, dr6 ^ X86_DR6_DEFAULT);
+                                v->arch.dr6, dbg);
 
     if ( guest_kernel_mode(v, regs) && v->domain->debugger_attached )
     {
@@ -2121,7 +2118,16 @@ void asmlinkage do_debug(struct cpu_user_regs *regs)
         return;
     }
 
-    pv_inject_DB(dr6 ^ X86_DR6_DEFAULT);
+    pv_inject_DB(dbg);
+}
+
+/*
+ * When using IDT delivery, it is our responsibility to read %dr6.  Convert it
+ * to positive polarity.
+ */
+void asmlinkage handle_DB_IDT(struct cpu_user_regs *regs)
+{
+    handle_DB(regs, read_debugreg(6) ^ X86_DR6_DEFAULT);
 }
 
 void asmlinkage do_entry_CP(struct cpu_user_regs *regs)
diff --git a/xen/arch/x86/x86_64/entry.S b/xen/arch/x86/x86_64/entry.S
index 39c7b9d17f..789687488c 100644
--- a/xen/arch/x86/x86_64/entry.S
+++ b/xen/arch/x86/x86_64/entry.S
@@ -1171,7 +1171,7 @@ FUNC(handle_ist_exception)
 .L_ ## vec ## _done:
 
         DISPATCH(X86_EXC_NMI, do_nmi)
-        DISPATCH(X86_EXC_DB,  do_debug)
+        DISPATCH(X86_EXC_DB,  handle_DB_IDT)
         DISPATCH(X86_EXC_MC,  do_machine_check)
 #undef DISPATCH
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.21


From xen-changelog-bounces@lists.xenproject.org Tue Mar 24 08:23:24 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Mar 2026 08:23:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1260064.1553399 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4x2q-0005XR-5J; Tue, 24 Mar 2026 08:23:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1260064.1553399; Tue, 24 Mar 2026 08:23:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4x2q-0005XJ-1w; Tue, 24 Mar 2026 08:23:24 +0000
Received: by outflank-mailman (input) for mailman id 1260064;
 Tue, 24 Mar 2026 08:23:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w4x2o-0005X8-VZ
 for xen-changelog@lists.xenproject.org; Tue, 24 Mar 2026 08:23:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4x2p-0078yi-0W
 for xen-changelog@lists.xenproject.org;
 Tue, 24 Mar 2026 08:23:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4x2o-00Bdit-2y
 for xen-changelog@lists.xenproject.org;
 Tue, 24 Mar 2026 08:23:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=sB3gwURPw4UY/e0lHhIMYGcdAsb6rRFz3S8f2m5dZKM=; b=4UXQ8JBin504TzJ+NvZ2QQKlDR
	NfBcUkN/ir+Q0x0KrDQWB3pMtzQij1TKUaaJwKkjR0H9dXC3yRbZ6i1rpUsOsv49xeDrKAL06eN++
	aoK+zKg2UXZeVeisNkhdwq1XdV3+J6D9VSEBllEE4dJbm6EX9hhPTcdX6mRSfPoam0fI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.21] x86/traps: Make an IDT-specific #PF helper
Message-Id: <E1w4x2o-00Bdit-2y@xenbits.xenproject.org>
Date: Tue, 24 Mar 2026 08:23:22 +0000

commit 92307f30b05de02b5c6f23577754e57b27560440
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Aug 11 12:42:01 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 17 12:13:50 2026 +0000

    x86/traps: Make an IDT-specific #PF helper
    
    FRED provides %cr2 in the the stack frame, avoiding the need to read %cr2
    manually.
    
    Rename do_page_fault() to handle_PF(), and update it to take cr2, still named
    addr for consistency.
    
    Introduce a new handle_PF_IDT() which reads %cr2 and conditionally re-enables
    interrupts.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    (cherry picked from commit 4153eb7660ad441de75ab6dca50b54eb340d0728)
---
 xen/arch/x86/traps.c        | 26 ++++++++++++++------------
 xen/arch/x86/x86_64/entry.S |  2 +-
 2 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index d24bb381fa..3f038f8e12 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -1675,21 +1675,10 @@ static int fixup_page_fault(unsigned long addr, struct cpu_user_regs *regs)
     return 0;
 }
 
-void asmlinkage do_page_fault(struct cpu_user_regs *regs)
+static void handle_PF(struct cpu_user_regs *regs, unsigned long addr /* cr2 */)
 {
-    unsigned long addr;
     unsigned int error_code;
 
-    addr = read_cr2();
-
-    /*
-     * Don't re-enable interrupts if we were running an IRQ-off region when
-     * we hit the page fault, or we'll break that code.
-     */
-    ASSERT(!local_irq_is_enabled());
-    if ( regs->flags & X86_EFLAGS_IF )
-        local_irq_enable();
-
     /* fixup_page_fault() might change regs->error_code, so cache it here. */
     error_code = regs->error_code;
 
@@ -1750,6 +1739,19 @@ void asmlinkage do_page_fault(struct cpu_user_regs *regs)
     pv_inject_page_fault(regs->error_code, addr);
 }
 
+/*
+ * When using IDT delivery, it is our responsibility to read %cr2.
+ */
+void asmlinkage handle_PF_IDT(struct cpu_user_regs *regs)
+{
+    unsigned long addr = read_cr2();
+
+    if ( regs->flags & X86_EFLAGS_IF )
+        local_irq_enable();
+
+    handle_PF(regs, addr);
+}
+
 /*
  * Early #PF handler to print CR2, error code, and stack.
  *
diff --git a/xen/arch/x86/x86_64/entry.S b/xen/arch/x86/x86_64/entry.S
index 789687488c..c02245ac06 100644
--- a/xen/arch/x86/x86_64/entry.S
+++ b/xen/arch/x86/x86_64/entry.S
@@ -871,7 +871,7 @@ handle_exception_saved:
          * reading %cr2. Otherwise a page fault in the nested interrupt handler
          * would corrupt %cr2.
          */
-        DISPATCH(X86_EXC_PF, do_page_fault)
+        DISPATCH(X86_EXC_PF, handle_PF_IDT)
 
         /* Only re-enable IRQs if they were active before taking the fault */
         testb $X86_EFLAGS_IF >> 8, UREGS_eflags + 1(%rsp)
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.21


From xen-changelog-bounces@lists.xenproject.org Tue Mar 24 08:23:34 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Mar 2026 08:23:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1260065.1553403 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4x30-0005aB-72; Tue, 24 Mar 2026 08:23:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1260065.1553403; Tue, 24 Mar 2026 08:23:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4x30-0005a3-4Y; Tue, 24 Mar 2026 08:23:34 +0000
Received: by outflank-mailman (input) for mailman id 1260065;
 Tue, 24 Mar 2026 08:23:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w4x2z-0005Zv-1r
 for xen-changelog@lists.xenproject.org; Tue, 24 Mar 2026 08:23:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4x2z-0078z7-0m
 for xen-changelog@lists.xenproject.org;
 Tue, 24 Mar 2026 08:23:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4x2z-00Bdja-00
 for xen-changelog@lists.xenproject.org;
 Tue, 24 Mar 2026 08:23:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=gqKuK8/N32AndDP8PUwcALhG9LFDiy33JxmT4jvl3vA=; b=iCE1mVSbdcil0Mbg2lgCL5XLme
	B3trsSbucpijYH4krFH9OjalN5qJqThv7VAJJTwXNp/2P9MmY1fgZVsiAhJND/MTeQk5mRYG1xsNM
	IG+PznZuSLKCEGNwtYwIYA4O+EtDxoimVr9fY8k+kEq4Ba6nI1Hk/fzLZ43waz4fDbCQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.21] x86/traps: Alter switch_stack_and_jump() for FRED mode
Message-Id: <E1w4x2z-00Bdja-00@xenbits.xenproject.org>
Date: Tue, 24 Mar 2026 08:23:33 +0000

commit b7572954da0e09d5289609db0b126c0944593dbd
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon May 26 18:48:26 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 17 12:13:50 2026 +0000

    x86/traps: Alter switch_stack_and_jump() for FRED mode
    
    FRED and IDT differ by a Supervisor Token on the base of the shadow stack.
    This means that switch_stack_and_jump() needs to discard one extra word when
    FRED is active.
    
    Fix a typo in the parameter name, which should be shstk_base.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    (cherry picked from commit 40fbf971771a5c7c973818edbd0be7b50f0eb364)
---
 xen/arch/x86/include/asm/current.h | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/include/asm/current.h b/xen/arch/x86/include/asm/current.h
index c1eb27b1c4..62817e8476 100644
--- a/xen/arch/x86/include/asm/current.h
+++ b/xen/arch/x86/include/asm/current.h
@@ -154,7 +154,9 @@ unsigned long get_stack_dump_bottom (unsigned long sp);
     "rdsspd %[ssp];"                                            \
     "cmp $1, %[ssp];"                                           \
     "je .L_shstk_done.%=;" /* CET not active?  Skip. */         \
-    "mov $%c[skstk_base], %[val];"                              \
+    ALTERNATIVE("mov $%c[shstk_base], %[val];",                 \
+                "mov $%c[shstk_base] + 8, %[val];",             \
+                X86_FEATURE_XEN_FRED)                           \
     "and $%c[stack_mask], %[ssp];"                              \
     "sub %[ssp], %[val];"                                       \
     "shr $3, %[val];"                                           \
@@ -188,7 +190,7 @@ unsigned long get_stack_dump_bottom (unsigned long sp);
               [ssp] "=&r" (tmp)                                         \
             : [stk] "r" (guest_cpu_user_regs()),                        \
               [fun] constr (fn),                                        \
-              [skstk_base] "i"                                          \
+              [shstk_base] "i"                                          \
               ((PRIMARY_SHSTK_SLOT + 1) * PAGE_SIZE - 8),               \
               [stack_mask] "i" (STACK_SIZE - 1),                        \
               _ASM_BUGFRAME_INFO(BUGFRAME_bug, __LINE__,                \
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.21


From xen-changelog-bounces@lists.xenproject.org Tue Mar 24 08:23:44 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Mar 2026 08:23:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1260066.1553408 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4x3A-0005cA-91; Tue, 24 Mar 2026 08:23:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1260066.1553408; Tue, 24 Mar 2026 08:23:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4x3A-0005c0-63; Tue, 24 Mar 2026 08:23:44 +0000
Received: by outflank-mailman (input) for mailman id 1260066;
 Tue, 24 Mar 2026 08:23:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w4x39-0005bu-6P
 for xen-changelog@lists.xenproject.org; Tue, 24 Mar 2026 08:23:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4x39-0078zH-1E
 for xen-changelog@lists.xenproject.org;
 Tue, 24 Mar 2026 08:23:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4x39-00BdkI-0H
 for xen-changelog@lists.xenproject.org;
 Tue, 24 Mar 2026 08:23:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=CIC9seK//NqMuUCJIRVIVxxN5+wH3hs35ckvyPBC2Sg=; b=giH7poJARWAmmfzRj5RJrlU6/k
	3JNiUe5QssaqwyWLs44XS2Dep83eXqA0LZ2/0erAh3BqAHFpNAI7nQlcK8KN0An1URbRMJrn6cAzi
	8Ke/EHuBJBuemAvzDvoBzMCQPlc2YUT8ddlU1wUQqRNx869LnzAR9t6Xo7LMFwye8Hvk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.21] x86/fsgsbase: Make SHADOW_GS accesses safe under FRED
Message-Id: <E1w4x39-00BdkI-0H@xenbits.xenproject.org>
Date: Tue, 24 Mar 2026 08:23:43 +0000

commit 1fd19a1bc5f64c00dbcf3eb49a601ae6a0e4b61f
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Aug 18 15:44:44 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 17 12:13:50 2026 +0000

    x86/fsgsbase: Make SHADOW_GS accesses safe under FRED
    
    Under FRED, the SWAPGS instruction is disallowed.  Therefore we must use the
    MSR path instead.
    
    read_registers() is in the show_registers() path, so this change allows Xen to
    render it's current state without suffering #UD (and recursing until the stack
    guard page is hit).
    
    All hardware with FRED is expected to have some kind of non-serialising access
    to these registers.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    (cherry picked from commit 3ff1030ea7d40e62edfe09b44dbdba44def5072a)
---
 xen/arch/x86/include/asm/fsgsbase.h | 8 ++++++--
 xen/arch/x86/traps.c                | 2 +-
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/include/asm/fsgsbase.h b/xen/arch/x86/include/asm/fsgsbase.h
index 24862a6bfe..5faa3a3243 100644
--- a/xen/arch/x86/include/asm/fsgsbase.h
+++ b/xen/arch/x86/include/asm/fsgsbase.h
@@ -79,7 +79,9 @@ static inline unsigned long read_gs_base(void)
 
 static inline unsigned long read_gs_shadow(void)
 {
-    if ( read_cr4() & X86_CR4_FSGSBASE )
+    unsigned long cr4 = read_cr4();
+
+    if ( !(cr4 & X86_CR4_FRED) && (cr4 & X86_CR4_FSGSBASE) )
         return __rdgs_shadow();
     else
         return rdmsr(MSR_SHADOW_GS_BASE);
@@ -103,7 +105,9 @@ static inline void write_gs_base(unsigned long base)
 
 static inline void write_gs_shadow(unsigned long base)
 {
-    if ( read_cr4() & X86_CR4_FSGSBASE )
+    unsigned long cr4 = read_cr4();
+
+    if ( !(cr4 & X86_CR4_FRED) && (cr4 & X86_CR4_FSGSBASE) )
         __wrgs_shadow(base);
     else
         wrmsrns(MSR_SHADOW_GS_BASE, base);
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index 3f038f8e12..702a110131 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -124,7 +124,7 @@ static void read_registers(struct extra_state *state)
      * invalidate the read_cr4() address calculation (really cpu_info->cr4
      * under the hood), forcing the cr4 check to be re-evaluated every time.
      */
-    if ( state->cr4 & X86_CR4_FSGSBASE )
+    if ( !(state->cr4 & X86_CR4_FRED) && (state->cr4 & X86_CR4_FSGSBASE) )
     {
         state->fsb = __rdfsbase();
         state->gsb = __rdgsbase();
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.21


From xen-changelog-bounces@lists.xenproject.org Tue Mar 24 08:23:55 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Mar 2026 08:23:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1260068.1553411 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4x3L-0005eN-AA; Tue, 24 Mar 2026 08:23:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1260068.1553411; Tue, 24 Mar 2026 08:23:55 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4x3L-0005eF-7O; Tue, 24 Mar 2026 08:23:55 +0000
Received: by outflank-mailman (input) for mailman id 1260068;
 Tue, 24 Mar 2026 08:23:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w4x3J-0005e4-Bh
 for xen-changelog@lists.xenproject.org; Tue, 24 Mar 2026 08:23:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4x3J-0078zM-1l
 for xen-changelog@lists.xenproject.org;
 Tue, 24 Mar 2026 08:23:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4x3J-00Bdkk-0k
 for xen-changelog@lists.xenproject.org;
 Tue, 24 Mar 2026 08:23:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=56UnwNkecZkgmvXJas2i5cYAFiyhvRMk2WU8pL6jHUc=; b=GTj0AII+e0ewgoiQEye/mLumRR
	LozoZ9P1nYBVwa1KFecQ2snqqZiyc8jX1RRQIwYKxGO8wUiaYJbVDvfa5IqaEikp1/Y5M8bv3G495
	oU5yCwJXNfyRbYb0/XQCDyjbm1Pl0ENvAGOFvAxkm4RI2iYYVtmVPdyIjK4rGWoySoeU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.21] x86/boot: Move gdt_l1e caching out of traps_init()
Message-Id: <E1w4x3J-00Bdkk-0k@xenbits.xenproject.org>
Date: Tue, 24 Mar 2026 08:23:53 +0000

commit f7e0615d83532e0d485d4b0e9e88d8bad335139e
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Feb 13 23:45:28 2026 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 17 12:13:50 2026 +0000

    x86/boot: Move gdt_l1e caching out of traps_init()
    
    Commit 564d261687c0 ("x86/ctxt-switch: Document and improve GDT handling") put
    the initialisation of {,compat_}gdt_l1e into traps_init() but this wasn't a
    great choice.  Instead, put it in smp_prepare_cpus() which performs the BSP
    preparation of variables normally set up by cpu_smpboot_alloc() for APs.
    
    This removes an implicit dependency that prevents traps_init() moving earlier
    than move_xen() in the boot sequence.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    (cherry picked from commit a1e6afbf54283be0ea3db9bf6cb046c683fcf684)
---
 xen/arch/x86/domain.c      |  2 ++
 xen/arch/x86/smpboot.c     | 11 +++++++++++
 xen/arch/x86/traps-setup.c |  7 -------
 3 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index 7d74414ada..bdbf680fe2 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -2053,6 +2053,8 @@ static always_inline bool need_full_gdt(const struct domain *d)
 
 static void update_xen_slot_in_full_gdt(const struct vcpu *v, unsigned int cpu)
 {
+    ASSERT(per_cpu(gdt_l1e, cpu).l1); /* Confirm these have been cached. */
+
     l1e_write(pv_gdt_ptes(v) + FIRST_RESERVED_GDT_PAGE,
               !is_pv_32bit_vcpu(v) ? per_cpu(gdt_l1e, cpu)
                                    : per_cpu(compat_gdt_l1e, cpu));
diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c
index 8d3161248d..7339aeaefd 100644
--- a/xen/arch/x86/smpboot.c
+++ b/xen/arch/x86/smpboot.c
@@ -1167,6 +1167,17 @@ void __init smp_prepare_cpus(void)
     initialize_cpu_data(0); /* Final full version of the data */
     print_cpu_info(0);
 
+    /*
+     * Cache {,compat_}gdt_l1e for the BSP now that physically relocation is
+     * done.  It must be after physical relocation of Xen, and before the
+     * first context_switch().
+     */
+    this_cpu(gdt_l1e) =
+        l1e_from_pfn(virt_to_mfn(boot_gdt), __PAGE_HYPERVISOR_RW);
+    if ( IS_ENABLED(CONFIG_PV32) )
+        this_cpu(compat_gdt_l1e) =
+            l1e_from_pfn(virt_to_mfn(boot_compat_gdt), __PAGE_HYPERVISOR_RW);
+
     boot_cpu_physical_apicid = get_apic_id();
     x86_cpu_to_apicid[0] = boot_cpu_physical_apicid;
 
diff --git a/xen/arch/x86/traps-setup.c b/xen/arch/x86/traps-setup.c
index d77be8f839..c5fc71c75b 100644
--- a/xen/arch/x86/traps-setup.c
+++ b/xen/arch/x86/traps-setup.c
@@ -341,13 +341,6 @@ void __init traps_init(void)
 
     init_ler();
 
-    /* Cache {,compat_}gdt_l1e now that physically relocation is done. */
-    this_cpu(gdt_l1e) =
-        l1e_from_pfn(virt_to_mfn(boot_gdt), __PAGE_HYPERVISOR_RW);
-    if ( IS_ENABLED(CONFIG_PV32) )
-        this_cpu(compat_gdt_l1e) =
-            l1e_from_pfn(virt_to_mfn(boot_compat_gdt), __PAGE_HYPERVISOR_RW);
-
     percpu_traps_init();
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.21


From xen-changelog-bounces@lists.xenproject.org Tue Mar 24 08:24:05 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Mar 2026 08:24:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1260070.1553414 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4x3V-0005gq-BM; Tue, 24 Mar 2026 08:24:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1260070.1553414; Tue, 24 Mar 2026 08:24:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4x3V-0005gi-8l; Tue, 24 Mar 2026 08:24:05 +0000
Received: by outflank-mailman (input) for mailman id 1260070;
 Tue, 24 Mar 2026 08:24:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w4x3T-0005gV-ER
 for xen-changelog@lists.xenproject.org; Tue, 24 Mar 2026 08:24:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4x3T-0078zd-21
 for xen-changelog@lists.xenproject.org;
 Tue, 24 Mar 2026 08:24:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4x3T-00Bdlw-1G
 for xen-changelog@lists.xenproject.org;
 Tue, 24 Mar 2026 08:24:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=H22ofUhVcIAg3+mwz4ndjetd7bTsuiQhxWXTOznCZs0=; b=0laJma4qwOT39pPUft4529CStc
	J5xeYM5ejMPEL8tKQR1wpZu7G7EBnSl0xhvbg4HVbz4P1Q3Wc17Jh66PfcCFuo8r4YdlFNrfyI650
	FiRol1vzrJxpaXTvlFwxd0tUd2iqtm8q52YmdcxpAZqXJEOXl6A82QdombYZxIZCg3Ck=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.21] x86/boot: Document the ordering dependency of _svm_cpu_up()
Message-Id: <E1w4x3T-00Bdlw-1G@xenbits.xenproject.org>
Date: Tue, 24 Mar 2026 08:24:03 +0000

commit 1512e5a19866e850d4e192233b1d6bb4abbf9b9e
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Feb 16 20:57:02 2026 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 17 12:13:50 2026 +0000

    x86/boot: Document the ordering dependency of _svm_cpu_up()
    
    Lets just say this took an unreasonable amount of time and effort to track
    down, when trying to move traps_init() earlier during boot.
    
    When the SYSCALL linkage MSRs are not configured ahead of _svm_cpu_up() on the
    BSP, context switch clobbers the later-set-up linkage with the 0's cached
    here.  Amongst other problems, this causes PV guest to enter at 0 in
    supervisor mode on the user stack.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    (cherry picked from commit c2f15b0fff94ca71fe32792ea933fcf2a907111d)
---
 xen/arch/x86/hvm/svm/svm.c | 14 ++++++++++++++
 xen/arch/x86/setup.c       |  2 +-
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
index b54f9d9af5..f1128a657d 100644
--- a/xen/arch/x86/hvm/svm/svm.c
+++ b/xen/arch/x86/hvm/svm/svm.c
@@ -1579,6 +1579,20 @@ static int _svm_cpu_up(bool bsp)
     /* Initialize OSVW bits to be used by guests */
     svm_host_osvw_init();
 
+    /*
+     * VMSAVE writes out the current full FS, GS, LDTR and TR segments, and
+     * the GS_SHADOW, SYSENTER and SYSCALL linkage MSRs.
+     *
+     * The segment data gets modified by the svm_load_segs() optimisation for
+     * PV context switches, but all values get reloaded at that point, as well
+     * as during context switch from SVM.
+     *
+     * If PV guests are available, it is critical that the SYSCALL linkage
+     * MSRs been configured at this juncture even in FRED mode.
+     */
+    if ( IS_ENABLED(CONFIG_PV) )
+        ASSERT(rdmsr(MSR_STAR) == XEN_MSR_STAR);
+
     svm_vmsave_pa(per_cpu(host_vmcb, cpu));
 
     return 0;
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 44da5efa1d..455eac47d6 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -2078,7 +2078,7 @@ void asmlinkage __init noreturn __start_xen(void)
                                            &this_cpu(stubs).mfn);
     BUG_ON(!this_cpu(stubs.addr));
 
-    traps_init(); /* Needs stubs allocated. */
+    traps_init(); /* Needs stubs allocated, must be before presmp_initcalls. */
 
     cpu_init();
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.21


From xen-changelog-bounces@lists.xenproject.org Tue Mar 24 08:24:15 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Mar 2026 08:24:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1260072.1553418 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4x3f-0005iq-Cr; Tue, 24 Mar 2026 08:24:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1260072.1553418; Tue, 24 Mar 2026 08:24:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4x3f-0005ii-AE; Tue, 24 Mar 2026 08:24:15 +0000
Received: by outflank-mailman (input) for mailman id 1260072;
 Tue, 24 Mar 2026 08:24:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w4x3d-0005ic-HJ
 for xen-changelog@lists.xenproject.org; Tue, 24 Mar 2026 08:24:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4x3d-0078zj-2K
 for xen-changelog@lists.xenproject.org;
 Tue, 24 Mar 2026 08:24:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4x3d-00BdmK-1X
 for xen-changelog@lists.xenproject.org;
 Tue, 24 Mar 2026 08:24:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Fhu/1gc7QEC9WbQ2G0R4wJieVM11uKAjSXJJ/JAZE0U=; b=E7nO8SWaCVUCrhL6QP0/W7qJ0h
	4fj6UrTSAH/VHZzqwMzOR9W+qPwP3wS0XhwEsrAKR1mEITYoDNWrjV4MGXAh1n7uInvxwiVPj/Rcl
	LT959LKM6lTNXDCzBJ3vcnILppgEk1rDQrurqvfhswE+6u/eyziqb9EV8M98xpW/g1X8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.21] x86/traps: Move traps_init() earlier on boot
Message-Id: <E1w4x3d-00BdmK-1X@xenbits.xenproject.org>
Date: Tue, 24 Mar 2026 08:24:13 +0000

commit f94cc1c429e00e3bd97aadc2b35ec6d1ecb7ced9
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Aug 15 22:56:42 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 17 12:13:50 2026 +0000

    x86/traps: Move traps_init() earlier on boot
    
    We wish to make use of opt_fred earlier on boot, which involves moving
    traps_init() earlier, but this comes with several ordering complications.
    
    The feature word containing FRED needs collecting in early_cpu_init(), and
    legacy_syscall_init() cannot be moved that early because it relies on the
    stubs being allocated, yet must be called ahead of cpu_init() so the SYSCALL
    linkage MSRs are set up before being cached.
    
    Delaying legacy_syscall_init() is easy enough based on a system_state check.
    Reuse bsp_traps_reinit() to cause a call to legacy_syscall_init() to occur at
    the same point as previously.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    (cherry picked from commit 8e4775d118c327782f5bf286e5b353a9de797bef)
---
 xen/arch/x86/cpu/common.c  |  4 +++-
 xen/arch/x86/setup.c       |  4 +++-
 xen/arch/x86/traps-setup.c | 12 +++++++++++-
 3 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c
index 9d225ac8d7..92c709ea69 100644
--- a/xen/arch/x86/cpu/common.c
+++ b/xen/arch/x86/cpu/common.c
@@ -420,7 +420,9 @@ void __init early_cpu_init(bool verbose)
 		}
 
 		if (max_subleaf >= 1)
-			cpuid_count(7, 1, &eax, &ebx, &ecx,
+			cpuid_count(7, 1,
+                                    &c->x86_capability[FEATURESET_7a1],
+                                    &ebx, &ecx,
 				    &c->x86_capability[FEATURESET_7d1]);
 	}
 
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 455eac47d6..c2827fec00 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -1386,6 +1386,8 @@ void asmlinkage __init noreturn __start_xen(void)
     else
         panic("Bootloader provided no memory information\n");
 
+    traps_init();
+
     /* Choose shadow stack early, to set infrastructure up appropriately. */
     if ( !boot_cpu_has(X86_FEATURE_CET_SS) )
         opt_xen_shstk = 0;
@@ -2078,7 +2080,7 @@ void asmlinkage __init noreturn __start_xen(void)
                                            &this_cpu(stubs).mfn);
     BUG_ON(!this_cpu(stubs.addr));
 
-    traps_init(); /* Needs stubs allocated, must be before presmp_initcalls. */
+    bsp_traps_reinit(); /* Needs stubs allocated, must be before presmp_initcalls. */
 
     cpu_init();
 
diff --git a/xen/arch/x86/traps-setup.c b/xen/arch/x86/traps-setup.c
index c5fc71c75b..b2c161943d 100644
--- a/xen/arch/x86/traps-setup.c
+++ b/xen/arch/x86/traps-setup.c
@@ -346,6 +346,10 @@ void __init traps_init(void)
 
 /*
  * Re-initialise all state referencing the early-boot stack.
+ *
+ * This is called twice during boot, first to ensure legacy_syscall_init() has
+ * run (deferred from earlier), and second when the virtual address of the BSP
+ * stack changes.
  */
 void __init bsp_traps_reinit(void)
 {
@@ -359,7 +363,13 @@ void __init bsp_traps_reinit(void)
  */
 void percpu_traps_init(void)
 {
-    legacy_syscall_init();
+    /*
+     * Skip legacy_syscall_init() at early boot.  It requires the stubs being
+     * allocated, limiting the placement of the traps_init() call, and gets
+     * re-done anyway by bsp_traps_reinit().
+     */
+    if ( system_state > SYS_STATE_early_boot )
+        legacy_syscall_init();
 
     if ( cpu_has_xen_lbr )
         wrmsrl(MSR_IA32_DEBUGCTLMSR, IA32_DEBUGCTLMSR_LBR);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.21


From xen-changelog-bounces@lists.xenproject.org Tue Mar 24 08:24:25 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Mar 2026 08:24:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1260074.1553423 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4x3p-0005lI-Ei; Tue, 24 Mar 2026 08:24:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1260074.1553423; Tue, 24 Mar 2026 08:24:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4x3p-0005lA-Bj; Tue, 24 Mar 2026 08:24:25 +0000
Received: by outflank-mailman (input) for mailman id 1260074;
 Tue, 24 Mar 2026 08:24:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w4x3n-0005kw-KD
 for xen-changelog@lists.xenproject.org; Tue, 24 Mar 2026 08:24:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4x3n-0078zp-2c
 for xen-changelog@lists.xenproject.org;
 Tue, 24 Mar 2026 08:24:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4x3n-00Bdn7-1q
 for xen-changelog@lists.xenproject.org;
 Tue, 24 Mar 2026 08:24:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=5LJR+0/cceHES6aQG/JT53LvMkfoz2GdPpQTtckgyBQ=; b=nTPb1byX0PHsY91FSGJrTNgigz
	G62c4+AtpRLIahyZN1mA1fYm2FzwOgrif5vdT3HIGO2PMt6Qy1nXtawPwFuU7jv+IzJUDO/aKmXrT
	I+xLlL8fgN89BwGfNjzqFDAVsGLZX/PeosrYbEqCXoPKiQo3g4MqXFrV4FnRi8un0lGk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.21] x86/traps: Don't configure Supervisor Shadow Stack tokens in FRED mode
Message-Id: <E1w4x3n-00Bdn7-1q@xenbits.xenproject.org>
Date: Tue, 24 Mar 2026 08:24:23 +0000

commit 08c222e3fa2eecedb5a110aee92b0c532e2918ec
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Aug 15 22:56:42 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 17 12:13:50 2026 +0000

    x86/traps: Don't configure Supervisor Shadow Stack tokens in FRED mode
    
    FRED doesn't use Supervisor Shadow Stack tokens.  This means that:
    
     1) memguard_guard_stack() should not write Supervisor Shadow Stack Tokens.
     2) cpu_has_bug_shstk_fracture is no longer relevant when deciding whether to
        enable Shadow Stacks or not.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    (cherry picked from commit 7634f5662551864a4976d5f0022263a056efd14d)
---
 xen/arch/x86/mm.c    | 14 +++++++++++---
 xen/arch/x86/setup.c | 16 ++++++++++------
 2 files changed, 21 insertions(+), 9 deletions(-)

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index b929d15d00..2b23bf2e7a 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -129,6 +129,7 @@
 #include <asm/shadow.h>
 #include <asm/shared.h>
 #include <asm/trampoline.h>
+#include <asm/traps.h>
 #include <asm/x86_emulate.h>
 
 #include <public/memory.h>
@@ -6441,8 +6442,15 @@ static void write_sss_token(unsigned long *ptr)
 
 void memguard_guard_stack(void *p)
 {
-    /* IST Shadow stacks.  4x 1k in stack page 0. */
-    if ( IS_ENABLED(CONFIG_XEN_SHSTK) )
+    ASSERT(opt_fred >= 0); /* Confirm that FRED-ness has been resolved */
+
+    /*
+     * IST Shadow stacks.  4x 1k in stack page 0.
+     *
+     * With IDT delivery, we need Supervisor Shadow Stack tokens at the base
+     * of each stack.  With FRED delivery, these no longer exist.
+     */
+    if ( IS_ENABLED(CONFIG_XEN_SHSTK) && !opt_fred )
     {
         write_sss_token(p + (IST_MCE * IST_SHSTK_SIZE) - 8);
         write_sss_token(p + (IST_NMI * IST_SHSTK_SIZE) - 8);
@@ -6453,7 +6461,7 @@ void memguard_guard_stack(void *p)
 
     /* Primary Shadow Stack.  1x 4k in stack page 5. */
     p += PRIMARY_SHSTK_SLOT * PAGE_SIZE;
-    if ( IS_ENABLED(CONFIG_XEN_SHSTK) )
+    if ( IS_ENABLED(CONFIG_XEN_SHSTK) && !opt_fred )
         write_sss_token(p + PAGE_SIZE - 8);
 
     map_pages_to_xen((unsigned long)p, virt_to_mfn(p), 1, PAGE_HYPERVISOR_SHSTK);
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index c2827fec00..14c28ba8e7 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -1412,15 +1412,19 @@ void asmlinkage __init noreturn __start_xen(void)
             boot_cpu_data.x86_vendor == X86_VENDOR_INTEL &&
             !boot_cpu_has(X86_FEATURE_CET_SSS);
 
+        ASSERT(opt_fred >= 0); /* Confirm that FRED-ness has been resolved */
+
         /*
-         * On bare metal, assume that Xen won't be impacted by shstk
-         * fracturing problems.  Under virt, be more conservative and disable
-         * shstk by default.
+         * If FRED is in use, Supervisor Shadow Stack tokens are not used and
+         * shstk fracturing is of no consequence.  Otherwise:
+         * - On bare metal, assume that Xen won't be impacted by shstk
+         *   fracturing problems.
+         * - Under virt, be more conservative and disable shstk by default.
          */
         if ( opt_xen_shstk == -1 )
             opt_xen_shstk =
-                cpu_has_hypervisor ? !cpu_has_bug_shstk_fracture
-                                   : true;
+                opt_fred || (cpu_has_hypervisor ? !cpu_has_bug_shstk_fracture
+                                                : true);
 
         if ( opt_xen_shstk )
         {
@@ -1925,7 +1929,7 @@ void asmlinkage __init noreturn __start_xen(void)
 
     system_state = SYS_STATE_boot;
 
-    bsp_stack = cpu_alloc_stack(0);
+    bsp_stack = cpu_alloc_stack(0); /* Needs to know IDT vs FRED */
     if ( !bsp_stack )
         panic("No memory for BSP stack\n");
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.21


From xen-changelog-bounces@lists.xenproject.org Tue Mar 24 08:24:35 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Mar 2026 08:24:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1260076.1553427 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4x3z-0005pF-JF; Tue, 24 Mar 2026 08:24:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1260076.1553427; Tue, 24 Mar 2026 08:24:35 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4x3z-0005p7-FR; Tue, 24 Mar 2026 08:24:35 +0000
Received: by outflank-mailman (input) for mailman id 1260076;
 Tue, 24 Mar 2026 08:24:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w4x3x-0005p1-NB
 for xen-changelog@lists.xenproject.org; Tue, 24 Mar 2026 08:24:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4x3x-00790C-2u
 for xen-changelog@lists.xenproject.org;
 Tue, 24 Mar 2026 08:24:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4x3x-00Bdo4-27
 for xen-changelog@lists.xenproject.org;
 Tue, 24 Mar 2026 08:24:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=SU56uKdnEI//h/33jEbrc0vIGLkYP6Xg1iDRUBT5eyM=; b=243NbrAxXk9SKac636OQI/wICb
	gno3RPRjsd5Vf17EKuUQcishrWZEHR87xCWc14VWyCUa19iDvGFZ0zrgSKwuF0H91XRn18i7Ukt0p
	VqXnwYKX61ggVrMNHNjgCeFaXeHCf5S8i84yEcbDiEFPbzX3GBm5E9eR2uBb5cZxZddg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.21] x86/traps: Introduce FRED entrypoints
Message-Id: <E1w4x3x-00Bdo4-27@xenbits.xenproject.org>
Date: Tue, 24 Mar 2026 08:24:33 +0000

commit 04048e2a006fb87a4e4df4cc24b01fadceb73288
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Dec 24 11:03:06 2024 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 17 12:13:50 2026 +0000

    x86/traps: Introduce FRED entrypoints
    
    Under FRED, there's one entrypoint from Ring 3, and one from Ring 0.
    
    FRED gives us a good stack (even for SYSCALL/SYSENTER), and a unified event
    frame on the stack with all flags cleared, meaning that all software needs to
    do is spill the GPRs with a line of PUSHes.  Introduce PUSH_AND_CLEAR_GPRS for
    this purpose, along with the matching POP_GPRS.
    
    Introduce entry_FRED_R0() which to a first approximation is complete for all
    event handling within Xen.
    
    entry_FRED_R0() needs deriving from entry_FRED_R3(), so introduce a basic
    Ring3 handler.  There is more work required to make the return-to-guest path
    work under FRED.
    
    Also introduce entry_from_{xen,pv}() to be the C level handlers.  By simply
    copying regs->fred_ss.vector into regs->entry_vector, we can reuse all the
    existing fault handlers.
    
    Extend fatal_trap() to render the event type including name, when FRED is
    active.  This is slightly complicated, because X86_ET_OTHER must not use
    vector_name() or SYSCALL and SYSENTER get rendered as #BP and #DB.
    
    This is sufficient to handle all interrupts and exceptions encountered during
    development, including plenty of Double Faults.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    (cherry picked from commit 0e9cc04453fc2d7234ad3ced51b520c597c7bfbf)
---
 xen/arch/x86/include/asm/asm_defns.h |  63 ++++++++++++++
 xen/arch/x86/traps.c                 | 155 +++++++++++++++++++++++++++++++++++
 xen/arch/x86/x86_64/Makefile         |   1 +
 xen/arch/x86/x86_64/entry-fred.S     |  33 ++++++++
 4 files changed, 252 insertions(+)

diff --git a/xen/arch/x86/include/asm/asm_defns.h b/xen/arch/x86/include/asm/asm_defns.h
index 72a0082d31..82ad691500 100644
--- a/xen/arch/x86/include/asm/asm_defns.h
+++ b/xen/arch/x86/include/asm/asm_defns.h
@@ -315,6 +315,69 @@ static always_inline void stac(void)
         subq  $-(UREGS_error_code-UREGS_r15+\adj), %rsp
 .endm
 
+/*
+ * Push and clear GPRs
+ */
+.macro PUSH_AND_CLEAR_GPRS
+        push  %rdi
+        xor   %edi, %edi
+        push  %rsi
+        xor   %esi, %esi
+        push  %rdx
+        xor   %edx, %edx
+        push  %rcx
+        xor   %ecx, %ecx
+        push  %rax
+        xor   %eax, %eax
+        push  %r8
+        xor   %r8d, %r8d
+        push  %r9
+        xor   %r9d, %r9d
+        push  %r10
+        xor   %r10d, %r10d
+        push  %r11
+        xor   %r11d, %r11d
+        push  %rbx
+        xor   %ebx, %ebx
+        push  %rbp
+#ifdef CONFIG_FRAME_POINTER
+/* Indicate special exception stack frame by inverting the frame pointer. */
+        mov   %rsp, %rbp
+        not   %rbp
+#else
+        xor   %ebp, %ebp
+#endif
+        push  %r12
+        xor   %r12d, %r12d
+        push  %r13
+        xor   %r13d, %r13d
+        push  %r14
+        xor   %r14d, %r14d
+        push  %r15
+        xor   %r15d, %r15d
+.endm
+
+/*
+ * POP GPRs from a UREGS_* frame on the stack.  Does not modify flags.
+ */
+.macro POP_GPRS
+        pop   %r15
+        pop   %r14
+        pop   %r13
+        pop   %r12
+        pop   %rbp
+        pop   %rbx
+        pop   %r11
+        pop   %r10
+        pop   %r9
+        pop   %r8
+        pop   %rax
+        pop   %rcx
+        pop   %rdx
+        pop   %rsi
+        pop   %rdi
+.endm
+
 #ifdef CONFIG_PV32
 #define CR4_PV32_RESTORE                               \
     ALTERNATIVE_2 "",                                  \
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index 702a110131..178169dc5f 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -89,6 +89,13 @@ const unsigned int nmi_cpu;
 #define stack_words_per_line 4
 #define ESP_BEFORE_EXCEPTION(regs) ((unsigned long *)(regs)->rsp)
 
+/* Only valid to use when FRED is active. */
+static inline struct fred_info *cpu_regs_fred_info(struct cpu_user_regs *regs)
+{
+    ASSERT(read_cr4() & X86_CR4_FRED);
+    return &container_of(regs, struct cpu_info, guest_cpu_user_regs)->_fred;
+}
+
 struct extra_state
 {
     unsigned long cr0, cr2, cr3, cr4;
@@ -1029,6 +1036,32 @@ void show_execution_state_nmi(const cpumask_t *mask, bool show_all)
         printk("Non-responding CPUs: {%*pbl}\n", CPUMASK_PR(&show_state_mask));
 }
 
+static const char *x86_et_name(unsigned int type)
+{
+    static const char *const names[] = {
+        [X86_ET_EXT_INTR]    = "EXT_INTR",
+        [X86_ET_NMI]         = "NMI",
+        [X86_ET_HW_EXC]      = "HW_EXC",
+        [X86_ET_SW_INT]      = "SW_INT",
+        [X86_ET_PRIV_SW_EXC] = "PRIV_SW_EXC",
+        [X86_ET_SW_EXC]      = "SW_EXC",
+        [X86_ET_OTHER]       = "OTHER",
+    };
+
+    return (type < ARRAY_SIZE(names) && names[type]) ? names[type] : "???";
+}
+
+static const char *x86_et_other_name(unsigned int what)
+{
+    static const char *const names[] = {
+        [0] = "MTF",
+        [1] = "SYSCALL",
+        [2] = "SYSENTER",
+    };
+
+    return (what < ARRAY_SIZE(names) && names[what]) ? names[what] : "???";
+}
+
 const char *vector_name(unsigned int vec)
 {
     static const char names[][4] = {
@@ -1107,6 +1140,38 @@ void fatal_trap(const struct cpu_user_regs *regs, bool show_remote)
         }
     }
 
+    if ( read_cr4() & X86_CR4_FRED )
+    {
+        bool render_ec = false;
+        const char *vec_name = NULL;
+
+        switch ( regs->fred_ss.type )
+        {
+        case X86_ET_HW_EXC:
+        case X86_ET_PRIV_SW_EXC:
+        case X86_ET_SW_EXC:
+            render_ec = true;
+            vec_name = vector_name(regs->fred_ss.vector);
+            break;
+
+        case X86_ET_OTHER:
+            vec_name = x86_et_other_name(regs->fred_ss.vector);
+            break;
+        }
+
+        if ( render_ec )
+            panic("FATAL TRAP: type %u, %s, vec %u, %s[%04x]%s\n",
+                  regs->fred_ss.type, x86_et_name(regs->fred_ss.type),
+                  regs->fred_ss.vector, vec_name ?: "",
+                  regs->error_code,
+                  (regs->eflags & X86_EFLAGS_IF) ? "" : " IN INTERRUPT CONTEXT");
+        else
+            panic("FATAL TRAP: type %u, %s, vec %u, %s%s\n",
+                  regs->fred_ss.type, x86_et_name(regs->fred_ss.type),
+                  regs->fred_ss.vector, vec_name ?: "",
+                  (regs->eflags & X86_EFLAGS_IF) ? "" : " IN INTERRUPT CONTEXT");
+    }
+
     panic("FATAL TRAP: vec %u, %s[%04x]%s\n",
           trapnr, vector_name(trapnr), regs->error_code,
           (regs->eflags & X86_EFLAGS_IF) ? "" : " IN INTERRUPT CONTEXT");
@@ -2204,6 +2269,96 @@ void asmlinkage check_ist_exit(const struct cpu_user_regs *regs, bool ist_exit)
 }
 #endif
 
+void asmlinkage entry_from_pv(struct cpu_user_regs *regs)
+{
+    /* Copy fred_ss.vector into entry_vector as IDT delivery would have done. */
+    regs->entry_vector = regs->fred_ss.vector;
+
+    fatal_trap(regs, false);
+}
+
+void asmlinkage entry_from_xen(struct cpu_user_regs *regs)
+{
+    struct fred_info *fi = cpu_regs_fred_info(regs);
+    uint8_t type = regs->fred_ss.type;
+
+    /* Copy fred_ss.vector into entry_vector as IDT delivery would have done. */
+    regs->entry_vector = regs->fred_ss.vector;
+
+    /*
+     * First, handle the asynchronous or fatal events.  These are either
+     * unrelated to the interrupted context, or may not have valid context
+     * recorded, and all have special rules on how/whether to re-enable IRQs.
+     */
+    if ( regs->fred_ss.nested )
+        goto fatal;
+
+    switch ( type )
+    {
+    case X86_ET_EXT_INTR:
+        return do_IRQ(regs);
+
+    case X86_ET_NMI:
+        return do_nmi(regs);
+
+    case X86_ET_HW_EXC:
+        switch ( regs->fred_ss.vector )
+        {
+        case X86_EXC_DF: return do_double_fault(regs);
+        case X86_EXC_MC: return do_machine_check(regs);
+        }
+        break;
+    }
+
+    /*
+     * With the asynchronous events handled, what remains are the synchronous
+     * ones.  If we interrupted an IRQs-on region, we should re-enable IRQs
+     * now; for #PF and #DB, %cr2 and PENDING_DBG are on the stack in edata.
+     */
+    if ( regs->eflags & X86_EFLAGS_IF )
+        local_irq_enable();
+
+    switch ( type )
+    {
+    case X86_ET_HW_EXC:
+    case X86_ET_PRIV_SW_EXC:
+    case X86_ET_SW_EXC:
+        switch ( regs->fred_ss.vector )
+        {
+        case X86_EXC_PF:  handle_PF(regs, fi->edata); break;
+        case X86_EXC_GP:  do_general_protection(regs); break;
+        case X86_EXC_UD:  do_invalid_op(regs); break;
+        case X86_EXC_NM:  do_device_not_available(regs); break;
+        case X86_EXC_BP:  do_int3(regs); break;
+        case X86_EXC_DB:  handle_DB(regs, fi->edata); break;
+        case X86_EXC_CP:  do_entry_CP(regs); break;
+
+        case X86_EXC_DE:
+        case X86_EXC_OF:
+        case X86_EXC_BR:
+        case X86_EXC_NP:
+        case X86_EXC_SS:
+        case X86_EXC_MF:
+        case X86_EXC_AC:
+        case X86_EXC_XM:
+            do_trap(regs);
+            break;
+
+        default:
+            goto fatal;
+        }
+        break;
+
+    default:
+        goto fatal;
+    }
+
+    return;
+
+ fatal:
+    fatal_trap(regs, false);
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/xen/arch/x86/x86_64/Makefile b/xen/arch/x86/x86_64/Makefile
index f207630887..c0a0b66032 100644
--- a/xen/arch/x86/x86_64/Makefile
+++ b/xen/arch/x86/x86_64/Makefile
@@ -1,5 +1,6 @@
 obj-$(CONFIG_PV32) += compat/
 
+obj-bin-y += entry-fred.o
 obj-bin-y += entry.o
 obj-$(CONFIG_KEXEC) += machine_kexec.o
 obj-y += pci.o
diff --git a/xen/arch/x86/x86_64/entry-fred.S b/xen/arch/x86/x86_64/entry-fred.S
new file mode 100644
index 0000000000..3c3320df22
--- /dev/null
+++ b/xen/arch/x86/x86_64/entry-fred.S
@@ -0,0 +1,33 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+        .file "x86_64/entry-fred.S"
+
+#include <asm/asm_defns.h>
+#include <asm/page.h>
+
+        .section .text.entry, "ax", @progbits
+
+        /* The Ring3 entry point is required to be 4k aligned. */
+
+FUNC(entry_FRED_R3, 4096)
+        PUSH_AND_CLEAR_GPRS
+
+        mov     %rsp, %rdi
+        call    entry_from_pv
+
+        POP_GPRS
+        eretu
+END(entry_FRED_R3)
+
+        /* The Ring0 entrypoint is at Ring3 + 0x100. */
+        .org entry_FRED_R3 + 0x100, 0xcc
+
+FUNC_LOCAL(entry_FRED_R0, 0)
+        PUSH_AND_CLEAR_GPRS
+
+        mov     %rsp, %rdi
+        call    entry_from_xen
+
+        POP_GPRS
+        erets
+END(entry_FRED_R0)
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.21


From xen-changelog-bounces@lists.xenproject.org Tue Mar 24 08:24:44 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Mar 2026 08:24:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1260078.1553431 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4x48-0005rt-Jr; Tue, 24 Mar 2026 08:24:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1260078.1553431; Tue, 24 Mar 2026 08:24:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4x48-0005rl-H9; Tue, 24 Mar 2026 08:24:44 +0000
Received: by outflank-mailman (input) for mailman id 1260078;
 Tue, 24 Mar 2026 08:24:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w4x47-0005re-Pp
 for xen-changelog@lists.xenproject.org; Tue, 24 Mar 2026 08:24:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4x47-00790G-3B
 for xen-changelog@lists.xenproject.org;
 Tue, 24 Mar 2026 08:24:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4x47-00Bdog-2P
 for xen-changelog@lists.xenproject.org;
 Tue, 24 Mar 2026 08:24:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ujVNR4NnLwMqIqZs1h7oearfdX3nqoCilCEJ7TyxfPQ=; b=EelJY9zjjIgLAj0NAdL8KJGnj9
	qhIDncywSnpORnkd5Z2ZZc83/mji/T2mBeVVHDQ7qqss7E9eC85yWcAx31HbkFyguGtvzDUCh+ymG
	QokGPKbFWiZe/YZIYDtRPQW88yZlghMpFHGVybE/cZXNV92+6A5Wv1Tq4Sg7EDCwAU0w=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.21] x86/traps: Enable FRED when requested
Message-Id: <E1w4x47-00Bdog-2P@xenbits.xenproject.org>
Date: Tue, 24 Mar 2026 08:24:43 +0000

commit d151802841a478ae87c84868144d8252f57d944f
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Dec 24 11:03:06 2024 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 17 12:13:50 2026 +0000

    x86/traps: Enable FRED when requested
    
    With the shadow stack and exception handling adjustements in place, we can now
    activate FRED when appropriate.  Note that opt_fred is still disabled by
    default until more development is complete.
    
    Introduce init_fred() to set up all the MSRs relevant for FRED.  FRED uses
    MSR_STAR (entries from Ring3 only), and MSR_FRED_SSP_SL0 aliases MSR_PL0_SSP
    when CET-SS is active.  Otherwise, they're all new MSRs.
    
    Also introduce init_fred_tss().  At this juncture we need a TSS set up, even
    if it is mostly unused.  Reinsert the BUILD_BUG_ON() checking the size of the
    TSS against 0x67, this time with a more precise comment.
    
    With init_fred() existing, load_system_tables() and legacy_syscall_init()
    should only be used when setting up IDT delivery.  Insert ASSERT()s to this
    effect, and adjust the various init functions to make this property true.
    
    The FRED initialisation path still needs to write to all system table
    registers at least once, even if only to invalidate them.  Per the
    documentation, percpu_early_traps_init() is responsible for switching off the
    boot GDT, which also needs doing even in FRED mode.
    
    Finally, set CR4.FRED in traps_init()/percpu_early_traps_init().
    
    Xen can now boot in FRED mode and run a PVH dom0.  PV guests still need more
    work before they can be run under FRED.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    (cherry picked from commit bbfb30f649fc11281b091b91fd353954df1354a0)
---
 xen/arch/x86/include/asm/current.h |   3 +
 xen/arch/x86/include/asm/traps.h   |   2 +
 xen/arch/x86/traps-setup.c         | 130 +++++++++++++++++++++++++++++++++++--
 3 files changed, 130 insertions(+), 5 deletions(-)

diff --git a/xen/arch/x86/include/asm/current.h b/xen/arch/x86/include/asm/current.h
index 62817e8476..6139980ab1 100644
--- a/xen/arch/x86/include/asm/current.h
+++ b/xen/arch/x86/include/asm/current.h
@@ -23,6 +23,9 @@
  * 2 - NMI IST stack
  * 1 - #MC IST stack
  * 0 - IST Shadow Stacks (4x 1k, read-only)
+ *
+ * In FRED mode, #DB and NMI do not need special stacks, so their IST stacks
+ * are unused.
  */
 
 /*
diff --git a/xen/arch/x86/include/asm/traps.h b/xen/arch/x86/include/asm/traps.h
index 73097e957d..5d7504bc44 100644
--- a/xen/arch/x86/include/asm/traps.h
+++ b/xen/arch/x86/include/asm/traps.h
@@ -16,6 +16,8 @@ void traps_init(void);
 void bsp_traps_reinit(void);
 void percpu_traps_init(void);
 
+void nocall entry_FRED_R3(void);
+
 extern unsigned int ler_msr;
 
 const char *vector_name(unsigned int vec);
diff --git a/xen/arch/x86/traps-setup.c b/xen/arch/x86/traps-setup.c
index b2c161943d..9b8301c23e 100644
--- a/xen/arch/x86/traps-setup.c
+++ b/xen/arch/x86/traps-setup.c
@@ -59,6 +59,8 @@ static void load_system_tables(void)
         .limit = sizeof(bsp_idt) - 1,
     };
 
+    ASSERT(opt_fred == 0);
+
     /*
      * Set up the TSS.  Warning - may be live, and the NMI/#MC must remain
      * valid on every instruction boundary.  (Note: these are all
@@ -191,6 +193,8 @@ static void legacy_syscall_init(void)
     unsigned char *stub_page;
     unsigned int offset;
 
+    ASSERT(opt_fred == 0);
+
     /* No PV guests?  No need to set up SYSCALL/SYSENTER infrastructure. */
     if ( !IS_ENABLED(CONFIG_PV) )
         return;
@@ -268,6 +272,76 @@ static void __init init_ler(void)
     setup_force_cpu_cap(X86_FEATURE_XEN_LBR);
 }
 
+/*
+ * Set up all MSRs relevant for FRED event delivery.
+ *
+ * Xen does not use any of the optional config in MSR_FRED_CONFIG, so all that
+ * is needed is the entrypoint.
+ *
+ * Because FRED always provides a good stack, NMI and #DB do not need any
+ * special treatment.  Only #DF needs another stack level, and #MC for the
+ * off-chance that Xen's main stack suffers an uncorrectable error.
+ *
+ * This makes Stack Level 1 unused, but we use #DB's stacks, and with the
+ * regular and shadow stack pointers reversed as poison to guarantee that any
+ * use escalates to #DF.
+ *
+ * FRED reuses MSR_STAR to provide the segment selector values to load on
+ * entry from Ring3.  Entry from Ring0 leave %cs and %ss unmodified.
+ */
+static void init_fred(void)
+{
+    unsigned long stack_top = get_stack_bottom() & ~(STACK_SIZE - 1);
+
+    ASSERT(opt_fred == 1);
+
+    wrmsrns(MSR_STAR, XEN_MSR_STAR);
+    wrmsrns(MSR_FRED_CONFIG, (unsigned long)entry_FRED_R3);
+
+    /*
+     * MSR_FRED_RSP_* all come with an 64-byte alignment check, avoiding the
+     * need for an explicit BUG_ON().
+     */
+    wrmsrns(MSR_FRED_RSP_SL0, (unsigned long)(&get_cpu_info()->_fred + 1));
+    wrmsrns(MSR_FRED_RSP_SL1, stack_top + (IST_DB * IST_SHSTK_SIZE)); /* Poison */
+    wrmsrns(MSR_FRED_RSP_SL2, stack_top + (1 + IST_MCE)  * PAGE_SIZE);
+    wrmsrns(MSR_FRED_RSP_SL3, stack_top + (1 + IST_DF)   * PAGE_SIZE);
+    wrmsrns(MSR_FRED_STK_LVLS, ((2UL << (X86_EXC_MC * 2)) |
+                                (3UL << (X86_EXC_DF * 2))));
+
+    if ( cpu_has_xen_shstk )
+    {
+        wrmsrns(MSR_FRED_SSP_SL0, stack_top + (PRIMARY_SHSTK_SLOT + 1) * PAGE_SIZE);
+        wrmsrns(MSR_FRED_SSP_SL1, stack_top + (1 + IST_DB) * PAGE_SIZE); /* Poison */
+        wrmsrns(MSR_FRED_SSP_SL2, stack_top + (IST_MCE * IST_SHSTK_SIZE));
+        wrmsrns(MSR_FRED_SSP_SL3, stack_top + (IST_DF  * IST_SHSTK_SIZE));
+    }
+}
+
+/*
+ * Set up a minimal TSS and selector for use in FRED mode.
+ *
+ * With FRED moving the stack pointers into MSRs, we would like to avoid
+ * having a TSS at all, but:
+ *  - VT-x VMExit unconditionally sets TR.limit to 0x67, meaning that
+ *    HOST_TR_BASE needs to point to a good TSS.
+ *  - show_stack_overflow() cross-checks tss->rsp0.
+ *
+ * Fill in rsp0 and the bitmap offset, and load a zero-length TR.  If VT-x
+ * does get used, it will clobber TR to refer to this_cpu(tss_page).tss.
+ */
+static void init_fred_tss(void)
+{
+    seg_desc_t *gdt = this_cpu(gdt) - FIRST_RESERVED_GDT_ENTRY;
+    struct tss64 *tss = &this_cpu(tss_page).tss;
+
+    tss->rsp0 = get_stack_bottom();
+    tss->bitmap = IOBMP_INVALID_OFFSET;
+
+    _set_tssldt_desc(gdt + TSS_ENTRY, 0, 0, SYS_DESC_tss_avail);
+    ltr(TSS_SELECTOR);
+}
+
 /*
  * Configure basic exception handling.  This is prior to parsing the command
  * line or configuring a console, and needs to be as simple as possible.
@@ -322,6 +396,8 @@ void __init traps_init(void)
 
     if ( opt_fred )
     {
+        const struct desc_ptr idtr = {};
+
 #ifdef CONFIG_PV32
         if ( opt_pv32 )
         {
@@ -329,16 +405,27 @@ void __init traps_init(void)
             printk(XENLOG_INFO "Disabling PV32 due to FRED\n");
         }
 #endif
+
+        init_fred();
+        set_in_cr4(X86_CR4_FRED);
+
+        /*
+         * Invalidate the IDT as it's not used.  Set up a minimal TSS.  The
+         * LDT was configured by bsp_early_traps_init().
+         */
+        lidt(&idtr);
+        init_fred_tss();
+
         setup_force_cpu_cap(X86_FEATURE_XEN_FRED);
         printk("Using FRED event delivery\n");
     }
     else
     {
+        load_system_tables();
+
         printk("Using IDT event delivery\n");
     }
 
-    load_system_tables();
-
     init_ler();
 
     percpu_traps_init();
@@ -353,7 +440,11 @@ void __init traps_init(void)
  */
 void __init bsp_traps_reinit(void)
 {
-    load_system_tables();
+    if ( opt_fred )
+        init_fred();
+    else
+        load_system_tables();
+
     percpu_traps_init();
 }
 
@@ -368,7 +459,7 @@ void percpu_traps_init(void)
      * allocated, limiting the placement of the traps_init() call, and gets
      * re-done anyway by bsp_traps_reinit().
      */
-    if ( system_state > SYS_STATE_early_boot )
+    if ( !opt_fred && system_state > SYS_STATE_early_boot )
         legacy_syscall_init();
 
     if ( cpu_has_xen_lbr )
@@ -384,7 +475,29 @@ void percpu_traps_init(void)
  */
 void asmlinkage percpu_early_traps_init(void)
 {
-    load_system_tables();
+    if ( opt_fred )
+    {
+        seg_desc_t *gdt = this_cpu(gdt) - FIRST_RESERVED_GDT_ENTRY;
+        const struct desc_ptr gdtr = {
+            .base = (unsigned long)gdt,
+            .limit = LAST_RESERVED_GDT_BYTE,
+        }, idtr = {};
+
+        lgdt(&gdtr);
+
+        init_fred();
+        write_cr4(read_cr4() | X86_CR4_FRED);
+
+        /*
+         * Invalidate the IDT (not used) and LDT (not set up yet).  Set up a
+         * minimal TSS.
+         */
+        lidt(&idtr);
+        init_fred_tss();
+        lldt(0);
+    }
+    else
+        load_system_tables();
 }
 
 static void __init __maybe_unused build_assertions(void)
@@ -403,4 +516,11 @@ static void __init __maybe_unused build_assertions(void)
                   endof_field(struct cpu_info, guest_cpu_user_regs)) & 15);
     BUILD_BUG_ON((sizeof(struct cpu_info) -
                   endof_field(struct cpu_info, _fred)) & 63);
+
+    /*
+     * The x86 architecture is happy with TR.limit being less than 0x67, but
+     * VT-x is not.  VMExit unconditionally sets the limit to 0x67, meaning
+     * that HOST_TR_BASE needs to refer to a good TSS of at least this size.
+     */
+    BUILD_BUG_ON(sizeof(struct tss64) <= 0x67);
 }
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.21


From xen-changelog-bounces@lists.xenproject.org Tue Mar 24 08:24:54 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Mar 2026 08:24:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1260082.1553435 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4x4I-0005uf-Nh; Tue, 24 Mar 2026 08:24:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1260082.1553435; Tue, 24 Mar 2026 08:24:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4x4I-0005uX-Kr; Tue, 24 Mar 2026 08:24:54 +0000
Received: by outflank-mailman (input) for mailman id 1260082;
 Tue, 24 Mar 2026 08:24:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w4x4H-0005uN-Sn
 for xen-changelog@lists.xenproject.org; Tue, 24 Mar 2026 08:24:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4x4I-00790R-0E
 for xen-changelog@lists.xenproject.org;
 Tue, 24 Mar 2026 08:24:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4x4H-00BdpK-2h
 for xen-changelog@lists.xenproject.org;
 Tue, 24 Mar 2026 08:24:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=eqp8NpaUh/JaT/nZpoJ3oJfeaI2SXKa1Av3UofpfqNU=; b=J47zZPUZMWIIgGwenNHaU76/z7
	MWrRNCeq1qN0tgnp/zGxgy9MsH7tto5K5zUQpObB9EzB5zxSfsekWwSKTDX3S16I3L7aXMMfX/ujV
	KiXcJN++LXQ8uxOtsdjpQnozyQUf+uUzGDQxOLZeqgpY60LerE+Oqwidt6zRjP/p+zWA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.21] x86/pv: Adjust GS handling for FRED mode
Message-Id: <E1w4x4H-00BdpK-2h@xenbits.xenproject.org>
Date: Tue, 24 Mar 2026 08:24:53 +0000

commit d1d8143d8c8bd80fe21d8bc9e0455bfd0cc4e651
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Aug 11 23:46:01 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 17 12:13:50 2026 +0000

    x86/pv: Adjust GS handling for FRED mode
    
    When FRED is active, hardware automatically swaps GS when changing privilege,
    and the SWAPGS instruction is disallowed.
    
    For native OSes using GS as the thread local pointer this is a massive
    improvement on the pre-FRED architecture, but under Xen it makes handling PV
    guests more complicated.  Specifically, it means that GS_BASE and GS_SHADOW
    are the opposite way around in FRED mode, as opposed to IDT mode.
    
    This leads to the following changes:
    
      * In load_segments(), we already load both GSes.  Account for FRED in the
        SWAP() condition and avoid the path with SWAGS.
    
      * In save_segments(), we need to read GS_SHADOW rather than GS_BASE.
    
      * In toggle_guest_mode(), we need to emulate SWAPGS.
    
      * In {read,write}_msr() which access the live registers, GS_SHADOW and
        GS_BASE need swapping.
    
      * In do_set_segment_base(), merge the SEGBASE_GS_{USER,KERNEL} cases and
        take FRED into account when choosing which base to update.
    
        SEGBASE_GS_USER_SEL was already an LKGS invocation (decades before FRED)
        so under FRED needs to be just a MOV %gs.  Simply skip the SWAPGSes.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    (cherry picked from commit 9ea7d7f9393c52de36ee9c42b52c235949453a2a)
---
 xen/arch/x86/domain.c             | 16 +++++++++++-----
 xen/arch/x86/pv/domain.c          | 22 ++++++++++++++++++++--
 xen/arch/x86/pv/emul-priv-op.c    | 26 +++++++++++++++++---------
 xen/arch/x86/pv/misc-hypercalls.c | 23 +++++++++++++++--------
 4 files changed, 63 insertions(+), 24 deletions(-)

diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index bdbf680fe2..ff990bab49 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -1815,9 +1815,10 @@ static void load_segments(struct vcpu *n)
 
         /*
          * Figure out which way around gsb/gss want to be.  gsb needs to be
-         * the active context, and gss needs to be the inactive context.
+         * the active context, and gss needs to be the inactive context,
+         * unless we're in FRED mode where they're reversed.
          */
-        if ( !(n->arch.flags & TF_kernel_mode) )
+        if ( !(n->arch.flags & TF_kernel_mode) ^ opt_fred )
             SWAP(gsb, gss);
 
         if ( using_svm() && (n->arch.pv.fs | n->arch.pv.gs) <= 3 )
@@ -1838,7 +1839,9 @@ static void load_segments(struct vcpu *n)
 
     if ( !fs_gs_done && !compat )
     {
-        if ( read_cr4() & X86_CR4_FSGSBASE )
+        unsigned long cr4 = read_cr4();
+
+        if ( !(cr4 & X86_CR4_FRED) && (cr4 & X86_CR4_FSGSBASE) )
         {
             __wrgsbase(gss);
             __wrfsbase(n->arch.pv.fs_base);
@@ -1955,6 +1958,9 @@ static void load_segments(struct vcpu *n)
  * Guests however cannot use SWAPGS, so there is no mechanism to modify the
  * inactive GS base behind Xen's back.  Therefore, Xen's copy of the inactive
  * GS base is still accurate, and doesn't need reading back from hardware.
+ *
+ * Under FRED, hardware automatically swaps GS for us, so SHADOW_GS is the
+ * active GS from the guest's point of view.
  */
 static void save_segments(struct vcpu *v)
 {
@@ -1970,12 +1976,12 @@ static void save_segments(struct vcpu *v)
         if ( read_cr4() & X86_CR4_FSGSBASE )
         {
             fs_base = __rdfsbase();
-            gs_base = __rdgsbase();
+            gs_base = opt_fred ? rdmsr(MSR_SHADOW_GS_BASE) : __rdgsbase();
         }
         else
         {
             fs_base = rdmsr(MSR_FS_BASE);
-            gs_base = rdmsr(MSR_GS_BASE);
+            gs_base = opt_fred ? rdmsr(MSR_SHADOW_GS_BASE) : rdmsr(MSR_GS_BASE);
         }
 
         v->arch.pv.fs_base = fs_base;
diff --git a/xen/arch/x86/pv/domain.c b/xen/arch/x86/pv/domain.c
index a97831efe9..ef4f442e73 100644
--- a/xen/arch/x86/pv/domain.c
+++ b/xen/arch/x86/pv/domain.c
@@ -14,9 +14,10 @@
 #include <asm/cpufeature.h>
 #include <asm/fsgsbase.h>
 #include <asm/invpcid.h>
-#include <asm/spec_ctrl.h>
 #include <asm/pv/domain.h>
 #include <asm/shadow.h>
+#include <asm/spec_ctrl.h>
+#include <asm/traps.h>
 
 #ifdef CONFIG_PV32
 int8_t __read_mostly opt_pv32 = -1;
@@ -508,11 +509,28 @@ void toggle_guest_mode(struct vcpu *v)
      * subsequent context switch won't bother re-reading it.
      */
     gs_base = read_gs_base();
+
+    /*
+     * In FRED mode, not only are the two GSes the other way around (i.e. we
+     * want to read GS_SHADOW here), the SWAPGS instruction is disallowed so
+     * we have to emulate it.
+     */
+    if ( opt_fred )
+    {
+        unsigned long gs_shadow = rdmsr(MSR_SHADOW_GS_BASE);
+
+        wrmsrns(MSR_SHADOW_GS_BASE, gs_base);
+        write_gs_base(gs_shadow);
+
+        gs_base = gs_shadow;
+    }
+    else
+        asm volatile ( "swapgs" );
+
     if ( v->arch.flags & TF_kernel_mode )
         v->arch.pv.gs_base_kernel = gs_base;
     else
         v->arch.pv.gs_base_user = gs_base;
-    asm volatile ( "swapgs" );
 
     _toggle_guest_pt(v);
 
diff --git a/xen/arch/x86/pv/emul-priv-op.c b/xen/arch/x86/pv/emul-priv-op.c
index 0ba446d812..548ad16cb8 100644
--- a/xen/arch/x86/pv/emul-priv-op.c
+++ b/xen/arch/x86/pv/emul-priv-op.c
@@ -24,6 +24,7 @@
 #include <asm/pv/trace.h>
 #include <asm/shared.h>
 #include <asm/stubs.h>
+#include <asm/traps.h>
 
 #include <xsm/xsm.h>
 
@@ -910,7 +911,8 @@ static int cf_check read_msr(
     case MSR_GS_BASE:
         if ( !cp->extd.lm )
             break;
-        *val = read_gs_base();
+        /* Under FRED, GS is automatically swapped on privilege change. */
+        *val = opt_fred ? rdmsr(MSR_SHADOW_GS_BASE) : read_gs_base();
         return X86EMUL_OKAY;
 
     case MSR_SHADOW_GS_BASE:
@@ -1049,17 +1051,23 @@ static int cf_check write_msr(
         if ( !cp->extd.lm || !is_canonical_address(val) )
             break;
 
-        if ( reg == MSR_FS_BASE )
-            write_fs_base(val);
-        else if ( reg == MSR_GS_BASE )
-            write_gs_base(val);
-        else if ( reg == MSR_SHADOW_GS_BASE )
+        switch ( reg )
         {
-            write_gs_shadow(val);
+        case MSR_FS_BASE:
+            write_fs_base(val);
+            break;
+
+        case MSR_SHADOW_GS_BASE:
             curr->arch.pv.gs_base_user = val;
+            fallthrough;
+        case MSR_GS_BASE:
+            /* Under FRED, GS is automatically swapped on privilege change. */
+            if ( (reg == MSR_GS_BASE) ^ opt_fred )
+                write_gs_base(val);
+            else
+                write_gs_shadow(val);
+            break;
         }
-        else
-            ASSERT_UNREACHABLE();
         return X86EMUL_OKAY;
 
     case MSR_EFER:
diff --git a/xen/arch/x86/pv/misc-hypercalls.c b/xen/arch/x86/pv/misc-hypercalls.c
index 4c2abeb4ad..7e915d86b7 100644
--- a/xen/arch/x86/pv/misc-hypercalls.c
+++ b/xen/arch/x86/pv/misc-hypercalls.c
@@ -11,6 +11,7 @@
 
 #include <asm/debugreg.h>
 #include <asm/fsgsbase.h>
+#include <asm/traps.h>
 
 long do_set_debugreg(int reg, unsigned long value)
 {
@@ -192,11 +193,13 @@ long do_set_segment_base(unsigned int which, unsigned long base)
 
         case SEGBASE_GS_USER:
             v->arch.pv.gs_base_user = base;
-            write_gs_shadow(base);
-            break;
-
+            fallthrough;
         case SEGBASE_GS_KERNEL:
-            write_gs_base(base);
+            /* Under FRED, GS is automatically swapped on privilege change. */
+            if ( (which == SEGBASE_GS_KERNEL) ^ opt_fred )
+                write_gs_base(base);
+            else
+                write_gs_shadow(base);
             break;
         }
         break;
@@ -206,10 +209,13 @@ long do_set_segment_base(unsigned int which, unsigned long base)
         unsigned int sel = (uint16_t)base;
 
         /*
-         * We wish to update the user %gs from the GDT/LDT.  Currently, the
-         * guest kernel's GS_BASE is in context.
+         * We wish to update the user %gs from the GDT/LDT.  Currently, we are
+         * in guest kernel context.
+         *
+         * Under IDT, this means updating GS_SHADOW.  Under FRED, plain GS.
          */
-        asm volatile ( "swapgs" );
+        if ( !opt_fred )
+            asm volatile ( "swapgs" );
 
         if ( sel > 3 )
             /* Fix up RPL for non-NUL selectors. */
@@ -247,7 +253,8 @@ long do_set_segment_base(unsigned int which, unsigned long base)
         /* Update the cache of the inactive base, as read from the GDT/LDT. */
         v->arch.pv.gs_base_user = read_gs_base();
 
-        asm volatile ( safe_swapgs );
+        if ( !opt_fred )
+            asm volatile ( safe_swapgs );
         break;
     }
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.21


From xen-changelog-bounces@lists.xenproject.org Tue Mar 24 08:25:04 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Mar 2026 08:25:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1260084.1553438 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4x4S-0005xa-QP; Tue, 24 Mar 2026 08:25:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1260084.1553438; Tue, 24 Mar 2026 08:25:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4x4S-0005xS-Nn; Tue, 24 Mar 2026 08:25:04 +0000
Received: by outflank-mailman (input) for mailman id 1260084;
 Tue, 24 Mar 2026 08:25:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w4x4R-0005xI-VS
 for xen-changelog@lists.xenproject.org; Tue, 24 Mar 2026 08:25:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4x4S-00790i-0W
 for xen-changelog@lists.xenproject.org;
 Tue, 24 Mar 2026 08:25:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4x4R-00Bdq9-2y
 for xen-changelog@lists.xenproject.org;
 Tue, 24 Mar 2026 08:25:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=gA94DG0cyNnW5UdPF8JEc8xIIR13nWPQr75Oq+UIEdM=; b=7Kvld5OFpgRJXno9ZmqtA5k6+A
	3hTqBQeYFzD+jQpJO4gEfumcElbimAxUcbcLhYRLG/UipmZGKRG72E/evpXvNfn851sUoV0mWX25c
	XD9pOq8LWuKxggtjnWdb4pYMEyBFqKHTtwaxzUQrelwvhw2t2FDmL3ePz3vUHC3dE574=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.21] x86/pv: Guest exception handling in FRED mode
Message-Id: <E1w4x4R-00Bdq9-2y@xenbits.xenproject.org>
Date: Tue, 24 Mar 2026 08:25:03 +0000

commit 889041f06ffae39df3938dc9f97fb8d151b4efb2
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Aug 11 15:55:24 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 17 12:13:50 2026 +0000

    x86/pv: Guest exception handling in FRED mode
    
    Under FRED, entry_from_pv() handles everything.  To start with, implement
    exception handling in the same manner as entry_from_xen(), although we can
    unconditionally enable interrupts after the async/fatal events.
    
    After entry_from_pv() returns, test_all_events() needs to run to perform
    exception and interrupt injection.  Split entry_FRED_R3() into two and
    introduce eretu_exit_to_guest() as the latter half, coming unilaterally from
    restore_all_guest().
    
    For all of this, there is a slightly complicated relationship with CONFIG_PV.
    entry_FRED_R3() must exist irrespective of CONFIG_PV, because it's the
    entrypoint registered with hardware.  For simplicity, entry_from_pv() is
    always called, but it collapses into fatal_trap() in the !PV case.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    (cherry picked from commit 87cfcbe9f0b522f9498101b6a698dd8fbf6509b7)
---
 xen/arch/x86/traps.c             | 78 +++++++++++++++++++++++++++++++++++++++-
 xen/arch/x86/x86_64/entry-fred.S | 13 ++++++-
 xen/arch/x86/x86_64/entry.S      |  4 ++-
 3 files changed, 92 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index 178169dc5f..6a8ebcb3c2 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -2271,9 +2271,85 @@ void asmlinkage check_ist_exit(const struct cpu_user_regs *regs, bool ist_exit)
 
 void asmlinkage entry_from_pv(struct cpu_user_regs *regs)
 {
+    struct fred_info *fi = cpu_regs_fred_info(regs);
+    uint8_t type = regs->fred_ss.type;
+    uint8_t vec = regs->fred_ss.vector;
+
     /* Copy fred_ss.vector into entry_vector as IDT delivery would have done. */
-    regs->entry_vector = regs->fred_ss.vector;
+    regs->entry_vector = vec;
+
+    if ( !IS_ENABLED(CONFIG_PV) )
+        goto fatal;
+
+    /*
+     * First, handle the asynchronous or fatal events.  These are either
+     * unrelated to the interrupted context, or may not have valid context
+     * recorded, and all have special rules on how/whether to re-enable IRQs.
+     */
+    if ( regs->fred_ss.nested )
+        goto fatal;
+
+    switch ( type )
+    {
+    case X86_ET_EXT_INTR:
+        return do_IRQ(regs);
+
+    case X86_ET_NMI:
+        return do_nmi(regs);
+
+    case X86_ET_HW_EXC:
+        switch ( vec )
+        {
+        case X86_EXC_DF: return do_double_fault(regs);
+        case X86_EXC_MC: return do_machine_check(regs);
+        }
+        break;
+    }
 
+    /*
+     * With the asynchronous events handled, what remains are the synchronous
+     * ones.  PV guest context always had interrupts enabled.
+     */
+    local_irq_enable();
+
+    switch ( type )
+    {
+    case X86_ET_HW_EXC:
+    case X86_ET_PRIV_SW_EXC:
+    case X86_ET_SW_EXC:
+        switch ( vec )
+        {
+        case X86_EXC_PF:  handle_PF(regs, fi->edata); break;
+        case X86_EXC_GP:  do_general_protection(regs); break;
+        case X86_EXC_UD:  do_invalid_op(regs); break;
+        case X86_EXC_NM:  do_device_not_available(regs); break;
+        case X86_EXC_BP:  do_int3(regs); break;
+        case X86_EXC_DB:  handle_DB(regs, fi->edata); break;
+        case X86_EXC_CP:  do_entry_CP(regs); break;
+
+        case X86_EXC_DE:
+        case X86_EXC_OF:
+        case X86_EXC_BR:
+        case X86_EXC_NP:
+        case X86_EXC_SS:
+        case X86_EXC_MF:
+        case X86_EXC_AC:
+        case X86_EXC_XM:
+            do_trap(regs);
+            break;
+
+        default:
+            goto fatal;
+        }
+        break;
+
+    default:
+        goto fatal;
+    }
+
+    return;
+
+ fatal:
     fatal_trap(regs, false);
 }
 
diff --git a/xen/arch/x86/x86_64/entry-fred.S b/xen/arch/x86/x86_64/entry-fred.S
index 3c3320df22..a1ff9a4a97 100644
--- a/xen/arch/x86/x86_64/entry-fred.S
+++ b/xen/arch/x86/x86_64/entry-fred.S
@@ -15,9 +15,20 @@ FUNC(entry_FRED_R3, 4096)
         mov     %rsp, %rdi
         call    entry_from_pv
 
+#ifdef CONFIG_PV
+        GET_STACK_END(14)
+        movq    STACK_CPUINFO_FIELD(current_vcpu)(%r14), %rbx
+
+        jmp     test_all_events
+#else
+        BUG     /* Not Reached */
+#endif
+END(entry_FRED_R3)
+
+FUNC(eretu_exit_to_guest)
         POP_GPRS
         eretu
-END(entry_FRED_R3)
+END(eretu_exit_to_guest)
 
         /* The Ring0 entrypoint is at Ring3 + 0x100. */
         .org entry_FRED_R3 + 0x100, 0xcc
diff --git a/xen/arch/x86/x86_64/entry.S b/xen/arch/x86/x86_64/entry.S
index c02245ac06..e10444c1ff 100644
--- a/xen/arch/x86/x86_64/entry.S
+++ b/xen/arch/x86/x86_64/entry.S
@@ -64,7 +64,7 @@ UNLIKELY_END(syscall_no_callback)
         /* Conditionally clear DF */
         and   %esi, UREGS_eflags(%rsp)
 /* %rbx: struct vcpu */
-test_all_events:
+LABEL(test_all_events, 0)
         ASSERT_NOT_IN_ATOMIC
         cli                             # tests must not race interrupts
 /*test_softirqs:*/
@@ -153,6 +153,8 @@ END(switch_to_kernel)
 FUNC_LOCAL(restore_all_guest)
         ASSERT_INTERRUPTS_DISABLED
 
+        ALTERNATIVE "", "jmp eretu_exit_to_guest", X86_FEATURE_XEN_FRED
+
         /* Stash guest SPEC_CTRL value while we can read struct vcpu. */
         mov VCPU_arch_msrs(%rbx), %rdx
         mov VCPUMSR_spec_ctrl_raw(%rdx), %r15d
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.21


From xen-changelog-bounces@lists.xenproject.org Tue Mar 24 08:25:14 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Mar 2026 08:25:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1260086.1553443 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4x4c-0005zr-Ru; Tue, 24 Mar 2026 08:25:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1260086.1553443; Tue, 24 Mar 2026 08:25:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4x4c-0005zj-PJ; Tue, 24 Mar 2026 08:25:14 +0000
Received: by outflank-mailman (input) for mailman id 1260086;
 Tue, 24 Mar 2026 08:25:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w4x4c-0005zd-1s
 for xen-changelog@lists.xenproject.org; Tue, 24 Mar 2026 08:25:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4x4c-00790o-0m
 for xen-changelog@lists.xenproject.org;
 Tue, 24 Mar 2026 08:25:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4x4c-00BdqZ-01
 for xen-changelog@lists.xenproject.org;
 Tue, 24 Mar 2026 08:25:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=EO4GVhzYl7MW5wDTFFYjyuACGaiZS6+huwQlDWA2Qds=; b=f+MXTxITpYMmZ+Ypk2X+9yAM4f
	s9JLkqQLp5pRIU0Pg4M+RmhfcEFSyESIO6nw1zePfXGJOiJ2axOVnGrZzLLMYIwG2UiblPNl8fwub
	RW1R5CHcEgZSy2vMNgUEAH5IXYYM51t/3AUvXuiZDPkToKlahBwEYudUqqJJqVleWMS4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.21] x86/pv: ERETU error handling
Message-Id: <E1w4x4c-00BdqZ-01@xenbits.xenproject.org>
Date: Tue, 24 Mar 2026 08:25:14 +0000

commit 6ad825078ee9ea8b6b1fcc241ceacaadfd97a79e
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Aug 13 15:02:26 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 17 12:13:50 2026 +0000

    x86/pv: ERETU error handling
    
    ERETU can fault for guest reasons, and like IRET needs special handling to
    forward the error into the guest.
    
    As this is largely written in C, take the opportunity to better classify the
    sources of error, and in particular, not forward errors that are actually
    Xen's fault into the guest, opting for a domain crash instead.
    
    Because ERETU does not enable NMIs if it faults, a corner case exists if an
    NMI was taken while in guest context, and the ERETU back out faults.  Recovery
    must involve an ERETS with the interrupted context's NMI flag.
    
    See the comments for full details.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    (cherry picked from commit 99edc6c2a0f5886474e017dd0bdd5829e0605455)
---
 xen/arch/x86/traps.c             | 115 +++++++++++++++++++++++++++++++++++++++
 xen/arch/x86/x86_64/entry-fred.S |  13 +++++
 2 files changed, 128 insertions(+)

diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index 6a8ebcb3c2..d470908736 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -2353,6 +2353,113 @@ void asmlinkage entry_from_pv(struct cpu_user_regs *regs)
     fatal_trap(regs, false);
 }
 
+void nocall eretu_error_dom_crash(void);
+
+/*
+ * Classify an event at the ERETU instruction, and handle if possible.
+ * Returns @true if handled, @false if the event should continue down the
+ * normal handlers.
+ */
+static bool handle_eretu_event(struct cpu_user_regs *regs)
+{
+    unsigned long recover;
+
+    /*
+     * WARNING: The GPRs in gregs overlaps with regs.  Only gregs->error_code
+     *          and later are legitimate to access.
+     */
+    struct cpu_user_regs *gregs =
+        _p(regs->rsp - offsetof(struct cpu_user_regs, error_code));
+
+    /*
+     * The asynchronous or fatal events (INTR, NMI, #MC, #DF) have been dealt
+     * with, meaning we only have synchronous ones to consider.  Anything
+     * which isn't a hardware exception (e.g. #BP) wants handling normally.
+     */
+    if ( regs->fred_ss.type != X86_ET_HW_EXC )
+        return false;
+
+    /*
+     * Guests are permitted to write non-present GDT/LDT entries.  Therefore
+     * #NP[sel] (%cs) and #SS[sel] (%ss) must be handled as guest errors.  The
+     * only other source of #SS is for a bad %ss-relative memory access in
+     * Xen, and if the stack is that bad, we'll have escalated to #DF.
+     *
+     * #PF can happen from ERETU accessing the GDT/LDT.  Xen may translate
+     * these into #GP for the guest, so must be handled as guest errors.  In
+     * theory we can get #PF for a bad instruction fetch or bad stack access,
+     * but either of these will be fatal and not end up here.
+     */
+    switch ( regs->fred_ss.vector )
+    {
+    case X86_EXC_GP:
+        /*
+         * #GP[0] can occur because of a NULL %cs or %ss (which are a guest
+         * error), but some #GP[0]'s are errors in Xen (ERETU at SL != 0), or
+         * errors of Xen's handling of guest state (bad metadata).
+         *
+         * These magic numbers came from the FRED Spec; they check that ERETU
+         * is trying to return to Ring 3, and that reserved or inapplicable
+         * bits are 0.
+         */
+        if ( regs->error_code == 0 && (gregs->cs & ~3) && (gregs->ss & ~3) &&
+             (regs->fred_cs.sl != 0 ||
+              (gregs->csx    & 0xffffffffffff0003UL) != 3 ||
+              (gregs->rflags & 0xffffffffffc2b02aUL) != 2 ||
+              (gregs->ssx    &         0xfff80003UL) != 3) )
+        {
+            recover = (unsigned long)eretu_error_dom_crash;
+
+            if ( regs->fred_cs.sl )
+                gprintk(XENLOG_ERR, "ERETU at SL %u\n", regs->fred_cs.sl);
+            else
+                gprintk(XENLOG_ERR, "Bad return state: csx %#lx, rflags %#lx, ssx %#x\n",
+                        gregs->csx, gregs->rflags, (unsigned int)gregs->ssx);
+            break;
+        }
+        fallthrough;
+    case X86_EXC_NP:
+    case X86_EXC_SS:
+    case X86_EXC_PF:
+        recover = (unsigned long)entry_FRED_R3;
+        break;
+
+        /*
+         * Handle everything else normally.  e.g. #DB would be debugging
+         * activities in Xen.  In theory we can get #UD if CR4.FRED gets
+         * cleared, but in practice if that were the case we wouldn't be here
+         * handling the result.
+         */
+    default:
+        return false;
+    }
+
+    this_cpu(last_extable_addr) = regs->rip;
+
+    /*
+     * If an NMI was taken in guest context and the ERETU faulted, NMIs will
+     * still be blocked.  Therefore we copy the interrupted frame's NMI status
+     * into our own, and must ERETS as part of recovery.
+     */
+    regs->fred_ss.nmi = gregs->fred_ss.nmi;
+
+    /*
+     * Next, copy the exception information from the current frame back onto
+     * the interrupted frame, preserving the interrupted frame's %cs and %ss.
+     */
+    *cpu_regs_fred_info(regs) = *cpu_regs_fred_info(gregs);
+    gregs->ssx = (regs->ssx & ~0xffff) | gregs->ss;
+    gregs->csx = (regs->csx & ~0xffff) | gregs->cs;
+    gregs->error_code   = regs->error_code;
+    gregs->entry_vector = regs->entry_vector;
+
+    fixup_exception_return(regs, recover, 0);
+
+    return true;
+}
+
+void nocall eretu(void);
+
 void asmlinkage entry_from_xen(struct cpu_user_regs *regs)
 {
     struct fred_info *fi = cpu_regs_fred_info(regs);
@@ -2394,6 +2501,14 @@ void asmlinkage entry_from_xen(struct cpu_user_regs *regs)
     if ( regs->eflags & X86_EFLAGS_IF )
         local_irq_enable();
 
+    /*
+     * An event taken at the ERETU instruction may be because of bad guest
+     * state.  If so, it will need special handling.
+     */
+    if ( unlikely(regs->rip == (unsigned long)eretu) &&
+         handle_eretu_event(regs) )
+        return;
+
     switch ( type )
     {
     case X86_ET_HW_EXC:
diff --git a/xen/arch/x86/x86_64/entry-fred.S b/xen/arch/x86/x86_64/entry-fred.S
index a1ff9a4a97..2fa57beb93 100644
--- a/xen/arch/x86/x86_64/entry-fred.S
+++ b/xen/arch/x86/x86_64/entry-fred.S
@@ -27,9 +27,22 @@ END(entry_FRED_R3)
 
 FUNC(eretu_exit_to_guest)
         POP_GPRS
+
+        /*
+         * Exceptions here are handled by redirecting either to
+         * entry_FRED_R3() (for an error to be passed to the guest), or to
+         * eretu_error_dom_crash() (for a Xen error handling guest state).
+         */
+LABEL(eretu, 0)
         eretu
 END(eretu_exit_to_guest)
 
+FUNC(eretu_error_dom_crash)
+        PUSH_AND_CLEAR_GPRS
+        sti
+        call    asm_domain_crash_synchronous  /* Does not return */
+END(eretu_error_dom_crash)
+
         /* The Ring0 entrypoint is at Ring3 + 0x100. */
         .org entry_FRED_R3 + 0x100, 0xcc
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.21


From xen-changelog-bounces@lists.xenproject.org Tue Mar 24 08:25:24 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Mar 2026 08:25:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1260088.1553446 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4x4m-000623-TE; Tue, 24 Mar 2026 08:25:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1260088.1553446; Tue, 24 Mar 2026 08:25:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4x4m-00061v-Qj; Tue, 24 Mar 2026 08:25:24 +0000
Received: by outflank-mailman (input) for mailman id 1260088;
 Tue, 24 Mar 2026 08:25:24 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w4x4m-00061l-4e
 for xen-changelog@lists.xenproject.org; Tue, 24 Mar 2026 08:25:24 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4x4m-00790w-13
 for xen-changelog@lists.xenproject.org;
 Tue, 24 Mar 2026 08:25:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4x4m-00Bdqx-0I
 for xen-changelog@lists.xenproject.org;
 Tue, 24 Mar 2026 08:25:24 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=paRHfTbUFmtiHewY0tGT3xapWCk3bnTCPqHX1tup6NI=; b=xfpJYpcUF6HvXGXAbvr3XZ3Zz3
	dIVV+mg/goQB3EzQqD/B0QYkGzXmPfpZS9CRvPFqkJyZn83e+NxnKW1mS779PSjbT+ptVbhNx0/OP
	oKmsYjlG7S6YrlBohONfCw4TD2qlFEEWm6MEDoG8MiSWzY/1YSsM+CFTowsRcMtxAUP0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.21] x86/pv: System call handling in FRED mode
Message-Id: <E1w4x4m-00Bdqx-0I@xenbits.xenproject.org>
Date: Tue, 24 Mar 2026 08:25:24 +0000

commit c8b536ec186fcdaf689861c1513292092f01e216
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Aug 11 15:55:24 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 17 12:13:50 2026 +0000

    x86/pv: System call handling in FRED mode
    
    Under FRED, entry_from_pv() handles everything, even system call instructions.
    This means more of our logic is written in C now, rather than assembly.
    
    In order to facilitate this, introduce pv_inject_callback(), which reuses
    struct trap_bounce infrastructure to inject the syscall/sysenter callbacks.
    This in turns requires some !PV compatibility for pv_inject_callback() and
    pv_hypercall() which can both be ASSERT_UNREACHABLE().
    
    For each of INT $N, SYSCALL and SYSENTER, FRED gives us interrupted context
    which was previously lost.  As the guest can't see FRED, Xen has to lose state
    in the same way to maintain the prior behaviour.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    (cherry picked from commit 76193ef47d9165a2c85b1f0c9e40c6018c5ef943)
---
 xen/arch/x86/include/asm/domain.h    |   2 +
 xen/arch/x86/include/asm/hypercall.h |   2 -
 xen/arch/x86/pv/traps.c              |  39 +++++++++++
 xen/arch/x86/traps.c                 | 126 +++++++++++++++++++++++++++++++++++
 4 files changed, 167 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/include/asm/domain.h b/xen/arch/x86/include/asm/domain.h
index 5df8c78253..828f42c3e4 100644
--- a/xen/arch/x86/include/asm/domain.h
+++ b/xen/arch/x86/include/asm/domain.h
@@ -710,6 +710,8 @@ void arch_vcpu_regs_init(struct vcpu *v);
 struct vcpu_hvm_context;
 int arch_set_info_hvm_guest(struct vcpu *v, const struct vcpu_hvm_context *ctx);
 
+void pv_inject_callback(unsigned int type);
+
 #ifdef CONFIG_PV
 void pv_inject_event(const struct x86_event *event);
 #else
diff --git a/xen/arch/x86/include/asm/hypercall.h b/xen/arch/x86/include/asm/hypercall.h
index f6e9e2313b..ded3c24d40 100644
--- a/xen/arch/x86/include/asm/hypercall.h
+++ b/xen/arch/x86/include/asm/hypercall.h
@@ -18,9 +18,7 @@
 
 #define __HYPERVISOR_paging_domctl_cont __HYPERVISOR_arch_1
 
-#ifdef CONFIG_PV
 void pv_hypercall(struct cpu_user_regs *regs);
-#endif
 
 void pv_ring1_init_hypercall_page(void *ptr);
 void pv_ring3_init_hypercall_page(void *ptr);
diff --git a/xen/arch/x86/pv/traps.c b/xen/arch/x86/pv/traps.c
index c3c0976c44..00de034126 100644
--- a/xen/arch/x86/pv/traps.c
+++ b/xen/arch/x86/pv/traps.c
@@ -19,6 +19,8 @@
 #include <asm/shared.h>
 #include <asm/traps.h>
 
+#include <public/callback.h>
+
 void pv_inject_event(const struct x86_event *event)
 {
     struct vcpu *curr = current;
@@ -95,6 +97,43 @@ void pv_inject_event(const struct x86_event *event)
     }
 }
 
+void pv_inject_callback(unsigned int type)
+{
+    struct vcpu *curr = current;
+    struct trap_bounce *tb = &curr->arch.pv.trap_bounce;
+    unsigned long rip;
+    bool irq;
+
+    ASSERT(is_pv_64bit_vcpu(curr));
+
+    switch ( type )
+    {
+    case CALLBACKTYPE_syscall:
+        rip = curr->arch.pv.syscall_callback_eip;
+        irq = curr->arch.pv.vgc_flags & VGCF_syscall_disables_events;
+        break;
+
+    case CALLBACKTYPE_syscall32:
+        rip = curr->arch.pv.syscall32_callback_eip;
+        irq = curr->arch.pv.syscall32_disables_events;
+        break;
+
+    case CALLBACKTYPE_sysenter:
+        rip = curr->arch.pv.sysenter_callback_eip;
+        irq = curr->arch.pv.sysenter_disables_events;
+        break;
+
+    default:
+        ASSERT_UNREACHABLE();
+        rip = 0;
+        irq = false;
+        break;
+    }
+
+    tb->flags = TBF_EXCEPTION | (irq ? TBF_INTERRUPT : 0);
+    tb->eip = rip;
+}
+
 /*
  * Called from asm to set up the MCE trapbounce info.
  * Returns false no callback is set up, else true.
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index d470908736..ac063b87d5 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -18,6 +18,7 @@
 #include <xen/delay.h>
 #include <xen/domain_page.h>
 #include <xen/guest_access.h>
+#include <xen/hypercall.h>
 #include <xen/init.h>
 #include <xen/mm.h>
 #include <xen/paging.h>
@@ -52,6 +53,8 @@
 #include <asm/uaccess.h>
 #include <asm/xenoprof.h>
 
+#include <public/callback.h>
+
 /*
  * opt_nmi: one of 'ignore', 'dom0', or 'fatal'.
  *  fatal:  Xen prints diagnostic message and then hangs.
@@ -2272,6 +2275,7 @@ void asmlinkage check_ist_exit(const struct cpu_user_regs *regs, bool ist_exit)
 void asmlinkage entry_from_pv(struct cpu_user_regs *regs)
 {
     struct fred_info *fi = cpu_regs_fred_info(regs);
+    struct vcpu *curr = current;
     uint8_t type = regs->fred_ss.type;
     uint8_t vec = regs->fred_ss.vector;
 
@@ -2314,6 +2318,38 @@ void asmlinkage entry_from_pv(struct cpu_user_regs *regs)
 
     switch ( type )
     {
+    case X86_ET_SW_INT:
+        /*
+         * For better or worse, Xen writes IDT vectors 3 and 4 with DPL3 (so
+         * INT3/INTO work), making INT $3/4 indistinguishable, and the guest
+         * choice of DPL for these vectors is ignored.
+         *
+         * Have them fall through into X86_ET_HW_EXC, as #BP in particular
+         * needs handling by do_int3() in case an external debugger is
+         * attached.
+         *
+         * As the event type is provided, INT $N instructions don't need #GP
+         * tricks to spot, and INT $0x80 doesn't need a fastpath.  As the
+         * guest is necessary PV64, INT $0x82 has no special meaning either.
+         *
+         * When converting to a fault, hardware finally gives us enough
+         * information to account for prefixes, so provide the more correct
+         * behaviour rather than assuming the instruction was two bytes long.
+         */
+        if ( vec != X86_EXC_BP && vec != X86_EXC_OF )
+        {
+            const struct trap_info *ti = &curr->arch.pv.trap_ctxt[vec];
+
+            if ( permit_softint(TI_GET_DPL(ti), curr, regs) )
+                pv_inject_sw_interrupt(vec);
+            else
+            {
+                regs->rip -= regs->fred_ss.insnlen;
+                pv_inject_hw_exception(X86_EXC_GP, (vec << 3) | X86_XEC_IDT);
+            }
+            break;
+        }
+        fallthrough;
     case X86_ET_HW_EXC:
     case X86_ET_PRIV_SW_EXC:
     case X86_ET_SW_EXC:
@@ -2343,6 +2379,96 @@ void asmlinkage entry_from_pv(struct cpu_user_regs *regs)
         }
         break;
 
+    case X86_ET_OTHER:
+        switch ( regs->fred_ss.vector )
+        {
+        case 1: /* SYSCALL */
+        {
+            /*
+             * FRED delivery preserves the interrupted %cs/%ss, but previously
+             * SYSCALL lost the interrupted selectors, and SYSRET forced the
+             * use of the ones in MSR_STAR.
+             *
+             * The guest isn't aware of FRED, so recreate the legacy
+             * behaviour.
+             *
+             * The non-FRED SYSCALL path sets TRAP_syscall in entry_vector to
+             * signal that SYSRET can be used, but this isn't relevant in FRED
+             * mode.
+             *
+             * When setting the selectors, clear all upper metadata again for
+             * backwards compatibility.  In particular fred_ss.swint becomes
+             * pend_DB on ERETx, and nothing else in the pv_hypercall() would
+             * clean up.
+             *
+             * When converting to a fault, hardware finally gives us enough
+             * information to account for prefixes, so provide the more
+             * correct behaviour rather than assuming the instruction was two
+             * bytes long.
+             */
+            bool l = regs->fred_ss.l;
+            unsigned int len = regs->fred_ss.insnlen;
+
+            regs->ssx = l ? FLAT_KERNEL_SS   : FLAT_USER_SS32;
+            regs->csx = l ? FLAT_KERNEL_CS64 : FLAT_USER_CS32;
+
+            if ( guest_kernel_mode(curr, regs) )
+                pv_hypercall(regs);
+            else if ( (l ? curr->arch.pv.syscall_callback_eip
+                         : curr->arch.pv.syscall32_callback_eip) == 0 )
+            {
+                regs->rip -= len;
+                pv_inject_hw_exception(X86_EXC_UD, X86_EVENT_NO_EC);
+            }
+            else
+            {
+                /*
+                 * The PV ABI, given no virtual SYSCALL_MASK, hardcodes that
+                 * DF is cleared.  Other flags are handled in the same way as
+                 * interrupts and exceptions in create_bounce_frame().
+                 */
+                regs->eflags &= ~X86_EFLAGS_DF;
+                pv_inject_callback(l ? CALLBACKTYPE_syscall
+                                     : CALLBACKTYPE_syscall32);
+            }
+            break;
+        }
+
+        case 2: /* SYSENTER */
+        {
+            /*
+             * FRED delivery preserves the interrupted state, but previously
+             * SYSENTER discarded almost everything.
+             *
+             * The guest isn't aware of FRED, so recreate the legacy
+             * behaviour.
+             *
+             * When setting the selectors, clear all upper metadata.  In
+             * particular fred_ss.swint becomes pend_DB on ERETx.
+             *
+             * When converting to a fault, hardware finally gives us enough
+             * information to account for prefixes, so provide the more
+             * correct behaviour rather than assuming the instruction was two
+             * bytes long.
+             */
+            regs->ssx = FLAT_USER_SS;
+            regs->rsp = 0;
+            regs->eflags &= ~(X86_EFLAGS_VM | X86_EFLAGS_IF);
+            regs->csx = 3;
+            regs->rip = 0;
+
+            if ( !curr->arch.pv.sysenter_callback_eip )
+                pv_inject_hw_exception(X86_EXC_GP, 0);
+            else
+                pv_inject_callback(CALLBACKTYPE_sysenter);
+            break;
+        }
+
+        default:
+            goto fatal;
+        }
+        break;
+
     default:
         goto fatal;
     }
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.21


From xen-changelog-bounces@lists.xenproject.org Tue Mar 24 08:25:34 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Mar 2026 08:25:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1260090.1553451 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4x4w-00064I-Us; Tue, 24 Mar 2026 08:25:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1260090.1553451; Tue, 24 Mar 2026 08:25:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4x4w-00064A-S9; Tue, 24 Mar 2026 08:25:34 +0000
Received: by outflank-mailman (input) for mailman id 1260090;
 Tue, 24 Mar 2026 08:25:34 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w4x4w-000641-7D
 for xen-changelog@lists.xenproject.org; Tue, 24 Mar 2026 08:25:34 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4x4w-00791G-1J
 for xen-changelog@lists.xenproject.org;
 Tue, 24 Mar 2026 08:25:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4x4w-00BdrJ-0Y
 for xen-changelog@lists.xenproject.org;
 Tue, 24 Mar 2026 08:25:34 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=QRKeKrX3Omy/Ovn8RFpFIRgwE6mZAYoiUMgvv8wsEf0=; b=a4Sqzl8jcbNca+efMIBQxjF9QB
	3dF+plaT7LAXTuQkkdMWyJm8QmFZ5YYSQlMut/YUV6PsxVKmBo3e+j6hp9C9y5CT1D3uKhfhhuaxG
	3CqoJ353sPkaLb/n6E8+H2w6MOr+KUI65WY7F6IU7b5dDcHdZgkhgUP2TMjqHQn623V0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.21] x86/traps: Use fatal_trap() for #UD and #GP
Message-Id: <E1w4x4w-00BdrJ-0Y@xenbits.xenproject.org>
Date: Tue, 24 Mar 2026 08:25:34 +0000

commit 4deb5b83b64164264046ef493e76acbefff0b428
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Feb 10 14:50:56 2026 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 17 12:13:50 2026 +0000

    x86/traps: Use fatal_trap() for #UD and #GP
    
    This renders the diagnostics in a more uniform way.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    (cherry picked from commit 705784e51212cd77031e95ee4ec8799c25e69fb5)
---
 xen/arch/x86/traps.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index ac063b87d5..85d835ab43 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -1376,8 +1376,7 @@ void asmlinkage do_invalid_op(struct cpu_user_regs *regs)
     if ( likely(extable_fixup(regs, true)) )
         return;
 
-    show_execution_state(regs);
-    panic("FATAL TRAP: vector = %d (invalid opcode)\n", X86_EXC_UD);
+    fatal_trap(regs, false);
 }
 
 void asmlinkage do_int3(struct cpu_user_regs *regs)
@@ -1476,8 +1475,7 @@ void do_general_protection(struct cpu_user_regs *regs)
         return;
 
  hardware_gp:
-    show_execution_state(regs);
-    panic("GENERAL PROTECTION FAULT\n[error_code=%04x]\n", regs->error_code);
+    fatal_trap(regs, false);
 }
 
 #ifdef CONFIG_PV
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.21


From xen-changelog-bounces@lists.xenproject.org Tue Mar 24 08:25:45 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Mar 2026 08:25:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1260092.1553455 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4x57-000673-1R; Tue, 24 Mar 2026 08:25:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1260092.1553455; Tue, 24 Mar 2026 08:25:45 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4x56-00066t-Uw; Tue, 24 Mar 2026 08:25:44 +0000
Received: by outflank-mailman (input) for mailman id 1260092;
 Tue, 24 Mar 2026 08:25:44 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w4x56-00066k-9o
 for xen-changelog@lists.xenproject.org; Tue, 24 Mar 2026 08:25:44 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4x56-00793j-1a
 for xen-changelog@lists.xenproject.org;
 Tue, 24 Mar 2026 08:25:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4x56-00Bdw1-0p
 for xen-changelog@lists.xenproject.org;
 Tue, 24 Mar 2026 08:25:44 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=NAtC+X93bQTNiT0v1NCB7C2yxN6ci4d3womNDNTA0Tc=; b=a+GGgGOJfACVUKvrmxO4J+6++V
	D2npDLvy3vjgYWGuzKNAYaqIWNAApQFkfl2DW1MAqw94oDOocseRO2lLwQz7DqxObm67pG2jaNAvp
	UShJBEwfK0o8ySOJLr4F7jHzcomNvvga5zcOobJQNJkrnR2jUci16jIIy9ywumCnR/ow=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.21] x86: Clamp bits in eflags more aggressively
Message-Id: <E1w4x56-00Bdw1-0p@xenbits.xenproject.org>
Date: Tue, 24 Mar 2026 08:25:44 +0000

commit 16a45172ae9e4880a501df57f4f66fed436e3734
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue May 27 15:58:46 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Mar 19 13:24:48 2026 +0000

    x86: Clamp bits in eflags more aggressively
    
    In FRED mode, ERET is stricter than IRET about flags.  Notably this means:
    
     * The vm86 bit (bit 17) and IOPL (bits 12,13) must be clear.
     * The sticky-1 reserved bit (bit 2) must be set, so dom0_construct() needs to
       set X86_EFLAGS_MBS in order for a PV dom0 to start.
     * All other reserved bits must be clear.
    
    Xen has been overly lax with reserved bit handling.  Adjust
    arch_set_info_guest*() and hypercall_iret() which consume flags to clamp the
    reserved bits for all guest types.
    
    This is a minor ABI change, but by the same argument as commit
    9f892f84c279 ("x86/domctl: Stop using XLAT_cpu_user_regs()"); the reserved
    bits would get clamped like this naturally by hardware when the vCPU is run.
    
    The handling of vm86 is also different.  Guests under 32bit Xen really could
    use vm86 mode, but Long Mode disallows vm86 mode and IRET simply ignores the
    bit.  Xen's behaviour for a PV32 guest trying to use vm86 mode under a 64bit
    Xen is to arrange to deliver #GP at the target of the IRET, rather than to
    fail the IRET itself.
    
    However there's no filtering in arch_set_info_guest() itself, and it can't
    arrange to queue a #GP at the target, so do the next best thing and fail the
    hypercall.  This is not expected to create an issue for PV guests, as the
    result of such an arch_set_info_guest() previously would be to run supposedly
    Real Mode code as Protected Mode code.
    
    This allows PV guests to start when Xen is using FRED mode.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    (cherry picked from commit dbd936248f3846449c0d0e192d544b592c1c44d5)
---
 xen/arch/x86/domain.c                | 24 ++++++++++++++++++++++--
 xen/arch/x86/hvm/domain.c            |  4 ++--
 xen/arch/x86/include/asm/x86-defns.h |  7 +++++++
 xen/arch/x86/pv/dom0_build.c         |  2 +-
 xen/arch/x86/pv/iret.c               |  8 +++++---
 5 files changed, 37 insertions(+), 8 deletions(-)

diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index ff990bab49..9af833b6da 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -1218,6 +1218,14 @@ int arch_set_info_guest(
 
             if ( !__addr_ok(c.nat->ldt_base) )
                 return -EINVAL;
+
+            /*
+             * IRET in Long Mode discards EFLAGS.VM, but in FRED mode ERET
+             * cares that it is zero.
+             *
+             * Guests can't see FRED, so emulate IRET behaviour.
+             */
+            c.nat->user_regs.rflags &= ~X86_EFLAGS_VM;
         }
 #ifdef CONFIG_COMPAT
         else
@@ -1230,6 +1238,18 @@ int arch_set_info_guest(
 
             for ( i = 0; i < ARRAY_SIZE(c.cmp->trap_ctxt); i++ )
                 fixup_guest_code_selector(d, c.cmp->trap_ctxt[i].cs);
+
+            /*
+             * Under 32bit Xen, PV guests could really use vm86 mode.  Under
+             * 64bit Xen, vm86 mode can't be entered even by PV32 guests.
+             *
+             * For backwards compatibility, compat HYPERCALL_iret will arrange
+             * to deliver #GP at the target of the IRET rather than to fail
+             * the IRET itself, but we can't arrange for the same behaviour
+             * here.  Reject the hypercall as the next best option.
+             */
+            if ( c.cmp->user_regs.eflags & X86_EFLAGS_VM )
+                return -EINVAL;
         }
 #endif
 
@@ -1269,7 +1289,7 @@ int arch_set_info_guest(
         v->arch.user_regs.rax               = c.nat->user_regs.rax;
         v->arch.user_regs.rip               = c.nat->user_regs.rip;
         v->arch.user_regs.cs                = c.nat->user_regs.cs;
-        v->arch.user_regs.rflags            = c.nat->user_regs.rflags;
+        v->arch.user_regs.rflags            = (c.nat->user_regs.rflags & X86_EFLAGS_ALL) | X86_EFLAGS_MBS;
         v->arch.user_regs.rsp               = c.nat->user_regs.rsp;
         v->arch.user_regs.ss                = c.nat->user_regs.ss;
         v->arch.pv.es                       = c.nat->user_regs.es;
@@ -1293,7 +1313,7 @@ int arch_set_info_guest(
         v->arch.user_regs.eax               = c.cmp->user_regs.eax;
         v->arch.user_regs.eip               = c.cmp->user_regs.eip;
         v->arch.user_regs.cs                = c.cmp->user_regs.cs;
-        v->arch.user_regs.eflags            = c.cmp->user_regs.eflags;
+        v->arch.user_regs.eflags            = (c.cmp->user_regs.eflags & X86_EFLAGS_ALL) | X86_EFLAGS_MBS;
         v->arch.user_regs.esp               = c.cmp->user_regs.esp;
         v->arch.user_regs.ss                = c.cmp->user_regs.ss;
         v->arch.pv.es                       = c.cmp->user_regs.es;
diff --git a/xen/arch/x86/hvm/domain.c b/xen/arch/x86/hvm/domain.c
index 048f29ae49..1e874d5989 100644
--- a/xen/arch/x86/hvm/domain.c
+++ b/xen/arch/x86/hvm/domain.c
@@ -194,7 +194,7 @@ int arch_set_info_hvm_guest(struct vcpu *v, const struct vcpu_hvm_context *ctx)
         uregs->rsi    = regs->esi;
         uregs->rdi    = regs->edi;
         uregs->rip    = regs->eip;
-        uregs->rflags = regs->eflags;
+        uregs->rflags = (regs->eflags & X86_EFLAGS_ALL) | X86_EFLAGS_MBS;
 
         v->arch.hvm.guest_cr[0] = regs->cr0;
         v->arch.hvm.guest_cr[3] = regs->cr3;
@@ -245,7 +245,7 @@ int arch_set_info_hvm_guest(struct vcpu *v, const struct vcpu_hvm_context *ctx)
         uregs->rsi    = regs->rsi;
         uregs->rdi    = regs->rdi;
         uregs->rip    = regs->rip;
-        uregs->rflags = regs->rflags;
+        uregs->rflags = (regs->rflags & X86_EFLAGS_ALL) | X86_EFLAGS_MBS;
 
         v->arch.hvm.guest_cr[0] = regs->cr0;
         v->arch.hvm.guest_cr[3] = regs->cr3;
diff --git a/xen/arch/x86/include/asm/x86-defns.h b/xen/arch/x86/include/asm/x86-defns.h
index 0a0ba83de7..edeb0b4ff9 100644
--- a/xen/arch/x86/include/asm/x86-defns.h
+++ b/xen/arch/x86/include/asm/x86-defns.h
@@ -27,6 +27,13 @@
     (X86_EFLAGS_CF | X86_EFLAGS_PF | X86_EFLAGS_AF |   \
      X86_EFLAGS_ZF | X86_EFLAGS_SF | X86_EFLAGS_OF)
 
+#define X86_EFLAGS_ALL                                          \
+    (X86_EFLAGS_ARITH_MASK | X86_EFLAGS_TF | X86_EFLAGS_IF |    \
+     X86_EFLAGS_DF | X86_EFLAGS_OF | X86_EFLAGS_IOPL |          \
+     X86_EFLAGS_NT | X86_EFLAGS_RF | X86_EFLAGS_VM |            \
+     X86_EFLAGS_AC | X86_EFLAGS_VIF | X86_EFLAGS_VIP |          \
+     X86_EFLAGS_ID)
+
 /*
  * Intel CPU flags in CR0
  */
diff --git a/xen/arch/x86/pv/dom0_build.c b/xen/arch/x86/pv/dom0_build.c
index 21158ce181..f9bbbea2ff 100644
--- a/xen/arch/x86/pv/dom0_build.c
+++ b/xen/arch/x86/pv/dom0_build.c
@@ -1021,7 +1021,7 @@ static int __init dom0_construct(const struct boot_domain *bd)
     regs->rip = parms.virt_entry;
     regs->rsp = vstack_end;
     regs->rsi = vstartinfo_start;
-    regs->eflags = X86_EFLAGS_IF;
+    regs->eflags = X86_EFLAGS_IF | X86_EFLAGS_MBS;
 
     /*
      * We don't call arch_set_info_guest(), so some initialisation needs doing
diff --git a/xen/arch/x86/pv/iret.c b/xen/arch/x86/pv/iret.c
index d3a1fb2c68..39ce316b8d 100644
--- a/xen/arch/x86/pv/iret.c
+++ b/xen/arch/x86/pv/iret.c
@@ -80,8 +80,9 @@ long do_iret(void)
 
     regs->rip    = iret_saved.rip;
     regs->cs     = iret_saved.cs | 3; /* force guest privilege */
-    regs->rflags = ((iret_saved.rflags & ~(X86_EFLAGS_IOPL|X86_EFLAGS_VM))
-                    | X86_EFLAGS_IF);
+    regs->rflags = ((iret_saved.rflags & X86_EFLAGS_ALL &
+                     ~(X86_EFLAGS_IOPL | X86_EFLAGS_VM)) |
+                    X86_EFLAGS_IF | X86_EFLAGS_MBS);
     regs->rsp    = iret_saved.rsp;
     regs->ss     = iret_saved.ss | 3; /* force guest privilege */
 
@@ -143,7 +144,8 @@ int compat_iret(void)
     if ( VM_ASSIST(v->domain, architectural_iopl) )
         v->arch.pv.iopl = eflags & X86_EFLAGS_IOPL;
 
-    regs->eflags = (eflags & ~X86_EFLAGS_IOPL) | X86_EFLAGS_IF;
+    regs->eflags = ((eflags & X86_EFLAGS_ALL & ~X86_EFLAGS_IOPL) |
+                    X86_EFLAGS_IF | X86_EFLAGS_MBS);
 
     if ( unlikely(eflags & X86_EFLAGS_VM) )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.21


From xen-changelog-bounces@lists.xenproject.org Tue Mar 24 08:25:55 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Mar 2026 08:25:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1260094.1553459 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4x5H-00069B-2X; Tue, 24 Mar 2026 08:25:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1260094.1553459; Tue, 24 Mar 2026 08:25:55 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4x5H-000693-02; Tue, 24 Mar 2026 08:25:55 +0000
Received: by outflank-mailman (input) for mailman id 1260094;
 Tue, 24 Mar 2026 08:25:54 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w4x5G-00068t-CI
 for xen-changelog@lists.xenproject.org; Tue, 24 Mar 2026 08:25:54 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4x5G-00793o-1p
 for xen-changelog@lists.xenproject.org;
 Tue, 24 Mar 2026 08:25:54 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4x5G-00Bdws-14
 for xen-changelog@lists.xenproject.org;
 Tue, 24 Mar 2026 08:25:54 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=kU0WjUS8PkBvGZPI44zwDYfk8pQnQ3wzPWXSppH0qQQ=; b=vya9dkY5+WAdIXca2fPRAxehml
	is890HpfyYxPMPo0LH+iiumexLlnOEK5bqRidSKrqAcV8oRaQCy1itverWJi/IhOqw4JUenN5mi8Y
	yflkuP230PdVdMJnniIYAcQmRYJQOenKwSiLwNhYZidgnxxNVcWoaYSHqryyXXtMDvkI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.21] x86/ucode: Exclude Zen6 from entrysign mitigations
Message-Id: <E1w4x5G-00Bdws-14@xenbits.xenproject.org>
Date: Tue, 24 Mar 2026 08:25:54 +0000

commit 74930b4a9d3688cb07b1df8997199d70e3957cee
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Mar 16 10:34:23 2026 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Mar 19 13:26:13 2026 +0000

    x86/ucode: Exclude Zen6 from entrysign mitigations
    
    Family 0x1a covers both Zen5 and Zen6, but the latter is not believed to be
    vulnerable to entrysign.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    (cherry picked from commit bd15fdedafb3a414aeafa918a9212148ac22ebb5)
---
 xen/arch/x86/cpu/microcode/amd.c | 6 ++++--
 xen/arch/x86/include/asm/amd.h   | 4 ++++
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/cpu/microcode/amd.c b/xen/arch/x86/cpu/microcode/amd.c
index e7ae1e8023..34e3a52753 100644
--- a/xen/arch/x86/cpu/microcode/amd.c
+++ b/xen/arch/x86/cpu/microcode/amd.c
@@ -20,6 +20,7 @@
 #include <xen/mm.h> /* TODO: Fix asm/tlbflush.h breakage */
 #include <xen/sha2.h>
 
+#include <asm/amd.h>
 #include <asm/msr.h>
 
 #include "private.h"
@@ -575,7 +576,7 @@ void __init ucode_probe_amd(struct microcode_ops *ops)
      * CPUs.  Taint Xen if digest checking is turned off.
      */
     if ( boot_cpu_data.family >= 0x17 && boot_cpu_data.family <= 0x1a &&
-         !opt_digest_check )
+         !is_zen6_uarch() && !opt_digest_check )
     {
         printk(XENLOG_WARNING
                "Microcode patch additional digest checks disabled\n");
@@ -616,7 +617,8 @@ void __init amd_check_entrysign(void)
 
     if ( boot_cpu_data.vendor != X86_VENDOR_AMD ||
          boot_cpu_data.family < 0x17 ||
-         boot_cpu_data.family > 0x1a )
+         boot_cpu_data.family > 0x1a ||
+         is_zen6_uarch() )
         return;
 
     /*
diff --git a/xen/arch/x86/include/asm/amd.h b/xen/arch/x86/include/asm/amd.h
index 72df42a6f6..5903b21890 100644
--- a/xen/arch/x86/include/asm/amd.h
+++ b/xen/arch/x86/include/asm/amd.h
@@ -149,6 +149,8 @@
  * For Zen3 and Zen4 (Fam19h) the heuristic is the presence of AutoIBRS, as
  * it's Zen4-specific.
  *
+ * For Zen5 and Zen6 (Fam1ah) the heuristic is the presence of FRED.
+ *
  * The caller is required to perform the appropriate vendor/family checks
  * first.
  */
@@ -156,6 +158,8 @@
 #define is_zen2_uarch()   boot_cpu_has(X86_FEATURE_AMD_STIBP)
 #define is_zen3_uarch() (!boot_cpu_has(X86_FEATURE_AUTO_IBRS))
 #define is_zen4_uarch()   boot_cpu_has(X86_FEATURE_AUTO_IBRS)
+#define is_zen5_uarch() (!boot_cpu_has(X86_FEATURE_FRED))
+#define is_zen6_uarch()   boot_cpu_has(X86_FEATURE_FRED)
 
 struct cpuinfo_x86;
 int cpu_has_amd_erratum(const struct cpuinfo_x86 *cpu, int osvw_id, ...);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.21


From xen-changelog-bounces@lists.xenproject.org Tue Mar 24 08:26:06 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Mar 2026 08:26:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1260096.1553463 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4x5S-0006BU-3y; Tue, 24 Mar 2026 08:26:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1260096.1553463; Tue, 24 Mar 2026 08:26:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w4x5S-0006BK-1L; Tue, 24 Mar 2026 08:26:06 +0000
Received: by outflank-mailman (input) for mailman id 1260096;
 Tue, 24 Mar 2026 08:26:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w4x5Q-0006BC-L9
 for xen-changelog@lists.xenproject.org; Tue, 24 Mar 2026 08:26:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4x5Q-007943-2h
 for xen-changelog@lists.xenproject.org;
 Tue, 24 Mar 2026 08:26:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w4x5Q-00BdyH-1w
 for xen-changelog@lists.xenproject.org;
 Tue, 24 Mar 2026 08:26:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=SzE53nLQ8kr2nw2QFBu54Aewu7aw8P373p96yc7FSDY=; b=LyQpW1g6zQ9xO3aiMcZmgZTQEM
	CVq8gQNA7guxepJBWgDiaJXEAqZBamUOerWonnytQWUz8/b/PC5ezjbn5hMG0cAoSoepuyI/z1z4+
	PIbpGHWHN+OI14djI13gOYFdm4cCIiiAQgKjzfd1PhL7USvNuLqiJNn9CO3SNuzwLLwY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] x86/ucode: Exclude Zen6 from entrysign mitigations
Message-Id: <E1w4x5Q-00BdyH-1w@xenbits.xenproject.org>
Date: Tue, 24 Mar 2026 08:26:04 +0000

commit 75b97ef09bffd1674023f15e8b5d31100e675b73
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Mar 16 10:34:23 2026 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Mar 23 21:52:33 2026 +0000

    x86/ucode: Exclude Zen6 from entrysign mitigations
    
    Family 0x1a covers both Zen5 and Zen6, but the latter is not believed to be
    vulnerable to entrysign.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    (cherry picked from commit bd15fdedafb3a414aeafa918a9212148ac22ebb5)
---
 xen/arch/x86/cpu/common.c                   | 4 +++-
 xen/arch/x86/cpu/microcode/amd.c            | 6 ++++--
 xen/arch/x86/include/asm/amd.h              | 4 ++++
 xen/include/public/arch-x86/cpufeatureset.h | 1 +
 4 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c
index 130d4e2a35..94afb07e8c 100644
--- a/xen/arch/x86/cpu/common.c
+++ b/xen/arch/x86/cpu/common.c
@@ -383,7 +383,9 @@ void __init early_cpu_init(bool verbose)
 			      c->x86_capability[FEATURESET_m10Ah]);
 
 		if (max_subleaf >= 1)
-			cpuid_count(7, 1, &eax, &ebx, &ecx,
+			cpuid_count(7, 1,
+				    &c->x86_capability[FEATURESET_7a1],
+				    &ebx, &ecx,
 				    &c->x86_capability[FEATURESET_7d1]);
 	}
 
diff --git a/xen/arch/x86/cpu/microcode/amd.c b/xen/arch/x86/cpu/microcode/amd.c
index e1b931fb51..7753af1db0 100644
--- a/xen/arch/x86/cpu/microcode/amd.c
+++ b/xen/arch/x86/cpu/microcode/amd.c
@@ -20,6 +20,7 @@
 #include <xen/mm.h> /* TODO: Fix asm/tlbflush.h breakage */
 #include <xen/sha2.h>
 
+#include <asm/amd.h>
 #include <asm/msr.h>
 
 #include "private.h"
@@ -560,7 +561,7 @@ void __init ucode_probe_amd(struct microcode_ops *ops)
      * CPUs.  Taint Xen if digest checking is turned off.
      */
     if ( boot_cpu_data.x86 >= 0x17 && boot_cpu_data.x86 <= 0x1a &&
-         !opt_digest_check )
+         !is_zen6_uarch() && !opt_digest_check )
     {
         printk(XENLOG_WARNING
                "Microcode patch additional digest checks disabled\n");
@@ -601,7 +602,8 @@ void __init amd_check_entrysign(void)
 
     if ( boot_cpu_data.x86_vendor != X86_VENDOR_AMD ||
          boot_cpu_data.x86 < 0x17 ||
-         boot_cpu_data.x86 > 0x1a )
+         boot_cpu_data.x86 > 0x1a ||
+         is_zen6_uarch() )
         return;
 
     /*
diff --git a/xen/arch/x86/include/asm/amd.h b/xen/arch/x86/include/asm/amd.h
index fa4e0fc766..62dd900cc7 100644
--- a/xen/arch/x86/include/asm/amd.h
+++ b/xen/arch/x86/include/asm/amd.h
@@ -149,6 +149,8 @@
  * For Zen3 and Zen4 (Fam19h) the heuristic is the presence of AutoIBRS, as
  * it's Zen4-specific.
  *
+ * For Zen5 and Zen6 (Fam1ah) the heuristic is the presence of FRED.
+ *
  * The caller is required to perform the appropriate vendor/family checks
  * first.
  */
@@ -156,6 +158,8 @@
 #define is_zen2_uarch()   boot_cpu_has(X86_FEATURE_AMD_STIBP)
 #define is_zen3_uarch() (!boot_cpu_has(X86_FEATURE_AUTO_IBRS))
 #define is_zen4_uarch()   boot_cpu_has(X86_FEATURE_AUTO_IBRS)
+#define is_zen5_uarch() (!boot_cpu_has(X86_FEATURE_FRED))
+#define is_zen6_uarch()   boot_cpu_has(X86_FEATURE_FRED)
 
 struct cpuinfo_x86;
 int cpu_has_amd_erratum(const struct cpuinfo_x86 *cpu, int osvw_id, ...);
diff --git a/xen/include/public/arch-x86/cpufeatureset.h b/xen/include/public/arch-x86/cpufeatureset.h
index 4ea6d95c7a..d61dccc464 100644
--- a/xen/include/public/arch-x86/cpufeatureset.h
+++ b/xen/include/public/arch-x86/cpufeatureset.h
@@ -295,6 +295,7 @@ XEN_CPUFEATURE(AVX512_BF16,  10*32+ 5) /*A  AVX512 BFloat16 Instructions */
 XEN_CPUFEATURE(FZRM,         10*32+10) /*A  Fast Zero-length REP MOVSB */
 XEN_CPUFEATURE(FSRS,         10*32+11) /*A  Fast Short REP STOSB */
 XEN_CPUFEATURE(FSRCS,        10*32+12) /*A  Fast Short REP CMPSB/SCASB */
+XEN_CPUFEATURE(FRED,         10*32+17) /*   Fast Return and Event Delivery */
 XEN_CPUFEATURE(WRMSRNS,      10*32+19) /*S  WRMSR Non-Serialising */
 XEN_CPUFEATURE(AVX_IFMA,     10*32+23) /*A  AVX-IFMA Instructions */
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Tue Mar 24 12:55:03 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Mar 2026 12:55:03 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1260784.1553979 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w51Hh-0005KV-Va; Tue, 24 Mar 2026 12:55:01 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1260784.1553979; Tue, 24 Mar 2026 12:55:01 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w51Hh-0005KN-Rr; Tue, 24 Mar 2026 12:55:01 +0000
Received: by outflank-mailman (input) for mailman id 1260784;
 Tue, 24 Mar 2026 12:55:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w51Hh-0005KG-Kr
 for xen-changelog@lists.xenproject.org; Tue, 24 Mar 2026 12:55:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w51Hh-007EhJ-2W
 for xen-changelog@lists.xenproject.org;
 Tue, 24 Mar 2026 12:55:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w51Hh-00C3ZP-1j
 for xen-changelog@lists.xenproject.org;
 Tue, 24 Mar 2026 12:55:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=jUAAuuEE+I2grYfieinXvc9XeA8z6nLkRNnhH4cIpgQ=; b=A8hv4bVC2XdWaGY7695OHKD5lX
	pH1kyMqgea27kavsWSivn0k57FO1gXyDktAZWcKfSpQlp5DzJve1bAKX+XjgwcC5Ol+YrBjLvZhcF
	kG7cmuVEpY+ZogZiT5xDLGjft1LjVLOD6DX11Gk7FKtX8UUcGr9+PLJxLYv9CzUTJbkk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/vpmu: Expose up to 8 Intel event selectors in PV Dom0
Message-Id: <E1w51Hh-00C3ZP-1j@xenbits.xenproject.org>
Date: Tue, 24 Mar 2026 12:55:01 +0000

commit 4e9d9e7cc9a663d7c15118d5ebe344f7edad3ec9
Author:     Teddy Astie <teddy.astie@vates.tech>
AuthorDate: Tue Mar 24 12:04:46 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 24 12:04:46 2026 +0100

    x86/vpmu: Expose up to 8 Intel event selectors in PV Dom0
    
    Most (if not all) Intel CPUs starting from Sandy Bridge have up to 8
    event selectors per core, which could be halved per hyperthread.
    
    However, current PV emulation logic doesn't support up to 8 event selector,
    leading to errors when trying to access them, hence, preventing Linux from
    driving the vPMU correctly.
    
    Make sure up to MSR_P6_EVNTSEL(7) is usable, which is the same upper bound as
    used in VMX code.
    
    The check if the event selector actually exist for the hardware is done in
    core2_vpmu_do_{rdmsr,wrmsr}, hence we're not allowing to access non-existent
    MSRs.
    
    Fixes: 27c554198666 ("x86/VPMU: add support for PMU register handling on PV guests")
    Signed-off-by: Teddy Astie <teddy.astie@vates.tech>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/pv/emul-priv-op.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/pv/emul-priv-op.c b/xen/arch/x86/pv/emul-priv-op.c
index 53676b3021..d98c7f166a 100644
--- a/xen/arch/x86/pv/emul-priv-op.c
+++ b/xen/arch/x86/pv/emul-priv-op.c
@@ -992,7 +992,7 @@ static int cf_check read_msr(
         return X86EMUL_OKAY;
 
     case MSR_P6_PERFCTR(0) ... MSR_P6_PERFCTR(7):
-    case MSR_P6_EVNTSEL(0) ... MSR_P6_EVNTSEL(3):
+    case MSR_P6_EVNTSEL(0) ... MSR_P6_EVNTSEL(7):
     case MSR_CORE_PERF_FIXED_CTR0 ... MSR_CORE_PERF_FIXED_CTR2:
     case MSR_CORE_PERF_FIXED_CTR_CTRL ... MSR_CORE_PERF_GLOBAL_OVF_CTRL:
         if ( boot_cpu_data.vendor == X86_VENDOR_INTEL )
@@ -1175,7 +1175,7 @@ static int cf_check write_msr(
         break;
 
     case MSR_P6_PERFCTR(0) ... MSR_P6_PERFCTR(7):
-    case MSR_P6_EVNTSEL(0) ... MSR_P6_EVNTSEL(3):
+    case MSR_P6_EVNTSEL(0) ... MSR_P6_EVNTSEL(7):
     case MSR_CORE_PERF_FIXED_CTR0 ... MSR_CORE_PERF_FIXED_CTR2:
     case MSR_CORE_PERF_FIXED_CTR_CTRL ... MSR_CORE_PERF_GLOBAL_OVF_CTRL:
         if ( boot_cpu_data.vendor == X86_VENDOR_INTEL )
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 24 12:55:13 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Mar 2026 12:55:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1260785.1553981 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w51Hs-0005Mm-W0; Tue, 24 Mar 2026 12:55:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1260785.1553981; Tue, 24 Mar 2026 12:55:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w51Hs-0005Me-TI; Tue, 24 Mar 2026 12:55:12 +0000
Received: by outflank-mailman (input) for mailman id 1260785;
 Tue, 24 Mar 2026 12:55:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w51Hr-0005MW-Mb
 for xen-changelog@lists.xenproject.org; Tue, 24 Mar 2026 12:55:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w51Hr-007EhN-2q
 for xen-changelog@lists.xenproject.org;
 Tue, 24 Mar 2026 12:55:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w51Hr-00C3aF-20
 for xen-changelog@lists.xenproject.org;
 Tue, 24 Mar 2026 12:55:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=WPR3WqIIi+xeEhJQ2Uya5cIfb/nxhC2uksyScLJv4+k=; b=Z35BgE1L612++GCMWxLJEDb8yZ
	U2m+qDHMsJJH6VXeXrVcWy5hHleWNtqMU7Bj+E63Ubgj22EeQNEMIqvUZNyzQdAQhWkh+tR2UMMpW
	XBVRXh/wJJpPi6unVBOKgmtqnXpbCYBlGoer7hy0ekE9dJ9V4HmJ8bwoO+j0wsT/YPkE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/S3: restore MCE (APs) init
Message-Id: <E1w51Hr-00C3aF-20@xenbits.xenproject.org>
Date: Tue, 24 Mar 2026 12:55:11 +0000

commit 5ebd4dd14118e4eb24f1d409a7ca3773f77e7e41
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Mar 24 12:05:42 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 24 12:05:42 2026 +0100

    x86/S3: restore MCE (APs) init
    
    MCE init for APs was broken when CPU feature re-checking was added. At the
    same time make sure we don't bypass setup_doitm() (and whatever else may
    be added to the bottom of identify_cpu()).
    
    Fixes: bb502a8ca592 ("x86: check feature flags after resume")
    Reported-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Tested-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/cpu/common.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c
index 5d0523a78b..5ac76897ae 100644
--- a/xen/arch/x86/cpu/common.c
+++ b/xen/arch/x86/cpu/common.c
@@ -642,16 +642,20 @@ void identify_cpu(struct cpuinfo_x86 *c)
 			       smp_processor_id());
 	}
 
-	if (system_state == SYS_STATE_resume)
-		return;
+	if (system_state == SYS_STATE_resume) {
+		unsigned int cpu = smp_processor_id();
 
+		/* The BSP has this done right from enter_state(). */
+		if (cpu)
+			mcheck_init(&cpu_data[cpu], false);
+	}
 	/*
 	 * On SMP, boot_cpu_data holds the common feature set between
 	 * all CPUs; so make sure that we indicate which features are
 	 * common between the CPUs.  The first time this routine gets
 	 * executed, c == &boot_cpu_data.
 	 */
-	if ( c != &boot_cpu_data ) {
+	else if (c != &boot_cpu_data) {
 		/* AND the already accumulated flags with these */
 		for ( i = 0 ; i < NCAPINTS ; i++ )
 			boot_cpu_data.x86_capability[i] &= c->x86_capability[i];
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 24 14:00:11 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Mar 2026 14:00:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1260855.1554021 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w52Id-0000Ts-A2; Tue, 24 Mar 2026 14:00:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1260855.1554021; Tue, 24 Mar 2026 14:00:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w52Id-0000TP-6y; Tue, 24 Mar 2026 14:00:03 +0000
Received: by outflank-mailman (input) for mailman id 1260855;
 Tue, 24 Mar 2026 14:00:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w52Ic-0000EA-3d
 for xen-changelog@lists.xenproject.org; Tue, 24 Mar 2026 14:00:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w52Ic-007G50-0i
 for xen-changelog@lists.xenproject.org;
 Tue, 24 Mar 2026 14:00:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w52Ib-00C7ui-37
 for xen-changelog@lists.xenproject.org;
 Tue, 24 Mar 2026 14:00:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=GO9jAE5qR1P77/MgG+9OSpoIs1iB/yqVQ+X5tHzl/Ds=; b=JM8PbF0RTL8IpntE2CHzVNFNXz
	/YMj6HM8Ar13RWeCt6AH170lR/qxsWhM/wG780EkiydFVcJi/7c7u7fy1PwoiFWMTLccExXjR08y9
	0oaTZ808cq8ihfue+72lO68fw7rZNX3FbRTghWERKLlxz8W1ZrxN1suQWhgZdyXwmfY4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/vpmu: Expose up to 8 Intel event selectors in PV Dom0
Message-Id: <E1w52Ib-00C7ui-37@xenbits.xenproject.org>
Date: Tue, 24 Mar 2026 14:00:01 +0000

commit 4e9d9e7cc9a663d7c15118d5ebe344f7edad3ec9
Author:     Teddy Astie <teddy.astie@vates.tech>
AuthorDate: Tue Mar 24 12:04:46 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 24 12:04:46 2026 +0100

    x86/vpmu: Expose up to 8 Intel event selectors in PV Dom0
    
    Most (if not all) Intel CPUs starting from Sandy Bridge have up to 8
    event selectors per core, which could be halved per hyperthread.
    
    However, current PV emulation logic doesn't support up to 8 event selector,
    leading to errors when trying to access them, hence, preventing Linux from
    driving the vPMU correctly.
    
    Make sure up to MSR_P6_EVNTSEL(7) is usable, which is the same upper bound as
    used in VMX code.
    
    The check if the event selector actually exist for the hardware is done in
    core2_vpmu_do_{rdmsr,wrmsr}, hence we're not allowing to access non-existent
    MSRs.
    
    Fixes: 27c554198666 ("x86/VPMU: add support for PMU register handling on PV guests")
    Signed-off-by: Teddy Astie <teddy.astie@vates.tech>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/pv/emul-priv-op.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/pv/emul-priv-op.c b/xen/arch/x86/pv/emul-priv-op.c
index 53676b3021..d98c7f166a 100644
--- a/xen/arch/x86/pv/emul-priv-op.c
+++ b/xen/arch/x86/pv/emul-priv-op.c
@@ -992,7 +992,7 @@ static int cf_check read_msr(
         return X86EMUL_OKAY;
 
     case MSR_P6_PERFCTR(0) ... MSR_P6_PERFCTR(7):
-    case MSR_P6_EVNTSEL(0) ... MSR_P6_EVNTSEL(3):
+    case MSR_P6_EVNTSEL(0) ... MSR_P6_EVNTSEL(7):
     case MSR_CORE_PERF_FIXED_CTR0 ... MSR_CORE_PERF_FIXED_CTR2:
     case MSR_CORE_PERF_FIXED_CTR_CTRL ... MSR_CORE_PERF_GLOBAL_OVF_CTRL:
         if ( boot_cpu_data.vendor == X86_VENDOR_INTEL )
@@ -1175,7 +1175,7 @@ static int cf_check write_msr(
         break;
 
     case MSR_P6_PERFCTR(0) ... MSR_P6_PERFCTR(7):
-    case MSR_P6_EVNTSEL(0) ... MSR_P6_EVNTSEL(3):
+    case MSR_P6_EVNTSEL(0) ... MSR_P6_EVNTSEL(7):
     case MSR_CORE_PERF_FIXED_CTR0 ... MSR_CORE_PERF_FIXED_CTR2:
     case MSR_CORE_PERF_FIXED_CTR_CTRL ... MSR_CORE_PERF_GLOBAL_OVF_CTRL:
         if ( boot_cpu_data.vendor == X86_VENDOR_INTEL )
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 24 14:00:13 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Mar 2026 14:00:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1260856.1554025 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w52In-00019O-B9; Tue, 24 Mar 2026 14:00:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1260856.1554025; Tue, 24 Mar 2026 14:00:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w52In-00019F-8K; Tue, 24 Mar 2026 14:00:13 +0000
Received: by outflank-mailman (input) for mailman id 1260856;
 Tue, 24 Mar 2026 14:00:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w52Im-000195-4f
 for xen-changelog@lists.xenproject.org; Tue, 24 Mar 2026 14:00:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w52Im-007G6F-11
 for xen-changelog@lists.xenproject.org;
 Tue, 24 Mar 2026 14:00:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w52Im-00C7wY-0D
 for xen-changelog@lists.xenproject.org;
 Tue, 24 Mar 2026 14:00:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Fj33IK3msP9Nxze28Gum6uanNz9c272HMZ/H6mlsJ7A=; b=DFv1y8rJbkqtRp4C7AaW/8W1R1
	/+Ti/yATIVybaD523Goa8HZy3+bkjEQKUL1CTZZ/Y5znASR/6YtIhJ1Q41atdb2/4f/KN11vcaQEI
	WrDW0PN/U04kZ7xPCDwKQ28/113OVLxuY4eH3q8oPjtUKWGKLErX5S06LAxpSRmE92cc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/S3: restore MCE (APs) init
Message-Id: <E1w52Im-00C7wY-0D@xenbits.xenproject.org>
Date: Tue, 24 Mar 2026 14:00:12 +0000

commit 5ebd4dd14118e4eb24f1d409a7ca3773f77e7e41
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Mar 24 12:05:42 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 24 12:05:42 2026 +0100

    x86/S3: restore MCE (APs) init
    
    MCE init for APs was broken when CPU feature re-checking was added. At the
    same time make sure we don't bypass setup_doitm() (and whatever else may
    be added to the bottom of identify_cpu()).
    
    Fixes: bb502a8ca592 ("x86: check feature flags after resume")
    Reported-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Tested-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/cpu/common.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c
index 5d0523a78b..5ac76897ae 100644
--- a/xen/arch/x86/cpu/common.c
+++ b/xen/arch/x86/cpu/common.c
@@ -642,16 +642,20 @@ void identify_cpu(struct cpuinfo_x86 *c)
 			       smp_processor_id());
 	}
 
-	if (system_state == SYS_STATE_resume)
-		return;
+	if (system_state == SYS_STATE_resume) {
+		unsigned int cpu = smp_processor_id();
 
+		/* The BSP has this done right from enter_state(). */
+		if (cpu)
+			mcheck_init(&cpu_data[cpu], false);
+	}
 	/*
 	 * On SMP, boot_cpu_data holds the common feature set between
 	 * all CPUs; so make sure that we indicate which features are
 	 * common between the CPUs.  The first time this routine gets
 	 * executed, c == &boot_cpu_data.
 	 */
-	if ( c != &boot_cpu_data ) {
+	else if (c != &boot_cpu_data) {
 		/* AND the already accumulated flags with these */
 		for ( i = 0 ; i < NCAPINTS ; i++ )
 			boot_cpu_data.x86_capability[i] &= c->x86_capability[i];
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Mar 26 10:33:08 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 26 Mar 2026 10:33:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1263668.1555528 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w5i1P-0005GL-DY; Thu, 26 Mar 2026 10:33:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1263668.1555528; Thu, 26 Mar 2026 10:33:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w5i1P-0005GD-Av; Thu, 26 Mar 2026 10:33:03 +0000
Received: by outflank-mailman (input) for mailman id 1263668;
 Thu, 26 Mar 2026 10:33:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w5i1O-0005G7-9D
 for xen-changelog@lists.xenproject.org; Thu, 26 Mar 2026 10:33:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w5i1O-00AYBz-1K
 for xen-changelog@lists.xenproject.org;
 Thu, 26 Mar 2026 10:33:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w5i1O-00Gj6j-0T
 for xen-changelog@lists.xenproject.org;
 Thu, 26 Mar 2026 10:33:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=TjwnPxikP4hXdMHaCJldPl2IV2YYQeCDlNhT60GVaeE=; b=dTX4/sIfNhvblZmz2E/0veKreS
	SmRHCoSE9hF04A3ruAX5tlz7erR43VOFN+r6grcwJNkv+hNqUyOXgzT/dJjkVLBeXFCPPXquV2H7x
	PnV5GKMT5MKNoUkw8ECAuN3f+URYF76WWttx/y3aRXspo2fl5srQVaqaKYbKlzGuj7aw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.21] Revert "xen/mm: allow deferred scrub of physmap populate allocated pages"
Message-Id: <E1w5i1O-00Gj6j-0T@xenbits.xenproject.org>
Date: Thu, 26 Mar 2026 10:33:02 +0000

commit 73f4c7aab763cd1cfbcd778ad309fe2c2991cb43
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 26 11:03:11 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 26 11:04:14 2026 +0100

    Revert "xen/mm: allow deferred scrub of physmap populate allocated pages"
    
    This reverts commit 6228ea8acddadbd815f958fb1a867f54c01ddf78 and its
    prereq 15cd2b8f1bac5f4adf0f8303ae79298a612b53e1 ("xen/mm: remove
    aliasing of PGC_need_scrub over PGC_allocated"). Further fixes are
    needed before these can be considered for backporting.
---
 xen/arch/arm/include/asm/mm.h   |  10 ++--
 xen/arch/ppc/include/asm/mm.h   |  10 ++--
 xen/arch/riscv/include/asm/mm.h |  10 ++--
 xen/arch/x86/include/asm/mm.h   |  18 ++++---
 xen/common/domain.c             |  23 ---------
 xen/common/memory.c             | 105 +---------------------------------------
 xen/common/page_alloc.c         |   4 +-
 xen/include/xen/mm.h            |  10 ----
 xen/include/xen/sched.h         |   5 --
 9 files changed, 35 insertions(+), 160 deletions(-)

diff --git a/xen/arch/arm/include/asm/mm.h b/xen/arch/arm/include/asm/mm.h
index ee1f60c59e..7a93dad2ed 100644
--- a/xen/arch/arm/include/asm/mm.h
+++ b/xen/arch/arm/include/asm/mm.h
@@ -144,9 +144,6 @@ struct page_info
 #define _PGC_colored      PG_shift(4)
 #define PGC_colored       PG_mask(1, 4)
 #endif
-/* Page needs to be scrubbed. */
-#define _PGC_need_scrub   PG_shift(5)
-#define PGC_need_scrub    PG_mask(1, 5)
 /* ... */
 /* Page is broken? */
 #define _PGC_broken       PG_shift(7)
@@ -166,6 +163,13 @@ struct page_info
 #define PGC_count_width   PG_shift(10)
 #define PGC_count_mask    ((1UL<<PGC_count_width)-1)
 
+/*
+ * Page needs to be scrubbed. Since this bit can only be set on a page that is
+ * free (i.e. in PGC_state_free) we can reuse PGC_allocated bit.
+ */
+#define _PGC_need_scrub   _PGC_allocated
+#define PGC_need_scrub    PGC_allocated
+
 #if defined(CONFIG_ARM_64) || defined(CONFIG_MPU)
 #define is_xen_heap_page(page) ((page)->count_info & PGC_xen_heap)
 #define is_xen_heap_mfn(mfn) \
diff --git a/xen/arch/ppc/include/asm/mm.h b/xen/arch/ppc/include/asm/mm.h
index 82a9551082..a33eeec43b 100644
--- a/xen/arch/ppc/include/asm/mm.h
+++ b/xen/arch/ppc/include/asm/mm.h
@@ -57,9 +57,6 @@ static inline struct page_info *virt_to_page(const void *v)
 /* Page is Xen heap? */
 #define _PGC_xen_heap     PG_shift(2)
 #define PGC_xen_heap      PG_mask(1, 2)
-/* Page needs to be scrubbed. */
-#define _PGC_need_scrub   PG_shift(3)
-#define PGC_need_scrub    PG_mask(1, 3)
 /* Page is broken? */
 #define _PGC_broken       PG_shift(7)
 #define PGC_broken        PG_mask(1, 7)
@@ -78,6 +75,13 @@ static inline struct page_info *virt_to_page(const void *v)
 #define PGC_count_width   PG_shift(10)
 #define PGC_count_mask    ((1UL<<PGC_count_width)-1)
 
+/*
+ * Page needs to be scrubbed. Since this bit can only be set on a page that is
+ * free (i.e. in PGC_state_free) we can reuse PGC_allocated bit.
+ */
+#define _PGC_need_scrub   _PGC_allocated
+#define PGC_need_scrub    PGC_allocated
+
 #define is_xen_heap_page(page) ((page)->count_info & PGC_xen_heap)
 #define is_xen_heap_mfn(mfn) \
     (mfn_valid(mfn) && is_xen_heap_page(mfn_to_page(mfn)))
diff --git a/xen/arch/riscv/include/asm/mm.h b/xen/arch/riscv/include/asm/mm.h
index 4c37d87508..9283616c02 100644
--- a/xen/arch/riscv/include/asm/mm.h
+++ b/xen/arch/riscv/include/asm/mm.h
@@ -247,15 +247,19 @@ static inline bool arch_mfns_in_directmap(unsigned long mfn, unsigned long nr)
 #define PGT_count_width   PG_shift(2)
 #define PGT_count_mask    ((1UL << PGT_count_width) - 1)
 
+/*
+ * Page needs to be scrubbed. Since this bit can only be set on a page that is
+ * free (i.e. in PGC_state_free) we can reuse PGC_allocated bit.
+ */
+#define _PGC_need_scrub   _PGC_allocated
+#define PGC_need_scrub    PGC_allocated
+
 /* Cleared when the owning guest 'frees' this page. */
 #define _PGC_allocated    PG_shift(1)
 #define PGC_allocated     PG_mask(1, 1)
 /* Page is Xen heap? */
 #define _PGC_xen_heap     PG_shift(2)
 #define PGC_xen_heap      PG_mask(1, 2)
-/* Page needs to be scrubbed. */
-#define _PGC_need_scrub   PG_shift(4)
-#define PGC_need_scrub    PG_mask(1, 4)
 /* Page is broken? */
 #define _PGC_broken       PG_shift(7)
 #define PGC_broken        PG_mask(1, 7)
diff --git a/xen/arch/x86/include/asm/mm.h b/xen/arch/x86/include/asm/mm.h
index d35086e31e..08153e6d6f 100644
--- a/xen/arch/x86/include/asm/mm.h
+++ b/xen/arch/x86/include/asm/mm.h
@@ -83,25 +83,29 @@
 #define PGC_state_offlined  PG_mask(2, 6)
 #define PGC_state_free      PG_mask(3, 6)
 #define page_state_is(pg, st) (((pg)->count_info&PGC_state) == PGC_state_##st)
-/* Page needs to be scrubbed. */
-#define _PGC_need_scrub   PG_shift(7)
-#define PGC_need_scrub    PG_mask(1, 7)
 #ifdef CONFIG_SHADOW_PAGING
  /* Set when a page table page has been shadowed. */
-#define _PGC_shadowed_pt  PG_shift(8)
-#define PGC_shadowed_pt   PG_mask(1, 8)
+#define _PGC_shadowed_pt  PG_shift(7)
+#define PGC_shadowed_pt   PG_mask(1, 7)
 #else
 #define PGC_shadowed_pt   0
 #endif
 
 /* Count of references to this frame. */
 #if PGC_shadowed_pt
-#define PGC_count_width   PG_shift(8)
-#else
 #define PGC_count_width   PG_shift(7)
+#else
+#define PGC_count_width   PG_shift(6)
 #endif
 #define PGC_count_mask    ((1UL<<PGC_count_width)-1)
 
+/*
+ * Page needs to be scrubbed. Since this bit can only be set on a page that is
+ * free (i.e. in PGC_state_free) we can reuse PGC_allocated bit.
+ */
+#define _PGC_need_scrub   _PGC_allocated
+#define PGC_need_scrub    PGC_allocated
+
 #ifndef CONFIG_BIGMEM
 /*
  * This definition is solely for the use in struct page_info (and
diff --git a/xen/common/domain.c b/xen/common/domain.c
index 75c7da16e2..88db82d187 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -582,18 +582,6 @@ static int __init cf_check parse_dom0_param(const char *s)
 }
 custom_param("dom0", parse_dom0_param);
 
-static void domain_pending_scrub_free(struct domain *d)
-{
-    rspin_lock(&d->page_alloc_lock);
-    if ( d->pending_scrub )
-    {
-        FREE_DOMHEAP_PAGES(d->pending_scrub, d->pending_scrub_order);
-        d->pending_scrub_order = 0;
-        d->pending_scrub_index = 0;
-    }
-    rspin_unlock(&d->page_alloc_lock);
-}
-
 /*
  * Release resources held by a domain.  There may or may not be live
  * references to the domain, and it may or may not be fully constructed.
@@ -655,7 +643,6 @@ static int domain_teardown(struct domain *d)
 
         /* Trivial teardown, not long-running enough to need a preemption check. */
         domain_llc_coloring_free(d);
-        domain_pending_scrub_free(d);
 
     PROGRESS(gnttab_mappings):
         rc = gnttab_release_mappings(d);
@@ -699,7 +686,6 @@ static void _domain_destroy(struct domain *d)
 {
     BUG_ON(!d->is_dying);
     BUG_ON(atomic_read(&d->refcnt) != DOMAIN_DESTROYED);
-    ASSERT(!d->pending_scrub);
 
     xfree(d->pbuf);
 
@@ -1665,15 +1651,6 @@ int domain_unpause_by_systemcontroller(struct domain *d)
      */
     if ( new == 0 && !d->creation_finished )
     {
-        if ( d->pending_scrub )
-        {
-            printk(XENLOG_ERR
-                   "%pd: cannot be started with pending unscrubbed pages, destroying\n",
-                   d);
-            domain_crash(d);
-            domain_pending_scrub_free(d);
-            return -EBUSY;
-        }
         d->creation_finished = true;
         arch_domain_creation_finished(d);
     }
diff --git a/xen/common/memory.c b/xen/common/memory.c
index 9240a6005e..10becf7c1f 100644
--- a/xen/common/memory.c
+++ b/xen/common/memory.c
@@ -159,73 +159,6 @@ static void increase_reservation(struct memop_args *a)
     a->nr_done = i;
 }
 
-/*
- * Temporary storage for a domain assigned page that's not been fully scrubbed.
- * Stored pages must be domheap ones.
- *
- * The stashed page can be freed at any time by Xen, the caller must pass the
- * order and NUMA node requirement to the fetch function to ensure the
- * currently stashed page matches it's requirements.
- */
-static void stash_allocation(struct domain *d, struct page_info *page,
-                             unsigned int order, unsigned int scrub_index)
-{
-    rspin_lock(&d->page_alloc_lock);
-
-    /*
-     * Drop the passed page in preference for the already stashed one.  This
-     * interface is designed to be used for single-threaded domain creation.
-     */
-    if ( d->pending_scrub || d->is_dying )
-        free_domheap_pages(page, order);
-    else
-    {
-        d->pending_scrub_index = scrub_index;
-        d->pending_scrub_order = order;
-        d->pending_scrub = page;
-    }
-
-    rspin_unlock(&d->page_alloc_lock);
-}
-
-static struct page_info *get_stashed_allocation(struct domain *d,
-                                                unsigned int order,
-                                                nodeid_t node,
-                                                unsigned int *scrub_index)
-{
-    struct page_info *page = NULL;
-
-    rspin_lock(&d->page_alloc_lock);
-
-    /*
-     * If there's a pending page to scrub check if it satisfies the current
-     * request.  If it doesn't free it and return NULL.
-     */
-    if ( d->pending_scrub )
-    {
-        if ( d->pending_scrub_order == order &&
-             (node == NUMA_NO_NODE || node == page_to_nid(d->pending_scrub)) )
-        {
-            page = d->pending_scrub;
-            *scrub_index = d->pending_scrub_index;
-        }
-        else
-            free_domheap_pages(d->pending_scrub, d->pending_scrub_order);
-
-        /*
-         * The caller now owns the page or it has been freed, clear stashed
-         * information.  Prevent concurrent usages of get_stashed_allocation()
-         * from returning the same page to different contexts.
-         */
-        d->pending_scrub_index = 0;
-        d->pending_scrub_order = 0;
-        d->pending_scrub = NULL;
-    }
-
-    rspin_unlock(&d->page_alloc_lock);
-    return page;
-}
-
 static void populate_physmap(struct memop_args *a)
 {
     struct page_info *page;
@@ -342,19 +275,7 @@ static void populate_physmap(struct memop_args *a)
             }
             else
             {
-                unsigned int scrub_start = 0;
-                unsigned int memflags =
-                    a->memflags | (d->creation_finished ? 0
-                                                        : MEMF_no_scrub);
-                nodeid_t node =
-                    (a->memflags & MEMF_exact_node) ? MEMF_get_node(a->memflags)
-                                                    : NUMA_NO_NODE;
-
-                page = get_stashed_allocation(d, a->extent_order, node,
-                                              &scrub_start);
-
-                if ( !page )
-                    page = alloc_domheap_pages(d, a->extent_order, memflags);
+                page = alloc_domheap_pages(d, a->extent_order, a->memflags);
 
                 if ( unlikely(!page) )
                 {
@@ -365,30 +286,6 @@ static void populate_physmap(struct memop_args *a)
                     goto out;
                 }
 
-                if ( memflags & MEMF_no_scrub )
-                {
-                    unsigned int dirty_cnt = 0;
-
-                    /* Check if there's anything to scrub. */
-                    for ( j = scrub_start; j < (1U << a->extent_order); j++ )
-                    {
-                        if ( !test_and_clear_bit(_PGC_need_scrub,
-                                                 &page[j].count_info) )
-                            continue;
-
-                        scrub_one_page(&page[j], true);
-
-                        if ( (j + 1) != (1U << a->extent_order) &&
-                             !(++dirty_cnt & 0xff) &&
-                             hypercall_preempt_check() )
-                        {
-                            a->preempted = 1;
-                            stash_allocation(d, page, a->extent_order, j + 1);
-                            goto out;
-                        }
-                    }
-                }
-
                 if ( unlikely(a->memflags & MEMF_no_tlbflush) )
                 {
                     for ( j = 0; j < (1U << a->extent_order); j++ )
diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
index 588b5b99cb..2efc11ce09 100644
--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -170,7 +170,7 @@
 /*
  * Flags that are preserved in assign_pages() (and only there)
  */
-#define PGC_preserved (PGC_extra | PGC_static | PGC_colored | PGC_need_scrub)
+#define PGC_preserved (PGC_extra | PGC_static | PGC_colored)
 
 #ifndef PGT_TYPE_INFO_INITIALIZER
 #define PGT_TYPE_INFO_INITIALIZER 0
@@ -792,7 +792,7 @@ static void page_list_add_scrub(struct page_info *pg, unsigned int node,
 # define scrub_page_cold clear_page_cold
 #endif
 
-void scrub_one_page(const struct page_info *pg, bool cold)
+static void scrub_one_page(const struct page_info *pg, bool cold)
 {
     void *ptr;
 
diff --git a/xen/include/xen/mm.h b/xen/include/xen/mm.h
index 49c34248f9..b968f47b87 100644
--- a/xen/include/xen/mm.h
+++ b/xen/include/xen/mm.h
@@ -145,16 +145,6 @@ unsigned long avail_node_heap_pages(unsigned int nodeid);
 #define alloc_domheap_page(d,f) (alloc_domheap_pages(d,0,f))
 #define free_domheap_page(p)  (free_domheap_pages(p,0))
 
-/* Free an allocation, and zero the pointer to it. */
-#define FREE_DOMHEAP_PAGES(p, o) do { \
-    void *_ptr_ = (p);                \
-    (p) = NULL;                       \
-    free_domheap_pages(_ptr_, o);     \
-} while ( false )
-#define FREE_DOMHEAP_PAGE(p) FREE_DOMHEAP_PAGES(p, 0)
-
-void scrub_one_page(const struct page_info *pg, bool cold);
-
 int online_page(mfn_t mfn, uint32_t *status);
 int offline_page(mfn_t mfn, int broken, uint32_t *status);
 int query_page_offline(mfn_t mfn, uint32_t *status);
diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
index c89b930cbd..610f3d4c0d 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -662,11 +662,6 @@ struct domain
         /* Permission to take ownership of the physical console input. */
         bool input_allowed;
     } console;
-
-    /* Pointer to allocated domheap page that possibly needs scrubbing. */
-    struct page_info *pending_scrub;
-    unsigned int pending_scrub_order;
-    unsigned int pending_scrub_index;
 } __aligned(PAGE_SIZE);
 
 static inline struct page_list_head *page_to_list(
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.21


From xen-changelog-bounces@lists.xenproject.org Thu Mar 26 10:33:13 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 26 Mar 2026 10:33:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1263669.1555532 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w5i1Z-0005IE-Er; Thu, 26 Mar 2026 10:33:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1263669.1555532; Thu, 26 Mar 2026 10:33:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w5i1Z-0005I6-CJ; Thu, 26 Mar 2026 10:33:13 +0000
Received: by outflank-mailman (input) for mailman id 1263669;
 Thu, 26 Mar 2026 10:33:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w5i1Y-0005Hw-BF
 for xen-changelog@lists.xenproject.org; Thu, 26 Mar 2026 10:33:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w5i1Y-00AYCM-1f
 for xen-changelog@lists.xenproject.org;
 Thu, 26 Mar 2026 10:33:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w5i1Y-00Gj9Y-0p
 for xen-changelog@lists.xenproject.org;
 Thu, 26 Mar 2026 10:33:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=rZZ/78GTIUVOzAvzyyeSlIrkpABXXKEiEK5FSEezYrY=; b=0oc8KDBoPi6JkD34jZhKxx5omf
	qZkDySt7mcI+9vQmpDi1z0L6LKlDxZzq6VT5ptsSbODHnf0FAiw8mXP64utG8vgXfO1DhuivXQx7y
	k4G0un9+di4s51DXjH8ctr51snaNGh3T6RpWhEd8k/AbsFMKXIm+B69jjb9Z2LR2f8do=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.21] ARM: Drop ThumbEE support
Message-Id: <E1w5i1Y-00Gj9Y-0p@xenbits.xenproject.org>
Date: Thu, 26 Mar 2026 10:33:12 +0000

commit a2eea8fd9e64afb733874c0a5634828570bb1061
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Mar 26 11:08:04 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 26 11:08:04 2026 +0100

    ARM: Drop ThumbEE support
    
    Hans reports that Xen no longer builds on Debian unstable/sid:
    
      Assembler messages:
      {standard input}:474: Error: unknown or missing system register name at operand 1 -- `msr TEECR32_EL1,x0'
      {standard input}:480: Error: unknown or missing system register name at operand 1 -- `msr TEEHBR32_EL1,x0'
      {standard input}:488: Error: unknown or missing system register name at operand 2 -- `mrs x0,TEECR32_EL1'
      {standard input}:494: Error: unknown or missing system register name at operand 2 -- `mrs x0,TEEHBR32_EL1'
      make[5]: *** [Rules.mk:249: arch/arm/domain.o] Error 1
    
    This turns out to be an intentional change in binutils.  ThumbEE was dropped
    ahead of ARM v8 (i.e. AArch64).
    
    Xen supports ARM v7+virt extensions so in principle we could #ifdef
    CONFIG_ARM_32 to keep it working.  However, there was apparently no use of
    ThumbEE outside of demo code, so simply drop it.
    
    On ThumbEE capable hardware, unconditionally trap ThumbEE instructions, and
    drop the context switching logic for TEE{CR,HBR}32.
    
    Reported-by: Hans van Kranenburg <hans@knorrie.org>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    
    xen/arm: Set ThumbEE as not present in PFR0
    
    Force ThumbEE support to not available in the version of the PFR0
    register value we present to guest.
    Xen does not support ThumbEE and will trap all access to ThumbEE
    registers so do not report it being supported if the hardware supports
    it.
    
    Fixes: 5bbe1fe413f9 ("ARM: Drop ThumbEE support")
    Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
    Tested-by: Luca Fancellu <luca.fancellu@arm.com>
    master commit: 5bbe1fe413f9d6a841b0bc70db024b1398391630
    master date: 2025-12-05 18:06:19 +0000
    master commit: 1ecb5946bdf8797d43ac6730c708bd105fdb0be4
    master date: 2026-01-05 10:33:03 +0000
---
 xen/arch/arm/cpufeature.c            |  3 +++
 xen/arch/arm/domain.c                | 12 ------------
 xen/arch/arm/include/asm/domain.h    |  1 -
 xen/arch/arm/include/asm/processor.h |  1 +
 xen/arch/arm/traps.c                 |  4 ++--
 5 files changed, 6 insertions(+), 15 deletions(-)

diff --git a/xen/arch/arm/cpufeature.c b/xen/arch/arm/cpufeature.c
index 1a80738571..94d14fb6a9 100644
--- a/xen/arch/arm/cpufeature.c
+++ b/xen/arch/arm/cpufeature.c
@@ -227,6 +227,9 @@ static int __init create_domain_cpuinfo(void)
 #endif
     domain_cpuinfo.pfr32.amu = 0;
 
+    /* Hide ThumbEE support */
+    domain_cpuinfo.pfr32.thumbee = 0;
+
     /* Hide RAS support as Xen does not support it */
 #ifdef CONFIG_ARM_64
     domain_cpuinfo.pfr64.ras = 0;
diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c
index e36719bce4..38d7768de9 100644
--- a/xen/arch/arm/domain.c
+++ b/xen/arch/arm/domain.c
@@ -111,12 +111,6 @@ static void ctxt_switch_from(struct vcpu *p)
     p->arch.cntkctl = READ_SYSREG(CNTKCTL_EL1);
     virt_timer_save(p);
 
-    if ( is_32bit_domain(p->domain) && cpu_has_thumbee )
-    {
-        p->arch.teecr = READ_SYSREG(TEECR32_EL1);
-        p->arch.teehbr = READ_SYSREG(TEEHBR32_EL1);
-    }
-
 #ifdef CONFIG_ARM_32
     p->arch.joscr = READ_CP32(JOSCR);
     p->arch.jmcr = READ_CP32(JMCR);
@@ -244,12 +238,6 @@ static void ctxt_switch_to(struct vcpu *n)
     WRITE_SYSREG(n->arch.tpidrro_el0, TPIDRRO_EL0);
     WRITE_SYSREG(n->arch.tpidr_el1, TPIDR_EL1);
 
-    if ( is_32bit_domain(n->domain) && cpu_has_thumbee )
-    {
-        WRITE_SYSREG(n->arch.teecr, TEECR32_EL1);
-        WRITE_SYSREG(n->arch.teehbr, TEEHBR32_EL1);
-    }
-
 #ifdef CONFIG_ARM_32
     WRITE_CP32(n->arch.joscr, JOSCR);
     WRITE_CP32(n->arch.jmcr, JMCR);
diff --git a/xen/arch/arm/include/asm/domain.h b/xen/arch/arm/include/asm/domain.h
index af3e168374..758ad807e4 100644
--- a/xen/arch/arm/include/asm/domain.h
+++ b/xen/arch/arm/include/asm/domain.h
@@ -211,7 +211,6 @@ struct arch_vcpu
     register_t hcr_el2;
     register_t mdcr_el2;
 
-    uint32_t teecr, teehbr; /* ThumbEE, 32-bit guests only */
 #ifdef CONFIG_ARM_32
     /*
      * ARMv8 only supports a trivial implementation on Jazelle when in AArch32
diff --git a/xen/arch/arm/include/asm/processor.h b/xen/arch/arm/include/asm/processor.h
index 92c8bc1a31..ec23fd098b 100644
--- a/xen/arch/arm/include/asm/processor.h
+++ b/xen/arch/arm/include/asm/processor.h
@@ -411,6 +411,7 @@
 
 /* HSTR Hyp. System Trap Register */
 #define HSTR_T(x)       ((_AC(1,U)<<(x)))       /* Trap Cp15 c<x> */
+#define HSTR_TTEE       (_AC(1,U)<<16)          /* Trap ThumbEE */
 
 /* HDCR Hyp. Debug Configuration Register */
 #define HDCR_TDRA       (_AC(1,U)<<11)          /* Trap Debug ROM access */
diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
index 2bc3e1df04..040c0f2e0d 100644
--- a/xen/arch/arm/traps.c
+++ b/xen/arch/arm/traps.c
@@ -158,8 +158,8 @@ void init_traps(void)
     WRITE_SYSREG(HDCR_TDRA|HDCR_TDOSA|HDCR_TDA|HDCR_TPM|HDCR_TPMCR,
                  MDCR_EL2);
 
-    /* Trap CP15 c15 used for implementation defined registers */
-    WRITE_SYSREG(HSTR_T(15), HSTR_EL2);
+    /* Trap CP15 c15 used for implementation defined registers, and ThumbEE. */
+    WRITE_SYSREG(HSTR_T(15) | (cpu_has_thumbee ? HSTR_TTEE : 0), HSTR_EL2);
 
     WRITE_SYSREG(get_default_cptr_flags(), CPTR_EL2);
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.21


From xen-changelog-bounces@lists.xenproject.org Thu Mar 26 10:33:23 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 26 Mar 2026 10:33:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1263670.1555536 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w5i1j-0005Kd-GL; Thu, 26 Mar 2026 10:33:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1263670.1555536; Thu, 26 Mar 2026 10:33:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w5i1j-0005KU-Df; Thu, 26 Mar 2026 10:33:23 +0000
Received: by outflank-mailman (input) for mailman id 1263670;
 Thu, 26 Mar 2026 10:33:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w5i1i-0005KN-F5
 for xen-changelog@lists.xenproject.org; Thu, 26 Mar 2026 10:33:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w5i1i-00AYCS-25
 for xen-changelog@lists.xenproject.org;
 Thu, 26 Mar 2026 10:33:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w5i1i-00GjBk-1C
 for xen-changelog@lists.xenproject.org;
 Thu, 26 Mar 2026 10:33:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=fb4g/tryw/ddTOslpfcL0OLBgiaHSrbrV+Y5ITAaZUc=; b=5On+7/cobbo/SRq5ApieHBTMag
	WFWqbA0AdJo63zUFoGM2AaFw90SMQJdnRFTydKXdG95UfTmT2GjrmsCdjV0JnSIHuHe2UEyVincH9
	A0LHm4QD/AOsU4buzDPfhnEko11241mSSivl5IUG9bI2T/j5O3kvREJ5hjALJSG4fYag=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.21] x86/vpmu: Expose up to 8 Intel event selectors in PV Dom0
Message-Id: <E1w5i1i-00GjBk-1C@xenbits.xenproject.org>
Date: Thu, 26 Mar 2026 10:33:22 +0000

commit 3960613c1e3b56c4a5abd3ae1e656642ea8ef72c
Author:     Teddy Astie <teddy.astie@vates.tech>
AuthorDate: Thu Mar 26 11:08:40 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 26 11:08:40 2026 +0100

    x86/vpmu: Expose up to 8 Intel event selectors in PV Dom0
    
    Most (if not all) Intel CPUs starting from Sandy Bridge have up to 8
    event selectors per core, which could be halved per hyperthread.
    
    However, current PV emulation logic doesn't support up to 8 event selector,
    leading to errors when trying to access them, hence, preventing Linux from
    driving the vPMU correctly.
    
    Make sure up to MSR_P6_EVNTSEL(7) is usable, which is the same upper bound as
    used in VMX code.
    
    The check if the event selector actually exist for the hardware is done in
    core2_vpmu_do_{rdmsr,wrmsr}, hence we're not allowing to access non-existent
    MSRs.
    
    Fixes: 27c554198666 ("x86/VPMU: add support for PMU register handling on PV guests")
    Signed-off-by: Teddy Astie <teddy.astie@vates.tech>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 4e9d9e7cc9a663d7c15118d5ebe344f7edad3ec9
    master date: 2026-03-24 12:04:46 +0100
---
 xen/arch/x86/pv/emul-priv-op.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/pv/emul-priv-op.c b/xen/arch/x86/pv/emul-priv-op.c
index 548ad16cb8..b021c8a657 100644
--- a/xen/arch/x86/pv/emul-priv-op.c
+++ b/xen/arch/x86/pv/emul-priv-op.c
@@ -976,7 +976,7 @@ static int cf_check read_msr(
         return X86EMUL_OKAY;
 
     case MSR_P6_PERFCTR(0) ... MSR_P6_PERFCTR(7):
-    case MSR_P6_EVNTSEL(0) ... MSR_P6_EVNTSEL(3):
+    case MSR_P6_EVNTSEL(0) ... MSR_P6_EVNTSEL(7):
     case MSR_CORE_PERF_FIXED_CTR0 ... MSR_CORE_PERF_FIXED_CTR2:
     case MSR_CORE_PERF_FIXED_CTR_CTRL ... MSR_CORE_PERF_GLOBAL_OVF_CTRL:
         if ( boot_cpu_data.x86_vendor == X86_VENDOR_INTEL )
@@ -1158,7 +1158,7 @@ static int cf_check write_msr(
         break;
 
     case MSR_P6_PERFCTR(0) ... MSR_P6_PERFCTR(7):
-    case MSR_P6_EVNTSEL(0) ... MSR_P6_EVNTSEL(3):
+    case MSR_P6_EVNTSEL(0) ... MSR_P6_EVNTSEL(7):
     case MSR_CORE_PERF_FIXED_CTR0 ... MSR_CORE_PERF_FIXED_CTR2:
     case MSR_CORE_PERF_FIXED_CTR_CTRL ... MSR_CORE_PERF_GLOBAL_OVF_CTRL:
         if ( boot_cpu_data.x86_vendor == X86_VENDOR_INTEL )
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.21


From xen-changelog-bounces@lists.xenproject.org Thu Mar 26 10:33:33 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 26 Mar 2026 10:33:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1263671.1555540 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w5i1t-0005N2-I8; Thu, 26 Mar 2026 10:33:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1263671.1555540; Thu, 26 Mar 2026 10:33:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w5i1t-0005Mu-F8; Thu, 26 Mar 2026 10:33:33 +0000
Received: by outflank-mailman (input) for mailman id 1263671;
 Thu, 26 Mar 2026 10:33:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w5i1s-0005Mm-Hn
 for xen-changelog@lists.xenproject.org; Thu, 26 Mar 2026 10:33:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w5i1s-00AYCY-2N
 for xen-changelog@lists.xenproject.org;
 Thu, 26 Mar 2026 10:33:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w5i1s-00GjCt-1Z
 for xen-changelog@lists.xenproject.org;
 Thu, 26 Mar 2026 10:33:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=+iHnEpE3GNqgFHLVKyLlHkUhFZaWcQ/8lWrNqY/3zX8=; b=Wo2xe8riul0FGEGJpD0VXWY6kY
	z0sC1qQt20bqMrHoAt7Te83Aw9SB53xtd6Nk/YzJsfsKzHksu99Rh1vilez1INT4xhbcPGJSqli5A
	DXeeunfEW60Y+Iuump2chR2yJh3DacvS0HpEtwq1vtPOHD05ZLpYfeKa/rsPxTWcjgVw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.21] x86/S3: restore MCE (APs) init
Message-Id: <E1w5i1s-00GjCt-1Z@xenbits.xenproject.org>
Date: Thu, 26 Mar 2026 10:33:32 +0000

commit 1ea9c24d0f2caa1d171b1c77cfa534be7848b97e
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 26 11:08:57 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 26 11:08:57 2026 +0100

    x86/S3: restore MCE (APs) init
    
    MCE init for APs was broken when CPU feature re-checking was added. At the
    same time make sure we don't bypass setup_doitm() (and whatever else may
    be added to the bottom of identify_cpu()).
    
    Fixes: bb502a8ca592 ("x86: check feature flags after resume")
    Reported-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Tested-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 5ebd4dd14118e4eb24f1d409a7ca3773f77e7e41
    master date: 2026-03-24 12:05:42 +0100
---
 xen/arch/x86/cpu/common.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c
index 92c709ea69..574fd0be20 100644
--- a/xen/arch/x86/cpu/common.c
+++ b/xen/arch/x86/cpu/common.c
@@ -659,16 +659,20 @@ void identify_cpu(struct cpuinfo_x86 *c)
 			       smp_processor_id());
 	}
 
-	if (system_state == SYS_STATE_resume)
-		return;
+	if (system_state == SYS_STATE_resume) {
+		unsigned int cpu = smp_processor_id();
 
+		/* The BSP has this done right from enter_state(). */
+		if (cpu)
+			mcheck_init(&cpu_data[cpu], false);
+	}
 	/*
 	 * On SMP, boot_cpu_data holds the common feature set between
 	 * all CPUs; so make sure that we indicate which features are
 	 * common between the CPUs.  The first time this routine gets
 	 * executed, c == &boot_cpu_data.
 	 */
-	if ( c != &boot_cpu_data ) {
+	else if (c != &boot_cpu_data) {
 		/* AND the already accumulated flags with these */
 		for ( i = 0 ; i < NCAPINTS ; i++ )
 			boot_cpu_data.x86_capability[i] &= c->x86_capability[i];
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.21


From xen-changelog-bounces@lists.xenproject.org Thu Mar 26 10:44:05 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 26 Mar 2026 10:44:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1263701.1555562 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w5iC3-0007iU-OA; Thu, 26 Mar 2026 10:44:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1263701.1555562; Thu, 26 Mar 2026 10:44:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w5iC3-0007iM-LK; Thu, 26 Mar 2026 10:44:03 +0000
Received: by outflank-mailman (input) for mailman id 1263701;
 Thu, 26 Mar 2026 10:44:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w5iC1-0007iG-NZ
 for xen-changelog@lists.xenproject.org; Thu, 26 Mar 2026 10:44:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w5iC1-00AYOG-2i
 for xen-changelog@lists.xenproject.org;
 Thu, 26 Mar 2026 10:44:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w5iC1-00Gl6D-1u
 for xen-changelog@lists.xenproject.org;
 Thu, 26 Mar 2026 10:44:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ceahD/o0VBlT0GWlfyhXwxj189W8ZnvV4nBl0jbOUe8=; b=YQuvf/uJEw8iYz8xOT4AB8M4Ms
	MVViQvFIgk1xWoXHGiPQOfGyIRHPsIXA4bKrZ6gbYyilld5YkGyPyI4WGTjBFQkz5cW6MXCiFARkR
	N+2LCdLahFMsRxFaG9ph4E7Ad1XYZMr7McZh+r5VXj1tmtApxE+So+XvazQCzRg5x/74=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.20] Revert "xen/mm: allow deferred scrub of physmap populate allocated pages"
Message-Id: <E1w5iC1-00Gl6D-1u@xenbits.xenproject.org>
Date: Thu, 26 Mar 2026 10:44:01 +0000

commit a9730e49531c299c80a2cb8bad959dbbfcf46211
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 26 11:11:09 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 26 11:11:46 2026 +0100

    Revert "xen/mm: allow deferred scrub of physmap populate allocated pages"
    
    This reverts commit b304f948427218421af24abcb04b40d3c34fefbf and its
    prereq 7e10bb1501c0289988d27772823c5eaf52f1b6a5 ("xen/mm: remove
    aliasing of PGC_need_scrub over PGC_allocated"). Further fixes are
    needed before this can be considered for backporting.
---
 xen/arch/arm/include/asm/mm.h   |  10 ++--
 xen/arch/ppc/include/asm/mm.h   |  10 ++--
 xen/arch/riscv/include/asm/mm.h |  10 ++--
 xen/arch/x86/include/asm/mm.h   |  18 ++++---
 xen/common/domain.c             |  25 ----------
 xen/common/memory.c             | 105 +---------------------------------------
 xen/common/page_alloc.c         |   4 +-
 xen/include/xen/mm.h            |  11 -----
 xen/include/xen/sched.h         |   5 --
 9 files changed, 35 insertions(+), 163 deletions(-)

diff --git a/xen/arch/arm/include/asm/mm.h b/xen/arch/arm/include/asm/mm.h
index efbe19aba4..a0d8e5afe9 100644
--- a/xen/arch/arm/include/asm/mm.h
+++ b/xen/arch/arm/include/asm/mm.h
@@ -150,9 +150,6 @@ struct page_info
 #define _PGC_colored      PG_shift(4)
 #define PGC_colored       PG_mask(1, 4)
 #endif
-/* Page needs to be scrubbed. */
-#define _PGC_need_scrub   PG_shift(5)
-#define PGC_need_scrub    PG_mask(1, 5)
 /* ... */
 /* Page is broken? */
 #define _PGC_broken       PG_shift(7)
@@ -172,6 +169,13 @@ struct page_info
 #define PGC_count_width   PG_shift(10)
 #define PGC_count_mask    ((1UL<<PGC_count_width)-1)
 
+/*
+ * Page needs to be scrubbed. Since this bit can only be set on a page that is
+ * free (i.e. in PGC_state_free) we can reuse PGC_allocated bit.
+ */
+#define _PGC_need_scrub   _PGC_allocated
+#define PGC_need_scrub    PGC_allocated
+
 #ifdef CONFIG_ARM_32
 #define is_xen_heap_page(page) is_xen_heap_mfn(page_to_mfn(page))
 #define is_xen_heap_mfn(mfn) ({                                 \
diff --git a/xen/arch/ppc/include/asm/mm.h b/xen/arch/ppc/include/asm/mm.h
index 9b654945de..a433936076 100644
--- a/xen/arch/ppc/include/asm/mm.h
+++ b/xen/arch/ppc/include/asm/mm.h
@@ -58,9 +58,6 @@ static inline struct page_info *virt_to_page(const void *v)
 /* Page is Xen heap? */
 #define _PGC_xen_heap     PG_shift(2)
 #define PGC_xen_heap      PG_mask(1, 2)
-/* Page needs to be scrubbed. */
-#define _PGC_need_scrub   PG_shift(3)
-#define PGC_need_scrub    PG_mask(1, 3)
 /* Page is broken? */
 #define _PGC_broken       PG_shift(7)
 #define PGC_broken        PG_mask(1, 7)
@@ -79,6 +76,13 @@ static inline struct page_info *virt_to_page(const void *v)
 #define PGC_count_width   PG_shift(10)
 #define PGC_count_mask    ((1UL<<PGC_count_width)-1)
 
+/*
+ * Page needs to be scrubbed. Since this bit can only be set on a page that is
+ * free (i.e. in PGC_state_free) we can reuse PGC_allocated bit.
+ */
+#define _PGC_need_scrub   _PGC_allocated
+#define PGC_need_scrub    PGC_allocated
+
 #define is_xen_heap_page(page) ((page)->count_info & PGC_xen_heap)
 #define is_xen_heap_mfn(mfn) \
     (mfn_valid(mfn) && is_xen_heap_page(mfn_to_page(mfn)))
diff --git a/xen/arch/riscv/include/asm/mm.h b/xen/arch/riscv/include/asm/mm.h
index 70849ce2e6..292aa48fc1 100644
--- a/xen/arch/riscv/include/asm/mm.h
+++ b/xen/arch/riscv/include/asm/mm.h
@@ -221,15 +221,19 @@ static inline bool arch_mfns_in_directmap(unsigned long mfn, unsigned long nr)
 #define PGT_count_width   PG_shift(2)
 #define PGT_count_mask    ((1UL << PGT_count_width) - 1)
 
+/*
+ * Page needs to be scrubbed. Since this bit can only be set on a page that is
+ * free (i.e. in PGC_state_free) we can reuse PGC_allocated bit.
+ */
+#define _PGC_need_scrub   _PGC_allocated
+#define PGC_need_scrub    PGC_allocated
+
 /* Cleared when the owning guest 'frees' this page. */
 #define _PGC_allocated    PG_shift(1)
 #define PGC_allocated     PG_mask(1, 1)
 /* Page is Xen heap? */
 #define _PGC_xen_heap     PG_shift(2)
 #define PGC_xen_heap      PG_mask(1, 2)
-/* Page needs to be scrubbed. */
-#define _PGC_need_scrub   PG_shift(4)
-#define PGC_need_scrub    PG_mask(1, 4)
 /* Page is broken? */
 #define _PGC_broken       PG_shift(7)
 #define PGC_broken        PG_mask(1, 7)
diff --git a/xen/arch/x86/include/asm/mm.h b/xen/arch/x86/include/asm/mm.h
index 30e993baba..6c7e66ee21 100644
--- a/xen/arch/x86/include/asm/mm.h
+++ b/xen/arch/x86/include/asm/mm.h
@@ -83,25 +83,29 @@
 #define PGC_state_offlined  PG_mask(2, 6)
 #define PGC_state_free      PG_mask(3, 6)
 #define page_state_is(pg, st) (((pg)->count_info&PGC_state) == PGC_state_##st)
-/* Page needs to be scrubbed. */
-#define _PGC_need_scrub   PG_shift(7)
-#define PGC_need_scrub    PG_mask(1, 7)
 #ifdef CONFIG_SHADOW_PAGING
  /* Set when a page table page has been shadowed. */
-#define _PGC_shadowed_pt  PG_shift(8)
-#define PGC_shadowed_pt   PG_mask(1, 8)
+#define _PGC_shadowed_pt  PG_shift(7)
+#define PGC_shadowed_pt   PG_mask(1, 7)
 #else
 #define PGC_shadowed_pt   0
 #endif
 
 /* Count of references to this frame. */
 #if PGC_shadowed_pt
-#define PGC_count_width   PG_shift(8)
-#else
 #define PGC_count_width   PG_shift(7)
+#else
+#define PGC_count_width   PG_shift(6)
 #endif
 #define PGC_count_mask    ((1UL<<PGC_count_width)-1)
 
+/*
+ * Page needs to be scrubbed. Since this bit can only be set on a page that is
+ * free (i.e. in PGC_state_free) we can reuse PGC_allocated bit.
+ */
+#define _PGC_need_scrub   _PGC_allocated
+#define PGC_need_scrub    PGC_allocated
+
 #ifndef CONFIG_BIGMEM
 /*
  * This definition is solely for the use in struct page_info (and
diff --git a/xen/common/domain.c b/xen/common/domain.c
index 1a5a7d15bf..d03f3e046f 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -446,18 +446,6 @@ static int __init cf_check parse_dom0_param(const char *s)
 }
 custom_param("dom0", parse_dom0_param);
 
-static void domain_pending_scrub_free(struct domain *d)
-{
-    rspin_lock(&d->page_alloc_lock);
-    if ( d->pending_scrub )
-    {
-        FREE_DOMHEAP_PAGES(d->pending_scrub, d->pending_scrub_order);
-        d->pending_scrub_order = 0;
-        d->pending_scrub_index = 0;
-    }
-    rspin_unlock(&d->page_alloc_lock);
-}
-
 /*
  * Release resources held by a domain.  There may or may not be live
  * references to the domain, and it may or may not be fully constructed.
@@ -517,9 +505,6 @@ static int domain_teardown(struct domain *d)
     case PROG_none:
         BUILD_BUG_ON(PROG_none != 0);
 
-        /* Trivial teardown, not long-running enough to need a preemption check. */
-        domain_pending_scrub_free(d);
-
     PROGRESS(gnttab_mappings):
         rc = gnttab_release_mappings(d);
         if ( rc )
@@ -562,7 +547,6 @@ static void _domain_destroy(struct domain *d)
 {
     BUG_ON(!d->is_dying);
     BUG_ON(atomic_read(&d->refcnt) != DOMAIN_DESTROYED);
-    ASSERT(!d->pending_scrub);
 
     xfree(d->pbuf);
 
@@ -1494,15 +1478,6 @@ int domain_unpause_by_systemcontroller(struct domain *d)
      */
     if ( new == 0 && !d->creation_finished )
     {
-        if ( d->pending_scrub )
-        {
-            printk(XENLOG_ERR
-                   "%pd: cannot be started with pending unscrubbed pages, destroying\n",
-                   d);
-            domain_crash(d);
-            domain_pending_scrub_free(d);
-            return -EBUSY;
-        }
         d->creation_finished = true;
         arch_domain_creation_finished(d);
     }
diff --git a/xen/common/memory.c b/xen/common/memory.c
index 00ba0d61dc..c78f0dcd0a 100644
--- a/xen/common/memory.c
+++ b/xen/common/memory.c
@@ -157,73 +157,6 @@ static void increase_reservation(struct memop_args *a)
     a->nr_done = i;
 }
 
-/*
- * Temporary storage for a domain assigned page that's not been fully scrubbed.
- * Stored pages must be domheap ones.
- *
- * The stashed page can be freed at any time by Xen, the caller must pass the
- * order and NUMA node requirement to the fetch function to ensure the
- * currently stashed page matches it's requirements.
- */
-static void stash_allocation(struct domain *d, struct page_info *page,
-                             unsigned int order, unsigned int scrub_index)
-{
-    rspin_lock(&d->page_alloc_lock);
-
-    /*
-     * Drop the passed page in preference for the already stashed one.  This
-     * interface is designed to be used for single-threaded domain creation.
-     */
-    if ( d->pending_scrub || d->is_dying )
-        free_domheap_pages(page, order);
-    else
-    {
-        d->pending_scrub_index = scrub_index;
-        d->pending_scrub_order = order;
-        d->pending_scrub = page;
-    }
-
-    rspin_unlock(&d->page_alloc_lock);
-}
-
-static struct page_info *get_stashed_allocation(struct domain *d,
-                                                unsigned int order,
-                                                nodeid_t node,
-                                                unsigned int *scrub_index)
-{
-    struct page_info *page = NULL;
-
-    rspin_lock(&d->page_alloc_lock);
-
-    /*
-     * If there's a pending page to scrub check if it satisfies the current
-     * request.  If it doesn't free it and return NULL.
-     */
-    if ( d->pending_scrub )
-    {
-        if ( d->pending_scrub_order == order &&
-             (node == NUMA_NO_NODE || node == page_to_nid(d->pending_scrub)) )
-        {
-            page = d->pending_scrub;
-            *scrub_index = d->pending_scrub_index;
-        }
-        else
-            free_domheap_pages(d->pending_scrub, d->pending_scrub_order);
-
-        /*
-         * The caller now owns the page or it has been freed, clear stashed
-         * information.  Prevent concurrent usages of get_stashed_allocation()
-         * from returning the same page to different contexts.
-         */
-        d->pending_scrub_index = 0;
-        d->pending_scrub_order = 0;
-        d->pending_scrub = NULL;
-    }
-
-    rspin_unlock(&d->page_alloc_lock);
-    return page;
-}
-
 static void populate_physmap(struct memop_args *a)
 {
     struct page_info *page;
@@ -340,19 +273,7 @@ static void populate_physmap(struct memop_args *a)
             }
             else
             {
-                unsigned int scrub_start = 0;
-                unsigned int memflags =
-                    a->memflags | (d->creation_finished ? 0
-                                                        : MEMF_no_scrub);
-                nodeid_t node =
-                    (a->memflags & MEMF_exact_node) ? MEMF_get_node(a->memflags)
-                                                    : NUMA_NO_NODE;
-
-                page = get_stashed_allocation(d, a->extent_order, node,
-                                              &scrub_start);
-
-                if ( !page )
-                    page = alloc_domheap_pages(d, a->extent_order, memflags);
+                page = alloc_domheap_pages(d, a->extent_order, a->memflags);
 
                 if ( unlikely(!page) )
                 {
@@ -363,30 +284,6 @@ static void populate_physmap(struct memop_args *a)
                     goto out;
                 }
 
-                if ( memflags & MEMF_no_scrub )
-                {
-                    unsigned int dirty_cnt = 0;
-
-                    /* Check if there's anything to scrub. */
-                    for ( j = scrub_start; j < (1U << a->extent_order); j++ )
-                    {
-                        if ( !test_and_clear_bit(_PGC_need_scrub,
-                                                 &page[j].count_info) )
-                            continue;
-
-                        scrub_one_page(&page[j]);
-
-                        if ( (j + 1) != (1U << a->extent_order) &&
-                             !(++dirty_cnt & 0xff) &&
-                             hypercall_preempt_check() )
-                        {
-                            a->preempted = 1;
-                            stash_allocation(d, page, a->extent_order, j + 1);
-                            goto out;
-                        }
-                    }
-                }
-
                 if ( unlikely(a->memflags & MEMF_no_tlbflush) )
                 {
                     for ( j = 0; j < (1U << a->extent_order); j++ )
diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
index cab35bc39c..6919722e9a 100644
--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -169,7 +169,7 @@
 /*
  * Flags that are preserved in assign_pages() (and only there)
  */
-#define PGC_preserved (PGC_extra | PGC_static | PGC_colored | PGC_need_scrub)
+#define PGC_preserved (PGC_extra | PGC_static | PGC_colored)
 
 #ifndef PGT_TYPE_INFO_INITIALIZER
 #define PGT_TYPE_INFO_INITIALIZER 0
@@ -764,7 +764,7 @@ static void page_list_add_scrub(struct page_info *pg, unsigned int node,
 #endif
 #define SCRUB_BYTE_PATTERN   (SCRUB_PATTERN & 0xff)
 
-void scrub_one_page(const struct page_info *pg)
+static void scrub_one_page(const struct page_info *pg)
 {
     if ( unlikely(pg->count_info & PGC_broken) )
         return;
diff --git a/xen/include/xen/mm.h b/xen/include/xen/mm.h
index e8f4a2fba3..16f733281a 100644
--- a/xen/include/xen/mm.h
+++ b/xen/include/xen/mm.h
@@ -144,17 +144,6 @@ unsigned long avail_domheap_pages(void);
 unsigned long avail_node_heap_pages(unsigned int nodeid);
 #define alloc_domheap_page(d,f) (alloc_domheap_pages(d,0,f))
 #define free_domheap_page(p)  (free_domheap_pages(p,0))
-
-/* Free an allocation, and zero the pointer to it. */
-#define FREE_DOMHEAP_PAGES(p, o) do { \
-    void *_ptr_ = (p);                \
-    (p) = NULL;                       \
-    free_domheap_pages(_ptr_, o);     \
-} while ( false )
-#define FREE_DOMHEAP_PAGE(p) FREE_DOMHEAP_PAGES(p, 0)
-
-void scrub_one_page(const struct page_info *pg);
-
 unsigned int online_page(mfn_t mfn, uint32_t *status);
 int offline_page(mfn_t mfn, int broken, uint32_t *status);
 int query_page_offline(mfn_t mfn, uint32_t *status);
diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
index e664221184..de621eb123 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -646,11 +646,6 @@ struct domain
     unsigned int num_llc_colors;
     const unsigned int *llc_colors;
 #endif
-
-    /* Pointer to allocated domheap page that possibly needs scrubbing. */
-    struct page_info *pending_scrub;
-    unsigned int pending_scrub_order;
-    unsigned int pending_scrub_index;
 };
 
 static inline struct page_list_head *page_to_list(
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.20


From xen-changelog-bounces@lists.xenproject.org Thu Mar 26 10:44:13 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 26 Mar 2026 10:44:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1263702.1555566 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w5iCD-0007kP-PM; Thu, 26 Mar 2026 10:44:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1263702.1555566; Thu, 26 Mar 2026 10:44:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w5iCD-0007kH-Mn; Thu, 26 Mar 2026 10:44:13 +0000
Received: by outflank-mailman (input) for mailman id 1263702;
 Thu, 26 Mar 2026 10:44:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w5iCB-0007k5-Pp
 for xen-changelog@lists.xenproject.org; Thu, 26 Mar 2026 10:44:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w5iCB-00AYOc-37
 for xen-changelog@lists.xenproject.org;
 Thu, 26 Mar 2026 10:44:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w5iCB-00Gl8V-2F
 for xen-changelog@lists.xenproject.org;
 Thu, 26 Mar 2026 10:44:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=JLLa7sIE+0iV4+6J2JEQJWMh/OkY9YUrVz1SA0bndvg=; b=jk7APNcmUX7PxGkfIarTPuB44b
	9ApGAo6fwqXE6l2qLIhOMFAUZ0YjdgR0DKcMIeAosClTAC1NVp7Kalkz0zQl70HXQ8rSWB4sfg4jt
	q6Os3H8GqigePaJZZwHOxoNYETacaogu98DAD2AkoI0+cEp4vjMhuT/Kl977THiMwL48=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.20] ARM: Drop ThumbEE support
Message-Id: <E1w5iCB-00Gl8V-2F@xenbits.xenproject.org>
Date: Thu, 26 Mar 2026 10:44:11 +0000

commit 3f67b78bc8eec00864f1149218a12f5a902f9dbc
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Mar 26 11:13:59 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 26 11:13:59 2026 +0100

    ARM: Drop ThumbEE support
    
    Hans reports that Xen no longer builds on Debian unstable/sid:
    
      Assembler messages:
      {standard input}:474: Error: unknown or missing system register name at operand 1 -- `msr TEECR32_EL1,x0'
      {standard input}:480: Error: unknown or missing system register name at operand 1 -- `msr TEEHBR32_EL1,x0'
      {standard input}:488: Error: unknown or missing system register name at operand 2 -- `mrs x0,TEECR32_EL1'
      {standard input}:494: Error: unknown or missing system register name at operand 2 -- `mrs x0,TEEHBR32_EL1'
      make[5]: *** [Rules.mk:249: arch/arm/domain.o] Error 1
    
    This turns out to be an intentional change in binutils.  ThumbEE was dropped
    ahead of ARM v8 (i.e. AArch64).
    
    Xen supports ARM v7+virt extensions so in principle we could #ifdef
    CONFIG_ARM_32 to keep it working.  However, there was apparently no use of
    ThumbEE outside of demo code, so simply drop it.
    
    On ThumbEE capable hardware, unconditionally trap ThumbEE instructions, and
    drop the context switching logic for TEE{CR,HBR}32.
    
    Reported-by: Hans van Kranenburg <hans@knorrie.org>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    
    xen/arm: Set ThumbEE as not present in PFR0
    
    Force ThumbEE support to not available in the version of the PFR0
    register value we present to guest.
    Xen does not support ThumbEE and will trap all access to ThumbEE
    registers so do not report it being supported if the hardware supports
    it.
    
    Fixes: 5bbe1fe413f9 ("ARM: Drop ThumbEE support")
    Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
    Tested-by: Luca Fancellu <luca.fancellu@arm.com>
    master commit: 5bbe1fe413f9d6a841b0bc70db024b1398391630
    master date: 2025-12-05 18:06:19 +0000
    master commit: 1ecb5946bdf8797d43ac6730c708bd105fdb0be4
    master date: 2026-01-05 10:33:03 +0000
---
 xen/arch/arm/cpufeature.c            |  3 +++
 xen/arch/arm/domain.c                | 12 ------------
 xen/arch/arm/include/asm/domain.h    |  1 -
 xen/arch/arm/include/asm/processor.h |  1 +
 xen/arch/arm/traps.c                 |  4 ++--
 5 files changed, 6 insertions(+), 15 deletions(-)

diff --git a/xen/arch/arm/cpufeature.c b/xen/arch/arm/cpufeature.c
index 1a80738571..94d14fb6a9 100644
--- a/xen/arch/arm/cpufeature.c
+++ b/xen/arch/arm/cpufeature.c
@@ -227,6 +227,9 @@ static int __init create_domain_cpuinfo(void)
 #endif
     domain_cpuinfo.pfr32.amu = 0;
 
+    /* Hide ThumbEE support */
+    domain_cpuinfo.pfr32.thumbee = 0;
+
     /* Hide RAS support as Xen does not support it */
 #ifdef CONFIG_ARM_64
     domain_cpuinfo.pfr64.ras = 0;
diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c
index 3ba959f866..2d00b4ce1d 100644
--- a/xen/arch/arm/domain.c
+++ b/xen/arch/arm/domain.c
@@ -111,12 +111,6 @@ static void ctxt_switch_from(struct vcpu *p)
     p->arch.cntkctl = READ_SYSREG(CNTKCTL_EL1);
     virt_timer_save(p);
 
-    if ( is_32bit_domain(p->domain) && cpu_has_thumbee )
-    {
-        p->arch.teecr = READ_SYSREG(TEECR32_EL1);
-        p->arch.teehbr = READ_SYSREG(TEEHBR32_EL1);
-    }
-
 #ifdef CONFIG_ARM_32
     p->arch.joscr = READ_CP32(JOSCR);
     p->arch.jmcr = READ_CP32(JMCR);
@@ -244,12 +238,6 @@ static void ctxt_switch_to(struct vcpu *n)
     WRITE_SYSREG(n->arch.tpidrro_el0, TPIDRRO_EL0);
     WRITE_SYSREG(n->arch.tpidr_el1, TPIDR_EL1);
 
-    if ( is_32bit_domain(n->domain) && cpu_has_thumbee )
-    {
-        WRITE_SYSREG(n->arch.teecr, TEECR32_EL1);
-        WRITE_SYSREG(n->arch.teehbr, TEEHBR32_EL1);
-    }
-
 #ifdef CONFIG_ARM_32
     WRITE_CP32(n->arch.joscr, JOSCR);
     WRITE_CP32(n->arch.jmcr, JMCR);
diff --git a/xen/arch/arm/include/asm/domain.h b/xen/arch/arm/include/asm/domain.h
index f1d72c6e48..48aa17b1b1 100644
--- a/xen/arch/arm/include/asm/domain.h
+++ b/xen/arch/arm/include/asm/domain.h
@@ -204,7 +204,6 @@ struct arch_vcpu
     register_t hcr_el2;
     register_t mdcr_el2;
 
-    uint32_t teecr, teehbr; /* ThumbEE, 32-bit guests only */
 #ifdef CONFIG_ARM_32
     /*
      * ARMv8 only supports a trivial implementation on Jazelle when in AArch32
diff --git a/xen/arch/arm/include/asm/processor.h b/xen/arch/arm/include/asm/processor.h
index 60b587db69..ecf7f2e859 100644
--- a/xen/arch/arm/include/asm/processor.h
+++ b/xen/arch/arm/include/asm/processor.h
@@ -411,6 +411,7 @@
 
 /* HSTR Hyp. System Trap Register */
 #define HSTR_T(x)       ((_AC(1,U)<<(x)))       /* Trap Cp15 c<x> */
+#define HSTR_TTEE       (_AC(1,U)<<16)          /* Trap ThumbEE */
 
 /* HDCR Hyp. Debug Configuration Register */
 #define HDCR_TDRA       (_AC(1,U)<<11)          /* Trap Debug ROM access */
diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
index 737f4d65e3..4b7ccdf485 100644
--- a/xen/arch/arm/traps.c
+++ b/xen/arch/arm/traps.c
@@ -158,8 +158,8 @@ void init_traps(void)
     WRITE_SYSREG(HDCR_TDRA|HDCR_TDOSA|HDCR_TDA|HDCR_TPM|HDCR_TPMCR,
                  MDCR_EL2);
 
-    /* Trap CP15 c15 used for implementation defined registers */
-    WRITE_SYSREG(HSTR_T(15), HSTR_EL2);
+    /* Trap CP15 c15 used for implementation defined registers, and ThumbEE. */
+    WRITE_SYSREG(HSTR_T(15) | (cpu_has_thumbee ? HSTR_TTEE : 0), HSTR_EL2);
 
     WRITE_SYSREG(get_default_cptr_flags(), CPTR_EL2);
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.20


From xen-changelog-bounces@lists.xenproject.org Thu Mar 26 10:44:23 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 26 Mar 2026 10:44:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1263703.1555569 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w5iCN-0007mY-Qe; Thu, 26 Mar 2026 10:44:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1263703.1555569; Thu, 26 Mar 2026 10:44:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w5iCN-0007mQ-OB; Thu, 26 Mar 2026 10:44:23 +0000
Received: by outflank-mailman (input) for mailman id 1263703;
 Thu, 26 Mar 2026 10:44:21 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w5iCL-0007mI-SP
 for xen-changelog@lists.xenproject.org; Thu, 26 Mar 2026 10:44:21 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w5iCM-00AYOk-0C
 for xen-changelog@lists.xenproject.org;
 Thu, 26 Mar 2026 10:44:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w5iCL-00GlAM-2c
 for xen-changelog@lists.xenproject.org;
 Thu, 26 Mar 2026 10:44:21 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=VR5upoA31PGn3Yea5FCUuHALlDeWdMw1VkD8p8qazYY=; b=VY4a5KNUUJOFUer/RX+qwIRbmD
	ZLxdk7Ve/E4S3YdBejbAJGcbbJ/0kAICTgf+CClbbqWpmBQeRP68C9/ClvJm167B4W/YMNXg65C/E
	iqj0YP6rf08tGdo+thh3S6jZJOyAYcczdQAZOaMCvMCqOadmIc9QPczaga1RK+W5XDdA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.20] x86/vpmu: Expose up to 8 Intel event selectors in PV Dom0
Message-Id: <E1w5iCL-00GlAM-2c@xenbits.xenproject.org>
Date: Thu, 26 Mar 2026 10:44:21 +0000

commit 598d4c662aa348fd9a898b4a8ef04ba7c8a44d6d
Author:     Teddy Astie <teddy.astie@vates.tech>
AuthorDate: Thu Mar 26 11:14:28 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 26 11:14:28 2026 +0100

    x86/vpmu: Expose up to 8 Intel event selectors in PV Dom0
    
    Most (if not all) Intel CPUs starting from Sandy Bridge have up to 8
    event selectors per core, which could be halved per hyperthread.
    
    However, current PV emulation logic doesn't support up to 8 event selector,
    leading to errors when trying to access them, hence, preventing Linux from
    driving the vPMU correctly.
    
    Make sure up to MSR_P6_EVNTSEL(7) is usable, which is the same upper bound as
    used in VMX code.
    
    The check if the event selector actually exist for the hardware is done in
    core2_vpmu_do_{rdmsr,wrmsr}, hence we're not allowing to access non-existent
    MSRs.
    
    Fixes: 27c554198666 ("x86/VPMU: add support for PMU register handling on PV guests")
    Signed-off-by: Teddy Astie <teddy.astie@vates.tech>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 4e9d9e7cc9a663d7c15118d5ebe344f7edad3ec9
    master date: 2026-03-24 12:04:46 +0100
---
 xen/arch/x86/pv/emul-priv-op.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/pv/emul-priv-op.c b/xen/arch/x86/pv/emul-priv-op.c
index 7753e44477..af805d5efd 100644
--- a/xen/arch/x86/pv/emul-priv-op.c
+++ b/xen/arch/x86/pv/emul-priv-op.c
@@ -972,7 +972,7 @@ static int cf_check read_msr(
         return X86EMUL_OKAY;
 
     case MSR_P6_PERFCTR(0) ... MSR_P6_PERFCTR(7):
-    case MSR_P6_EVNTSEL(0) ... MSR_P6_EVNTSEL(3):
+    case MSR_P6_EVNTSEL(0) ... MSR_P6_EVNTSEL(7):
     case MSR_CORE_PERF_FIXED_CTR0 ... MSR_CORE_PERF_FIXED_CTR2:
     case MSR_CORE_PERF_FIXED_CTR_CTRL ... MSR_CORE_PERF_GLOBAL_OVF_CTRL:
         if ( boot_cpu_data.x86_vendor == X86_VENDOR_INTEL )
@@ -1149,7 +1149,7 @@ static int cf_check write_msr(
         break;
 
     case MSR_P6_PERFCTR(0) ... MSR_P6_PERFCTR(7):
-    case MSR_P6_EVNTSEL(0) ... MSR_P6_EVNTSEL(3):
+    case MSR_P6_EVNTSEL(0) ... MSR_P6_EVNTSEL(7):
     case MSR_CORE_PERF_FIXED_CTR0 ... MSR_CORE_PERF_FIXED_CTR2:
     case MSR_CORE_PERF_FIXED_CTR_CTRL ... MSR_CORE_PERF_GLOBAL_OVF_CTRL:
         if ( boot_cpu_data.x86_vendor == X86_VENDOR_INTEL )
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.20


From xen-changelog-bounces@lists.xenproject.org Thu Mar 26 10:44:33 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 26 Mar 2026 10:44:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1263704.1555575 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w5iCX-0007qS-Sx; Thu, 26 Mar 2026 10:44:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1263704.1555575; Thu, 26 Mar 2026 10:44:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w5iCX-0007qK-Ph; Thu, 26 Mar 2026 10:44:33 +0000
Received: by outflank-mailman (input) for mailman id 1263704;
 Thu, 26 Mar 2026 10:44:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w5iCV-0007qC-W4
 for xen-changelog@lists.xenproject.org; Thu, 26 Mar 2026 10:44:31 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w5iCW-00AYOo-0Z
 for xen-changelog@lists.xenproject.org;
 Thu, 26 Mar 2026 10:44:31 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w5iCV-00GlDZ-2v
 for xen-changelog@lists.xenproject.org;
 Thu, 26 Mar 2026 10:44:31 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=3dpjvBUOa1q8+4wYajcgPfY9oN0P68A6z18bsqS7+AY=; b=L2awTHKbfbsV9IJ88YJhJEHrPI
	e81ah+LSl1bG6HJjKzr6nPVhL3AMhX7DA99V2M1xoCOlGrodY+dN8b6wK82ZeQhauozuPkunQi/YY
	Z6iEHkPmSl3yAlT1KP5tTyVufhe/lz2aSXyiA0k7NRDeMRVYNowg8avSsxycPr5kqBZ8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.20] x86/S3: restore MCE (APs) init
Message-Id: <E1w5iCV-00GlDZ-2v@xenbits.xenproject.org>
Date: Thu, 26 Mar 2026 10:44:31 +0000

commit 72b74479efa480d98e36ebc4434d7579f73fa25f
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 26 11:15:03 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 26 11:15:03 2026 +0100

    x86/S3: restore MCE (APs) init
    
    MCE init for APs was broken when CPU feature re-checking was added. At the
    same time make sure we don't bypass setup_doitm() (and whatever else may
    be added to the bottom of identify_cpu()).
    
    Fixes: bb502a8ca592 ("x86: check feature flags after resume")
    Reported-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Tested-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 5ebd4dd14118e4eb24f1d409a7ca3773f77e7e41
    master date: 2026-03-24 12:05:42 +0100
---
 xen/arch/x86/cpu/common.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c
index 4efa4fed32..683ec673f7 100644
--- a/xen/arch/x86/cpu/common.c
+++ b/xen/arch/x86/cpu/common.c
@@ -612,16 +612,20 @@ void identify_cpu(struct cpuinfo_x86 *c)
 			       smp_processor_id());
 	}
 
-	if (system_state == SYS_STATE_resume)
-		return;
+	if (system_state == SYS_STATE_resume) {
+		unsigned int cpu = smp_processor_id();
 
+		/* The BSP has this done right from enter_state(). */
+		if (cpu)
+			mcheck_init(&cpu_data[cpu], false);
+	}
 	/*
 	 * On SMP, boot_cpu_data holds the common feature set between
 	 * all CPUs; so make sure that we indicate which features are
 	 * common between the CPUs.  The first time this routine gets
 	 * executed, c == &boot_cpu_data.
 	 */
-	if ( c != &boot_cpu_data ) {
+	else if (c != &boot_cpu_data) {
 		/* AND the already accumulated flags with these */
 		for ( i = 0 ; i < NCAPINTS ; i++ )
 			boot_cpu_data.x86_capability[i] &= c->x86_capability[i];
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.20


From xen-changelog-bounces@lists.xenproject.org Thu Mar 26 10:44:44 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 26 Mar 2026 10:44:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1263705.1555577 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w5iCh-0007t0-Vk; Thu, 26 Mar 2026 10:44:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1263705.1555577; Thu, 26 Mar 2026 10:44:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w5iCh-0007ss-T9; Thu, 26 Mar 2026 10:44:43 +0000
Received: by outflank-mailman (input) for mailman id 1263705;
 Thu, 26 Mar 2026 10:44:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w5iCg-0007sm-Ds
 for xen-changelog@lists.xenproject.org; Thu, 26 Mar 2026 10:44:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w5iCg-00AYOs-1y
 for xen-changelog@lists.xenproject.org;
 Thu, 26 Mar 2026 10:44:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w5iCg-00GlJ3-1B
 for xen-changelog@lists.xenproject.org;
 Thu, 26 Mar 2026 10:44:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=raNurGe7qayr70TtqZ3QIDpFlnXd4we5eLlCjVl0QJM=; b=6CA4SjPQlFm4LHg4jLLRW5NC9i
	OYtWkIuvbBcsKzl47e7ekXe9yFB9lYT3uyfmUUf88JbN/27TMMG1gP9n/cA4KUQR76wqI5dWdVoKI
	QhmOx6Md3ctDoO4W26+QuLGmmjyYnSVU0CnzbhDrcGR68kjdd1RM0Sn2gCZ7QLroIho0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] Revert "xen/mm: allow deferred scrub of physmap populate allocated pages"
Message-Id: <E1w5iCg-00GlJ3-1B@xenbits.xenproject.org>
Date: Thu, 26 Mar 2026 10:44:42 +0000

commit 360813e9e829f0b9439ac08a16808341cf74e993
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 26 11:16:35 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 26 11:16:58 2026 +0100

    Revert "xen/mm: allow deferred scrub of physmap populate allocated pages"
    
    This reverts commit 52f3b7c6f89abe1f8fd4fc702f150cf3ec1fe89f and its
    prereq 49a4deb467caea989d81f3692ed19a406ef6ee83 ("xen/mm: remove
    aliasing of PGC_need_scrub over PGC_allocated"). Further fixes are
    needed before this can be considered for backporting.
---
 xen/arch/arm/include/asm/mm.h |  10 ++--
 xen/arch/ppc/include/asm/mm.h |  10 ++--
 xen/arch/x86/include/asm/mm.h |  18 +++++---
 xen/common/domain.c           |  25 ----------
 xen/common/memory.c           | 105 +-----------------------------------------
 xen/common/page_alloc.c       |   6 +--
 xen/include/xen/mm.h          |   9 ----
 xen/include/xen/sched.h       |   5 --
 8 files changed, 28 insertions(+), 160 deletions(-)

diff --git a/xen/arch/arm/include/asm/mm.h b/xen/arch/arm/include/asm/mm.h
index ed71cf9bca..48538b5337 100644
--- a/xen/arch/arm/include/asm/mm.h
+++ b/xen/arch/arm/include/asm/mm.h
@@ -145,9 +145,6 @@ struct page_info
 #else
 #define PGC_static     0
 #endif
-/* Page needs to be scrubbed. */
-#define _PGC_need_scrub   PG_shift(5)
-#define PGC_need_scrub    PG_mask(1, 5)
 /* ... */
 /* Page is broken? */
 #define _PGC_broken       PG_shift(7)
@@ -167,6 +164,13 @@ struct page_info
 #define PGC_count_width   PG_shift(10)
 #define PGC_count_mask    ((1UL<<PGC_count_width)-1)
 
+/*
+ * Page needs to be scrubbed. Since this bit can only be set on a page that is
+ * free (i.e. in PGC_state_free) we can reuse PGC_allocated bit.
+ */
+#define _PGC_need_scrub   _PGC_allocated
+#define PGC_need_scrub    PGC_allocated
+
 #ifdef CONFIG_ARM_32
 #define is_xen_heap_page(page) is_xen_heap_mfn(page_to_mfn(page))
 #define is_xen_heap_mfn(mfn) ({                                 \
diff --git a/xen/arch/ppc/include/asm/mm.h b/xen/arch/ppc/include/asm/mm.h
index 9b654945de..a433936076 100644
--- a/xen/arch/ppc/include/asm/mm.h
+++ b/xen/arch/ppc/include/asm/mm.h
@@ -58,9 +58,6 @@ static inline struct page_info *virt_to_page(const void *v)
 /* Page is Xen heap? */
 #define _PGC_xen_heap     PG_shift(2)
 #define PGC_xen_heap      PG_mask(1, 2)
-/* Page needs to be scrubbed. */
-#define _PGC_need_scrub   PG_shift(3)
-#define PGC_need_scrub    PG_mask(1, 3)
 /* Page is broken? */
 #define _PGC_broken       PG_shift(7)
 #define PGC_broken        PG_mask(1, 7)
@@ -79,6 +76,13 @@ static inline struct page_info *virt_to_page(const void *v)
 #define PGC_count_width   PG_shift(10)
 #define PGC_count_mask    ((1UL<<PGC_count_width)-1)
 
+/*
+ * Page needs to be scrubbed. Since this bit can only be set on a page that is
+ * free (i.e. in PGC_state_free) we can reuse PGC_allocated bit.
+ */
+#define _PGC_need_scrub   _PGC_allocated
+#define PGC_need_scrub    PGC_allocated
+
 #define is_xen_heap_page(page) ((page)->count_info & PGC_xen_heap)
 #define is_xen_heap_mfn(mfn) \
     (mfn_valid(mfn) && is_xen_heap_page(mfn_to_page(mfn)))
diff --git a/xen/arch/x86/include/asm/mm.h b/xen/arch/x86/include/asm/mm.h
index 52d2d5ff60..98b66edaca 100644
--- a/xen/arch/x86/include/asm/mm.h
+++ b/xen/arch/x86/include/asm/mm.h
@@ -83,25 +83,29 @@
 #define PGC_state_offlined  PG_mask(2, 6)
 #define PGC_state_free      PG_mask(3, 6)
 #define page_state_is(pg, st) (((pg)->count_info&PGC_state) == PGC_state_##st)
-/* Page needs to be scrubbed. */
-#define _PGC_need_scrub   PG_shift(7)
-#define PGC_need_scrub    PG_mask(1, 7)
 #ifdef CONFIG_SHADOW_PAGING
  /* Set when a page table page has been shadowed. */
-#define _PGC_shadowed_pt  PG_shift(8)
-#define PGC_shadowed_pt   PG_mask(1, 8)
+#define _PGC_shadowed_pt  PG_shift(7)
+#define PGC_shadowed_pt   PG_mask(1, 7)
 #else
 #define PGC_shadowed_pt   0
 #endif
 
 /* Count of references to this frame. */
 #if PGC_shadowed_pt
-#define PGC_count_width   PG_shift(8)
-#else
 #define PGC_count_width   PG_shift(7)
+#else
+#define PGC_count_width   PG_shift(6)
 #endif
 #define PGC_count_mask    ((1UL<<PGC_count_width)-1)
 
+/*
+ * Page needs to be scrubbed. Since this bit can only be set on a page that is
+ * free (i.e. in PGC_state_free) we can reuse PGC_allocated bit.
+ */
+#define _PGC_need_scrub   _PGC_allocated
+#define PGC_need_scrub    PGC_allocated
+
 #ifndef CONFIG_BIGMEM
 /*
  * This definition is solely for the use in struct page_info (and
diff --git a/xen/common/domain.c b/xen/common/domain.c
index 77dacffd22..00c59a9baa 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -392,18 +392,6 @@ static int __init cf_check parse_dom0_param(const char *s)
 }
 custom_param("dom0", parse_dom0_param);
 
-static void domain_pending_scrub_free(struct domain *d)
-{
-    rspin_lock(&d->page_alloc_lock);
-    if ( d->pending_scrub )
-    {
-        FREE_DOMHEAP_PAGES(d->pending_scrub, d->pending_scrub_order);
-        d->pending_scrub_order = 0;
-        d->pending_scrub_index = 0;
-    }
-    rspin_unlock(&d->page_alloc_lock);
-}
-
 /*
  * Release resources held by a domain.  There may or may not be live
  * references to the domain, and it may or may not be fully constructed.
@@ -463,9 +451,6 @@ static int domain_teardown(struct domain *d)
     case PROG_none:
         BUILD_BUG_ON(PROG_none != 0);
 
-        /* Trivial teardown, not long-running enough to need a preemption check. */
-        domain_pending_scrub_free(d);
-
     PROGRESS(gnttab_mappings):
         rc = gnttab_release_mappings(d);
         if ( rc )
@@ -508,7 +493,6 @@ static void _domain_destroy(struct domain *d)
 {
     BUG_ON(!d->is_dying);
     BUG_ON(atomic_read(&d->refcnt) != DOMAIN_DESTROYED);
-    ASSERT(!d->pending_scrub);
 
     xfree(d->pbuf);
 
@@ -1436,15 +1420,6 @@ int domain_unpause_by_systemcontroller(struct domain *d)
      */
     if ( new == 0 && !d->creation_finished )
     {
-        if ( d->pending_scrub )
-        {
-            printk(XENLOG_ERR
-                   "%pd: cannot be started with pending unscrubbed pages, destroying\n",
-                   d);
-            domain_crash(d);
-            domain_pending_scrub_free(d);
-            return -EBUSY;
-        }
         d->creation_finished = true;
         arch_domain_creation_finished(d);
     }
diff --git a/xen/common/memory.c b/xen/common/memory.c
index 09bb1198bb..9b23cd0bdb 100644
--- a/xen/common/memory.c
+++ b/xen/common/memory.c
@@ -155,73 +155,6 @@ static void increase_reservation(struct memop_args *a)
     a->nr_done = i;
 }
 
-/*
- * Temporary storage for a domain assigned page that's not been fully scrubbed.
- * Stored pages must be domheap ones.
- *
- * The stashed page can be freed at any time by Xen, the caller must pass the
- * order and NUMA node requirement to the fetch function to ensure the
- * currently stashed page matches it's requirements.
- */
-static void stash_allocation(struct domain *d, struct page_info *page,
-                             unsigned int order, unsigned int scrub_index)
-{
-    rspin_lock(&d->page_alloc_lock);
-
-    /*
-     * Drop the passed page in preference for the already stashed one.  This
-     * interface is designed to be used for single-threaded domain creation.
-     */
-    if ( d->pending_scrub || d->is_dying )
-        free_domheap_pages(page, order);
-    else
-    {
-        d->pending_scrub_index = scrub_index;
-        d->pending_scrub_order = order;
-        d->pending_scrub = page;
-    }
-
-    rspin_unlock(&d->page_alloc_lock);
-}
-
-static struct page_info *get_stashed_allocation(struct domain *d,
-                                                unsigned int order,
-                                                nodeid_t node,
-                                                unsigned int *scrub_index)
-{
-    struct page_info *page = NULL;
-
-    rspin_lock(&d->page_alloc_lock);
-
-    /*
-     * If there's a pending page to scrub check if it satisfies the current
-     * request.  If it doesn't free it and return NULL.
-     */
-    if ( d->pending_scrub )
-    {
-        if ( d->pending_scrub_order == order &&
-             (node == NUMA_NO_NODE || node == page_to_nid(d->pending_scrub)) )
-        {
-            page = d->pending_scrub;
-            *scrub_index = d->pending_scrub_index;
-        }
-        else
-            free_domheap_pages(d->pending_scrub, d->pending_scrub_order);
-
-        /*
-         * The caller now owns the page or it has been freed, clear stashed
-         * information.  Prevent concurrent usages of get_stashed_allocation()
-         * from returning the same page to different contexts.
-         */
-        d->pending_scrub_index = 0;
-        d->pending_scrub_order = 0;
-        d->pending_scrub = NULL;
-    }
-
-    rspin_unlock(&d->page_alloc_lock);
-    return page;
-}
-
 static void populate_physmap(struct memop_args *a)
 {
     struct page_info *page;
@@ -338,19 +271,7 @@ static void populate_physmap(struct memop_args *a)
             }
             else
             {
-                unsigned int scrub_start = 0;
-                unsigned int memflags =
-                    a->memflags | (d->creation_finished ? 0
-                                                        : MEMF_no_scrub);
-                nodeid_t node =
-                    (a->memflags & MEMF_exact_node) ? MEMF_get_node(a->memflags)
-                                                    : NUMA_NO_NODE;
-
-                page = get_stashed_allocation(d, a->extent_order, node,
-                                              &scrub_start);
-
-                if ( !page )
-                    page = alloc_domheap_pages(d, a->extent_order, memflags);
+                page = alloc_domheap_pages(d, a->extent_order, a->memflags);
 
                 if ( unlikely(!page) )
                 {
@@ -361,30 +282,6 @@ static void populate_physmap(struct memop_args *a)
                     goto out;
                 }
 
-                if ( memflags & MEMF_no_scrub )
-                {
-                    unsigned int dirty_cnt = 0;
-
-                    /* Check if there's anything to scrub. */
-                    for ( j = scrub_start; j < (1U << a->extent_order); j++ )
-                    {
-                        if ( !test_and_clear_bit(_PGC_need_scrub,
-                                                 &page[j].count_info) )
-                            continue;
-
-                        scrub_one_page(&page[j]);
-
-                        if ( (j + 1) != (1U << a->extent_order) &&
-                             !(++dirty_cnt & 0xff) &&
-                             hypercall_preempt_check() )
-                        {
-                            a->preempted = 1;
-                            stash_allocation(d, page, a->extent_order, j + 1);
-                            goto out;
-                        }
-                    }
-                }
-
                 if ( unlikely(a->memflags & MEMF_no_tlbflush) )
                 {
                     for ( j = 0; j < (1U << a->extent_order); j++ )
diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
index 4304c3dbd4..bbb8578459 100644
--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -2364,8 +2364,7 @@ int assign_pages(
 
         for ( i = 0; i < nr; i++ )
         {
-            ASSERT(!(pg[i].count_info &
-                     ~(PGC_extra | PGC_static | PGC_need_scrub)));
+            ASSERT(!(pg[i].count_info & ~(PGC_extra | PGC_static)));
             if ( pg[i].count_info & PGC_extra )
                 extra_pages++;
         }
@@ -2425,8 +2424,7 @@ int assign_pages(
         page_set_owner(&pg[i], d);
         smp_wmb(); /* Domain pointer must be visible before updating refcnt. */
         pg[i].count_info =
-            (pg[i].count_info & (PGC_extra | PGC_static | PGC_need_scrub)) |
-            PGC_allocated | 1;
+            (pg[i].count_info & (PGC_extra | PGC_static)) | PGC_allocated | 1;
 
         page_list_add_tail(&pg[i], page_to_list(d, &pg[i]));
     }
diff --git a/xen/include/xen/mm.h b/xen/include/xen/mm.h
index fe32ef81cb..7561297a75 100644
--- a/xen/include/xen/mm.h
+++ b/xen/include/xen/mm.h
@@ -142,15 +142,6 @@ unsigned long avail_domheap_pages(void);
 unsigned long avail_node_heap_pages(unsigned int nodeid);
 #define alloc_domheap_page(d,f) (alloc_domheap_pages(d,0,f))
 #define free_domheap_page(p)  (free_domheap_pages(p,0))
-
-/* Free an allocation, and zero the pointer to it. */
-#define FREE_DOMHEAP_PAGES(p, o) do { \
-    void *_ptr_ = (p);                \
-    (p) = NULL;                       \
-    free_domheap_pages(_ptr_, o);     \
-} while ( false )
-#define FREE_DOMHEAP_PAGE(p) FREE_DOMHEAP_PAGES(p, 0)
-
 unsigned int online_page(mfn_t mfn, uint32_t *status);
 int offline_page(mfn_t mfn, int broken, uint32_t *status);
 int query_page_offline(mfn_t mfn, uint32_t *status);
diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
index ff831c7254..2a83b9dacf 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -636,11 +636,6 @@ struct domain
     } ioreq_server;
 #endif
 
-    /* Pointer to allocated domheap page that possibly needs scrubbing. */
-    struct page_info *pending_scrub;
-    unsigned int pending_scrub_order;
-    unsigned int pending_scrub_index;
-
     /* Holding CDF_* constant. Internal flags for domain creation. */
     unsigned int cdf;
 };
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Mar 26 10:44:53 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 26 Mar 2026 10:44:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1263706.1555583 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w5iCr-0007v0-1P; Thu, 26 Mar 2026 10:44:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1263706.1555583; Thu, 26 Mar 2026 10:44:53 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w5iCq-0007us-UV; Thu, 26 Mar 2026 10:44:52 +0000
Received: by outflank-mailman (input) for mailman id 1263706;
 Thu, 26 Mar 2026 10:44:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w5iCq-0007uj-Gg
 for xen-changelog@lists.xenproject.org; Thu, 26 Mar 2026 10:44:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w5iCq-00AYP0-2F
 for xen-changelog@lists.xenproject.org;
 Thu, 26 Mar 2026 10:44:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w5iCq-00GlL3-1T
 for xen-changelog@lists.xenproject.org;
 Thu, 26 Mar 2026 10:44:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=3eoZTqnYzreu+i71l54RiEg0Jp1rp29zraMAXLxfh8Y=; b=yVrp1SspPMhdhH8rdDI0b9sU42
	NFtYvWERCx96SwQ/NIXP2KZNfCTU3eIr5yrnf4trxuSPnPTrVCdvX02L2fUaIp7NBwRVzRSoTy46U
	/ymXPrdRSMxHtgZ/SWWmlEUaSH5lWPyQ9+jA2SSemQPk+JDWAMAmEj10nHE4erH3rQwE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] ARM: Drop ThumbEE support
Message-Id: <E1w5iCq-00GlL3-1T@xenbits.xenproject.org>
Date: Thu, 26 Mar 2026 10:44:52 +0000

commit 11e8f436d572f611059b46d83564fc03527d5ba5
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Mar 26 11:18:56 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 26 11:18:56 2026 +0100

    ARM: Drop ThumbEE support
    
    Hans reports that Xen no longer builds on Debian unstable/sid:
    
      Assembler messages:
      {standard input}:474: Error: unknown or missing system register name at operand 1 -- `msr TEECR32_EL1,x0'
      {standard input}:480: Error: unknown or missing system register name at operand 1 -- `msr TEEHBR32_EL1,x0'
      {standard input}:488: Error: unknown or missing system register name at operand 2 -- `mrs x0,TEECR32_EL1'
      {standard input}:494: Error: unknown or missing system register name at operand 2 -- `mrs x0,TEEHBR32_EL1'
      make[5]: *** [Rules.mk:249: arch/arm/domain.o] Error 1
    
    This turns out to be an intentional change in binutils.  ThumbEE was dropped
    ahead of ARM v8 (i.e. AArch64).
    
    Xen supports ARM v7+virt extensions so in principle we could #ifdef
    CONFIG_ARM_32 to keep it working.  However, there was apparently no use of
    ThumbEE outside of demo code, so simply drop it.
    
    On ThumbEE capable hardware, unconditionally trap ThumbEE instructions, and
    drop the context switching logic for TEE{CR,HBR}32.
    
    Reported-by: Hans van Kranenburg <hans@knorrie.org>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    
    xen/arm: Set ThumbEE as not present in PFR0
    
    Force ThumbEE support to not available in the version of the PFR0
    register value we present to guest.
    Xen does not support ThumbEE and will trap all access to ThumbEE
    registers so do not report it being supported if the hardware supports
    it.
    
    Fixes: 5bbe1fe413f9 ("ARM: Drop ThumbEE support")
    Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
    Tested-by: Luca Fancellu <luca.fancellu@arm.com>
    master commit: 5bbe1fe413f9d6a841b0bc70db024b1398391630
    master date: 2025-12-05 18:06:19 +0000
    master commit: 1ecb5946bdf8797d43ac6730c708bd105fdb0be4
    master date: 2026-01-05 10:33:03 +0000
---
 xen/arch/arm/cpufeature.c            |  3 +++
 xen/arch/arm/domain.c                | 12 ------------
 xen/arch/arm/include/asm/domain.h    |  1 -
 xen/arch/arm/include/asm/processor.h |  1 +
 xen/arch/arm/traps.c                 |  4 ++--
 5 files changed, 6 insertions(+), 15 deletions(-)

diff --git a/xen/arch/arm/cpufeature.c b/xen/arch/arm/cpufeature.c
index ef77473bf8..9f9335eea2 100644
--- a/xen/arch/arm/cpufeature.c
+++ b/xen/arch/arm/cpufeature.c
@@ -224,6 +224,9 @@ static int __init create_domain_cpuinfo(void)
 #endif
     domain_cpuinfo.pfr32.amu = 0;
 
+    /* Hide ThumbEE support */
+    domain_cpuinfo.pfr32.thumbee = 0;
+
     /* Hide RAS support as Xen does not support it */
 #ifdef CONFIG_ARM_64
     domain_cpuinfo.pfr64.ras = 0;
diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c
index 7cfcefd279..dafcc86103 100644
--- a/xen/arch/arm/domain.c
+++ b/xen/arch/arm/domain.c
@@ -111,12 +111,6 @@ static void ctxt_switch_from(struct vcpu *p)
     p->arch.cntkctl = READ_SYSREG(CNTKCTL_EL1);
     virt_timer_save(p);
 
-    if ( is_32bit_domain(p->domain) && cpu_has_thumbee )
-    {
-        p->arch.teecr = READ_SYSREG(TEECR32_EL1);
-        p->arch.teehbr = READ_SYSREG(TEEHBR32_EL1);
-    }
-
 #ifdef CONFIG_ARM_32
     p->arch.joscr = READ_CP32(JOSCR);
     p->arch.jmcr = READ_CP32(JMCR);
@@ -244,12 +238,6 @@ static void ctxt_switch_to(struct vcpu *n)
     WRITE_SYSREG(n->arch.tpidrro_el0, TPIDRRO_EL0);
     WRITE_SYSREG(n->arch.tpidr_el1, TPIDR_EL1);
 
-    if ( is_32bit_domain(n->domain) && cpu_has_thumbee )
-    {
-        WRITE_SYSREG(n->arch.teecr, TEECR32_EL1);
-        WRITE_SYSREG(n->arch.teehbr, TEEHBR32_EL1);
-    }
-
 #ifdef CONFIG_ARM_32
     WRITE_CP32(n->arch.joscr, JOSCR);
     WRITE_CP32(n->arch.jmcr, JMCR);
diff --git a/xen/arch/arm/include/asm/domain.h b/xen/arch/arm/include/asm/domain.h
index f1d72c6e48..48aa17b1b1 100644
--- a/xen/arch/arm/include/asm/domain.h
+++ b/xen/arch/arm/include/asm/domain.h
@@ -204,7 +204,6 @@ struct arch_vcpu
     register_t hcr_el2;
     register_t mdcr_el2;
 
-    uint32_t teecr, teehbr; /* ThumbEE, 32-bit guests only */
 #ifdef CONFIG_ARM_32
     /*
      * ARMv8 only supports a trivial implementation on Jazelle when in AArch32
diff --git a/xen/arch/arm/include/asm/processor.h b/xen/arch/arm/include/asm/processor.h
index 8e02410465..2ca2662c02 100644
--- a/xen/arch/arm/include/asm/processor.h
+++ b/xen/arch/arm/include/asm/processor.h
@@ -396,6 +396,7 @@
 
 /* HSTR Hyp. System Trap Register */
 #define HSTR_T(x)       ((_AC(1,U)<<(x)))       /* Trap Cp15 c<x> */
+#define HSTR_TTEE       (_AC(1,U)<<16)          /* Trap ThumbEE */
 
 /* HDCR Hyp. Debug Configuration Register */
 #define HDCR_TDRA       (_AC(1,U)<<11)          /* Trap Debug ROM access */
diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
index aac6c599f8..ebfd53f8b9 100644
--- a/xen/arch/arm/traps.c
+++ b/xen/arch/arm/traps.c
@@ -158,8 +158,8 @@ void init_traps(void)
     WRITE_SYSREG(HDCR_TDRA|HDCR_TDOSA|HDCR_TDA|HDCR_TPM|HDCR_TPMCR,
                  MDCR_EL2);
 
-    /* Trap CP15 c15 used for implementation defined registers */
-    WRITE_SYSREG(HSTR_T(15), HSTR_EL2);
+    /* Trap CP15 c15 used for implementation defined registers, and ThumbEE. */
+    WRITE_SYSREG(HSTR_T(15) | (cpu_has_thumbee ? HSTR_TTEE : 0), HSTR_EL2);
 
     WRITE_SYSREG(get_default_cptr_flags(), CPTR_EL2);
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Mar 26 10:45:03 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 26 Mar 2026 10:45:03 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1263707.1555586 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w5iD1-0007xC-2C; Thu, 26 Mar 2026 10:45:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1263707.1555586; Thu, 26 Mar 2026 10:45:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w5iD0-0007x4-Vr; Thu, 26 Mar 2026 10:45:02 +0000
Received: by outflank-mailman (input) for mailman id 1263707;
 Thu, 26 Mar 2026 10:45:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w5iD0-0007wt-JP
 for xen-changelog@lists.xenproject.org; Thu, 26 Mar 2026 10:45:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w5iD0-00AYPQ-2W
 for xen-changelog@lists.xenproject.org;
 Thu, 26 Mar 2026 10:45:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w5iD0-00GlNn-1j
 for xen-changelog@lists.xenproject.org;
 Thu, 26 Mar 2026 10:45:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=rWNV5tE6C2nZ0CZNRZw3dLp0/VYILIKHtu4lhfD1iZE=; b=33zXsdjo3rp8fqaa2ohD06M0TE
	zXzGt/ax2Fx2O6tPqsSeDDbhDSrh2pVJO+1D7b0xVYY92lWNbffUaR2u35bGZKzdfK3TrWBUuzkL/
	3hl9x2oRV0Im2I3l+4LVjx1GkbKsBZBPISKHeCSX+am4Cv5JiyZ8CfWZ7WrZxZDZghmc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] x86/vpmu: Expose up to 8 Intel event selectors in PV Dom0
Message-Id: <E1w5iD0-00GlNn-1j@xenbits.xenproject.org>
Date: Thu, 26 Mar 2026 10:45:02 +0000

commit 138abc1cc31216735e3798883d3ce94be8b53e3b
Author:     Teddy Astie <teddy.astie@vates.tech>
AuthorDate: Thu Mar 26 11:19:16 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 26 11:19:16 2026 +0100

    x86/vpmu: Expose up to 8 Intel event selectors in PV Dom0
    
    Most (if not all) Intel CPUs starting from Sandy Bridge have up to 8
    event selectors per core, which could be halved per hyperthread.
    
    However, current PV emulation logic doesn't support up to 8 event selector,
    leading to errors when trying to access them, hence, preventing Linux from
    driving the vPMU correctly.
    
    Make sure up to MSR_P6_EVNTSEL(7) is usable, which is the same upper bound as
    used in VMX code.
    
    The check if the event selector actually exist for the hardware is done in
    core2_vpmu_do_{rdmsr,wrmsr}, hence we're not allowing to access non-existent
    MSRs.
    
    Fixes: 27c554198666 ("x86/VPMU: add support for PMU register handling on PV guests")
    Signed-off-by: Teddy Astie <teddy.astie@vates.tech>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 4e9d9e7cc9a663d7c15118d5ebe344f7edad3ec9
    master date: 2026-03-24 12:04:46 +0100
---
 xen/arch/x86/pv/emul-priv-op.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/pv/emul-priv-op.c b/xen/arch/x86/pv/emul-priv-op.c
index 7753e44477..af805d5efd 100644
--- a/xen/arch/x86/pv/emul-priv-op.c
+++ b/xen/arch/x86/pv/emul-priv-op.c
@@ -972,7 +972,7 @@ static int cf_check read_msr(
         return X86EMUL_OKAY;
 
     case MSR_P6_PERFCTR(0) ... MSR_P6_PERFCTR(7):
-    case MSR_P6_EVNTSEL(0) ... MSR_P6_EVNTSEL(3):
+    case MSR_P6_EVNTSEL(0) ... MSR_P6_EVNTSEL(7):
     case MSR_CORE_PERF_FIXED_CTR0 ... MSR_CORE_PERF_FIXED_CTR2:
     case MSR_CORE_PERF_FIXED_CTR_CTRL ... MSR_CORE_PERF_GLOBAL_OVF_CTRL:
         if ( boot_cpu_data.x86_vendor == X86_VENDOR_INTEL )
@@ -1149,7 +1149,7 @@ static int cf_check write_msr(
         break;
 
     case MSR_P6_PERFCTR(0) ... MSR_P6_PERFCTR(7):
-    case MSR_P6_EVNTSEL(0) ... MSR_P6_EVNTSEL(3):
+    case MSR_P6_EVNTSEL(0) ... MSR_P6_EVNTSEL(7):
     case MSR_CORE_PERF_FIXED_CTR0 ... MSR_CORE_PERF_FIXED_CTR2:
     case MSR_CORE_PERF_FIXED_CTR_CTRL ... MSR_CORE_PERF_GLOBAL_OVF_CTRL:
         if ( boot_cpu_data.x86_vendor == X86_VENDOR_INTEL )
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Mar 26 10:45:13 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 26 Mar 2026 10:45:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1263709.1555590 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w5iDB-0007zH-3n; Thu, 26 Mar 2026 10:45:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1263709.1555590; Thu, 26 Mar 2026 10:45:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w5iDB-0007z9-0y; Thu, 26 Mar 2026 10:45:13 +0000
Received: by outflank-mailman (input) for mailman id 1263709;
 Thu, 26 Mar 2026 10:45:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w5iDA-0007z1-M0
 for xen-changelog@lists.xenproject.org; Thu, 26 Mar 2026 10:45:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w5iDA-00AYPv-2n
 for xen-changelog@lists.xenproject.org;
 Thu, 26 Mar 2026 10:45:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w5iDA-00GlRo-21
 for xen-changelog@lists.xenproject.org;
 Thu, 26 Mar 2026 10:45:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=17NlQ1WK257u6v+Pyx3Uc8dqV9WZoro2mHRBdBZ6eoE=; b=pgK74LvEZkzrvluGSUDDAprnhO
	qt4+M7jTrUy75uu3WOa3V+vDckhbcrjIbpsA7JLCLnXxcon/rLk70GUZFpc43zSjLvZxartRr2BaC
	ZrMPWZuPCK7v6bzGu5MtuddlxAYF9G7XZxp3R5FT1RLD1RqVJf9hUlCLm8HCyPaufoSs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] x86/S3: restore MCE (APs) init
Message-Id: <E1w5iDA-00GlRo-21@xenbits.xenproject.org>
Date: Thu, 26 Mar 2026 10:45:12 +0000

commit 0e0bcd9a02ecf01dbc9806fadcde2e109d7e0454
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 26 11:19:50 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 26 11:19:50 2026 +0100

    x86/S3: restore MCE (APs) init
    
    MCE init for APs was broken when CPU feature re-checking was added. At the
    same time make sure we don't bypass setup_doitm() (and whatever else may
    be added to the bottom of identify_cpu()).
    
    Fixes: bb502a8ca592 ("x86: check feature flags after resume")
    Reported-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Tested-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 5ebd4dd14118e4eb24f1d409a7ca3773f77e7e41
    master date: 2026-03-24 12:05:42 +0100
---
 xen/arch/x86/cpu/common.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c
index 94afb07e8c..b26e71231a 100644
--- a/xen/arch/x86/cpu/common.c
+++ b/xen/arch/x86/cpu/common.c
@@ -613,16 +613,20 @@ void identify_cpu(struct cpuinfo_x86 *c)
 			       smp_processor_id());
 	}
 
-	if (system_state == SYS_STATE_resume)
-		return;
+	if (system_state == SYS_STATE_resume) {
+		unsigned int cpu = smp_processor_id();
 
+		/* The BSP has this done right from enter_state(). */
+		if (cpu)
+			mcheck_init(&cpu_data[cpu], false);
+	}
 	/*
 	 * On SMP, boot_cpu_data holds the common feature set between
 	 * all CPUs; so make sure that we indicate which features are
 	 * common between the CPUs.  The first time this routine gets
 	 * executed, c == &boot_cpu_data.
 	 */
-	if ( c != &boot_cpu_data ) {
+	else if (c != &boot_cpu_data) {
 		/* AND the already accumulated flags with these */
 		for ( i = 0 ; i < NCAPINTS ; i++ )
 			boot_cpu_data.x86_capability[i] &= c->x86_capability[i];
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Mar 26 11:11:05 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 26 Mar 2026 11:11:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1263755.1555603 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w5icB-00041J-3I; Thu, 26 Mar 2026 11:11:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1263755.1555603; Thu, 26 Mar 2026 11:11:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w5icB-00041A-0U; Thu, 26 Mar 2026 11:11:03 +0000
Received: by outflank-mailman (input) for mailman id 1263755;
 Thu, 26 Mar 2026 11:11:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w5ic9-00040y-Qf
 for xen-changelog@lists.xenproject.org; Thu, 26 Mar 2026 11:11:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w5ic9-00AYwd-37
 for xen-changelog@lists.xenproject.org;
 Thu, 26 Mar 2026 11:11:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w5ic9-00GplM-2I
 for xen-changelog@lists.xenproject.org;
 Thu, 26 Mar 2026 11:11:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=zDZJYXfomjUIQWQmGEuoN7w6PhFpLneUiht07N8j0sY=; b=C1imidW5kTqPPjnOk4C6lxtZ1L
	+SW5okBDPA/IcZE3WpSwP4Ie5P0eAW04zY5UuEw9wvY7lMNw2qrb7mYgaI3IAlNW6rx8pC5MWHdg2
	reSBU1Hvbzc1xYiOaEdonASTbqOfPXb6Y4rHPW+vD3w3WtDSyg3M8L/h7BSgU8krmQ34=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] arinc653: overwrite entire .dom_handle[] for Dom0 slots
Message-Id: <E1w5ic9-00GplM-2I@xenbits.xenproject.org>
Date: Thu, 26 Mar 2026 11:11:01 +0000

commit 2a0ee29f5e6441b3c977ae8862842fd7c4da79d3
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 26 10:47:08 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 26 10:47:08 2026 +0100

    arinc653: overwrite entire .dom_handle[] for Dom0 slots
    
    When that code still lived in a653sched_init(), it was redundant with the
    earlier memset() / xzalloc(). Once moved, the full structure field needs
    setting, as dom_handle_cmp() uses memcmp() and arinc653_sched_set() may
    have clobbered entries. Rather than implying the handle to be all zero,
    copy the handle out of the domain structure.
    
    Fixes: 9f0c658baedc ("arinc: add cpu-pool support to scheduler")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Stewart Hildebrand <stewart@stew.dk>
---
 xen/common/sched/arinc653.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/xen/common/sched/arinc653.c b/xen/common/sched/arinc653.c
index 8a4f4259d8..bde15eb7e1 100644
--- a/xen/common/sched/arinc653.c
+++ b/xen/common/sched/arinc653.c
@@ -420,7 +420,9 @@ a653sched_alloc_udata(const struct scheduler *ops, struct sched_unit *unit,
 
         if ( entry < ARINC653_MAX_DOMAINS_PER_SCHEDULE )
         {
-            sched_priv->schedule[entry].dom_handle[0] = '\0';
+            memcpy(sched_priv->schedule[entry].dom_handle,
+                   unit->domain->handle,
+                   sizeof(sched_priv->schedule->dom_handle));
             sched_priv->schedule[entry].unit_id = unit->unit_id;
             sched_priv->schedule[entry].runtime = DEFAULT_TIMESLICE;
             sched_priv->schedule[entry].unit = unit;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Mar 26 11:11:13 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 26 Mar 2026 11:11:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1263757.1555607 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w5icL-00043F-4Z; Thu, 26 Mar 2026 11:11:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1263757.1555607; Thu, 26 Mar 2026 11:11:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w5icL-000437-1q; Thu, 26 Mar 2026 11:11:13 +0000
Received: by outflank-mailman (input) for mailman id 1263757;
 Thu, 26 Mar 2026 11:11:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w5icJ-00042z-Sd
 for xen-changelog@lists.xenproject.org; Thu, 26 Mar 2026 11:11:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w5icK-00AYx7-0D
 for xen-changelog@lists.xenproject.org;
 Thu, 26 Mar 2026 11:11:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w5icJ-00Gpm7-2b
 for xen-changelog@lists.xenproject.org;
 Thu, 26 Mar 2026 11:11:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=q3AcRpzWSTLBawpHNIV/fhEzC1kglrZnbjJmKvdg1zY=; b=pIuLEljo4w9lCVtZMjM8aPS/Uo
	fnJS7TiCzXU8FP+mwh4+BfOb17hqTd9njzffOQ2ftm0cROlO/GOuEA//6A8xKSJN6cGrZp7Zyw2Hg
	VXm04/GWoYsFsaPhiBiDMi/ARz6cU8vuxPQyV81UuSztH8QV1zUzTlOUce15JzKFMTVk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] arinc653: avoid array overrun
Message-Id: <E1w5icJ-00Gpm7-2b@xenbits.xenproject.org>
Date: Thu, 26 Mar 2026 11:11:11 +0000

commit 5a1121633f2ae97d96d3e66472cf373a6caa3d51
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 26 10:47:41 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 26 10:47:41 2026 +0100

    arinc653: avoid array overrun
    
    Incrementing ->sched_index between bounds check and array access may
    result in accessing one past the array when that is fully filled
    (->num_schedule_entries == ARINC653_MAX_DOMAINS_PER_SCHEDULE).
    
    Fixes: 22787f2e107c ("ARINC 653 scheduler")
    Reported-by: Kamil Frankowicz <kamil.frankowicz@cert.pl>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Stewart Hildebrand <stewart@stew.dk>
---
 xen/common/sched/arinc653.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/xen/common/sched/arinc653.c b/xen/common/sched/arinc653.c
index bde15eb7e1..c35bfbd04e 100644
--- a/xen/common/sched/arinc653.c
+++ b/xen/common/sched/arinc653.c
@@ -552,12 +552,9 @@ a653sched_do_schedule(
 
     /* Switch minor frame or find correct minor frame after a miss */
     while ( (now >= sched_priv->next_switch_time) &&
-        (sched_priv->sched_index < sched_priv->num_schedule_entries) )
-    {
-        sched_priv->sched_index++;
+            (++sched_priv->sched_index < sched_priv->num_schedule_entries) )
         sched_priv->next_switch_time +=
             sched_priv->schedule[sched_priv->sched_index].runtime;
-    }
 
     /*
      * If we exhausted the domains in the schedule and still have time left
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Mar 26 11:11:23 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 26 Mar 2026 11:11:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1263759.1555610 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w5icV-00045V-5k; Thu, 26 Mar 2026 11:11:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1263759.1555610; Thu, 26 Mar 2026 11:11:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w5icV-00045M-3E; Thu, 26 Mar 2026 11:11:23 +0000
Received: by outflank-mailman (input) for mailman id 1263759;
 Thu, 26 Mar 2026 11:11:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w5icT-00045G-VY
 for xen-changelog@lists.xenproject.org; Thu, 26 Mar 2026 11:11:21 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w5icU-00AYxB-0V
 for xen-changelog@lists.xenproject.org;
 Thu, 26 Mar 2026 11:11:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w5icT-00Gpmz-2v
 for xen-changelog@lists.xenproject.org;
 Thu, 26 Mar 2026 11:11:21 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=c086aT7S8lpo7M5TbT5Eo5shvjIvbWRvGGLIpzwFcjU=; b=ICCkPXsIlGwUZZz4Wo+ymNSTXi
	4+FLlzrECBD6Z9xthu432adStFVGrcQ1wrw3UO8eJNZBayqcp7VNcEQRsENg4OQxd05P9PMKqVHWG
	ugkHZ3rt9SJUIO+CNhCXn9P/jeb74PtE+6Yev+T29SDyGRYFOXvqD8538mozWiAwe91A=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] MAINTAINERS: update my email
Message-Id: <E1w5icT-00Gpmz-2v@xenbits.xenproject.org>
Date: Thu, 26 Mar 2026 11:11:21 +0000

commit 9f21a4dc1f3c19f4cecd5c6649c3ba3e73e74e41
Author:     Stewart Hildebrand <stewart.hildebrand@amd.com>
AuthorDate: Thu Mar 26 10:48:35 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 26 10:48:35 2026 +0100

    MAINTAINERS: update my email
    
    It's more convenient for me.
    
    Signed-off-by: Stewart Hildebrand <stewart.hildebrand@amd.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 MAINTAINERS | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index ccc25a0e55..1ac61da59a 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -248,7 +248,7 @@ F:	xen/common/argo.c
 
 ARINC653 SCHEDULER
 M:	Nathan Studer <nathan.studer@dornerworks.com>
-M:	Stewart Hildebrand <stewart@stew.dk>
+M:	Stewart Hildebrand <stewart.hildebrand@amd.com>
 S:	Supported
 L:	xen-devel@dornerworks.com
 F:	xen/common/sched/arinc653.c
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Mar 26 11:11:33 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 26 Mar 2026 11:11:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1263761.1555614 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w5icf-00047v-74; Thu, 26 Mar 2026 11:11:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1263761.1555614; Thu, 26 Mar 2026 11:11:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w5icf-00047n-4b; Thu, 26 Mar 2026 11:11:33 +0000
Received: by outflank-mailman (input) for mailman id 1263761;
 Thu, 26 Mar 2026 11:11:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w5ice-00047f-1p
 for xen-changelog@lists.xenproject.org; Thu, 26 Mar 2026 11:11:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w5ice-00AYxI-0l
 for xen-changelog@lists.xenproject.org;
 Thu, 26 Mar 2026 11:11:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w5icd-00Gpq5-3C
 for xen-changelog@lists.xenproject.org;
 Thu, 26 Mar 2026 11:11:31 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=4swmKn0QHzZ6mtUlXtL2X7HGi/K4hrCqHu5pB1pYgzw=; b=VFgl3+6v1Q542FF66c6hfZNlWN
	jKmUf06rFr8jN9BEewDLpD9A5xsqzypcrJjVYhh3cWdYZDJUAwSbVGwdOwe3ie55s2SejjN7fjhwP
	Ox19EZV8Ic0/gZsvG/3KX5a+ZwIB1hDO+BZDfBClmD1juGvF3DAppMeWMFBrOrYonR7c=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] arinc653: remove idle period in default schedule
Message-Id: <E1w5icd-00Gpq5-3C@xenbits.xenproject.org>
Date: Thu, 26 Mar 2026 11:11:31 +0000

commit 6d412c059982d821260055eaa43417b3245b2050
Author:     Stewart Hildebrand <stewart.hildebrand@amd.com>
AuthorDate: Thu Mar 26 10:49:11 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 26 10:49:11 2026 +0100

    arinc653: remove idle period in default schedule
    
    By initializing major_frame in a653sched_init(), an idle period was
    inadvertently introduced into the default schedule. Account for the
    initial value of major_frame when populating the default schedule.
    
    Fixes: f2927d8343ae ("xen/arinc653: fix delay in the start of major frame")
    Signed-off-by: Stewart Hildebrand <stewart.hildebrand@amd.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
---
 xen/common/sched/arinc653.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/common/sched/arinc653.c b/xen/common/sched/arinc653.c
index c35bfbd04e..19249f6464 100644
--- a/xen/common/sched/arinc653.c
+++ b/xen/common/sched/arinc653.c
@@ -427,7 +427,8 @@ a653sched_alloc_udata(const struct scheduler *ops, struct sched_unit *unit,
             sched_priv->schedule[entry].runtime = DEFAULT_TIMESLICE;
             sched_priv->schedule[entry].unit = unit;
 
-            sched_priv->major_frame += DEFAULT_TIMESLICE;
+            if ( entry )
+                sched_priv->major_frame += DEFAULT_TIMESLICE;
             ++sched_priv->num_schedule_entries;
         }
     }
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Mar 26 12:55:05 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 26 Mar 2026 12:55:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1264026.1555770 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w5kEp-0001VP-5g; Thu, 26 Mar 2026 12:55:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1264026.1555770; Thu, 26 Mar 2026 12:55:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w5kEp-0001VF-2i; Thu, 26 Mar 2026 12:55:03 +0000
Received: by outflank-mailman (input) for mailman id 1264026;
 Thu, 26 Mar 2026 12:55:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w5kEn-0001Uv-Jb
 for xen-changelog@lists.xenproject.org; Thu, 26 Mar 2026 12:55:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w5kEn-00Aaze-2M
 for xen-changelog@lists.xenproject.org;
 Thu, 26 Mar 2026 12:55:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w5kEn-00H3uU-1S
 for xen-changelog@lists.xenproject.org;
 Thu, 26 Mar 2026 12:55:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=N8FekO2vGqjFjZT0iU3GOA0OPKZDECA4rLSV2zfiVNc=; b=l/b2rKN3GqKiI8SuOB9onF9lUV
	/WuPZokW6w4gg2tROwiApGlTiNP8ogspqjhVjX3PDUONhvrKc6EA6aiOp1rlUPKbnPeUcqdBChebE
	5d8hlQ7lseRxoc2ipa+5jNh/0yj91p7UEyZ+rQdFCfb88yPYiCdiRPF5weYdJVZUA27g=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.21] Revert "xen/mm: allow deferred scrub of physmap populate allocated pages"
Message-Id: <E1w5kEn-00H3uU-1S@xenbits.xenproject.org>
Date: Thu, 26 Mar 2026 12:55:01 +0000

commit 73f4c7aab763cd1cfbcd778ad309fe2c2991cb43
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 26 11:03:11 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 26 11:04:14 2026 +0100

    Revert "xen/mm: allow deferred scrub of physmap populate allocated pages"
    
    This reverts commit 6228ea8acddadbd815f958fb1a867f54c01ddf78 and its
    prereq 15cd2b8f1bac5f4adf0f8303ae79298a612b53e1 ("xen/mm: remove
    aliasing of PGC_need_scrub over PGC_allocated"). Further fixes are
    needed before these can be considered for backporting.
---
 xen/arch/arm/include/asm/mm.h   |  10 ++--
 xen/arch/ppc/include/asm/mm.h   |  10 ++--
 xen/arch/riscv/include/asm/mm.h |  10 ++--
 xen/arch/x86/include/asm/mm.h   |  18 ++++---
 xen/common/domain.c             |  23 ---------
 xen/common/memory.c             | 105 +---------------------------------------
 xen/common/page_alloc.c         |   4 +-
 xen/include/xen/mm.h            |  10 ----
 xen/include/xen/sched.h         |   5 --
 9 files changed, 35 insertions(+), 160 deletions(-)

diff --git a/xen/arch/arm/include/asm/mm.h b/xen/arch/arm/include/asm/mm.h
index ee1f60c59e..7a93dad2ed 100644
--- a/xen/arch/arm/include/asm/mm.h
+++ b/xen/arch/arm/include/asm/mm.h
@@ -144,9 +144,6 @@ struct page_info
 #define _PGC_colored      PG_shift(4)
 #define PGC_colored       PG_mask(1, 4)
 #endif
-/* Page needs to be scrubbed. */
-#define _PGC_need_scrub   PG_shift(5)
-#define PGC_need_scrub    PG_mask(1, 5)
 /* ... */
 /* Page is broken? */
 #define _PGC_broken       PG_shift(7)
@@ -166,6 +163,13 @@ struct page_info
 #define PGC_count_width   PG_shift(10)
 #define PGC_count_mask    ((1UL<<PGC_count_width)-1)
 
+/*
+ * Page needs to be scrubbed. Since this bit can only be set on a page that is
+ * free (i.e. in PGC_state_free) we can reuse PGC_allocated bit.
+ */
+#define _PGC_need_scrub   _PGC_allocated
+#define PGC_need_scrub    PGC_allocated
+
 #if defined(CONFIG_ARM_64) || defined(CONFIG_MPU)
 #define is_xen_heap_page(page) ((page)->count_info & PGC_xen_heap)
 #define is_xen_heap_mfn(mfn) \
diff --git a/xen/arch/ppc/include/asm/mm.h b/xen/arch/ppc/include/asm/mm.h
index 82a9551082..a33eeec43b 100644
--- a/xen/arch/ppc/include/asm/mm.h
+++ b/xen/arch/ppc/include/asm/mm.h
@@ -57,9 +57,6 @@ static inline struct page_info *virt_to_page(const void *v)
 /* Page is Xen heap? */
 #define _PGC_xen_heap     PG_shift(2)
 #define PGC_xen_heap      PG_mask(1, 2)
-/* Page needs to be scrubbed. */
-#define _PGC_need_scrub   PG_shift(3)
-#define PGC_need_scrub    PG_mask(1, 3)
 /* Page is broken? */
 #define _PGC_broken       PG_shift(7)
 #define PGC_broken        PG_mask(1, 7)
@@ -78,6 +75,13 @@ static inline struct page_info *virt_to_page(const void *v)
 #define PGC_count_width   PG_shift(10)
 #define PGC_count_mask    ((1UL<<PGC_count_width)-1)
 
+/*
+ * Page needs to be scrubbed. Since this bit can only be set on a page that is
+ * free (i.e. in PGC_state_free) we can reuse PGC_allocated bit.
+ */
+#define _PGC_need_scrub   _PGC_allocated
+#define PGC_need_scrub    PGC_allocated
+
 #define is_xen_heap_page(page) ((page)->count_info & PGC_xen_heap)
 #define is_xen_heap_mfn(mfn) \
     (mfn_valid(mfn) && is_xen_heap_page(mfn_to_page(mfn)))
diff --git a/xen/arch/riscv/include/asm/mm.h b/xen/arch/riscv/include/asm/mm.h
index 4c37d87508..9283616c02 100644
--- a/xen/arch/riscv/include/asm/mm.h
+++ b/xen/arch/riscv/include/asm/mm.h
@@ -247,15 +247,19 @@ static inline bool arch_mfns_in_directmap(unsigned long mfn, unsigned long nr)
 #define PGT_count_width   PG_shift(2)
 #define PGT_count_mask    ((1UL << PGT_count_width) - 1)
 
+/*
+ * Page needs to be scrubbed. Since this bit can only be set on a page that is
+ * free (i.e. in PGC_state_free) we can reuse PGC_allocated bit.
+ */
+#define _PGC_need_scrub   _PGC_allocated
+#define PGC_need_scrub    PGC_allocated
+
 /* Cleared when the owning guest 'frees' this page. */
 #define _PGC_allocated    PG_shift(1)
 #define PGC_allocated     PG_mask(1, 1)
 /* Page is Xen heap? */
 #define _PGC_xen_heap     PG_shift(2)
 #define PGC_xen_heap      PG_mask(1, 2)
-/* Page needs to be scrubbed. */
-#define _PGC_need_scrub   PG_shift(4)
-#define PGC_need_scrub    PG_mask(1, 4)
 /* Page is broken? */
 #define _PGC_broken       PG_shift(7)
 #define PGC_broken        PG_mask(1, 7)
diff --git a/xen/arch/x86/include/asm/mm.h b/xen/arch/x86/include/asm/mm.h
index d35086e31e..08153e6d6f 100644
--- a/xen/arch/x86/include/asm/mm.h
+++ b/xen/arch/x86/include/asm/mm.h
@@ -83,25 +83,29 @@
 #define PGC_state_offlined  PG_mask(2, 6)
 #define PGC_state_free      PG_mask(3, 6)
 #define page_state_is(pg, st) (((pg)->count_info&PGC_state) == PGC_state_##st)
-/* Page needs to be scrubbed. */
-#define _PGC_need_scrub   PG_shift(7)
-#define PGC_need_scrub    PG_mask(1, 7)
 #ifdef CONFIG_SHADOW_PAGING
  /* Set when a page table page has been shadowed. */
-#define _PGC_shadowed_pt  PG_shift(8)
-#define PGC_shadowed_pt   PG_mask(1, 8)
+#define _PGC_shadowed_pt  PG_shift(7)
+#define PGC_shadowed_pt   PG_mask(1, 7)
 #else
 #define PGC_shadowed_pt   0
 #endif
 
 /* Count of references to this frame. */
 #if PGC_shadowed_pt
-#define PGC_count_width   PG_shift(8)
-#else
 #define PGC_count_width   PG_shift(7)
+#else
+#define PGC_count_width   PG_shift(6)
 #endif
 #define PGC_count_mask    ((1UL<<PGC_count_width)-1)
 
+/*
+ * Page needs to be scrubbed. Since this bit can only be set on a page that is
+ * free (i.e. in PGC_state_free) we can reuse PGC_allocated bit.
+ */
+#define _PGC_need_scrub   _PGC_allocated
+#define PGC_need_scrub    PGC_allocated
+
 #ifndef CONFIG_BIGMEM
 /*
  * This definition is solely for the use in struct page_info (and
diff --git a/xen/common/domain.c b/xen/common/domain.c
index 75c7da16e2..88db82d187 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -582,18 +582,6 @@ static int __init cf_check parse_dom0_param(const char *s)
 }
 custom_param("dom0", parse_dom0_param);
 
-static void domain_pending_scrub_free(struct domain *d)
-{
-    rspin_lock(&d->page_alloc_lock);
-    if ( d->pending_scrub )
-    {
-        FREE_DOMHEAP_PAGES(d->pending_scrub, d->pending_scrub_order);
-        d->pending_scrub_order = 0;
-        d->pending_scrub_index = 0;
-    }
-    rspin_unlock(&d->page_alloc_lock);
-}
-
 /*
  * Release resources held by a domain.  There may or may not be live
  * references to the domain, and it may or may not be fully constructed.
@@ -655,7 +643,6 @@ static int domain_teardown(struct domain *d)
 
         /* Trivial teardown, not long-running enough to need a preemption check. */
         domain_llc_coloring_free(d);
-        domain_pending_scrub_free(d);
 
     PROGRESS(gnttab_mappings):
         rc = gnttab_release_mappings(d);
@@ -699,7 +686,6 @@ static void _domain_destroy(struct domain *d)
 {
     BUG_ON(!d->is_dying);
     BUG_ON(atomic_read(&d->refcnt) != DOMAIN_DESTROYED);
-    ASSERT(!d->pending_scrub);
 
     xfree(d->pbuf);
 
@@ -1665,15 +1651,6 @@ int domain_unpause_by_systemcontroller(struct domain *d)
      */
     if ( new == 0 && !d->creation_finished )
     {
-        if ( d->pending_scrub )
-        {
-            printk(XENLOG_ERR
-                   "%pd: cannot be started with pending unscrubbed pages, destroying\n",
-                   d);
-            domain_crash(d);
-            domain_pending_scrub_free(d);
-            return -EBUSY;
-        }
         d->creation_finished = true;
         arch_domain_creation_finished(d);
     }
diff --git a/xen/common/memory.c b/xen/common/memory.c
index 9240a6005e..10becf7c1f 100644
--- a/xen/common/memory.c
+++ b/xen/common/memory.c
@@ -159,73 +159,6 @@ static void increase_reservation(struct memop_args *a)
     a->nr_done = i;
 }
 
-/*
- * Temporary storage for a domain assigned page that's not been fully scrubbed.
- * Stored pages must be domheap ones.
- *
- * The stashed page can be freed at any time by Xen, the caller must pass the
- * order and NUMA node requirement to the fetch function to ensure the
- * currently stashed page matches it's requirements.
- */
-static void stash_allocation(struct domain *d, struct page_info *page,
-                             unsigned int order, unsigned int scrub_index)
-{
-    rspin_lock(&d->page_alloc_lock);
-
-    /*
-     * Drop the passed page in preference for the already stashed one.  This
-     * interface is designed to be used for single-threaded domain creation.
-     */
-    if ( d->pending_scrub || d->is_dying )
-        free_domheap_pages(page, order);
-    else
-    {
-        d->pending_scrub_index = scrub_index;
-        d->pending_scrub_order = order;
-        d->pending_scrub = page;
-    }
-
-    rspin_unlock(&d->page_alloc_lock);
-}
-
-static struct page_info *get_stashed_allocation(struct domain *d,
-                                                unsigned int order,
-                                                nodeid_t node,
-                                                unsigned int *scrub_index)
-{
-    struct page_info *page = NULL;
-
-    rspin_lock(&d->page_alloc_lock);
-
-    /*
-     * If there's a pending page to scrub check if it satisfies the current
-     * request.  If it doesn't free it and return NULL.
-     */
-    if ( d->pending_scrub )
-    {
-        if ( d->pending_scrub_order == order &&
-             (node == NUMA_NO_NODE || node == page_to_nid(d->pending_scrub)) )
-        {
-            page = d->pending_scrub;
-            *scrub_index = d->pending_scrub_index;
-        }
-        else
-            free_domheap_pages(d->pending_scrub, d->pending_scrub_order);
-
-        /*
-         * The caller now owns the page or it has been freed, clear stashed
-         * information.  Prevent concurrent usages of get_stashed_allocation()
-         * from returning the same page to different contexts.
-         */
-        d->pending_scrub_index = 0;
-        d->pending_scrub_order = 0;
-        d->pending_scrub = NULL;
-    }
-
-    rspin_unlock(&d->page_alloc_lock);
-    return page;
-}
-
 static void populate_physmap(struct memop_args *a)
 {
     struct page_info *page;
@@ -342,19 +275,7 @@ static void populate_physmap(struct memop_args *a)
             }
             else
             {
-                unsigned int scrub_start = 0;
-                unsigned int memflags =
-                    a->memflags | (d->creation_finished ? 0
-                                                        : MEMF_no_scrub);
-                nodeid_t node =
-                    (a->memflags & MEMF_exact_node) ? MEMF_get_node(a->memflags)
-                                                    : NUMA_NO_NODE;
-
-                page = get_stashed_allocation(d, a->extent_order, node,
-                                              &scrub_start);
-
-                if ( !page )
-                    page = alloc_domheap_pages(d, a->extent_order, memflags);
+                page = alloc_domheap_pages(d, a->extent_order, a->memflags);
 
                 if ( unlikely(!page) )
                 {
@@ -365,30 +286,6 @@ static void populate_physmap(struct memop_args *a)
                     goto out;
                 }
 
-                if ( memflags & MEMF_no_scrub )
-                {
-                    unsigned int dirty_cnt = 0;
-
-                    /* Check if there's anything to scrub. */
-                    for ( j = scrub_start; j < (1U << a->extent_order); j++ )
-                    {
-                        if ( !test_and_clear_bit(_PGC_need_scrub,
-                                                 &page[j].count_info) )
-                            continue;
-
-                        scrub_one_page(&page[j], true);
-
-                        if ( (j + 1) != (1U << a->extent_order) &&
-                             !(++dirty_cnt & 0xff) &&
-                             hypercall_preempt_check() )
-                        {
-                            a->preempted = 1;
-                            stash_allocation(d, page, a->extent_order, j + 1);
-                            goto out;
-                        }
-                    }
-                }
-
                 if ( unlikely(a->memflags & MEMF_no_tlbflush) )
                 {
                     for ( j = 0; j < (1U << a->extent_order); j++ )
diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
index 588b5b99cb..2efc11ce09 100644
--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -170,7 +170,7 @@
 /*
  * Flags that are preserved in assign_pages() (and only there)
  */
-#define PGC_preserved (PGC_extra | PGC_static | PGC_colored | PGC_need_scrub)
+#define PGC_preserved (PGC_extra | PGC_static | PGC_colored)
 
 #ifndef PGT_TYPE_INFO_INITIALIZER
 #define PGT_TYPE_INFO_INITIALIZER 0
@@ -792,7 +792,7 @@ static void page_list_add_scrub(struct page_info *pg, unsigned int node,
 # define scrub_page_cold clear_page_cold
 #endif
 
-void scrub_one_page(const struct page_info *pg, bool cold)
+static void scrub_one_page(const struct page_info *pg, bool cold)
 {
     void *ptr;
 
diff --git a/xen/include/xen/mm.h b/xen/include/xen/mm.h
index 49c34248f9..b968f47b87 100644
--- a/xen/include/xen/mm.h
+++ b/xen/include/xen/mm.h
@@ -145,16 +145,6 @@ unsigned long avail_node_heap_pages(unsigned int nodeid);
 #define alloc_domheap_page(d,f) (alloc_domheap_pages(d,0,f))
 #define free_domheap_page(p)  (free_domheap_pages(p,0))
 
-/* Free an allocation, and zero the pointer to it. */
-#define FREE_DOMHEAP_PAGES(p, o) do { \
-    void *_ptr_ = (p);                \
-    (p) = NULL;                       \
-    free_domheap_pages(_ptr_, o);     \
-} while ( false )
-#define FREE_DOMHEAP_PAGE(p) FREE_DOMHEAP_PAGES(p, 0)
-
-void scrub_one_page(const struct page_info *pg, bool cold);
-
 int online_page(mfn_t mfn, uint32_t *status);
 int offline_page(mfn_t mfn, int broken, uint32_t *status);
 int query_page_offline(mfn_t mfn, uint32_t *status);
diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
index c89b930cbd..610f3d4c0d 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -662,11 +662,6 @@ struct domain
         /* Permission to take ownership of the physical console input. */
         bool input_allowed;
     } console;
-
-    /* Pointer to allocated domheap page that possibly needs scrubbing. */
-    struct page_info *pending_scrub;
-    unsigned int pending_scrub_order;
-    unsigned int pending_scrub_index;
 } __aligned(PAGE_SIZE);
 
 static inline struct page_list_head *page_to_list(
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.21


From xen-changelog-bounces@lists.xenproject.org Thu Mar 26 12:55:13 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 26 Mar 2026 12:55:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1264028.1555774 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w5kEz-0001Y1-6o; Thu, 26 Mar 2026 12:55:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1264028.1555774; Thu, 26 Mar 2026 12:55:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w5kEz-0001Xt-48; Thu, 26 Mar 2026 12:55:13 +0000
Received: by outflank-mailman (input) for mailman id 1264028;
 Thu, 26 Mar 2026 12:55:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w5kEx-0001Xg-Kr
 for xen-changelog@lists.xenproject.org; Thu, 26 Mar 2026 12:55:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w5kEx-00Ab0J-2f
 for xen-changelog@lists.xenproject.org;
 Thu, 26 Mar 2026 12:55:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w5kEx-00H3v0-1s
 for xen-changelog@lists.xenproject.org;
 Thu, 26 Mar 2026 12:55:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=+6RuhcM3e+q5OZL9fPHxLOBZ/xzeYjEtzf0b6TfwG0o=; b=DPkdJTji/SA+mTkSlJKjrLBMi/
	07U2pQDj0Uqb0ZB1eMMqUJXwSoQTOUshwaCYdEgFKpLFaLOihpVSzdg03dvE2CVvG+E6vX2lIZ7X+
	+pjTGdbhsyMYNutBOKdQ0uSBUJkUyOGoisgWyIVCAy9EcWaxvQUoPSRDbNb8puWeuWDo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.21] ARM: Drop ThumbEE support
Message-Id: <E1w5kEx-00H3v0-1s@xenbits.xenproject.org>
Date: Thu, 26 Mar 2026 12:55:11 +0000

commit a2eea8fd9e64afb733874c0a5634828570bb1061
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Mar 26 11:08:04 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 26 11:08:04 2026 +0100

    ARM: Drop ThumbEE support
    
    Hans reports that Xen no longer builds on Debian unstable/sid:
    
      Assembler messages:
      {standard input}:474: Error: unknown or missing system register name at operand 1 -- `msr TEECR32_EL1,x0'
      {standard input}:480: Error: unknown or missing system register name at operand 1 -- `msr TEEHBR32_EL1,x0'
      {standard input}:488: Error: unknown or missing system register name at operand 2 -- `mrs x0,TEECR32_EL1'
      {standard input}:494: Error: unknown or missing system register name at operand 2 -- `mrs x0,TEEHBR32_EL1'
      make[5]: *** [Rules.mk:249: arch/arm/domain.o] Error 1
    
    This turns out to be an intentional change in binutils.  ThumbEE was dropped
    ahead of ARM v8 (i.e. AArch64).
    
    Xen supports ARM v7+virt extensions so in principle we could #ifdef
    CONFIG_ARM_32 to keep it working.  However, there was apparently no use of
    ThumbEE outside of demo code, so simply drop it.
    
    On ThumbEE capable hardware, unconditionally trap ThumbEE instructions, and
    drop the context switching logic for TEE{CR,HBR}32.
    
    Reported-by: Hans van Kranenburg <hans@knorrie.org>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    
    xen/arm: Set ThumbEE as not present in PFR0
    
    Force ThumbEE support to not available in the version of the PFR0
    register value we present to guest.
    Xen does not support ThumbEE and will trap all access to ThumbEE
    registers so do not report it being supported if the hardware supports
    it.
    
    Fixes: 5bbe1fe413f9 ("ARM: Drop ThumbEE support")
    Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
    Tested-by: Luca Fancellu <luca.fancellu@arm.com>
    master commit: 5bbe1fe413f9d6a841b0bc70db024b1398391630
    master date: 2025-12-05 18:06:19 +0000
    master commit: 1ecb5946bdf8797d43ac6730c708bd105fdb0be4
    master date: 2026-01-05 10:33:03 +0000
---
 xen/arch/arm/cpufeature.c            |  3 +++
 xen/arch/arm/domain.c                | 12 ------------
 xen/arch/arm/include/asm/domain.h    |  1 -
 xen/arch/arm/include/asm/processor.h |  1 +
 xen/arch/arm/traps.c                 |  4 ++--
 5 files changed, 6 insertions(+), 15 deletions(-)

diff --git a/xen/arch/arm/cpufeature.c b/xen/arch/arm/cpufeature.c
index 1a80738571..94d14fb6a9 100644
--- a/xen/arch/arm/cpufeature.c
+++ b/xen/arch/arm/cpufeature.c
@@ -227,6 +227,9 @@ static int __init create_domain_cpuinfo(void)
 #endif
     domain_cpuinfo.pfr32.amu = 0;
 
+    /* Hide ThumbEE support */
+    domain_cpuinfo.pfr32.thumbee = 0;
+
     /* Hide RAS support as Xen does not support it */
 #ifdef CONFIG_ARM_64
     domain_cpuinfo.pfr64.ras = 0;
diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c
index e36719bce4..38d7768de9 100644
--- a/xen/arch/arm/domain.c
+++ b/xen/arch/arm/domain.c
@@ -111,12 +111,6 @@ static void ctxt_switch_from(struct vcpu *p)
     p->arch.cntkctl = READ_SYSREG(CNTKCTL_EL1);
     virt_timer_save(p);
 
-    if ( is_32bit_domain(p->domain) && cpu_has_thumbee )
-    {
-        p->arch.teecr = READ_SYSREG(TEECR32_EL1);
-        p->arch.teehbr = READ_SYSREG(TEEHBR32_EL1);
-    }
-
 #ifdef CONFIG_ARM_32
     p->arch.joscr = READ_CP32(JOSCR);
     p->arch.jmcr = READ_CP32(JMCR);
@@ -244,12 +238,6 @@ static void ctxt_switch_to(struct vcpu *n)
     WRITE_SYSREG(n->arch.tpidrro_el0, TPIDRRO_EL0);
     WRITE_SYSREG(n->arch.tpidr_el1, TPIDR_EL1);
 
-    if ( is_32bit_domain(n->domain) && cpu_has_thumbee )
-    {
-        WRITE_SYSREG(n->arch.teecr, TEECR32_EL1);
-        WRITE_SYSREG(n->arch.teehbr, TEEHBR32_EL1);
-    }
-
 #ifdef CONFIG_ARM_32
     WRITE_CP32(n->arch.joscr, JOSCR);
     WRITE_CP32(n->arch.jmcr, JMCR);
diff --git a/xen/arch/arm/include/asm/domain.h b/xen/arch/arm/include/asm/domain.h
index af3e168374..758ad807e4 100644
--- a/xen/arch/arm/include/asm/domain.h
+++ b/xen/arch/arm/include/asm/domain.h
@@ -211,7 +211,6 @@ struct arch_vcpu
     register_t hcr_el2;
     register_t mdcr_el2;
 
-    uint32_t teecr, teehbr; /* ThumbEE, 32-bit guests only */
 #ifdef CONFIG_ARM_32
     /*
      * ARMv8 only supports a trivial implementation on Jazelle when in AArch32
diff --git a/xen/arch/arm/include/asm/processor.h b/xen/arch/arm/include/asm/processor.h
index 92c8bc1a31..ec23fd098b 100644
--- a/xen/arch/arm/include/asm/processor.h
+++ b/xen/arch/arm/include/asm/processor.h
@@ -411,6 +411,7 @@
 
 /* HSTR Hyp. System Trap Register */
 #define HSTR_T(x)       ((_AC(1,U)<<(x)))       /* Trap Cp15 c<x> */
+#define HSTR_TTEE       (_AC(1,U)<<16)          /* Trap ThumbEE */
 
 /* HDCR Hyp. Debug Configuration Register */
 #define HDCR_TDRA       (_AC(1,U)<<11)          /* Trap Debug ROM access */
diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
index 2bc3e1df04..040c0f2e0d 100644
--- a/xen/arch/arm/traps.c
+++ b/xen/arch/arm/traps.c
@@ -158,8 +158,8 @@ void init_traps(void)
     WRITE_SYSREG(HDCR_TDRA|HDCR_TDOSA|HDCR_TDA|HDCR_TPM|HDCR_TPMCR,
                  MDCR_EL2);
 
-    /* Trap CP15 c15 used for implementation defined registers */
-    WRITE_SYSREG(HSTR_T(15), HSTR_EL2);
+    /* Trap CP15 c15 used for implementation defined registers, and ThumbEE. */
+    WRITE_SYSREG(HSTR_T(15) | (cpu_has_thumbee ? HSTR_TTEE : 0), HSTR_EL2);
 
     WRITE_SYSREG(get_default_cptr_flags(), CPTR_EL2);
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.21


From xen-changelog-bounces@lists.xenproject.org Thu Mar 26 12:55:23 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 26 Mar 2026 12:55:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1264029.1555778 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w5kF9-0001aL-8H; Thu, 26 Mar 2026 12:55:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1264029.1555778; Thu, 26 Mar 2026 12:55:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w5kF9-0001aD-5V; Thu, 26 Mar 2026 12:55:23 +0000
Received: by outflank-mailman (input) for mailman id 1264029;
 Thu, 26 Mar 2026 12:55:21 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w5kF7-0001a5-O0
 for xen-changelog@lists.xenproject.org; Thu, 26 Mar 2026 12:55:21 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w5kF7-00Ab0N-2z
 for xen-changelog@lists.xenproject.org;
 Thu, 26 Mar 2026 12:55:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w5kF7-00H3vn-2A
 for xen-changelog@lists.xenproject.org;
 Thu, 26 Mar 2026 12:55:21 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=dGflJl7RMBO2+jegz/0EVqtPsNDr6NzQ0Hhbx0vmnPc=; b=4NKvi3HGWfnHJYDDj9+UyGWk1t
	T4G5+erMnEvgyVK10BcKmSSnT6zdFbmGmKfzvM62rM7JAzd0LayTc4N51dDH3se9lENfogmLbs6Ym
	TcvYkfrrzQ/6vjyzTj4IdPCDeYJBCfkhZe96Ka3N1hAux0X6lPyTh40eMyQ9jrzYYsWk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.21] x86/vpmu: Expose up to 8 Intel event selectors in PV Dom0
Message-Id: <E1w5kF7-00H3vn-2A@xenbits.xenproject.org>
Date: Thu, 26 Mar 2026 12:55:21 +0000

commit 3960613c1e3b56c4a5abd3ae1e656642ea8ef72c
Author:     Teddy Astie <teddy.astie@vates.tech>
AuthorDate: Thu Mar 26 11:08:40 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 26 11:08:40 2026 +0100

    x86/vpmu: Expose up to 8 Intel event selectors in PV Dom0
    
    Most (if not all) Intel CPUs starting from Sandy Bridge have up to 8
    event selectors per core, which could be halved per hyperthread.
    
    However, current PV emulation logic doesn't support up to 8 event selector,
    leading to errors when trying to access them, hence, preventing Linux from
    driving the vPMU correctly.
    
    Make sure up to MSR_P6_EVNTSEL(7) is usable, which is the same upper bound as
    used in VMX code.
    
    The check if the event selector actually exist for the hardware is done in
    core2_vpmu_do_{rdmsr,wrmsr}, hence we're not allowing to access non-existent
    MSRs.
    
    Fixes: 27c554198666 ("x86/VPMU: add support for PMU register handling on PV guests")
    Signed-off-by: Teddy Astie <teddy.astie@vates.tech>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 4e9d9e7cc9a663d7c15118d5ebe344f7edad3ec9
    master date: 2026-03-24 12:04:46 +0100
---
 xen/arch/x86/pv/emul-priv-op.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/pv/emul-priv-op.c b/xen/arch/x86/pv/emul-priv-op.c
index 548ad16cb8..b021c8a657 100644
--- a/xen/arch/x86/pv/emul-priv-op.c
+++ b/xen/arch/x86/pv/emul-priv-op.c
@@ -976,7 +976,7 @@ static int cf_check read_msr(
         return X86EMUL_OKAY;
 
     case MSR_P6_PERFCTR(0) ... MSR_P6_PERFCTR(7):
-    case MSR_P6_EVNTSEL(0) ... MSR_P6_EVNTSEL(3):
+    case MSR_P6_EVNTSEL(0) ... MSR_P6_EVNTSEL(7):
     case MSR_CORE_PERF_FIXED_CTR0 ... MSR_CORE_PERF_FIXED_CTR2:
     case MSR_CORE_PERF_FIXED_CTR_CTRL ... MSR_CORE_PERF_GLOBAL_OVF_CTRL:
         if ( boot_cpu_data.x86_vendor == X86_VENDOR_INTEL )
@@ -1158,7 +1158,7 @@ static int cf_check write_msr(
         break;
 
     case MSR_P6_PERFCTR(0) ... MSR_P6_PERFCTR(7):
-    case MSR_P6_EVNTSEL(0) ... MSR_P6_EVNTSEL(3):
+    case MSR_P6_EVNTSEL(0) ... MSR_P6_EVNTSEL(7):
     case MSR_CORE_PERF_FIXED_CTR0 ... MSR_CORE_PERF_FIXED_CTR2:
     case MSR_CORE_PERF_FIXED_CTR_CTRL ... MSR_CORE_PERF_GLOBAL_OVF_CTRL:
         if ( boot_cpu_data.x86_vendor == X86_VENDOR_INTEL )
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.21


From xen-changelog-bounces@lists.xenproject.org Thu Mar 26 12:55:32 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 26 Mar 2026 12:55:32 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1264032.1555782 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w5kFI-0001d4-A0; Thu, 26 Mar 2026 12:55:32 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1264032.1555782; Thu, 26 Mar 2026 12:55:32 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w5kFI-0001cw-7K; Thu, 26 Mar 2026 12:55:32 +0000
Received: by outflank-mailman (input) for mailman id 1264032;
 Thu, 26 Mar 2026 12:55:31 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w5kFH-0001cq-RJ
 for xen-changelog@lists.xenproject.org; Thu, 26 Mar 2026 12:55:31 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w5kFI-00Ab0R-05
 for xen-changelog@lists.xenproject.org;
 Thu, 26 Mar 2026 12:55:31 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w5kFH-00H3wX-2U
 for xen-changelog@lists.xenproject.org;
 Thu, 26 Mar 2026 12:55:31 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=uLEA4CVG0g4D3Qx9uE0Pc6uUTRVjsN0SzlMfPibqoaQ=; b=C+lbsEU5tQhH8Kz6QCb1snZjsB
	kCwdCmtbaujLx4D6eHrdlS+VqThFk7FBgbC/B5DRhz9hOSNZ9pDUrLbrhIS9Tu/ujMOziKpzv9KVu
	ehPVgCnzH5f/RltDnCqJKSfj1f0M8CdhMgTK6U1lDNtcEjDaCwBQswNteDDiJv3rxIBI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.21] x86/S3: restore MCE (APs) init
Message-Id: <E1w5kFH-00H3wX-2U@xenbits.xenproject.org>
Date: Thu, 26 Mar 2026 12:55:31 +0000

commit 1ea9c24d0f2caa1d171b1c77cfa534be7848b97e
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 26 11:08:57 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 26 11:08:57 2026 +0100

    x86/S3: restore MCE (APs) init
    
    MCE init for APs was broken when CPU feature re-checking was added. At the
    same time make sure we don't bypass setup_doitm() (and whatever else may
    be added to the bottom of identify_cpu()).
    
    Fixes: bb502a8ca592 ("x86: check feature flags after resume")
    Reported-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Tested-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 5ebd4dd14118e4eb24f1d409a7ca3773f77e7e41
    master date: 2026-03-24 12:05:42 +0100
---
 xen/arch/x86/cpu/common.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c
index 92c709ea69..574fd0be20 100644
--- a/xen/arch/x86/cpu/common.c
+++ b/xen/arch/x86/cpu/common.c
@@ -659,16 +659,20 @@ void identify_cpu(struct cpuinfo_x86 *c)
 			       smp_processor_id());
 	}
 
-	if (system_state == SYS_STATE_resume)
-		return;
+	if (system_state == SYS_STATE_resume) {
+		unsigned int cpu = smp_processor_id();
 
+		/* The BSP has this done right from enter_state(). */
+		if (cpu)
+			mcheck_init(&cpu_data[cpu], false);
+	}
 	/*
 	 * On SMP, boot_cpu_data holds the common feature set between
 	 * all CPUs; so make sure that we indicate which features are
 	 * common between the CPUs.  The first time this routine gets
 	 * executed, c == &boot_cpu_data.
 	 */
-	if ( c != &boot_cpu_data ) {
+	else if (c != &boot_cpu_data) {
 		/* AND the already accumulated flags with these */
 		for ( i = 0 ; i < NCAPINTS ; i++ )
 			boot_cpu_data.x86_capability[i] &= c->x86_capability[i];
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.21


From xen-changelog-bounces@lists.xenproject.org Thu Mar 26 13:11:05 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 26 Mar 2026 13:11:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1264073.1555796 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w5kUI-0005Tj-KI; Thu, 26 Mar 2026 13:11:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1264073.1555796; Thu, 26 Mar 2026 13:11:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w5kUI-0005Tb-Gv; Thu, 26 Mar 2026 13:11:02 +0000
Received: by outflank-mailman (input) for mailman id 1264073;
 Thu, 26 Mar 2026 13:11:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w5kUH-0005TU-Jz
 for xen-changelog@lists.xenproject.org; Thu, 26 Mar 2026 13:11:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w5kUH-00AbN5-2T
 for xen-changelog@lists.xenproject.org;
 Thu, 26 Mar 2026 13:11:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w5kUH-00H5TY-1g
 for xen-changelog@lists.xenproject.org;
 Thu, 26 Mar 2026 13:11:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=X/hSqBYfkiZGRskT4IOdo8YPtpRJIai1nYQmaO48tAE=; b=AaL8I51wZURjcfJlhYyWxnahLW
	qYc70eaarvZ092hS7NoVZdPa0cWiO9MiSAL0RPv82dQX60peBMu+4slfhas9YgZNa6IchEBLk9hV3
	zjshF16HDgl0On3GMd48PTpYGdNmIZlYozONpRDU7bCMCfjp9IIk0xtr/tT9cbW54Ri0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.20] Revert "xen/mm: allow deferred scrub of physmap populate allocated pages"
Message-Id: <E1w5kUH-00H5TY-1g@xenbits.xenproject.org>
Date: Thu, 26 Mar 2026 13:11:01 +0000

commit a9730e49531c299c80a2cb8bad959dbbfcf46211
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 26 11:11:09 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 26 11:11:46 2026 +0100

    Revert "xen/mm: allow deferred scrub of physmap populate allocated pages"
    
    This reverts commit b304f948427218421af24abcb04b40d3c34fefbf and its
    prereq 7e10bb1501c0289988d27772823c5eaf52f1b6a5 ("xen/mm: remove
    aliasing of PGC_need_scrub over PGC_allocated"). Further fixes are
    needed before this can be considered for backporting.
---
 xen/arch/arm/include/asm/mm.h   |  10 ++--
 xen/arch/ppc/include/asm/mm.h   |  10 ++--
 xen/arch/riscv/include/asm/mm.h |  10 ++--
 xen/arch/x86/include/asm/mm.h   |  18 ++++---
 xen/common/domain.c             |  25 ----------
 xen/common/memory.c             | 105 +---------------------------------------
 xen/common/page_alloc.c         |   4 +-
 xen/include/xen/mm.h            |  11 -----
 xen/include/xen/sched.h         |   5 --
 9 files changed, 35 insertions(+), 163 deletions(-)

diff --git a/xen/arch/arm/include/asm/mm.h b/xen/arch/arm/include/asm/mm.h
index efbe19aba4..a0d8e5afe9 100644
--- a/xen/arch/arm/include/asm/mm.h
+++ b/xen/arch/arm/include/asm/mm.h
@@ -150,9 +150,6 @@ struct page_info
 #define _PGC_colored      PG_shift(4)
 #define PGC_colored       PG_mask(1, 4)
 #endif
-/* Page needs to be scrubbed. */
-#define _PGC_need_scrub   PG_shift(5)
-#define PGC_need_scrub    PG_mask(1, 5)
 /* ... */
 /* Page is broken? */
 #define _PGC_broken       PG_shift(7)
@@ -172,6 +169,13 @@ struct page_info
 #define PGC_count_width   PG_shift(10)
 #define PGC_count_mask    ((1UL<<PGC_count_width)-1)
 
+/*
+ * Page needs to be scrubbed. Since this bit can only be set on a page that is
+ * free (i.e. in PGC_state_free) we can reuse PGC_allocated bit.
+ */
+#define _PGC_need_scrub   _PGC_allocated
+#define PGC_need_scrub    PGC_allocated
+
 #ifdef CONFIG_ARM_32
 #define is_xen_heap_page(page) is_xen_heap_mfn(page_to_mfn(page))
 #define is_xen_heap_mfn(mfn) ({                                 \
diff --git a/xen/arch/ppc/include/asm/mm.h b/xen/arch/ppc/include/asm/mm.h
index 9b654945de..a433936076 100644
--- a/xen/arch/ppc/include/asm/mm.h
+++ b/xen/arch/ppc/include/asm/mm.h
@@ -58,9 +58,6 @@ static inline struct page_info *virt_to_page(const void *v)
 /* Page is Xen heap? */
 #define _PGC_xen_heap     PG_shift(2)
 #define PGC_xen_heap      PG_mask(1, 2)
-/* Page needs to be scrubbed. */
-#define _PGC_need_scrub   PG_shift(3)
-#define PGC_need_scrub    PG_mask(1, 3)
 /* Page is broken? */
 #define _PGC_broken       PG_shift(7)
 #define PGC_broken        PG_mask(1, 7)
@@ -79,6 +76,13 @@ static inline struct page_info *virt_to_page(const void *v)
 #define PGC_count_width   PG_shift(10)
 #define PGC_count_mask    ((1UL<<PGC_count_width)-1)
 
+/*
+ * Page needs to be scrubbed. Since this bit can only be set on a page that is
+ * free (i.e. in PGC_state_free) we can reuse PGC_allocated bit.
+ */
+#define _PGC_need_scrub   _PGC_allocated
+#define PGC_need_scrub    PGC_allocated
+
 #define is_xen_heap_page(page) ((page)->count_info & PGC_xen_heap)
 #define is_xen_heap_mfn(mfn) \
     (mfn_valid(mfn) && is_xen_heap_page(mfn_to_page(mfn)))
diff --git a/xen/arch/riscv/include/asm/mm.h b/xen/arch/riscv/include/asm/mm.h
index 70849ce2e6..292aa48fc1 100644
--- a/xen/arch/riscv/include/asm/mm.h
+++ b/xen/arch/riscv/include/asm/mm.h
@@ -221,15 +221,19 @@ static inline bool arch_mfns_in_directmap(unsigned long mfn, unsigned long nr)
 #define PGT_count_width   PG_shift(2)
 #define PGT_count_mask    ((1UL << PGT_count_width) - 1)
 
+/*
+ * Page needs to be scrubbed. Since this bit can only be set on a page that is
+ * free (i.e. in PGC_state_free) we can reuse PGC_allocated bit.
+ */
+#define _PGC_need_scrub   _PGC_allocated
+#define PGC_need_scrub    PGC_allocated
+
 /* Cleared when the owning guest 'frees' this page. */
 #define _PGC_allocated    PG_shift(1)
 #define PGC_allocated     PG_mask(1, 1)
 /* Page is Xen heap? */
 #define _PGC_xen_heap     PG_shift(2)
 #define PGC_xen_heap      PG_mask(1, 2)
-/* Page needs to be scrubbed. */
-#define _PGC_need_scrub   PG_shift(4)
-#define PGC_need_scrub    PG_mask(1, 4)
 /* Page is broken? */
 #define _PGC_broken       PG_shift(7)
 #define PGC_broken        PG_mask(1, 7)
diff --git a/xen/arch/x86/include/asm/mm.h b/xen/arch/x86/include/asm/mm.h
index 30e993baba..6c7e66ee21 100644
--- a/xen/arch/x86/include/asm/mm.h
+++ b/xen/arch/x86/include/asm/mm.h
@@ -83,25 +83,29 @@
 #define PGC_state_offlined  PG_mask(2, 6)
 #define PGC_state_free      PG_mask(3, 6)
 #define page_state_is(pg, st) (((pg)->count_info&PGC_state) == PGC_state_##st)
-/* Page needs to be scrubbed. */
-#define _PGC_need_scrub   PG_shift(7)
-#define PGC_need_scrub    PG_mask(1, 7)
 #ifdef CONFIG_SHADOW_PAGING
  /* Set when a page table page has been shadowed. */
-#define _PGC_shadowed_pt  PG_shift(8)
-#define PGC_shadowed_pt   PG_mask(1, 8)
+#define _PGC_shadowed_pt  PG_shift(7)
+#define PGC_shadowed_pt   PG_mask(1, 7)
 #else
 #define PGC_shadowed_pt   0
 #endif
 
 /* Count of references to this frame. */
 #if PGC_shadowed_pt
-#define PGC_count_width   PG_shift(8)
-#else
 #define PGC_count_width   PG_shift(7)
+#else
+#define PGC_count_width   PG_shift(6)
 #endif
 #define PGC_count_mask    ((1UL<<PGC_count_width)-1)
 
+/*
+ * Page needs to be scrubbed. Since this bit can only be set on a page that is
+ * free (i.e. in PGC_state_free) we can reuse PGC_allocated bit.
+ */
+#define _PGC_need_scrub   _PGC_allocated
+#define PGC_need_scrub    PGC_allocated
+
 #ifndef CONFIG_BIGMEM
 /*
  * This definition is solely for the use in struct page_info (and
diff --git a/xen/common/domain.c b/xen/common/domain.c
index 1a5a7d15bf..d03f3e046f 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -446,18 +446,6 @@ static int __init cf_check parse_dom0_param(const char *s)
 }
 custom_param("dom0", parse_dom0_param);
 
-static void domain_pending_scrub_free(struct domain *d)
-{
-    rspin_lock(&d->page_alloc_lock);
-    if ( d->pending_scrub )
-    {
-        FREE_DOMHEAP_PAGES(d->pending_scrub, d->pending_scrub_order);
-        d->pending_scrub_order = 0;
-        d->pending_scrub_index = 0;
-    }
-    rspin_unlock(&d->page_alloc_lock);
-}
-
 /*
  * Release resources held by a domain.  There may or may not be live
  * references to the domain, and it may or may not be fully constructed.
@@ -517,9 +505,6 @@ static int domain_teardown(struct domain *d)
     case PROG_none:
         BUILD_BUG_ON(PROG_none != 0);
 
-        /* Trivial teardown, not long-running enough to need a preemption check. */
-        domain_pending_scrub_free(d);
-
     PROGRESS(gnttab_mappings):
         rc = gnttab_release_mappings(d);
         if ( rc )
@@ -562,7 +547,6 @@ static void _domain_destroy(struct domain *d)
 {
     BUG_ON(!d->is_dying);
     BUG_ON(atomic_read(&d->refcnt) != DOMAIN_DESTROYED);
-    ASSERT(!d->pending_scrub);
 
     xfree(d->pbuf);
 
@@ -1494,15 +1478,6 @@ int domain_unpause_by_systemcontroller(struct domain *d)
      */
     if ( new == 0 && !d->creation_finished )
     {
-        if ( d->pending_scrub )
-        {
-            printk(XENLOG_ERR
-                   "%pd: cannot be started with pending unscrubbed pages, destroying\n",
-                   d);
-            domain_crash(d);
-            domain_pending_scrub_free(d);
-            return -EBUSY;
-        }
         d->creation_finished = true;
         arch_domain_creation_finished(d);
     }
diff --git a/xen/common/memory.c b/xen/common/memory.c
index 00ba0d61dc..c78f0dcd0a 100644
--- a/xen/common/memory.c
+++ b/xen/common/memory.c
@@ -157,73 +157,6 @@ static void increase_reservation(struct memop_args *a)
     a->nr_done = i;
 }
 
-/*
- * Temporary storage for a domain assigned page that's not been fully scrubbed.
- * Stored pages must be domheap ones.
- *
- * The stashed page can be freed at any time by Xen, the caller must pass the
- * order and NUMA node requirement to the fetch function to ensure the
- * currently stashed page matches it's requirements.
- */
-static void stash_allocation(struct domain *d, struct page_info *page,
-                             unsigned int order, unsigned int scrub_index)
-{
-    rspin_lock(&d->page_alloc_lock);
-
-    /*
-     * Drop the passed page in preference for the already stashed one.  This
-     * interface is designed to be used for single-threaded domain creation.
-     */
-    if ( d->pending_scrub || d->is_dying )
-        free_domheap_pages(page, order);
-    else
-    {
-        d->pending_scrub_index = scrub_index;
-        d->pending_scrub_order = order;
-        d->pending_scrub = page;
-    }
-
-    rspin_unlock(&d->page_alloc_lock);
-}
-
-static struct page_info *get_stashed_allocation(struct domain *d,
-                                                unsigned int order,
-                                                nodeid_t node,
-                                                unsigned int *scrub_index)
-{
-    struct page_info *page = NULL;
-
-    rspin_lock(&d->page_alloc_lock);
-
-    /*
-     * If there's a pending page to scrub check if it satisfies the current
-     * request.  If it doesn't free it and return NULL.
-     */
-    if ( d->pending_scrub )
-    {
-        if ( d->pending_scrub_order == order &&
-             (node == NUMA_NO_NODE || node == page_to_nid(d->pending_scrub)) )
-        {
-            page = d->pending_scrub;
-            *scrub_index = d->pending_scrub_index;
-        }
-        else
-            free_domheap_pages(d->pending_scrub, d->pending_scrub_order);
-
-        /*
-         * The caller now owns the page or it has been freed, clear stashed
-         * information.  Prevent concurrent usages of get_stashed_allocation()
-         * from returning the same page to different contexts.
-         */
-        d->pending_scrub_index = 0;
-        d->pending_scrub_order = 0;
-        d->pending_scrub = NULL;
-    }
-
-    rspin_unlock(&d->page_alloc_lock);
-    return page;
-}
-
 static void populate_physmap(struct memop_args *a)
 {
     struct page_info *page;
@@ -340,19 +273,7 @@ static void populate_physmap(struct memop_args *a)
             }
             else
             {
-                unsigned int scrub_start = 0;
-                unsigned int memflags =
-                    a->memflags | (d->creation_finished ? 0
-                                                        : MEMF_no_scrub);
-                nodeid_t node =
-                    (a->memflags & MEMF_exact_node) ? MEMF_get_node(a->memflags)
-                                                    : NUMA_NO_NODE;
-
-                page = get_stashed_allocation(d, a->extent_order, node,
-                                              &scrub_start);
-
-                if ( !page )
-                    page = alloc_domheap_pages(d, a->extent_order, memflags);
+                page = alloc_domheap_pages(d, a->extent_order, a->memflags);
 
                 if ( unlikely(!page) )
                 {
@@ -363,30 +284,6 @@ static void populate_physmap(struct memop_args *a)
                     goto out;
                 }
 
-                if ( memflags & MEMF_no_scrub )
-                {
-                    unsigned int dirty_cnt = 0;
-
-                    /* Check if there's anything to scrub. */
-                    for ( j = scrub_start; j < (1U << a->extent_order); j++ )
-                    {
-                        if ( !test_and_clear_bit(_PGC_need_scrub,
-                                                 &page[j].count_info) )
-                            continue;
-
-                        scrub_one_page(&page[j]);
-
-                        if ( (j + 1) != (1U << a->extent_order) &&
-                             !(++dirty_cnt & 0xff) &&
-                             hypercall_preempt_check() )
-                        {
-                            a->preempted = 1;
-                            stash_allocation(d, page, a->extent_order, j + 1);
-                            goto out;
-                        }
-                    }
-                }
-
                 if ( unlikely(a->memflags & MEMF_no_tlbflush) )
                 {
                     for ( j = 0; j < (1U << a->extent_order); j++ )
diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
index cab35bc39c..6919722e9a 100644
--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -169,7 +169,7 @@
 /*
  * Flags that are preserved in assign_pages() (and only there)
  */
-#define PGC_preserved (PGC_extra | PGC_static | PGC_colored | PGC_need_scrub)
+#define PGC_preserved (PGC_extra | PGC_static | PGC_colored)
 
 #ifndef PGT_TYPE_INFO_INITIALIZER
 #define PGT_TYPE_INFO_INITIALIZER 0
@@ -764,7 +764,7 @@ static void page_list_add_scrub(struct page_info *pg, unsigned int node,
 #endif
 #define SCRUB_BYTE_PATTERN   (SCRUB_PATTERN & 0xff)
 
-void scrub_one_page(const struct page_info *pg)
+static void scrub_one_page(const struct page_info *pg)
 {
     if ( unlikely(pg->count_info & PGC_broken) )
         return;
diff --git a/xen/include/xen/mm.h b/xen/include/xen/mm.h
index e8f4a2fba3..16f733281a 100644
--- a/xen/include/xen/mm.h
+++ b/xen/include/xen/mm.h
@@ -144,17 +144,6 @@ unsigned long avail_domheap_pages(void);
 unsigned long avail_node_heap_pages(unsigned int nodeid);
 #define alloc_domheap_page(d,f) (alloc_domheap_pages(d,0,f))
 #define free_domheap_page(p)  (free_domheap_pages(p,0))
-
-/* Free an allocation, and zero the pointer to it. */
-#define FREE_DOMHEAP_PAGES(p, o) do { \
-    void *_ptr_ = (p);                \
-    (p) = NULL;                       \
-    free_domheap_pages(_ptr_, o);     \
-} while ( false )
-#define FREE_DOMHEAP_PAGE(p) FREE_DOMHEAP_PAGES(p, 0)
-
-void scrub_one_page(const struct page_info *pg);
-
 unsigned int online_page(mfn_t mfn, uint32_t *status);
 int offline_page(mfn_t mfn, int broken, uint32_t *status);
 int query_page_offline(mfn_t mfn, uint32_t *status);
diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
index e664221184..de621eb123 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -646,11 +646,6 @@ struct domain
     unsigned int num_llc_colors;
     const unsigned int *llc_colors;
 #endif
-
-    /* Pointer to allocated domheap page that possibly needs scrubbing. */
-    struct page_info *pending_scrub;
-    unsigned int pending_scrub_order;
-    unsigned int pending_scrub_index;
 };
 
 static inline struct page_list_head *page_to_list(
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.20


From xen-changelog-bounces@lists.xenproject.org Thu Mar 26 13:11:12 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 26 Mar 2026 13:11:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1264075.1555798 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w5kUS-0005Vn-Ky; Thu, 26 Mar 2026 13:11:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1264075.1555798; Thu, 26 Mar 2026 13:11:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w5kUS-0005Vd-IO; Thu, 26 Mar 2026 13:11:12 +0000
Received: by outflank-mailman (input) for mailman id 1264075;
 Thu, 26 Mar 2026 13:11:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w5kUR-0005VS-ML
 for xen-changelog@lists.xenproject.org; Thu, 26 Mar 2026 13:11:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w5kUR-00AbNc-2m
 for xen-changelog@lists.xenproject.org;
 Thu, 26 Mar 2026 13:11:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w5kUR-00H5U8-1z
 for xen-changelog@lists.xenproject.org;
 Thu, 26 Mar 2026 13:11:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=kxrp1oXXgs9GU/UHBlkjtxE2lakEWuAy6A2NhzuCFTo=; b=GKSgaCYrcCvAXdsXkZe1R38e/o
	jmLqkUnAsVgiuVH/Gf0Lk4Mh4nttIxn5cxlmqiRQz0skRJW1gTLFaiARWxVWKV9a/DyhfaM8XTZdz
	WbWuj7wG4JKnoLHzEKJq/iOlT+ULtQi/C1wWV6n77B+kHOoivZS6Bl2z39Ou33mTiOYo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.20] ARM: Drop ThumbEE support
Message-Id: <E1w5kUR-00H5U8-1z@xenbits.xenproject.org>
Date: Thu, 26 Mar 2026 13:11:11 +0000

commit 3f67b78bc8eec00864f1149218a12f5a902f9dbc
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Mar 26 11:13:59 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 26 11:13:59 2026 +0100

    ARM: Drop ThumbEE support
    
    Hans reports that Xen no longer builds on Debian unstable/sid:
    
      Assembler messages:
      {standard input}:474: Error: unknown or missing system register name at operand 1 -- `msr TEECR32_EL1,x0'
      {standard input}:480: Error: unknown or missing system register name at operand 1 -- `msr TEEHBR32_EL1,x0'
      {standard input}:488: Error: unknown or missing system register name at operand 2 -- `mrs x0,TEECR32_EL1'
      {standard input}:494: Error: unknown or missing system register name at operand 2 -- `mrs x0,TEEHBR32_EL1'
      make[5]: *** [Rules.mk:249: arch/arm/domain.o] Error 1
    
    This turns out to be an intentional change in binutils.  ThumbEE was dropped
    ahead of ARM v8 (i.e. AArch64).
    
    Xen supports ARM v7+virt extensions so in principle we could #ifdef
    CONFIG_ARM_32 to keep it working.  However, there was apparently no use of
    ThumbEE outside of demo code, so simply drop it.
    
    On ThumbEE capable hardware, unconditionally trap ThumbEE instructions, and
    drop the context switching logic for TEE{CR,HBR}32.
    
    Reported-by: Hans van Kranenburg <hans@knorrie.org>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    
    xen/arm: Set ThumbEE as not present in PFR0
    
    Force ThumbEE support to not available in the version of the PFR0
    register value we present to guest.
    Xen does not support ThumbEE and will trap all access to ThumbEE
    registers so do not report it being supported if the hardware supports
    it.
    
    Fixes: 5bbe1fe413f9 ("ARM: Drop ThumbEE support")
    Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
    Tested-by: Luca Fancellu <luca.fancellu@arm.com>
    master commit: 5bbe1fe413f9d6a841b0bc70db024b1398391630
    master date: 2025-12-05 18:06:19 +0000
    master commit: 1ecb5946bdf8797d43ac6730c708bd105fdb0be4
    master date: 2026-01-05 10:33:03 +0000
---
 xen/arch/arm/cpufeature.c            |  3 +++
 xen/arch/arm/domain.c                | 12 ------------
 xen/arch/arm/include/asm/domain.h    |  1 -
 xen/arch/arm/include/asm/processor.h |  1 +
 xen/arch/arm/traps.c                 |  4 ++--
 5 files changed, 6 insertions(+), 15 deletions(-)

diff --git a/xen/arch/arm/cpufeature.c b/xen/arch/arm/cpufeature.c
index 1a80738571..94d14fb6a9 100644
--- a/xen/arch/arm/cpufeature.c
+++ b/xen/arch/arm/cpufeature.c
@@ -227,6 +227,9 @@ static int __init create_domain_cpuinfo(void)
 #endif
     domain_cpuinfo.pfr32.amu = 0;
 
+    /* Hide ThumbEE support */
+    domain_cpuinfo.pfr32.thumbee = 0;
+
     /* Hide RAS support as Xen does not support it */
 #ifdef CONFIG_ARM_64
     domain_cpuinfo.pfr64.ras = 0;
diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c
index 3ba959f866..2d00b4ce1d 100644
--- a/xen/arch/arm/domain.c
+++ b/xen/arch/arm/domain.c
@@ -111,12 +111,6 @@ static void ctxt_switch_from(struct vcpu *p)
     p->arch.cntkctl = READ_SYSREG(CNTKCTL_EL1);
     virt_timer_save(p);
 
-    if ( is_32bit_domain(p->domain) && cpu_has_thumbee )
-    {
-        p->arch.teecr = READ_SYSREG(TEECR32_EL1);
-        p->arch.teehbr = READ_SYSREG(TEEHBR32_EL1);
-    }
-
 #ifdef CONFIG_ARM_32
     p->arch.joscr = READ_CP32(JOSCR);
     p->arch.jmcr = READ_CP32(JMCR);
@@ -244,12 +238,6 @@ static void ctxt_switch_to(struct vcpu *n)
     WRITE_SYSREG(n->arch.tpidrro_el0, TPIDRRO_EL0);
     WRITE_SYSREG(n->arch.tpidr_el1, TPIDR_EL1);
 
-    if ( is_32bit_domain(n->domain) && cpu_has_thumbee )
-    {
-        WRITE_SYSREG(n->arch.teecr, TEECR32_EL1);
-        WRITE_SYSREG(n->arch.teehbr, TEEHBR32_EL1);
-    }
-
 #ifdef CONFIG_ARM_32
     WRITE_CP32(n->arch.joscr, JOSCR);
     WRITE_CP32(n->arch.jmcr, JMCR);
diff --git a/xen/arch/arm/include/asm/domain.h b/xen/arch/arm/include/asm/domain.h
index f1d72c6e48..48aa17b1b1 100644
--- a/xen/arch/arm/include/asm/domain.h
+++ b/xen/arch/arm/include/asm/domain.h
@@ -204,7 +204,6 @@ struct arch_vcpu
     register_t hcr_el2;
     register_t mdcr_el2;
 
-    uint32_t teecr, teehbr; /* ThumbEE, 32-bit guests only */
 #ifdef CONFIG_ARM_32
     /*
      * ARMv8 only supports a trivial implementation on Jazelle when in AArch32
diff --git a/xen/arch/arm/include/asm/processor.h b/xen/arch/arm/include/asm/processor.h
index 60b587db69..ecf7f2e859 100644
--- a/xen/arch/arm/include/asm/processor.h
+++ b/xen/arch/arm/include/asm/processor.h
@@ -411,6 +411,7 @@
 
 /* HSTR Hyp. System Trap Register */
 #define HSTR_T(x)       ((_AC(1,U)<<(x)))       /* Trap Cp15 c<x> */
+#define HSTR_TTEE       (_AC(1,U)<<16)          /* Trap ThumbEE */
 
 /* HDCR Hyp. Debug Configuration Register */
 #define HDCR_TDRA       (_AC(1,U)<<11)          /* Trap Debug ROM access */
diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
index 737f4d65e3..4b7ccdf485 100644
--- a/xen/arch/arm/traps.c
+++ b/xen/arch/arm/traps.c
@@ -158,8 +158,8 @@ void init_traps(void)
     WRITE_SYSREG(HDCR_TDRA|HDCR_TDOSA|HDCR_TDA|HDCR_TPM|HDCR_TPMCR,
                  MDCR_EL2);
 
-    /* Trap CP15 c15 used for implementation defined registers */
-    WRITE_SYSREG(HSTR_T(15), HSTR_EL2);
+    /* Trap CP15 c15 used for implementation defined registers, and ThumbEE. */
+    WRITE_SYSREG(HSTR_T(15) | (cpu_has_thumbee ? HSTR_TTEE : 0), HSTR_EL2);
 
     WRITE_SYSREG(get_default_cptr_flags(), CPTR_EL2);
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.20


From xen-changelog-bounces@lists.xenproject.org Thu Mar 26 13:11:22 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 26 Mar 2026 13:11:22 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1264076.1555803 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w5kUc-0005Xv-MT; Thu, 26 Mar 2026 13:11:22 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1264076.1555803; Thu, 26 Mar 2026 13:11:22 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w5kUc-0005Xl-Jl; Thu, 26 Mar 2026 13:11:22 +0000
Received: by outflank-mailman (input) for mailman id 1264076;
 Thu, 26 Mar 2026 13:11:21 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w5kUb-0005Xf-QI
 for xen-changelog@lists.xenproject.org; Thu, 26 Mar 2026 13:11:21 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w5kUb-00AbNi-38
 for xen-changelog@lists.xenproject.org;
 Thu, 26 Mar 2026 13:11:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w5kUb-00H5Uu-2G
 for xen-changelog@lists.xenproject.org;
 Thu, 26 Mar 2026 13:11:21 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=2rRi30Gchg//TuGQEtD0NCAjzmzJai6XIqNI/mTigR4=; b=A/rDJOlKXppv4Cl3ZZx4/OAybB
	8Z61RdL0xEV//XZhByPIFtHotLaftwTCzjeGa1oXtI9Rm0M7tt2VpYzshEodT0AwlniFPc1Ej/gaP
	RKZ3LDFVUYLhOVu/fr0O8+0BcyGq/re5HqFO4uLesQhRReIzlzwbjLVA8duvoFmGmNTw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.20] x86/vpmu: Expose up to 8 Intel event selectors in PV Dom0
Message-Id: <E1w5kUb-00H5Uu-2G@xenbits.xenproject.org>
Date: Thu, 26 Mar 2026 13:11:21 +0000

commit 598d4c662aa348fd9a898b4a8ef04ba7c8a44d6d
Author:     Teddy Astie <teddy.astie@vates.tech>
AuthorDate: Thu Mar 26 11:14:28 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 26 11:14:28 2026 +0100

    x86/vpmu: Expose up to 8 Intel event selectors in PV Dom0
    
    Most (if not all) Intel CPUs starting from Sandy Bridge have up to 8
    event selectors per core, which could be halved per hyperthread.
    
    However, current PV emulation logic doesn't support up to 8 event selector,
    leading to errors when trying to access them, hence, preventing Linux from
    driving the vPMU correctly.
    
    Make sure up to MSR_P6_EVNTSEL(7) is usable, which is the same upper bound as
    used in VMX code.
    
    The check if the event selector actually exist for the hardware is done in
    core2_vpmu_do_{rdmsr,wrmsr}, hence we're not allowing to access non-existent
    MSRs.
    
    Fixes: 27c554198666 ("x86/VPMU: add support for PMU register handling on PV guests")
    Signed-off-by: Teddy Astie <teddy.astie@vates.tech>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 4e9d9e7cc9a663d7c15118d5ebe344f7edad3ec9
    master date: 2026-03-24 12:04:46 +0100
---
 xen/arch/x86/pv/emul-priv-op.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/pv/emul-priv-op.c b/xen/arch/x86/pv/emul-priv-op.c
index 7753e44477..af805d5efd 100644
--- a/xen/arch/x86/pv/emul-priv-op.c
+++ b/xen/arch/x86/pv/emul-priv-op.c
@@ -972,7 +972,7 @@ static int cf_check read_msr(
         return X86EMUL_OKAY;
 
     case MSR_P6_PERFCTR(0) ... MSR_P6_PERFCTR(7):
-    case MSR_P6_EVNTSEL(0) ... MSR_P6_EVNTSEL(3):
+    case MSR_P6_EVNTSEL(0) ... MSR_P6_EVNTSEL(7):
     case MSR_CORE_PERF_FIXED_CTR0 ... MSR_CORE_PERF_FIXED_CTR2:
     case MSR_CORE_PERF_FIXED_CTR_CTRL ... MSR_CORE_PERF_GLOBAL_OVF_CTRL:
         if ( boot_cpu_data.x86_vendor == X86_VENDOR_INTEL )
@@ -1149,7 +1149,7 @@ static int cf_check write_msr(
         break;
 
     case MSR_P6_PERFCTR(0) ... MSR_P6_PERFCTR(7):
-    case MSR_P6_EVNTSEL(0) ... MSR_P6_EVNTSEL(3):
+    case MSR_P6_EVNTSEL(0) ... MSR_P6_EVNTSEL(7):
     case MSR_CORE_PERF_FIXED_CTR0 ... MSR_CORE_PERF_FIXED_CTR2:
     case MSR_CORE_PERF_FIXED_CTR_CTRL ... MSR_CORE_PERF_GLOBAL_OVF_CTRL:
         if ( boot_cpu_data.x86_vendor == X86_VENDOR_INTEL )
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.20


From xen-changelog-bounces@lists.xenproject.org Thu Mar 26 13:11:32 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 26 Mar 2026 13:11:32 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1264078.1555806 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w5kUm-0005aP-Ne; Thu, 26 Mar 2026 13:11:32 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1264078.1555806; Thu, 26 Mar 2026 13:11:32 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w5kUm-0005aI-LA; Thu, 26 Mar 2026 13:11:32 +0000
Received: by outflank-mailman (input) for mailman id 1264078;
 Thu, 26 Mar 2026 13:11:31 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w5kUl-0005aC-Sb
 for xen-changelog@lists.xenproject.org; Thu, 26 Mar 2026 13:11:31 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w5kUm-00AbNp-0C
 for xen-changelog@lists.xenproject.org;
 Thu, 26 Mar 2026 13:11:31 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w5kUl-00H5WA-2d
 for xen-changelog@lists.xenproject.org;
 Thu, 26 Mar 2026 13:11:31 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=vjwwO5TMb7EWWHxIPZKq77mJ7KxD9G4ushKR2FckEcU=; b=AyXfMUWSg09Q6XzxXgCRL5Nv+5
	lnIP0SostRzh+0OaM1s3emNPdwHogv6IVxAliPt5oVihtBw/jugVZnlIs2YuURuCn1Kj2wLuJvXHr
	VzsfHAOJHyUOWaYkdhFD80W78LwughH9YWdM9axAihwv+zMppAxnOtAijNPGg+D9bnS4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.20] x86/S3: restore MCE (APs) init
Message-Id: <E1w5kUl-00H5WA-2d@xenbits.xenproject.org>
Date: Thu, 26 Mar 2026 13:11:31 +0000

commit 72b74479efa480d98e36ebc4434d7579f73fa25f
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 26 11:15:03 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 26 11:15:03 2026 +0100

    x86/S3: restore MCE (APs) init
    
    MCE init for APs was broken when CPU feature re-checking was added. At the
    same time make sure we don't bypass setup_doitm() (and whatever else may
    be added to the bottom of identify_cpu()).
    
    Fixes: bb502a8ca592 ("x86: check feature flags after resume")
    Reported-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Tested-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 5ebd4dd14118e4eb24f1d409a7ca3773f77e7e41
    master date: 2026-03-24 12:05:42 +0100
---
 xen/arch/x86/cpu/common.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c
index 4efa4fed32..683ec673f7 100644
--- a/xen/arch/x86/cpu/common.c
+++ b/xen/arch/x86/cpu/common.c
@@ -612,16 +612,20 @@ void identify_cpu(struct cpuinfo_x86 *c)
 			       smp_processor_id());
 	}
 
-	if (system_state == SYS_STATE_resume)
-		return;
+	if (system_state == SYS_STATE_resume) {
+		unsigned int cpu = smp_processor_id();
 
+		/* The BSP has this done right from enter_state(). */
+		if (cpu)
+			mcheck_init(&cpu_data[cpu], false);
+	}
 	/*
 	 * On SMP, boot_cpu_data holds the common feature set between
 	 * all CPUs; so make sure that we indicate which features are
 	 * common between the CPUs.  The first time this routine gets
 	 * executed, c == &boot_cpu_data.
 	 */
-	if ( c != &boot_cpu_data ) {
+	else if (c != &boot_cpu_data) {
 		/* AND the already accumulated flags with these */
 		for ( i = 0 ; i < NCAPINTS ; i++ )
 			boot_cpu_data.x86_capability[i] &= c->x86_capability[i];
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.20


From xen-changelog-bounces@lists.xenproject.org Thu Mar 26 13:11:43 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 26 Mar 2026 13:11:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1264079.1555811 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w5kUx-0005cz-QY; Thu, 26 Mar 2026 13:11:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1264079.1555811; Thu, 26 Mar 2026 13:11:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w5kUx-0005cr-Nl; Thu, 26 Mar 2026 13:11:43 +0000
Received: by outflank-mailman (input) for mailman id 1264079;
 Thu, 26 Mar 2026 13:11:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w5kUw-0005cj-6j
 for xen-changelog@lists.xenproject.org; Thu, 26 Mar 2026 13:11:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w5kUw-00AbNy-1F
 for xen-changelog@lists.xenproject.org;
 Thu, 26 Mar 2026 13:11:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w5kUw-00H5YG-0T
 for xen-changelog@lists.xenproject.org;
 Thu, 26 Mar 2026 13:11:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=BXwfAkkQAI1ZwqquSEzbN/n+2tXYs+FI+zYsq5Q3/4c=; b=kVQNnuZ0SFaGuH8rhneycUl/FU
	gLcAIW+YODerOf2iRMEM2+12h1s4sMu6Dmc1Se40iPNp4Vp+8p2kGhgXYrcnguHzt4cNO0OKF5WdR
	7B0hHUw8O32OjW35P9BCvbqOFof9Uq3OJ09vHWmyMXokARof2+nqbgYFfb8sE7Iq7Ch8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.20] update Xen version to 4.20.3
Message-Id: <E1w5kUw-00H5YG-0T@xenbits.xenproject.org>
Date: Thu, 26 Mar 2026 13:11:42 +0000

commit 14274673cbb499472f63b8ece772e8d88bf7d79b
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 26 14:04:44 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 26 14:04:44 2026 +0100

    update Xen version to 4.20.3
---
 xen/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/Makefile b/xen/Makefile
index 19d4e56bd2..90f493d74f 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -6,7 +6,7 @@ this-makefile := $(call lastword,$(MAKEFILE_LIST))
 # All other places this is stored (eg. compile.h) should be autogenerated.
 export XEN_VERSION       = 4
 export XEN_SUBVERSION    = 20
-export XEN_EXTRAVERSION ?= .3-pre$(XEN_VENDORVERSION)
+export XEN_EXTRAVERSION ?= .3$(XEN_VENDORVERSION)
 export XEN_FULLVERSION   = $(XEN_VERSION).$(XEN_SUBVERSION)$(XEN_EXTRAVERSION)
 -include xen-version
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.20


From xen-changelog-bounces@lists.xenproject.org Thu Mar 26 13:22:05 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 26 Mar 2026 13:22:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1264133.1555851 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w5kex-0000r0-Gm; Thu, 26 Mar 2026 13:22:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1264133.1555851; Thu, 26 Mar 2026 13:22:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w5kex-0000qt-DO; Thu, 26 Mar 2026 13:22:03 +0000
Received: by outflank-mailman (input) for mailman id 1264133;
 Thu, 26 Mar 2026 13:22:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w5kew-0000ql-DU
 for xen-changelog@lists.xenproject.org; Thu, 26 Mar 2026 13:22:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w5kew-00AbaD-1o
 for xen-changelog@lists.xenproject.org;
 Thu, 26 Mar 2026 13:22:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w5kew-00H6U2-0y
 for xen-changelog@lists.xenproject.org;
 Thu, 26 Mar 2026 13:22:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=bhof5V8t72YyoSyMzMjjJX0Cb3WYi8qQoJg9tv4WuD4=; b=aCgEt2s5RHNSKXyF6JM1QHrM7u
	70oiP3OKA0NskOQUIF91asYlEGic6dHlGDnMU8pd/F2DHOIY7q31EG8X328+WbD/Y6l9sh+u0ETLr
	tsftNDPID3ywkfRLp3eFAKjT/BKd/bcCDQjrMmpbFiNhUHCHX0LCXfquC75hkg4+Vclc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] Revert "xen/mm: allow deferred scrub of physmap populate allocated pages"
Message-Id: <E1w5kew-00H6U2-0y@xenbits.xenproject.org>
Date: Thu, 26 Mar 2026 13:22:02 +0000

commit 360813e9e829f0b9439ac08a16808341cf74e993
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 26 11:16:35 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 26 11:16:58 2026 +0100

    Revert "xen/mm: allow deferred scrub of physmap populate allocated pages"
    
    This reverts commit 52f3b7c6f89abe1f8fd4fc702f150cf3ec1fe89f and its
    prereq 49a4deb467caea989d81f3692ed19a406ef6ee83 ("xen/mm: remove
    aliasing of PGC_need_scrub over PGC_allocated"). Further fixes are
    needed before this can be considered for backporting.
---
 xen/arch/arm/include/asm/mm.h |  10 ++--
 xen/arch/ppc/include/asm/mm.h |  10 ++--
 xen/arch/x86/include/asm/mm.h |  18 +++++---
 xen/common/domain.c           |  25 ----------
 xen/common/memory.c           | 105 +-----------------------------------------
 xen/common/page_alloc.c       |   6 +--
 xen/include/xen/mm.h          |   9 ----
 xen/include/xen/sched.h       |   5 --
 8 files changed, 28 insertions(+), 160 deletions(-)

diff --git a/xen/arch/arm/include/asm/mm.h b/xen/arch/arm/include/asm/mm.h
index ed71cf9bca..48538b5337 100644
--- a/xen/arch/arm/include/asm/mm.h
+++ b/xen/arch/arm/include/asm/mm.h
@@ -145,9 +145,6 @@ struct page_info
 #else
 #define PGC_static     0
 #endif
-/* Page needs to be scrubbed. */
-#define _PGC_need_scrub   PG_shift(5)
-#define PGC_need_scrub    PG_mask(1, 5)
 /* ... */
 /* Page is broken? */
 #define _PGC_broken       PG_shift(7)
@@ -167,6 +164,13 @@ struct page_info
 #define PGC_count_width   PG_shift(10)
 #define PGC_count_mask    ((1UL<<PGC_count_width)-1)
 
+/*
+ * Page needs to be scrubbed. Since this bit can only be set on a page that is
+ * free (i.e. in PGC_state_free) we can reuse PGC_allocated bit.
+ */
+#define _PGC_need_scrub   _PGC_allocated
+#define PGC_need_scrub    PGC_allocated
+
 #ifdef CONFIG_ARM_32
 #define is_xen_heap_page(page) is_xen_heap_mfn(page_to_mfn(page))
 #define is_xen_heap_mfn(mfn) ({                                 \
diff --git a/xen/arch/ppc/include/asm/mm.h b/xen/arch/ppc/include/asm/mm.h
index 9b654945de..a433936076 100644
--- a/xen/arch/ppc/include/asm/mm.h
+++ b/xen/arch/ppc/include/asm/mm.h
@@ -58,9 +58,6 @@ static inline struct page_info *virt_to_page(const void *v)
 /* Page is Xen heap? */
 #define _PGC_xen_heap     PG_shift(2)
 #define PGC_xen_heap      PG_mask(1, 2)
-/* Page needs to be scrubbed. */
-#define _PGC_need_scrub   PG_shift(3)
-#define PGC_need_scrub    PG_mask(1, 3)
 /* Page is broken? */
 #define _PGC_broken       PG_shift(7)
 #define PGC_broken        PG_mask(1, 7)
@@ -79,6 +76,13 @@ static inline struct page_info *virt_to_page(const void *v)
 #define PGC_count_width   PG_shift(10)
 #define PGC_count_mask    ((1UL<<PGC_count_width)-1)
 
+/*
+ * Page needs to be scrubbed. Since this bit can only be set on a page that is
+ * free (i.e. in PGC_state_free) we can reuse PGC_allocated bit.
+ */
+#define _PGC_need_scrub   _PGC_allocated
+#define PGC_need_scrub    PGC_allocated
+
 #define is_xen_heap_page(page) ((page)->count_info & PGC_xen_heap)
 #define is_xen_heap_mfn(mfn) \
     (mfn_valid(mfn) && is_xen_heap_page(mfn_to_page(mfn)))
diff --git a/xen/arch/x86/include/asm/mm.h b/xen/arch/x86/include/asm/mm.h
index 52d2d5ff60..98b66edaca 100644
--- a/xen/arch/x86/include/asm/mm.h
+++ b/xen/arch/x86/include/asm/mm.h
@@ -83,25 +83,29 @@
 #define PGC_state_offlined  PG_mask(2, 6)
 #define PGC_state_free      PG_mask(3, 6)
 #define page_state_is(pg, st) (((pg)->count_info&PGC_state) == PGC_state_##st)
-/* Page needs to be scrubbed. */
-#define _PGC_need_scrub   PG_shift(7)
-#define PGC_need_scrub    PG_mask(1, 7)
 #ifdef CONFIG_SHADOW_PAGING
  /* Set when a page table page has been shadowed. */
-#define _PGC_shadowed_pt  PG_shift(8)
-#define PGC_shadowed_pt   PG_mask(1, 8)
+#define _PGC_shadowed_pt  PG_shift(7)
+#define PGC_shadowed_pt   PG_mask(1, 7)
 #else
 #define PGC_shadowed_pt   0
 #endif
 
 /* Count of references to this frame. */
 #if PGC_shadowed_pt
-#define PGC_count_width   PG_shift(8)
-#else
 #define PGC_count_width   PG_shift(7)
+#else
+#define PGC_count_width   PG_shift(6)
 #endif
 #define PGC_count_mask    ((1UL<<PGC_count_width)-1)
 
+/*
+ * Page needs to be scrubbed. Since this bit can only be set on a page that is
+ * free (i.e. in PGC_state_free) we can reuse PGC_allocated bit.
+ */
+#define _PGC_need_scrub   _PGC_allocated
+#define PGC_need_scrub    PGC_allocated
+
 #ifndef CONFIG_BIGMEM
 /*
  * This definition is solely for the use in struct page_info (and
diff --git a/xen/common/domain.c b/xen/common/domain.c
index 77dacffd22..00c59a9baa 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -392,18 +392,6 @@ static int __init cf_check parse_dom0_param(const char *s)
 }
 custom_param("dom0", parse_dom0_param);
 
-static void domain_pending_scrub_free(struct domain *d)
-{
-    rspin_lock(&d->page_alloc_lock);
-    if ( d->pending_scrub )
-    {
-        FREE_DOMHEAP_PAGES(d->pending_scrub, d->pending_scrub_order);
-        d->pending_scrub_order = 0;
-        d->pending_scrub_index = 0;
-    }
-    rspin_unlock(&d->page_alloc_lock);
-}
-
 /*
  * Release resources held by a domain.  There may or may not be live
  * references to the domain, and it may or may not be fully constructed.
@@ -463,9 +451,6 @@ static int domain_teardown(struct domain *d)
     case PROG_none:
         BUILD_BUG_ON(PROG_none != 0);
 
-        /* Trivial teardown, not long-running enough to need a preemption check. */
-        domain_pending_scrub_free(d);
-
     PROGRESS(gnttab_mappings):
         rc = gnttab_release_mappings(d);
         if ( rc )
@@ -508,7 +493,6 @@ static void _domain_destroy(struct domain *d)
 {
     BUG_ON(!d->is_dying);
     BUG_ON(atomic_read(&d->refcnt) != DOMAIN_DESTROYED);
-    ASSERT(!d->pending_scrub);
 
     xfree(d->pbuf);
 
@@ -1436,15 +1420,6 @@ int domain_unpause_by_systemcontroller(struct domain *d)
      */
     if ( new == 0 && !d->creation_finished )
     {
-        if ( d->pending_scrub )
-        {
-            printk(XENLOG_ERR
-                   "%pd: cannot be started with pending unscrubbed pages, destroying\n",
-                   d);
-            domain_crash(d);
-            domain_pending_scrub_free(d);
-            return -EBUSY;
-        }
         d->creation_finished = true;
         arch_domain_creation_finished(d);
     }
diff --git a/xen/common/memory.c b/xen/common/memory.c
index 09bb1198bb..9b23cd0bdb 100644
--- a/xen/common/memory.c
+++ b/xen/common/memory.c
@@ -155,73 +155,6 @@ static void increase_reservation(struct memop_args *a)
     a->nr_done = i;
 }
 
-/*
- * Temporary storage for a domain assigned page that's not been fully scrubbed.
- * Stored pages must be domheap ones.
- *
- * The stashed page can be freed at any time by Xen, the caller must pass the
- * order and NUMA node requirement to the fetch function to ensure the
- * currently stashed page matches it's requirements.
- */
-static void stash_allocation(struct domain *d, struct page_info *page,
-                             unsigned int order, unsigned int scrub_index)
-{
-    rspin_lock(&d->page_alloc_lock);
-
-    /*
-     * Drop the passed page in preference for the already stashed one.  This
-     * interface is designed to be used for single-threaded domain creation.
-     */
-    if ( d->pending_scrub || d->is_dying )
-        free_domheap_pages(page, order);
-    else
-    {
-        d->pending_scrub_index = scrub_index;
-        d->pending_scrub_order = order;
-        d->pending_scrub = page;
-    }
-
-    rspin_unlock(&d->page_alloc_lock);
-}
-
-static struct page_info *get_stashed_allocation(struct domain *d,
-                                                unsigned int order,
-                                                nodeid_t node,
-                                                unsigned int *scrub_index)
-{
-    struct page_info *page = NULL;
-
-    rspin_lock(&d->page_alloc_lock);
-
-    /*
-     * If there's a pending page to scrub check if it satisfies the current
-     * request.  If it doesn't free it and return NULL.
-     */
-    if ( d->pending_scrub )
-    {
-        if ( d->pending_scrub_order == order &&
-             (node == NUMA_NO_NODE || node == page_to_nid(d->pending_scrub)) )
-        {
-            page = d->pending_scrub;
-            *scrub_index = d->pending_scrub_index;
-        }
-        else
-            free_domheap_pages(d->pending_scrub, d->pending_scrub_order);
-
-        /*
-         * The caller now owns the page or it has been freed, clear stashed
-         * information.  Prevent concurrent usages of get_stashed_allocation()
-         * from returning the same page to different contexts.
-         */
-        d->pending_scrub_index = 0;
-        d->pending_scrub_order = 0;
-        d->pending_scrub = NULL;
-    }
-
-    rspin_unlock(&d->page_alloc_lock);
-    return page;
-}
-
 static void populate_physmap(struct memop_args *a)
 {
     struct page_info *page;
@@ -338,19 +271,7 @@ static void populate_physmap(struct memop_args *a)
             }
             else
             {
-                unsigned int scrub_start = 0;
-                unsigned int memflags =
-                    a->memflags | (d->creation_finished ? 0
-                                                        : MEMF_no_scrub);
-                nodeid_t node =
-                    (a->memflags & MEMF_exact_node) ? MEMF_get_node(a->memflags)
-                                                    : NUMA_NO_NODE;
-
-                page = get_stashed_allocation(d, a->extent_order, node,
-                                              &scrub_start);
-
-                if ( !page )
-                    page = alloc_domheap_pages(d, a->extent_order, memflags);
+                page = alloc_domheap_pages(d, a->extent_order, a->memflags);
 
                 if ( unlikely(!page) )
                 {
@@ -361,30 +282,6 @@ static void populate_physmap(struct memop_args *a)
                     goto out;
                 }
 
-                if ( memflags & MEMF_no_scrub )
-                {
-                    unsigned int dirty_cnt = 0;
-
-                    /* Check if there's anything to scrub. */
-                    for ( j = scrub_start; j < (1U << a->extent_order); j++ )
-                    {
-                        if ( !test_and_clear_bit(_PGC_need_scrub,
-                                                 &page[j].count_info) )
-                            continue;
-
-                        scrub_one_page(&page[j]);
-
-                        if ( (j + 1) != (1U << a->extent_order) &&
-                             !(++dirty_cnt & 0xff) &&
-                             hypercall_preempt_check() )
-                        {
-                            a->preempted = 1;
-                            stash_allocation(d, page, a->extent_order, j + 1);
-                            goto out;
-                        }
-                    }
-                }
-
                 if ( unlikely(a->memflags & MEMF_no_tlbflush) )
                 {
                     for ( j = 0; j < (1U << a->extent_order); j++ )
diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
index 4304c3dbd4..bbb8578459 100644
--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -2364,8 +2364,7 @@ int assign_pages(
 
         for ( i = 0; i < nr; i++ )
         {
-            ASSERT(!(pg[i].count_info &
-                     ~(PGC_extra | PGC_static | PGC_need_scrub)));
+            ASSERT(!(pg[i].count_info & ~(PGC_extra | PGC_static)));
             if ( pg[i].count_info & PGC_extra )
                 extra_pages++;
         }
@@ -2425,8 +2424,7 @@ int assign_pages(
         page_set_owner(&pg[i], d);
         smp_wmb(); /* Domain pointer must be visible before updating refcnt. */
         pg[i].count_info =
-            (pg[i].count_info & (PGC_extra | PGC_static | PGC_need_scrub)) |
-            PGC_allocated | 1;
+            (pg[i].count_info & (PGC_extra | PGC_static)) | PGC_allocated | 1;
 
         page_list_add_tail(&pg[i], page_to_list(d, &pg[i]));
     }
diff --git a/xen/include/xen/mm.h b/xen/include/xen/mm.h
index fe32ef81cb..7561297a75 100644
--- a/xen/include/xen/mm.h
+++ b/xen/include/xen/mm.h
@@ -142,15 +142,6 @@ unsigned long avail_domheap_pages(void);
 unsigned long avail_node_heap_pages(unsigned int nodeid);
 #define alloc_domheap_page(d,f) (alloc_domheap_pages(d,0,f))
 #define free_domheap_page(p)  (free_domheap_pages(p,0))
-
-/* Free an allocation, and zero the pointer to it. */
-#define FREE_DOMHEAP_PAGES(p, o) do { \
-    void *_ptr_ = (p);                \
-    (p) = NULL;                       \
-    free_domheap_pages(_ptr_, o);     \
-} while ( false )
-#define FREE_DOMHEAP_PAGE(p) FREE_DOMHEAP_PAGES(p, 0)
-
 unsigned int online_page(mfn_t mfn, uint32_t *status);
 int offline_page(mfn_t mfn, int broken, uint32_t *status);
 int query_page_offline(mfn_t mfn, uint32_t *status);
diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
index ff831c7254..2a83b9dacf 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -636,11 +636,6 @@ struct domain
     } ioreq_server;
 #endif
 
-    /* Pointer to allocated domheap page that possibly needs scrubbing. */
-    struct page_info *pending_scrub;
-    unsigned int pending_scrub_order;
-    unsigned int pending_scrub_index;
-
     /* Holding CDF_* constant. Internal flags for domain creation. */
     unsigned int cdf;
 };
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Mar 26 13:22:13 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 26 Mar 2026 13:22:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1264135.1555854 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w5kf7-0000tG-Ha; Thu, 26 Mar 2026 13:22:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1264135.1555854; Thu, 26 Mar 2026 13:22:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w5kf7-0000t8-Et; Thu, 26 Mar 2026 13:22:13 +0000
Received: by outflank-mailman (input) for mailman id 1264135;
 Thu, 26 Mar 2026 13:22:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w5kf6-0000t2-FH
 for xen-changelog@lists.xenproject.org; Thu, 26 Mar 2026 13:22:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w5kf6-00Abad-26
 for xen-changelog@lists.xenproject.org;
 Thu, 26 Mar 2026 13:22:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w5kf6-00H6V3-1J
 for xen-changelog@lists.xenproject.org;
 Thu, 26 Mar 2026 13:22:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=jx3pWFcwefEr+/QnNAJnbhv+nhxbKFcXjy3AT0Gv/SU=; b=moGLKhXqsMEtAn6wIKn2onpcO6
	2mv+SGhXG3VeE7325QjRYkGXC/kcXx8cJAtQ5ui4xUVzUNBhaxkNwMoI+quledMmygtVTLBydZOR7
	emZ7x50LvFMKAbpp8y0rIR8tk6CwAxRnvPA2bo8XL1lHPDYrtdqpCIYM/48wi1oSR2jk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] ARM: Drop ThumbEE support
Message-Id: <E1w5kf6-00H6V3-1J@xenbits.xenproject.org>
Date: Thu, 26 Mar 2026 13:22:12 +0000

commit 11e8f436d572f611059b46d83564fc03527d5ba5
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Mar 26 11:18:56 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 26 11:18:56 2026 +0100

    ARM: Drop ThumbEE support
    
    Hans reports that Xen no longer builds on Debian unstable/sid:
    
      Assembler messages:
      {standard input}:474: Error: unknown or missing system register name at operand 1 -- `msr TEECR32_EL1,x0'
      {standard input}:480: Error: unknown or missing system register name at operand 1 -- `msr TEEHBR32_EL1,x0'
      {standard input}:488: Error: unknown or missing system register name at operand 2 -- `mrs x0,TEECR32_EL1'
      {standard input}:494: Error: unknown or missing system register name at operand 2 -- `mrs x0,TEEHBR32_EL1'
      make[5]: *** [Rules.mk:249: arch/arm/domain.o] Error 1
    
    This turns out to be an intentional change in binutils.  ThumbEE was dropped
    ahead of ARM v8 (i.e. AArch64).
    
    Xen supports ARM v7+virt extensions so in principle we could #ifdef
    CONFIG_ARM_32 to keep it working.  However, there was apparently no use of
    ThumbEE outside of demo code, so simply drop it.
    
    On ThumbEE capable hardware, unconditionally trap ThumbEE instructions, and
    drop the context switching logic for TEE{CR,HBR}32.
    
    Reported-by: Hans van Kranenburg <hans@knorrie.org>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    
    xen/arm: Set ThumbEE as not present in PFR0
    
    Force ThumbEE support to not available in the version of the PFR0
    register value we present to guest.
    Xen does not support ThumbEE and will trap all access to ThumbEE
    registers so do not report it being supported if the hardware supports
    it.
    
    Fixes: 5bbe1fe413f9 ("ARM: Drop ThumbEE support")
    Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
    Tested-by: Luca Fancellu <luca.fancellu@arm.com>
    master commit: 5bbe1fe413f9d6a841b0bc70db024b1398391630
    master date: 2025-12-05 18:06:19 +0000
    master commit: 1ecb5946bdf8797d43ac6730c708bd105fdb0be4
    master date: 2026-01-05 10:33:03 +0000
---
 xen/arch/arm/cpufeature.c            |  3 +++
 xen/arch/arm/domain.c                | 12 ------------
 xen/arch/arm/include/asm/domain.h    |  1 -
 xen/arch/arm/include/asm/processor.h |  1 +
 xen/arch/arm/traps.c                 |  4 ++--
 5 files changed, 6 insertions(+), 15 deletions(-)

diff --git a/xen/arch/arm/cpufeature.c b/xen/arch/arm/cpufeature.c
index ef77473bf8..9f9335eea2 100644
--- a/xen/arch/arm/cpufeature.c
+++ b/xen/arch/arm/cpufeature.c
@@ -224,6 +224,9 @@ static int __init create_domain_cpuinfo(void)
 #endif
     domain_cpuinfo.pfr32.amu = 0;
 
+    /* Hide ThumbEE support */
+    domain_cpuinfo.pfr32.thumbee = 0;
+
     /* Hide RAS support as Xen does not support it */
 #ifdef CONFIG_ARM_64
     domain_cpuinfo.pfr64.ras = 0;
diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c
index 7cfcefd279..dafcc86103 100644
--- a/xen/arch/arm/domain.c
+++ b/xen/arch/arm/domain.c
@@ -111,12 +111,6 @@ static void ctxt_switch_from(struct vcpu *p)
     p->arch.cntkctl = READ_SYSREG(CNTKCTL_EL1);
     virt_timer_save(p);
 
-    if ( is_32bit_domain(p->domain) && cpu_has_thumbee )
-    {
-        p->arch.teecr = READ_SYSREG(TEECR32_EL1);
-        p->arch.teehbr = READ_SYSREG(TEEHBR32_EL1);
-    }
-
 #ifdef CONFIG_ARM_32
     p->arch.joscr = READ_CP32(JOSCR);
     p->arch.jmcr = READ_CP32(JMCR);
@@ -244,12 +238,6 @@ static void ctxt_switch_to(struct vcpu *n)
     WRITE_SYSREG(n->arch.tpidrro_el0, TPIDRRO_EL0);
     WRITE_SYSREG(n->arch.tpidr_el1, TPIDR_EL1);
 
-    if ( is_32bit_domain(n->domain) && cpu_has_thumbee )
-    {
-        WRITE_SYSREG(n->arch.teecr, TEECR32_EL1);
-        WRITE_SYSREG(n->arch.teehbr, TEEHBR32_EL1);
-    }
-
 #ifdef CONFIG_ARM_32
     WRITE_CP32(n->arch.joscr, JOSCR);
     WRITE_CP32(n->arch.jmcr, JMCR);
diff --git a/xen/arch/arm/include/asm/domain.h b/xen/arch/arm/include/asm/domain.h
index f1d72c6e48..48aa17b1b1 100644
--- a/xen/arch/arm/include/asm/domain.h
+++ b/xen/arch/arm/include/asm/domain.h
@@ -204,7 +204,6 @@ struct arch_vcpu
     register_t hcr_el2;
     register_t mdcr_el2;
 
-    uint32_t teecr, teehbr; /* ThumbEE, 32-bit guests only */
 #ifdef CONFIG_ARM_32
     /*
      * ARMv8 only supports a trivial implementation on Jazelle when in AArch32
diff --git a/xen/arch/arm/include/asm/processor.h b/xen/arch/arm/include/asm/processor.h
index 8e02410465..2ca2662c02 100644
--- a/xen/arch/arm/include/asm/processor.h
+++ b/xen/arch/arm/include/asm/processor.h
@@ -396,6 +396,7 @@
 
 /* HSTR Hyp. System Trap Register */
 #define HSTR_T(x)       ((_AC(1,U)<<(x)))       /* Trap Cp15 c<x> */
+#define HSTR_TTEE       (_AC(1,U)<<16)          /* Trap ThumbEE */
 
 /* HDCR Hyp. Debug Configuration Register */
 #define HDCR_TDRA       (_AC(1,U)<<11)          /* Trap Debug ROM access */
diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
index aac6c599f8..ebfd53f8b9 100644
--- a/xen/arch/arm/traps.c
+++ b/xen/arch/arm/traps.c
@@ -158,8 +158,8 @@ void init_traps(void)
     WRITE_SYSREG(HDCR_TDRA|HDCR_TDOSA|HDCR_TDA|HDCR_TPM|HDCR_TPMCR,
                  MDCR_EL2);
 
-    /* Trap CP15 c15 used for implementation defined registers */
-    WRITE_SYSREG(HSTR_T(15), HSTR_EL2);
+    /* Trap CP15 c15 used for implementation defined registers, and ThumbEE. */
+    WRITE_SYSREG(HSTR_T(15) | (cpu_has_thumbee ? HSTR_TTEE : 0), HSTR_EL2);
 
     WRITE_SYSREG(get_default_cptr_flags(), CPTR_EL2);
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Mar 26 13:22:23 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 26 Mar 2026 13:22:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1264136.1555860 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w5kfH-0000wk-Ji; Thu, 26 Mar 2026 13:22:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1264136.1555860; Thu, 26 Mar 2026 13:22:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w5kfH-0000wd-GK; Thu, 26 Mar 2026 13:22:23 +0000
Received: by outflank-mailman (input) for mailman id 1264136;
 Thu, 26 Mar 2026 13:22:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w5kfG-0000wW-IS
 for xen-changelog@lists.xenproject.org; Thu, 26 Mar 2026 13:22:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w5kfG-00Abao-2O
 for xen-changelog@lists.xenproject.org;
 Thu, 26 Mar 2026 13:22:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w5kfG-00H6W0-1b
 for xen-changelog@lists.xenproject.org;
 Thu, 26 Mar 2026 13:22:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=IcnZNKfPEaRmDnWHvBs0B6zGqNBI8RvIqFGobrhgoKw=; b=1rHKClw/StlcfM6L65Ki4/2nGM
	wRI3OxiSF/IzKkhLmW56CUecv+jgE9MSbOWdgmrD6VILY1iZLSX6S49RB5eo1gCDKZ3obhI4hNwZ2
	DdiQkejezXO1SpFPAOJ4HWf87bJ7GDnzsuiWQPeey26HbQvgha9wSX2Ak+yhghlKyiNc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] x86/vpmu: Expose up to 8 Intel event selectors in PV Dom0
Message-Id: <E1w5kfG-00H6W0-1b@xenbits.xenproject.org>
Date: Thu, 26 Mar 2026 13:22:22 +0000

commit 138abc1cc31216735e3798883d3ce94be8b53e3b
Author:     Teddy Astie <teddy.astie@vates.tech>
AuthorDate: Thu Mar 26 11:19:16 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 26 11:19:16 2026 +0100

    x86/vpmu: Expose up to 8 Intel event selectors in PV Dom0
    
    Most (if not all) Intel CPUs starting from Sandy Bridge have up to 8
    event selectors per core, which could be halved per hyperthread.
    
    However, current PV emulation logic doesn't support up to 8 event selector,
    leading to errors when trying to access them, hence, preventing Linux from
    driving the vPMU correctly.
    
    Make sure up to MSR_P6_EVNTSEL(7) is usable, which is the same upper bound as
    used in VMX code.
    
    The check if the event selector actually exist for the hardware is done in
    core2_vpmu_do_{rdmsr,wrmsr}, hence we're not allowing to access non-existent
    MSRs.
    
    Fixes: 27c554198666 ("x86/VPMU: add support for PMU register handling on PV guests")
    Signed-off-by: Teddy Astie <teddy.astie@vates.tech>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 4e9d9e7cc9a663d7c15118d5ebe344f7edad3ec9
    master date: 2026-03-24 12:04:46 +0100
---
 xen/arch/x86/pv/emul-priv-op.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/pv/emul-priv-op.c b/xen/arch/x86/pv/emul-priv-op.c
index 7753e44477..af805d5efd 100644
--- a/xen/arch/x86/pv/emul-priv-op.c
+++ b/xen/arch/x86/pv/emul-priv-op.c
@@ -972,7 +972,7 @@ static int cf_check read_msr(
         return X86EMUL_OKAY;
 
     case MSR_P6_PERFCTR(0) ... MSR_P6_PERFCTR(7):
-    case MSR_P6_EVNTSEL(0) ... MSR_P6_EVNTSEL(3):
+    case MSR_P6_EVNTSEL(0) ... MSR_P6_EVNTSEL(7):
     case MSR_CORE_PERF_FIXED_CTR0 ... MSR_CORE_PERF_FIXED_CTR2:
     case MSR_CORE_PERF_FIXED_CTR_CTRL ... MSR_CORE_PERF_GLOBAL_OVF_CTRL:
         if ( boot_cpu_data.x86_vendor == X86_VENDOR_INTEL )
@@ -1149,7 +1149,7 @@ static int cf_check write_msr(
         break;
 
     case MSR_P6_PERFCTR(0) ... MSR_P6_PERFCTR(7):
-    case MSR_P6_EVNTSEL(0) ... MSR_P6_EVNTSEL(3):
+    case MSR_P6_EVNTSEL(0) ... MSR_P6_EVNTSEL(7):
     case MSR_CORE_PERF_FIXED_CTR0 ... MSR_CORE_PERF_FIXED_CTR2:
     case MSR_CORE_PERF_FIXED_CTR_CTRL ... MSR_CORE_PERF_GLOBAL_OVF_CTRL:
         if ( boot_cpu_data.x86_vendor == X86_VENDOR_INTEL )
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Mar 26 13:22:33 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 26 Mar 2026 13:22:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1264138.1555863 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w5kfR-0000zg-LY; Thu, 26 Mar 2026 13:22:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1264138.1555863; Thu, 26 Mar 2026 13:22:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w5kfR-0000zY-J6; Thu, 26 Mar 2026 13:22:33 +0000
Received: by outflank-mailman (input) for mailman id 1264138;
 Thu, 26 Mar 2026 13:22:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w5kfQ-0000zS-LK
 for xen-changelog@lists.xenproject.org; Thu, 26 Mar 2026 13:22:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w5kfQ-00Abas-2i
 for xen-changelog@lists.xenproject.org;
 Thu, 26 Mar 2026 13:22:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w5kfQ-00H6WY-1s
 for xen-changelog@lists.xenproject.org;
 Thu, 26 Mar 2026 13:22:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=aV4S4RPuWRNtr0/6Dv+a+zhs00wGNhY8W2FnY1tASSI=; b=zhZYu0mtZepTCCNjdxPTOsdmJj
	BkQL/VKcFiMyv81DscVMqVuwQlyz3zYBGMa6FnZt8d1Rn8qxrbO94Hk1656WHT8D+bIWntezPknPz
	9/Ofylo71ZMxZUz8rjKO0GoWmn473VXlrWtzNJs07prdEATa5UcG52W4cv/CmlvKgEow=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] x86/S3: restore MCE (APs) init
Message-Id: <E1w5kfQ-00H6WY-1s@xenbits.xenproject.org>
Date: Thu, 26 Mar 2026 13:22:32 +0000

commit 0e0bcd9a02ecf01dbc9806fadcde2e109d7e0454
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 26 11:19:50 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 26 11:19:50 2026 +0100

    x86/S3: restore MCE (APs) init
    
    MCE init for APs was broken when CPU feature re-checking was added. At the
    same time make sure we don't bypass setup_doitm() (and whatever else may
    be added to the bottom of identify_cpu()).
    
    Fixes: bb502a8ca592 ("x86: check feature flags after resume")
    Reported-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Tested-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 5ebd4dd14118e4eb24f1d409a7ca3773f77e7e41
    master date: 2026-03-24 12:05:42 +0100
---
 xen/arch/x86/cpu/common.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c
index 94afb07e8c..b26e71231a 100644
--- a/xen/arch/x86/cpu/common.c
+++ b/xen/arch/x86/cpu/common.c
@@ -613,16 +613,20 @@ void identify_cpu(struct cpuinfo_x86 *c)
 			       smp_processor_id());
 	}
 
-	if (system_state == SYS_STATE_resume)
-		return;
+	if (system_state == SYS_STATE_resume) {
+		unsigned int cpu = smp_processor_id();
 
+		/* The BSP has this done right from enter_state(). */
+		if (cpu)
+			mcheck_init(&cpu_data[cpu], false);
+	}
 	/*
 	 * On SMP, boot_cpu_data holds the common feature set between
 	 * all CPUs; so make sure that we indicate which features are
 	 * common between the CPUs.  The first time this routine gets
 	 * executed, c == &boot_cpu_data.
 	 */
-	if ( c != &boot_cpu_data ) {
+	else if (c != &boot_cpu_data) {
 		/* AND the already accumulated flags with these */
 		for ( i = 0 ; i < NCAPINTS ; i++ )
 			boot_cpu_data.x86_capability[i] &= c->x86_capability[i];
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Mar 26 13:33:05 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 26 Mar 2026 13:33:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1264152.1555867 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w5kpa-0002bg-Cz; Thu, 26 Mar 2026 13:33:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1264152.1555867; Thu, 26 Mar 2026 13:33:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w5kpa-0002bX-AB; Thu, 26 Mar 2026 13:33:02 +0000
Received: by outflank-mailman (input) for mailman id 1264152;
 Thu, 26 Mar 2026 13:33:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w5kpZ-0002bR-Fa
 for xen-changelog@lists.xenproject.org; Thu, 26 Mar 2026 13:33:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w5kpZ-00AbmK-20
 for xen-changelog@lists.xenproject.org;
 Thu, 26 Mar 2026 13:33:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w5kpZ-00H7Jb-19
 for xen-changelog@lists.xenproject.org;
 Thu, 26 Mar 2026 13:33:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=1cdZaQ/m3jU3JZ+8pl/ysEa6cx4xg6b4Z+VuwuTHvPw=; b=2dzy2xvi9W+fnB90UFR9lCVUct
	yi/IWh4RN95AlcANlCdOOObSBQUIQmRxKcRZHrUsnSY+CPqWE60HUbmRHIFZJydeOm6tWUQhauI47
	BZd7O85uJZu/cSQu0USBetqyyaBl72hf96sMGIGqzYIlI5X5TUm08YwM26qTfEgKYylU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] update Xen version to 4.19.5
Message-Id: <E1w5kpZ-00H7Jb-19@xenbits.xenproject.org>
Date: Thu, 26 Mar 2026 13:33:01 +0000

commit 7a15cde90e8fc21ca9ea225b16bef6f8e3839c7a
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 26 14:21:54 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 26 14:21:54 2026 +0100

    update Xen version to 4.19.5
---
 xen/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/Makefile b/xen/Makefile
index 4d34597522..683cb4bdac 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -6,7 +6,7 @@ this-makefile := $(call lastword,$(MAKEFILE_LIST))
 # All other places this is stored (eg. compile.h) should be autogenerated.
 export XEN_VERSION       = 4
 export XEN_SUBVERSION    = 19
-export XEN_EXTRAVERSION ?= .5-pre$(XEN_VENDORVERSION)
+export XEN_EXTRAVERSION ?= .5$(XEN_VENDORVERSION)
 export XEN_FULLVERSION   = $(XEN_VERSION).$(XEN_SUBVERSION)$(XEN_EXTRAVERSION)
 -include xen-version
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Mar 26 14:33:07 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 26 Mar 2026 14:33:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1264231.1555893 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w5lle-0004IM-Qj; Thu, 26 Mar 2026 14:33:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1264231.1555893; Thu, 26 Mar 2026 14:33:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w5lle-0004IE-Nt; Thu, 26 Mar 2026 14:33:02 +0000
Received: by outflank-mailman (input) for mailman id 1264231;
 Thu, 26 Mar 2026 14:33:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w5lld-0004I8-O3
 for xen-changelog@lists.xenproject.org; Thu, 26 Mar 2026 14:33:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w5lld-00Ad0j-2u
 for xen-changelog@lists.xenproject.org;
 Thu, 26 Mar 2026 14:33:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w5lld-00HBSf-1x
 for xen-changelog@lists.xenproject.org;
 Thu, 26 Mar 2026 14:33:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=36AXKvjFYSjvfblG1qnocBUvqidLF6/odegnjaVmzqA=; b=t+tSK4/rUPfrXy8LYTiAt+i3jT
	wuKCT/cmrzFIqzA25tqkJnqm7Mmt0/U1VODrrVjfrUuESgIhvXmkg1KJKgXxA6ovNOLbPU1pvmCc1
	BXAD0IOFz6pgjcqZtWryvVOBxJ0iLrzffXqFNYyHwyuSMGhRKjO7qYkyWcnAHhVxCyyA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] arinc653: overwrite entire .dom_handle[] for Dom0 slots
Message-Id: <E1w5lld-00HBSf-1x@xenbits.xenproject.org>
Date: Thu, 26 Mar 2026 14:33:01 +0000

commit 2a0ee29f5e6441b3c977ae8862842fd7c4da79d3
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 26 10:47:08 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 26 10:47:08 2026 +0100

    arinc653: overwrite entire .dom_handle[] for Dom0 slots
    
    When that code still lived in a653sched_init(), it was redundant with the
    earlier memset() / xzalloc(). Once moved, the full structure field needs
    setting, as dom_handle_cmp() uses memcmp() and arinc653_sched_set() may
    have clobbered entries. Rather than implying the handle to be all zero,
    copy the handle out of the domain structure.
    
    Fixes: 9f0c658baedc ("arinc: add cpu-pool support to scheduler")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Stewart Hildebrand <stewart@stew.dk>
---
 xen/common/sched/arinc653.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/xen/common/sched/arinc653.c b/xen/common/sched/arinc653.c
index 8a4f4259d8..bde15eb7e1 100644
--- a/xen/common/sched/arinc653.c
+++ b/xen/common/sched/arinc653.c
@@ -420,7 +420,9 @@ a653sched_alloc_udata(const struct scheduler *ops, struct sched_unit *unit,
 
         if ( entry < ARINC653_MAX_DOMAINS_PER_SCHEDULE )
         {
-            sched_priv->schedule[entry].dom_handle[0] = '\0';
+            memcpy(sched_priv->schedule[entry].dom_handle,
+                   unit->domain->handle,
+                   sizeof(sched_priv->schedule->dom_handle));
             sched_priv->schedule[entry].unit_id = unit->unit_id;
             sched_priv->schedule[entry].runtime = DEFAULT_TIMESLICE;
             sched_priv->schedule[entry].unit = unit;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Mar 26 14:33:13 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 26 Mar 2026 14:33:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1264232.1555895 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w5llp-0004Kj-Rc; Thu, 26 Mar 2026 14:33:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1264232.1555895; Thu, 26 Mar 2026 14:33:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w5llp-0004Kb-PB; Thu, 26 Mar 2026 14:33:13 +0000
Received: by outflank-mailman (input) for mailman id 1264232;
 Thu, 26 Mar 2026 14:33:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w5lln-0004KC-Q9
 for xen-changelog@lists.xenproject.org; Thu, 26 Mar 2026 14:33:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w5lln-00Ad0p-3C
 for xen-changelog@lists.xenproject.org;
 Thu, 26 Mar 2026 14:33:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w5lln-00HBTh-2P
 for xen-changelog@lists.xenproject.org;
 Thu, 26 Mar 2026 14:33:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=H7qIq1njwYyhw16eYccl6sxJUtMK/IphfCrLwHGaDLk=; b=k7vnyxWRoLSVm8NqFXkzlCsJPK
	v9mURaQV5nhj8yrytMZQvjfFxJsCloxhG9WkVzqnJ1oihQqXRbZOlPn1sFZPlpQHAXxz0ZCVQPDjK
	LhYJsQ6woOhVM8oUVxOwED1Go2mMT2B8s3YvuioqB6YdRWcdbWpgIEh449TPwhKehXFg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] arinc653: avoid array overrun
Message-Id: <E1w5lln-00HBTh-2P@xenbits.xenproject.org>
Date: Thu, 26 Mar 2026 14:33:11 +0000

commit 5a1121633f2ae97d96d3e66472cf373a6caa3d51
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 26 10:47:41 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 26 10:47:41 2026 +0100

    arinc653: avoid array overrun
    
    Incrementing ->sched_index between bounds check and array access may
    result in accessing one past the array when that is fully filled
    (->num_schedule_entries == ARINC653_MAX_DOMAINS_PER_SCHEDULE).
    
    Fixes: 22787f2e107c ("ARINC 653 scheduler")
    Reported-by: Kamil Frankowicz <kamil.frankowicz@cert.pl>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Stewart Hildebrand <stewart@stew.dk>
---
 xen/common/sched/arinc653.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/xen/common/sched/arinc653.c b/xen/common/sched/arinc653.c
index bde15eb7e1..c35bfbd04e 100644
--- a/xen/common/sched/arinc653.c
+++ b/xen/common/sched/arinc653.c
@@ -552,12 +552,9 @@ a653sched_do_schedule(
 
     /* Switch minor frame or find correct minor frame after a miss */
     while ( (now >= sched_priv->next_switch_time) &&
-        (sched_priv->sched_index < sched_priv->num_schedule_entries) )
-    {
-        sched_priv->sched_index++;
+            (++sched_priv->sched_index < sched_priv->num_schedule_entries) )
         sched_priv->next_switch_time +=
             sched_priv->schedule[sched_priv->sched_index].runtime;
-    }
 
     /*
      * If we exhausted the domains in the schedule and still have time left
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Mar 26 14:33:23 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 26 Mar 2026 14:33:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1264234.1555900 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w5llz-0004Mx-TR; Thu, 26 Mar 2026 14:33:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1264234.1555900; Thu, 26 Mar 2026 14:33:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w5llz-0004Mp-QY; Thu, 26 Mar 2026 14:33:23 +0000
Received: by outflank-mailman (input) for mailman id 1264234;
 Thu, 26 Mar 2026 14:33:21 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w5llx-0004Mg-Th
 for xen-changelog@lists.xenproject.org; Thu, 26 Mar 2026 14:33:21 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w5lly-00Ad1C-0I
 for xen-changelog@lists.xenproject.org;
 Thu, 26 Mar 2026 14:33:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w5llx-00HBUK-2h
 for xen-changelog@lists.xenproject.org;
 Thu, 26 Mar 2026 14:33:21 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=2SvxJn5M6h8O4lcdqL4NdFPobUtrpJT2SWALduTKb+M=; b=aZRXSJqSf7TppZqZ1DCA6qgCqr
	QsBljEPmNvjCTfjAui0tvWcDVXXJFYlNpQSZKg+hPlBerzqytaLhcgiJj+Xaz43r2/exluhNKse4h
	9HJQM71kqmdG6ympYlYCmvlvyfhY+caO7FolmOkN/Y/FuElNSOTwvgZObmZO9SbchQ44=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] MAINTAINERS: update my email
Message-Id: <E1w5llx-00HBUK-2h@xenbits.xenproject.org>
Date: Thu, 26 Mar 2026 14:33:21 +0000

commit 9f21a4dc1f3c19f4cecd5c6649c3ba3e73e74e41
Author:     Stewart Hildebrand <stewart.hildebrand@amd.com>
AuthorDate: Thu Mar 26 10:48:35 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 26 10:48:35 2026 +0100

    MAINTAINERS: update my email
    
    It's more convenient for me.
    
    Signed-off-by: Stewart Hildebrand <stewart.hildebrand@amd.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 MAINTAINERS | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index ccc25a0e55..1ac61da59a 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -248,7 +248,7 @@ F:	xen/common/argo.c
 
 ARINC653 SCHEDULER
 M:	Nathan Studer <nathan.studer@dornerworks.com>
-M:	Stewart Hildebrand <stewart@stew.dk>
+M:	Stewart Hildebrand <stewart.hildebrand@amd.com>
 S:	Supported
 L:	xen-devel@dornerworks.com
 F:	xen/common/sched/arinc653.c
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Mar 26 14:33:33 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 26 Mar 2026 14:33:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1264235.1555904 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w5lm9-0004Pk-Uf; Thu, 26 Mar 2026 14:33:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1264235.1555904; Thu, 26 Mar 2026 14:33:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w5lm9-0004Pc-Rw; Thu, 26 Mar 2026 14:33:33 +0000
Received: by outflank-mailman (input) for mailman id 1264235;
 Thu, 26 Mar 2026 14:33:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w5lm8-0004PB-04
 for xen-changelog@lists.xenproject.org; Thu, 26 Mar 2026 14:33:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w5lm8-00Ad1I-0Y
 for xen-changelog@lists.xenproject.org;
 Thu, 26 Mar 2026 14:33:31 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w5lm7-00HBVL-30
 for xen-changelog@lists.xenproject.org;
 Thu, 26 Mar 2026 14:33:31 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=nsk9/NAJVmOAk5ACm7GTS2GAjD8y1XlF6Py36RvSDx8=; b=EXaMkol0dtCiG8NaJ2gZaO+YPm
	JYGtXLta5luyxAtau/gTOeb+eIY9dz3pFGF+OTEpSdKHe30pFYdliXV5FVJ+Qk07CsMkgXmaV5a/a
	jhOrzu8HjVABI8liHpgrhBYwoKGcNGcxUG1awUYia3PxEA1suzWEcHK90Rhn0iXktl7Q=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] arinc653: remove idle period in default schedule
Message-Id: <E1w5lm7-00HBVL-30@xenbits.xenproject.org>
Date: Thu, 26 Mar 2026 14:33:31 +0000

commit 6d412c059982d821260055eaa43417b3245b2050
Author:     Stewart Hildebrand <stewart.hildebrand@amd.com>
AuthorDate: Thu Mar 26 10:49:11 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 26 10:49:11 2026 +0100

    arinc653: remove idle period in default schedule
    
    By initializing major_frame in a653sched_init(), an idle period was
    inadvertently introduced into the default schedule. Account for the
    initial value of major_frame when populating the default schedule.
    
    Fixes: f2927d8343ae ("xen/arinc653: fix delay in the start of major frame")
    Signed-off-by: Stewart Hildebrand <stewart.hildebrand@amd.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
---
 xen/common/sched/arinc653.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/common/sched/arinc653.c b/xen/common/sched/arinc653.c
index c35bfbd04e..19249f6464 100644
--- a/xen/common/sched/arinc653.c
+++ b/xen/common/sched/arinc653.c
@@ -427,7 +427,8 @@ a653sched_alloc_udata(const struct scheduler *ops, struct sched_unit *unit,
             sched_priv->schedule[entry].runtime = DEFAULT_TIMESLICE;
             sched_priv->schedule[entry].unit = unit;
 
-            sched_priv->major_frame += DEFAULT_TIMESLICE;
+            if ( entry )
+                sched_priv->major_frame += DEFAULT_TIMESLICE;
             ++sched_priv->num_schedule_entries;
         }
     }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Mar 26 15:33:09 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 26 Mar 2026 15:33:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1264322.1555926 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w5mhj-0005WP-HB; Thu, 26 Mar 2026 15:33:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1264322.1555926; Thu, 26 Mar 2026 15:33:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w5mhj-0005WH-EQ; Thu, 26 Mar 2026 15:33:03 +0000
Received: by outflank-mailman (input) for mailman id 1264322;
 Thu, 26 Mar 2026 15:33:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w5mhh-0005WB-Uq
 for xen-changelog@lists.xenproject.org; Thu, 26 Mar 2026 15:33:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w5mhi-00Ae7f-0C
 for xen-changelog@lists.xenproject.org;
 Thu, 26 Mar 2026 15:33:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w5mhh-00HHnx-2a
 for xen-changelog@lists.xenproject.org;
 Thu, 26 Mar 2026 15:33:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=H1/IqTdIh+ZSj4Eg/DSpLBV0Cr5KBtQKaSkjGTd8QpU=; b=Re+uLCp7Lu+O9uZDB3lnVRur56
	sSFS7E2UkF9DdGHlJngZr0xwr/m83Uy9XJj+xtgShMWuECn0VusSdBr70vetmGki2OPwYbc4cp1/I
	zhfbzZDm50wNLvaaj0XHG7T9coA0P2TLypIkkZrsxRyjkfJW1sIUG18wJED6IayqtRlA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.21] update Xen version to 4.21.1
Message-Id: <E1w5mhh-00HHnx-2a@xenbits.xenproject.org>
Date: Thu, 26 Mar 2026 15:33:01 +0000

commit f1a1e629d0cc4729d10e86104ce157732bcabaca
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 26 16:28:26 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 26 16:28:26 2026 +0100

    update Xen version to 4.21.1
---
 xen/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/Makefile b/xen/Makefile
index 1a54194a1e..d808267ce1 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -6,7 +6,7 @@ this-makefile := $(call lastword,$(MAKEFILE_LIST))
 # All other places this is stored (eg. compile.h) should be autogenerated.
 export XEN_VERSION       = 4
 export XEN_SUBVERSION    = 21
-export XEN_EXTRAVERSION ?= .1-pre$(XEN_VENDORVERSION)
+export XEN_EXTRAVERSION ?= .1$(XEN_VENDORVERSION)
 export XEN_FULLVERSION   = $(XEN_VERSION).$(XEN_SUBVERSION)$(XEN_EXTRAVERSION)
 -include xen-version
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.21


From xen-changelog-bounces@lists.xenproject.org Thu Mar 26 15:44:05 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 26 Mar 2026 15:44:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1264393.1555972 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w5msN-00018v-C8; Thu, 26 Mar 2026 15:44:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1264393.1555972; Thu, 26 Mar 2026 15:44:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w5msN-00018n-9S; Thu, 26 Mar 2026 15:44:03 +0000
Received: by outflank-mailman (input) for mailman id 1264393;
 Thu, 26 Mar 2026 15:44:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w5msM-00018h-9c
 for xen-changelog@lists.xenproject.org; Thu, 26 Mar 2026 15:44:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w5msM-00AeLt-1F
 for xen-changelog@lists.xenproject.org;
 Thu, 26 Mar 2026 15:44:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w5msM-00HJNZ-0Q
 for xen-changelog@lists.xenproject.org;
 Thu, 26 Mar 2026 15:44:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=x7e+DOH15t1cNtJ4tHppYvJwmu/pWziqp4A/v+Yr26Y=; b=NfNXLqxlwP/blmT9H8TNhKc95b
	rCL8hYT5hYvKvI3LfIgW9XiyxLJbCeFWyBOq2afjwYlM3sTFnOo1JJ5tjf2FWeVGRBOIbejf5Ihws
	D4sFz4SxiJez4aiJwBRQ7fHgNNX+W9MYWEfwdXrieYb7y9jlsLunhcDeWpxAhlYajWjk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.20] update Xen version to 4.20.3
Message-Id: <E1w5msM-00HJNZ-0Q@xenbits.xenproject.org>
Date: Thu, 26 Mar 2026 15:44:02 +0000

commit 14274673cbb499472f63b8ece772e8d88bf7d79b
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 26 14:04:44 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 26 14:04:44 2026 +0100

    update Xen version to 4.20.3
---
 xen/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/Makefile b/xen/Makefile
index 19d4e56bd2..90f493d74f 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -6,7 +6,7 @@ this-makefile := $(call lastword,$(MAKEFILE_LIST))
 # All other places this is stored (eg. compile.h) should be autogenerated.
 export XEN_VERSION       = 4
 export XEN_SUBVERSION    = 20
-export XEN_EXTRAVERSION ?= .3-pre$(XEN_VENDORVERSION)
+export XEN_EXTRAVERSION ?= .3$(XEN_VENDORVERSION)
 export XEN_FULLVERSION   = $(XEN_VERSION).$(XEN_SUBVERSION)$(XEN_EXTRAVERSION)
 -include xen-version
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.20


From xen-changelog-bounces@lists.xenproject.org Thu Mar 26 15:55:05 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 26 Mar 2026 15:55:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1264434.1555994 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w5n31-0003k0-KC; Thu, 26 Mar 2026 15:55:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1264434.1555994; Thu, 26 Mar 2026 15:55:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w5n31-0003js-Hi; Thu, 26 Mar 2026 15:55:03 +0000
Received: by outflank-mailman (input) for mailman id 1264434;
 Thu, 26 Mar 2026 15:55:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w5n30-0003jk-3k
 for xen-changelog@lists.xenproject.org; Thu, 26 Mar 2026 15:55:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w5n30-00AeZm-0m
 for xen-changelog@lists.xenproject.org;
 Thu, 26 Mar 2026 15:55:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w5n2z-00HKaB-3D
 for xen-changelog@lists.xenproject.org;
 Thu, 26 Mar 2026 15:55:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Fieza7e+/8HYj7sgJ/v3QCxNXV24asiky+9adb78yDI=; b=gkLxMpcxCiuq98uqYvsMtGUves
	Rl4qrfLV4+68uepQ3AFuioIx7Az8ypXzsTyA7FyqIYh/7DJBTfO3U6UJIzytnhrkpxfi9wk/Sw001
	1biS6kPQCFe33NfeIAWm3nJyRjgWfnWnDBcIe85M9VHKP6jiaS3ugLmy7Z3SSziLmxSQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] update Xen version to 4.19.5
Message-Id: <E1w5n2z-00HKaB-3D@xenbits.xenproject.org>
Date: Thu, 26 Mar 2026 15:55:01 +0000

commit 7a15cde90e8fc21ca9ea225b16bef6f8e3839c7a
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 26 14:21:54 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 26 14:21:54 2026 +0100

    update Xen version to 4.19.5
---
 xen/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/Makefile b/xen/Makefile
index 4d34597522..683cb4bdac 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -6,7 +6,7 @@ this-makefile := $(call lastword,$(MAKEFILE_LIST))
 # All other places this is stored (eg. compile.h) should be autogenerated.
 export XEN_VERSION       = 4
 export XEN_SUBVERSION    = 19
-export XEN_EXTRAVERSION ?= .5-pre$(XEN_VENDORVERSION)
+export XEN_EXTRAVERSION ?= .5$(XEN_VENDORVERSION)
 export XEN_FULLVERSION   = $(XEN_VERSION).$(XEN_SUBVERSION)$(XEN_EXTRAVERSION)
 -include xen-version
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Mar 26 16:44:12 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 26 Mar 2026 16:44:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1264525.1556035 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w5noQ-0005a7-RV; Thu, 26 Mar 2026 16:44:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1264525.1556035; Thu, 26 Mar 2026 16:44:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w5noQ-0005Zz-O0; Thu, 26 Mar 2026 16:44:02 +0000
Received: by outflank-mailman (input) for mailman id 1264525;
 Thu, 26 Mar 2026 16:44:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w5noP-0005Zt-Ly
 for xen-changelog@lists.xenproject.org; Thu, 26 Mar 2026 16:44:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w5noP-00Ag44-2d
 for xen-changelog@lists.xenproject.org;
 Thu, 26 Mar 2026 16:44:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w5noP-00HQ46-1m
 for xen-changelog@lists.xenproject.org;
 Thu, 26 Mar 2026 16:44:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=FZU2l0/CHUpAFbsX1a3aD9dZjCCgp/YIoOCltC89nJk=; b=onf1LaO0wHTYO5PqYtA2I4iJck
	eBumvkROGf/Ds02YK9WyFX4M/y6ke7CDScGBYLQYEVpe+/MMKshVisAyY/EGBgJbIlum0uDc6ja/N
	Onco22MpYGm+H0Vrx3OFKHvWOLI1X8jqrj65bQ5go1IKkcZUqqSIHU72vIAEP/vVjHoM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.21] update Xen version to 4.21.1
Message-Id: <E1w5noP-00HQ46-1m@xenbits.xenproject.org>
Date: Thu, 26 Mar 2026 16:44:01 +0000

commit f1a1e629d0cc4729d10e86104ce157732bcabaca
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 26 16:28:26 2026 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 26 16:28:26 2026 +0100

    update Xen version to 4.21.1
---
 xen/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/Makefile b/xen/Makefile
index 1a54194a1e..d808267ce1 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -6,7 +6,7 @@ this-makefile := $(call lastword,$(MAKEFILE_LIST))
 # All other places this is stored (eg. compile.h) should be autogenerated.
 export XEN_VERSION       = 4
 export XEN_SUBVERSION    = 21
-export XEN_EXTRAVERSION ?= .1-pre$(XEN_VENDORVERSION)
+export XEN_EXTRAVERSION ?= .1$(XEN_VENDORVERSION)
 export XEN_FULLVERSION   = $(XEN_VERSION).$(XEN_SUBVERSION)$(XEN_EXTRAVERSION)
 -include xen-version
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.21


From xen-changelog-bounces@lists.xenproject.org Fri Mar 27 13:33:10 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 27 Mar 2026 13:33:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1265644.1556429 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w67J9-0000sQ-Vg; Fri, 27 Mar 2026 13:33:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1265644.1556429; Fri, 27 Mar 2026 13:33:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w67J9-0000sI-S1; Fri, 27 Mar 2026 13:33:03 +0000
Received: by outflank-mailman (input) for mailman id 1265644;
 Fri, 27 Mar 2026 13:33:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w67J8-0000sC-3g
 for xen-changelog@lists.xenproject.org; Fri, 27 Mar 2026 13:33:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w67J8-00CHeT-0n
 for xen-changelog@lists.xenproject.org;
 Fri, 27 Mar 2026 13:33:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w67J7-002myZ-39
 for xen-changelog@lists.xenproject.org;
 Fri, 27 Mar 2026 13:33:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=wkTzcYcskO0oq5G3SIvt/2qpuCIbtTvNQBk+Ob8uToo=; b=ha/RPZg60dVJQmGKlbHTRbkYJp
	7AdT/JIQsyhTyY7nYK3C8iLpWJ82T+6ASWv3XyTfmiLIoKa1MbxLUoECrl7OzZniK9E9QMS8pkWro
	fZhpnlMT5d6xZWTDv/qWt01Zm/UzBPJWD5aJdzO1bOZpNZp1K+zR2DR/qPBff0+721iM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/libs/store: add get- and set-quota related functions
Message-Id: <E1w67J7-002myZ-39@xenbits.xenproject.org>
Date: Fri, 27 Mar 2026 13:33:01 +0000

commit ba9058944748af22bcc438f5b6cf105be7c88cdd
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Fri Mar 20 16:01:09 2026 +0100
Commit:     Anthony PERARD <anthony.perard@vates.tech>
CommitDate: Fri Mar 27 12:06:37 2026 +0100

    tools/libs/store: add get- and set-quota related functions
    
    Add functions for getting and setting Xenstore quota to libxenstore:
    
    xs_get_quota_names(): get the names of the supported quota.
    
    xs_get_global_quota(): get the value of one global quota.
    
    xs_set_global_quota(): set the value of one global quota.
    
    xs_get_domain_quota(): get the value of one quota of a domain.
    
    xs_set_domain_quota(): set the value of one quota of a domain.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
---
 tools/include/xenstore.h         |  37 +++++++++++++
 tools/libs/store/Makefile        |   2 +-
 tools/libs/store/libxenstore.map |   8 +++
 tools/libs/store/xs.c            | 111 +++++++++++++++++++++++++++++++++++++++
 4 files changed, 157 insertions(+), 1 deletion(-)

diff --git a/tools/include/xenstore.h b/tools/include/xenstore.h
index 423422dc50..bf6d767a22 100644
--- a/tools/include/xenstore.h
+++ b/tools/include/xenstore.h
@@ -277,6 +277,43 @@ bool xs_get_features_domain(struct xs_handle *h, unsigned int domid,
 bool xs_set_features_domain(struct xs_handle *h, unsigned int domid,
 			    unsigned int features);
 
+/* Get names of supported quota.
+ * Returns an array of quota names supported by Xenstore. On return
+ * num will contain the number of quota names in the array.
+ * Will return NULL on failure.
+ * The returned array should be freed via free() after usage, this will
+ * free the array AND the strings of the quota names.
+ */
+const char **xs_get_quota_names(struct xs_handle *h, unsigned int *num);
+
+/* Get the value of one global quota.
+ * Returns the global quota value specified by "quota" in "value".
+ * Return false on failure.
+ */
+bool xs_get_global_quota(struct xs_handle *h, const char *quota,
+			 unsigned int *value);
+
+/* Set the value of one global quota.
+ * Sets the global quota value specified by "quota" to "value".
+ * Return false on failure.
+ */
+bool xs_set_global_quota(struct xs_handle *h, const char *quota,
+			 unsigned int value);
+
+/* Get the value of one domain quota.
+ * Returns a domain's quota value specified by "quota" in "value".
+ * Return false on failure.
+ */
+bool xs_get_domain_quota(struct xs_handle *h, unsigned int domid,
+			 const char *quota, unsigned int *value);
+
+/* Set the value of one domain quota.
+ * Sets a domain's quota value specified by "quota" to "value".
+ * Return false on failure.
+ */
+bool xs_set_domain_quota(struct xs_handle *h, unsigned int domid,
+			 const char *quota, unsigned int value);
+
 char *xs_control_command(struct xs_handle *h, const char *cmd,
 			 void *data, unsigned int len);
 /* Deprecated: use xs_control_command() instead. */
diff --git a/tools/libs/store/Makefile b/tools/libs/store/Makefile
index fed43b0008..b52d1f35ad 100644
--- a/tools/libs/store/Makefile
+++ b/tools/libs/store/Makefile
@@ -2,7 +2,7 @@ XEN_ROOT=$(CURDIR)/../../..
 include $(XEN_ROOT)/tools/Rules.mk
 
 MAJOR = 4
-MINOR = 1
+MINOR = 2
 version-script := libxenstore.map
 
 ifeq ($(CONFIG_Linux),y)
diff --git a/tools/libs/store/libxenstore.map b/tools/libs/store/libxenstore.map
index cd9df86749..a08ddd549f 100644
--- a/tools/libs/store/libxenstore.map
+++ b/tools/libs/store/libxenstore.map
@@ -45,3 +45,11 @@ VERS_4.1 {
 		xs_get_features_domain;
 		xs_set_features_domain;
 } VERS_4.0;
+VERS_4.2 {
+	global:
+		xs_get_quota_names;
+		xs_get_global_quota;
+		xs_set_global_quota;
+		xs_get_domain_quota;
+		xs_set_domain_quota;
+} VERS_4.1;
diff --git a/tools/libs/store/xs.c b/tools/libs/store/xs.c
index 8f4b90a3cf..06462445e0 100644
--- a/tools/libs/store/xs.c
+++ b/tools/libs/store/xs.c
@@ -1456,6 +1456,117 @@ bool xs_set_features_domain(struct xs_handle *h, unsigned int domid,
 	return xs_bool(xs_talkv(h, iov, ARRAY_SIZE(iov), NULL));
 }
 
+const char **xs_get_quota_names(struct xs_handle *h, unsigned int *num)
+{
+	struct xsd_sockmsg msg = { .type = XS_GET_QUOTA };
+	struct iovec iov[1];
+	const char **quota;
+	char *reply;
+	char *c;
+	unsigned int i;
+
+	iov[0].iov_base = &msg;
+	iov[0].iov_len  = sizeof(msg);
+
+	reply = xs_talkv(h, iov, ARRAY_SIZE(iov), NULL);
+	if (!reply)
+		return NULL;
+
+	*num = 1;
+	for (c = reply; *c; c++)
+		if (*c == ' ')
+			(*num)++;
+
+	quota = malloc(*num * sizeof(char *) + strlen(reply) + 1);
+	c = (char *)(quota + *num);
+	strcpy(c, reply);
+	for (i = 0; i < *num; i++) {
+		quota[i] = c;
+		c = strchr(c, ' ');
+		if (c) {
+			*c = 0;
+			c++;
+		}
+	}
+
+	return quota;
+}
+
+bool xs_get_global_quota(struct xs_handle *h, const char *quota,
+			 unsigned int *value)
+{
+	struct xsd_sockmsg msg = { .type = XS_GET_QUOTA };
+	struct iovec iov[2];
+
+	iov[0].iov_base = &msg;
+	iov[0].iov_len  = sizeof(msg);
+	iov[1].iov_base = (char *)quota;
+	iov[1].iov_len  = strlen(quota) + 1;
+
+	return xs_uint(xs_talkv(h, iov, ARRAY_SIZE(iov), NULL), value);
+}
+
+bool xs_set_global_quota(struct xs_handle *h, const char *quota,
+			 unsigned int value)
+{
+	struct xsd_sockmsg msg = { .type = XS_SET_QUOTA };
+	char val_str[MAX_STRLEN(value)];
+	struct iovec iov[3];
+
+	snprintf(val_str, sizeof(val_str), "%u", value);
+
+	iov[0].iov_base = &msg;
+	iov[0].iov_len  = sizeof(msg);
+	iov[1].iov_base = (char *)quota;
+	iov[1].iov_len  = strlen(quota) + 1;
+	iov[2].iov_base = val_str;
+	iov[2].iov_len  = strlen(val_str) + 1;
+
+	return xs_bool(xs_talkv(h, iov, ARRAY_SIZE(iov), NULL));
+}
+
+bool xs_get_domain_quota(struct xs_handle *h, unsigned int domid,
+			 const char *quota, unsigned int *value)
+{
+	struct xsd_sockmsg msg = { .type = XS_GET_QUOTA };
+	char domid_str[MAX_STRLEN(domid)];
+	struct iovec iov[3];
+
+	snprintf(domid_str, sizeof(domid_str), "%u", domid);
+
+	iov[0].iov_base = &msg;
+	iov[0].iov_len  = sizeof(msg);
+	iov[1].iov_base = domid_str;
+	iov[1].iov_len  = strlen(domid_str) + 1;
+	iov[2].iov_base = (char *)quota;
+	iov[2].iov_len  = strlen(quota) + 1;
+
+	return xs_uint(xs_talkv(h, iov, ARRAY_SIZE(iov), NULL), value);
+}
+
+bool xs_set_domain_quota(struct xs_handle *h, unsigned int domid,
+			 const char *quota, unsigned int value)
+{
+	struct xsd_sockmsg msg = { .type = XS_SET_QUOTA };
+	char domid_str[MAX_STRLEN(domid)];
+	char val_str[MAX_STRLEN(value)];
+	struct iovec iov[4];
+
+	snprintf(domid_str, sizeof(domid_str), "%u", domid);
+	snprintf(val_str, sizeof(val_str), "%u", value);
+
+	iov[0].iov_base = &msg;
+	iov[0].iov_len  = sizeof(msg);
+	iov[1].iov_base = domid_str;
+	iov[1].iov_len  = strlen(domid_str) + 1;
+	iov[2].iov_base = (char *)quota;
+	iov[2].iov_len  = strlen(quota) + 1;
+	iov[3].iov_base = val_str;
+	iov[3].iov_len  = strlen(val_str) + 1;
+
+	return xs_bool(xs_talkv(h, iov, ARRAY_SIZE(iov), NULL));
+}
+
 char *xs_control_command(struct xs_handle *h, const char *cmd,
 			 void *data, unsigned int len)
 {
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Mar 27 13:33:14 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 27 Mar 2026 13:33:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1265645.1556432 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w67JJ-0000u7-W0; Fri, 27 Mar 2026 13:33:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1265645.1556432; Fri, 27 Mar 2026 13:33:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w67JJ-0000tz-TR; Fri, 27 Mar 2026 13:33:13 +0000
Received: by outflank-mailman (input) for mailman id 1265645;
 Fri, 27 Mar 2026 13:33:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w67JI-0000tn-64
 for xen-changelog@lists.xenproject.org; Fri, 27 Mar 2026 13:33:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w67JI-00CHer-19
 for xen-changelog@lists.xenproject.org;
 Fri, 27 Mar 2026 13:33:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w67JI-002n0C-0J
 for xen-changelog@lists.xenproject.org;
 Fri, 27 Mar 2026 13:33:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=fubkYSkB+GkFQ+a5Lh9Tq4X1/ovOatc1NMx2iC42YLk=; b=ob8EEpp9roPTqJwIrb8QDZIrca
	S3Jtj0Z5Rwt6lj7A4JYwqWfvWFVGVfjbfPMztdtS40U3RoUnw0VjYpEnQ77etOAVQbqZ8AeHCg/91
	r78ZSbg4ucARhwqLv7K2gg63E7cuxMAwPeo3xunEGbDtDimCOVXuRlYePkjSf92X8Rdw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/xenstored: add helper to parse domid
Message-Id: <E1w67JI-002n0C-0J@xenbits.xenproject.org>
Date: Fri, 27 Mar 2026 13:33:12 +0000

commit f8402a98b4fe345d403bd35166c33e8c6fda63b7
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Fri Mar 20 16:01:10 2026 +0100
Commit:     Anthony PERARD <anthony.perard@vates.tech>
CommitDate: Fri Mar 27 12:06:37 2026 +0100

    tools/xenstored: add helper to parse domid
    
    Today a domid passed in by a command is parsed using atoi(). This
    will still "succeed" even with a domid like "x", resulting in "0" to
    be used instead.
    
    Use a common domid parser instead rejecting everything but integers
    in the range 0..65535 like specified in docs/misc/xenstore.txt.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
---
 tools/xenstored/domain.c | 47 +++++++++++++++++++++++++++++++++++++++--------
 1 file changed, 39 insertions(+), 8 deletions(-)

diff --git a/tools/xenstored/domain.c b/tools/xenstored/domain.c
index e453b3061f..a70acddf94 100644
--- a/tools/xenstored/domain.c
+++ b/tools/xenstored/domain.c
@@ -732,6 +732,18 @@ static char *talloc_domain_path(const void *context, unsigned int domid)
 	return talloc_asprintf(context, "/local/domain/%u", domid);
 }
 
+/* Parse a domid. Sets errno either to 0 or EINVAL. */
+static unsigned int parse_domid(const char *input)
+{
+	unsigned long domid;
+	char *endptr;
+
+	domid = strtoul(input, &endptr, 10);
+	errno = (*endptr != 0 || domid > 65535) ? EINVAL : 0;
+
+	return domid;
+}
+
 int domain_get_quota(const void *ctx, struct connection *conn,
 		     unsigned int domid)
 {
@@ -1077,7 +1089,10 @@ int do_introduce(const void *ctx, struct connection *conn,
 	if (get_strings(in, vec, ARRAY_SIZE(vec)) < ARRAY_SIZE(vec))
 		return EINVAL;
 
-	domid = atoi(vec[0]);
+	domid = parse_domid(vec[0]);
+	if (errno)
+		return errno;
+
 	/* Ignore the gfn, we don't need it. */
 	port = atoi(vec[2]);
 
@@ -1124,8 +1139,12 @@ int do_set_target(const void *ctx, struct connection *conn,
 	if (get_strings(in, vec, ARRAY_SIZE(vec)) < ARRAY_SIZE(vec))
 		return EINVAL;
 
-	domid = atoi(vec[0]);
-	tdomid = atoi(vec[1]);
+	domid = parse_domid(vec[0]);
+	if (errno)
+		return errno;
+	tdomid = parse_domid(vec[1]);
+	if (errno)
+		return errno;
 
         domain = find_connected_domain(domid);
 	if (IS_ERR(domain))
@@ -1152,7 +1171,9 @@ static struct domain *onearg_domain(struct connection *conn,
 	if (!domid_str)
 		return ERR_PTR(-EINVAL);
 
-	domid = atoi(domid_str);
+	domid = parse_domid(domid_str);
+	if (errno)
+		return ERR_PTR(-errno);
 	if (domid == store_domid || domid == priv_domid)
 		return ERR_PTR(-EINVAL);
 
@@ -1200,11 +1221,15 @@ int do_get_domain_path(const void *ctx, struct connection *conn,
 {
 	char *path;
 	const char *domid_str = onearg(in);
+	unsigned int domid;
 
 	if (!domid_str)
 		return EINVAL;
 
-	path = talloc_domain_path(ctx, atoi(domid_str));
+	domid = parse_domid(domid_str);
+	if (errno)
+		return errno;
+	path = talloc_domain_path(ctx, domid);
 	if (!path)
 		return errno;
 
@@ -1223,7 +1248,9 @@ int do_is_domain_introduced(const void *ctx, struct connection *conn,
 	if (!domid_str)
 		return EINVAL;
 
-	domid = atoi(domid_str);
+	domid = parse_domid(domid_str);
+	if (errno)
+		return errno;
 	if (domid == DOMID_SELF)
 		result = 1;
 	else
@@ -1261,7 +1288,9 @@ int do_get_feature(const void *ctx, struct connection *conn,
 		return EINVAL;
 
 	if (n_args == 1) {
-		domid = atoi(vec[0]);
+		domid = parse_domid(vec[0]);
+		if (errno)
+			return errno;
 		domain = find_or_alloc_existing_domain(domid);
 		if (!domain)
 			return ENOENT;
@@ -1289,7 +1318,9 @@ int do_set_feature(const void *ctx, struct connection *conn,
 	if (get_strings(in, vec, ARRAY_SIZE(vec)) != ARRAY_SIZE(vec))
 		return EINVAL;
 
-	domid = atoi(vec[0]);
+	domid = parse_domid(vec[0]);
+	if (errno)
+		return errno;
 	features = atoi(vec[1]);
 	domain = find_or_alloc_existing_domain(domid);
 	if (!domain)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Mar 27 13:33:24 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 27 Mar 2026 13:33:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1265646.1556436 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w67JU-0000wt-1W; Fri, 27 Mar 2026 13:33:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1265646.1556436; Fri, 27 Mar 2026 13:33:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w67JT-0000wl-Us; Fri, 27 Mar 2026 13:33:23 +0000
Received: by outflank-mailman (input) for mailman id 1265646;
 Fri, 27 Mar 2026 13:33:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w67JS-0000wc-9J
 for xen-changelog@lists.xenproject.org; Fri, 27 Mar 2026 13:33:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w67JS-00CHfI-1Q
 for xen-changelog@lists.xenproject.org;
 Fri, 27 Mar 2026 13:33:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w67JS-002n3O-0e
 for xen-changelog@lists.xenproject.org;
 Fri, 27 Mar 2026 13:33:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=pWArCUC1JsB4jhquzYRRIOlCvQ/dSEB2wjvJRnyqt1U=; b=WAhLk8XK3kPfPlRKsHs8nzzISt
	DK1slMshFKkUbsM2TSY67y/Ce0SErJGqu6eYgsyniQt9K5h6MjGWCPWGHNKr+CK1NmMTYd7XVzgNQ
	i/A+t7qYZLPavJV9pWhNZS6XK2IoBYiuDU6DzSVr1aWttfKO0MH6Dvlf7IVug9V8M/ek=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/xenstored: add central quota check functions
Message-Id: <E1w67JS-002n3O-0e@xenbits.xenproject.org>
Date: Fri, 27 Mar 2026 13:33:22 +0000

commit 70fcc2531c353b50f564309aa43bf7efd98021d1
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Fri Mar 20 16:01:11 2026 +0100
Commit:     Anthony PERARD <anthony.perard@vates.tech>
CommitDate: Fri Mar 27 12:06:37 2026 +0100

    tools/xenstored: add central quota check functions
    
    Add central functions for checking a value (either an absolute one or
    the current domain value plus an offset) against a specific quota.
    
    This is in preparation of introducing per-domain quota.
    
    The required changes allow to drop the "update" parameter from
    domain_nbentry_fix().
    
    While at it, make the returned error for exceeded quota consistent by
    changing one instance from "E2BIG" to "ENOSPC".
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
---
 tools/xenstored/core.c        |  4 +--
 tools/xenstored/domain.c      | 74 ++++++++++++++++++++-----------------------
 tools/xenstored/domain.h      |  6 ++--
 tools/xenstored/transaction.c |  2 +-
 tools/xenstored/watch.c       |  4 +--
 5 files changed, 42 insertions(+), 48 deletions(-)

diff --git a/tools/xenstored/core.c b/tools/xenstored/core.c
index e4d2fd4876..e86d947be4 100644
--- a/tools/xenstored/core.c
+++ b/tools/xenstored/core.c
@@ -1539,7 +1539,7 @@ static struct node *create_node(struct connection *conn, const void *ctx,
 	for (i = node; i; i = i->parent) {
 		/* i->parent is set for each new node, so check quota. */
 		if (i->parent &&
-		    domain_nbentry(conn) >= hard_quotas[ACC_NODES].val) {
+		    domain_quota_add_exceeds(conn->domain, ACC_NODES, 1)) {
 			ret = ENOSPC;
 			goto err;
 		}
@@ -2321,7 +2321,7 @@ void setup_structure(bool live_update)
 		manual_node("/tool/xenstored", NULL);
 		manual_node("@releaseDomain", NULL);
 		manual_node("@introduceDomain", NULL);
-		domain_nbentry_fix(priv_domid, 5, true);
+		domain_nbentry_fix(priv_domid, 5);
 	}
 }
 
diff --git a/tools/xenstored/domain.c b/tools/xenstored/domain.c
index a70acddf94..21f6f13f83 100644
--- a/tools/xenstored/domain.c
+++ b/tools/xenstored/domain.c
@@ -389,6 +389,25 @@ void wrl_apply_debit_trans_commit(struct connection *conn)
 	wrl_apply_debit_actual(conn->domain);
 }
 
+static bool domain_quota_val_exceeds(struct domain *d, enum accitem what,
+				     unsigned int val)
+{
+	unsigned int quota = hard_quotas[what].val;
+
+	if (!quota || !domid_is_unprivileged(d->domid))
+		return false;
+
+	return val >= quota;
+}
+
+bool domain_quota_add_exceeds(struct domain *d, enum accitem what, int add)
+{
+	if (add < 0 || !d)
+		return false;
+
+	return domain_quota_val_exceeds(d, what, d->acc[what].val + add);
+}
+
 static bool check_indexes(XENSTORE_RING_IDX cons, XENSTORE_RING_IDX prod)
 {
 	return ((prod - cons) <= XENSTORE_RING_SIZE);
@@ -490,10 +509,9 @@ static bool domain_can_read(struct connection *conn)
 	if (domain_is_unprivileged(conn)) {
 		if (domain->wrl_credit < 0)
 			return false;
-		if (domain->acc[ACC_OUTST].val >= hard_quotas[ACC_OUTST].val)
+		if (domain_quota_add_exceeds(domain, ACC_OUTST, 0))
 			return false;
-		if (domain->acc[ACC_MEM].val >= hard_quotas[ACC_MEM].val &&
-		    hard_quotas[ACC_MEM].val)
+		if (domain_quota_add_exceeds(domain, ACC_MEM, 0))
 			return false;
 	}
 
@@ -916,16 +934,20 @@ do {						\
 
 int acc_fix_domains(struct list_head *head, bool chk_quota, bool update)
 {
+	struct domain *d;
 	struct changed_domain *cd;
-	int cnt;
 
 	list_for_each_entry(cd, head, list) {
-		cnt = domain_nbentry_fix(cd->domid, cd->acc[ACC_NODES], update);
-		if (!update) {
-			if (chk_quota && cnt >= hard_quotas[ACC_NODES].val)
-				return ENOSPC;
-			if (cnt < 0)
+		if (update) {
+			domain_nbentry_fix(cd->domid, cd->acc[ACC_NODES]);
+		} else if (chk_quota) {
+			d = find_or_alloc_existing_domain(cd->domid);
+
+			if (!d)
 				return ENOMEM;
+			if (domain_quota_add_exceeds(d, ACC_NODES,
+						     cd->acc[ACC_NODES]))
+				return ENOSPC;
 		}
 	}
 
@@ -1763,7 +1785,7 @@ bool domain_max_chk(const struct connection *conn, enum accitem what,
 	if (!conn || !conn->domain)
 		return false;
 
-	if (domain_is_unprivileged(conn) && val > hard_quotas[what].val)
+	if (domain_quota_val_exceeds(conn->domain, what, val))
 		return true;
 
 	domain_acc_valid_max(conn->domain, what, val);
@@ -1783,21 +1805,9 @@ int domain_nbentry_dec(struct connection *conn, unsigned int domid)
 	       ? errno : 0;
 }
 
-int domain_nbentry_fix(unsigned int domid, int num, bool update)
-{
-	int ret;
-
-	ret = domain_acc_add(NULL, domid, ACC_NODES, update ? num : 0, update);
-	if (ret < 0 || update)
-		return ret;
-
-	return domid_is_unprivileged(domid) ? ret + num : 0;
-}
-
-unsigned int domain_nbentry(struct connection *conn)
+int domain_nbentry_fix(unsigned int domid, int num)
 {
-	return domain_is_unprivileged(conn)
-	       ? domain_acc_add(conn, conn->id, ACC_NODES, 0, true) : 0;
+	return domain_acc_add(NULL, domid, ACC_NODES, num, true);
 }
 
 static bool domain_chk_quota(struct connection *conn, unsigned int mem)
@@ -1812,7 +1822,7 @@ static bool domain_chk_quota(struct connection *conn, unsigned int mem)
 	domain = conn->domain;
 	now = time(NULL);
 
-	if (mem >= hard_quotas[ACC_MEM].val && hard_quotas[ACC_MEM].val) {
+	if (domain_quota_val_exceeds(domain, ACC_MEM, mem)) {
 		if (domain->hard_quota_reported)
 			return true;
 		syslog(LOG_ERR, "Domain %u exceeds hard memory quota, Xenstore interface to domain stalled\n",
@@ -1888,13 +1898,6 @@ void domain_watch_dec(struct connection *conn)
 	domain_acc_add(conn, conn->id, ACC_WATCH, -1, true);
 }
 
-int domain_watch(struct connection *conn)
-{
-	return (domain_is_unprivileged(conn))
-		? domain_acc_add(conn, conn->id, ACC_WATCH, 0, true)
-		: 0;
-}
-
 void domain_outstanding_inc(struct connection *conn)
 {
 	domain_acc_add(conn, conn->id, ACC_OUTST, 1, true);
@@ -1915,13 +1918,6 @@ void domain_transaction_dec(struct connection *conn)
 	domain_acc_add(conn, conn->id, ACC_TRANS, -1, true);
 }
 
-unsigned int domain_transaction_get(struct connection *conn)
-{
-	return (domain_is_unprivileged(conn))
-		? domain_acc_add(conn, conn->id, ACC_TRANS, 0, true)
-		: 0;
-}
-
 const char *dump_state_connections(FILE *fp)
 {
 	const char *ret = NULL;
diff --git a/tools/xenstored/domain.h b/tools/xenstored/domain.h
index 28186ccac0..29b91fc783 100644
--- a/tools/xenstored/domain.h
+++ b/tools/xenstored/domain.h
@@ -113,8 +113,7 @@ int domain_alloc_permrefs(struct node_perms *perms);
 /* Quota manipulation */
 int domain_nbentry_inc(struct connection *conn, unsigned int domid);
 int domain_nbentry_dec(struct connection *conn, unsigned int domid);
-int domain_nbentry_fix(unsigned int domid, int num, bool update);
-unsigned int domain_nbentry(struct connection *conn);
+int domain_nbentry_fix(unsigned int domid, int num);
 int domain_memory_add(struct connection *conn, unsigned int domid, int mem,
 		      bool no_quota_check);
 
@@ -141,12 +140,10 @@ static inline void domain_memory_add_nochk(struct connection *conn,
 }
 void domain_watch_inc(struct connection *conn);
 void domain_watch_dec(struct connection *conn);
-int domain_watch(struct connection *conn);
 void domain_outstanding_inc(struct connection *conn);
 void domain_outstanding_dec(struct connection *conn, unsigned int domid);
 void domain_transaction_inc(struct connection *conn);
 void domain_transaction_dec(struct connection *conn);
-unsigned int domain_transaction_get(struct connection *conn);
 int domain_get_quota(const void *ctx, struct connection *conn,
 		     unsigned int domid);
 
@@ -161,6 +158,7 @@ int domain_max_global_acc(const void *ctx, struct connection *conn);
 void domain_reset_global_acc(void);
 bool domain_max_chk(const struct connection *conn, enum accitem what,
 		    unsigned int val);
+bool domain_quota_add_exceeds(struct domain *d, enum accitem what, int add);
 
 extern long wrl_ntransactions;
 
diff --git a/tools/xenstored/transaction.c b/tools/xenstored/transaction.c
index 167cd597fd..47cd6ecd3c 100644
--- a/tools/xenstored/transaction.c
+++ b/tools/xenstored/transaction.c
@@ -470,7 +470,7 @@ int do_transaction_start(const void *ctx, struct connection *conn,
 	if (conn->transaction)
 		return EBUSY;
 
-	if (domain_transaction_get(conn) > hard_quotas[ACC_TRANS].val)
+	if (domain_quota_add_exceeds(conn->domain, ACC_TRANS, 1))
 		return ENOSPC;
 
 	/* Attach transaction to ctx for autofree until it's complete */
diff --git a/tools/xenstored/watch.c b/tools/xenstored/watch.c
index b66a9f1a39..becb9c339d 100644
--- a/tools/xenstored/watch.c
+++ b/tools/xenstored/watch.c
@@ -220,8 +220,8 @@ int do_watch(const void *ctx, struct connection *conn, struct buffered_data *in)
 			return EEXIST;
 	}
 
-	if (domain_watch(conn) > hard_quotas[ACC_WATCH].val)
-		return E2BIG;
+	if (domain_quota_add_exceeds(conn->domain, ACC_WATCH, 1))
+		return ENOSPC;
 
 	watch = add_watch(conn, vec[0], vec[1], relative, false);
 	if (!watch)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Mar 27 13:33:34 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 27 Mar 2026 13:33:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1265648.1556440 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w67Je-0000z2-41; Fri, 27 Mar 2026 13:33:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1265648.1556440; Fri, 27 Mar 2026 13:33:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w67Je-0000yv-06; Fri, 27 Mar 2026 13:33:34 +0000
Received: by outflank-mailman (input) for mailman id 1265648;
 Fri, 27 Mar 2026 13:33:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w67Jc-0000ym-BT
 for xen-changelog@lists.xenproject.org; Fri, 27 Mar 2026 13:33:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w67Jc-00CHfu-1j
 for xen-changelog@lists.xenproject.org;
 Fri, 27 Mar 2026 13:33:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w67Jc-002n53-0w
 for xen-changelog@lists.xenproject.org;
 Fri, 27 Mar 2026 13:33:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=wVB6sNcaKI+lEz2cOC1X+H7ZlMVcq6KrGk5TI9qsMbo=; b=HJHg0fHwWcUVVvEBU/qyKxMLi9
	hlQQbWFaYAzgacXDVGSjo36LQfocW26XRJtiayWoXJzg9WLP5EHAnaarSwET80gYs1nRgVp1iW8/z
	O4SpAdXKanAg31yWRna56mY/w5I3TxVGthJ6iaiHPNZQk20FmqAgMKU+YF51z5/58YBo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/xenstored: rework hard_quotas and soft_quotas arrays
Message-Id: <E1w67Jc-002n53-0w@xenbits.xenproject.org>
Date: Fri, 27 Mar 2026 13:33:32 +0000

commit c777202d67f113d5671a5027a6837aadb91a37a6
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Fri Mar 20 16:01:12 2026 +0100
Commit:     Anthony PERARD <anthony.perard@vates.tech>
CommitDate: Fri Mar 27 12:06:37 2026 +0100

    tools/xenstored: rework hard_quotas and soft_quotas arrays
    
    Instead of having one array for hard quotas and one for soft quotas,
    split them differently: have one array with the quota names and
    descriptions, and one with the quota values (soft and hard) and the
    maximum value so far.
    
    This is in preparation of supporting per-domain quotas, as the layout
    of the second array elements will be reused in the domain data.
    
    While at it add an accessor for getting a soft quota value, as this
    will be needed for per-domain quotas, too.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
---
 tools/xenstored/control.c | 24 +++++++++--------
 tools/xenstored/core.c    | 33 ++++++++++++++----------
 tools/xenstored/domain.c  | 65 +++++++++++++++++++++++++----------------------
 tools/xenstored/domain.h  | 15 ++++++-----
 4 files changed, 76 insertions(+), 61 deletions(-)

diff --git a/tools/xenstored/control.c b/tools/xenstored/control.c
index 2611a6fade..ca59d30d05 100644
--- a/tools/xenstored/control.c
+++ b/tools/xenstored/control.c
@@ -101,7 +101,7 @@ static int do_control_log(const void *ctx, struct connection *conn,
 }
 
 static int quota_show_current(const void *ctx, struct connection *conn,
-			      const struct quota *quotas)
+			      unsigned int idx)
 {
 	char *resp;
 	unsigned int i;
@@ -111,11 +111,12 @@ static int quota_show_current(const void *ctx, struct connection *conn,
 		return ENOMEM;
 
 	for (i = 0; i < ACC_N; i++) {
-		if (!quotas[i].name)
+		if (!quota_adm[i].name || quotas[i].val[idx] == Q_VAL_DISABLED)
 			continue;
 		resp = talloc_asprintf_append(resp, "%-17s: %8d %s\n",
-					      quotas[i].name, quotas[i].val,
-					      quotas[i].descr);
+					      quota_adm[i].name,
+					      quotas[i].val[idx],
+					      quota_adm[i].descr);
 		if (!resp)
 			return ENOMEM;
 	}
@@ -126,7 +127,7 @@ static int quota_show_current(const void *ctx, struct connection *conn,
 }
 
 static int quota_set(const void *ctx, struct connection *conn,
-		     const char **vec, int num, struct quota *quotas)
+		     const char **vec, int num, unsigned int idx)
 {
 	unsigned int i;
 	int val;
@@ -139,8 +140,9 @@ static int quota_set(const void *ctx, struct connection *conn,
 		return EINVAL;
 
 	for (i = 0; i < ACC_N; i++) {
-		if (quotas[i].name && !strcmp(vec[0], quotas[i].name)) {
-			quotas[i].val = val;
+		if (quota_adm[i].name && !strcmp(vec[0], quota_adm[i].name) &&
+		    quotas[i].val[idx] != Q_VAL_DISABLED) {
+			quotas[i].val[idx] = val;
 			send_ack(conn, XS_CONTROL);
 			return 0;
 		}
@@ -178,10 +180,10 @@ static int do_control_quota(const void *ctx, struct connection *conn,
 			    const char **vec, int num)
 {
 	if (num == 0)
-		return quota_show_current(ctx, conn, hard_quotas);
+		return quota_show_current(ctx, conn, Q_IDX_HARD);
 
 	if (!strcmp(vec[0], "set"))
-		return quota_set(ctx, conn, vec + 1, num - 1, hard_quotas);
+		return quota_set(ctx, conn, vec + 1, num - 1, Q_IDX_HARD);
 
 	if (!strcmp(vec[0], "max"))
 		return quota_max(ctx, conn, vec + 1, num - 1);
@@ -193,10 +195,10 @@ static int do_control_quota_s(const void *ctx, struct connection *conn,
 			      const char **vec, int num)
 {
 	if (num == 0)
-		return quota_show_current(ctx, conn, soft_quotas);
+		return quota_show_current(ctx, conn, Q_IDX_SOFT);
 
 	if (!strcmp(vec[0], "set"))
-		return quota_set(ctx, conn, vec + 1, num - 1, soft_quotas);
+		return quota_set(ctx, conn, vec + 1, num - 1, Q_IDX_SOFT);
 
 	return EINVAL;
 }
diff --git a/tools/xenstored/core.c b/tools/xenstored/core.c
index e86d947be4..dc63c97658 100644
--- a/tools/xenstored/core.c
+++ b/tools/xenstored/core.c
@@ -2614,10 +2614,9 @@ static void set_timeout(const char *arg)
 		barf("unknown timeout \"%s\"\n", arg);
 }
 
-static void set_quota(const char *arg, bool soft)
+static void set_quota(const char *arg, unsigned int idx)
 {
 	const char *eq = strchr(arg, '=');
-	struct quota *q = soft ? soft_quotas : hard_quotas;
 	unsigned int val;
 	unsigned int i;
 
@@ -2626,8 +2625,9 @@ static void set_quota(const char *arg, bool soft)
 	val = get_optval_uint(eq + 1);
 
 	for (i = 0; i < ACC_N; i++) {
-		if (what_matches(arg, q[i].name)) {
-			q[i].val = val;
+		if (what_matches(arg, quota_adm[i].name) &&
+		    quotas[i].val[idx] != Q_VAL_DISABLED) {
+			quotas[i].val[idx] = val;
 			return;
 		}
 	}
@@ -2635,6 +2635,11 @@ static void set_quota(const char *arg, bool soft)
 	barf("unknown quota \"%s\"\n", arg);
 }
 
+static void set_one_quota(const char *arg, unsigned int idx, enum accitem what)
+{
+	quotas[what].val[idx] = get_optval_uint(arg);
+}
+
 /* Sorted by bit values of TRACE_* flags. Flag is (1u << index). */
 const char *const trace_switches[] = {
 	"obj", "io", "wrl", "acc", "tdb",
@@ -2688,7 +2693,7 @@ int main(int argc, char *argv[])
 				  options, NULL)) != -1) {
 		switch (opt) {
 		case 'E':
-			hard_quotas[ACC_NODES].val = get_optval_uint(optarg);
+			set_one_quota(optarg, Q_IDX_HARD, ACC_NODES);
 			break;
 		case 'F':
 			pidfile = optarg;
@@ -2700,10 +2705,10 @@ int main(int argc, char *argv[])
 			dofork = false;
 			break;
 		case 'S':
-			hard_quotas[ACC_NODESZ].val = get_optval_uint(optarg);
+			set_one_quota(optarg, Q_IDX_HARD, ACC_NODESZ);
 			break;
 		case 't':
-			hard_quotas[ACC_TRANS].val = get_optval_uint(optarg);
+			set_one_quota(optarg, Q_IDX_HARD, ACC_TRANS);
 			break;
 		case 'T':
 			tracefile = optarg;
@@ -2716,22 +2721,22 @@ int main(int argc, char *argv[])
 			keep_orphans = true;
 			break;
 		case 'W':
-			hard_quotas[ACC_WATCH].val = get_optval_uint(optarg);
+			set_one_quota(optarg, Q_IDX_HARD, ACC_WATCH);
 			break;
 		case 'A':
-			hard_quotas[ACC_NPERM].val = get_optval_uint(optarg);
+			set_one_quota(optarg, Q_IDX_HARD, ACC_NPERM);
 			break;
 		case 'M':
-			hard_quotas[ACC_PATHLEN].val = get_optval_uint(optarg);
-			hard_quotas[ACC_PATHLEN].val =
+			set_one_quota(optarg, Q_IDX_HARD, ACC_PATHLEN);
+			quotas[ACC_PATHLEN].val[Q_IDX_HARD] =
 				 min((unsigned int)XENSTORE_REL_PATH_MAX,
-				     hard_quotas[ACC_PATHLEN].val);
+				     quotas[ACC_PATHLEN].val[Q_IDX_HARD]);
 			break;
 		case 'Q':
-			set_quota(optarg, false);
+			set_quota(optarg, Q_IDX_HARD);
 			break;
 		case 'q':
-			set_quota(optarg, true);
+			set_quota(optarg, Q_IDX_SOFT);
 			break;
 		case 'w':
 			set_timeout(optarg);
diff --git a/tools/xenstored/domain.c b/tools/xenstored/domain.c
index 21f6f13f83..4e696a81a8 100644
--- a/tools/xenstored/domain.c
+++ b/tools/xenstored/domain.c
@@ -51,60 +51,60 @@ static evtchn_port_t virq_port;
 
 xenevtchn_handle *xce_handle = NULL;
 
-struct quota hard_quotas[ACC_N] = {
+struct quotaadm quota_adm[ACC_N] = {
 	[ACC_NODES] = {
 		.name = "nodes",
 		.descr = "Nodes per domain",
-		.val = 1000,
 	},
 	[ACC_WATCH] = {
 		.name = "watches",
 		.descr = "Watches per domain",
-		.val = 128,
 	},
 	[ACC_OUTST] = {
 		.name = "outstanding",
 		.descr = "Outstanding requests per domain",
-		.val = 20,
 	},
 	[ACC_MEM] = {
 		.name = "memory",
-		.descr = "Total Xenstore memory per domain (error level)",
-		.val = 2 * 1024 * 1024 + 512 * 1024,	/* 2.5 MB */
+		.descr = "Total Xenstore memory per domain",
 	},
 	[ACC_TRANS] = {
 		.name = "transactions",
 		.descr = "Active transactions per domain",
-		.val = 10,
 	},
 	[ACC_TRANSNODES] = {
 		.name = "transaction-nodes",
 		.descr = "Max. number of accessed nodes per transaction",
-		.val = 1024,
 	},
 	[ACC_NPERM] = {
 		.name = "node-permissions",
 		.descr = "Max. number of permissions per node",
-		.val = 5,
 	},
 	[ACC_PATHLEN] = {
 		.name = "path-max",
 		.descr = "Max. length of a node path",
-		.val = XENSTORE_REL_PATH_MAX,
 	},
 	[ACC_NODESZ] = {
 		.name = "node-size",
 		.descr = "Max. size of a node",
-		.val = 2048,
 	},
 };
 
-struct quota soft_quotas[ACC_N] = {
-	[ACC_MEM] = {
-		.name = "memory",
-		.descr = "Total Xenstore memory per domain (warning level)",
-		.val = 2 * 1024 * 1024,			/* 2.0 MB */
+struct quota quotas[ACC_N] = {
+	[ACC_NODES] =      { .val = { 1000, Q_VAL_DISABLED }, },
+	[ACC_WATCH] =      { .val = {  128, Q_VAL_DISABLED }, },
+	[ACC_OUTST] =      { .val = {   20, Q_VAL_DISABLED }, },
+	[ACC_MEM] =        {
+		.val = { 2 * 1024 * 1024 + 512 * 1024,	/* 2.5 MB */
+			 2 * 1024 * 1024		/* 2.0 MB */ },
 	},
+	[ACC_TRANS] =      { .val = {   10, Q_VAL_DISABLED }, },
+	[ACC_TRANSNODES] = { .val = { 1024, Q_VAL_DISABLED }, },
+	[ACC_NPERM] =      { .val = {    5, Q_VAL_DISABLED }, },
+	[ACC_PATHLEN] =    {
+		.val = { XENSTORE_REL_PATH_MAX, Q_VAL_DISABLED },
+	},
+	[ACC_NODESZ] =     { .val = { 2048, Q_VAL_DISABLED }, },
 };
 
 typedef int32_t wrl_creditt;
@@ -389,10 +389,15 @@ void wrl_apply_debit_trans_commit(struct connection *conn)
 	wrl_apply_debit_actual(conn->domain);
 }
 
+static unsigned int domain_get_soft_quota(struct domain *d, enum accitem what)
+{
+	return quotas[what].val[Q_IDX_SOFT];
+}
+
 static bool domain_quota_val_exceeds(struct domain *d, enum accitem what,
 				     unsigned int val)
 {
-	unsigned int quota = hard_quotas[what].val;
+	unsigned int quota = quotas[what].val[Q_IDX_HARD];
 
 	if (!quota || !domid_is_unprivileged(d->domid))
 		return false;
@@ -777,10 +782,10 @@ int domain_get_quota(const void *ctx, struct connection *conn,
 		return ENOMEM;
 
 	for (i = 0; i < ACC_N; i++) {
-		if (!hard_quotas[i].name)
+		if (!quota_adm[i].name)
 			continue;
 		resp = talloc_asprintf_append(resp, "%-17s: %8u (max %8u)\n",
-					      hard_quotas[i].name,
+					      quota_adm[i].name,
 					      d->acc[i].val, d->acc[i].max);
 		if (!resp)
 			return ENOMEM;
@@ -801,11 +806,10 @@ int domain_max_global_acc(const void *ctx, struct connection *conn)
 		return ENOMEM;
 
 	for (i = 0; i < ACC_N; i++) {
-		if (!hard_quotas[i].name)
+		if (!quota_adm[i].name)
 			continue;
 		resp = talloc_asprintf_append(resp, "%-17s: %8u\n",
-					      hard_quotas[i].name,
-					      hard_quotas[i].max);
+					      quota_adm[i].name, quotas[i].max);
 		if (!resp)
 			return ENOMEM;
 	}
@@ -1631,12 +1635,12 @@ static void domain_acc_valid_max(struct domain *d, enum accitem what,
 				 unsigned int val)
 {
 	assert(what < ARRAY_SIZE(d->acc));
-	assert(what < ARRAY_SIZE(hard_quotas));
+	assert(what < ARRAY_SIZE(quotas));
 
 	if (val > d->acc[what].max)
 		d->acc[what].max = val;
-	if (val > hard_quotas[what].max && domid_is_unprivileged(d->domid))
-		hard_quotas[what].max = val;
+	if (val > quotas[what].max && domid_is_unprivileged(d->domid))
+		quotas[what].max = val;
 }
 
 static int domain_acc_add_valid(struct domain *d, enum accitem what, int add)
@@ -1773,7 +1777,7 @@ void domain_reset_global_acc(void)
 	unsigned int i;
 
 	for (i = 0; i < ACC_N; i++)
-		hard_quotas[i].max = 0;
+		quotas[i].max = 0;
 
 	/* Set current max values seen. */
 	hashtable_iterate(domhash, domain_reset_global_acc_sub, NULL);
@@ -1833,21 +1837,22 @@ static bool domain_chk_quota(struct connection *conn, unsigned int mem)
 	}
 
 	if (now - domain->mem_last_msg >= MEM_WARN_MINTIME_SEC) {
+		unsigned int soft_mem = domain_get_soft_quota(domain, ACC_MEM);
+
 		if (domain->hard_quota_reported) {
 			domain->mem_last_msg = now;
 			domain->hard_quota_reported = false;
 			syslog(LOG_INFO, "Domain %u below hard memory quota again\n",
 			       domain->domid);
 		}
-		if (mem >= soft_quotas[ACC_MEM].val &&
-		    soft_quotas[ACC_MEM].val && !domain->soft_quota_reported) {
+		if (mem >= soft_mem && soft_mem &&
+		    !domain->soft_quota_reported) {
 			domain->mem_last_msg = now;
 			domain->soft_quota_reported = true;
 			syslog(LOG_WARNING, "Domain %u exceeds soft memory quota\n",
 			       domain->domid);
 		}
-		if (mem < soft_quotas[ACC_MEM].val &&
-		    domain->soft_quota_reported) {
+		if (mem < soft_mem && domain->soft_quota_reported) {
 			domain->mem_last_msg = now;
 			domain->soft_quota_reported = false;
 			syslog(LOG_INFO, "Domain %u below soft memory quota again\n",
diff --git a/tools/xenstored/domain.h b/tools/xenstored/domain.h
index 29b91fc783..3bedadb477 100644
--- a/tools/xenstored/domain.h
+++ b/tools/xenstored/domain.h
@@ -40,15 +40,18 @@ enum accitem {
 	ACC_N,			/* Number of elements per domain. */
 };
 
-struct quota {
+extern struct quotaadm {
 	const char *name;
 	const char *descr;
-	unsigned int val;
-	unsigned int max;
-};
+} quota_adm[ACC_N];
 
-extern struct quota hard_quotas[ACC_N];
-extern struct quota soft_quotas[ACC_N];
+extern struct quota {
+	unsigned int val[2];
+#define Q_IDX_HARD      0
+#define Q_IDX_SOFT      1
+#define Q_VAL_DISABLED  UINT_MAX
+	unsigned int max;
+} quotas[ACC_N];
 
 void handle_event(void);
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Mar 27 13:33:43 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 27 Mar 2026 13:33:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1265649.1556444 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w67Jn-00011c-6Z; Fri, 27 Mar 2026 13:33:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1265649.1556444; Fri, 27 Mar 2026 13:33:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w67Jn-00011U-3j; Fri, 27 Mar 2026 13:33:43 +0000
Received: by outflank-mailman (input) for mailman id 1265649;
 Fri, 27 Mar 2026 13:33:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w67Jm-00011O-E5
 for xen-changelog@lists.xenproject.org; Fri, 27 Mar 2026 13:33:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w67Jm-00CHg3-20
 for xen-changelog@lists.xenproject.org;
 Fri, 27 Mar 2026 13:33:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w67Jm-002n6P-1E
 for xen-changelog@lists.xenproject.org;
 Fri, 27 Mar 2026 13:33:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=8+AeBMXp99BDosWNg6b4/T/7Cw9J4D/rON9eHoZ5QXI=; b=LSyNfKEoKFN4idlz8Zo9KSBdYB
	7PK++419I/NfUgFogA8tpEYqYj7EbRUVVt3upVt/gHzAdj8dXfBzbjjo6R8Kk8idgB2BNB52+u5Tn
	VAo21bW83xUEuO/e4Ma8xFTAY18S0EcU/CL9e6Q3aO1FjWQ/1O/V/I1PvENJNrYPfcZA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/xenstored: add GLOBAL_QUOTA_DATA record for live update
Message-Id: <E1w67Jm-002n6P-1E@xenbits.xenproject.org>
Date: Fri, 27 Mar 2026 13:33:42 +0000

commit c427829d0effbeb5ef5c2e734a51e2b69a1b7640
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Fri Mar 20 16:01:13 2026 +0100
Commit:     Anthony PERARD <anthony.perard@vates.tech>
CommitDate: Fri Mar 27 12:06:37 2026 +0100

    tools/xenstored: add GLOBAL_QUOTA_DATA record for live update
    
    Communicate the global quota settings via the GLOBAL_QUOTA_DATA
    record to the new Xenstore instance.
    
    This avoids to lose global quota settings done via xenstore-control.
    
    In theory it would be possible to drop any quota related command line
    parameters in the live update case, but they don't do any harm, as
    the record data is applied on top of the command line data.
    
    For soft-quota just prepend "soft-" to the quota name.
    
    Use sub-functions for building and analyzing the quota part of the
    migration stream, as they will be reused for per-domain quotas.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
---
 tools/xenstored/domain.c | 132 +++++++++++++++++++++++++++++++++++++++++++++++
 tools/xenstored/domain.h |   2 +
 tools/xenstored/lu.c     |   6 +++
 3 files changed, 140 insertions(+)

diff --git a/tools/xenstored/domain.c b/tools/xenstored/domain.c
index 4e696a81a8..cfc8fd0cb4 100644
--- a/tools/xenstored/domain.c
+++ b/tools/xenstored/domain.c
@@ -107,6 +107,9 @@ struct quota quotas[ACC_N] = {
 	[ACC_NODESZ] =     { .val = { 2048, Q_VAL_DISABLED }, },
 };
 
+#define SOFT_PREFIX	"soft-"
+#define SOFT_PREFIX_LEN	(sizeof(SOFT_PREFIX) - 1)
+
 typedef int32_t wrl_creditt;
 
 struct domain
@@ -1363,6 +1366,29 @@ int do_set_feature(const void *ctx, struct connection *conn,
 	return 0;
 }
 
+static bool parse_quota_name(const char *name, unsigned int *qidx,
+			     unsigned int *idx)
+{
+	unsigned int q;
+
+	if (strncmp(name, SOFT_PREFIX, SOFT_PREFIX_LEN)) {
+		*idx = Q_IDX_HARD;
+	} else {
+		*idx = Q_IDX_SOFT;
+		name += SOFT_PREFIX_LEN;
+	}
+	for (q = 0; q < ACC_N; q++) {
+		if (quota_adm[q].name && !strcmp(quota_adm[q].name, name)) {
+			if (quotas[q].val[*idx] == Q_VAL_DISABLED)
+				return true;
+			*qidx = q;
+			return false;
+		}
+	}
+
+	return true;
+}
+
 static int close_xgt_handle(void *_handle)
 {
 	xengnttab_close(*(xengnttab_handle **)_handle);
@@ -2032,6 +2058,64 @@ void read_state_connection(const void *ctx, const void *state)
 	}
 }
 
+/* Returns number of quota and adds length of quota names to *len. */
+static unsigned int get_quota_size(struct quota *quota, unsigned int *len)
+{
+	unsigned int q;
+	unsigned int n = 0;
+
+	*len = 0;
+	for (q = 0; q < ACC_N; q++) {
+		if (!quota_adm[q].name)
+			continue;
+		if (quota[q].val[Q_IDX_HARD] != Q_VAL_DISABLED) {
+			n++;
+			*len += strlen(quota_adm[q].name) + 1;
+		}
+		if (quota[q].val[Q_IDX_SOFT] != Q_VAL_DISABLED) {
+			n++;
+			*len += strlen(quota_adm[q].name) + SOFT_PREFIX_LEN + 1;
+		}
+	}
+
+	return n;
+}
+
+static void build_quota_data(struct quota *quota, uint32_t *val,
+			     char *names_buf)
+{
+	unsigned int q;
+	unsigned int n = 0;
+
+	for (q = 0; q < ACC_N; q++) {
+		if (!quota_adm[q].name)
+			continue;
+		if (quota[q].val[Q_IDX_HARD] != Q_VAL_DISABLED) {
+			val[n++] = quota[q].val[Q_IDX_HARD];
+			strcpy(names_buf, quota_adm[q].name);
+			names_buf += strlen(names_buf) + 1;
+		}
+		if (quota[q].val[Q_IDX_SOFT] != Q_VAL_DISABLED) {
+			val[n++] = quota[q].val[Q_IDX_SOFT];
+			strcpy(names_buf, SOFT_PREFIX);
+			strcpy(names_buf + SOFT_PREFIX_LEN, quota_adm[q].name);
+			names_buf += strlen(names_buf) + 1;
+		}
+	}
+}
+
+static void parse_quota_data(const uint32_t *val, const char *name,
+			     unsigned int n, struct quota *quota)
+{
+	unsigned int i, q, idx;
+
+	for (i = 0; i < n; i++) {
+		if (!parse_quota_name(name, &q, &idx))
+			quota[q].val[idx] = val[i];
+		name += strlen(name) + 1;
+	}
+}
+
 static int dump_state_domain(const void *k, void *v, void *arg)
 {
 	struct domain *domain = v;
@@ -2080,6 +2164,54 @@ void read_state_domain(const void *ctx, const void *state, unsigned int version)
 		domain->features = sd->features;
 }
 
+const char *dump_state_glb_quota(FILE *fp)
+{
+	struct xs_state_record_header *head;
+	struct xs_state_glb_quota *glb;
+	void *record;
+	unsigned int n_quota;
+	unsigned int rec_len;
+	size_t ret;
+
+	n_quota = get_quota_size(quotas, &rec_len);
+	rec_len += n_quota * sizeof(glb->quota_val[0]);
+	rec_len += sizeof(*glb);
+	rec_len = ROUNDUP(rec_len, 3);
+
+	record = talloc_size(NULL, rec_len + sizeof(*head));
+	if (!record)
+		return "Dump global quota allocation error";
+
+	head = record;
+	head->type = XS_STATE_TYPE_GLB_QUOTA;
+	head->length = rec_len;
+
+	glb = (struct xs_state_glb_quota *)(head + 1);
+	glb->n_dom_quota = n_quota;
+	glb->n_glob_quota = 0;
+
+	build_quota_data(quotas, glb->quota_val,
+			 (char *)(glb->quota_val + n_quota));
+
+	ret = fwrite(record, rec_len + sizeof(*head), 1, fp);
+
+	talloc_free(record);
+
+	if (ret != 1 || dump_state_align(fp))
+		return "Dump global quota error";
+
+	return NULL;
+}
+
+void read_state_glb_quota(const void *ctx, const void *state)
+{
+	const struct xs_state_glb_quota *glb = state;
+	unsigned int n_quota = glb->n_dom_quota + glb->n_glob_quota;
+	const char *name = (const char *)(glb->quota_val + n_quota);
+
+	parse_quota_data(glb->quota_val, name, n_quota, quotas);
+}
+
 struct domain_acc {
 	unsigned int domid;
 	int nodes;
diff --git a/tools/xenstored/domain.h b/tools/xenstored/domain.h
index 3bedadb477..8f23a82854 100644
--- a/tools/xenstored/domain.h
+++ b/tools/xenstored/domain.h
@@ -172,10 +172,12 @@ void wrl_apply_debit_trans_commit(struct connection *conn);
 
 const char *dump_state_connections(FILE *fp);
 const char *dump_state_domains(FILE *fp);
+const char *dump_state_glb_quota(FILE *fp);
 
 void read_state_connection(const void *ctx, const void *state);
 void read_state_domain(const void *ctx, const void *state,
 		       unsigned int version);
+void read_state_glb_quota(const void *ctx, const void *state);
 
 struct hashtable *domain_check_acc_init(void);
 void domain_check_acc_add(const struct node *node, struct hashtable *domains);
diff --git a/tools/xenstored/lu.c b/tools/xenstored/lu.c
index fa8395eb1e..eaffdbc69e 100644
--- a/tools/xenstored/lu.c
+++ b/tools/xenstored/lu.c
@@ -192,6 +192,9 @@ void lu_read_state(void)
 		case XS_STATE_TYPE_DOMAIN:
 			read_state_domain(ctx, state.buf, version);
 			break;
+		case XS_STATE_TYPE_GLB_QUOTA:
+			read_state_glb_quota(ctx, state.buf);
+			break;
 		default:
 			xprintf("live-update: unknown state record %08x\n",
 				head.type);
@@ -319,6 +322,9 @@ static const char *lu_dump_state(const void *ctx, struct connection *conn)
 	}
 
 	ret = dump_state_global(fp);
+	if (ret)
+		goto out;
+	ret = dump_state_glb_quota(fp);
 	if (ret)
 		goto out;
 	ret = dump_state_connections(fp);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Mar 27 13:33:53 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 27 Mar 2026 13:33:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1265650.1556449 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w67Jx-00014T-7z; Fri, 27 Mar 2026 13:33:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1265650.1556449; Fri, 27 Mar 2026 13:33:53 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w67Jx-00014J-57; Fri, 27 Mar 2026 13:33:53 +0000
Received: by outflank-mailman (input) for mailman id 1265650;
 Fri, 27 Mar 2026 13:33:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w67Jw-00014B-Go
 for xen-changelog@lists.xenproject.org; Fri, 27 Mar 2026 13:33:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w67Jw-00CHg9-2G
 for xen-changelog@lists.xenproject.org;
 Fri, 27 Mar 2026 13:33:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w67Jw-002n7X-1U
 for xen-changelog@lists.xenproject.org;
 Fri, 27 Mar 2026 13:33:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=40s/C0nrcMC0R/R2o4t/qZUK8tGr99anC5X9vvcaGFQ=; b=6gourQHwZbPEfEtrTqwd2TbVne
	i24ybqj2rGfBdSLlXiD1uo4vNGzG9jlEhEr53GwUNbtFWx7XfNUjy1gDlBUV+OIbzN7zeerqZAXbc
	azyuAfcLzWnhgv2zlF0fMvvhF/WMmW1MZmSNH0LNTWVDMs5gE4yeH6myFfjfWB8Zbii4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/xenstored: split acc[] array in struct domain
Message-Id: <E1w67Jw-002n7X-1U@xenbits.xenproject.org>
Date: Fri, 27 Mar 2026 13:33:52 +0000

commit de4b565fcf73bc617e9b65767ebdac8d2379a0d3
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Fri Mar 20 16:01:14 2026 +0100
Commit:     Anthony PERARD <anthony.perard@vates.tech>
CommitDate: Fri Mar 27 12:06:37 2026 +0100

    tools/xenstored: split acc[] array in struct domain
    
    Prepare using per-domain quota by splitting the acc[] array in struct
    domain into an array with the current accounting data, and an array
    of type struct quota for the per-domain quota and the seen max value
    of the domain.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
---
 tools/xenstored/domain.c | 34 ++++++++++++++++------------------
 1 file changed, 16 insertions(+), 18 deletions(-)

diff --git a/tools/xenstored/domain.c b/tools/xenstored/domain.c
index cfc8fd0cb4..b82f2d5167 100644
--- a/tools/xenstored/domain.c
+++ b/tools/xenstored/domain.c
@@ -143,10 +143,8 @@ struct domain
 	bool introduced;
 
 	/* Accounting data for this domain. */
-	struct acc {
-		unsigned int val;
-		unsigned int max;
-	} acc[ACC_N];
+	unsigned int acc_val[ACC_N];
+	struct quota acc[ACC_N];
 
 	/* Memory quota data for this domain. */
 	bool soft_quota_reported;
@@ -413,7 +411,7 @@ bool domain_quota_add_exceeds(struct domain *d, enum accitem what, int add)
 	if (add < 0 || !d)
 		return false;
 
-	return domain_quota_val_exceeds(d, what, d->acc[what].val + add);
+	return domain_quota_val_exceeds(d, what, d->acc_val[what] + add);
 }
 
 static bool check_indexes(XENSTORE_RING_IDX cons, XENSTORE_RING_IDX prod)
@@ -585,7 +583,7 @@ static int domain_tree_remove_sub(const void *ctx, struct connection *conn,
 		ret = WALK_TREE_SKIP_CHILDREN;
 	}
 
-	return domain->acc[ACC_NODES].val ? ret : WALK_TREE_SUCCESS_STOP;
+	return domain->acc_val[ACC_NODES] ? ret : WALK_TREE_SUCCESS_STOP;
 }
 
 static void domain_tree_remove(struct domain *domain)
@@ -593,7 +591,7 @@ static void domain_tree_remove(struct domain *domain)
 	int ret;
 	struct walk_funcs walkfuncs = { .enter = domain_tree_remove_sub };
 
-	if (domain->acc[ACC_NODES].val) {
+	if (domain->acc_val[ACC_NODES]) {
 		ret = walk_node_tree(domain, NULL, "/", &walkfuncs, domain);
 		if (ret == WALK_TREE_ERROR_STOP)
 			syslog(LOG_ERR,
@@ -789,7 +787,7 @@ int domain_get_quota(const void *ctx, struct connection *conn,
 			continue;
 		resp = talloc_asprintf_append(resp, "%-17s: %8u (max %8u)\n",
 					      quota_adm[i].name,
-					      d->acc[i].val, d->acc[i].max);
+					      d->acc_val[i], d->acc[i].max);
 		if (!resp)
 			return ENOMEM;
 	}
@@ -1673,10 +1671,10 @@ static int domain_acc_add_valid(struct domain *d, enum accitem what, int add)
 {
 	unsigned int val;
 
-	assert(what < ARRAY_SIZE(d->acc));
+	assert(what < ARRAY_SIZE(d->acc_val));
 
-	if ((add < 0 && -add > d->acc[what].val) ||
-	    (add > 0 && (INT_MAX - d->acc[what].val) < add)) {
+	if ((add < 0 && -add > d->acc_val[what]) ||
+	    (add > 0 && (INT_MAX - d->acc_val[what]) < add)) {
 		/*
 		 * In a transaction when a node is being added/removed AND the
 		 * same node has been added/removed outside the transaction in
@@ -1687,7 +1685,7 @@ static int domain_acc_add_valid(struct domain *d, enum accitem what, int add)
 		return (add < 0) ? 0 : INT_MAX;
 	}
 
-	val = d->acc[what].val + add;
+	val = d->acc_val[what] + add;
 	domain_acc_valid_max(d, what, val);
 
 	return val;
@@ -1746,10 +1744,10 @@ static int domain_acc_add(struct connection *conn, unsigned int domid,
 	}
 
 	trace_acc("global change domid %u: what=%u %u add %d\n", domid, what,
-		  d->acc[what].val, add);
-	d->acc[what].val = domain_acc_add_valid(d, what, add);
+		  d->acc_val[what], add);
+	d->acc_val[what] = domain_acc_add_valid(d, what, add);
 
-	return d->acc[what].val;
+	return d->acc_val[what];
 }
 
 void acc_drop(struct connection *conn)
@@ -1793,7 +1791,7 @@ static int domain_reset_global_acc_sub(const void *k, void *v, void *arg)
 	unsigned int i;
 
 	for (i = 0; i < ACC_N; i++)
-		d->acc[i].max = d->acc[i].val;
+		d->acc[i].max = d->acc_val[i];
 
 	return 0;
 }
@@ -2233,7 +2231,7 @@ static int domain_check_acc_init_sub(const void *k, void *v, void *arg)
 	 * If everything is correct incrementing the value for each node will
 	 * result in dom->nodes being 0 at the end.
 	 */
-	dom->nodes = -d->acc[ACC_NODES].val;
+	dom->nodes = -d->acc_val[ACC_NODES];
 
 	if (hashtable_add(domains, &dom->domid, dom)) {
 		talloc_free(dom);
@@ -2288,7 +2286,7 @@ static int domain_check_acc_cb(const void *k, void *v, void *arg)
 	if (!d)
 		return 0;
 
-	d->acc[ACC_NODES].val += dom->nodes;
+	d->acc_val[ACC_NODES] += dom->nodes;
 
 	return 0;
 }
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Mar 27 13:34:03 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 27 Mar 2026 13:34:03 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1265651.1556451 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w67K7-00017s-9C; Fri, 27 Mar 2026 13:34:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1265651.1556451; Fri, 27 Mar 2026 13:34:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w67K7-00017k-6X; Fri, 27 Mar 2026 13:34:03 +0000
Received: by outflank-mailman (input) for mailman id 1265651;
 Fri, 27 Mar 2026 13:34:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w67K6-00017d-JO
 for xen-changelog@lists.xenproject.org; Fri, 27 Mar 2026 13:34:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w67K6-00CHgO-2W
 for xen-changelog@lists.xenproject.org;
 Fri, 27 Mar 2026 13:34:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w67K6-002nAR-1l
 for xen-changelog@lists.xenproject.org;
 Fri, 27 Mar 2026 13:34:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=EKU3eK8HQPl+adNsaLVHuDuNq34L+Zdzh/MNxObGEt4=; b=nu5H2cYfIVZ/Xx1HK6+hSbW1B7
	A0pPFmxRulf7issw5cJKjt2l8J3Ly2WHg60/FUFJex4ZlabnEM8ujjtRbBKiK0Xo+lipS0DiTbHfd
	DxeYHfA/JBfWtdCv9xAZ91h+uveBUa7UrbMha0AvtUCaRDXrlmfq60LNanS9TV5IPbEY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/xenstored: use per-domain quota settings
Message-Id: <E1w67K6-002nAR-1l@xenbits.xenproject.org>
Date: Fri, 27 Mar 2026 13:34:02 +0000

commit e52798141bc937605d564c24bc7e5a9efb7fe95a
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Fri Mar 20 16:01:15 2026 +0100
Commit:     Anthony PERARD <anthony.perard@vates.tech>
CommitDate: Fri Mar 27 12:06:37 2026 +0100

    tools/xenstored: use per-domain quota settings
    
    Initialize the per-domain quota values with the global ones at domain
    introduction. Use the per-domain quota settings when checking for
    current values to exceed the quota.
    
    Add per-domain quota support to live update.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
---
 tools/xenstored/domain.c | 60 ++++++++++++++++++++++++++++++++++++------------
 1 file changed, 45 insertions(+), 15 deletions(-)

diff --git a/tools/xenstored/domain.c b/tools/xenstored/domain.c
index b82f2d5167..7a8d285e64 100644
--- a/tools/xenstored/domain.c
+++ b/tools/xenstored/domain.c
@@ -392,6 +392,9 @@ void wrl_apply_debit_trans_commit(struct connection *conn)
 
 static unsigned int domain_get_soft_quota(struct domain *d, enum accitem what)
 {
+	if (d && d->acc[what].val[Q_IDX_SOFT] != Q_VAL_DISABLED)
+		return d->acc[what].val[Q_IDX_SOFT];
+
 	return quotas[what].val[Q_IDX_SOFT];
 }
 
@@ -400,6 +403,9 @@ static bool domain_quota_val_exceeds(struct domain *d, enum accitem what,
 {
 	unsigned int quota = quotas[what].val[Q_IDX_HARD];
 
+	if (d->acc[what].val[Q_IDX_HARD] != Q_VAL_DISABLED)
+		quota = d->acc[what].val[Q_IDX_HARD];
+
 	if (!quota || !domid_is_unprivileged(d->domid))
 		return false;
 
@@ -824,6 +830,7 @@ static struct domain *alloc_domain(const void *context, unsigned int domid,
 				   uint64_t unique_id)
 {
 	struct domain *domain;
+	unsigned int q;
 
 	domain = talloc_zero(context, struct domain);
 	if (!domain) {
@@ -837,6 +844,11 @@ static struct domain *alloc_domain(const void *context, unsigned int domid,
 	domain->introduced = false;
 	domain->features = XENSTORE_FEATURES;
 
+	for (q = 0; q < ACC_N; q++) {
+		domain->acc[q].val[Q_IDX_HARD] = quotas[q].val[Q_IDX_HARD];
+		domain->acc[q].val[Q_IDX_SOFT] = quotas[q].val[Q_IDX_SOFT];
+	}
+
 	if (hashtable_add(domhash, &domain->domid, domain)) {
 		talloc_free(domain);
 		errno = ENOMEM;
@@ -2118,25 +2130,39 @@ static int dump_state_domain(const void *k, void *v, void *arg)
 {
 	struct domain *domain = v;
 	FILE *fp = arg;
-	struct xs_state_domain sd;
-	struct xs_state_record_header head;
-
-	head.type = XS_STATE_TYPE_DOMAIN;
-	head.length = sizeof(sd);
-	memset(&sd, 0, sizeof(sd));
-	sd.domain_id = domain->domid;
+	struct xs_state_domain *sd;
+	struct xs_state_record_header *head;
+	void *record;
+	unsigned int n_quota;
+	unsigned int rec_len;
+	size_t ret;
 
-	if (lu_status->version > 1)
-		sd.features = domain->features;
+	n_quota = get_quota_size(domain->acc, &rec_len);
+	rec_len += n_quota * sizeof(sd->quota_val[0]);
+	rec_len += sizeof(*sd);
+	rec_len = ROUNDUP(rec_len, 3);
 
-	if (fwrite(&head, sizeof(head), 1, fp) != 1)
-		return 1;
-	if (fwrite(&sd, sizeof(sd), 1, fp) != 1)
-		return 1;
-	if (dump_state_align(fp))
+	record = talloc_size(NULL, rec_len + sizeof(*head));
+	if (!record)
 		return 1;
 
-	return 0;
+	head = record;
+	head->type = XS_STATE_TYPE_DOMAIN;
+	head->length = rec_len;
+
+	sd = (struct xs_state_domain *)(head + 1);
+	sd->domain_id = domain->domid;
+	sd->n_quota = n_quota;
+	sd->features = (lu_status->version > 1) ? domain->features : 0;
+
+	build_quota_data(domain->acc, sd->quota_val,
+			 (char *)(sd->quota_val + n_quota));
+
+	ret = fwrite(record, rec_len + sizeof(*head), 1, fp);
+
+	talloc_free(record);
+
+	return (ret != 1 || dump_state_align(fp)) ? 1 : 0;
 }
 
 const char *dump_state_domains(FILE *fp)
@@ -2153,6 +2179,8 @@ void read_state_domain(const void *ctx, const void *state, unsigned int version)
 {
 	const struct xs_state_domain *sd = state;
 	struct domain *domain;
+	unsigned int n_quota = sd->n_quota;
+	const char *name = (const char *)(sd->quota_val + n_quota);
 
 	domain = find_domain_struct(sd->domain_id);
 	if (!domain)
@@ -2160,6 +2188,8 @@ void read_state_domain(const void *ctx, const void *state, unsigned int version)
 
 	if (version > 1)
 		domain->features = sd->features;
+
+	parse_quota_data(sd->quota_val, name, n_quota, domain->acc);
 }
 
 const char *dump_state_glb_quota(FILE *fp)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Mar 27 13:34:13 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 27 Mar 2026 13:34:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1265652.1556456 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w67KH-00019s-AS; Fri, 27 Mar 2026 13:34:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1265652.1556456; Fri, 27 Mar 2026 13:34:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w67KH-00019l-7p; Fri, 27 Mar 2026 13:34:13 +0000
Received: by outflank-mailman (input) for mailman id 1265652;
 Fri, 27 Mar 2026 13:34:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w67KG-00019d-M7
 for xen-changelog@lists.xenproject.org; Fri, 27 Mar 2026 13:34:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w67KG-00CHgV-2n
 for xen-changelog@lists.xenproject.org;
 Fri, 27 Mar 2026 13:34:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w67KG-002nB8-22
 for xen-changelog@lists.xenproject.org;
 Fri, 27 Mar 2026 13:34:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=eX1CkRyRCKVzYDP/JpA4wkdSprSvi0BG0uhf6d/Qw4Q=; b=J+VTvo6Qf+tmKPzAfcBUJNGQxo
	NdVCEKtBTsHpShjGfiOB8+wuGHnWnk7zE9oP3zjz3FABP6Jzn4E8WfjydEQyauyhdWePq/3pmYWtr
	1ajnwb6GjQNK0xEPxTocNVALsULk7Nt83I9DWqBhBjYIQfrxBjc5o++3ByvzqtVRzYR8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/xenstored: implement the GET/SET_QUOTA commands
Message-Id: <E1w67KG-002nB8-22@xenbits.xenproject.org>
Date: Fri, 27 Mar 2026 13:34:12 +0000

commit af41cad8fc7ed7242cca2409d934fa59d9f602fa
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Fri Mar 20 16:01:16 2026 +0100
Commit:     Anthony PERARD <anthony.perard@vates.tech>
CommitDate: Fri Mar 27 12:06:37 2026 +0100

    tools/xenstored: implement the GET/SET_QUOTA commands
    
    Add the implementation of the GET_QUOTA and SET_QUOTA wire commands.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
---
 tools/xenstored/core.c   |   4 ++
 tools/xenstored/domain.c | 111 +++++++++++++++++++++++++++++++++++++++++++++++
 tools/xenstored/domain.h |   5 +++
 3 files changed, 120 insertions(+)

diff --git a/tools/xenstored/core.c b/tools/xenstored/core.c
index dc63c97658..4786a2a82e 100644
--- a/tools/xenstored/core.c
+++ b/tools/xenstored/core.c
@@ -2035,6 +2035,10 @@ static struct {
 	    { "GET_FEATURE",   do_get_feature,  XS_FLAG_PRIV },
 	[XS_SET_FEATURE]       =
 	    { "SET_FEATURE",   do_set_feature,  XS_FLAG_PRIV },
+	[XS_GET_QUOTA]         =
+	    { "GET_QUOTA",     do_get_quota,    XS_FLAG_PRIV },
+	[XS_SET_QUOTA]         =
+	    { "SET_QUOTA",     do_set_quota,    XS_FLAG_PRIV },
 };
 
 static const char *sockmsg_string(enum xsd_sockmsg_type type)
diff --git a/tools/xenstored/domain.c b/tools/xenstored/domain.c
index 7a8d285e64..1684f6dee7 100644
--- a/tools/xenstored/domain.c
+++ b/tools/xenstored/domain.c
@@ -1399,6 +1399,117 @@ static bool parse_quota_name(const char *name, unsigned int *qidx,
 	return true;
 }
 
+int do_get_quota(const void *ctx, struct connection *conn,
+		 struct buffered_data *in)
+{
+	const char *vec[2];
+	unsigned int n_pars;
+	unsigned int domid;
+	unsigned int q;
+	unsigned int idx;
+	char *resp;
+	const char *name;
+	const struct quota *quota;
+	const struct domain *domain;
+
+	n_pars = get_strings(in, vec, ARRAY_SIZE(vec));
+
+	if (n_pars > 2)
+		return EINVAL;
+
+	if (n_pars == 0) {
+		resp = talloc_strdup(ctx, "");
+		if (!resp)
+			return ENOMEM;
+		for (q = 0; q < ACC_N; q++) {
+			if (!quota_adm[q].name)
+				continue;
+			if (quotas[q].val[Q_IDX_HARD] != Q_VAL_DISABLED) {
+				resp = talloc_asprintf_append(resp, "%s%s",
+					*resp ? " " : "", quota_adm[q].name);
+				if (!resp)
+					return ENOMEM;
+			}
+			if (quotas[q].val[Q_IDX_SOFT] != Q_VAL_DISABLED) {
+				resp = talloc_asprintf_append(resp, "%s%s%s",
+					*resp ? " " : "", SOFT_PREFIX,
+					quota_adm[q].name);
+				if (!resp)
+					return ENOMEM;
+			}
+		}
+	} else {
+		if (n_pars == 1) {
+			quota = quotas;
+			name = vec[0];
+		} else {
+			domid = parse_domid(vec[0]);
+			if (errno)
+				return errno;
+			domain = find_or_alloc_existing_domain(domid);
+			if (!domain)
+				return ENOENT;
+			quota = domain->acc;
+			name = vec[1];
+		}
+
+		if (parse_quota_name(name, &q, &idx))
+			return EINVAL;
+
+		resp = talloc_asprintf(ctx, "%u", quota[q].val[idx]);
+		if (!resp)
+			return ENOMEM;
+	}
+
+	send_reply(conn, XS_GET_QUOTA, resp, strlen(resp) + 1);
+
+	return 0;
+}
+
+int do_set_quota(const void *ctx, struct connection *conn,
+		 struct buffered_data *in)
+{
+	const char *vec[3];
+	unsigned int n_pars;
+	unsigned int domid;
+	unsigned int q;
+	unsigned int idx;
+	const char *name;
+	unsigned int val;
+	struct quota *quota;
+	struct domain *domain;
+
+	n_pars = get_strings(in, vec, ARRAY_SIZE(vec));
+
+	if (n_pars < 2 || n_pars > 3)
+		return EINVAL;
+
+	if (n_pars == 2) {
+		quota = quotas;
+		name = vec[0];
+		val = atoi(vec[1]);
+	} else {
+		domid = parse_domid(vec[0]);
+		if (errno)
+			return errno;
+		domain = find_or_alloc_existing_domain(domid);
+		if (!domain)
+			return ENOENT;
+		quota = domain->acc;
+		name = vec[1];
+		val = atoi(vec[2]);
+	}
+
+	if (parse_quota_name(name, &q, &idx) || val == Q_VAL_DISABLED)
+		return EINVAL;
+
+	quota[q].val[idx] = val;
+
+	send_ack(conn, XS_SET_QUOTA);
+
+	return 0;
+}
+
 static int close_xgt_handle(void *_handle)
 {
 	xengnttab_close(*(xengnttab_handle **)_handle);
diff --git a/tools/xenstored/domain.h b/tools/xenstored/domain.h
index 8f23a82854..ca38b5e0ea 100644
--- a/tools/xenstored/domain.h
+++ b/tools/xenstored/domain.h
@@ -93,6 +93,11 @@ int do_get_feature(const void *ctx, struct connection *conn,
 int do_set_feature(const void *ctx, struct connection *conn,
 		   struct buffered_data *in);
 
+int do_get_quota(const void *ctx, struct connection *conn,
+		 struct buffered_data *in);
+int do_set_quota(const void *ctx, struct connection *conn,
+		 struct buffered_data *in);
+
 void domain_early_init(void);
 void domain_init(int evtfd);
 void init_domains(bool live_update);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Mar 27 13:34:23 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 27 Mar 2026 13:34:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1265653.1556461 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w67KR-0001Bx-CR; Fri, 27 Mar 2026 13:34:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1265653.1556461; Fri, 27 Mar 2026 13:34:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w67KR-0001Bp-9N; Fri, 27 Mar 2026 13:34:23 +0000
Received: by outflank-mailman (input) for mailman id 1265653;
 Fri, 27 Mar 2026 13:34:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w67KQ-0001Bj-PB
 for xen-changelog@lists.xenproject.org; Fri, 27 Mar 2026 13:34:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w67KQ-00CHgd-36
 for xen-changelog@lists.xenproject.org;
 Fri, 27 Mar 2026 13:34:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w67KQ-002nCp-2K
 for xen-changelog@lists.xenproject.org;
 Fri, 27 Mar 2026 13:34:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=OvZhDLQX6Q+wmIxM1dX3k1jJ+gi/y+DJMzvGIqQRMVs=; b=qZzNhSxcX9i3Wx8ciapS8ZIat5
	bc8s0WgI3FfLHhQSlSqogv7goZpvxtAy982DJmy3Hx8u8JbGmNd/34x0yDd1W+zR1Gs8i9hn3svhL
	XLn8/lqcsGvleOSpuS/elf5xC1CdQloiWvRhOAc4JAW2ArlHamblXqfo6Q767RYYDZlg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/libxl: add functions for retrieving and setting xenstore quota
Message-Id: <E1w67KQ-002nCp-2K@xenbits.xenproject.org>
Date: Fri, 27 Mar 2026 13:34:22 +0000

commit 6f58df9d7d48ea612758312485808e45647e9686
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Fri Mar 20 16:01:17 2026 +0100
Commit:     Anthony PERARD <anthony.perard@vates.tech>
CommitDate: Fri Mar 27 12:06:37 2026 +0100

    tools/libxl: add functions for retrieving and setting xenstore quota
    
    Add some functions allowing to retrieve and set Xenstore quota (either
    global or domain specific).
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Acked-by: Nick Rosbrook <enr0n@ubuntu.com> # golang stuff
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
---
 tools/golang/xenlight/helpers.gen.go |  78 +++++++++++++++++++++++
 tools/golang/xenlight/types.gen.go   |   9 +++
 tools/include/libxl.h                |  20 ++++++
 tools/libs/light/Makefile            |   1 +
 tools/libs/light/libxl_types.idl     |   9 +++
 tools/libs/light/libxl_xsquota.c     | 116 +++++++++++++++++++++++++++++++++++
 6 files changed, 233 insertions(+)

diff --git a/tools/golang/xenlight/helpers.gen.go b/tools/golang/xenlight/helpers.gen.go
index 8909fe8a1b..767b9e45f5 100644
--- a/tools/golang/xenlight/helpers.gen.go
+++ b/tools/golang/xenlight/helpers.gen.go
@@ -998,6 +998,84 @@ xc.policy = C.libxl_rdm_reserve_policy(x.Policy)
  return nil
  }
 
+// NewXsQuotaItem returns an instance of XsQuotaItem initialized with defaults.
+func NewXsQuotaItem() (*XsQuotaItem, error) {
+var (
+x XsQuotaItem
+xc C.libxl_xs_quota_item)
+
+C.libxl_xs_quota_item_init(&xc)
+defer C.libxl_xs_quota_item_dispose(&xc)
+
+if err := x.fromC(&xc); err != nil {
+return nil, err }
+
+return &x, nil}
+
+func (x *XsQuotaItem) fromC(xc *C.libxl_xs_quota_item) error {
+ x.Name = C.GoString(xc.name)
+x.Val = uint32(xc.val)
+
+ return nil}
+
+func (x *XsQuotaItem) toC(xc *C.libxl_xs_quota_item) (err error){defer func(){
+if err != nil{
+C.libxl_xs_quota_item_dispose(xc)}
+}()
+
+if x.Name != "" {
+xc.name = C.CString(x.Name)}
+xc.val = C.uint32_t(x.Val)
+
+ return nil
+ }
+
+// NewXsQuotaList returns an instance of XsQuotaList initialized with defaults.
+func NewXsQuotaList() (*XsQuotaList, error) {
+var (
+x XsQuotaList
+xc C.libxl_xs_quota_list)
+
+C.libxl_xs_quota_list_init(&xc)
+defer C.libxl_xs_quota_list_dispose(&xc)
+
+if err := x.fromC(&xc); err != nil {
+return nil, err }
+
+return &x, nil}
+
+func (x *XsQuotaList) fromC(xc *C.libxl_xs_quota_list) error {
+ x.Quota = nil
+if n := int(xc.num_quota); n > 0 {
+cQuota := (*[1<<28]C.libxl_xs_quota_item)(unsafe.Pointer(xc.quota))[:n:n]
+x.Quota = make([]XsQuotaItem, n)
+for i, v := range cQuota {
+if err := x.Quota[i].fromC(&v); err != nil {
+return fmt.Errorf("converting field Quota: %v", err) }
+}
+}
+
+ return nil}
+
+func (x *XsQuotaList) toC(xc *C.libxl_xs_quota_list) (err error){defer func(){
+if err != nil{
+C.libxl_xs_quota_list_dispose(xc)}
+}()
+
+if numQuota := len(x.Quota); numQuota > 0 {
+xc.quota = (*C.libxl_xs_quota_item)(C.malloc(C.ulong(numQuota)*C.sizeof_libxl_xs_quota_item))
+xc.num_quota = C.int(numQuota)
+cQuota := (*[1<<28]C.libxl_xs_quota_item)(unsafe.Pointer(xc.quota))[:numQuota:numQuota]
+for i,v := range x.Quota {
+if err := v.toC(&cQuota[i]); err != nil {
+return fmt.Errorf("converting field Quota: %v", err)
+}
+}
+}
+
+ return nil
+ }
+
 // NewDomainBuildInfo returns an instance of DomainBuildInfo initialized with defaults.
 func NewDomainBuildInfo(dtype DomainType) (*DomainBuildInfo, error) {
 var (
diff --git a/tools/golang/xenlight/types.gen.go b/tools/golang/xenlight/types.gen.go
index ab9d4ca7b4..8dd610919d 100644
--- a/tools/golang/xenlight/types.gen.go
+++ b/tools/golang/xenlight/types.gen.go
@@ -543,6 +543,15 @@ Altp2MModeExternal Altp2MMode = 2
 Altp2MModeLimited Altp2MMode = 3
 )
 
+type XsQuotaItem struct {
+Name string
+Val uint32
+}
+
+type XsQuotaList struct {
+Quota []XsQuotaItem
+}
+
 type DomainBuildInfo struct {
 MaxVcpus int
 AvailVcpus Bitmap
diff --git a/tools/include/libxl.h b/tools/include/libxl.h
index bc35e412da..6d2910df34 100644
--- a/tools/include/libxl.h
+++ b/tools/include/libxl.h
@@ -1537,6 +1537,18 @@ void libxl_mac_copy(libxl_ctx *ctx, libxl_mac *dst, const libxl_mac *src);
  */
 #define LIBXL_HAVE_XEN_PLATFORM_PCI_BAR_UC
 
+/*
+ * LIBXL_HAVE_XENSTORE_QUOTA
+ *
+ * If this is defined the Xenstore quota related functions
+ * libxl_xs_quota_global_get()
+ * libxl_xs_quota_global_set()
+ * libxl_xs_quota_domain_get()
+ * libxl_xs_quota_domain_set()
+ * are available.
+ */
+#define LIBXL_HAVE_XENSTORE_QUOTA
+
 typedef char **libxl_string_list;
 void libxl_string_list_dispose(libxl_string_list *sl);
 int libxl_string_list_length(const libxl_string_list *sl);
@@ -3011,6 +3023,14 @@ static inline int libxl_qemu_monitor_command_0x041200(libxl_ctx *ctx,
 #define libxl_qemu_monitor_command libxl_qemu_monitor_command_0x041200
 #endif
 
+/* Get/set global and per-domain Xenstore quota. */
+int libxl_xs_quota_global_get(libxl_ctx *ctx, libxl_xs_quota_list *q_out);
+int libxl_xs_quota_global_set(libxl_ctx *ctx, libxl_xs_quota_list *q);
+int libxl_xs_quota_domain_get(libxl_ctx *ctx, uint32_t domid,
+                              libxl_xs_quota_list *q_out);
+int libxl_xs_quota_domain_set(libxl_ctx *ctx, uint32_t domid,
+                              libxl_xs_quota_list *q);
+
 #include <libxl_event.h>
 
 /*
diff --git a/tools/libs/light/Makefile b/tools/libs/light/Makefile
index bc60c46558..ca22a40c6c 100644
--- a/tools/libs/light/Makefile
+++ b/tools/libs/light/Makefile
@@ -106,6 +106,7 @@ OBJS-y += libxl_pvcalls.o
 OBJS-y += libxl_vsnd.o
 OBJS-y += libxl_vkb.o
 OBJS-y += libxl_virtio.o
+OBJS-y += libxl_xsquota.o
 OBJS-y += libxl_genid.o
 OBJS-y += _libxl_types.o
 OBJS-y += libxl_flask.o
diff --git a/tools/libs/light/libxl_types.idl b/tools/libs/light/libxl_types.idl
index d64a573ff3..1a63c8af76 100644
--- a/tools/libs/light/libxl_types.idl
+++ b/tools/libs/light/libxl_types.idl
@@ -574,6 +574,15 @@ libxl_altp2m_mode = Enumeration("altp2m_mode", [
     (3, "limited"),
     ], init_val = "LIBXL_ALTP2M_MODE_DISABLED")
 
+libxl_xs_quota_item = Struct("xs_quota_item", [
+    ("name", string),
+    ("val",  uint32),
+    ])
+
+libxl_xs_quota_list = Struct("xs_quota_list", [
+    ("quota", Array(libxl_xs_quota_item, "num_quota"))
+    ])
+
 libxl_domain_build_info = Struct("domain_build_info",[
     ("max_vcpus",       integer),
     ("avail_vcpus",     libxl_bitmap),
diff --git a/tools/libs/light/libxl_xsquota.c b/tools/libs/light/libxl_xsquota.c
new file mode 100644
index 0000000000..4524442655
--- /dev/null
+++ b/tools/libs/light/libxl_xsquota.c
@@ -0,0 +1,116 @@
+/* SPDX-License-Identifier: LGPL-2.1-only */
+
+/* Xenstore quota handling functions. */
+
+#include "libxl_internal.h"
+
+static int get_quota(libxl_ctx *ctx, unsigned int domid,
+                     libxl_xs_quota_list *q_out,
+                     bool (func)(struct xs_handle *h, unsigned int domid,
+                                 const char *quota, unsigned int *value))
+{
+    const char **names;
+    unsigned int num, i;
+    bool ok;
+    int rc;
+    GC_INIT(ctx);
+
+    libxl_xs_quota_list_init(q_out);
+    names = xs_get_quota_names(ctx->xsh, &num);
+    if (!names) {
+        /* Xenstore quota support is optional! */
+        if (errno != ENOSYS) {
+            libxl_xs_quota_list_dispose(q_out);
+            rc = ERROR_FAIL;
+        } else {
+            rc = 0;
+        }
+        goto out;
+    }
+
+    q_out->num_quota = num;
+    q_out->quota = libxl__calloc(NOGC, num, sizeof(*q_out->quota));
+    for (i = 0; i < num; i++) {
+        q_out->quota[i].name = libxl__strdup(NOGC, names[i]);
+        ok = func(ctx->xsh, domid, q_out->quota[i].name, &q_out->quota[i].val);
+        if (!ok) {
+            libxl_xs_quota_list_dispose(q_out);
+            rc = ERROR_FAIL;
+            goto out;
+        }
+    }
+
+    rc = 0;
+
+ out:
+    free(names);
+
+    GC_FREE;
+    return rc;
+}
+
+static int set_quota(libxl_ctx *ctx, unsigned int domid, libxl_xs_quota_list *q,
+                     bool (func)(struct xs_handle *h, unsigned int domid,
+                                 const char *quota, unsigned int value))
+{
+    unsigned int i;
+    bool ok;
+    int rc;
+    GC_INIT(ctx);
+
+    for (i = 0; i < q->num_quota; i++) {
+        ok = func(ctx->xsh, domid, q->quota[i].name, q->quota[i].val);
+        if (!ok) {
+            rc = ERROR_FAIL;
+            goto out;
+        }
+    }
+
+    rc = 0;
+
+ out:
+    GC_FREE;
+    return rc;
+}
+
+static bool get_global_quota(struct xs_handle *h, unsigned int domid,
+                             const char *quota, unsigned int *value)
+{
+    return xs_get_global_quota(h, quota, value);
+}
+
+int libxl_xs_quota_global_get(libxl_ctx *ctx, libxl_xs_quota_list *q_out)
+{
+    return get_quota(ctx, 0, q_out, get_global_quota);
+}
+
+static bool set_global_quota(struct xs_handle *h, unsigned int domid,
+                             const char *quota, unsigned int value)
+{
+    return xs_set_global_quota(h, quota, value);
+}
+
+int libxl_xs_quota_global_set(libxl_ctx *ctx, libxl_xs_quota_list *q)
+{
+    return set_quota(ctx, 0, q, set_global_quota);;
+}
+
+int libxl_xs_quota_domain_get(libxl_ctx *ctx, uint32_t domid,
+                              libxl_xs_quota_list *q_out)
+{
+    return get_quota(ctx, domid, q_out, xs_get_domain_quota);
+}
+
+int libxl_xs_quota_domain_set(libxl_ctx *ctx, uint32_t domid,
+                              libxl_xs_quota_list *q)
+{
+    return set_quota(ctx, domid, q, xs_set_domain_quota);
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Mar 27 13:34:33 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 27 Mar 2026 13:34:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1265654.1556464 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w67Kb-0001G8-F3; Fri, 27 Mar 2026 13:34:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1265654.1556464; Fri, 27 Mar 2026 13:34:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w67Kb-0001G0-C8; Fri, 27 Mar 2026 13:34:33 +0000
Received: by outflank-mailman (input) for mailman id 1265654;
 Fri, 27 Mar 2026 13:34:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w67Ka-0001Fs-ST
 for xen-changelog@lists.xenproject.org; Fri, 27 Mar 2026 13:34:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w67Kb-00CHgy-0C
 for xen-changelog@lists.xenproject.org;
 Fri, 27 Mar 2026 13:34:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w67Ka-002nDq-2e
 for xen-changelog@lists.xenproject.org;
 Fri, 27 Mar 2026 13:34:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=RWvgCCR99b94yISWxp78UhUiUfd6RJyJglulHOQT2HM=; b=O56IEqkRd3Xv7z7KpGs/0KwkCH
	xHdTVYGRTMvh/qL7jnWPEznSeXhEeJSdkjzvUxOLdh4hnP4yzzBlbkH3B5JeU7C16LSLB36wnW15w
	o23Qhe5TYaeW/sNx2yRYiGCbNH4H9mWMb1u/GPDng2v9t1tCc6ShuOzaFli9tqVifXXc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/libxl: add support for xenstore quota in domain_config
Message-Id: <E1w67Ka-002nDq-2e@xenbits.xenproject.org>
Date: Fri, 27 Mar 2026 13:34:32 +0000

commit a6f159f92ca39ec074d8d4a530c5af04c34f0fa5
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Fri Mar 20 16:01:18 2026 +0100
Commit:     Anthony PERARD <anthony.perard@vates.tech>
CommitDate: Fri Mar 27 12:06:37 2026 +0100

    tools/libxl: add support for xenstore quota in domain_config
    
    Add support for xenstore quota in the struct domain_config. Initially
    it will be used only for migration of a domain.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Acked-by: Nick Rosbrook <enr0n@ubuntu.com> # golang stuff
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
---
 tools/golang/xenlight/helpers.gen.go |  6 ++++++
 tools/golang/xenlight/types.gen.go   |  1 +
 tools/include/libxl.h                |  1 +
 tools/libs/light/libxl_dom.c         |  8 ++++++++
 tools/libs/light/libxl_domain.c      | 11 +++++++++++
 tools/libs/light/libxl_types.idl     |  1 +
 6 files changed, 28 insertions(+)

diff --git a/tools/golang/xenlight/helpers.gen.go b/tools/golang/xenlight/helpers.gen.go
index 767b9e45f5..b0c09da910 100644
--- a/tools/golang/xenlight/helpers.gen.go
+++ b/tools/golang/xenlight/helpers.gen.go
@@ -1286,6 +1286,9 @@ if err := x.TrapUnmappedAccesses.fromC(&xc.trap_unmapped_accesses);err != nil {
 return fmt.Errorf("converting field TrapUnmappedAccesses: %v", err)
 }
 x.XenstoreFeatureMask = uint32(xc.xenstore_feature_mask)
+if err := x.XenstoreQuota.fromC(&xc.xenstore_quota);err != nil {
+return fmt.Errorf("converting field XenstoreQuota: %v", err)
+}
 
  return nil}
 
@@ -1825,6 +1828,9 @@ if err := x.TrapUnmappedAccesses.toC(&xc.trap_unmapped_accesses); err != nil {
 return fmt.Errorf("converting field TrapUnmappedAccesses: %v", err)
 }
 xc.xenstore_feature_mask = C.uint32_t(x.XenstoreFeatureMask)
+if err := x.XenstoreQuota.toC(&xc.xenstore_quota); err != nil {
+return fmt.Errorf("converting field XenstoreQuota: %v", err)
+}
 
  return nil
  }
diff --git a/tools/golang/xenlight/types.gen.go b/tools/golang/xenlight/types.gen.go
index 8dd610919d..e0fd78ec03 100644
--- a/tools/golang/xenlight/types.gen.go
+++ b/tools/golang/xenlight/types.gen.go
@@ -629,6 +629,7 @@ VmtraceBufKb int
 Vpmu Defbool
 TrapUnmappedAccesses Defbool
 XenstoreFeatureMask uint32
+XenstoreQuota XsQuotaList
 }
 
 type DomainBuildInfoTypeUnion interface {
diff --git a/tools/include/libxl.h b/tools/include/libxl.h
index 6d2910df34..80e3ec8de9 100644
--- a/tools/include/libxl.h
+++ b/tools/include/libxl.h
@@ -1545,6 +1545,7 @@ void libxl_mac_copy(libxl_ctx *ctx, libxl_mac *dst, const libxl_mac *src);
  * libxl_xs_quota_global_set()
  * libxl_xs_quota_domain_get()
  * libxl_xs_quota_domain_set()
+ * and the xenstore_quota member of struct domain_build_info
  * are available.
  */
 #define LIBXL_HAVE_XENSTORE_QUOTA
diff --git a/tools/libs/light/libxl_dom.c b/tools/libs/light/libxl_dom.c
index 05ebc69534..4ff5f65f6f 100644
--- a/tools/libs/light/libxl_dom.c
+++ b/tools/libs/light/libxl_dom.c
@@ -509,6 +509,14 @@ retry_transaction:
 
     xs_introduce_domain(ctx->xsh, domid, state->store_mfn, state->store_port);
 
+    if (info->xenstore_quota.num_quota) {
+        rc = libxl_xs_quota_domain_set(ctx, domid, &info->xenstore_quota);
+        if (rc) {
+            LOGED(ERROR, domid, "Failed to set Xenstore quota");
+            goto out;
+        }
+    }
+
  out:
     free(vm_path);
     return rc;
diff --git a/tools/libs/light/libxl_domain.c b/tools/libs/light/libxl_domain.c
index 5be47f687f..37fcd92871 100644
--- a/tools/libs/light/libxl_domain.c
+++ b/tools/libs/light/libxl_domain.c
@@ -2533,6 +2533,17 @@ static void retrieve_domain_configuration_end(libxl__egc *egc,
         }
     }
 
+    /* Xenstore quota */
+    {
+        libxl_xs_quota_list_dispose(&d_config->b_info.xenstore_quota);
+        rc = libxl_xs_quota_domain_get(CTX, domid,
+                                       &d_config->b_info.xenstore_quota);
+        if (rc) {
+            LOGED(ERROR, domid, "Fail to get xenstore quota");
+            goto out;
+        }
+    }
+
     /* Devices: disk, nic, vtpm, pcidev etc. */
 
     /* The MERGE macro implements following logic:
diff --git a/tools/libs/light/libxl_types.idl b/tools/libs/light/libxl_types.idl
index 1a63c8af76..a7893460f0 100644
--- a/tools/libs/light/libxl_types.idl
+++ b/tools/libs/light/libxl_types.idl
@@ -760,6 +760,7 @@ libxl_domain_build_info = Struct("domain_build_info",[
     ("vpmu", libxl_defbool),
     ("trap_unmapped_accesses", libxl_defbool),
     ("xenstore_feature_mask", uint32, {'init_val': '~0U'}),
+    ("xenstore_quota", libxl_xs_quota_list),
 
     ], dir=DIR_IN,
        copy_deprecated_fn="libxl__domain_build_info_copy_deprecated",
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Mar 27 13:34:43 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 27 Mar 2026 13:34:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1265655.1556468 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w67Kl-0001IB-G9; Fri, 27 Mar 2026 13:34:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1265655.1556468; Fri, 27 Mar 2026 13:34:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w67Kl-0001I2-Da; Fri, 27 Mar 2026 13:34:43 +0000
Received: by outflank-mailman (input) for mailman id 1265655;
 Fri, 27 Mar 2026 13:34:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w67Kk-0001Hw-VA
 for xen-changelog@lists.xenproject.org; Fri, 27 Mar 2026 13:34:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w67Kl-00CHh4-0U
 for xen-changelog@lists.xenproject.org;
 Fri, 27 Mar 2026 13:34:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w67Kk-002nFz-2w
 for xen-changelog@lists.xenproject.org;
 Fri, 27 Mar 2026 13:34:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=UaQRxnMI/OWgBRay/CT1RakyOCyPRgQdYImxz3jUzdw=; b=HaE2pasm9OEfv1d7qiaSckFJVd
	FGB+AgdVjOfCLlUOkZwfM0jZsUiu8UDdNOw9YD4T1xgX1Ysvs+nkPlRaI8Klk5mwCBEI7FV7YYlWB
	Ll6anFP2ICeuG59E8QkX0EuCp166u9QOlZPC05FCDAjFaol6N/VApU1Y6279kB3MVR/g=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/xl: add xl commands for xenstore quota operations
Message-Id: <E1w67Kk-002nFz-2w@xenbits.xenproject.org>
Date: Fri, 27 Mar 2026 13:34:42 +0000

commit ad860c6454ba950b378c3e0d12211be6730f5c1f
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Fri Mar 20 16:01:19 2026 +0100
Commit:     Anthony PERARD <anthony.perard@vates.tech>
CommitDate: Fri Mar 27 12:06:37 2026 +0100

    tools/xl: add xl commands for xenstore quota operations
    
    Add "xl xenstore-quota-get" and "xl xenstore-quota-set" commands for
    retrieving and setting global and per-domain Xenstore quota.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
---
 tools/xl/Makefile      |  1 +
 tools/xl/xl.h          |  2 ++
 tools/xl/xl_cmdtable.c | 10 ++++++
 tools/xl/xl_parse.c    | 28 ++++++++++++++++
 tools/xl/xl_parse.h    |  1 +
 tools/xl/xl_xsquota.c  | 90 ++++++++++++++++++++++++++++++++++++++++++++++++++
 6 files changed, 132 insertions(+)

diff --git a/tools/xl/Makefile b/tools/xl/Makefile
index 973ff0e1a2..e4eed8be13 100644
--- a/tools/xl/Makefile
+++ b/tools/xl/Makefile
@@ -24,6 +24,7 @@ XL_OBJS += xl_sched.o xl_pci.o xl_vcpu.o xl_cdrom.o xl_mem.o
 XL_OBJS += xl_info.o xl_console.o xl_misc.o
 XL_OBJS += xl_vmcontrol.o xl_saverestore.o xl_migrate.o
 XL_OBJS += xl_vdispl.o xl_vsnd.o xl_vkb.o
+XL_OBJS += xl_xsquota.o
 
 $(XL_OBJS): CFLAGS += $(CFLAGS_libxentoollog)
 $(XL_OBJS): CFLAGS += $(CFLAGS_XL)
diff --git a/tools/xl/xl.h b/tools/xl/xl.h
index 9000df00de..0efc07a6ba 100644
--- a/tools/xl/xl.h
+++ b/tools/xl/xl.h
@@ -217,6 +217,8 @@ int main_psr_mba_set(int argc, char **argv);
 int main_psr_mba_show(int argc, char **argv);
 #endif
 int main_qemu_monitor_command(int argc, char **argv);
+int main_xsquota_get(int argc, char **argv);
+int main_xsquota_set(int argc, char **argv);
 
 void help(const char *command);
 
diff --git a/tools/xl/xl_cmdtable.c b/tools/xl/xl_cmdtable.c
index 06a0039718..5098f72ab4 100644
--- a/tools/xl/xl_cmdtable.c
+++ b/tools/xl/xl_cmdtable.c
@@ -649,6 +649,16 @@ const struct cmd_spec cmd_table[] = {
       "-h print this help\n"
     },
 #endif
+    { "xenstore-quota-get",
+      &main_xsquota_get, 0, 0,
+      "List global or domain specific Xenstore quotas",
+      "<Domain>|-g",
+    },
+    { "xenstore-quota-set",
+      &main_xsquota_set, 0, 1,
+      "Set global or domain specific Xenstore quotas",
+      "<Domain>|-g <quota>=<val>...",
+    },
 };
 
 const int cmdtable_len = ARRAY_SIZE(cmd_table);
diff --git a/tools/xl/xl_parse.c b/tools/xl/xl_parse.c
index 1a2ea8b5d5..4b074fdb58 100644
--- a/tools/xl/xl_parse.c
+++ b/tools/xl/xl_parse.c
@@ -1314,6 +1314,34 @@ out:
     return ret;
 }
 
+int parse_xsquota_item(const char *buf, struct libxl_xs_quota_item *item)
+{
+    const char *eq;
+    char *endptr;
+    unsigned long val;
+
+    eq = strchr(buf, '=');
+    if (!eq) {
+        fprintf(stderr, "Quota specification \"%s\" lacks \"=\".\n", buf);
+        return ERROR_INVAL;
+    }
+    errno = 0;
+    item->name = strndup(buf, eq - buf);
+    if (!item->name)
+        return ERROR_NOMEM;
+    val = strtoul(eq + 1, &endptr, 0);
+    if (errno || !eq[1] || *endptr || (unsigned int)val != val) {
+        fprintf(stderr,
+                "Quota specification \"%s\" uses illegal value \"%s\".\n",
+                buf, eq + 1);
+        return ERROR_INVAL;
+    }
+
+    item->val = val;
+
+    return 0;
+}
+
 void parse_config_data(const char *config_source,
                        const char *config_data,
                        int config_len,
diff --git a/tools/xl/xl_parse.h b/tools/xl/xl_parse.h
index fe0d586cdd..57bb43a067 100644
--- a/tools/xl/xl_parse.h
+++ b/tools/xl/xl_parse.h
@@ -36,6 +36,7 @@ int parse_nic_config(libxl_device_nic *nic, XLU_Config **config, char *token);
 int parse_vdispl_config(libxl_device_vdispl *vdispl, char *token);
 int parse_vsnd_item(libxl_device_vsnd *vsnd, const char *spec);
 int parse_vkb_config(libxl_device_vkb *vkb, char *token);
+int parse_xsquota_item(const char *buf, struct libxl_xs_quota_item *item);
 
 int match_option_size(const char *prefix, size_t len,
                       char *arg, char **argopt);
diff --git a/tools/xl/xl_xsquota.c b/tools/xl/xl_xsquota.c
new file mode 100644
index 0000000000..3533d22dae
--- /dev/null
+++ b/tools/xl/xl_xsquota.c
@@ -0,0 +1,90 @@
+/* SPDX-License-Identifier: LGPL-2.1-only */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <libxl.h>
+#include <libxlutil.h>
+
+#include "xl.h"
+#include "xl_utils.h"
+#include "xl_parse.h"
+
+int main_xsquota_get(int argc, char **argv)
+{
+    libxl_xs_quota_list q;
+    unsigned int i;
+    int rc;
+
+    if (argc != 2) {
+        fprintf(stderr, "Domain or \"-g\" must be specified.\n");
+        return EXIT_FAILURE;
+    }
+
+    libxl_xs_quota_list_init(&q);
+
+    if (!strcmp(argv[1], "-g")) {
+        rc = libxl_xs_quota_global_get(ctx, &q);
+    } else {
+        uint32_t domid = find_domain(argv[1]);
+
+        rc = libxl_xs_quota_domain_get(ctx, domid, &q);
+    }
+
+    if (rc) {
+        libxl_xs_quota_list_dispose(&q);
+        fprintf(stderr, "Quota could not be obtained.\n");
+        return EXIT_FAILURE;
+    }
+
+    printf("Quota name           Quota value\n");
+    printf("--------------------------------\n");
+    for (i = 0; i < q.num_quota; i++)
+        printf("%-20s %8u\n", q.quota[i].name, q.quota[i].val);
+
+    libxl_xs_quota_list_dispose(&q);
+
+    return EXIT_SUCCESS;
+}
+
+int main_xsquota_set(int argc, char **argv)
+{
+    unsigned int i;
+    libxl_xs_quota_list q;
+    int rc = EXIT_FAILURE;
+
+    if (argc < 3) {
+        fprintf(stderr, "Not enough parameters.\n");
+        help("xenstore-quota-set");
+        return EXIT_FAILURE;
+    }
+
+    libxl_xs_quota_list_init(&q);
+
+    q.num_quota = argc - 2;
+    q.quota = xcalloc(q.num_quota, sizeof(*q.quota));
+
+    for (i = 2; i < argc; i++) {
+        if (parse_xsquota_item(argv[i], q.quota + i - 2))
+            goto err;
+    }
+
+    if (!strcmp(argv[1], "-g")) {
+         rc = libxl_xs_quota_global_set(ctx, &q);
+    } else {
+        uint32_t domid = find_domain(argv[1]);
+
+        rc = libxl_xs_quota_domain_set(ctx, domid, &q);
+    }
+
+    if (rc) {
+        fprintf(stderr, "Quota could not be set.\n");
+        rc = EXIT_FAILURE;
+    } else {
+        rc = EXIT_SUCCESS;
+    }
+
+ err:
+    libxl_xs_quota_list_dispose(&q);
+
+    return rc;
+}
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Mar 27 13:34:54 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 27 Mar 2026 13:34:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1265657.1556472 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w67Kw-0001L2-Hk; Fri, 27 Mar 2026 13:34:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1265657.1556472; Fri, 27 Mar 2026 13:34:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w67Kw-0001Kt-F7; Fri, 27 Mar 2026 13:34:54 +0000
Received: by outflank-mailman (input) for mailman id 1265657;
 Fri, 27 Mar 2026 13:34:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w67Kv-0001Kl-1i
 for xen-changelog@lists.xenproject.org; Fri, 27 Mar 2026 13:34:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w67Kv-00CHhA-0k
 for xen-changelog@lists.xenproject.org;
 Fri, 27 Mar 2026 13:34:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w67Ku-002nHK-3D
 for xen-changelog@lists.xenproject.org;
 Fri, 27 Mar 2026 13:34:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=HKrEnxILg1p/YNrPnGlZh0KyvT7SaMZBywDJsWuQhaI=; b=w60+sUONp1+wMGETKiDOZ1opo6
	ySu+wYJxSACIb0a6MW2mTX29oXPof31jRDZptUBJkIdiZ0BNai/gBARzSm/IqUdgWHRIZeoGe99dq
	V6fRiNQLOQs4XqZ4mD/xR6PvNHB4sCBcZ0tLH+JpGxxJGCsE7IHfKrXJ/+WzE1YgceLE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/xl: add support for xenstore quota setting via domain config
Message-Id: <E1w67Ku-002nHK-3D@xenbits.xenproject.org>
Date: Fri, 27 Mar 2026 13:34:52 +0000

commit ea3099e19146106e0a4a7ee724822a356f790a4d
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Fri Mar 20 16:01:20 2026 +0100
Commit:     Anthony PERARD <anthony.perard@vates.tech>
CommitDate: Fri Mar 27 12:06:37 2026 +0100

    tools/xl: add support for xenstore quota setting via domain config
    
    Add a new "xenstore_quota" domain config parameter for setting the
    Xenstore quota of a new domain via a list of <quota>=<val> items.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
---
 docs/man/xl.cfg.5.pod.in | 13 +++++++++++++
 tools/xl/xl_parse.c      | 19 ++++++++++++++++++-
 2 files changed, 31 insertions(+), 1 deletion(-)

diff --git a/docs/man/xl.cfg.5.pod.in b/docs/man/xl.cfg.5.pod.in
index 27c455210b..3aac0bc4fb 100644
--- a/docs/man/xl.cfg.5.pod.in
+++ b/docs/man/xl.cfg.5.pod.in
@@ -748,6 +748,19 @@ via the B<xl info -x> command in dom0.
 The default value is B<0xffffffff>, meaning that all possible Xenstore
 features are visible by the guest.
 
+=item B<xenstore_quota=[ QUOTA_SPEC, QUOTA_SPEC, ...]>
+
+Specifies Xenstore quota values of the domain, overriding the default
+values of Xenstore.
+
+Each B<QUOTA_SPEC> is a B<quota-name>=B<value> specification. The supported
+B<quota-name> identifiers can be obtained by the B<xl xenstore-quota-get -g>
+command. B<value> is a non-negative integer.
+
+As per-domain Xenstore quota are an optional Xenstore feature, the
+B<xenstore_quota> config parameter may not be supported by all Xenstore
+implementations.
+
 =back
 
 =head2 Devices
diff --git a/tools/xl/xl_parse.c b/tools/xl/xl_parse.c
index 4b074fdb58..48c72dce9c 100644
--- a/tools/xl/xl_parse.c
+++ b/tools/xl/xl_parse.c
@@ -1354,7 +1354,7 @@ void parse_config_data(const char *config_source,
     XLU_ConfigList *cpus, *vbds, *nics, *pcis, *cvfbs, *cpuids, *vtpms,
                    *usbctrls, *usbdevs, *p9devs, *vdispls, *pvcallsifs_devs;
     XLU_ConfigList *channels, *ioports, *irqs, *iomem, *viridian, *dtdevs,
-                   *mca_caps, *smbios, *llc_colors;
+                   *mca_caps, *smbios, *llc_colors, *xs_quota;
     int num_ioports, num_irqs, num_iomem, num_cpus, num_viridian, num_mca_caps;
     int num_smbios;
     int pci_power_mgmt = 0;
@@ -1363,6 +1363,7 @@ void parse_config_data(const char *config_source,
     int pci_seize = 0;
     int i, e;
     int num_llc_colors;
+    int num_xs_quota;
     char *kernel_basename;
 
     libxl_domain_create_info *c_info = &d_config->c_info;
@@ -1470,6 +1471,22 @@ void parse_config_data(const char *config_source,
     if (!xlu_cfg_get_long (config, "xenstore_feature_mask", &l, 0))
         b_info->xenstore_feature_mask = l;
 
+    if (!xlu_cfg_get_list(config, "xenstore_quota", &xs_quota, &num_xs_quota, 0)) {
+        b_info->xenstore_quota.num_quota = num_xs_quota;
+        b_info->xenstore_quota.quota = xcalloc(num_xs_quota, sizeof(* b_info->xenstore_quota.quota));
+
+        for (i = 0; i < num_xs_quota; i++) {
+           buf = xlu_cfg_get_listitem(xs_quota, i);
+           if (!buf) {
+                fprintf(stderr,
+                        "xl: Can't get element %d in Xenstore quota list\n", i);
+                exit(1);
+            }
+            if (parse_xsquota_item(buf, b_info->xenstore_quota.quota + i))
+                exit(1);
+        }
+    }
+
     libxl_domain_build_info_init_type(b_info, c_info->type);
 
     if (b_info->type == LIBXL_DOMAIN_TYPE_PVH) {
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Mar 27 13:55:07 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 27 Mar 2026 13:55:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1265690.1556485 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w67eR-0004tW-31; Fri, 27 Mar 2026 13:55:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1265690.1556485; Fri, 27 Mar 2026 13:55:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w67eR-0004tL-0P; Fri, 27 Mar 2026 13:55:03 +0000
Received: by outflank-mailman (input) for mailman id 1265690;
 Fri, 27 Mar 2026 13:55:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w67eQ-0004tF-CJ
 for xen-changelog@lists.xenproject.org; Fri, 27 Mar 2026 13:55:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w67eQ-00CI7g-1k
 for xen-changelog@lists.xenproject.org;
 Fri, 27 Mar 2026 13:55:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w67eQ-002qLv-0w
 for xen-changelog@lists.xenproject.org;
 Fri, 27 Mar 2026 13:55:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=cI/HFY0Atp0gH/4Ha3GnSkY+ElC9l1g/y6zHAHJKCEQ=; b=WzaEGbFJHrs1iqAqv4JZfLbclB
	wajzLhfRiWcH/fKCMTYibqil+xYKCFDC0wi/CHpMIlHT174H191JRwnr+ZF9Pr55VGzDDv6+4L1wV
	Xot3AbbkIrx6i3OYfPhcTBzlugwxkZRBVAqkvqP7PKto+YG59lS0griaCjrqGVHSOkUc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/uart: report an error if the device type is not supported
Message-Id: <E1w67eQ-002qLv-0w@xenbits.xenproject.org>
Date: Fri, 27 Mar 2026 13:55:02 +0000

commit 550ee7c198010c297d74b69e07d95a26358eadbd
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Fri Mar 20 10:17:15 2026 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Fri Mar 27 14:52:40 2026 +0100

    xen/uart: report an error if the device type is not supported
    
    When using key pairs for the uart configuration (com1 and com2 command line
    options), report an error if the passed device=<type> is not recognized
    instead of silently ignoring it.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/drivers/char/ns16550.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/xen/drivers/char/ns16550.c b/xen/drivers/char/ns16550.c
index df7fff7f81..d384f1c69d 100644
--- a/xen/drivers/char/ns16550.c
+++ b/xen/drivers/char/ns16550.c
@@ -1674,6 +1674,8 @@ static bool __init parse_namevalue_pairs(char *str, struct ns16550 *uart)
                 pci_uart_config(uart, 0, uart - ns16550_com);
                 dev_set = true;
             }
+            else
+                PARSE_ERR_RET("Unknown device type %s\n", param_value);
             break;
 
         case port_bdf:
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Mar 27 14:44:05 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 27 Mar 2026 14:44:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1265791.1556538 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w68Pq-0006T5-Nk; Fri, 27 Mar 2026 14:44:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1265791.1556538; Fri, 27 Mar 2026 14:44:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w68Pq-0006Sx-Ks; Fri, 27 Mar 2026 14:44:02 +0000
Received: by outflank-mailman (input) for mailman id 1265791;
 Fri, 27 Mar 2026 14:44:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w68Pp-0006Sr-Le
 for xen-changelog@lists.xenproject.org; Fri, 27 Mar 2026 14:44:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w68Pp-00CJID-2b
 for xen-changelog@lists.xenproject.org;
 Fri, 27 Mar 2026 14:44:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w68Pp-002wVx-1g
 for xen-changelog@lists.xenproject.org;
 Fri, 27 Mar 2026 14:44:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=81edQXslhIgCJmRAASJZaCNLLuWSc4kqu67e0QofPug=; b=JDUj1UM07Hi0zgowYZQosWpbtX
	+MtIueF2rEXE1iU8K8RbOc5CdF8H13hDdk3/mkojXKmbvr2kGAPdCzceVFI/EnEzyqqsVh8fP2TYd
	iK/aJ7s6qlRWi8ydYsMoQ242RzmyvwdGDbX72FgaBavvLBAUOmNU9P4ZOOUsgUrz5DqI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/libs/store: add get- and set-quota related functions
Message-Id: <E1w68Pp-002wVx-1g@xenbits.xenproject.org>
Date: Fri, 27 Mar 2026 14:44:01 +0000

commit ba9058944748af22bcc438f5b6cf105be7c88cdd
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Fri Mar 20 16:01:09 2026 +0100
Commit:     Anthony PERARD <anthony.perard@vates.tech>
CommitDate: Fri Mar 27 12:06:37 2026 +0100

    tools/libs/store: add get- and set-quota related functions
    
    Add functions for getting and setting Xenstore quota to libxenstore:
    
    xs_get_quota_names(): get the names of the supported quota.
    
    xs_get_global_quota(): get the value of one global quota.
    
    xs_set_global_quota(): set the value of one global quota.
    
    xs_get_domain_quota(): get the value of one quota of a domain.
    
    xs_set_domain_quota(): set the value of one quota of a domain.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
---
 tools/include/xenstore.h         |  37 +++++++++++++
 tools/libs/store/Makefile        |   2 +-
 tools/libs/store/libxenstore.map |   8 +++
 tools/libs/store/xs.c            | 111 +++++++++++++++++++++++++++++++++++++++
 4 files changed, 157 insertions(+), 1 deletion(-)

diff --git a/tools/include/xenstore.h b/tools/include/xenstore.h
index 423422dc50..bf6d767a22 100644
--- a/tools/include/xenstore.h
+++ b/tools/include/xenstore.h
@@ -277,6 +277,43 @@ bool xs_get_features_domain(struct xs_handle *h, unsigned int domid,
 bool xs_set_features_domain(struct xs_handle *h, unsigned int domid,
 			    unsigned int features);
 
+/* Get names of supported quota.
+ * Returns an array of quota names supported by Xenstore. On return
+ * num will contain the number of quota names in the array.
+ * Will return NULL on failure.
+ * The returned array should be freed via free() after usage, this will
+ * free the array AND the strings of the quota names.
+ */
+const char **xs_get_quota_names(struct xs_handle *h, unsigned int *num);
+
+/* Get the value of one global quota.
+ * Returns the global quota value specified by "quota" in "value".
+ * Return false on failure.
+ */
+bool xs_get_global_quota(struct xs_handle *h, const char *quota,
+			 unsigned int *value);
+
+/* Set the value of one global quota.
+ * Sets the global quota value specified by "quota" to "value".
+ * Return false on failure.
+ */
+bool xs_set_global_quota(struct xs_handle *h, const char *quota,
+			 unsigned int value);
+
+/* Get the value of one domain quota.
+ * Returns a domain's quota value specified by "quota" in "value".
+ * Return false on failure.
+ */
+bool xs_get_domain_quota(struct xs_handle *h, unsigned int domid,
+			 const char *quota, unsigned int *value);
+
+/* Set the value of one domain quota.
+ * Sets a domain's quota value specified by "quota" to "value".
+ * Return false on failure.
+ */
+bool xs_set_domain_quota(struct xs_handle *h, unsigned int domid,
+			 const char *quota, unsigned int value);
+
 char *xs_control_command(struct xs_handle *h, const char *cmd,
 			 void *data, unsigned int len);
 /* Deprecated: use xs_control_command() instead. */
diff --git a/tools/libs/store/Makefile b/tools/libs/store/Makefile
index fed43b0008..b52d1f35ad 100644
--- a/tools/libs/store/Makefile
+++ b/tools/libs/store/Makefile
@@ -2,7 +2,7 @@ XEN_ROOT=$(CURDIR)/../../..
 include $(XEN_ROOT)/tools/Rules.mk
 
 MAJOR = 4
-MINOR = 1
+MINOR = 2
 version-script := libxenstore.map
 
 ifeq ($(CONFIG_Linux),y)
diff --git a/tools/libs/store/libxenstore.map b/tools/libs/store/libxenstore.map
index cd9df86749..a08ddd549f 100644
--- a/tools/libs/store/libxenstore.map
+++ b/tools/libs/store/libxenstore.map
@@ -45,3 +45,11 @@ VERS_4.1 {
 		xs_get_features_domain;
 		xs_set_features_domain;
 } VERS_4.0;
+VERS_4.2 {
+	global:
+		xs_get_quota_names;
+		xs_get_global_quota;
+		xs_set_global_quota;
+		xs_get_domain_quota;
+		xs_set_domain_quota;
+} VERS_4.1;
diff --git a/tools/libs/store/xs.c b/tools/libs/store/xs.c
index 8f4b90a3cf..06462445e0 100644
--- a/tools/libs/store/xs.c
+++ b/tools/libs/store/xs.c
@@ -1456,6 +1456,117 @@ bool xs_set_features_domain(struct xs_handle *h, unsigned int domid,
 	return xs_bool(xs_talkv(h, iov, ARRAY_SIZE(iov), NULL));
 }
 
+const char **xs_get_quota_names(struct xs_handle *h, unsigned int *num)
+{
+	struct xsd_sockmsg msg = { .type = XS_GET_QUOTA };
+	struct iovec iov[1];
+	const char **quota;
+	char *reply;
+	char *c;
+	unsigned int i;
+
+	iov[0].iov_base = &msg;
+	iov[0].iov_len  = sizeof(msg);
+
+	reply = xs_talkv(h, iov, ARRAY_SIZE(iov), NULL);
+	if (!reply)
+		return NULL;
+
+	*num = 1;
+	for (c = reply; *c; c++)
+		if (*c == ' ')
+			(*num)++;
+
+	quota = malloc(*num * sizeof(char *) + strlen(reply) + 1);
+	c = (char *)(quota + *num);
+	strcpy(c, reply);
+	for (i = 0; i < *num; i++) {
+		quota[i] = c;
+		c = strchr(c, ' ');
+		if (c) {
+			*c = 0;
+			c++;
+		}
+	}
+
+	return quota;
+}
+
+bool xs_get_global_quota(struct xs_handle *h, const char *quota,
+			 unsigned int *value)
+{
+	struct xsd_sockmsg msg = { .type = XS_GET_QUOTA };
+	struct iovec iov[2];
+
+	iov[0].iov_base = &msg;
+	iov[0].iov_len  = sizeof(msg);
+	iov[1].iov_base = (char *)quota;
+	iov[1].iov_len  = strlen(quota) + 1;
+
+	return xs_uint(xs_talkv(h, iov, ARRAY_SIZE(iov), NULL), value);
+}
+
+bool xs_set_global_quota(struct xs_handle *h, const char *quota,
+			 unsigned int value)
+{
+	struct xsd_sockmsg msg = { .type = XS_SET_QUOTA };
+	char val_str[MAX_STRLEN(value)];
+	struct iovec iov[3];
+
+	snprintf(val_str, sizeof(val_str), "%u", value);
+
+	iov[0].iov_base = &msg;
+	iov[0].iov_len  = sizeof(msg);
+	iov[1].iov_base = (char *)quota;
+	iov[1].iov_len  = strlen(quota) + 1;
+	iov[2].iov_base = val_str;
+	iov[2].iov_len  = strlen(val_str) + 1;
+
+	return xs_bool(xs_talkv(h, iov, ARRAY_SIZE(iov), NULL));
+}
+
+bool xs_get_domain_quota(struct xs_handle *h, unsigned int domid,
+			 const char *quota, unsigned int *value)
+{
+	struct xsd_sockmsg msg = { .type = XS_GET_QUOTA };
+	char domid_str[MAX_STRLEN(domid)];
+	struct iovec iov[3];
+
+	snprintf(domid_str, sizeof(domid_str), "%u", domid);
+
+	iov[0].iov_base = &msg;
+	iov[0].iov_len  = sizeof(msg);
+	iov[1].iov_base = domid_str;
+	iov[1].iov_len  = strlen(domid_str) + 1;
+	iov[2].iov_base = (char *)quota;
+	iov[2].iov_len  = strlen(quota) + 1;
+
+	return xs_uint(xs_talkv(h, iov, ARRAY_SIZE(iov), NULL), value);
+}
+
+bool xs_set_domain_quota(struct xs_handle *h, unsigned int domid,
+			 const char *quota, unsigned int value)
+{
+	struct xsd_sockmsg msg = { .type = XS_SET_QUOTA };
+	char domid_str[MAX_STRLEN(domid)];
+	char val_str[MAX_STRLEN(value)];
+	struct iovec iov[4];
+
+	snprintf(domid_str, sizeof(domid_str), "%u", domid);
+	snprintf(val_str, sizeof(val_str), "%u", value);
+
+	iov[0].iov_base = &msg;
+	iov[0].iov_len  = sizeof(msg);
+	iov[1].iov_base = domid_str;
+	iov[1].iov_len  = strlen(domid_str) + 1;
+	iov[2].iov_base = (char *)quota;
+	iov[2].iov_len  = strlen(quota) + 1;
+	iov[3].iov_base = val_str;
+	iov[3].iov_len  = strlen(val_str) + 1;
+
+	return xs_bool(xs_talkv(h, iov, ARRAY_SIZE(iov), NULL));
+}
+
 char *xs_control_command(struct xs_handle *h, const char *cmd,
 			 void *data, unsigned int len)
 {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 27 14:44:12 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 27 Mar 2026 14:44:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1265792.1556542 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w68Q0-0006VU-QB; Fri, 27 Mar 2026 14:44:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1265792.1556542; Fri, 27 Mar 2026 14:44:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w68Q0-0006VM-Nd; Fri, 27 Mar 2026 14:44:12 +0000
Received: by outflank-mailman (input) for mailman id 1265792;
 Fri, 27 Mar 2026 14:44:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w68Pz-0006VE-Nb
 for xen-changelog@lists.xenproject.org; Fri, 27 Mar 2026 14:44:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w68Pz-00CJIL-2v
 for xen-changelog@lists.xenproject.org;
 Fri, 27 Mar 2026 14:44:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w68Pz-002wXp-26
 for xen-changelog@lists.xenproject.org;
 Fri, 27 Mar 2026 14:44:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=QQaV2ajWNKk+9YDAjKlRYvWpUL+RnECWUea3LY3VmlQ=; b=hX1E3gZLbKLbnfrXa3Uk09U0aI
	WlvMSx8i3gi+fIyqERZit7dkr6OwXJ5T1cHLVjoTcYuiZzO6LKsgWv9EEhkafGlaReRF+jr55QNNS
	yYFLwoPsaTrKgsKMVT3YOjD3q3Bq+BP9/upceuXNafIlIxm9astk0hm0fd7eGjceot5c=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/xenstored: add helper to parse domid
Message-Id: <E1w68Pz-002wXp-26@xenbits.xenproject.org>
Date: Fri, 27 Mar 2026 14:44:11 +0000

commit f8402a98b4fe345d403bd35166c33e8c6fda63b7
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Fri Mar 20 16:01:10 2026 +0100
Commit:     Anthony PERARD <anthony.perard@vates.tech>
CommitDate: Fri Mar 27 12:06:37 2026 +0100

    tools/xenstored: add helper to parse domid
    
    Today a domid passed in by a command is parsed using atoi(). This
    will still "succeed" even with a domid like "x", resulting in "0" to
    be used instead.
    
    Use a common domid parser instead rejecting everything but integers
    in the range 0..65535 like specified in docs/misc/xenstore.txt.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
---
 tools/xenstored/domain.c | 47 +++++++++++++++++++++++++++++++++++++++--------
 1 file changed, 39 insertions(+), 8 deletions(-)

diff --git a/tools/xenstored/domain.c b/tools/xenstored/domain.c
index e453b3061f..a70acddf94 100644
--- a/tools/xenstored/domain.c
+++ b/tools/xenstored/domain.c
@@ -732,6 +732,18 @@ static char *talloc_domain_path(const void *context, unsigned int domid)
 	return talloc_asprintf(context, "/local/domain/%u", domid);
 }
 
+/* Parse a domid. Sets errno either to 0 or EINVAL. */
+static unsigned int parse_domid(const char *input)
+{
+	unsigned long domid;
+	char *endptr;
+
+	domid = strtoul(input, &endptr, 10);
+	errno = (*endptr != 0 || domid > 65535) ? EINVAL : 0;
+
+	return domid;
+}
+
 int domain_get_quota(const void *ctx, struct connection *conn,
 		     unsigned int domid)
 {
@@ -1077,7 +1089,10 @@ int do_introduce(const void *ctx, struct connection *conn,
 	if (get_strings(in, vec, ARRAY_SIZE(vec)) < ARRAY_SIZE(vec))
 		return EINVAL;
 
-	domid = atoi(vec[0]);
+	domid = parse_domid(vec[0]);
+	if (errno)
+		return errno;
+
 	/* Ignore the gfn, we don't need it. */
 	port = atoi(vec[2]);
 
@@ -1124,8 +1139,12 @@ int do_set_target(const void *ctx, struct connection *conn,
 	if (get_strings(in, vec, ARRAY_SIZE(vec)) < ARRAY_SIZE(vec))
 		return EINVAL;
 
-	domid = atoi(vec[0]);
-	tdomid = atoi(vec[1]);
+	domid = parse_domid(vec[0]);
+	if (errno)
+		return errno;
+	tdomid = parse_domid(vec[1]);
+	if (errno)
+		return errno;
 
         domain = find_connected_domain(domid);
 	if (IS_ERR(domain))
@@ -1152,7 +1171,9 @@ static struct domain *onearg_domain(struct connection *conn,
 	if (!domid_str)
 		return ERR_PTR(-EINVAL);
 
-	domid = atoi(domid_str);
+	domid = parse_domid(domid_str);
+	if (errno)
+		return ERR_PTR(-errno);
 	if (domid == store_domid || domid == priv_domid)
 		return ERR_PTR(-EINVAL);
 
@@ -1200,11 +1221,15 @@ int do_get_domain_path(const void *ctx, struct connection *conn,
 {
 	char *path;
 	const char *domid_str = onearg(in);
+	unsigned int domid;
 
 	if (!domid_str)
 		return EINVAL;
 
-	path = talloc_domain_path(ctx, atoi(domid_str));
+	domid = parse_domid(domid_str);
+	if (errno)
+		return errno;
+	path = talloc_domain_path(ctx, domid);
 	if (!path)
 		return errno;
 
@@ -1223,7 +1248,9 @@ int do_is_domain_introduced(const void *ctx, struct connection *conn,
 	if (!domid_str)
 		return EINVAL;
 
-	domid = atoi(domid_str);
+	domid = parse_domid(domid_str);
+	if (errno)
+		return errno;
 	if (domid == DOMID_SELF)
 		result = 1;
 	else
@@ -1261,7 +1288,9 @@ int do_get_feature(const void *ctx, struct connection *conn,
 		return EINVAL;
 
 	if (n_args == 1) {
-		domid = atoi(vec[0]);
+		domid = parse_domid(vec[0]);
+		if (errno)
+			return errno;
 		domain = find_or_alloc_existing_domain(domid);
 		if (!domain)
 			return ENOENT;
@@ -1289,7 +1318,9 @@ int do_set_feature(const void *ctx, struct connection *conn,
 	if (get_strings(in, vec, ARRAY_SIZE(vec)) != ARRAY_SIZE(vec))
 		return EINVAL;
 
-	domid = atoi(vec[0]);
+	domid = parse_domid(vec[0]);
+	if (errno)
+		return errno;
 	features = atoi(vec[1]);
 	domain = find_or_alloc_existing_domain(domid);
 	if (!domain)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 27 14:44:22 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 27 Mar 2026 14:44:22 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1265793.1556546 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w68QA-0006Xg-Ri; Fri, 27 Mar 2026 14:44:22 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1265793.1556546; Fri, 27 Mar 2026 14:44:22 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w68QA-0006XY-P5; Fri, 27 Mar 2026 14:44:22 +0000
Received: by outflank-mailman (input) for mailman id 1265793;
 Fri, 27 Mar 2026 14:44:21 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w68Q9-0006XQ-RM
 for xen-changelog@lists.xenproject.org; Fri, 27 Mar 2026 14:44:21 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w68QA-00CJIU-02
 for xen-changelog@lists.xenproject.org;
 Fri, 27 Mar 2026 14:44:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w68Q9-002wZl-2S
 for xen-changelog@lists.xenproject.org;
 Fri, 27 Mar 2026 14:44:21 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ZgARBm3I1g28lO74OF4QwUqUbQ+kHTft2mGLxbdNWDw=; b=pXtHAPAg0JLsRYGVbQMmqFATfj
	gB/fK1vR7C0sSqV82HWFuicZjwK52pOwOEywFoYdvFvKfq9QeSxDs2sLxiiv1K4+d+FizWTnglKCO
	g4t+BL7BMtBKOcS31a0NVQzDfW2wr9Z0ZZuef3NGPwKfPNdmKRdzYy4Q53DAc3v2vmzo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/xenstored: add central quota check functions
Message-Id: <E1w68Q9-002wZl-2S@xenbits.xenproject.org>
Date: Fri, 27 Mar 2026 14:44:21 +0000

commit 70fcc2531c353b50f564309aa43bf7efd98021d1
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Fri Mar 20 16:01:11 2026 +0100
Commit:     Anthony PERARD <anthony.perard@vates.tech>
CommitDate: Fri Mar 27 12:06:37 2026 +0100

    tools/xenstored: add central quota check functions
    
    Add central functions for checking a value (either an absolute one or
    the current domain value plus an offset) against a specific quota.
    
    This is in preparation of introducing per-domain quota.
    
    The required changes allow to drop the "update" parameter from
    domain_nbentry_fix().
    
    While at it, make the returned error for exceeded quota consistent by
    changing one instance from "E2BIG" to "ENOSPC".
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
---
 tools/xenstored/core.c        |  4 +--
 tools/xenstored/domain.c      | 74 ++++++++++++++++++++-----------------------
 tools/xenstored/domain.h      |  6 ++--
 tools/xenstored/transaction.c |  2 +-
 tools/xenstored/watch.c       |  4 +--
 5 files changed, 42 insertions(+), 48 deletions(-)

diff --git a/tools/xenstored/core.c b/tools/xenstored/core.c
index e4d2fd4876..e86d947be4 100644
--- a/tools/xenstored/core.c
+++ b/tools/xenstored/core.c
@@ -1539,7 +1539,7 @@ static struct node *create_node(struct connection *conn, const void *ctx,
 	for (i = node; i; i = i->parent) {
 		/* i->parent is set for each new node, so check quota. */
 		if (i->parent &&
-		    domain_nbentry(conn) >= hard_quotas[ACC_NODES].val) {
+		    domain_quota_add_exceeds(conn->domain, ACC_NODES, 1)) {
 			ret = ENOSPC;
 			goto err;
 		}
@@ -2321,7 +2321,7 @@ void setup_structure(bool live_update)
 		manual_node("/tool/xenstored", NULL);
 		manual_node("@releaseDomain", NULL);
 		manual_node("@introduceDomain", NULL);
-		domain_nbentry_fix(priv_domid, 5, true);
+		domain_nbentry_fix(priv_domid, 5);
 	}
 }
 
diff --git a/tools/xenstored/domain.c b/tools/xenstored/domain.c
index a70acddf94..21f6f13f83 100644
--- a/tools/xenstored/domain.c
+++ b/tools/xenstored/domain.c
@@ -389,6 +389,25 @@ void wrl_apply_debit_trans_commit(struct connection *conn)
 	wrl_apply_debit_actual(conn->domain);
 }
 
+static bool domain_quota_val_exceeds(struct domain *d, enum accitem what,
+				     unsigned int val)
+{
+	unsigned int quota = hard_quotas[what].val;
+
+	if (!quota || !domid_is_unprivileged(d->domid))
+		return false;
+
+	return val >= quota;
+}
+
+bool domain_quota_add_exceeds(struct domain *d, enum accitem what, int add)
+{
+	if (add < 0 || !d)
+		return false;
+
+	return domain_quota_val_exceeds(d, what, d->acc[what].val + add);
+}
+
 static bool check_indexes(XENSTORE_RING_IDX cons, XENSTORE_RING_IDX prod)
 {
 	return ((prod - cons) <= XENSTORE_RING_SIZE);
@@ -490,10 +509,9 @@ static bool domain_can_read(struct connection *conn)
 	if (domain_is_unprivileged(conn)) {
 		if (domain->wrl_credit < 0)
 			return false;
-		if (domain->acc[ACC_OUTST].val >= hard_quotas[ACC_OUTST].val)
+		if (domain_quota_add_exceeds(domain, ACC_OUTST, 0))
 			return false;
-		if (domain->acc[ACC_MEM].val >= hard_quotas[ACC_MEM].val &&
-		    hard_quotas[ACC_MEM].val)
+		if (domain_quota_add_exceeds(domain, ACC_MEM, 0))
 			return false;
 	}
 
@@ -916,16 +934,20 @@ do {						\
 
 int acc_fix_domains(struct list_head *head, bool chk_quota, bool update)
 {
+	struct domain *d;
 	struct changed_domain *cd;
-	int cnt;
 
 	list_for_each_entry(cd, head, list) {
-		cnt = domain_nbentry_fix(cd->domid, cd->acc[ACC_NODES], update);
-		if (!update) {
-			if (chk_quota && cnt >= hard_quotas[ACC_NODES].val)
-				return ENOSPC;
-			if (cnt < 0)
+		if (update) {
+			domain_nbentry_fix(cd->domid, cd->acc[ACC_NODES]);
+		} else if (chk_quota) {
+			d = find_or_alloc_existing_domain(cd->domid);
+
+			if (!d)
 				return ENOMEM;
+			if (domain_quota_add_exceeds(d, ACC_NODES,
+						     cd->acc[ACC_NODES]))
+				return ENOSPC;
 		}
 	}
 
@@ -1763,7 +1785,7 @@ bool domain_max_chk(const struct connection *conn, enum accitem what,
 	if (!conn || !conn->domain)
 		return false;
 
-	if (domain_is_unprivileged(conn) && val > hard_quotas[what].val)
+	if (domain_quota_val_exceeds(conn->domain, what, val))
 		return true;
 
 	domain_acc_valid_max(conn->domain, what, val);
@@ -1783,21 +1805,9 @@ int domain_nbentry_dec(struct connection *conn, unsigned int domid)
 	       ? errno : 0;
 }
 
-int domain_nbentry_fix(unsigned int domid, int num, bool update)
-{
-	int ret;
-
-	ret = domain_acc_add(NULL, domid, ACC_NODES, update ? num : 0, update);
-	if (ret < 0 || update)
-		return ret;
-
-	return domid_is_unprivileged(domid) ? ret + num : 0;
-}
-
-unsigned int domain_nbentry(struct connection *conn)
+int domain_nbentry_fix(unsigned int domid, int num)
 {
-	return domain_is_unprivileged(conn)
-	       ? domain_acc_add(conn, conn->id, ACC_NODES, 0, true) : 0;
+	return domain_acc_add(NULL, domid, ACC_NODES, num, true);
 }
 
 static bool domain_chk_quota(struct connection *conn, unsigned int mem)
@@ -1812,7 +1822,7 @@ static bool domain_chk_quota(struct connection *conn, unsigned int mem)
 	domain = conn->domain;
 	now = time(NULL);
 
-	if (mem >= hard_quotas[ACC_MEM].val && hard_quotas[ACC_MEM].val) {
+	if (domain_quota_val_exceeds(domain, ACC_MEM, mem)) {
 		if (domain->hard_quota_reported)
 			return true;
 		syslog(LOG_ERR, "Domain %u exceeds hard memory quota, Xenstore interface to domain stalled\n",
@@ -1888,13 +1898,6 @@ void domain_watch_dec(struct connection *conn)
 	domain_acc_add(conn, conn->id, ACC_WATCH, -1, true);
 }
 
-int domain_watch(struct connection *conn)
-{
-	return (domain_is_unprivileged(conn))
-		? domain_acc_add(conn, conn->id, ACC_WATCH, 0, true)
-		: 0;
-}
-
 void domain_outstanding_inc(struct connection *conn)
 {
 	domain_acc_add(conn, conn->id, ACC_OUTST, 1, true);
@@ -1915,13 +1918,6 @@ void domain_transaction_dec(struct connection *conn)
 	domain_acc_add(conn, conn->id, ACC_TRANS, -1, true);
 }
 
-unsigned int domain_transaction_get(struct connection *conn)
-{
-	return (domain_is_unprivileged(conn))
-		? domain_acc_add(conn, conn->id, ACC_TRANS, 0, true)
-		: 0;
-}
-
 const char *dump_state_connections(FILE *fp)
 {
 	const char *ret = NULL;
diff --git a/tools/xenstored/domain.h b/tools/xenstored/domain.h
index 28186ccac0..29b91fc783 100644
--- a/tools/xenstored/domain.h
+++ b/tools/xenstored/domain.h
@@ -113,8 +113,7 @@ int domain_alloc_permrefs(struct node_perms *perms);
 /* Quota manipulation */
 int domain_nbentry_inc(struct connection *conn, unsigned int domid);
 int domain_nbentry_dec(struct connection *conn, unsigned int domid);
-int domain_nbentry_fix(unsigned int domid, int num, bool update);
-unsigned int domain_nbentry(struct connection *conn);
+int domain_nbentry_fix(unsigned int domid, int num);
 int domain_memory_add(struct connection *conn, unsigned int domid, int mem,
 		      bool no_quota_check);
 
@@ -141,12 +140,10 @@ static inline void domain_memory_add_nochk(struct connection *conn,
 }
 void domain_watch_inc(struct connection *conn);
 void domain_watch_dec(struct connection *conn);
-int domain_watch(struct connection *conn);
 void domain_outstanding_inc(struct connection *conn);
 void domain_outstanding_dec(struct connection *conn, unsigned int domid);
 void domain_transaction_inc(struct connection *conn);
 void domain_transaction_dec(struct connection *conn);
-unsigned int domain_transaction_get(struct connection *conn);
 int domain_get_quota(const void *ctx, struct connection *conn,
 		     unsigned int domid);
 
@@ -161,6 +158,7 @@ int domain_max_global_acc(const void *ctx, struct connection *conn);
 void domain_reset_global_acc(void);
 bool domain_max_chk(const struct connection *conn, enum accitem what,
 		    unsigned int val);
+bool domain_quota_add_exceeds(struct domain *d, enum accitem what, int add);
 
 extern long wrl_ntransactions;
 
diff --git a/tools/xenstored/transaction.c b/tools/xenstored/transaction.c
index 167cd597fd..47cd6ecd3c 100644
--- a/tools/xenstored/transaction.c
+++ b/tools/xenstored/transaction.c
@@ -470,7 +470,7 @@ int do_transaction_start(const void *ctx, struct connection *conn,
 	if (conn->transaction)
 		return EBUSY;
 
-	if (domain_transaction_get(conn) > hard_quotas[ACC_TRANS].val)
+	if (domain_quota_add_exceeds(conn->domain, ACC_TRANS, 1))
 		return ENOSPC;
 
 	/* Attach transaction to ctx for autofree until it's complete */
diff --git a/tools/xenstored/watch.c b/tools/xenstored/watch.c
index b66a9f1a39..becb9c339d 100644
--- a/tools/xenstored/watch.c
+++ b/tools/xenstored/watch.c
@@ -220,8 +220,8 @@ int do_watch(const void *ctx, struct connection *conn, struct buffered_data *in)
 			return EEXIST;
 	}
 
-	if (domain_watch(conn) > hard_quotas[ACC_WATCH].val)
-		return E2BIG;
+	if (domain_quota_add_exceeds(conn->domain, ACC_WATCH, 1))
+		return ENOSPC;
 
 	watch = add_watch(conn, vec[0], vec[1], relative, false);
 	if (!watch)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 27 14:44:32 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 27 Mar 2026 14:44:32 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1265794.1556550 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w68QK-0006bJ-T8; Fri, 27 Mar 2026 14:44:32 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1265794.1556550; Fri, 27 Mar 2026 14:44:32 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w68QK-0006bC-QW; Fri, 27 Mar 2026 14:44:32 +0000
Received: by outflank-mailman (input) for mailman id 1265794;
 Fri, 27 Mar 2026 14:44:31 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w68QJ-0006b4-U4
 for xen-changelog@lists.xenproject.org; Fri, 27 Mar 2026 14:44:31 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w68QK-00CJIb-0M
 for xen-changelog@lists.xenproject.org;
 Fri, 27 Mar 2026 14:44:31 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w68QJ-002wbX-2m
 for xen-changelog@lists.xenproject.org;
 Fri, 27 Mar 2026 14:44:31 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Gq+F02jIyrNtBJRYBrv9gQFz/2TdBDGSfbB5iKSUH2g=; b=Y4YZAS1j6FcZcHjToGt5vAxguu
	NLY46YZJNS7ifXDSh37p0Dyk46eVb8jW2N0afshZB8Rc123SzsFG4eWN9c/hNemohMPfe2F9zDMFl
	OXIEGogEsoo8e1U3TW2AdF6travRGrtRcWwj+PguReo/VAgLbRUTipEyctZbbdm3yO5g=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/xenstored: rework hard_quotas and soft_quotas arrays
Message-Id: <E1w68QJ-002wbX-2m@xenbits.xenproject.org>
Date: Fri, 27 Mar 2026 14:44:31 +0000

commit c777202d67f113d5671a5027a6837aadb91a37a6
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Fri Mar 20 16:01:12 2026 +0100
Commit:     Anthony PERARD <anthony.perard@vates.tech>
CommitDate: Fri Mar 27 12:06:37 2026 +0100

    tools/xenstored: rework hard_quotas and soft_quotas arrays
    
    Instead of having one array for hard quotas and one for soft quotas,
    split them differently: have one array with the quota names and
    descriptions, and one with the quota values (soft and hard) and the
    maximum value so far.
    
    This is in preparation of supporting per-domain quotas, as the layout
    of the second array elements will be reused in the domain data.
    
    While at it add an accessor for getting a soft quota value, as this
    will be needed for per-domain quotas, too.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
---
 tools/xenstored/control.c | 24 +++++++++--------
 tools/xenstored/core.c    | 33 ++++++++++++++----------
 tools/xenstored/domain.c  | 65 +++++++++++++++++++++++++----------------------
 tools/xenstored/domain.h  | 15 ++++++-----
 4 files changed, 76 insertions(+), 61 deletions(-)

diff --git a/tools/xenstored/control.c b/tools/xenstored/control.c
index 2611a6fade..ca59d30d05 100644
--- a/tools/xenstored/control.c
+++ b/tools/xenstored/control.c
@@ -101,7 +101,7 @@ static int do_control_log(const void *ctx, struct connection *conn,
 }
 
 static int quota_show_current(const void *ctx, struct connection *conn,
-			      const struct quota *quotas)
+			      unsigned int idx)
 {
 	char *resp;
 	unsigned int i;
@@ -111,11 +111,12 @@ static int quota_show_current(const void *ctx, struct connection *conn,
 		return ENOMEM;
 
 	for (i = 0; i < ACC_N; i++) {
-		if (!quotas[i].name)
+		if (!quota_adm[i].name || quotas[i].val[idx] == Q_VAL_DISABLED)
 			continue;
 		resp = talloc_asprintf_append(resp, "%-17s: %8d %s\n",
-					      quotas[i].name, quotas[i].val,
-					      quotas[i].descr);
+					      quota_adm[i].name,
+					      quotas[i].val[idx],
+					      quota_adm[i].descr);
 		if (!resp)
 			return ENOMEM;
 	}
@@ -126,7 +127,7 @@ static int quota_show_current(const void *ctx, struct connection *conn,
 }
 
 static int quota_set(const void *ctx, struct connection *conn,
-		     const char **vec, int num, struct quota *quotas)
+		     const char **vec, int num, unsigned int idx)
 {
 	unsigned int i;
 	int val;
@@ -139,8 +140,9 @@ static int quota_set(const void *ctx, struct connection *conn,
 		return EINVAL;
 
 	for (i = 0; i < ACC_N; i++) {
-		if (quotas[i].name && !strcmp(vec[0], quotas[i].name)) {
-			quotas[i].val = val;
+		if (quota_adm[i].name && !strcmp(vec[0], quota_adm[i].name) &&
+		    quotas[i].val[idx] != Q_VAL_DISABLED) {
+			quotas[i].val[idx] = val;
 			send_ack(conn, XS_CONTROL);
 			return 0;
 		}
@@ -178,10 +180,10 @@ static int do_control_quota(const void *ctx, struct connection *conn,
 			    const char **vec, int num)
 {
 	if (num == 0)
-		return quota_show_current(ctx, conn, hard_quotas);
+		return quota_show_current(ctx, conn, Q_IDX_HARD);
 
 	if (!strcmp(vec[0], "set"))
-		return quota_set(ctx, conn, vec + 1, num - 1, hard_quotas);
+		return quota_set(ctx, conn, vec + 1, num - 1, Q_IDX_HARD);
 
 	if (!strcmp(vec[0], "max"))
 		return quota_max(ctx, conn, vec + 1, num - 1);
@@ -193,10 +195,10 @@ static int do_control_quota_s(const void *ctx, struct connection *conn,
 			      const char **vec, int num)
 {
 	if (num == 0)
-		return quota_show_current(ctx, conn, soft_quotas);
+		return quota_show_current(ctx, conn, Q_IDX_SOFT);
 
 	if (!strcmp(vec[0], "set"))
-		return quota_set(ctx, conn, vec + 1, num - 1, soft_quotas);
+		return quota_set(ctx, conn, vec + 1, num - 1, Q_IDX_SOFT);
 
 	return EINVAL;
 }
diff --git a/tools/xenstored/core.c b/tools/xenstored/core.c
index e86d947be4..dc63c97658 100644
--- a/tools/xenstored/core.c
+++ b/tools/xenstored/core.c
@@ -2614,10 +2614,9 @@ static void set_timeout(const char *arg)
 		barf("unknown timeout \"%s\"\n", arg);
 }
 
-static void set_quota(const char *arg, bool soft)
+static void set_quota(const char *arg, unsigned int idx)
 {
 	const char *eq = strchr(arg, '=');
-	struct quota *q = soft ? soft_quotas : hard_quotas;
 	unsigned int val;
 	unsigned int i;
 
@@ -2626,8 +2625,9 @@ static void set_quota(const char *arg, bool soft)
 	val = get_optval_uint(eq + 1);
 
 	for (i = 0; i < ACC_N; i++) {
-		if (what_matches(arg, q[i].name)) {
-			q[i].val = val;
+		if (what_matches(arg, quota_adm[i].name) &&
+		    quotas[i].val[idx] != Q_VAL_DISABLED) {
+			quotas[i].val[idx] = val;
 			return;
 		}
 	}
@@ -2635,6 +2635,11 @@ static void set_quota(const char *arg, bool soft)
 	barf("unknown quota \"%s\"\n", arg);
 }
 
+static void set_one_quota(const char *arg, unsigned int idx, enum accitem what)
+{
+	quotas[what].val[idx] = get_optval_uint(arg);
+}
+
 /* Sorted by bit values of TRACE_* flags. Flag is (1u << index). */
 const char *const trace_switches[] = {
 	"obj", "io", "wrl", "acc", "tdb",
@@ -2688,7 +2693,7 @@ int main(int argc, char *argv[])
 				  options, NULL)) != -1) {
 		switch (opt) {
 		case 'E':
-			hard_quotas[ACC_NODES].val = get_optval_uint(optarg);
+			set_one_quota(optarg, Q_IDX_HARD, ACC_NODES);
 			break;
 		case 'F':
 			pidfile = optarg;
@@ -2700,10 +2705,10 @@ int main(int argc, char *argv[])
 			dofork = false;
 			break;
 		case 'S':
-			hard_quotas[ACC_NODESZ].val = get_optval_uint(optarg);
+			set_one_quota(optarg, Q_IDX_HARD, ACC_NODESZ);
 			break;
 		case 't':
-			hard_quotas[ACC_TRANS].val = get_optval_uint(optarg);
+			set_one_quota(optarg, Q_IDX_HARD, ACC_TRANS);
 			break;
 		case 'T':
 			tracefile = optarg;
@@ -2716,22 +2721,22 @@ int main(int argc, char *argv[])
 			keep_orphans = true;
 			break;
 		case 'W':
-			hard_quotas[ACC_WATCH].val = get_optval_uint(optarg);
+			set_one_quota(optarg, Q_IDX_HARD, ACC_WATCH);
 			break;
 		case 'A':
-			hard_quotas[ACC_NPERM].val = get_optval_uint(optarg);
+			set_one_quota(optarg, Q_IDX_HARD, ACC_NPERM);
 			break;
 		case 'M':
-			hard_quotas[ACC_PATHLEN].val = get_optval_uint(optarg);
-			hard_quotas[ACC_PATHLEN].val =
+			set_one_quota(optarg, Q_IDX_HARD, ACC_PATHLEN);
+			quotas[ACC_PATHLEN].val[Q_IDX_HARD] =
 				 min((unsigned int)XENSTORE_REL_PATH_MAX,
-				     hard_quotas[ACC_PATHLEN].val);
+				     quotas[ACC_PATHLEN].val[Q_IDX_HARD]);
 			break;
 		case 'Q':
-			set_quota(optarg, false);
+			set_quota(optarg, Q_IDX_HARD);
 			break;
 		case 'q':
-			set_quota(optarg, true);
+			set_quota(optarg, Q_IDX_SOFT);
 			break;
 		case 'w':
 			set_timeout(optarg);
diff --git a/tools/xenstored/domain.c b/tools/xenstored/domain.c
index 21f6f13f83..4e696a81a8 100644
--- a/tools/xenstored/domain.c
+++ b/tools/xenstored/domain.c
@@ -51,60 +51,60 @@ static evtchn_port_t virq_port;
 
 xenevtchn_handle *xce_handle = NULL;
 
-struct quota hard_quotas[ACC_N] = {
+struct quotaadm quota_adm[ACC_N] = {
 	[ACC_NODES] = {
 		.name = "nodes",
 		.descr = "Nodes per domain",
-		.val = 1000,
 	},
 	[ACC_WATCH] = {
 		.name = "watches",
 		.descr = "Watches per domain",
-		.val = 128,
 	},
 	[ACC_OUTST] = {
 		.name = "outstanding",
 		.descr = "Outstanding requests per domain",
-		.val = 20,
 	},
 	[ACC_MEM] = {
 		.name = "memory",
-		.descr = "Total Xenstore memory per domain (error level)",
-		.val = 2 * 1024 * 1024 + 512 * 1024,	/* 2.5 MB */
+		.descr = "Total Xenstore memory per domain",
 	},
 	[ACC_TRANS] = {
 		.name = "transactions",
 		.descr = "Active transactions per domain",
-		.val = 10,
 	},
 	[ACC_TRANSNODES] = {
 		.name = "transaction-nodes",
 		.descr = "Max. number of accessed nodes per transaction",
-		.val = 1024,
 	},
 	[ACC_NPERM] = {
 		.name = "node-permissions",
 		.descr = "Max. number of permissions per node",
-		.val = 5,
 	},
 	[ACC_PATHLEN] = {
 		.name = "path-max",
 		.descr = "Max. length of a node path",
-		.val = XENSTORE_REL_PATH_MAX,
 	},
 	[ACC_NODESZ] = {
 		.name = "node-size",
 		.descr = "Max. size of a node",
-		.val = 2048,
 	},
 };
 
-struct quota soft_quotas[ACC_N] = {
-	[ACC_MEM] = {
-		.name = "memory",
-		.descr = "Total Xenstore memory per domain (warning level)",
-		.val = 2 * 1024 * 1024,			/* 2.0 MB */
+struct quota quotas[ACC_N] = {
+	[ACC_NODES] =      { .val = { 1000, Q_VAL_DISABLED }, },
+	[ACC_WATCH] =      { .val = {  128, Q_VAL_DISABLED }, },
+	[ACC_OUTST] =      { .val = {   20, Q_VAL_DISABLED }, },
+	[ACC_MEM] =        {
+		.val = { 2 * 1024 * 1024 + 512 * 1024,	/* 2.5 MB */
+			 2 * 1024 * 1024		/* 2.0 MB */ },
 	},
+	[ACC_TRANS] =      { .val = {   10, Q_VAL_DISABLED }, },
+	[ACC_TRANSNODES] = { .val = { 1024, Q_VAL_DISABLED }, },
+	[ACC_NPERM] =      { .val = {    5, Q_VAL_DISABLED }, },
+	[ACC_PATHLEN] =    {
+		.val = { XENSTORE_REL_PATH_MAX, Q_VAL_DISABLED },
+	},
+	[ACC_NODESZ] =     { .val = { 2048, Q_VAL_DISABLED }, },
 };
 
 typedef int32_t wrl_creditt;
@@ -389,10 +389,15 @@ void wrl_apply_debit_trans_commit(struct connection *conn)
 	wrl_apply_debit_actual(conn->domain);
 }
 
+static unsigned int domain_get_soft_quota(struct domain *d, enum accitem what)
+{
+	return quotas[what].val[Q_IDX_SOFT];
+}
+
 static bool domain_quota_val_exceeds(struct domain *d, enum accitem what,
 				     unsigned int val)
 {
-	unsigned int quota = hard_quotas[what].val;
+	unsigned int quota = quotas[what].val[Q_IDX_HARD];
 
 	if (!quota || !domid_is_unprivileged(d->domid))
 		return false;
@@ -777,10 +782,10 @@ int domain_get_quota(const void *ctx, struct connection *conn,
 		return ENOMEM;
 
 	for (i = 0; i < ACC_N; i++) {
-		if (!hard_quotas[i].name)
+		if (!quota_adm[i].name)
 			continue;
 		resp = talloc_asprintf_append(resp, "%-17s: %8u (max %8u)\n",
-					      hard_quotas[i].name,
+					      quota_adm[i].name,
 					      d->acc[i].val, d->acc[i].max);
 		if (!resp)
 			return ENOMEM;
@@ -801,11 +806,10 @@ int domain_max_global_acc(const void *ctx, struct connection *conn)
 		return ENOMEM;
 
 	for (i = 0; i < ACC_N; i++) {
-		if (!hard_quotas[i].name)
+		if (!quota_adm[i].name)
 			continue;
 		resp = talloc_asprintf_append(resp, "%-17s: %8u\n",
-					      hard_quotas[i].name,
-					      hard_quotas[i].max);
+					      quota_adm[i].name, quotas[i].max);
 		if (!resp)
 			return ENOMEM;
 	}
@@ -1631,12 +1635,12 @@ static void domain_acc_valid_max(struct domain *d, enum accitem what,
 				 unsigned int val)
 {
 	assert(what < ARRAY_SIZE(d->acc));
-	assert(what < ARRAY_SIZE(hard_quotas));
+	assert(what < ARRAY_SIZE(quotas));
 
 	if (val > d->acc[what].max)
 		d->acc[what].max = val;
-	if (val > hard_quotas[what].max && domid_is_unprivileged(d->domid))
-		hard_quotas[what].max = val;
+	if (val > quotas[what].max && domid_is_unprivileged(d->domid))
+		quotas[what].max = val;
 }
 
 static int domain_acc_add_valid(struct domain *d, enum accitem what, int add)
@@ -1773,7 +1777,7 @@ void domain_reset_global_acc(void)
 	unsigned int i;
 
 	for (i = 0; i < ACC_N; i++)
-		hard_quotas[i].max = 0;
+		quotas[i].max = 0;
 
 	/* Set current max values seen. */
 	hashtable_iterate(domhash, domain_reset_global_acc_sub, NULL);
@@ -1833,21 +1837,22 @@ static bool domain_chk_quota(struct connection *conn, unsigned int mem)
 	}
 
 	if (now - domain->mem_last_msg >= MEM_WARN_MINTIME_SEC) {
+		unsigned int soft_mem = domain_get_soft_quota(domain, ACC_MEM);
+
 		if (domain->hard_quota_reported) {
 			domain->mem_last_msg = now;
 			domain->hard_quota_reported = false;
 			syslog(LOG_INFO, "Domain %u below hard memory quota again\n",
 			       domain->domid);
 		}
-		if (mem >= soft_quotas[ACC_MEM].val &&
-		    soft_quotas[ACC_MEM].val && !domain->soft_quota_reported) {
+		if (mem >= soft_mem && soft_mem &&
+		    !domain->soft_quota_reported) {
 			domain->mem_last_msg = now;
 			domain->soft_quota_reported = true;
 			syslog(LOG_WARNING, "Domain %u exceeds soft memory quota\n",
 			       domain->domid);
 		}
-		if (mem < soft_quotas[ACC_MEM].val &&
-		    domain->soft_quota_reported) {
+		if (mem < soft_mem && domain->soft_quota_reported) {
 			domain->mem_last_msg = now;
 			domain->soft_quota_reported = false;
 			syslog(LOG_INFO, "Domain %u below soft memory quota again\n",
diff --git a/tools/xenstored/domain.h b/tools/xenstored/domain.h
index 29b91fc783..3bedadb477 100644
--- a/tools/xenstored/domain.h
+++ b/tools/xenstored/domain.h
@@ -40,15 +40,18 @@ enum accitem {
 	ACC_N,			/* Number of elements per domain. */
 };
 
-struct quota {
+extern struct quotaadm {
 	const char *name;
 	const char *descr;
-	unsigned int val;
-	unsigned int max;
-};
+} quota_adm[ACC_N];
 
-extern struct quota hard_quotas[ACC_N];
-extern struct quota soft_quotas[ACC_N];
+extern struct quota {
+	unsigned int val[2];
+#define Q_IDX_HARD      0
+#define Q_IDX_SOFT      1
+#define Q_VAL_DISABLED  UINT_MAX
+	unsigned int max;
+} quotas[ACC_N];
 
 void handle_event(void);
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 27 14:44:44 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 27 Mar 2026 14:44:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1265795.1556553 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w68QV-0006dx-Vv; Fri, 27 Mar 2026 14:44:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1265795.1556553; Fri, 27 Mar 2026 14:44:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w68QV-0006dp-TM; Fri, 27 Mar 2026 14:44:43 +0000
Received: by outflank-mailman (input) for mailman id 1265795;
 Fri, 27 Mar 2026 14:44:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w68QU-0006dd-19
 for xen-changelog@lists.xenproject.org; Fri, 27 Mar 2026 14:44:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w68QU-00CJIz-0f
 for xen-changelog@lists.xenproject.org;
 Fri, 27 Mar 2026 14:44:41 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w68QT-002wdf-35
 for xen-changelog@lists.xenproject.org;
 Fri, 27 Mar 2026 14:44:41 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=V6LlSypAA2p+x70nu1D7FwUevthztbtwK8I5t20tDvg=; b=2ABjVFeWWB/nPYxrAW0LvsOByU
	L+Hh+KOiOy4eUGapVcXg463/qJL51wX1XoY3BLIC+7NaovxVavDlV4MCZBiW64AM/6rOpJtO50A9W
	Axoli8l1x6bsh0UnO1nzRLb6tco3UKfYe1if6M9p1FS8fvdvflGHPa+z5REqP/k0lk8A=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/xenstored: add GLOBAL_QUOTA_DATA record for live update
Message-Id: <E1w68QT-002wdf-35@xenbits.xenproject.org>
Date: Fri, 27 Mar 2026 14:44:41 +0000

commit c427829d0effbeb5ef5c2e734a51e2b69a1b7640
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Fri Mar 20 16:01:13 2026 +0100
Commit:     Anthony PERARD <anthony.perard@vates.tech>
CommitDate: Fri Mar 27 12:06:37 2026 +0100

    tools/xenstored: add GLOBAL_QUOTA_DATA record for live update
    
    Communicate the global quota settings via the GLOBAL_QUOTA_DATA
    record to the new Xenstore instance.
    
    This avoids to lose global quota settings done via xenstore-control.
    
    In theory it would be possible to drop any quota related command line
    parameters in the live update case, but they don't do any harm, as
    the record data is applied on top of the command line data.
    
    For soft-quota just prepend "soft-" to the quota name.
    
    Use sub-functions for building and analyzing the quota part of the
    migration stream, as they will be reused for per-domain quotas.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
---
 tools/xenstored/domain.c | 132 +++++++++++++++++++++++++++++++++++++++++++++++
 tools/xenstored/domain.h |   2 +
 tools/xenstored/lu.c     |   6 +++
 3 files changed, 140 insertions(+)

diff --git a/tools/xenstored/domain.c b/tools/xenstored/domain.c
index 4e696a81a8..cfc8fd0cb4 100644
--- a/tools/xenstored/domain.c
+++ b/tools/xenstored/domain.c
@@ -107,6 +107,9 @@ struct quota quotas[ACC_N] = {
 	[ACC_NODESZ] =     { .val = { 2048, Q_VAL_DISABLED }, },
 };
 
+#define SOFT_PREFIX	"soft-"
+#define SOFT_PREFIX_LEN	(sizeof(SOFT_PREFIX) - 1)
+
 typedef int32_t wrl_creditt;
 
 struct domain
@@ -1363,6 +1366,29 @@ int do_set_feature(const void *ctx, struct connection *conn,
 	return 0;
 }
 
+static bool parse_quota_name(const char *name, unsigned int *qidx,
+			     unsigned int *idx)
+{
+	unsigned int q;
+
+	if (strncmp(name, SOFT_PREFIX, SOFT_PREFIX_LEN)) {
+		*idx = Q_IDX_HARD;
+	} else {
+		*idx = Q_IDX_SOFT;
+		name += SOFT_PREFIX_LEN;
+	}
+	for (q = 0; q < ACC_N; q++) {
+		if (quota_adm[q].name && !strcmp(quota_adm[q].name, name)) {
+			if (quotas[q].val[*idx] == Q_VAL_DISABLED)
+				return true;
+			*qidx = q;
+			return false;
+		}
+	}
+
+	return true;
+}
+
 static int close_xgt_handle(void *_handle)
 {
 	xengnttab_close(*(xengnttab_handle **)_handle);
@@ -2032,6 +2058,64 @@ void read_state_connection(const void *ctx, const void *state)
 	}
 }
 
+/* Returns number of quota and adds length of quota names to *len. */
+static unsigned int get_quota_size(struct quota *quota, unsigned int *len)
+{
+	unsigned int q;
+	unsigned int n = 0;
+
+	*len = 0;
+	for (q = 0; q < ACC_N; q++) {
+		if (!quota_adm[q].name)
+			continue;
+		if (quota[q].val[Q_IDX_HARD] != Q_VAL_DISABLED) {
+			n++;
+			*len += strlen(quota_adm[q].name) + 1;
+		}
+		if (quota[q].val[Q_IDX_SOFT] != Q_VAL_DISABLED) {
+			n++;
+			*len += strlen(quota_adm[q].name) + SOFT_PREFIX_LEN + 1;
+		}
+	}
+
+	return n;
+}
+
+static void build_quota_data(struct quota *quota, uint32_t *val,
+			     char *names_buf)
+{
+	unsigned int q;
+	unsigned int n = 0;
+
+	for (q = 0; q < ACC_N; q++) {
+		if (!quota_adm[q].name)
+			continue;
+		if (quota[q].val[Q_IDX_HARD] != Q_VAL_DISABLED) {
+			val[n++] = quota[q].val[Q_IDX_HARD];
+			strcpy(names_buf, quota_adm[q].name);
+			names_buf += strlen(names_buf) + 1;
+		}
+		if (quota[q].val[Q_IDX_SOFT] != Q_VAL_DISABLED) {
+			val[n++] = quota[q].val[Q_IDX_SOFT];
+			strcpy(names_buf, SOFT_PREFIX);
+			strcpy(names_buf + SOFT_PREFIX_LEN, quota_adm[q].name);
+			names_buf += strlen(names_buf) + 1;
+		}
+	}
+}
+
+static void parse_quota_data(const uint32_t *val, const char *name,
+			     unsigned int n, struct quota *quota)
+{
+	unsigned int i, q, idx;
+
+	for (i = 0; i < n; i++) {
+		if (!parse_quota_name(name, &q, &idx))
+			quota[q].val[idx] = val[i];
+		name += strlen(name) + 1;
+	}
+}
+
 static int dump_state_domain(const void *k, void *v, void *arg)
 {
 	struct domain *domain = v;
@@ -2080,6 +2164,54 @@ void read_state_domain(const void *ctx, const void *state, unsigned int version)
 		domain->features = sd->features;
 }
 
+const char *dump_state_glb_quota(FILE *fp)
+{
+	struct xs_state_record_header *head;
+	struct xs_state_glb_quota *glb;
+	void *record;
+	unsigned int n_quota;
+	unsigned int rec_len;
+	size_t ret;
+
+	n_quota = get_quota_size(quotas, &rec_len);
+	rec_len += n_quota * sizeof(glb->quota_val[0]);
+	rec_len += sizeof(*glb);
+	rec_len = ROUNDUP(rec_len, 3);
+
+	record = talloc_size(NULL, rec_len + sizeof(*head));
+	if (!record)
+		return "Dump global quota allocation error";
+
+	head = record;
+	head->type = XS_STATE_TYPE_GLB_QUOTA;
+	head->length = rec_len;
+
+	glb = (struct xs_state_glb_quota *)(head + 1);
+	glb->n_dom_quota = n_quota;
+	glb->n_glob_quota = 0;
+
+	build_quota_data(quotas, glb->quota_val,
+			 (char *)(glb->quota_val + n_quota));
+
+	ret = fwrite(record, rec_len + sizeof(*head), 1, fp);
+
+	talloc_free(record);
+
+	if (ret != 1 || dump_state_align(fp))
+		return "Dump global quota error";
+
+	return NULL;
+}
+
+void read_state_glb_quota(const void *ctx, const void *state)
+{
+	const struct xs_state_glb_quota *glb = state;
+	unsigned int n_quota = glb->n_dom_quota + glb->n_glob_quota;
+	const char *name = (const char *)(glb->quota_val + n_quota);
+
+	parse_quota_data(glb->quota_val, name, n_quota, quotas);
+}
+
 struct domain_acc {
 	unsigned int domid;
 	int nodes;
diff --git a/tools/xenstored/domain.h b/tools/xenstored/domain.h
index 3bedadb477..8f23a82854 100644
--- a/tools/xenstored/domain.h
+++ b/tools/xenstored/domain.h
@@ -172,10 +172,12 @@ void wrl_apply_debit_trans_commit(struct connection *conn);
 
 const char *dump_state_connections(FILE *fp);
 const char *dump_state_domains(FILE *fp);
+const char *dump_state_glb_quota(FILE *fp);
 
 void read_state_connection(const void *ctx, const void *state);
 void read_state_domain(const void *ctx, const void *state,
 		       unsigned int version);
+void read_state_glb_quota(const void *ctx, const void *state);
 
 struct hashtable *domain_check_acc_init(void);
 void domain_check_acc_add(const struct node *node, struct hashtable *domains);
diff --git a/tools/xenstored/lu.c b/tools/xenstored/lu.c
index fa8395eb1e..eaffdbc69e 100644
--- a/tools/xenstored/lu.c
+++ b/tools/xenstored/lu.c
@@ -192,6 +192,9 @@ void lu_read_state(void)
 		case XS_STATE_TYPE_DOMAIN:
 			read_state_domain(ctx, state.buf, version);
 			break;
+		case XS_STATE_TYPE_GLB_QUOTA:
+			read_state_glb_quota(ctx, state.buf);
+			break;
 		default:
 			xprintf("live-update: unknown state record %08x\n",
 				head.type);
@@ -319,6 +322,9 @@ static const char *lu_dump_state(const void *ctx, struct connection *conn)
 	}
 
 	ret = dump_state_global(fp);
+	if (ret)
+		goto out;
+	ret = dump_state_glb_quota(fp);
 	if (ret)
 		goto out;
 	ret = dump_state_connections(fp);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 27 14:44:54 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 27 Mar 2026 14:44:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1265796.1556558 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w68Qg-0006gG-1R; Fri, 27 Mar 2026 14:44:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1265796.1556558; Fri, 27 Mar 2026 14:44:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w68Qf-0006g8-Uq; Fri, 27 Mar 2026 14:44:53 +0000
Received: by outflank-mailman (input) for mailman id 1265796;
 Fri, 27 Mar 2026 14:44:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w68Qe-0006fz-3M
 for xen-changelog@lists.xenproject.org; Fri, 27 Mar 2026 14:44:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w68Qe-00CJJ6-0v
 for xen-changelog@lists.xenproject.org;
 Fri, 27 Mar 2026 14:44:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w68Qe-002wfy-09
 for xen-changelog@lists.xenproject.org;
 Fri, 27 Mar 2026 14:44:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=+/HbPeU9Fmxd4msQD+WOkQ8JN688OtWXm9b+S4tE8xw=; b=AifhnzmYhkhjV1eJpls5t39tgX
	d1tDyEINPs1I50G4ea/VaKAQVNEH3A3MFbhULnppJwGZ/VvIMIsD5+pufPSv/u0bFnyqERIfGxdpq
	b7dyKyWOzi5TpuSNlvZGqTioOcl14vgeA8aDlhac8BG0d7lG2Ngo6ng6kX6Wq5PXgORE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/xenstored: split acc[] array in struct domain
Message-Id: <E1w68Qe-002wfy-09@xenbits.xenproject.org>
Date: Fri, 27 Mar 2026 14:44:52 +0000

commit de4b565fcf73bc617e9b65767ebdac8d2379a0d3
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Fri Mar 20 16:01:14 2026 +0100
Commit:     Anthony PERARD <anthony.perard@vates.tech>
CommitDate: Fri Mar 27 12:06:37 2026 +0100

    tools/xenstored: split acc[] array in struct domain
    
    Prepare using per-domain quota by splitting the acc[] array in struct
    domain into an array with the current accounting data, and an array
    of type struct quota for the per-domain quota and the seen max value
    of the domain.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
---
 tools/xenstored/domain.c | 34 ++++++++++++++++------------------
 1 file changed, 16 insertions(+), 18 deletions(-)

diff --git a/tools/xenstored/domain.c b/tools/xenstored/domain.c
index cfc8fd0cb4..b82f2d5167 100644
--- a/tools/xenstored/domain.c
+++ b/tools/xenstored/domain.c
@@ -143,10 +143,8 @@ struct domain
 	bool introduced;
 
 	/* Accounting data for this domain. */
-	struct acc {
-		unsigned int val;
-		unsigned int max;
-	} acc[ACC_N];
+	unsigned int acc_val[ACC_N];
+	struct quota acc[ACC_N];
 
 	/* Memory quota data for this domain. */
 	bool soft_quota_reported;
@@ -413,7 +411,7 @@ bool domain_quota_add_exceeds(struct domain *d, enum accitem what, int add)
 	if (add < 0 || !d)
 		return false;
 
-	return domain_quota_val_exceeds(d, what, d->acc[what].val + add);
+	return domain_quota_val_exceeds(d, what, d->acc_val[what] + add);
 }
 
 static bool check_indexes(XENSTORE_RING_IDX cons, XENSTORE_RING_IDX prod)
@@ -585,7 +583,7 @@ static int domain_tree_remove_sub(const void *ctx, struct connection *conn,
 		ret = WALK_TREE_SKIP_CHILDREN;
 	}
 
-	return domain->acc[ACC_NODES].val ? ret : WALK_TREE_SUCCESS_STOP;
+	return domain->acc_val[ACC_NODES] ? ret : WALK_TREE_SUCCESS_STOP;
 }
 
 static void domain_tree_remove(struct domain *domain)
@@ -593,7 +591,7 @@ static void domain_tree_remove(struct domain *domain)
 	int ret;
 	struct walk_funcs walkfuncs = { .enter = domain_tree_remove_sub };
 
-	if (domain->acc[ACC_NODES].val) {
+	if (domain->acc_val[ACC_NODES]) {
 		ret = walk_node_tree(domain, NULL, "/", &walkfuncs, domain);
 		if (ret == WALK_TREE_ERROR_STOP)
 			syslog(LOG_ERR,
@@ -789,7 +787,7 @@ int domain_get_quota(const void *ctx, struct connection *conn,
 			continue;
 		resp = talloc_asprintf_append(resp, "%-17s: %8u (max %8u)\n",
 					      quota_adm[i].name,
-					      d->acc[i].val, d->acc[i].max);
+					      d->acc_val[i], d->acc[i].max);
 		if (!resp)
 			return ENOMEM;
 	}
@@ -1673,10 +1671,10 @@ static int domain_acc_add_valid(struct domain *d, enum accitem what, int add)
 {
 	unsigned int val;
 
-	assert(what < ARRAY_SIZE(d->acc));
+	assert(what < ARRAY_SIZE(d->acc_val));
 
-	if ((add < 0 && -add > d->acc[what].val) ||
-	    (add > 0 && (INT_MAX - d->acc[what].val) < add)) {
+	if ((add < 0 && -add > d->acc_val[what]) ||
+	    (add > 0 && (INT_MAX - d->acc_val[what]) < add)) {
 		/*
 		 * In a transaction when a node is being added/removed AND the
 		 * same node has been added/removed outside the transaction in
@@ -1687,7 +1685,7 @@ static int domain_acc_add_valid(struct domain *d, enum accitem what, int add)
 		return (add < 0) ? 0 : INT_MAX;
 	}
 
-	val = d->acc[what].val + add;
+	val = d->acc_val[what] + add;
 	domain_acc_valid_max(d, what, val);
 
 	return val;
@@ -1746,10 +1744,10 @@ static int domain_acc_add(struct connection *conn, unsigned int domid,
 	}
 
 	trace_acc("global change domid %u: what=%u %u add %d\n", domid, what,
-		  d->acc[what].val, add);
-	d->acc[what].val = domain_acc_add_valid(d, what, add);
+		  d->acc_val[what], add);
+	d->acc_val[what] = domain_acc_add_valid(d, what, add);
 
-	return d->acc[what].val;
+	return d->acc_val[what];
 }
 
 void acc_drop(struct connection *conn)
@@ -1793,7 +1791,7 @@ static int domain_reset_global_acc_sub(const void *k, void *v, void *arg)
 	unsigned int i;
 
 	for (i = 0; i < ACC_N; i++)
-		d->acc[i].max = d->acc[i].val;
+		d->acc[i].max = d->acc_val[i];
 
 	return 0;
 }
@@ -2233,7 +2231,7 @@ static int domain_check_acc_init_sub(const void *k, void *v, void *arg)
 	 * If everything is correct incrementing the value for each node will
 	 * result in dom->nodes being 0 at the end.
 	 */
-	dom->nodes = -d->acc[ACC_NODES].val;
+	dom->nodes = -d->acc_val[ACC_NODES];
 
 	if (hashtable_add(domains, &dom->domid, dom)) {
 		talloc_free(dom);
@@ -2288,7 +2286,7 @@ static int domain_check_acc_cb(const void *k, void *v, void *arg)
 	if (!d)
 		return 0;
 
-	d->acc[ACC_NODES].val += dom->nodes;
+	d->acc_val[ACC_NODES] += dom->nodes;
 
 	return 0;
 }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 27 14:45:04 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 27 Mar 2026 14:45:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1265797.1556563 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w68Qq-0006iJ-3m; Fri, 27 Mar 2026 14:45:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1265797.1556563; Fri, 27 Mar 2026 14:45:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w68Qp-0006iA-WE; Fri, 27 Mar 2026 14:45:04 +0000
Received: by outflank-mailman (input) for mailman id 1265797;
 Fri, 27 Mar 2026 14:45:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w68Qo-0006i2-6I
 for xen-changelog@lists.xenproject.org; Fri, 27 Mar 2026 14:45:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w68Qo-00CJJZ-1D
 for xen-changelog@lists.xenproject.org;
 Fri, 27 Mar 2026 14:45:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w68Qo-002wi3-0Q
 for xen-changelog@lists.xenproject.org;
 Fri, 27 Mar 2026 14:45:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=o9hkzTj+WyD+q88QZLwXVj+mO98MA9QnQH5paX9cHxI=; b=NjB0CQRQgYEAmwRshaAH5c7MXy
	7EXfEa1Jev2JLBqpOewvbjoqe31Rwafc/erq1jTkzxhz4SWDQ5HZpEJhpXmfZn14jil07jFfy3brt
	uFfo1/lf2esAi5NJz7QXjjgfMFpl009EwI2mf29vvPiP0bhpRz8MWqfWIpBDup8DOZwU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/xenstored: use per-domain quota settings
Message-Id: <E1w68Qo-002wi3-0Q@xenbits.xenproject.org>
Date: Fri, 27 Mar 2026 14:45:02 +0000

commit e52798141bc937605d564c24bc7e5a9efb7fe95a
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Fri Mar 20 16:01:15 2026 +0100
Commit:     Anthony PERARD <anthony.perard@vates.tech>
CommitDate: Fri Mar 27 12:06:37 2026 +0100

    tools/xenstored: use per-domain quota settings
    
    Initialize the per-domain quota values with the global ones at domain
    introduction. Use the per-domain quota settings when checking for
    current values to exceed the quota.
    
    Add per-domain quota support to live update.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
---
 tools/xenstored/domain.c | 60 ++++++++++++++++++++++++++++++++++++------------
 1 file changed, 45 insertions(+), 15 deletions(-)

diff --git a/tools/xenstored/domain.c b/tools/xenstored/domain.c
index b82f2d5167..7a8d285e64 100644
--- a/tools/xenstored/domain.c
+++ b/tools/xenstored/domain.c
@@ -392,6 +392,9 @@ void wrl_apply_debit_trans_commit(struct connection *conn)
 
 static unsigned int domain_get_soft_quota(struct domain *d, enum accitem what)
 {
+	if (d && d->acc[what].val[Q_IDX_SOFT] != Q_VAL_DISABLED)
+		return d->acc[what].val[Q_IDX_SOFT];
+
 	return quotas[what].val[Q_IDX_SOFT];
 }
 
@@ -400,6 +403,9 @@ static bool domain_quota_val_exceeds(struct domain *d, enum accitem what,
 {
 	unsigned int quota = quotas[what].val[Q_IDX_HARD];
 
+	if (d->acc[what].val[Q_IDX_HARD] != Q_VAL_DISABLED)
+		quota = d->acc[what].val[Q_IDX_HARD];
+
 	if (!quota || !domid_is_unprivileged(d->domid))
 		return false;
 
@@ -824,6 +830,7 @@ static struct domain *alloc_domain(const void *context, unsigned int domid,
 				   uint64_t unique_id)
 {
 	struct domain *domain;
+	unsigned int q;
 
 	domain = talloc_zero(context, struct domain);
 	if (!domain) {
@@ -837,6 +844,11 @@ static struct domain *alloc_domain(const void *context, unsigned int domid,
 	domain->introduced = false;
 	domain->features = XENSTORE_FEATURES;
 
+	for (q = 0; q < ACC_N; q++) {
+		domain->acc[q].val[Q_IDX_HARD] = quotas[q].val[Q_IDX_HARD];
+		domain->acc[q].val[Q_IDX_SOFT] = quotas[q].val[Q_IDX_SOFT];
+	}
+
 	if (hashtable_add(domhash, &domain->domid, domain)) {
 		talloc_free(domain);
 		errno = ENOMEM;
@@ -2118,25 +2130,39 @@ static int dump_state_domain(const void *k, void *v, void *arg)
 {
 	struct domain *domain = v;
 	FILE *fp = arg;
-	struct xs_state_domain sd;
-	struct xs_state_record_header head;
-
-	head.type = XS_STATE_TYPE_DOMAIN;
-	head.length = sizeof(sd);
-	memset(&sd, 0, sizeof(sd));
-	sd.domain_id = domain->domid;
+	struct xs_state_domain *sd;
+	struct xs_state_record_header *head;
+	void *record;
+	unsigned int n_quota;
+	unsigned int rec_len;
+	size_t ret;
 
-	if (lu_status->version > 1)
-		sd.features = domain->features;
+	n_quota = get_quota_size(domain->acc, &rec_len);
+	rec_len += n_quota * sizeof(sd->quota_val[0]);
+	rec_len += sizeof(*sd);
+	rec_len = ROUNDUP(rec_len, 3);
 
-	if (fwrite(&head, sizeof(head), 1, fp) != 1)
-		return 1;
-	if (fwrite(&sd, sizeof(sd), 1, fp) != 1)
-		return 1;
-	if (dump_state_align(fp))
+	record = talloc_size(NULL, rec_len + sizeof(*head));
+	if (!record)
 		return 1;
 
-	return 0;
+	head = record;
+	head->type = XS_STATE_TYPE_DOMAIN;
+	head->length = rec_len;
+
+	sd = (struct xs_state_domain *)(head + 1);
+	sd->domain_id = domain->domid;
+	sd->n_quota = n_quota;
+	sd->features = (lu_status->version > 1) ? domain->features : 0;
+
+	build_quota_data(domain->acc, sd->quota_val,
+			 (char *)(sd->quota_val + n_quota));
+
+	ret = fwrite(record, rec_len + sizeof(*head), 1, fp);
+
+	talloc_free(record);
+
+	return (ret != 1 || dump_state_align(fp)) ? 1 : 0;
 }
 
 const char *dump_state_domains(FILE *fp)
@@ -2153,6 +2179,8 @@ void read_state_domain(const void *ctx, const void *state, unsigned int version)
 {
 	const struct xs_state_domain *sd = state;
 	struct domain *domain;
+	unsigned int n_quota = sd->n_quota;
+	const char *name = (const char *)(sd->quota_val + n_quota);
 
 	domain = find_domain_struct(sd->domain_id);
 	if (!domain)
@@ -2160,6 +2188,8 @@ void read_state_domain(const void *ctx, const void *state, unsigned int version)
 
 	if (version > 1)
 		domain->features = sd->features;
+
+	parse_quota_data(sd->quota_val, name, n_quota, domain->acc);
 }
 
 const char *dump_state_glb_quota(FILE *fp)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 27 14:45:14 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 27 Mar 2026 14:45:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1265798.1556566 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w68R0-0006kP-47; Fri, 27 Mar 2026 14:45:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1265798.1556566; Fri, 27 Mar 2026 14:45:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w68R0-0006kH-1J; Fri, 27 Mar 2026 14:45:14 +0000
Received: by outflank-mailman (input) for mailman id 1265798;
 Fri, 27 Mar 2026 14:45:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w68Qy-0006k8-98
 for xen-changelog@lists.xenproject.org; Fri, 27 Mar 2026 14:45:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w68Qy-00CJJg-1V
 for xen-changelog@lists.xenproject.org;
 Fri, 27 Mar 2026 14:45:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w68Qy-002wlC-0j
 for xen-changelog@lists.xenproject.org;
 Fri, 27 Mar 2026 14:45:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Gw9jMIL5j66uHQG73SlXmjhxcsroKN3D4oWgoxSXN2Y=; b=vzHHN9z5otISdquG7QcRRsJQWy
	EC/kwwpxczajclDEkNKEoxyXTRKw5NRs/tWdfIWj3rb1udUaX/Bbo/9yqj94QLUP6jgOEeV0e8jzl
	F6D+6XV/lAuG8JpdckEVVndk0gYZjLsTktUlBP0p4nbp585zXJGW4zaEt8MysNora+jA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/xenstored: implement the GET/SET_QUOTA commands
Message-Id: <E1w68Qy-002wlC-0j@xenbits.xenproject.org>
Date: Fri, 27 Mar 2026 14:45:12 +0000

commit af41cad8fc7ed7242cca2409d934fa59d9f602fa
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Fri Mar 20 16:01:16 2026 +0100
Commit:     Anthony PERARD <anthony.perard@vates.tech>
CommitDate: Fri Mar 27 12:06:37 2026 +0100

    tools/xenstored: implement the GET/SET_QUOTA commands
    
    Add the implementation of the GET_QUOTA and SET_QUOTA wire commands.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
---
 tools/xenstored/core.c   |   4 ++
 tools/xenstored/domain.c | 111 +++++++++++++++++++++++++++++++++++++++++++++++
 tools/xenstored/domain.h |   5 +++
 3 files changed, 120 insertions(+)

diff --git a/tools/xenstored/core.c b/tools/xenstored/core.c
index dc63c97658..4786a2a82e 100644
--- a/tools/xenstored/core.c
+++ b/tools/xenstored/core.c
@@ -2035,6 +2035,10 @@ static struct {
 	    { "GET_FEATURE",   do_get_feature,  XS_FLAG_PRIV },
 	[XS_SET_FEATURE]       =
 	    { "SET_FEATURE",   do_set_feature,  XS_FLAG_PRIV },
+	[XS_GET_QUOTA]         =
+	    { "GET_QUOTA",     do_get_quota,    XS_FLAG_PRIV },
+	[XS_SET_QUOTA]         =
+	    { "SET_QUOTA",     do_set_quota,    XS_FLAG_PRIV },
 };
 
 static const char *sockmsg_string(enum xsd_sockmsg_type type)
diff --git a/tools/xenstored/domain.c b/tools/xenstored/domain.c
index 7a8d285e64..1684f6dee7 100644
--- a/tools/xenstored/domain.c
+++ b/tools/xenstored/domain.c
@@ -1399,6 +1399,117 @@ static bool parse_quota_name(const char *name, unsigned int *qidx,
 	return true;
 }
 
+int do_get_quota(const void *ctx, struct connection *conn,
+		 struct buffered_data *in)
+{
+	const char *vec[2];
+	unsigned int n_pars;
+	unsigned int domid;
+	unsigned int q;
+	unsigned int idx;
+	char *resp;
+	const char *name;
+	const struct quota *quota;
+	const struct domain *domain;
+
+	n_pars = get_strings(in, vec, ARRAY_SIZE(vec));
+
+	if (n_pars > 2)
+		return EINVAL;
+
+	if (n_pars == 0) {
+		resp = talloc_strdup(ctx, "");
+		if (!resp)
+			return ENOMEM;
+		for (q = 0; q < ACC_N; q++) {
+			if (!quota_adm[q].name)
+				continue;
+			if (quotas[q].val[Q_IDX_HARD] != Q_VAL_DISABLED) {
+				resp = talloc_asprintf_append(resp, "%s%s",
+					*resp ? " " : "", quota_adm[q].name);
+				if (!resp)
+					return ENOMEM;
+			}
+			if (quotas[q].val[Q_IDX_SOFT] != Q_VAL_DISABLED) {
+				resp = talloc_asprintf_append(resp, "%s%s%s",
+					*resp ? " " : "", SOFT_PREFIX,
+					quota_adm[q].name);
+				if (!resp)
+					return ENOMEM;
+			}
+		}
+	} else {
+		if (n_pars == 1) {
+			quota = quotas;
+			name = vec[0];
+		} else {
+			domid = parse_domid(vec[0]);
+			if (errno)
+				return errno;
+			domain = find_or_alloc_existing_domain(domid);
+			if (!domain)
+				return ENOENT;
+			quota = domain->acc;
+			name = vec[1];
+		}
+
+		if (parse_quota_name(name, &q, &idx))
+			return EINVAL;
+
+		resp = talloc_asprintf(ctx, "%u", quota[q].val[idx]);
+		if (!resp)
+			return ENOMEM;
+	}
+
+	send_reply(conn, XS_GET_QUOTA, resp, strlen(resp) + 1);
+
+	return 0;
+}
+
+int do_set_quota(const void *ctx, struct connection *conn,
+		 struct buffered_data *in)
+{
+	const char *vec[3];
+	unsigned int n_pars;
+	unsigned int domid;
+	unsigned int q;
+	unsigned int idx;
+	const char *name;
+	unsigned int val;
+	struct quota *quota;
+	struct domain *domain;
+
+	n_pars = get_strings(in, vec, ARRAY_SIZE(vec));
+
+	if (n_pars < 2 || n_pars > 3)
+		return EINVAL;
+
+	if (n_pars == 2) {
+		quota = quotas;
+		name = vec[0];
+		val = atoi(vec[1]);
+	} else {
+		domid = parse_domid(vec[0]);
+		if (errno)
+			return errno;
+		domain = find_or_alloc_existing_domain(domid);
+		if (!domain)
+			return ENOENT;
+		quota = domain->acc;
+		name = vec[1];
+		val = atoi(vec[2]);
+	}
+
+	if (parse_quota_name(name, &q, &idx) || val == Q_VAL_DISABLED)
+		return EINVAL;
+
+	quota[q].val[idx] = val;
+
+	send_ack(conn, XS_SET_QUOTA);
+
+	return 0;
+}
+
 static int close_xgt_handle(void *_handle)
 {
 	xengnttab_close(*(xengnttab_handle **)_handle);
diff --git a/tools/xenstored/domain.h b/tools/xenstored/domain.h
index 8f23a82854..ca38b5e0ea 100644
--- a/tools/xenstored/domain.h
+++ b/tools/xenstored/domain.h
@@ -93,6 +93,11 @@ int do_get_feature(const void *ctx, struct connection *conn,
 int do_set_feature(const void *ctx, struct connection *conn,
 		   struct buffered_data *in);
 
+int do_get_quota(const void *ctx, struct connection *conn,
+		 struct buffered_data *in);
+int do_set_quota(const void *ctx, struct connection *conn,
+		 struct buffered_data *in);
+
 void domain_early_init(void);
 void domain_init(int evtfd);
 void init_domains(bool live_update);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 27 14:45:24 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 27 Mar 2026 14:45:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1265799.1556569 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w68RA-0006mT-5O; Fri, 27 Mar 2026 14:45:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1265799.1556569; Fri, 27 Mar 2026 14:45:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w68RA-0006mL-2h; Fri, 27 Mar 2026 14:45:24 +0000
Received: by outflank-mailman (input) for mailman id 1265799;
 Fri, 27 Mar 2026 14:45:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w68R8-0006mD-Ci
 for xen-changelog@lists.xenproject.org; Fri, 27 Mar 2026 14:45:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w68R8-00CJJl-1r
 for xen-changelog@lists.xenproject.org;
 Fri, 27 Mar 2026 14:45:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w68R8-002wmq-12
 for xen-changelog@lists.xenproject.org;
 Fri, 27 Mar 2026 14:45:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=/SIe71ugsigrZYgxXa005Td2ue0OTrr1MO166W71rQs=; b=vI0mS7VSc9FtBnO2SLaC5JSmx2
	RY92m26lUJOa3BPSaQ4RdbMqEFb2mfCtaMEcpfU0MqnRizoTjPIKgJ5sdv8GYoSq3gvRBLRjAbqk9
	sAwDiNtQ/CX5PGqORa2vZD4YLdpZ38qlCnPdFgkvsHS/Tnl/JIEK/UzGX1BHRDtBQxvo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/libxl: add functions for retrieving and setting xenstore quota
Message-Id: <E1w68R8-002wmq-12@xenbits.xenproject.org>
Date: Fri, 27 Mar 2026 14:45:22 +0000

commit 6f58df9d7d48ea612758312485808e45647e9686
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Fri Mar 20 16:01:17 2026 +0100
Commit:     Anthony PERARD <anthony.perard@vates.tech>
CommitDate: Fri Mar 27 12:06:37 2026 +0100

    tools/libxl: add functions for retrieving and setting xenstore quota
    
    Add some functions allowing to retrieve and set Xenstore quota (either
    global or domain specific).
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Acked-by: Nick Rosbrook <enr0n@ubuntu.com> # golang stuff
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
---
 tools/golang/xenlight/helpers.gen.go |  78 +++++++++++++++++++++++
 tools/golang/xenlight/types.gen.go   |   9 +++
 tools/include/libxl.h                |  20 ++++++
 tools/libs/light/Makefile            |   1 +
 tools/libs/light/libxl_types.idl     |   9 +++
 tools/libs/light/libxl_xsquota.c     | 116 +++++++++++++++++++++++++++++++++++
 6 files changed, 233 insertions(+)

diff --git a/tools/golang/xenlight/helpers.gen.go b/tools/golang/xenlight/helpers.gen.go
index 8909fe8a1b..767b9e45f5 100644
--- a/tools/golang/xenlight/helpers.gen.go
+++ b/tools/golang/xenlight/helpers.gen.go
@@ -998,6 +998,84 @@ xc.policy = C.libxl_rdm_reserve_policy(x.Policy)
  return nil
  }
 
+// NewXsQuotaItem returns an instance of XsQuotaItem initialized with defaults.
+func NewXsQuotaItem() (*XsQuotaItem, error) {
+var (
+x XsQuotaItem
+xc C.libxl_xs_quota_item)
+
+C.libxl_xs_quota_item_init(&xc)
+defer C.libxl_xs_quota_item_dispose(&xc)
+
+if err := x.fromC(&xc); err != nil {
+return nil, err }
+
+return &x, nil}
+
+func (x *XsQuotaItem) fromC(xc *C.libxl_xs_quota_item) error {
+ x.Name = C.GoString(xc.name)
+x.Val = uint32(xc.val)
+
+ return nil}
+
+func (x *XsQuotaItem) toC(xc *C.libxl_xs_quota_item) (err error){defer func(){
+if err != nil{
+C.libxl_xs_quota_item_dispose(xc)}
+}()
+
+if x.Name != "" {
+xc.name = C.CString(x.Name)}
+xc.val = C.uint32_t(x.Val)
+
+ return nil
+ }
+
+// NewXsQuotaList returns an instance of XsQuotaList initialized with defaults.
+func NewXsQuotaList() (*XsQuotaList, error) {
+var (
+x XsQuotaList
+xc C.libxl_xs_quota_list)
+
+C.libxl_xs_quota_list_init(&xc)
+defer C.libxl_xs_quota_list_dispose(&xc)
+
+if err := x.fromC(&xc); err != nil {
+return nil, err }
+
+return &x, nil}
+
+func (x *XsQuotaList) fromC(xc *C.libxl_xs_quota_list) error {
+ x.Quota = nil
+if n := int(xc.num_quota); n > 0 {
+cQuota := (*[1<<28]C.libxl_xs_quota_item)(unsafe.Pointer(xc.quota))[:n:n]
+x.Quota = make([]XsQuotaItem, n)
+for i, v := range cQuota {
+if err := x.Quota[i].fromC(&v); err != nil {
+return fmt.Errorf("converting field Quota: %v", err) }
+}
+}
+
+ return nil}
+
+func (x *XsQuotaList) toC(xc *C.libxl_xs_quota_list) (err error){defer func(){
+if err != nil{
+C.libxl_xs_quota_list_dispose(xc)}
+}()
+
+if numQuota := len(x.Quota); numQuota > 0 {
+xc.quota = (*C.libxl_xs_quota_item)(C.malloc(C.ulong(numQuota)*C.sizeof_libxl_xs_quota_item))
+xc.num_quota = C.int(numQuota)
+cQuota := (*[1<<28]C.libxl_xs_quota_item)(unsafe.Pointer(xc.quota))[:numQuota:numQuota]
+for i,v := range x.Quota {
+if err := v.toC(&cQuota[i]); err != nil {
+return fmt.Errorf("converting field Quota: %v", err)
+}
+}
+}
+
+ return nil
+ }
+
 // NewDomainBuildInfo returns an instance of DomainBuildInfo initialized with defaults.
 func NewDomainBuildInfo(dtype DomainType) (*DomainBuildInfo, error) {
 var (
diff --git a/tools/golang/xenlight/types.gen.go b/tools/golang/xenlight/types.gen.go
index ab9d4ca7b4..8dd610919d 100644
--- a/tools/golang/xenlight/types.gen.go
+++ b/tools/golang/xenlight/types.gen.go
@@ -543,6 +543,15 @@ Altp2MModeExternal Altp2MMode = 2
 Altp2MModeLimited Altp2MMode = 3
 )
 
+type XsQuotaItem struct {
+Name string
+Val uint32
+}
+
+type XsQuotaList struct {
+Quota []XsQuotaItem
+}
+
 type DomainBuildInfo struct {
 MaxVcpus int
 AvailVcpus Bitmap
diff --git a/tools/include/libxl.h b/tools/include/libxl.h
index bc35e412da..6d2910df34 100644
--- a/tools/include/libxl.h
+++ b/tools/include/libxl.h
@@ -1537,6 +1537,18 @@ void libxl_mac_copy(libxl_ctx *ctx, libxl_mac *dst, const libxl_mac *src);
  */
 #define LIBXL_HAVE_XEN_PLATFORM_PCI_BAR_UC
 
+/*
+ * LIBXL_HAVE_XENSTORE_QUOTA
+ *
+ * If this is defined the Xenstore quota related functions
+ * libxl_xs_quota_global_get()
+ * libxl_xs_quota_global_set()
+ * libxl_xs_quota_domain_get()
+ * libxl_xs_quota_domain_set()
+ * are available.
+ */
+#define LIBXL_HAVE_XENSTORE_QUOTA
+
 typedef char **libxl_string_list;
 void libxl_string_list_dispose(libxl_string_list *sl);
 int libxl_string_list_length(const libxl_string_list *sl);
@@ -3011,6 +3023,14 @@ static inline int libxl_qemu_monitor_command_0x041200(libxl_ctx *ctx,
 #define libxl_qemu_monitor_command libxl_qemu_monitor_command_0x041200
 #endif
 
+/* Get/set global and per-domain Xenstore quota. */
+int libxl_xs_quota_global_get(libxl_ctx *ctx, libxl_xs_quota_list *q_out);
+int libxl_xs_quota_global_set(libxl_ctx *ctx, libxl_xs_quota_list *q);
+int libxl_xs_quota_domain_get(libxl_ctx *ctx, uint32_t domid,
+                              libxl_xs_quota_list *q_out);
+int libxl_xs_quota_domain_set(libxl_ctx *ctx, uint32_t domid,
+                              libxl_xs_quota_list *q);
+
 #include <libxl_event.h>
 
 /*
diff --git a/tools/libs/light/Makefile b/tools/libs/light/Makefile
index bc60c46558..ca22a40c6c 100644
--- a/tools/libs/light/Makefile
+++ b/tools/libs/light/Makefile
@@ -106,6 +106,7 @@ OBJS-y += libxl_pvcalls.o
 OBJS-y += libxl_vsnd.o
 OBJS-y += libxl_vkb.o
 OBJS-y += libxl_virtio.o
+OBJS-y += libxl_xsquota.o
 OBJS-y += libxl_genid.o
 OBJS-y += _libxl_types.o
 OBJS-y += libxl_flask.o
diff --git a/tools/libs/light/libxl_types.idl b/tools/libs/light/libxl_types.idl
index d64a573ff3..1a63c8af76 100644
--- a/tools/libs/light/libxl_types.idl
+++ b/tools/libs/light/libxl_types.idl
@@ -574,6 +574,15 @@ libxl_altp2m_mode = Enumeration("altp2m_mode", [
     (3, "limited"),
     ], init_val = "LIBXL_ALTP2M_MODE_DISABLED")
 
+libxl_xs_quota_item = Struct("xs_quota_item", [
+    ("name", string),
+    ("val",  uint32),
+    ])
+
+libxl_xs_quota_list = Struct("xs_quota_list", [
+    ("quota", Array(libxl_xs_quota_item, "num_quota"))
+    ])
+
 libxl_domain_build_info = Struct("domain_build_info",[
     ("max_vcpus",       integer),
     ("avail_vcpus",     libxl_bitmap),
diff --git a/tools/libs/light/libxl_xsquota.c b/tools/libs/light/libxl_xsquota.c
new file mode 100644
index 0000000000..4524442655
--- /dev/null
+++ b/tools/libs/light/libxl_xsquota.c
@@ -0,0 +1,116 @@
+/* SPDX-License-Identifier: LGPL-2.1-only */
+
+/* Xenstore quota handling functions. */
+
+#include "libxl_internal.h"
+
+static int get_quota(libxl_ctx *ctx, unsigned int domid,
+                     libxl_xs_quota_list *q_out,
+                     bool (func)(struct xs_handle *h, unsigned int domid,
+                                 const char *quota, unsigned int *value))
+{
+    const char **names;
+    unsigned int num, i;
+    bool ok;
+    int rc;
+    GC_INIT(ctx);
+
+    libxl_xs_quota_list_init(q_out);
+    names = xs_get_quota_names(ctx->xsh, &num);
+    if (!names) {
+        /* Xenstore quota support is optional! */
+        if (errno != ENOSYS) {
+            libxl_xs_quota_list_dispose(q_out);
+            rc = ERROR_FAIL;
+        } else {
+            rc = 0;
+        }
+        goto out;
+    }
+
+    q_out->num_quota = num;
+    q_out->quota = libxl__calloc(NOGC, num, sizeof(*q_out->quota));
+    for (i = 0; i < num; i++) {
+        q_out->quota[i].name = libxl__strdup(NOGC, names[i]);
+        ok = func(ctx->xsh, domid, q_out->quota[i].name, &q_out->quota[i].val);
+        if (!ok) {
+            libxl_xs_quota_list_dispose(q_out);
+            rc = ERROR_FAIL;
+            goto out;
+        }
+    }
+
+    rc = 0;
+
+ out:
+    free(names);
+
+    GC_FREE;
+    return rc;
+}
+
+static int set_quota(libxl_ctx *ctx, unsigned int domid, libxl_xs_quota_list *q,
+                     bool (func)(struct xs_handle *h, unsigned int domid,
+                                 const char *quota, unsigned int value))
+{
+    unsigned int i;
+    bool ok;
+    int rc;
+    GC_INIT(ctx);
+
+    for (i = 0; i < q->num_quota; i++) {
+        ok = func(ctx->xsh, domid, q->quota[i].name, q->quota[i].val);
+        if (!ok) {
+            rc = ERROR_FAIL;
+            goto out;
+        }
+    }
+
+    rc = 0;
+
+ out:
+    GC_FREE;
+    return rc;
+}
+
+static bool get_global_quota(struct xs_handle *h, unsigned int domid,
+                             const char *quota, unsigned int *value)
+{
+    return xs_get_global_quota(h, quota, value);
+}
+
+int libxl_xs_quota_global_get(libxl_ctx *ctx, libxl_xs_quota_list *q_out)
+{
+    return get_quota(ctx, 0, q_out, get_global_quota);
+}
+
+static bool set_global_quota(struct xs_handle *h, unsigned int domid,
+                             const char *quota, unsigned int value)
+{
+    return xs_set_global_quota(h, quota, value);
+}
+
+int libxl_xs_quota_global_set(libxl_ctx *ctx, libxl_xs_quota_list *q)
+{
+    return set_quota(ctx, 0, q, set_global_quota);;
+}
+
+int libxl_xs_quota_domain_get(libxl_ctx *ctx, uint32_t domid,
+                              libxl_xs_quota_list *q_out)
+{
+    return get_quota(ctx, domid, q_out, xs_get_domain_quota);
+}
+
+int libxl_xs_quota_domain_set(libxl_ctx *ctx, uint32_t domid,
+                              libxl_xs_quota_list *q)
+{
+    return set_quota(ctx, domid, q, xs_set_domain_quota);
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 27 14:45:34 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 27 Mar 2026 14:45:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1265800.1556575 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w68RK-0006p6-97; Fri, 27 Mar 2026 14:45:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1265800.1556575; Fri, 27 Mar 2026 14:45:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w68RK-0006oy-5Z; Fri, 27 Mar 2026 14:45:34 +0000
Received: by outflank-mailman (input) for mailman id 1265800;
 Fri, 27 Mar 2026 14:45:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w68RI-0006oq-GI
 for xen-changelog@lists.xenproject.org; Fri, 27 Mar 2026 14:45:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w68RI-00CJJq-2B
 for xen-changelog@lists.xenproject.org;
 Fri, 27 Mar 2026 14:45:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w68RI-002wnj-1P
 for xen-changelog@lists.xenproject.org;
 Fri, 27 Mar 2026 14:45:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=eZlP3AqITxVC2BqqSflpOKLlZLEycMlwkvnnzqUASuE=; b=rAuxzkS8QJHyESE5uwViW/AkeU
	8uMe0WJ62+d2gKi3SU6nhkyLj4BXRpUtQtdFQ/Ptcv9oOSIYfaLslJn3PcF3oJdQqCBa/ytrtZKIV
	po9vA+hlmKZolAJRbrRYGlqzkrKZQzeb9f3ZRpoAJln3u+R52K5HOugdR5yBvNjfwSY0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/libxl: add support for xenstore quota in domain_config
Message-Id: <E1w68RI-002wnj-1P@xenbits.xenproject.org>
Date: Fri, 27 Mar 2026 14:45:32 +0000

commit a6f159f92ca39ec074d8d4a530c5af04c34f0fa5
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Fri Mar 20 16:01:18 2026 +0100
Commit:     Anthony PERARD <anthony.perard@vates.tech>
CommitDate: Fri Mar 27 12:06:37 2026 +0100

    tools/libxl: add support for xenstore quota in domain_config
    
    Add support for xenstore quota in the struct domain_config. Initially
    it will be used only for migration of a domain.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Acked-by: Nick Rosbrook <enr0n@ubuntu.com> # golang stuff
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
---
 tools/golang/xenlight/helpers.gen.go |  6 ++++++
 tools/golang/xenlight/types.gen.go   |  1 +
 tools/include/libxl.h                |  1 +
 tools/libs/light/libxl_dom.c         |  8 ++++++++
 tools/libs/light/libxl_domain.c      | 11 +++++++++++
 tools/libs/light/libxl_types.idl     |  1 +
 6 files changed, 28 insertions(+)

diff --git a/tools/golang/xenlight/helpers.gen.go b/tools/golang/xenlight/helpers.gen.go
index 767b9e45f5..b0c09da910 100644
--- a/tools/golang/xenlight/helpers.gen.go
+++ b/tools/golang/xenlight/helpers.gen.go
@@ -1286,6 +1286,9 @@ if err := x.TrapUnmappedAccesses.fromC(&xc.trap_unmapped_accesses);err != nil {
 return fmt.Errorf("converting field TrapUnmappedAccesses: %v", err)
 }
 x.XenstoreFeatureMask = uint32(xc.xenstore_feature_mask)
+if err := x.XenstoreQuota.fromC(&xc.xenstore_quota);err != nil {
+return fmt.Errorf("converting field XenstoreQuota: %v", err)
+}
 
  return nil}
 
@@ -1825,6 +1828,9 @@ if err := x.TrapUnmappedAccesses.toC(&xc.trap_unmapped_accesses); err != nil {
 return fmt.Errorf("converting field TrapUnmappedAccesses: %v", err)
 }
 xc.xenstore_feature_mask = C.uint32_t(x.XenstoreFeatureMask)
+if err := x.XenstoreQuota.toC(&xc.xenstore_quota); err != nil {
+return fmt.Errorf("converting field XenstoreQuota: %v", err)
+}
 
  return nil
  }
diff --git a/tools/golang/xenlight/types.gen.go b/tools/golang/xenlight/types.gen.go
index 8dd610919d..e0fd78ec03 100644
--- a/tools/golang/xenlight/types.gen.go
+++ b/tools/golang/xenlight/types.gen.go
@@ -629,6 +629,7 @@ VmtraceBufKb int
 Vpmu Defbool
 TrapUnmappedAccesses Defbool
 XenstoreFeatureMask uint32
+XenstoreQuota XsQuotaList
 }
 
 type DomainBuildInfoTypeUnion interface {
diff --git a/tools/include/libxl.h b/tools/include/libxl.h
index 6d2910df34..80e3ec8de9 100644
--- a/tools/include/libxl.h
+++ b/tools/include/libxl.h
@@ -1545,6 +1545,7 @@ void libxl_mac_copy(libxl_ctx *ctx, libxl_mac *dst, const libxl_mac *src);
  * libxl_xs_quota_global_set()
  * libxl_xs_quota_domain_get()
  * libxl_xs_quota_domain_set()
+ * and the xenstore_quota member of struct domain_build_info
  * are available.
  */
 #define LIBXL_HAVE_XENSTORE_QUOTA
diff --git a/tools/libs/light/libxl_dom.c b/tools/libs/light/libxl_dom.c
index 05ebc69534..4ff5f65f6f 100644
--- a/tools/libs/light/libxl_dom.c
+++ b/tools/libs/light/libxl_dom.c
@@ -509,6 +509,14 @@ retry_transaction:
 
     xs_introduce_domain(ctx->xsh, domid, state->store_mfn, state->store_port);
 
+    if (info->xenstore_quota.num_quota) {
+        rc = libxl_xs_quota_domain_set(ctx, domid, &info->xenstore_quota);
+        if (rc) {
+            LOGED(ERROR, domid, "Failed to set Xenstore quota");
+            goto out;
+        }
+    }
+
  out:
     free(vm_path);
     return rc;
diff --git a/tools/libs/light/libxl_domain.c b/tools/libs/light/libxl_domain.c
index 5be47f687f..37fcd92871 100644
--- a/tools/libs/light/libxl_domain.c
+++ b/tools/libs/light/libxl_domain.c
@@ -2533,6 +2533,17 @@ static void retrieve_domain_configuration_end(libxl__egc *egc,
         }
     }
 
+    /* Xenstore quota */
+    {
+        libxl_xs_quota_list_dispose(&d_config->b_info.xenstore_quota);
+        rc = libxl_xs_quota_domain_get(CTX, domid,
+                                       &d_config->b_info.xenstore_quota);
+        if (rc) {
+            LOGED(ERROR, domid, "Fail to get xenstore quota");
+            goto out;
+        }
+    }
+
     /* Devices: disk, nic, vtpm, pcidev etc. */
 
     /* The MERGE macro implements following logic:
diff --git a/tools/libs/light/libxl_types.idl b/tools/libs/light/libxl_types.idl
index 1a63c8af76..a7893460f0 100644
--- a/tools/libs/light/libxl_types.idl
+++ b/tools/libs/light/libxl_types.idl
@@ -760,6 +760,7 @@ libxl_domain_build_info = Struct("domain_build_info",[
     ("vpmu", libxl_defbool),
     ("trap_unmapped_accesses", libxl_defbool),
     ("xenstore_feature_mask", uint32, {'init_val': '~0U'}),
+    ("xenstore_quota", libxl_xs_quota_list),
 
     ], dir=DIR_IN,
        copy_deprecated_fn="libxl__domain_build_info_copy_deprecated",
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 27 14:45:44 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 27 Mar 2026 14:45:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1265802.1556578 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w68RU-0006rG-9n; Fri, 27 Mar 2026 14:45:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1265802.1556578; Fri, 27 Mar 2026 14:45:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w68RU-0006r8-6x; Fri, 27 Mar 2026 14:45:44 +0000
Received: by outflank-mailman (input) for mailman id 1265802;
 Fri, 27 Mar 2026 14:45:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w68RS-0006qy-Id
 for xen-changelog@lists.xenproject.org; Fri, 27 Mar 2026 14:45:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w68RS-00CJMd-2S
 for xen-changelog@lists.xenproject.org;
 Fri, 27 Mar 2026 14:45:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w68RS-002wru-1g
 for xen-changelog@lists.xenproject.org;
 Fri, 27 Mar 2026 14:45:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=xpVWIkh4gogRM0aK8p8drQBlta1eHaO+F2DIF22xLBc=; b=TWspUSK+yMgzLygVPvbchOrwf5
	SDzZN9C7A6jtPck+WKvdE2weuCG1tuwgXh4cdDIXfOKIW3o+VGrb2fEEns4oEJQRr7gK6ZtWUoTwO
	ZPYy8n/dxV9MtZNu3ROZjUhG71Gp+860FjqlAPB85P1muNSh9mNxjvlBRhwuMo9ATOso=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/xl: add xl commands for xenstore quota operations
Message-Id: <E1w68RS-002wru-1g@xenbits.xenproject.org>
Date: Fri, 27 Mar 2026 14:45:42 +0000

commit ad860c6454ba950b378c3e0d12211be6730f5c1f
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Fri Mar 20 16:01:19 2026 +0100
Commit:     Anthony PERARD <anthony.perard@vates.tech>
CommitDate: Fri Mar 27 12:06:37 2026 +0100

    tools/xl: add xl commands for xenstore quota operations
    
    Add "xl xenstore-quota-get" and "xl xenstore-quota-set" commands for
    retrieving and setting global and per-domain Xenstore quota.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
---
 tools/xl/Makefile      |  1 +
 tools/xl/xl.h          |  2 ++
 tools/xl/xl_cmdtable.c | 10 ++++++
 tools/xl/xl_parse.c    | 28 ++++++++++++++++
 tools/xl/xl_parse.h    |  1 +
 tools/xl/xl_xsquota.c  | 90 ++++++++++++++++++++++++++++++++++++++++++++++++++
 6 files changed, 132 insertions(+)

diff --git a/tools/xl/Makefile b/tools/xl/Makefile
index 973ff0e1a2..e4eed8be13 100644
--- a/tools/xl/Makefile
+++ b/tools/xl/Makefile
@@ -24,6 +24,7 @@ XL_OBJS += xl_sched.o xl_pci.o xl_vcpu.o xl_cdrom.o xl_mem.o
 XL_OBJS += xl_info.o xl_console.o xl_misc.o
 XL_OBJS += xl_vmcontrol.o xl_saverestore.o xl_migrate.o
 XL_OBJS += xl_vdispl.o xl_vsnd.o xl_vkb.o
+XL_OBJS += xl_xsquota.o
 
 $(XL_OBJS): CFLAGS += $(CFLAGS_libxentoollog)
 $(XL_OBJS): CFLAGS += $(CFLAGS_XL)
diff --git a/tools/xl/xl.h b/tools/xl/xl.h
index 9000df00de..0efc07a6ba 100644
--- a/tools/xl/xl.h
+++ b/tools/xl/xl.h
@@ -217,6 +217,8 @@ int main_psr_mba_set(int argc, char **argv);
 int main_psr_mba_show(int argc, char **argv);
 #endif
 int main_qemu_monitor_command(int argc, char **argv);
+int main_xsquota_get(int argc, char **argv);
+int main_xsquota_set(int argc, char **argv);
 
 void help(const char *command);
 
diff --git a/tools/xl/xl_cmdtable.c b/tools/xl/xl_cmdtable.c
index 06a0039718..5098f72ab4 100644
--- a/tools/xl/xl_cmdtable.c
+++ b/tools/xl/xl_cmdtable.c
@@ -649,6 +649,16 @@ const struct cmd_spec cmd_table[] = {
       "-h print this help\n"
     },
 #endif
+    { "xenstore-quota-get",
+      &main_xsquota_get, 0, 0,
+      "List global or domain specific Xenstore quotas",
+      "<Domain>|-g",
+    },
+    { "xenstore-quota-set",
+      &main_xsquota_set, 0, 1,
+      "Set global or domain specific Xenstore quotas",
+      "<Domain>|-g <quota>=<val>...",
+    },
 };
 
 const int cmdtable_len = ARRAY_SIZE(cmd_table);
diff --git a/tools/xl/xl_parse.c b/tools/xl/xl_parse.c
index 1a2ea8b5d5..4b074fdb58 100644
--- a/tools/xl/xl_parse.c
+++ b/tools/xl/xl_parse.c
@@ -1314,6 +1314,34 @@ out:
     return ret;
 }
 
+int parse_xsquota_item(const char *buf, struct libxl_xs_quota_item *item)
+{
+    const char *eq;
+    char *endptr;
+    unsigned long val;
+
+    eq = strchr(buf, '=');
+    if (!eq) {
+        fprintf(stderr, "Quota specification \"%s\" lacks \"=\".\n", buf);
+        return ERROR_INVAL;
+    }
+    errno = 0;
+    item->name = strndup(buf, eq - buf);
+    if (!item->name)
+        return ERROR_NOMEM;
+    val = strtoul(eq + 1, &endptr, 0);
+    if (errno || !eq[1] || *endptr || (unsigned int)val != val) {
+        fprintf(stderr,
+                "Quota specification \"%s\" uses illegal value \"%s\".\n",
+                buf, eq + 1);
+        return ERROR_INVAL;
+    }
+
+    item->val = val;
+
+    return 0;
+}
+
 void parse_config_data(const char *config_source,
                        const char *config_data,
                        int config_len,
diff --git a/tools/xl/xl_parse.h b/tools/xl/xl_parse.h
index fe0d586cdd..57bb43a067 100644
--- a/tools/xl/xl_parse.h
+++ b/tools/xl/xl_parse.h
@@ -36,6 +36,7 @@ int parse_nic_config(libxl_device_nic *nic, XLU_Config **config, char *token);
 int parse_vdispl_config(libxl_device_vdispl *vdispl, char *token);
 int parse_vsnd_item(libxl_device_vsnd *vsnd, const char *spec);
 int parse_vkb_config(libxl_device_vkb *vkb, char *token);
+int parse_xsquota_item(const char *buf, struct libxl_xs_quota_item *item);
 
 int match_option_size(const char *prefix, size_t len,
                       char *arg, char **argopt);
diff --git a/tools/xl/xl_xsquota.c b/tools/xl/xl_xsquota.c
new file mode 100644
index 0000000000..3533d22dae
--- /dev/null
+++ b/tools/xl/xl_xsquota.c
@@ -0,0 +1,90 @@
+/* SPDX-License-Identifier: LGPL-2.1-only */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <libxl.h>
+#include <libxlutil.h>
+
+#include "xl.h"
+#include "xl_utils.h"
+#include "xl_parse.h"
+
+int main_xsquota_get(int argc, char **argv)
+{
+    libxl_xs_quota_list q;
+    unsigned int i;
+    int rc;
+
+    if (argc != 2) {
+        fprintf(stderr, "Domain or \"-g\" must be specified.\n");
+        return EXIT_FAILURE;
+    }
+
+    libxl_xs_quota_list_init(&q);
+
+    if (!strcmp(argv[1], "-g")) {
+        rc = libxl_xs_quota_global_get(ctx, &q);
+    } else {
+        uint32_t domid = find_domain(argv[1]);
+
+        rc = libxl_xs_quota_domain_get(ctx, domid, &q);
+    }
+
+    if (rc) {
+        libxl_xs_quota_list_dispose(&q);
+        fprintf(stderr, "Quota could not be obtained.\n");
+        return EXIT_FAILURE;
+    }
+
+    printf("Quota name           Quota value\n");
+    printf("--------------------------------\n");
+    for (i = 0; i < q.num_quota; i++)
+        printf("%-20s %8u\n", q.quota[i].name, q.quota[i].val);
+
+    libxl_xs_quota_list_dispose(&q);
+
+    return EXIT_SUCCESS;
+}
+
+int main_xsquota_set(int argc, char **argv)
+{
+    unsigned int i;
+    libxl_xs_quota_list q;
+    int rc = EXIT_FAILURE;
+
+    if (argc < 3) {
+        fprintf(stderr, "Not enough parameters.\n");
+        help("xenstore-quota-set");
+        return EXIT_FAILURE;
+    }
+
+    libxl_xs_quota_list_init(&q);
+
+    q.num_quota = argc - 2;
+    q.quota = xcalloc(q.num_quota, sizeof(*q.quota));
+
+    for (i = 2; i < argc; i++) {
+        if (parse_xsquota_item(argv[i], q.quota + i - 2))
+            goto err;
+    }
+
+    if (!strcmp(argv[1], "-g")) {
+         rc = libxl_xs_quota_global_set(ctx, &q);
+    } else {
+        uint32_t domid = find_domain(argv[1]);
+
+        rc = libxl_xs_quota_domain_set(ctx, domid, &q);
+    }
+
+    if (rc) {
+        fprintf(stderr, "Quota could not be set.\n");
+        rc = EXIT_FAILURE;
+    } else {
+        rc = EXIT_SUCCESS;
+    }
+
+ err:
+    libxl_xs_quota_list_dispose(&q);
+
+    return rc;
+}
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 27 14:45:54 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 27 Mar 2026 14:45:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1265804.1556582 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w68Re-0006to-As; Fri, 27 Mar 2026 14:45:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1265804.1556582; Fri, 27 Mar 2026 14:45:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w68Re-0006tg-8L; Fri, 27 Mar 2026 14:45:54 +0000
Received: by outflank-mailman (input) for mailman id 1265804;
 Fri, 27 Mar 2026 14:45:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w68Rc-0006tY-LX
 for xen-changelog@lists.xenproject.org; Fri, 27 Mar 2026 14:45:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w68Rc-00CJMq-2j
 for xen-changelog@lists.xenproject.org;
 Fri, 27 Mar 2026 14:45:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w68Rc-002wxW-1y
 for xen-changelog@lists.xenproject.org;
 Fri, 27 Mar 2026 14:45:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=mfqdj5iN6/zR+vV3bJYyBAjyWle5ATIHgYPqlU9pkEs=; b=Xwhr9I6ZzH0Xi9Bs4hyEjS+f3A
	bFjOcci8Sl57oNTDHtbzVCF5ZmNALLBBChLTfucCzIXtt5im/0n0woJX8KWTd3nDPcZwhd3/Kphbz
	o/KBUUDKLO4ucS61W/dckTpfUZRxGfqpYzeZa9AEti3VFROXPskbqW9qWn/Jdsd6y7Z4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/xl: add support for xenstore quota setting via domain config
Message-Id: <E1w68Rc-002wxW-1y@xenbits.xenproject.org>
Date: Fri, 27 Mar 2026 14:45:52 +0000

commit ea3099e19146106e0a4a7ee724822a356f790a4d
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Fri Mar 20 16:01:20 2026 +0100
Commit:     Anthony PERARD <anthony.perard@vates.tech>
CommitDate: Fri Mar 27 12:06:37 2026 +0100

    tools/xl: add support for xenstore quota setting via domain config
    
    Add a new "xenstore_quota" domain config parameter for setting the
    Xenstore quota of a new domain via a list of <quota>=<val> items.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
---
 docs/man/xl.cfg.5.pod.in | 13 +++++++++++++
 tools/xl/xl_parse.c      | 19 ++++++++++++++++++-
 2 files changed, 31 insertions(+), 1 deletion(-)

diff --git a/docs/man/xl.cfg.5.pod.in b/docs/man/xl.cfg.5.pod.in
index 27c455210b..3aac0bc4fb 100644
--- a/docs/man/xl.cfg.5.pod.in
+++ b/docs/man/xl.cfg.5.pod.in
@@ -748,6 +748,19 @@ via the B<xl info -x> command in dom0.
 The default value is B<0xffffffff>, meaning that all possible Xenstore
 features are visible by the guest.
 
+=item B<xenstore_quota=[ QUOTA_SPEC, QUOTA_SPEC, ...]>
+
+Specifies Xenstore quota values of the domain, overriding the default
+values of Xenstore.
+
+Each B<QUOTA_SPEC> is a B<quota-name>=B<value> specification. The supported
+B<quota-name> identifiers can be obtained by the B<xl xenstore-quota-get -g>
+command. B<value> is a non-negative integer.
+
+As per-domain Xenstore quota are an optional Xenstore feature, the
+B<xenstore_quota> config parameter may not be supported by all Xenstore
+implementations.
+
 =back
 
 =head2 Devices
diff --git a/tools/xl/xl_parse.c b/tools/xl/xl_parse.c
index 4b074fdb58..48c72dce9c 100644
--- a/tools/xl/xl_parse.c
+++ b/tools/xl/xl_parse.c
@@ -1354,7 +1354,7 @@ void parse_config_data(const char *config_source,
     XLU_ConfigList *cpus, *vbds, *nics, *pcis, *cvfbs, *cpuids, *vtpms,
                    *usbctrls, *usbdevs, *p9devs, *vdispls, *pvcallsifs_devs;
     XLU_ConfigList *channels, *ioports, *irqs, *iomem, *viridian, *dtdevs,
-                   *mca_caps, *smbios, *llc_colors;
+                   *mca_caps, *smbios, *llc_colors, *xs_quota;
     int num_ioports, num_irqs, num_iomem, num_cpus, num_viridian, num_mca_caps;
     int num_smbios;
     int pci_power_mgmt = 0;
@@ -1363,6 +1363,7 @@ void parse_config_data(const char *config_source,
     int pci_seize = 0;
     int i, e;
     int num_llc_colors;
+    int num_xs_quota;
     char *kernel_basename;
 
     libxl_domain_create_info *c_info = &d_config->c_info;
@@ -1470,6 +1471,22 @@ void parse_config_data(const char *config_source,
     if (!xlu_cfg_get_long (config, "xenstore_feature_mask", &l, 0))
         b_info->xenstore_feature_mask = l;
 
+    if (!xlu_cfg_get_list(config, "xenstore_quota", &xs_quota, &num_xs_quota, 0)) {
+        b_info->xenstore_quota.num_quota = num_xs_quota;
+        b_info->xenstore_quota.quota = xcalloc(num_xs_quota, sizeof(* b_info->xenstore_quota.quota));
+
+        for (i = 0; i < num_xs_quota; i++) {
+           buf = xlu_cfg_get_listitem(xs_quota, i);
+           if (!buf) {
+                fprintf(stderr,
+                        "xl: Can't get element %d in Xenstore quota list\n", i);
+                exit(1);
+            }
+            if (parse_xsquota_item(buf, b_info->xenstore_quota.quota + i))
+                exit(1);
+        }
+    }
+
     libxl_domain_build_info_init_type(b_info, c_info->type);
 
     if (b_info->type == LIBXL_DOMAIN_TYPE_PVH) {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 27 15:55:06 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 27 Mar 2026 15:55:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1265943.1556648 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w69WY-0002Se-9i; Fri, 27 Mar 2026 15:55:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1265943.1556648; Fri, 27 Mar 2026 15:55:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w69WY-0002SV-6Z; Fri, 27 Mar 2026 15:55:02 +0000
Received: by outflank-mailman (input) for mailman id 1265943;
 Fri, 27 Mar 2026 15:55:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w69WX-0002SP-FI
 for xen-changelog@lists.xenproject.org; Fri, 27 Mar 2026 15:55:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w69WX-00CKr3-20
 for xen-changelog@lists.xenproject.org;
 Fri, 27 Mar 2026 15:55:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w69WX-0034NN-1B
 for xen-changelog@lists.xenproject.org;
 Fri, 27 Mar 2026 15:55:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=GPYTO1XBB47h4f2UA2qntFySWATTwstgbEOYucxuNws=; b=OYooJpoUfoXdnipnGvmq1vWWK3
	3rSManuXBaRawIMqhiP77v5U2nd4vm1zng+hT5tdRKERrE5hRU5ZMj5qWZtZpld3ZeSxOJArG33Yz
	9HhZaq4iBJUln9wpHUh2EqAfsaj3pHnTF61JLpsCiDAq73cxgwig4Y3qMOou37mPhlGg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/uart: report an error if the device type is not supported
Message-Id: <E1w69WX-0034NN-1B@xenbits.xenproject.org>
Date: Fri, 27 Mar 2026 15:55:01 +0000

commit 550ee7c198010c297d74b69e07d95a26358eadbd
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Fri Mar 20 10:17:15 2026 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Fri Mar 27 14:52:40 2026 +0100

    xen/uart: report an error if the device type is not supported
    
    When using key pairs for the uart configuration (com1 and com2 command line
    options), report an error if the passed device=<type> is not recognized
    instead of silently ignoring it.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/drivers/char/ns16550.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/xen/drivers/char/ns16550.c b/xen/drivers/char/ns16550.c
index df7fff7f81..d384f1c69d 100644
--- a/xen/drivers/char/ns16550.c
+++ b/xen/drivers/char/ns16550.c
@@ -1674,6 +1674,8 @@ static bool __init parse_namevalue_pairs(char *str, struct ns16550 *uart)
                 pci_uart_config(uart, 0, uart - ns16550_com);
                 dev_set = true;
             }
+            else
+                PARSE_ERR_RET("Unknown device type %s\n", param_value);
             break;
 
         case port_bdf:
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 27 20:55:09 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 27 Mar 2026 20:55:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1266237.1556714 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w6ECt-0005Ze-Vt; Fri, 27 Mar 2026 20:55:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1266237.1556714; Fri, 27 Mar 2026 20:55:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w6ECt-0005ZW-TK; Fri, 27 Mar 2026 20:55:03 +0000
Received: by outflank-mailman (input) for mailman id 1266237;
 Fri, 27 Mar 2026 20:55:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w6ECs-0005ZQ-AJ
 for xen-changelog@lists.xenproject.org; Fri, 27 Mar 2026 20:55:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w6ECs-00CRXd-1P
 for xen-changelog@lists.xenproject.org;
 Fri, 27 Mar 2026 20:55:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w6ECs-004Yg4-0S
 for xen-changelog@lists.xenproject.org;
 Fri, 27 Mar 2026 20:55:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=eqb0dn7BWJ/EDDmd0CJnj1FOgqyiMqn6EpnomJmhC4c=; b=aEj2lqWod89NLyeClBtk0grF3l
	iRHHA90s4JHBfEjo9nja2DZjtBdUmcxqEFIwEDbfNAXhG3AesPF8qDk80YIKeJ8+RjlLl7LbMdK9u
	Qt6fsmUQpzD0m5tbHba/6aFWdQfKkb5AhXm6dGy8DPnBTBmYtKGmOwITru3iug41nPy0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/sched: validate RTDS putinfo period and budget
Message-Id: <E1w6ECs-004Yg4-0S@xenbits.xenproject.org>
Date: Fri, 27 Mar 2026 20:55:02 +0000

commit eec1a570c0e01e64e778f43e486e29768734d1b6
Author:     Oleksii Moisieiev <Oleksii_Moisieiev@epam.com>
AuthorDate: Fri Mar 27 15:21:35 2026 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 27 18:56:42 2026 +0000

    xen/sched: validate RTDS putinfo period and budget
    
    The RTDS domain-wide XEN_DOMCTL_SCHEDOP_putinfo path only checks for
    zero values before applying period and budget to all vCPUs in the
    domain.
    
    This is weaker than the per-vCPU XEN_DOMCTL_SCHEDOP_putvcpuinfo path,
    which already rejects values below the minimum, above the maximum, and
    cases where budget exceeds period.
    
    Use the same validation rules for putinfo as for putvcpuinfo, so
    invalid domain-wide updates are rejected with -EINVAL instead of being
    applied inconsistently.
    
    Signed-off-by: Oleksii Moisieiev <oleksii_moisieiev@epam.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
---
 xen/common/sched/rt.c | 37 ++++++++++++++++++++++++-------------
 1 file changed, 24 insertions(+), 13 deletions(-)

diff --git a/xen/common/sched/rt.c b/xen/common/sched/rt.c
index 7b1f64a779..b156f61afa 100644
--- a/xen/common/sched/rt.c
+++ b/xen/common/sched/rt.c
@@ -1362,6 +1362,23 @@ out:
     unit_schedule_unlock_irq(lock, unit);
 }
 
+static int
+rt_validate_params(const struct xen_domctl_sched_rtds *rtds,
+                   s_time_t *period, s_time_t *budget)
+{
+    s_time_t p = MICROSECS(rtds->period);
+    s_time_t b = MICROSECS(rtds->budget);
+
+    if ( p < RTDS_MIN_PERIOD || p > RTDS_MAX_PERIOD ||
+         b < RTDS_MIN_BUDGET || b > p )
+        return -EINVAL;
+
+    *period = p;
+    *budget = b;
+
+    return 0;
+}
+
 /*
  * set/get each unit info of each domain
  */
@@ -1388,17 +1405,16 @@ rt_dom_cntl(
         op->u.rtds.budget = RTDS_DEFAULT_BUDGET / MICROSECS(1);
         break;
     case XEN_DOMCTL_SCHEDOP_putinfo:
-        if ( op->u.rtds.period == 0 || op->u.rtds.budget == 0 )
-        {
-            rc = -EINVAL;
+        rc = rt_validate_params(&op->u.rtds, &period, &budget);
+        if ( rc )
             break;
-        }
+
         spin_lock_irqsave(&prv->lock, flags);
         for_each_sched_unit ( d, unit )
         {
             svc = rt_unit(unit);
-            svc->period = MICROSECS(op->u.rtds.period); /* transfer to nanosec */
-            svc->budget = MICROSECS(op->u.rtds.budget);
+            svc->period = period;
+            svc->budget = budget;
         }
         spin_unlock_irqrestore(&prv->lock, flags);
         break;
@@ -1440,14 +1456,9 @@ rt_dom_cntl(
             }
             else
             {
-                period = MICROSECS(local_sched.u.rtds.period);
-                budget = MICROSECS(local_sched.u.rtds.budget);
-                if ( period > RTDS_MAX_PERIOD || budget < RTDS_MIN_BUDGET ||
-                     budget > period || period < RTDS_MIN_PERIOD )
-                {
-                    rc = -EINVAL;
+                rc = rt_validate_params(&local_sched.u.rtds, &period, &budget);
+                if ( rc )
                     break;
-                }
 
                 spin_lock_irqsave(&prv->lock, flags);
                 svc = rt_unit(d->vcpu[local_sched.vcpuid]->sched_unit);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Mar 27 20:55:14 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 27 Mar 2026 20:55:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1266238.1556717 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w6ED4-0005bQ-1N; Fri, 27 Mar 2026 20:55:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1266238.1556717; Fri, 27 Mar 2026 20:55:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w6ED3-0005bI-Uh; Fri, 27 Mar 2026 20:55:13 +0000
Received: by outflank-mailman (input) for mailman id 1266238;
 Fri, 27 Mar 2026 20:55:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w6ED2-0005b4-BX
 for xen-changelog@lists.xenproject.org; Fri, 27 Mar 2026 20:55:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w6ED2-00CRXh-1j
 for xen-changelog@lists.xenproject.org;
 Fri, 27 Mar 2026 20:55:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w6ED2-004Yin-0s
 for xen-changelog@lists.xenproject.org;
 Fri, 27 Mar 2026 20:55:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=W8EGeS019Ylkbt5Cf1pn27lSq407QWb/F/vWmpSq5oo=; b=cDiC4j6l2mlPG7cb9TEzA8GQ00
	MsadJdvym+fcg3C2SmQTKFIq3zcyBmIN6wSXFhIfD6ratKBd4nlR6hqZxeLPSX9wXJKNGQb9T+PQy
	bCxA+1NOkManBveQbhrtjJaDnNO8PIK0Ry0hupibNZNzF2+aQnUtMaU2tZus5akWpP4M=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] Config: update Mini-OS commit id
Message-Id: <E1w6ED2-004Yin-0s@xenbits.xenproject.org>
Date: Fri, 27 Mar 2026 20:55:12 +0000

commit 8bf023c509e04bc84f18086276ca11d2435b7ba3
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Fri Mar 27 16:14:29 2026 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 27 18:56:42 2026 +0000

    Config: update Mini-OS commit id
    
    Use the newest Mini-OS.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 Config.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Config.mk b/Config.mk
index fdc0245079..b3d48e49c7 100644
--- a/Config.mk
+++ b/Config.mk
@@ -217,7 +217,7 @@ QEMU_UPSTREAM_URL ?= https://xenbits.xen.org/git-http/qemu-xen.git
 QEMU_UPSTREAM_REVISION ?= master
 
 MINIOS_UPSTREAM_URL ?= https://xenbits.xen.org/git-http/mini-os.git
-MINIOS_UPSTREAM_REVISION ?= 6732fd42d8eb8d0af9f5eb54aca17f4c250213a8
+MINIOS_UPSTREAM_REVISION ?= b6f79f5f44cf69044079c042b88fe9d75367642e
 
 SEABIOS_UPSTREAM_URL ?= https://xenbits.xen.org/git-http/seabios.git
 SEABIOS_UPSTREAM_REVISION ?= rel-1.17.0
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Mar 27 20:55:23 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 27 Mar 2026 20:55:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1266239.1556722 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w6EDD-0005eG-45; Fri, 27 Mar 2026 20:55:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1266239.1556722; Fri, 27 Mar 2026 20:55:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w6EDD-0005e8-1V; Fri, 27 Mar 2026 20:55:23 +0000
Received: by outflank-mailman (input) for mailman id 1266239;
 Fri, 27 Mar 2026 20:55:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w6EDC-0005dz-EN
 for xen-changelog@lists.xenproject.org; Fri, 27 Mar 2026 20:55:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w6EDC-00CRXr-20
 for xen-changelog@lists.xenproject.org;
 Fri, 27 Mar 2026 20:55:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w6EDC-004Yjm-1D
 for xen-changelog@lists.xenproject.org;
 Fri, 27 Mar 2026 20:55:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=sh5ads/4sKkuFcFu4YX94EPsK2PMizhCE4Iv4LM9oCE=; b=zQLDFDQG3Qy+MAom723EBJQL8i
	8bbgcLsp2ERWgY3tXWixjibE45/xGywFgFMmsowOzKFIT24iSpJUc+r4jiyBO3zIMSSI9I0E1Ap8+
	ep7uFn+oGsCvp4gMWsgm1YRyuqO86vf9s4FjkSi0qDTySBwVom1q0vrHwmylq2UY4XKM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] libacpi: Pass missing --dm_version to mk_dsdt
Message-Id: <E1w6EDC-004Yjm-1D@xenbits.xenproject.org>
Date: Fri, 27 Mar 2026 20:55:22 +0000

commit ea12f9d257353ddec8a2fe8da42d11636de3dacb
Author:     Ross Lagerwall <ross.lagerwall@citrix.com>
AuthorDate: Thu Mar 26 10:40:12 2026 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 27 18:56:42 2026 +0000

    libacpi: Pass missing --dm_version to mk_dsdt
    
    Commit 19ab8356abe4 ("tools: remove support for running a guest with
    qemu-traditional") made passing --dm_version to mk_dsdt mandatory on
    x86 but didn't fix all the invocations of it.
    
    The previous default was qemu-xen-traditional so with that removed set
    the dm_version to qemu-xen for this invocation.
    
    Without this change, Xen fails to build on x86 when using
    --enable-rombios.
    
    Fixes: 19ab8356abe4 ("tools: remove support for running a guest with qemu-traditional")
    Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 tools/libacpi/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/libacpi/Makefile b/tools/libacpi/Makefile
index b21a64c6b4..193ec78672 100644
--- a/tools/libacpi/Makefile
+++ b/tools/libacpi/Makefile
@@ -51,7 +51,7 @@ $(ACPI_BUILD_DIR)/dsdt_%cpu.asl: dsdt.asl dsdt_acpi_info.asl  $(MK_DSDT)
 	# Remove last bracket
 	awk 'NR > 1 {print s} {s=$$0}' $< > $@.$(TMP_SUFFIX)
 	cat dsdt_acpi_info.asl >> $@.$(TMP_SUFFIX)
-	$(MK_DSDT) --debug=$(debug) --maxcpu $*  >> $@.$(TMP_SUFFIX)
+	$(MK_DSDT) --debug=$(debug) --maxcpu $* --dm-version qemu-xen >> $@.$(TMP_SUFFIX)
 	mv -f $@.$(TMP_SUFFIX) $@
 
 $(ACPI_BUILD_DIR)/dsdt_pvh.asl: dsdt_acpi_info.asl $(MK_DSDT)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Mar 27 20:55:33 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 27 Mar 2026 20:55:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1266240.1556725 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w6EDN-0005gQ-5T; Fri, 27 Mar 2026 20:55:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1266240.1556725; Fri, 27 Mar 2026 20:55:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w6EDN-0005gJ-2s; Fri, 27 Mar 2026 20:55:33 +0000
Received: by outflank-mailman (input) for mailman id 1266240;
 Fri, 27 Mar 2026 20:55:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w6EDM-0005gB-HV
 for xen-changelog@lists.xenproject.org; Fri, 27 Mar 2026 20:55:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w6EDM-00CRXw-2K
 for xen-changelog@lists.xenproject.org;
 Fri, 27 Mar 2026 20:55:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w6EDM-004YkV-1V
 for xen-changelog@lists.xenproject.org;
 Fri, 27 Mar 2026 20:55:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=w2CinXm13oVagP2uXfPts19ORsqo78ZWfRCdHw3Nz44=; b=LgKFgBtzBWIvsD9vq2K16SoCfY
	CrqZu9BPwgN719d+BFOtm3+7eQDlf0ieV1352+fDk1iTBx4knopZSwE1iI8jF6hFix7jdZaDASkVS
	3w4KPv45EkGIBr6rpJ37uwNr40Zm7CiH8XCaHRHPzTQwkQGBuDyTviQgsfYI6o1G4LPk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/fred: Fix FRED name in comments
Message-Id: <E1w6EDM-004YkV-1V@xenbits.xenproject.org>
Date: Fri, 27 Mar 2026 20:55:32 +0000

commit 7bcac0c99b2a0a7a8dea899d09e042ea0ab0c40d
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Mar 24 12:51:09 2026 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 27 18:56:42 2026 +0000

    x86/fred: Fix FRED name in comments
    
    The patch introducing these constants predate the feature being renamed.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/include/asm/x86-defns.h        | 2 +-
 xen/include/public/arch-x86/cpufeatureset.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/include/asm/x86-defns.h b/xen/arch/x86/include/asm/x86-defns.h
index edeb0b4ff9..6dae36ef81 100644
--- a/xen/arch/x86/include/asm/x86-defns.h
+++ b/xen/arch/x86/include/asm/x86-defns.h
@@ -82,7 +82,7 @@
 #define X86_CR4_PKE        0x00400000 /* enable PKE */
 #define X86_CR4_CET        0x00800000 /* Control-flow Enforcement Technology */
 #define X86_CR4_PKS        0x01000000 /* Protection Key Supervisor */
-#define X86_CR4_FRED       (_AC(1, ULL) << 32) /* Fast Return and Event Delivery */
+#define X86_CR4_FRED       (_AC(1, ULL) << 32) /* Flexible Return and Event Delivery */
 
 #define X86_CR8_VALID_MASK 0xf
 
diff --git a/xen/include/public/arch-x86/cpufeatureset.h b/xen/include/public/arch-x86/cpufeatureset.h
index 9cd778586f..3bc4f5cad6 100644
--- a/xen/include/public/arch-x86/cpufeatureset.h
+++ b/xen/include/public/arch-x86/cpufeatureset.h
@@ -310,7 +310,7 @@ XEN_CPUFEATURE(ARCH_PERF_MON, 10*32+8) /*   Architectural Perfmon */
 XEN_CPUFEATURE(FZRM,         10*32+10) /*A  Fast Zero-length REP MOVSB */
 XEN_CPUFEATURE(FSRS,         10*32+11) /*A  Fast Short REP STOSB */
 XEN_CPUFEATURE(FSRCS,        10*32+12) /*A  Fast Short REP CMPSB/SCASB */
-XEN_CPUFEATURE(FRED,         10*32+17) /*   Fast Return and Event Delivery */
+XEN_CPUFEATURE(FRED,         10*32+17) /*   Flexible Return and Event Delivery */
 XEN_CPUFEATURE(LKGS,         10*32+18) /*   Load Kernel GS instruction */
 XEN_CPUFEATURE(WRMSRNS,      10*32+19) /*S  WRMSR Non-Serialising */
 XEN_CPUFEATURE(NMI_SRC,      10*32+20) /*   NMI-Source Reporting */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Mar 27 21:55:11 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 27 Mar 2026 21:55:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1266295.1556729 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w6F8x-00052J-2D; Fri, 27 Mar 2026 21:55:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1266295.1556729; Fri, 27 Mar 2026 21:55:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w6F8w-00052B-Vt; Fri, 27 Mar 2026 21:55:02 +0000
Received: by outflank-mailman (input) for mailman id 1266295;
 Fri, 27 Mar 2026 21:55:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w6F8w-000525-D7
 for xen-changelog@lists.xenproject.org; Fri, 27 Mar 2026 21:55:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w6F8w-00CShm-1k
 for xen-changelog@lists.xenproject.org;
 Fri, 27 Mar 2026 21:55:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w6F8w-004inV-0t
 for xen-changelog@lists.xenproject.org;
 Fri, 27 Mar 2026 21:55:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=RaeKZZ+o3JogNtz66B92KBdlbAbJjRi4/PDZrqCT8lE=; b=0z9LswPeHVcBV9tA2LtFXwCTez
	bYaWEAXGoaQ1UGZ91P1KqUbmXNlfgjnw07/ASW3m21aeCCQAVGzONKOIyGsrII9lyC/H96bgjeUmp
	vZ40RWYD5ThNlGpgk2FBgMOB6i+UdAaZVAdUZESy5rypVn2gzj4qO1qr0PJHV+vhRPhQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/sched: validate RTDS putinfo period and budget
Message-Id: <E1w6F8w-004inV-0t@xenbits.xenproject.org>
Date: Fri, 27 Mar 2026 21:55:02 +0000

commit eec1a570c0e01e64e778f43e486e29768734d1b6
Author:     Oleksii Moisieiev <Oleksii_Moisieiev@epam.com>
AuthorDate: Fri Mar 27 15:21:35 2026 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 27 18:56:42 2026 +0000

    xen/sched: validate RTDS putinfo period and budget
    
    The RTDS domain-wide XEN_DOMCTL_SCHEDOP_putinfo path only checks for
    zero values before applying period and budget to all vCPUs in the
    domain.
    
    This is weaker than the per-vCPU XEN_DOMCTL_SCHEDOP_putvcpuinfo path,
    which already rejects values below the minimum, above the maximum, and
    cases where budget exceeds period.
    
    Use the same validation rules for putinfo as for putvcpuinfo, so
    invalid domain-wide updates are rejected with -EINVAL instead of being
    applied inconsistently.
    
    Signed-off-by: Oleksii Moisieiev <oleksii_moisieiev@epam.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
---
 xen/common/sched/rt.c | 37 ++++++++++++++++++++++++-------------
 1 file changed, 24 insertions(+), 13 deletions(-)

diff --git a/xen/common/sched/rt.c b/xen/common/sched/rt.c
index 7b1f64a779..b156f61afa 100644
--- a/xen/common/sched/rt.c
+++ b/xen/common/sched/rt.c
@@ -1362,6 +1362,23 @@ out:
     unit_schedule_unlock_irq(lock, unit);
 }
 
+static int
+rt_validate_params(const struct xen_domctl_sched_rtds *rtds,
+                   s_time_t *period, s_time_t *budget)
+{
+    s_time_t p = MICROSECS(rtds->period);
+    s_time_t b = MICROSECS(rtds->budget);
+
+    if ( p < RTDS_MIN_PERIOD || p > RTDS_MAX_PERIOD ||
+         b < RTDS_MIN_BUDGET || b > p )
+        return -EINVAL;
+
+    *period = p;
+    *budget = b;
+
+    return 0;
+}
+
 /*
  * set/get each unit info of each domain
  */
@@ -1388,17 +1405,16 @@ rt_dom_cntl(
         op->u.rtds.budget = RTDS_DEFAULT_BUDGET / MICROSECS(1);
         break;
     case XEN_DOMCTL_SCHEDOP_putinfo:
-        if ( op->u.rtds.period == 0 || op->u.rtds.budget == 0 )
-        {
-            rc = -EINVAL;
+        rc = rt_validate_params(&op->u.rtds, &period, &budget);
+        if ( rc )
             break;
-        }
+
         spin_lock_irqsave(&prv->lock, flags);
         for_each_sched_unit ( d, unit )
         {
             svc = rt_unit(unit);
-            svc->period = MICROSECS(op->u.rtds.period); /* transfer to nanosec */
-            svc->budget = MICROSECS(op->u.rtds.budget);
+            svc->period = period;
+            svc->budget = budget;
         }
         spin_unlock_irqrestore(&prv->lock, flags);
         break;
@@ -1440,14 +1456,9 @@ rt_dom_cntl(
             }
             else
             {
-                period = MICROSECS(local_sched.u.rtds.period);
-                budget = MICROSECS(local_sched.u.rtds.budget);
-                if ( period > RTDS_MAX_PERIOD || budget < RTDS_MIN_BUDGET ||
-                     budget > period || period < RTDS_MIN_PERIOD )
-                {
-                    rc = -EINVAL;
+                rc = rt_validate_params(&local_sched.u.rtds, &period, &budget);
+                if ( rc )
                     break;
-                }
 
                 spin_lock_irqsave(&prv->lock, flags);
                 svc = rt_unit(d->vcpu[local_sched.vcpuid]->sched_unit);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 27 21:55:13 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 27 Mar 2026 21:55:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1266296.1556733 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w6F97-000545-3W; Fri, 27 Mar 2026 21:55:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1266296.1556733; Fri, 27 Mar 2026 21:55:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w6F97-00053x-0y; Fri, 27 Mar 2026 21:55:13 +0000
Received: by outflank-mailman (input) for mailman id 1266296;
 Fri, 27 Mar 2026 21:55:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w6F96-00053p-FS
 for xen-changelog@lists.xenproject.org; Fri, 27 Mar 2026 21:55:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w6F96-00CShs-26
 for xen-changelog@lists.xenproject.org;
 Fri, 27 Mar 2026 21:55:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w6F96-004ipw-1E
 for xen-changelog@lists.xenproject.org;
 Fri, 27 Mar 2026 21:55:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=hz6wJDjsqkcxXHp0Wvmi6otzTERRBZAJNDupuiOQOvc=; b=Vr/EdyWQwj4gB+mYS+cpiQrLBw
	jrs3f3LyMyoABytfY/ZBCSxTPbNypZ/NYJL65VeZbLraMi33ohCXD1ZK14g8lwuAPn1HW5+MdEJ4A
	VxYzoY8bML9Cx1MmB39XklusTDUr9zSG+EY2shdiWEFVcvb7fjfMA4toe+Q7kgzmcHLk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] Config: update Mini-OS commit id
Message-Id: <E1w6F96-004ipw-1E@xenbits.xenproject.org>
Date: Fri, 27 Mar 2026 21:55:12 +0000

commit 8bf023c509e04bc84f18086276ca11d2435b7ba3
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Fri Mar 27 16:14:29 2026 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 27 18:56:42 2026 +0000

    Config: update Mini-OS commit id
    
    Use the newest Mini-OS.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 Config.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Config.mk b/Config.mk
index fdc0245079..b3d48e49c7 100644
--- a/Config.mk
+++ b/Config.mk
@@ -217,7 +217,7 @@ QEMU_UPSTREAM_URL ?= https://xenbits.xen.org/git-http/qemu-xen.git
 QEMU_UPSTREAM_REVISION ?= master
 
 MINIOS_UPSTREAM_URL ?= https://xenbits.xen.org/git-http/mini-os.git
-MINIOS_UPSTREAM_REVISION ?= 6732fd42d8eb8d0af9f5eb54aca17f4c250213a8
+MINIOS_UPSTREAM_REVISION ?= b6f79f5f44cf69044079c042b88fe9d75367642e
 
 SEABIOS_UPSTREAM_URL ?= https://xenbits.xen.org/git-http/seabios.git
 SEABIOS_UPSTREAM_REVISION ?= rel-1.17.0
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 27 21:55:23 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 27 Mar 2026 21:55:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1266297.1556738 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w6F9H-00056P-4s; Fri, 27 Mar 2026 21:55:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1266297.1556738; Fri, 27 Mar 2026 21:55:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w6F9H-00056H-2H; Fri, 27 Mar 2026 21:55:23 +0000
Received: by outflank-mailman (input) for mailman id 1266297;
 Fri, 27 Mar 2026 21:55:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w6F9G-00056B-IP
 for xen-changelog@lists.xenproject.org; Fri, 27 Mar 2026 21:55:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w6F9G-00CShw-2Q
 for xen-changelog@lists.xenproject.org;
 Fri, 27 Mar 2026 21:55:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w6F9G-004irB-1a
 for xen-changelog@lists.xenproject.org;
 Fri, 27 Mar 2026 21:55:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=SuichcRPAgMgEhvSiR/rXt0R7laZ8Kq6a4XEzaJtVAM=; b=Ss8ZHhLzCWomBe8wfRbJIY+956
	manAhhPdB8nz+JDMDYTP/XbPs/aZes39ATm2qq6dQviTBC3hpP9+sZwH5ixdTQFvy1MgxalERm7kN
	JVUKJBFwrC0Uz8xGJxqyFwOn0o1bNLljkrHzsyiDYKrUfnMOEhgw3DCVzXEf6Hq/Jzd8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] libacpi: Pass missing --dm_version to mk_dsdt
Message-Id: <E1w6F9G-004irB-1a@xenbits.xenproject.org>
Date: Fri, 27 Mar 2026 21:55:22 +0000

commit ea12f9d257353ddec8a2fe8da42d11636de3dacb
Author:     Ross Lagerwall <ross.lagerwall@citrix.com>
AuthorDate: Thu Mar 26 10:40:12 2026 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 27 18:56:42 2026 +0000

    libacpi: Pass missing --dm_version to mk_dsdt
    
    Commit 19ab8356abe4 ("tools: remove support for running a guest with
    qemu-traditional") made passing --dm_version to mk_dsdt mandatory on
    x86 but didn't fix all the invocations of it.
    
    The previous default was qemu-xen-traditional so with that removed set
    the dm_version to qemu-xen for this invocation.
    
    Without this change, Xen fails to build on x86 when using
    --enable-rombios.
    
    Fixes: 19ab8356abe4 ("tools: remove support for running a guest with qemu-traditional")
    Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 tools/libacpi/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/libacpi/Makefile b/tools/libacpi/Makefile
index b21a64c6b4..193ec78672 100644
--- a/tools/libacpi/Makefile
+++ b/tools/libacpi/Makefile
@@ -51,7 +51,7 @@ $(ACPI_BUILD_DIR)/dsdt_%cpu.asl: dsdt.asl dsdt_acpi_info.asl  $(MK_DSDT)
 	# Remove last bracket
 	awk 'NR > 1 {print s} {s=$$0}' $< > $@.$(TMP_SUFFIX)
 	cat dsdt_acpi_info.asl >> $@.$(TMP_SUFFIX)
-	$(MK_DSDT) --debug=$(debug) --maxcpu $*  >> $@.$(TMP_SUFFIX)
+	$(MK_DSDT) --debug=$(debug) --maxcpu $* --dm-version qemu-xen >> $@.$(TMP_SUFFIX)
 	mv -f $@.$(TMP_SUFFIX) $@
 
 $(ACPI_BUILD_DIR)/dsdt_pvh.asl: dsdt_acpi_info.asl $(MK_DSDT)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 27 21:55:33 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 27 Mar 2026 21:55:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1266298.1556742 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w6F9R-00058a-69; Fri, 27 Mar 2026 21:55:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1266298.1556742; Fri, 27 Mar 2026 21:55:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w6F9R-00058S-3c; Fri, 27 Mar 2026 21:55:33 +0000
Received: by outflank-mailman (input) for mailman id 1266298;
 Fri, 27 Mar 2026 21:55:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w6F9Q-00058M-Ly
 for xen-changelog@lists.xenproject.org; Fri, 27 Mar 2026 21:55:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w6F9Q-00CSi2-2n
 for xen-changelog@lists.xenproject.org;
 Fri, 27 Mar 2026 21:55:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w6F9Q-004isB-1v
 for xen-changelog@lists.xenproject.org;
 Fri, 27 Mar 2026 21:55:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=e7IX+2V8YAZMA09t6egnOm4LXlcpg8KLCEwN6XM1I0I=; b=nCRPx+lRxGDqMRMi5v+EXLynTD
	qvLuKE9d2wNkfx5wKtw61QIk13Md69n6dl6Pt0XJgKEZy/GR/7u3eAabp1u5Ff8D16yGzLPXLJ4Uf
	7dbyg3IzGvQHImOmhDXpeLARYonYewcWwe8y11dF9RBkOH2mRuG9R+k9oD2/j3sK4GOs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/fred: Fix FRED name in comments
Message-Id: <E1w6F9Q-004isB-1v@xenbits.xenproject.org>
Date: Fri, 27 Mar 2026 21:55:32 +0000

commit 7bcac0c99b2a0a7a8dea899d09e042ea0ab0c40d
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Mar 24 12:51:09 2026 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 27 18:56:42 2026 +0000

    x86/fred: Fix FRED name in comments
    
    The patch introducing these constants predate the feature being renamed.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/include/asm/x86-defns.h        | 2 +-
 xen/include/public/arch-x86/cpufeatureset.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/include/asm/x86-defns.h b/xen/arch/x86/include/asm/x86-defns.h
index edeb0b4ff9..6dae36ef81 100644
--- a/xen/arch/x86/include/asm/x86-defns.h
+++ b/xen/arch/x86/include/asm/x86-defns.h
@@ -82,7 +82,7 @@
 #define X86_CR4_PKE        0x00400000 /* enable PKE */
 #define X86_CR4_CET        0x00800000 /* Control-flow Enforcement Technology */
 #define X86_CR4_PKS        0x01000000 /* Protection Key Supervisor */
-#define X86_CR4_FRED       (_AC(1, ULL) << 32) /* Fast Return and Event Delivery */
+#define X86_CR4_FRED       (_AC(1, ULL) << 32) /* Flexible Return and Event Delivery */
 
 #define X86_CR8_VALID_MASK 0xf
 
diff --git a/xen/include/public/arch-x86/cpufeatureset.h b/xen/include/public/arch-x86/cpufeatureset.h
index 9cd778586f..3bc4f5cad6 100644
--- a/xen/include/public/arch-x86/cpufeatureset.h
+++ b/xen/include/public/arch-x86/cpufeatureset.h
@@ -310,7 +310,7 @@ XEN_CPUFEATURE(ARCH_PERF_MON, 10*32+8) /*   Architectural Perfmon */
 XEN_CPUFEATURE(FZRM,         10*32+10) /*A  Fast Zero-length REP MOVSB */
 XEN_CPUFEATURE(FSRS,         10*32+11) /*A  Fast Short REP STOSB */
 XEN_CPUFEATURE(FSRCS,        10*32+12) /*A  Fast Short REP CMPSB/SCASB */
-XEN_CPUFEATURE(FRED,         10*32+17) /*   Fast Return and Event Delivery */
+XEN_CPUFEATURE(FRED,         10*32+17) /*   Flexible Return and Event Delivery */
 XEN_CPUFEATURE(LKGS,         10*32+18) /*   Load Kernel GS instruction */
 XEN_CPUFEATURE(WRMSRNS,      10*32+19) /*S  WRMSR Non-Serialising */
 XEN_CPUFEATURE(NMI_SRC,      10*32+20) /*   NMI-Source Reporting */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Mar 30 12:55:09 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 30 Mar 2026 12:55:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1267590.1557049 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7C91-00078A-LD; Mon, 30 Mar 2026 12:55:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1267590.1557049; Mon, 30 Mar 2026 12:55:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7C91-000782-IY; Mon, 30 Mar 2026 12:55:03 +0000
Received: by outflank-mailman (input) for mailman id 1267590;
 Mon, 30 Mar 2026 12:55:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w7C90-00077r-H1
 for xen-changelog@lists.xenproject.org; Mon, 30 Mar 2026 12:55:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7C90-00HIAn-2A
 for xen-changelog@lists.xenproject.org;
 Mon, 30 Mar 2026 12:55:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7C90-00AKLc-1J
 for xen-changelog@lists.xenproject.org;
 Mon, 30 Mar 2026 12:55:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=6XLiEXyGLjBoyaupZUYmeL+JNknwYZH2wcbxCVwxqK0=; b=ppmPToMQHYtNrYSPMWAogiOczx
	yGLp8yuKPWPB7m6pApDtNE+HtBsXcicY3VLC9wbARRDqBK2YFAbFva6Yn3XGeT7v3UEejcxrsGoS7
	Zu0HJ/iY/ym3zqTXL0611fa7YmSqc6D8nONPUITLiDaARgPdr3FE9QrNXj4QWQjq6UJ0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/time: adjust handling of negative delta in stime2tsc()
Message-Id: <E1w7C90-00AKLc-1J@xenbits.xenproject.org>
Date: Mon, 30 Mar 2026 12:55:02 +0000

commit 4fb768fc38999fe0ff5de6a44efae1c0ddc6c6b7
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Mar 30 13:40:42 2026 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Mar 30 13:40:42 2026 +0200

    x86/time: adjust handling of negative delta in stime2tsc()
    
    When we cap negative values to 0 (see code comment as to why), going
    through scale_delta() is pointless - it'll return 0 anyway. Therefore make
    the call conditional (and then also the one to scale_reciprocal()), adding
    a comment as to why there is this capping.
    
    Modernize types used while there, and switch to usiong initializers for
    the local variables.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/include/asm/time.h |  7 ++++++-
 xen/arch/x86/time.c             | 26 ++++++++++++++++----------
 2 files changed, 22 insertions(+), 11 deletions(-)

diff --git a/xen/arch/x86/include/asm/time.h b/xen/arch/x86/include/asm/time.h
index c5e826456d..29e1888ffb 100644
--- a/xen/arch/x86/include/asm/time.h
+++ b/xen/arch/x86/include/asm/time.h
@@ -50,7 +50,12 @@ void force_update_vcpu_system_time(struct vcpu *v);
 
 bool clocksource_is_tsc(void);
 int host_tsc_is_safe(void);
-u64 stime2tsc(s_time_t stime);
+
+/*
+ * Note: This function "caps" times ahead of the local CPU's stime stamp,
+ * supplying the corresponding TSC stamp in that case.
+ */
+uint64_t stime2tsc(s_time_t stime);
 
 struct time_scale;
 void set_time_scale(struct time_scale *ts, u64 ticks_per_sec);
diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c
index 87b4e83250..fed30a919d 100644
--- a/xen/arch/x86/time.c
+++ b/xen/arch/x86/time.c
@@ -1176,20 +1176,26 @@ uint64_t __init calibrate_apic_timer(void)
     return elapsed * CALIBRATE_FRAC;
 }
 
-u64 stime2tsc(s_time_t stime)
+uint64_t stime2tsc(s_time_t stime)
 {
-    struct cpu_time *t;
-    struct time_scale sys_to_tsc;
-    s_time_t stime_delta;
+    const struct cpu_time *t = &this_cpu(cpu_time);
+    s_time_t stime_delta = stime - t->stamp.local_stime;
+    uint64_t delta = 0;
 
-    t = &this_cpu(cpu_time);
-    sys_to_tsc = scale_reciprocal(t->tsc_scale);
+    /*
+     * While for reprogram_timer() the capping at 0 isn't relevant (the returned
+     * value is likely in the past anyway then, by the time it is used), for
+     * cstate_restore_tsc() this is relevant: We need to avoid moving the TSC
+     * backwards (relative to when it may last have been read).
+     */
+    if ( stime_delta > 0 )
+    {
+        struct time_scale sys_to_tsc = scale_reciprocal(t->tsc_scale);
 
-    stime_delta = stime - t->stamp.local_stime;
-    if ( stime_delta < 0 )
-        stime_delta = 0;
+        delta = scale_delta(stime_delta, &sys_to_tsc);
+    }
 
-    return t->stamp.local_tsc + scale_delta(stime_delta, &sys_to_tsc);
+    return t->stamp.local_tsc + delta;
 }
 
 void cstate_restore_tsc(void)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Mar 30 12:55:13 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 30 Mar 2026 12:55:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1267592.1557052 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7C9B-00079j-MQ; Mon, 30 Mar 2026 12:55:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1267592.1557052; Mon, 30 Mar 2026 12:55:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7C9B-00079a-Jw; Mon, 30 Mar 2026 12:55:13 +0000
Received: by outflank-mailman (input) for mailman id 1267592;
 Mon, 30 Mar 2026 12:55:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w7C9A-00079O-Io
 for xen-changelog@lists.xenproject.org; Mon, 30 Mar 2026 12:55:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7C9A-00HIAs-2S
 for xen-changelog@lists.xenproject.org;
 Mon, 30 Mar 2026 12:55:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7C9A-00AKMW-1f
 for xen-changelog@lists.xenproject.org;
 Mon, 30 Mar 2026 12:55:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=sDGOt2TrlESUT7VzCAvJiLkws7+gUcy4/UyM4NFWBOY=; b=5CisWos0OJNtEkNelwbMHH3XQw
	ipJGDsPf5nOX117kHFpkru0zvxa8cu1WKywfuF2HCsJusP7qD3Dt7XjRzyNjO/jxA1YwojLWQUBvi
	VzMAF+Be0xCbsSB1jJgXnkF9y8K/qn20s6ywP+VBquZN0j1QVCSjBKU/na1/6eD4wE4s=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] unlzma: avoid UB shift
Message-Id: <E1w7C9A-00AKMW-1f@xenbits.xenproject.org>
Date: Mon, 30 Mar 2026 12:55:12 +0000

commit 5b1185cf2602a3819629c8313d3303dc2509c830
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Mar 30 13:41:07 2026 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Mar 30 13:41:07 2026 +0200

    unlzma: avoid UB shift
    
    Shifting signed quantities has restrictions. Since the wrapping macro of
    read_int() type-casts the result anyway, switch function return type as
    well as the local variable to the corresponding unsigned type.
    
    Reported-by: Kamil Frankowicz <kamil.frankowicz@cert.pl>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/common/unlzma.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/common/unlzma.c b/xen/common/unlzma.c
index 6cd99023ad..56359420aa 100644
--- a/xen/common/unlzma.c
+++ b/xen/common/unlzma.c
@@ -30,10 +30,10 @@
 
 #include "decompress.h"
 
-static long long __init read_int(unsigned char *ptr, int size)
+static unsigned long long __init read_int(unsigned char *ptr, int size)
 {
 	int i;
-	long long ret = 0;
+	unsigned long long ret = 0;
 
 	for (i = 0; i < size; i++)
 		ret = (ret << 8) | ptr[size-i-1];
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Mar 30 12:55:23 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 30 Mar 2026 12:55:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1267593.1557056 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7C9L-0007CH-Nb; Mon, 30 Mar 2026 12:55:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1267593.1557056; Mon, 30 Mar 2026 12:55:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7C9L-0007C9-L5; Mon, 30 Mar 2026 12:55:23 +0000
Received: by outflank-mailman (input) for mailman id 1267593;
 Mon, 30 Mar 2026 12:55:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w7C9K-0007C1-MD
 for xen-changelog@lists.xenproject.org; Mon, 30 Mar 2026 12:55:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7C9K-00HIB0-2n
 for xen-changelog@lists.xenproject.org;
 Mon, 30 Mar 2026 12:55:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7C9K-00AKNq-1w
 for xen-changelog@lists.xenproject.org;
 Mon, 30 Mar 2026 12:55:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=xOX09iQfhviX94wJF6Sc+AwtN/r2CxxnyyxtXZEo2/U=; b=vBKB1Col5uUX94qsgA/EpwLnWh
	jncbp5dFOqoK6z3eFUR5M9ZQYAgHaCw9rR0Gh/hXomXDAHQoF7Hs3VRPZ9Ya+04XBOX/SIGOWjluA
	4E106eU0x+o+rd0Dig60+QLONu/ZV3Dwh144aT+bi1oW0vtI6gD4gR85ryKnfW7IAO6Q=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] CHANGELOG: add xenstore quota support
Message-Id: <E1w7C9K-00AKNq-1w@xenbits.xenproject.org>
Date: Mon, 30 Mar 2026 12:55:22 +0000

commit ce023004c4362bc891650f5e32f39062c6d92056
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Mon Mar 30 13:41:26 2026 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Mar 30 13:41:26 2026 +0200

    CHANGELOG: add xenstore quota support
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
---
 CHANGELOG.md | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index c191e504ab..6d4610d5f1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,6 +9,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
 ### Changed
 
 ### Added
+ - Support for per-domain Xenstore quota in C xenstored (includes
+   xenstore-stubdom), libxl and xl.
  - On x86:
    - Support for Bus Lock Threshold on AMD Zen5 and later CPUs, used by Xen to
      mitigate (by rate-limiting) the system wide impact of an HVM guest
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Mar 30 14:44:12 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 30 Mar 2026 14:44:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1267742.1557177 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7DqU-000210-S1; Mon, 30 Mar 2026 14:44:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1267742.1557177; Mon, 30 Mar 2026 14:44:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7DqU-00020t-PM; Mon, 30 Mar 2026 14:44:02 +0000
Received: by outflank-mailman (input) for mailman id 1267742;
 Mon, 30 Mar 2026 14:44:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w7DqT-00020n-Rj
 for xen-changelog@lists.xenproject.org; Mon, 30 Mar 2026 14:44:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7DqT-00HKMW-33
 for xen-changelog@lists.xenproject.org;
 Mon, 30 Mar 2026 14:44:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7DqT-00AT4f-2E
 for xen-changelog@lists.xenproject.org;
 Mon, 30 Mar 2026 14:44:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=vJtt3/lv1JHoGVir+nmaKokT9eHbF1dASqzOGuyt+mo=; b=OWXs/3BtR7jKIrTs1sT9b5dotv
	LIUuYqDLwNT4nIA5jqYH5BCN4a+RqImz3bRWM8iXogTUhH6zdPQmTyqpZlxttXfb09Qcz2XyP5oyw
	RVuDaCXX2tkHrsAS/53BPyS/08WX7XJtPYBGUWsdigYz9IqBVLXlDDTi3hGgm3U5Bcr4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/time: adjust handling of negative delta in stime2tsc()
Message-Id: <E1w7DqT-00AT4f-2E@xenbits.xenproject.org>
Date: Mon, 30 Mar 2026 14:44:01 +0000

commit 4fb768fc38999fe0ff5de6a44efae1c0ddc6c6b7
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Mar 30 13:40:42 2026 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Mar 30 13:40:42 2026 +0200

    x86/time: adjust handling of negative delta in stime2tsc()
    
    When we cap negative values to 0 (see code comment as to why), going
    through scale_delta() is pointless - it'll return 0 anyway. Therefore make
    the call conditional (and then also the one to scale_reciprocal()), adding
    a comment as to why there is this capping.
    
    Modernize types used while there, and switch to usiong initializers for
    the local variables.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/include/asm/time.h |  7 ++++++-
 xen/arch/x86/time.c             | 26 ++++++++++++++++----------
 2 files changed, 22 insertions(+), 11 deletions(-)

diff --git a/xen/arch/x86/include/asm/time.h b/xen/arch/x86/include/asm/time.h
index c5e826456d..29e1888ffb 100644
--- a/xen/arch/x86/include/asm/time.h
+++ b/xen/arch/x86/include/asm/time.h
@@ -50,7 +50,12 @@ void force_update_vcpu_system_time(struct vcpu *v);
 
 bool clocksource_is_tsc(void);
 int host_tsc_is_safe(void);
-u64 stime2tsc(s_time_t stime);
+
+/*
+ * Note: This function "caps" times ahead of the local CPU's stime stamp,
+ * supplying the corresponding TSC stamp in that case.
+ */
+uint64_t stime2tsc(s_time_t stime);
 
 struct time_scale;
 void set_time_scale(struct time_scale *ts, u64 ticks_per_sec);
diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c
index 87b4e83250..fed30a919d 100644
--- a/xen/arch/x86/time.c
+++ b/xen/arch/x86/time.c
@@ -1176,20 +1176,26 @@ uint64_t __init calibrate_apic_timer(void)
     return elapsed * CALIBRATE_FRAC;
 }
 
-u64 stime2tsc(s_time_t stime)
+uint64_t stime2tsc(s_time_t stime)
 {
-    struct cpu_time *t;
-    struct time_scale sys_to_tsc;
-    s_time_t stime_delta;
+    const struct cpu_time *t = &this_cpu(cpu_time);
+    s_time_t stime_delta = stime - t->stamp.local_stime;
+    uint64_t delta = 0;
 
-    t = &this_cpu(cpu_time);
-    sys_to_tsc = scale_reciprocal(t->tsc_scale);
+    /*
+     * While for reprogram_timer() the capping at 0 isn't relevant (the returned
+     * value is likely in the past anyway then, by the time it is used), for
+     * cstate_restore_tsc() this is relevant: We need to avoid moving the TSC
+     * backwards (relative to when it may last have been read).
+     */
+    if ( stime_delta > 0 )
+    {
+        struct time_scale sys_to_tsc = scale_reciprocal(t->tsc_scale);
 
-    stime_delta = stime - t->stamp.local_stime;
-    if ( stime_delta < 0 )
-        stime_delta = 0;
+        delta = scale_delta(stime_delta, &sys_to_tsc);
+    }
 
-    return t->stamp.local_tsc + scale_delta(stime_delta, &sys_to_tsc);
+    return t->stamp.local_tsc + delta;
 }
 
 void cstate_restore_tsc(void)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Mar 30 14:44:12 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 30 Mar 2026 14:44:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1267743.1557182 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7Dqe-00022e-TX; Mon, 30 Mar 2026 14:44:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1267743.1557182; Mon, 30 Mar 2026 14:44:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7Dqe-00022X-Qs; Mon, 30 Mar 2026 14:44:12 +0000
Received: by outflank-mailman (input) for mailman id 1267743;
 Mon, 30 Mar 2026 14:44:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w7Dqd-000229-RR
 for xen-changelog@lists.xenproject.org; Mon, 30 Mar 2026 14:44:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7Dqe-00HKMn-06
 for xen-changelog@lists.xenproject.org;
 Mon, 30 Mar 2026 14:44:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7Dqd-00AT66-2X
 for xen-changelog@lists.xenproject.org;
 Mon, 30 Mar 2026 14:44:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=NmaiiiJlvqJnKRrm3j1FGgNDCuCEYXyS713D5Td/jvk=; b=0CaPBReEYg/aKhrZjntnw0deZp
	QVAYERJGNL0uJRPjfxW9hAuJiGeT5Z9rlEnVLviV28pqHnCHbK+TkNcAyi9pVJpNV3sNx90mD8ET1
	6BGBQf0R0DTBVjqKXFQDQ+xAwEzDECGw/Ky0dGwKUrP4tpkC2qNO1GA7OYreNrZ/tybQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] unlzma: avoid UB shift
Message-Id: <E1w7Dqd-00AT66-2X@xenbits.xenproject.org>
Date: Mon, 30 Mar 2026 14:44:11 +0000

commit 5b1185cf2602a3819629c8313d3303dc2509c830
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Mar 30 13:41:07 2026 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Mar 30 13:41:07 2026 +0200

    unlzma: avoid UB shift
    
    Shifting signed quantities has restrictions. Since the wrapping macro of
    read_int() type-casts the result anyway, switch function return type as
    well as the local variable to the corresponding unsigned type.
    
    Reported-by: Kamil Frankowicz <kamil.frankowicz@cert.pl>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/common/unlzma.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/common/unlzma.c b/xen/common/unlzma.c
index 6cd99023ad..56359420aa 100644
--- a/xen/common/unlzma.c
+++ b/xen/common/unlzma.c
@@ -30,10 +30,10 @@
 
 #include "decompress.h"
 
-static long long __init read_int(unsigned char *ptr, int size)
+static unsigned long long __init read_int(unsigned char *ptr, int size)
 {
 	int i;
-	long long ret = 0;
+	unsigned long long ret = 0;
 
 	for (i = 0; i < size; i++)
 		ret = (ret << 8) | ptr[size-i-1];
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Mar 30 14:44:22 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 30 Mar 2026 14:44:22 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1267744.1557186 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7Dqo-000250-Ux; Mon, 30 Mar 2026 14:44:22 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1267744.1557186; Mon, 30 Mar 2026 14:44:22 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7Dqo-00024s-SN; Mon, 30 Mar 2026 14:44:22 +0000
Received: by outflank-mailman (input) for mailman id 1267744;
 Mon, 30 Mar 2026 14:44:21 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w7Dqn-00024m-UX
 for xen-changelog@lists.xenproject.org; Mon, 30 Mar 2026 14:44:21 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7Dqo-00HKMr-0P
 for xen-changelog@lists.xenproject.org;
 Mon, 30 Mar 2026 14:44:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7Dqn-00AT7O-2o
 for xen-changelog@lists.xenproject.org;
 Mon, 30 Mar 2026 14:44:21 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=yssU0P/tJSy6UR6GeD+2VK9we0fceC/K6voXRWU6WbQ=; b=gx1z1QSaVd1e4lHqtsXk3/W8DE
	KBqgsdwDaIIV22b67MfI23mG7/QWIjWVbzFjok0YrjXV2MvykktJd0vjDXT6Y8nO6vXN23EKInpbt
	aqk2Mrc5WvwJn7rh/qzfWZ8wLaFjItgEj+uVErf9jpxNkfbJcSCr7XjGy4R8m3ZiVIek=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] CHANGELOG: add xenstore quota support
Message-Id: <E1w7Dqn-00AT7O-2o@xenbits.xenproject.org>
Date: Mon, 30 Mar 2026 14:44:21 +0000

commit ce023004c4362bc891650f5e32f39062c6d92056
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Mon Mar 30 13:41:26 2026 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Mar 30 13:41:26 2026 +0200

    CHANGELOG: add xenstore quota support
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
---
 CHANGELOG.md | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index c191e504ab..6d4610d5f1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,6 +9,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
 ### Changed
 
 ### Added
+ - Support for per-domain Xenstore quota in C xenstored (includes
+   xenstore-stubdom), libxl and xl.
  - On x86:
    - Support for Bus Lock Threshold on AMD Zen5 and later CPUs, used by Xen to
      mitigate (by rate-limiting) the system wide impact of an HVM guest
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Mar 30 14:55:06 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 30 Mar 2026 14:55:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1267755.1557199 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7E19-0003pq-Sv; Mon, 30 Mar 2026 14:55:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1267755.1557199; Mon, 30 Mar 2026 14:55:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7E19-0003pj-QA; Mon, 30 Mar 2026 14:55:03 +0000
Received: by outflank-mailman (input) for mailman id 1267755;
 Mon, 30 Mar 2026 14:55:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w7E18-0003pd-4z
 for xen-changelog@lists.xenproject.org; Mon, 30 Mar 2026 14:55:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7E18-00HKZ2-0w
 for xen-changelog@lists.xenproject.org;
 Mon, 30 Mar 2026 14:55:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7E18-00AUqq-07
 for xen-changelog@lists.xenproject.org;
 Mon, 30 Mar 2026 14:55:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=P88oUFIUUO8SOd2OqDjUglu5WSCW2VSUFIXTsgrowN8=; b=ovhDbdsQBf/Ns5lAqUgpyQag6I
	GHTf1Eip8YCmo9SFN76M5GrRqNA3y1zyve4Y4cTczvn2FsooRrEM0BkWVSafZvFDGfdIOt2l5OSqN
	BoR1t5TZGtegqEWh6G1w25MmFaFKCa+O5gXYMBR3kZbFxEvdAKwosVULxoE6O5HfgN4g=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/uart: uniformly set ->ps_bdf_enable for all PCI serial devices
Message-Id: <E1w7E18-00AUqq-07@xenbits.xenproject.org>
Date: Mon, 30 Mar 2026 14:55:02 +0000

commit 4bf33360623d9d59c8e7a49b70308c1b58d4d772
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Fri Mar 27 11:16:33 2026 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Mon Mar 30 16:43:14 2026 +0200

    xen/uart: uniformly set ->ps_bdf_enable for all PCI serial devices
    
    Auto-discovered serial PCI devices when using dev=amt|pci won't get
    ->ps_bdf_enable, and as such some of the logic (like making sure the
    respective BARs are enabled) won't be applied to them.
    
    Fix by unconditionally setting ->ps_bdf_enable for all PCI serial devices,
    and removing the special case that was done in some places by checking
    whether the ->bar was set.  This also allows simplifying the logic in
    pci_serial_early_init().
    
    Fixes: 9738db88f68f ("xen: Automatically find serial port on PCI/PCIe and AMT devices.")
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/drivers/char/ns16550.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/xen/drivers/char/ns16550.c b/xen/drivers/char/ns16550.c
index d384f1c69d..45ac089193 100644
--- a/xen/drivers/char/ns16550.c
+++ b/xen/drivers/char/ns16550.c
@@ -283,7 +283,10 @@ static int cf_check ns16550_getc(struct serial_port *port, char *pc)
 static void pci_serial_early_init(struct ns16550 *uart)
 {
 #ifdef NS16550_PCI
-    if ( uart->bar && uart->io_base >= 0x10000 )
+    if ( !uart->ps_bdf_enable )
+        return;
+
+    if ( uart->io_base >= 0x10000 )
     {
         pci_conf_write16(PCI_SBDF(0, uart->ps_bdf[0], uart->ps_bdf[1],
                                   uart->ps_bdf[2]),
@@ -291,9 +294,6 @@ static void pci_serial_early_init(struct ns16550 *uart)
         return;
     }
 
-    if ( !uart->ps_bdf_enable || uart->io_base >= 0x10000 )
-        return;
-
     if ( uart->pb_bdf_enable )
         pci_conf_write16(PCI_SBDF(0, uart->pb_bdf[0], uart->pb_bdf[1],
                                   uart->pb_bdf[2]),
@@ -440,7 +440,7 @@ static void __init cf_check ns16550_init_postirq(struct serial_port *port)
         unsigned int, 1, (bits * uart->fifo_size * 1000) / uart->baud);
 
 #ifdef NS16550_PCI
-    if ( uart->bar || uart->ps_bdf_enable )
+    if ( uart->ps_bdf_enable )
     {
         if ( uart->param && uart->param->mmio &&
              rangeset_add_range(mmio_ro_ranges, PFN_DOWN(uart->io_base),
@@ -1338,6 +1338,7 @@ pci_uart_config(struct ns16550 *uart, bool skip_amt, unsigned int idx)
                 uart->ps_bdf[0] = b;
                 uart->ps_bdf[1] = d;
                 uart->ps_bdf[2] = f;
+                uart->ps_bdf_enable = true;
                 uart->bar_idx = bar_idx;
                 uart->bar = bar;
                 uart->bar64 = bar_64;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Mar 30 14:55:13 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 30 Mar 2026 14:55:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1267756.1557203 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7E1J-0003rm-Ug; Mon, 30 Mar 2026 14:55:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1267756.1557203; Mon, 30 Mar 2026 14:55:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7E1J-0003re-RZ; Mon, 30 Mar 2026 14:55:13 +0000
Received: by outflank-mailman (input) for mailman id 1267756;
 Mon, 30 Mar 2026 14:55:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w7E1I-0003rO-6d
 for xen-changelog@lists.xenproject.org; Mon, 30 Mar 2026 14:55:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7E1I-00HKZ7-1F
 for xen-changelog@lists.xenproject.org;
 Mon, 30 Mar 2026 14:55:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7E1I-00AUrs-0R
 for xen-changelog@lists.xenproject.org;
 Mon, 30 Mar 2026 14:55:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=1jAMRbAOwIRB3WEvc2JF03nyOPtillaNE7Wn8sB2+l8=; b=IUiVnupvW3MU48JMMGa+Kkblvk
	2mYg4RB7oNSuMAIkS0P3+cnLqVVzOQyNHN7J0DSuDCEKjtSz1gsQmQuPjLhafFWEFIMlPaHcXDoe8
	KhEAxtDuVXsv1/xrbygwSMR8gdnEEuyOOUs1RpCHu7e5aQJa4pTzbc7fPTsH7CYon6XQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/uart: be more careful with changes to the PCI command register
Message-Id: <E1w7E1I-00AUrs-0R@xenbits.xenproject.org>
Date: Mon, 30 Mar 2026 14:55:12 +0000

commit ebf543972560e45b838def3a54859331cc92c970
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Wed Mar 25 14:32:59 2026 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Mon Mar 30 16:43:14 2026 +0200

    xen/uart: be more careful with changes to the PCI command register
    
    Read the existing PCI command register and only add the required bits to
    it, as to avoid clearing bits that might be possibly set by the firmware
    already, which might put the device into a non-working state.
    
    Xen being the owner of the PCI device it's legitimately allowed to change
    command registers bits.  Be careful however in case buggy devices require
    certain command register bits to be enabled, while not strictly required
    from Xen's usage.
    
    Fixes: f2ff5d6628b3 ("ns16550: enable PCI serial card usage")
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/drivers/char/ns16550.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/xen/drivers/char/ns16550.c b/xen/drivers/char/ns16550.c
index 45ac089193..293fc74d63 100644
--- a/xen/drivers/char/ns16550.c
+++ b/xen/drivers/char/ns16550.c
@@ -283,14 +283,19 @@ static int cf_check ns16550_getc(struct serial_port *port, char *pc)
 static void pci_serial_early_init(struct ns16550 *uart)
 {
 #ifdef NS16550_PCI
+    uint16_t cmd;
+
     if ( !uart->ps_bdf_enable )
         return;
 
+    cmd = pci_conf_read16(PCI_SBDF(0, uart->ps_bdf[0], uart->ps_bdf[1],
+                                  uart->ps_bdf[2]), PCI_COMMAND);
+
     if ( uart->io_base >= 0x10000 )
     {
         pci_conf_write16(PCI_SBDF(0, uart->ps_bdf[0], uart->ps_bdf[1],
                                   uart->ps_bdf[2]),
-                         PCI_COMMAND, PCI_COMMAND_MEMORY);
+                         PCI_COMMAND, cmd | PCI_COMMAND_MEMORY);
         return;
     }
 
@@ -307,7 +312,7 @@ static void pci_serial_early_init(struct ns16550 *uart)
                      uart->io_base | PCI_BASE_ADDRESS_SPACE_IO);
     pci_conf_write16(PCI_SBDF(0, uart->ps_bdf[0], uart->ps_bdf[1],
                               uart->ps_bdf[2]),
-                     PCI_COMMAND, PCI_COMMAND_IO);
+                     PCI_COMMAND, cmd | PCI_COMMAND_IO);
 #endif
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Mar 30 14:55:23 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 30 Mar 2026 14:55:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1267757.1557207 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7E1T-0003uO-18; Mon, 30 Mar 2026 14:55:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1267757.1557207; Mon, 30 Mar 2026 14:55:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7E1S-0003uG-Uj; Mon, 30 Mar 2026 14:55:22 +0000
Received: by outflank-mailman (input) for mailman id 1267757;
 Mon, 30 Mar 2026 14:55:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w7E1S-0003u9-9a
 for xen-changelog@lists.xenproject.org; Mon, 30 Mar 2026 14:55:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7E1S-00HKZB-1X
 for xen-changelog@lists.xenproject.org;
 Mon, 30 Mar 2026 14:55:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7E1S-00AUtZ-0k
 for xen-changelog@lists.xenproject.org;
 Mon, 30 Mar 2026 14:55:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=vNsK+FJjF4qtSFnrxcgrVZfF7VW55oj2YkumpT+xgbU=; b=RPmsl13zgYYEFZSf22QeuaHTNc
	L9PsNQBHiUCR6eKNhvvtaNBs5aKjMdfVcGtHzldo5tTXyYsVKlRmQ/vUDowYLN5fPR8saAQq4z80O
	aoUgPYagWLR3QIUm2Uh4xgGIoCRIrhiXsETx5O7L9zJ0Ii7m1dOKPZNxG4LQFL7SY8vI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/uart: switch ns16550 to use pci_sbdf_t
Message-Id: <E1w7E1S-00AUtZ-0k@xenbits.xenproject.org>
Date: Mon, 30 Mar 2026 14:55:22 +0000

commit 1e185afefcfd497b662574c29b53d73d3393df3e
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Fri Mar 20 08:58:15 2026 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Mon Mar 30 16:43:14 2026 +0200

    xen/uart: switch ns16550 to use pci_sbdf_t
    
    No functional change intended.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/drivers/char/ns16550.c | 133 ++++++++++++++++++++-------------------------
 1 file changed, 58 insertions(+), 75 deletions(-)

diff --git a/xen/drivers/char/ns16550.c b/xen/drivers/char/ns16550.c
index 293fc74d63..b23e85a3c6 100644
--- a/xen/drivers/char/ns16550.c
+++ b/xen/drivers/char/ns16550.c
@@ -67,8 +67,8 @@ static struct ns16550 {
     /* PCI card parameters. */
     bool pb_bdf_enable;     /* if =1, pb-bdf effective, port behind bridge */
     bool ps_bdf_enable;     /* if =1, ps_bdf effective, port on pci card */
-    unsigned int pb_bdf[3]; /* pci bridge BDF */
-    unsigned int ps_bdf[3]; /* pci serial port BDF */
+    pci_sbdf_t pci_bridge;
+    pci_sbdf_t pci_device;
     u32 bar;
     u32 bar64;
     u16 cr;
@@ -288,31 +288,22 @@ static void pci_serial_early_init(struct ns16550 *uart)
     if ( !uart->ps_bdf_enable )
         return;
 
-    cmd = pci_conf_read16(PCI_SBDF(0, uart->ps_bdf[0], uart->ps_bdf[1],
-                                  uart->ps_bdf[2]), PCI_COMMAND);
+    cmd = pci_conf_read16(uart->pci_device, PCI_COMMAND);
 
     if ( uart->io_base >= 0x10000 )
     {
-        pci_conf_write16(PCI_SBDF(0, uart->ps_bdf[0], uart->ps_bdf[1],
-                                  uart->ps_bdf[2]),
-                         PCI_COMMAND, cmd | PCI_COMMAND_MEMORY);
+        pci_conf_write16(uart->pci_device, PCI_COMMAND, cmd | PCI_COMMAND_MEMORY);
         return;
     }
 
     if ( uart->pb_bdf_enable )
-        pci_conf_write16(PCI_SBDF(0, uart->pb_bdf[0], uart->pb_bdf[1],
-                                  uart->pb_bdf[2]),
-                         PCI_IO_BASE,
+        pci_conf_write16(uart->pci_bridge, PCI_IO_BASE,
                          (uart->io_base & 0xF000) |
                          ((uart->io_base & 0xF000) >> 8));
 
-    pci_conf_write32(PCI_SBDF(0, uart->ps_bdf[0], uart->ps_bdf[1],
-                              uart->ps_bdf[2]),
-                     PCI_BASE_ADDRESS_0,
+    pci_conf_write32(uart->pci_device, PCI_BASE_ADDRESS_0,
                      uart->io_base | PCI_BASE_ADDRESS_SPACE_IO);
-    pci_conf_write16(PCI_SBDF(0, uart->ps_bdf[0], uart->ps_bdf[1],
-                              uart->ps_bdf[2]),
-                     PCI_COMMAND, cmd | PCI_COMMAND_IO);
+    pci_conf_write16(uart->pci_device, PCI_COMMAND, cmd | PCI_COMMAND_IO);
 #endif
 }
 
@@ -452,17 +443,16 @@ static void __init cf_check ns16550_init_postirq(struct serial_port *port)
                                 PFN_UP(uart->io_base + uart->io_size) - 1) )
             printk(XENLOG_INFO "Error while adding MMIO range of device to mmio_ro_ranges\n");
 
-        if ( pci_ro_device(0, uart->ps_bdf[0],
-                           PCI_DEVFN(uart->ps_bdf[1], uart->ps_bdf[2])) )
-            printk(XENLOG_INFO "Could not mark config space of %02x:%02x.%u read-only.\n",
-                   uart->ps_bdf[0], uart->ps_bdf[1],
-                   uart->ps_bdf[2]);
+        if ( pci_ro_device(uart->pci_device.seg, uart->pci_device.bus,
+                           uart->pci_device.devfn) )
+            printk(XENLOG_INFO
+                   "Could not mark config space of %pp read-only.\n",
+                   &uart->pci_device);
 
         if ( uart->msi )
         {
             struct msi_info msi = {
-                .sbdf = PCI_SBDF(0, uart->ps_bdf[0], uart->ps_bdf[1],
-                                 uart->ps_bdf[2]),
+                .sbdf = uart->pci_device,
                 .irq = uart->irq,
                 .entry_nr = 1
             };
@@ -504,9 +494,8 @@ static void __init cf_check ns16550_init_postirq(struct serial_port *port)
             }
 
             if ( rc )
-                printk(XENLOG_WARNING
-                       "MSI setup failed (%d) for %02x:%02x.%o\n",
-                       rc, uart->ps_bdf[0], uart->ps_bdf[1], uart->ps_bdf[2]);
+                printk(XENLOG_WARNING "MSI setup failed (%d) for %pp\n",
+                       rc, &uart->pci_device);
         }
     }
 #endif
@@ -533,8 +522,7 @@ static void cf_check ns16550_suspend(struct serial_port *port)
 
 #ifdef NS16550_PCI
     if ( uart->bar )
-       uart->cr = pci_conf_read16(PCI_SBDF(0, uart->ps_bdf[0], uart->ps_bdf[1],
-                                  uart->ps_bdf[2]), PCI_COMMAND);
+       uart->cr = pci_conf_read16(uart->pci_device, PCI_COMMAND);
 #endif
 }
 
@@ -545,19 +533,15 @@ static void _ns16550_resume(struct serial_port *port)
 
     if ( uart->bar )
     {
-       pci_conf_write32(PCI_SBDF(0, uart->ps_bdf[0], uart->ps_bdf[1],
-                                 uart->ps_bdf[2]),
+       pci_conf_write32(uart->pci_device,
                         PCI_BASE_ADDRESS_0 + uart->bar_idx*4, uart->bar);
 
         /* If 64 bit BAR, write higher 32 bits to BAR+4 */
         if ( uart->bar & PCI_BASE_ADDRESS_MEM_TYPE_64 )
-            pci_conf_write32(PCI_SBDF(0, uart->ps_bdf[0],  uart->ps_bdf[1],
-                                      uart->ps_bdf[2]),
+            pci_conf_write32(uart->pci_device,
                         PCI_BASE_ADDRESS_0 + (uart->bar_idx+1)*4, uart->bar64);
 
-       pci_conf_write16(PCI_SBDF(0, uart->ps_bdf[0], uart->ps_bdf[1],
-                                 uart->ps_bdf[2]),
-                        PCI_COMMAND, uart->cr);
+       pci_conf_write16(uart->pci_device, PCI_COMMAND, uart->cr);
     }
 #endif
 
@@ -1217,13 +1201,12 @@ pci_uart_config(struct ns16550 *uart, bool skip_amt, unsigned int idx)
                 uint32_t bar, bar_64 = 0, len, len_64;
                 u64 size = 0;
                 const struct ns16550_config_param *param = uart_param;
+                pci_sbdf_t sbdf = PCI_SBDF(0, b, d, f);
 
-                nextf = (f || (pci_conf_read16(PCI_SBDF(0, b, d, f),
-                                               PCI_HEADER_TYPE) &
+                nextf = (f || (pci_conf_read16(sbdf, PCI_HEADER_TYPE) &
                                0x80)) ? f + 1 : 8;
 
-                switch ( pci_conf_read16(PCI_SBDF(0, b, d, f),
-                                         PCI_CLASS_DEVICE) )
+                switch ( pci_conf_read16(sbdf, PCI_CLASS_DEVICE) )
                 {
                 case 0x0700: /* single port serial */
                 case 0x0702: /* multi port serial */
@@ -1240,10 +1223,8 @@ pci_uart_config(struct ns16550 *uart, bool skip_amt, unsigned int idx)
                 /* Check for params in uart_config lookup table */
                 for ( i = 0; i < ARRAY_SIZE(uart_config); i++ )
                 {
-                    u16 vendor = pci_conf_read16(PCI_SBDF(0, b, d, f),
-                                                 PCI_VENDOR_ID);
-                    u16 device = pci_conf_read16(PCI_SBDF(0, b, d, f),
-                                                 PCI_DEVICE_ID);
+                    u16 vendor = pci_conf_read16(sbdf, PCI_VENDOR_ID);
+                    u16 device = pci_conf_read16(sbdf, PCI_DEVICE_ID);
 
                     if ( uart_config[i].vendor_id == vendor &&
                          uart_config[i].dev_id == device )
@@ -1266,29 +1247,26 @@ pci_uart_config(struct ns16550 *uart, bool skip_amt, unsigned int idx)
                 }
 
                 uart->io_base = 0;
-                bar = pci_conf_read32(PCI_SBDF(0, b, d, f),
-                                      PCI_BASE_ADDRESS_0 + bar_idx * 4);
+                bar = pci_conf_read32(sbdf, PCI_BASE_ADDRESS_0 + bar_idx * 4);
 
                 /* MMIO based */
                 if ( param->mmio && !(bar & PCI_BASE_ADDRESS_SPACE_IO) )
                 {
-                    pci_conf_write32(PCI_SBDF(0, b, d, f),
-                                     PCI_BASE_ADDRESS_0 + bar_idx*4, ~0u);
-                    len = pci_conf_read32(PCI_SBDF(0, b, d, f),
+                    pci_conf_write32(sbdf, PCI_BASE_ADDRESS_0 + bar_idx*4, ~0u);
+                    len = pci_conf_read32(sbdf,
                                           PCI_BASE_ADDRESS_0 + bar_idx * 4);
-                    pci_conf_write32(PCI_SBDF(0, b, d, f),
-                                     PCI_BASE_ADDRESS_0 + bar_idx*4, bar);
+                    pci_conf_write32(sbdf, PCI_BASE_ADDRESS_0 + bar_idx*4, bar);
 
                     /* Handle 64 bit BAR if found */
                     if ( bar & PCI_BASE_ADDRESS_MEM_TYPE_64 )
                     {
-                        bar_64 = pci_conf_read32(PCI_SBDF(0, b, d, f),
+                        bar_64 = pci_conf_read32(sbdf,
                                       PCI_BASE_ADDRESS_0 + (bar_idx + 1) * 4);
-                        pci_conf_write32(PCI_SBDF(0, b, d, f),
+                        pci_conf_write32(sbdf,
                                     PCI_BASE_ADDRESS_0 + (bar_idx+1)*4, ~0u);
-                        len_64 = pci_conf_read32(PCI_SBDF(0, b, d, f),
+                        len_64 = pci_conf_read32(sbdf,
                                     PCI_BASE_ADDRESS_0 + (bar_idx + 1) * 4);
-                        pci_conf_write32(PCI_SBDF(0, b, d, f),
+                        pci_conf_write32(sbdf,
                                     PCI_BASE_ADDRESS_0 + (bar_idx+1)*4, bar_64);
                         size  = ((u64)~0 << 32) | PCI_BASE_ADDRESS_MEM_MASK;
                         size &= ((u64)len_64 << 32) | len;
@@ -1302,12 +1280,9 @@ pci_uart_config(struct ns16550 *uart, bool skip_amt, unsigned int idx)
                 /* IO based */
                 else if ( !param->mmio && (bar & PCI_BASE_ADDRESS_SPACE_IO) )
                 {
-                    pci_conf_write32(PCI_SBDF(0, b, d, f),
-                                     PCI_BASE_ADDRESS_0 + bar_idx*4, ~0u);
-                    len = pci_conf_read32(PCI_SBDF(0, b, d, f),
-                                          PCI_BASE_ADDRESS_0);
-                    pci_conf_write32(PCI_SBDF(0, b, d, f),
-                                     PCI_BASE_ADDRESS_0 + bar_idx*4, bar);
+                    pci_conf_write32(sbdf, PCI_BASE_ADDRESS_0 + bar_idx*4, ~0u);
+                    len = pci_conf_read32(sbdf, PCI_BASE_ADDRESS_0);
+                    pci_conf_write32(sbdf, PCI_BASE_ADDRESS_0 + bar_idx*4, bar);
                     size = len & PCI_BASE_ADDRESS_IO_MASK;
 
                     uart->io_base = bar & ~PCI_BASE_ADDRESS_SPACE_IO;
@@ -1340,19 +1315,15 @@ pci_uart_config(struct ns16550 *uart, bool skip_amt, unsigned int idx)
                 if ( param->fifo_size )
                     uart->fifo_size = param->fifo_size;
 
-                uart->ps_bdf[0] = b;
-                uart->ps_bdf[1] = d;
-                uart->ps_bdf[2] = f;
+                uart->pci_device = sbdf;
                 uart->ps_bdf_enable = true;
                 uart->bar_idx = bar_idx;
                 uart->bar = bar;
                 uart->bar64 = bar_64;
                 uart->io_size = max(8U << param->reg_shift,
                                     param->uart_offset);
-                uart->irq = pci_conf_read8(PCI_SBDF(0, b, d, f),
-                                           PCI_INTERRUPT_PIN) ?
-                            pci_conf_read8(PCI_SBDF(0, b, d, f),
-                                           PCI_INTERRUPT_LINE) : 0;
+                uart->irq = pci_conf_read8(sbdf, PCI_INTERRUPT_PIN) ?
+                            pci_conf_read8(sbdf, PCI_INTERRUPT_LINE) : 0;
 
 #ifdef CONFIG_X86
                 /*
@@ -1591,18 +1562,22 @@ static bool __init parse_positional(struct ns16550 *uart, char **str)
 #ifdef CONFIG_HAS_PCI
     if ( *conf == ',' && *++conf != ',' )
     {
-        conf = parse_pci(conf, NULL, &uart->ps_bdf[0],
-                         &uart->ps_bdf[1], &uart->ps_bdf[2]);
+        unsigned int b, d, f;
+
+        conf = parse_pci(conf, NULL, &b, &d, &f);
         if ( !conf )
             PARSE_ERR_RET("Bad port PCI coordinates");
+        uart->pci_device = PCI_SBDF(0, b, d, f);
         uart->ps_bdf_enable = true;
     }
 
     if ( *conf == ',' && *++conf != ',' )
     {
-        if ( !parse_pci(conf, NULL, &uart->pb_bdf[0],
-                        &uart->pb_bdf[1], &uart->pb_bdf[2]) )
+        unsigned int b, d, f;
+
+        if ( !parse_pci(conf, NULL, &b, &d, &f) )
             PARSE_ERR_RET("Bad bridge PCI coordinates");
+        uart->pci_bridge = PCI_SBDF(0, b, d, f);
         uart->pb_bdf_enable = true;
     }
 #endif
@@ -1685,18 +1660,26 @@ static bool __init parse_namevalue_pairs(char *str, struct ns16550 *uart)
             break;
 
         case port_bdf:
-            if ( !parse_pci(param_value, NULL, &uart->ps_bdf[0],
-                            &uart->ps_bdf[1], &uart->ps_bdf[2]) )
+        {
+            unsigned int b, d, f;
+
+            if ( !parse_pci(param_value, NULL, &b, &d, &f) )
                 PARSE_ERR_RET("Bad port PCI coordinates\n");
+            uart->pci_device = PCI_SBDF(0, b, d, f);
             uart->ps_bdf_enable = true;
             break;
+        }
 
         case bridge_bdf:
-            if ( !parse_pci(param_value, NULL, &uart->pb_bdf[0],
-                            &uart->pb_bdf[1], &uart->pb_bdf[2]) )
+        {
+            unsigned int b, d, f;
+
+            if ( !parse_pci(param_value, NULL, &b, &d, &f) )
                 PARSE_ERR_RET("Bad bridge PCI coordinates\n");
+            uart->pci_bridge = PCI_SBDF(0, b, d, f);
             uart->pb_bdf_enable = true;
             break;
+        }
 #endif
 
         default:
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Mar 30 14:55:33 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 30 Mar 2026 14:55:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1267758.1557211 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7E1d-0003wV-2j; Mon, 30 Mar 2026 14:55:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1267758.1557211; Mon, 30 Mar 2026 14:55:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7E1c-0003wN-WB; Mon, 30 Mar 2026 14:55:32 +0000
Received: by outflank-mailman (input) for mailman id 1267758;
 Mon, 30 Mar 2026 14:55:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w7E1c-0003wB-D8
 for xen-changelog@lists.xenproject.org; Mon, 30 Mar 2026 14:55:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7E1c-00HKZF-1t
 for xen-changelog@lists.xenproject.org;
 Mon, 30 Mar 2026 14:55:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7E1c-00AUuk-13
 for xen-changelog@lists.xenproject.org;
 Mon, 30 Mar 2026 14:55:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=4rL47LzvRVb+7PPr46KMWsuI5UA5AEtCwcF6Wac95/k=; b=Vzcj2vuLWcPhtVm9nnJjMm3r9Y
	qRFcGS5Do7m+hbpIlwtLJ4iV4Y3KBmoM45AE6TI7EFTKYaAt18Z2GFjzeoqDQlx5oWLomIbuSLBPT
	lzqPTXpQJ+oC0yFfeItflYa7scUn6paGZLJRiNpsnGg5yoG/6lZmaxNhA9HpiaMe1rn4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/mm: don't unconditionally clear PGC_need_scrub in alloc_heap_pages()
Message-Id: <E1w7E1c-00AUuk-13@xenbits.xenproject.org>
Date: Mon, 30 Mar 2026 14:55:32 +0000

commit 009401506e3d6e40f1f22630af7a4a75ee03f7c1
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Tue Mar 24 14:26:47 2026 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Mon Mar 30 16:43:14 2026 +0200

    xen/mm: don't unconditionally clear PGC_need_scrub in alloc_heap_pages()
    
    alloc_heap_pages() will unconditionally clear PGC_need_scrub, even when
    MEMF_no_scrub is requested.  This is kind of expected as otherwise some
    callers will assert on seeing non-expected flags set on the count_info
    field.
    
    Introduce a new MEMF bit to signal to alloc_heap_pages() that non-scrubbed
    pages should keep the PGC_need_scrub bit set. This fixes returning dirty
    pages from alloc_domheap_pages() without the PGC_need_scrub bit set for
    populate_physmap() to consume.
    
    With the above change alloc_domheap_pages() needs an adjustment to cope
    with allocated pages possibly having the PGC_need_scrub set.
    
    Fixes: 83a784a15b47 ("xen/mm: allow deferred scrub of physmap populate allocated pages")
    Reported-by: Ayden Bottos <aydenbottos12@gmail.com>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/common/memory.c     |  3 ++-
 xen/common/page_alloc.c | 31 ++++++++++++++++++++++---------
 xen/include/xen/mm.h    |  3 +++
 3 files changed, 27 insertions(+), 10 deletions(-)

diff --git a/xen/common/memory.c b/xen/common/memory.c
index 918510f287..f0ff131188 100644
--- a/xen/common/memory.c
+++ b/xen/common/memory.c
@@ -345,7 +345,8 @@ static void populate_physmap(struct memop_args *a)
                 unsigned int scrub_start = 0;
                 unsigned int memflags =
                     a->memflags | (d->creation_finished ? 0
-                                                        : MEMF_no_scrub);
+                                                        : (MEMF_no_scrub |
+                                                           MEMF_keep_scrub));
                 nodeid_t node =
                     (a->memflags & MEMF_exact_node) ? MEMF_get_node(a->memflags)
                                                     : NUMA_NO_NODE;
diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
index 588b5b99cb..1316dfbd15 100644
--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -989,6 +989,8 @@ static struct page_info *alloc_heap_pages(
     ASSERT(zone_lo <= zone_hi);
     ASSERT(zone_hi < NR_ZONES);
 
+    ASSERT(!(memflags & MEMF_keep_scrub) || (memflags & MEMF_no_scrub));
+
     if ( unlikely(order > MAX_ORDER) )
         return NULL;
 
@@ -1110,17 +1112,26 @@ static struct page_info *alloc_heap_pages(
     {
         bool cold = d && d != current->domain;
 
-        for ( i = 0; i < (1U << order); i++ )
+        if ( !(memflags & MEMF_no_scrub) )
         {
-            if ( test_and_clear_bit(_PGC_need_scrub, &pg[i].count_info) )
+            for ( i = 0; i < (1U << order); i++ )
             {
-                if ( !(memflags & MEMF_no_scrub) )
+                if ( test_and_clear_bit(_PGC_need_scrub, &pg[i].count_info) )
+                {
                     scrub_one_page(&pg[i], cold);
-
-                dirty_cnt++;
+                    dirty_cnt++;
+                }
+                else
+                    check_one_page(&pg[i]);
             }
-            else if ( !(memflags & MEMF_no_scrub) )
-                check_one_page(&pg[i]);
+        }
+        else
+        {
+            for ( i = 0; i < (1U << order); i++ )
+                if ( (memflags & MEMF_keep_scrub)
+                     ? test_bit(_PGC_need_scrub, &pg[i].count_info)
+                     : test_and_clear_bit(_PGC_need_scrub, &pg[i].count_info) )
+                    dirty_cnt++;
         }
 
         if ( dirty_cnt )
@@ -2696,8 +2707,10 @@ struct page_info *alloc_domheap_pages(
 
             for ( i = 0; i < (1UL << order); i++ )
             {
-                ASSERT(!pg[i].count_info);
-                pg[i].count_info = PGC_extra;
+                ASSERT(!(pg[i].count_info &
+                         ~((memflags & MEMF_keep_scrub) ? PGC_need_scrub
+                                                        : 0UL)));
+                pg[i].count_info |= PGC_extra;
             }
         }
         if ( assign_page(pg, order, d, memflags) )
diff --git a/xen/include/xen/mm.h b/xen/include/xen/mm.h
index d80bfba6d3..5e786c874a 100644
--- a/xen/include/xen/mm.h
+++ b/xen/include/xen/mm.h
@@ -208,6 +208,9 @@ struct npfec {
 #define  MEMF_no_refcount (1U<<_MEMF_no_refcount)
 #define _MEMF_populate_on_demand 1
 #define  MEMF_populate_on_demand (1U<<_MEMF_populate_on_demand)
+/* MEMF_keep_scrub is only valid when specified together with MEMF_no_scrub. */
+#define _MEMF_keep_scrub  2
+#define  MEMF_keep_scrub  (1U << _MEMF_keep_scrub)
 #define _MEMF_no_dma      3
 #define  MEMF_no_dma      (1U<<_MEMF_no_dma)
 #define _MEMF_exact_node  4
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Mar 30 14:55:43 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 30 Mar 2026 14:55:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1267759.1557216 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7E1n-0003ym-4X; Mon, 30 Mar 2026 14:55:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1267759.1557216; Mon, 30 Mar 2026 14:55:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7E1n-0003yd-1K; Mon, 30 Mar 2026 14:55:43 +0000
Received: by outflank-mailman (input) for mailman id 1267759;
 Mon, 30 Mar 2026 14:55:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w7E1m-0003yX-G0
 for xen-changelog@lists.xenproject.org; Mon, 30 Mar 2026 14:55:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7E1m-00HKbw-2C
 for xen-changelog@lists.xenproject.org;
 Mon, 30 Mar 2026 14:55:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7E1m-00AUxg-1P
 for xen-changelog@lists.xenproject.org;
 Mon, 30 Mar 2026 14:55:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=JlwzJbE3+0ocvr2hmUQPxpqTkDtD8fkBeiPA6QH0IAI=; b=BBj8yoyjUOm/u8O77MWi8io6f1
	OrqgEQtoQ8JVOysYwhXcoDQ4k1hy1iTaL7FRU0lPOLRSnL5tw7h1b5PJF2G+FNzd3GD6rJuW+AQKR
	ZcphMiMD3w4JIT55MMUE4nLlVPULa1OMcN2zw5jS7Gte8NrATC+ToZPN1/dhALAuD8F8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/mm: do not assign pages to a domain until they are scrubbed
Message-Id: <E1w7E1m-00AUxg-1P@xenbits.xenproject.org>
Date: Mon, 30 Mar 2026 14:55:42 +0000

commit 36522685435ff7e5731310665929df158a017519
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Tue Mar 24 14:48:28 2026 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Mon Mar 30 16:43:14 2026 +0200

    xen/mm: do not assign pages to a domain until they are scrubbed
    
    Assigning pages to a domain make them the possible target of hypercalls
    like XENMEM_decrease_reservation ahead of such pages being scrubbed in
    populate_physmap() when the guest is running in PV mode.  This might allow
    pages to be freed ahead of being scrubbed for example, as a stubdomain
    already running could target them by guessing their MFNs.  It's also
    possible other action could set the page type ahead of scrubbing, which
    would be problematic.
    
    Prevent the pages pending scrub from being assigned to the domain, and only
    do the assign once the scrubbing has finished.  This has the disadvantage
    that the allocated pages will be removed from the free pool, but not yet
    accounted towards the domain consumed page quota.  However there can only
    be one stashed page in that state, and it's maximum size is bounded by the
    memop-max-order option.  This is not too different from the current logic,
    where assigning pages to a domain (and thus checking whether such domain
    doesn't overflow it's quota) is also done after the memory has been
    allocated and removed from the pool of free pages.
    
    Fixes: 83a784a15b47 ("xen/mm: allow deferred scrub of physmap populate allocated pages")
    Reported-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/common/memory.c     | 6 ++++++
 xen/common/page_alloc.c | 9 ++++++++-
 xen/include/xen/mm.h    | 7 ++++++-
 3 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/xen/common/memory.c b/xen/common/memory.c
index f0ff131188..1ad4b51c5b 100644
--- a/xen/common/memory.c
+++ b/xen/common/memory.c
@@ -388,6 +388,12 @@ static void populate_physmap(struct memop_args *a)
                             goto out;
                         }
                     }
+
+                    if ( assign_page(page, a->extent_order, d, memflags) )
+                    {
+                        free_domheap_pages(page, a->extent_order);
+                        goto out;
+                    }
                 }
 
                 if ( unlikely(a->memflags & MEMF_no_tlbflush) )
diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
index 1316dfbd15..b1edef8712 100644
--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -2713,7 +2713,14 @@ struct page_info *alloc_domheap_pages(
                 pg[i].count_info |= PGC_extra;
             }
         }
-        if ( assign_page(pg, order, d, memflags) )
+        /*
+         * Don't add pages with the PGC_need_scrub bit set to the domain, the
+         * caller must clean the bit and then manually call assign_pages().
+         * Otherwise pages still subject to scrubbing would be reachable using
+         * get_page().
+         */
+        if ( !(memflags & MEMF_keep_scrub) &&
+             assign_page(pg, order, d, memflags) )
         {
             free_heap_pages(pg, order, memflags & MEMF_no_scrub);
             return NULL;
diff --git a/xen/include/xen/mm.h b/xen/include/xen/mm.h
index 5e786c874a..b80bec00c1 100644
--- a/xen/include/xen/mm.h
+++ b/xen/include/xen/mm.h
@@ -208,7 +208,12 @@ struct npfec {
 #define  MEMF_no_refcount (1U<<_MEMF_no_refcount)
 #define _MEMF_populate_on_demand 1
 #define  MEMF_populate_on_demand (1U<<_MEMF_populate_on_demand)
-/* MEMF_keep_scrub is only valid when specified together with MEMF_no_scrub. */
+/*
+ * MEMF_keep_scrub is only valid when specified together with MEMF_no_scrub.
+ * Allocations with this flag never assign the pages to the domain, the caller
+ * must call assign_page() after the PGC_need_scrub bit is cleared if
+ * required.
+ */
 #define _MEMF_keep_scrub  2
 #define  MEMF_keep_scrub  (1U << _MEMF_keep_scrub)
 #define _MEMF_no_dma      3
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Mar 30 14:55:53 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 30 Mar 2026 14:55:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1267760.1557218 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7E1x-00040q-59; Mon, 30 Mar 2026 14:55:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1267760.1557218; Mon, 30 Mar 2026 14:55:53 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7E1x-00040j-2h; Mon, 30 Mar 2026 14:55:53 +0000
Received: by outflank-mailman (input) for mailman id 1267760;
 Mon, 30 Mar 2026 14:55:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w7E1w-00040d-J5
 for xen-changelog@lists.xenproject.org; Mon, 30 Mar 2026 14:55:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7E1w-00HKc2-2V
 for xen-changelog@lists.xenproject.org;
 Mon, 30 Mar 2026 14:55:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7E1w-00AUyv-1h
 for xen-changelog@lists.xenproject.org;
 Mon, 30 Mar 2026 14:55:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Y+sS5uYk3isHyyxxCc88QkIMIB8/saykXK1bwOXWBwM=; b=zu0LCRFpQ3UPVtrPJY+9ToQTgw
	UmNP1wq9NZYePun4TLm9ykrMCzmRk5vAcGgIq4YQoJFdEwlNPc/aoS4DnxePx12DVhdbcMXHTd11b
	ipvAbDuUK2C/AqjEwbzZZkaO/YJGD0IswgGQAKbwL4sA+X2KiJez0yJ0tD4GhWtt9m8g=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/hvm: Configuration for Linear Address Space Separation
Message-Id: <E1w7E1w-00AUyv-1h@xenbits.xenproject.org>
Date: Mon, 30 Mar 2026 14:55:52 +0000

commit 4c607bbb1e6c9a88aece17a1778e2fd7b9af6bbd
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Mar 26 13:18:15 2026 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Mar 30 15:48:13 2026 +0100

    x86/hvm: Configuration for Linear Address Space Separation
    
    LASS is a feature designed in the aftermath of Meltdown, which codifies the
    user/kernel split in address space in order to block entire classes of
    sidechanels.  Specifically, it allows the CPU to terminate any memory access
    into the wrong half of the address space based on linear address alone and
    without needing a pagewalk.
    
    It is available in CPUs starting with Intel Sierra Forrest (2023).
    
    For now, allow LASS to be opted in to, but leave it off by default.  Some work
    in the emulator is going to be needed to enable it by default.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/hvm.c                      | 1 +
 xen/arch/x86/include/asm/x86-defns.h        | 1 +
 xen/include/public/arch-x86/cpufeatureset.h | 2 +-
 3 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 4d37a93c57..b62b058861 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -1019,6 +1019,7 @@ unsigned long hvm_cr4_guest_valid_bits(const struct domain *d)
             (p->feat.pku      ? X86_CR4_PKE               : 0) |
             (cet              ? X86_CR4_CET               : 0) |
             (p->feat.pks      ? X86_CR4_PKS               : 0) |
+            (p->feat.lass     ? X86_CR4_LASS              : 0) |
             0);
 }
 
diff --git a/xen/arch/x86/include/asm/x86-defns.h b/xen/arch/x86/include/asm/x86-defns.h
index 6dae36ef81..cce0f4d990 100644
--- a/xen/arch/x86/include/asm/x86-defns.h
+++ b/xen/arch/x86/include/asm/x86-defns.h
@@ -82,6 +82,7 @@
 #define X86_CR4_PKE        0x00400000 /* enable PKE */
 #define X86_CR4_CET        0x00800000 /* Control-flow Enforcement Technology */
 #define X86_CR4_PKS        0x01000000 /* Protection Key Supervisor */
+#define X86_CR4_LASS       (_AC(1, ULL) << 27) /* Linear Address Space Separation */
 #define X86_CR4_FRED       (_AC(1, ULL) << 32) /* Flexible Return and Event Delivery */
 
 #define X86_CR8_VALID_MASK 0xf
diff --git a/xen/include/public/arch-x86/cpufeatureset.h b/xen/include/public/arch-x86/cpufeatureset.h
index 3bc4f5cad6..438acba4e2 100644
--- a/xen/include/public/arch-x86/cpufeatureset.h
+++ b/xen/include/public/arch-x86/cpufeatureset.h
@@ -304,7 +304,7 @@ XEN_CPUFEATURE(SM3,          10*32+ 1) /*A  SM3 Instructions */
 XEN_CPUFEATURE(SM4,          10*32+ 2) /*A  SM4 Instructions */
 XEN_CPUFEATURE(AVX_VNNI,     10*32+ 4) /*A  AVX-VNNI Instructions */
 XEN_CPUFEATURE(AVX512_BF16,  10*32+ 5) /*A  AVX512 BFloat16 Instructions */
-XEN_CPUFEATURE(LASS,         10*32+ 6) /*   Linear Address Space Separation */
+XEN_CPUFEATURE(LASS,         10*32+ 6) /*s  Linear Address Space Separation */
 XEN_CPUFEATURE(CMPCCXADD,    10*32+ 7) /*a  CMPccXADD Instructions */
 XEN_CPUFEATURE(ARCH_PERF_MON, 10*32+8) /*   Architectural Perfmon */
 XEN_CPUFEATURE(FZRM,         10*32+10) /*A  Fast Zero-length REP MOVSB */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Mar 30 14:56:03 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 30 Mar 2026 14:56:03 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1267761.1557223 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7E27-00043O-7y; Mon, 30 Mar 2026 14:56:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1267761.1557223; Mon, 30 Mar 2026 14:56:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7E27-00043G-5N; Mon, 30 Mar 2026 14:56:03 +0000
Received: by outflank-mailman (input) for mailman id 1267761;
 Mon, 30 Mar 2026 14:56:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w7E26-00043A-Lp
 for xen-changelog@lists.xenproject.org; Mon, 30 Mar 2026 14:56:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7E26-00HKcM-2l
 for xen-changelog@lists.xenproject.org;
 Mon, 30 Mar 2026 14:56:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7E26-00AV0O-1z
 for xen-changelog@lists.xenproject.org;
 Mon, 30 Mar 2026 14:56:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=TGlsixgJy5xGg7509fxK7CoGlMKqogj9Z5hk26pjTo8=; b=KfQr1t5Q3ABnKJ5fH1nAkzLd6A
	9ZktcVThkCCB5sYVrkH6lk9MQ1TgQFPwugIb7yNzUm+wApXwinJYdYKVecPtwLwUZXKDgzwBSFXdn
	i+P4LkROVSCNhVSxTSY4plxgyarW7Fsy5ODSWD0muTJcDAp46p8SC3hdcsKlJORaB+KY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] docs/hypfs: Adjust the hypfs layout example
Message-Id: <E1w7E26-00AV0O-1z@xenbits.xenproject.org>
Date: Mon, 30 Mar 2026 14:56:02 +0000

commit d9fcdb0c7a83eb15a238af3c26f5e9960c90d18f
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Mar 26 19:04:28 2026 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Mar 30 15:48:13 2026 +0100

    docs/hypfs: Adjust the hypfs layout example
    
    The controls for cpu-bugs were ultimately not taken.  As the paths are
    documented fully below, pick only a small subset for the example.  Include
    cpupool/ as it exists now.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
---
 docs/misc/hypfs-paths.pandoc | 37 +++++++------------------------------
 1 file changed, 7 insertions(+), 30 deletions(-)

diff --git a/docs/misc/hypfs-paths.pandoc b/docs/misc/hypfs-paths.pandoc
index e86f7d0dbe..dd089d90df 100644
--- a/docs/misc/hypfs-paths.pandoc
+++ b/docs/misc/hypfs-paths.pandoc
@@ -89,36 +89,13 @@ the hypervisors, and in different configurations.  Specifically:
 A populated Xen hypervisor file system might look like the following example:
 
     /
-        buildinfo/           directory containing build-time data
-            config           contents of .config file used to build Xen
-        cpu-bugs/            x86: directory of cpu bug information
-            l1tf             "Vulnerable" or "Not vulnerable"
-            mds              "Vulnerable" or "Not vulnerable"
-            meltdown         "Vulnerable" or "Not vulnerable"
-            spec-store-bypass "Vulnerable" or "Not vulnerable"
-            spectre-v1       "Vulnerable" or "Not vulnerable"
-            spectre-v2       "Vulnerable" or "Not vulnerable"
-            mitigations/     directory of mitigation settings
-                bti-thunk    "N/A", "RETPOLINE", "LFENCE" or "JMP"
-                spec-ctrl    "No", "IBRS+" or "IBRS-"
-                ibpb         "No" or "Yes"
-                l1d-flush    "No" or "Yes"
-                md-clear     "No" or "VERW"
-                l1tf-barrier "No" or "Yes"
-            active-hvm/      directory for mitigations active in hvm doamins
-                msr-spec-ctrl "No" or "Yes"
-                rsb          "No" or "Yes"
-                eager-fpu    "No" or "Yes"
-                md-clear     "No" or "Yes"
-            active-pv/       directory for mitigations active in pv doamins
-                msr-spec-ctrl "No" or "Yes"
-                rsb          "No" or "Yes"
-                eager-fpu    "No" or "Yes"
-                md-clear     "No" or "Yes"
-                xpti         "No" or list of "dom0", "domU", "PCID-on"
-                l1tf-shadow  "No" or list of "dom0", "domU"
-        params/              directory with hypervisor parameter values
-                             (boot/runtime parameters)
+      buildinfo/             directory containing build-time data
+        config               contents of .config file used to build Xen
+      cpupool/               directory containing CPU Pool data
+        0/                   directory for cpupool 0
+          sched-gran         "cpu", "core" or "socket"
+      params/                directory with hypervisor parameter values
+        loglvl               "none", "error", "warning", "info", "all"
 
 ## General Paths
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Mar 30 14:56:13 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 30 Mar 2026 14:56:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1267762.1557227 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7E2H-00046G-9M; Mon, 30 Mar 2026 14:56:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1267762.1557227; Mon, 30 Mar 2026 14:56:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7E2H-000468-6n; Mon, 30 Mar 2026 14:56:13 +0000
Received: by outflank-mailman (input) for mailman id 1267762;
 Mon, 30 Mar 2026 14:56:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w7E2G-000461-Oj
 for xen-changelog@lists.xenproject.org; Mon, 30 Mar 2026 14:56:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7E2G-00HKcW-32
 for xen-changelog@lists.xenproject.org;
 Mon, 30 Mar 2026 14:56:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7E2G-00AV3K-2G
 for xen-changelog@lists.xenproject.org;
 Mon, 30 Mar 2026 14:56:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=OQYN+RTkImsCm/4iVgx0pFSlqdzDXQ+8sA4k1k3e3E0=; b=Sp1Nzk3yCELj57pRGGx8RTPhbc
	Ng7EVLNkrZU5ohy7d1+c9j9cnfydXjrdcnhFwviGLo1th0TCOG0R1haGUMJOHQKVC7a2L5zjozTeW
	/3yMsGsK1BECLd1fTx6mGDSTYxyM8BcIS5xsKrDEvg0gYMH//X6cfoQhwIGuaLJ8IDiQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/fpu: Initialise FTW in xstate_alloc_save_area()
Message-Id: <E1w7E2G-00AV3K-2G@xenbits.xenproject.org>
Date: Mon, 30 Mar 2026 14:56:12 +0000

commit 639de2aafa437fd50abc16a46c8a8dd0d0e9e6a7
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Mar 27 17:16:36 2026 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Mar 30 15:48:13 2026 +0100

    x86/fpu: Initialise FTW in xstate_alloc_save_area()
    
    Right now, xstate_alloc_save_area() leaves both XSTATE_BV and FTW clear.  This
    causes a difference in behaviour between FXRSTOR and XRSTOR.
    
    Switch to using using XSTATE's idea of initial configuration which will behave
    the same even on pre-XSAVE hardware.  Expand the comment to explain why.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/xstate.c | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/xstate.c b/xen/arch/x86/xstate.c
index e990abc9d1..defe9b3f0c 100644
--- a/xen/arch/x86/xstate.c
+++ b/xen/arch/x86/xstate.c
@@ -550,11 +550,22 @@ int xstate_alloc_save_area(struct vcpu *v)
         return -ENOMEM;
 
     /*
-     * Set the memory image to default values, but don't force the context
-     * to be loaded from memory (i.e. keep save_area->xsave_hdr.xstate_bv
-     * clear).
+     * We're creating a vCPU, so conceptually we should be choosing the
+     * architectural #RESET values.
+     *
+     * However for historical reasons of configuring the external
+     * co-processor, FCW's #RESET state is different to what F(N)INIT and
+     * XSTATE consider the "initial configuration".
+     *
+     * Guests won't care about the difference; all software tends to executes
+     * FNINIT very early during setup.
+     *
+     * Use XSTATE's idea of initial configuration.  This allows XSTATE_BV to
+     * remain clear and for CPUs to use the INIT optimisation where
+     * applicable.
      */
     save_area->fpu_sse.fcw = FCW_DEFAULT;
+    save_area->fpu_sse.ftw = FXSAVE_FTW_RESET;
     save_area->fpu_sse.mxcsr = MXCSR_DEFAULT;
 
     v->arch.xsave_area = save_area;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Mar 30 14:56:23 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 30 Mar 2026 14:56:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1267763.1557230 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7E2R-00048k-Ag; Mon, 30 Mar 2026 14:56:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1267763.1557230; Mon, 30 Mar 2026 14:56:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7E2R-00048c-88; Mon, 30 Mar 2026 14:56:23 +0000
Received: by outflank-mailman (input) for mailman id 1267763;
 Mon, 30 Mar 2026 14:56:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w7E2Q-00048W-Ri
 for xen-changelog@lists.xenproject.org; Mon, 30 Mar 2026 14:56:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7E2R-00HKca-08
 for xen-changelog@lists.xenproject.org;
 Mon, 30 Mar 2026 14:56:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7E2Q-00AV6s-2Y
 for xen-changelog@lists.xenproject.org;
 Mon, 30 Mar 2026 14:56:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=KnURemzCP9YDeCVB3TUpLMdFuidXKHzjrD79+wbq5Bg=; b=biiO5O6Hz5RKmdfcBqF1BlqMxb
	7OW6wj7/2nd83YjiuvjwZzS4zeJ7NPUEPIvnLsp+tfQHYj0AFEDlUdRUXSeLF0w3wHWAH5D1Bv8W7
	nmbcIXPDYC0cksupAKjvmbmp20903TAQceB7aIcKfGfTu2qJ2kGrlz5dfaY3bANkyGpQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86: Always use eager-fpu
Message-Id: <E1w7E2Q-00AV6s-2Y@xenbits.xenproject.org>
Date: Mon, 30 Mar 2026 14:56:22 +0000

commit 70a6abd2cd17f11b8de29ca5782233e430e97d9a
Author:     Ross Lagerwall <ross.lagerwall@citrix.com>
AuthorDate: Tue Mar 24 18:19:30 2026 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Mar 30 15:48:13 2026 +0100

    x86: Always use eager-fpu
    
    Lazy FPU avoids some work during a context switch but pushes more
    expensive costs elsewhere:
    
    * For a workload running some Windows VMs, I measured about 83% of
      context switches out had used the FPU so most of the time the FPU
      save/restore is not avoided, just delayed.
    * A key difference between 32-bit and 64-bit OSes is that %xmm is in the
      base featureset for 64-bit and thus gets ubiquitous use in userspace.
      This is likely why we hit 83%.
    * Setting/clearing the cr0.TS bit is serializing and reportedly slower
      than the processor optimized xsave/restore.
    * Linux uses PKRU so a partial xsave/restore is performed on each
      context switch anyway, followed by a second xsave/restore at some
      point during execution. This interferes with the 'modified'
      optimisation that hardware uses to try and reduce the cost of the
      following XSAVE.
    
    There is no measurable performance benefit for using lazy FPU and it
    adds unwanted complexity so remove the option and always use eager-fpu.
    
    Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 docs/misc/xen-command-line.pandoc    |  7 +--
 xen/arch/x86/i387.c                  |  2 +-
 xen/arch/x86/include/asm/spec_ctrl.h |  1 -
 xen/arch/x86/spec_ctrl.c             | 88 ++----------------------------------
 4 files changed, 6 insertions(+), 92 deletions(-)

diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index ebdca007d2..6c77129732 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -2470,7 +2470,7 @@ By default SSBD will be mitigated at runtime (i.e `ssbd=runtime`).
 >              {msr-sc,rsb,verw,{ibpb,bhb}-entry}=<bool>|{pv,hvm}=<bool>,
 >              bti-thunk=retpoline|lfence|jmp,bhb-seq=short|tsx|long,
 >              {ibrs,ibpb,ssbd,psfd,
->              eager-fpu,l1d-flush,branch-harden,srb-lock,
+>              l1d-flush,branch-harden,srb-lock,
 >              unpriv-mmio,gds-mit,div-scrub,lock-harden,
 >              bhi-dis-s,bp-spec-reduce,ibpb-alt}=<bool> ]`
 
@@ -2574,11 +2574,6 @@ On hardware supporting IBPB (Indirect Branch Prediction Barrier), the `ibpb=`
 option can be used to force (the default) or prevent Xen from issuing branch
 prediction barriers on vcpu context switches.
 
-On all hardware, the `eager-fpu=` option can be used to force or prevent Xen
-from using fully eager FPU context switches.  This is currently implemented as
-a global control.  By default, Xen will choose to use fully eager context
-switches on hardware believed to speculate past #NM exceptions.
-
 On hardware supporting L1D_FLUSH, the `l1d-flush=` option can be used to force
 or prevent Xen from issuing an L1 data cache flush on each VMEntry.
 Irrespective of Xen's setting, the feature is virtualised for HVM guests to
diff --git a/xen/arch/x86/i387.c b/xen/arch/x86/i387.c
index b84cd6f7a9..954ba3b179 100644
--- a/xen/arch/x86/i387.c
+++ b/xen/arch/x86/i387.c
@@ -297,7 +297,7 @@ void save_fpu_enable(void)
 /* Initialize FPU's context save area */
 int vcpu_init_fpu(struct vcpu *v)
 {
-    v->arch.fully_eager_fpu = opt_eager_fpu;
+    v->arch.fully_eager_fpu = true;
 
     return xstate_alloc_save_area(v);
 }
diff --git a/xen/arch/x86/include/asm/spec_ctrl.h b/xen/arch/x86/include/asm/spec_ctrl.h
index 505e3ab863..8f82533c41 100644
--- a/xen/arch/x86/include/asm/spec_ctrl.h
+++ b/xen/arch/x86/include/asm/spec_ctrl.h
@@ -79,7 +79,6 @@ static always_inline void spec_ctrl_new_guest_context(void)
 extern int8_t opt_ibpb_ctxt_switch;
 extern bool opt_ssbd;
 extern int8_t opt_bhi_dis_s;
-extern int8_t opt_eager_fpu;
 extern int8_t opt_l1d_flush;
 
 extern bool bsp_delay_spec_ctrl;
diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c
index dd0413e1fc..bc8538a56f 100644
--- a/xen/arch/x86/spec_ctrl.c
+++ b/xen/arch/x86/spec_ctrl.c
@@ -61,7 +61,6 @@ static int8_t __initdata opt_psfd = -1;
 int8_t __ro_after_init opt_bhi_dis_s = -1;
 
 int8_t __ro_after_init opt_ibpb_ctxt_switch = -1;
-int8_t __ro_after_init opt_eager_fpu = -1;
 int8_t __ro_after_init opt_l1d_flush = -1;
 static bool __initdata opt_branch_harden =
     IS_ENABLED(CONFIG_SPECULATIVE_HARDEN_BRANCH);
@@ -104,8 +103,6 @@ static int __init cf_check parse_spec_ctrl(const char *s)
             opt_msr_sc_pv = false;
             opt_msr_sc_hvm = false;
 
-            opt_eager_fpu = 0;
-
             if ( opt_xpti_hwdom < 0 )
                 opt_xpti_hwdom = 0;
             if ( opt_xpti_domu < 0 )
@@ -336,8 +333,6 @@ static int __init cf_check parse_spec_ctrl(const char *s)
         /* Misc settings. */
         else if ( (val = parse_boolean("ibpb", s, ss)) >= 0 )
             opt_ibpb_ctxt_switch = val;
-        else if ( (val = parse_boolean("eager-fpu", s, ss)) >= 0 )
-            opt_eager_fpu = val;
         else if ( (val = parse_boolean("l1d-flush", s, ss)) >= 0 )
             opt_l1d_flush = val;
         else if ( (val = parse_boolean("branch-harden", s, ss)) >= 0 )
@@ -648,32 +643,30 @@ static void __init print_details(enum ind_thunk thunk)
      * mitigation support for guests.
      */
 #ifdef CONFIG_HVM
-    printk("  Support for HVM VMs:%s%s%s%s%s%s%s%s\n",
+    printk("  Support for HVM VMs:%s%s%s%s%s%s%s\n",
            (boot_cpu_has(X86_FEATURE_SC_MSR_HVM) ||
             boot_cpu_has(X86_FEATURE_SC_RSB_HVM) ||
             boot_cpu_has(X86_FEATURE_IBPB_ENTRY_HVM) ||
             opt_bhb_entry_hvm || amd_virt_spec_ctrl ||
-            opt_eager_fpu || opt_verw_hvm)           ? ""               : " None",
+            opt_verw_hvm)                            ? ""               : " None",
            boot_cpu_has(X86_FEATURE_SC_MSR_HVM)      ? " MSR_SPEC_CTRL" : "",
            (boot_cpu_has(X86_FEATURE_SC_MSR_HVM) ||
             amd_virt_spec_ctrl)                      ? " MSR_VIRT_SPEC_CTRL" : "",
            boot_cpu_has(X86_FEATURE_SC_RSB_HVM)      ? " RSB"           : "",
-           opt_eager_fpu                             ? " EAGER_FPU"     : "",
            opt_verw_hvm                              ? " VERW"          : "",
            boot_cpu_has(X86_FEATURE_IBPB_ENTRY_HVM)  ? " IBPB-entry"    : "",
            opt_bhb_entry_hvm                         ? " BHB-entry"     : "");
 
 #endif
 #ifdef CONFIG_PV
-    printk("  Support for PV VMs:%s%s%s%s%s%s%s\n",
+    printk("  Support for PV VMs:%s%s%s%s%s%s\n",
            (boot_cpu_has(X86_FEATURE_SC_MSR_PV) ||
             boot_cpu_has(X86_FEATURE_SC_RSB_PV) ||
             boot_cpu_has(X86_FEATURE_IBPB_ENTRY_PV) ||
             opt_bhb_entry_pv ||
-            opt_eager_fpu || opt_verw_pv)            ? ""               : " None",
+            opt_verw_pv)                             ? ""               : " None",
            boot_cpu_has(X86_FEATURE_SC_MSR_PV)       ? " MSR_SPEC_CTRL" : "",
            boot_cpu_has(X86_FEATURE_SC_RSB_PV)       ? " RSB"           : "",
-           opt_eager_fpu                             ? " EAGER_FPU"     : "",
            opt_verw_pv                               ? " VERW"          : "",
            boot_cpu_has(X86_FEATURE_IBPB_ENTRY_PV)   ? " IBPB-entry"    : "",
            opt_bhb_entry_pv                          ? " BHB-entry"     : "");
@@ -959,75 +952,6 @@ static bool __init rsb_is_full_width(void)
     return true;
 }
 
-/* Calculate whether this CPU speculates past #NM */
-static bool __init should_use_eager_fpu(void)
-{
-    /*
-     * Assume all unrecognised processors are ok.  This is only known to
-     * affect Intel Family 6 processors.
-     */
-    if ( boot_cpu_data.vendor != X86_VENDOR_INTEL ||
-         boot_cpu_data.family != 6 )
-        return false;
-
-    switch ( boot_cpu_data.model )
-    {
-        /*
-         * Core processors since at least Nehalem are vulnerable.
-         */
-    case 0x1e: /* Nehalem */
-    case 0x1f: /* Auburndale / Havendale */
-    case 0x1a: /* Nehalem EP */
-    case 0x2e: /* Nehalem EX */
-    case 0x25: /* Westmere */
-    case 0x2c: /* Westmere EP */
-    case 0x2f: /* Westmere EX */
-    case 0x2a: /* SandyBridge */
-    case 0x2d: /* SandyBridge EP/EX */
-    case 0x3a: /* IvyBridge */
-    case 0x3e: /* IvyBridge EP/EX */
-    case 0x3c: /* Haswell */
-    case 0x3f: /* Haswell EX/EP */
-    case 0x45: /* Haswell D */
-    case 0x46: /* Haswell H */
-    case 0x3d: /* Broadwell */
-    case 0x47: /* Broadwell H */
-    case 0x4f: /* Broadwell EP/EX */
-    case 0x56: /* Broadwell D */
-    case 0x4e: /* Skylake M */
-    case 0x55: /* Skylake X */
-    case 0x5e: /* Skylake D */
-    case 0x66: /* Cannonlake */
-    case 0x67: /* Cannonlake? */
-    case 0x8e: /* Kabylake M */
-    case 0x9e: /* Kabylake D */
-        return true;
-
-        /*
-         * Atom processors are not vulnerable.
-         */
-    case 0x1c: /* Pineview */
-    case 0x26: /* Lincroft */
-    case 0x27: /* Penwell */
-    case 0x35: /* Cloverview */
-    case 0x36: /* Cedarview */
-    case 0x37: /* Baytrail / Valleyview (Silvermont) */
-    case 0x4d: /* Avaton / Rangely (Silvermont) */
-    case 0x4c: /* Cherrytrail / Brasswell */
-    case 0x4a: /* Merrifield */
-    case 0x5a: /* Moorefield */
-    case 0x5c: /* Goldmont */
-    case 0x5f: /* Denverton */
-    case 0x7a: /* Gemini Lake */
-        return false;
-
-    default:
-        printk("Unrecognised CPU model %#x - assuming vulnerable to LazyFPU\n",
-               boot_cpu_data.model);
-        return true;
-    }
-}
-
 /*
  * https://www.amd.com/content/dam/amd/en/documents/corporate/cr/speculative-return-stack-overflow-whitepaper.pdf
  */
@@ -2221,10 +2145,6 @@ void __init init_speculation_mitigations(void)
 
     div_calculations(hw_smt_enabled);
 
-    /* Check whether Eager FPU should be enabled by default. */
-    if ( opt_eager_fpu == -1 )
-        opt_eager_fpu = should_use_eager_fpu();
-
     /* (Re)init BSP state now that default_scf has been calculated. */
     init_shadow_spec_ctrl_state(get_cpu_info());
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Mar 30 14:56:34 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 30 Mar 2026 14:56:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1267764.1557234 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7E2c-0004An-CC; Mon, 30 Mar 2026 14:56:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1267764.1557234; Mon, 30 Mar 2026 14:56:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7E2c-0004Af-9e; Mon, 30 Mar 2026 14:56:34 +0000
Received: by outflank-mailman (input) for mailman id 1267764;
 Mon, 30 Mar 2026 14:56:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w7E2a-0004AY-Up
 for xen-changelog@lists.xenproject.org; Mon, 30 Mar 2026 14:56:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7E2b-00HKcj-0R
 for xen-changelog@lists.xenproject.org;
 Mon, 30 Mar 2026 14:56:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7E2a-00AV88-2t
 for xen-changelog@lists.xenproject.org;
 Mon, 30 Mar 2026 14:56:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=f40VDoUFEa9HMMlhnt9NXoLAS8zS2+DgTQsAWCMecAI=; b=0k4FfUSnD4ZMCIgeR+JESo/D1r
	BiqXQuq5/xMFDf5hLHhQoTsmFjGnoDjF7U0RzhwojczGonjr0nrCcN56OWgz+H3qqCMK+/QcbNiSd
	fcGmmcXwsscbCscwR10ZPVUlPcxG1UYg0iLpxmNXf214IJOPqEJ+f3CGs6lnELEOnSt0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/vmx: Remove lazy FPU support
Message-Id: <E1w7E2a-00AV88-2t@xenbits.xenproject.org>
Date: Mon, 30 Mar 2026 14:56:32 +0000

commit 511ab162efe42bd914f698cbbfe938b4576627e5
Author:     Ross Lagerwall <ross.lagerwall@citrix.com>
AuthorDate: Tue Mar 24 18:19:31 2026 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Mar 30 15:48:13 2026 +0100

    x86/vmx: Remove lazy FPU support
    
    Remove lazy FPU support from the VMX code since fully_eager_fpu is now
    always true.
    
    No functional change intended.
    
    Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/hvm/vmx/vmcs.c             |  8 +---
 xen/arch/x86/hvm/vmx/vmx.c              | 70 +--------------------------------
 xen/arch/x86/hvm/vmx/vvmx.c             | 15 +------
 xen/arch/x86/include/asm/hvm/vmx/vmcs.h |  2 -
 4 files changed, 5 insertions(+), 90 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c
index c2e7f9aed3..8e52ef4d49 100644
--- a/xen/arch/x86/hvm/vmx/vmcs.c
+++ b/xen/arch/x86/hvm/vmx/vmcs.c
@@ -1247,10 +1247,7 @@ static int construct_vmcs(struct vcpu *v)
     __vmwrite(HOST_TR_SELECTOR, TSS_SELECTOR);
 
     /* Host control registers. */
-    v->arch.hvm.vmx.host_cr0 = read_cr0() & ~X86_CR0_TS;
-    if ( !v->arch.fully_eager_fpu )
-        v->arch.hvm.vmx.host_cr0 |= X86_CR0_TS;
-    __vmwrite(HOST_CR0, v->arch.hvm.vmx.host_cr0);
+    __vmwrite(HOST_CR0, read_cr0());
     __vmwrite(HOST_CR4, mmu_cr4_features);
     if ( cpu_has_vmx_efer )
         __vmwrite(HOST_EFER, read_efer());
@@ -1330,8 +1327,7 @@ static int construct_vmcs(struct vcpu *v)
     __vmwrite(VMCS_LINK_POINTER, ~0UL);
 
     v->arch.hvm.vmx.exception_bitmap = HVM_TRAP_MASK
-              | (paging_mode_hap(d) ? 0 : (1U << X86_EXC_PF))
-              | (v->arch.fully_eager_fpu ? 0 : (1U << X86_EXC_NM));
+              | (paging_mode_hap(d) ? 0 : (1U << X86_EXC_PF));
 
     if ( cpu_has_vmx_notify_vm_exiting )
         __vmwrite(NOTIFY_WINDOW, vm_notify_window);
diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index 82c55f49ae..03daf2f52b 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -68,7 +68,6 @@ static void cf_check vmx_update_guest_cr(
     struct vcpu *v, unsigned int cr, unsigned int flags);
 static void cf_check vmx_update_guest_efer(struct vcpu *v);
 static void cf_check vmx_wbinvd_intercept(void);
-static void cf_check vmx_fpu_dirty_intercept(void);
 static int cf_check vmx_msr_read_intercept(
     unsigned int msr, uint64_t *msr_content);
 static int cf_check vmx_msr_write_intercept(
@@ -1130,41 +1129,6 @@ static int cf_check vmx_load_vmcs_ctxt(struct vcpu *v, struct hvm_hw_cpu *ctxt)
     return 0;
 }
 
-static void vmx_fpu_enter(struct vcpu *v)
-{
-    vcpu_restore_fpu_lazy(v);
-    v->arch.hvm.vmx.exception_bitmap &= ~(1u << X86_EXC_NM);
-    vmx_update_exception_bitmap(v);
-    v->arch.hvm.vmx.host_cr0 &= ~X86_CR0_TS;
-    __vmwrite(HOST_CR0, v->arch.hvm.vmx.host_cr0);
-}
-
-static void cf_check vmx_fpu_leave(struct vcpu *v)
-{
-    ASSERT(!v->fpu_dirtied);
-    ASSERT(read_cr0() & X86_CR0_TS);
-
-    if ( !(v->arch.hvm.vmx.host_cr0 & X86_CR0_TS) )
-    {
-        v->arch.hvm.vmx.host_cr0 |= X86_CR0_TS;
-        __vmwrite(HOST_CR0, v->arch.hvm.vmx.host_cr0);
-    }
-
-    /*
-     * If the guest does not have TS enabled then we must cause and handle an
-     * exception on first use of the FPU. If the guest *does* have TS enabled
-     * then this is not necessary: no FPU activity can occur until the guest
-     * clears CR0.TS, and we will initialise the FPU when that happens.
-     */
-    if ( !(v->arch.hvm.guest_cr[0] & X86_CR0_TS) )
-    {
-        v->arch.hvm.hw_cr[0] |= X86_CR0_TS;
-        __vmwrite(GUEST_CR0, v->arch.hvm.hw_cr[0]);
-        v->arch.hvm.vmx.exception_bitmap |= (1u << X86_EXC_NM);
-        vmx_update_exception_bitmap(v);
-    }
-}
-
 static void cf_check vmx_ctxt_switch_from(struct vcpu *v)
 {
     /*
@@ -1187,8 +1151,6 @@ static void cf_check vmx_ctxt_switch_from(struct vcpu *v)
         vmx_vmcs_reload(v);
     }
 
-    if ( !v->arch.fully_eager_fpu )
-        vmx_fpu_leave(v);
     vmx_save_guest_msrs(v);
     vmx_restore_host_msrs();
     vmx_save_dr(v);
@@ -1771,17 +1733,6 @@ static void cf_check vmx_update_guest_cr(
         else
             nvmx_set_cr_read_shadow(v, 0);
 
-        if ( !(v->arch.hvm.guest_cr[0] & X86_CR0_TS) )
-        {
-            if ( v != current )
-            {
-                if ( !v->arch.fully_eager_fpu )
-                    hw_cr0_mask |= X86_CR0_TS;
-            }
-            else if ( v->arch.hvm.hw_cr[0] & X86_CR0_TS )
-                vmx_fpu_enter(v);
-        }
-
         realmode = !(v->arch.hvm.guest_cr[0] & X86_CR0_PE);
 
         if ( !vmx_unrestricted_guest(v) &&
@@ -2915,7 +2866,6 @@ static struct hvm_function_table __initdata_cf_clobber vmx_function_table = {
     .update_guest_cr      = vmx_update_guest_cr,
     .update_guest_efer    = vmx_update_guest_efer,
     .cpuid_policy_changed = vmx_cpuid_policy_changed,
-    .fpu_leave            = vmx_fpu_leave,
     .set_guest_pat        = vmx_set_guest_pat,
     .get_guest_pat        = vmx_get_guest_pat,
     .set_tsc_offset       = vmx_set_tsc_offset,
@@ -2927,7 +2877,6 @@ static struct hvm_function_table __initdata_cf_clobber vmx_function_table = {
     .cpu_up               = vmx_cpu_up,
     .cpu_down             = vmx_cpu_down,
     .wbinvd_intercept     = vmx_wbinvd_intercept,
-    .fpu_dirty_intercept  = vmx_fpu_dirty_intercept,
     .msr_read_intercept   = vmx_msr_read_intercept,
     .msr_write_intercept  = vmx_msr_write_intercept,
     .handle_cd            = vmx_handle_cd,
@@ -3281,20 +3230,6 @@ void update_guest_eip(void)
         hvm_inject_hw_exception(X86_EXC_DB, X86_EVENT_NO_EC);
 }
 
-static void cf_check vmx_fpu_dirty_intercept(void)
-{
-    struct vcpu *curr = current;
-
-    vmx_fpu_enter(curr);
-
-    /* Disable TS in guest CR0 unless the guest wants the exception too. */
-    if ( !(curr->arch.hvm.guest_cr[0] & X86_CR0_TS) )
-    {
-        curr->arch.hvm.hw_cr[0] &= ~X86_CR0_TS;
-        __vmwrite(GUEST_CR0, curr->arch.hvm.hw_cr[0]);
-    }
-}
-
 static void vmx_dr_access(unsigned long exit_qualification,
                           struct cpu_user_regs *regs)
 {
@@ -4543,10 +4478,7 @@ void asmlinkage vmx_vmexit_handler(struct cpu_user_regs *regs)
                 domain_pause_for_debugger();
             }
             break;
-        case X86_EXC_NM:
-            TRACE(TRC_HVM_TRAP, vector);
-            vmx_fpu_dirty_intercept();
-            break;
+
         case X86_EXC_PF:
             __vmread(EXIT_QUALIFICATION, &exit_qualification);
             __vmread(VM_EXIT_INTR_ERROR_CODE, &ecode);
diff --git a/xen/arch/x86/hvm/vmx/vvmx.c b/xen/arch/x86/hvm/vmx/vvmx.c
index 38952f0696..e4cdfe55c1 100644
--- a/xen/arch/x86/hvm/vmx/vvmx.c
+++ b/xen/arch/x86/hvm/vmx/vvmx.c
@@ -1238,9 +1238,6 @@ static void virtual_vmentry(struct cpu_user_regs *regs)
     regs->rsp = get_vvmcs(v, GUEST_RSP);
     regs->rflags = get_vvmcs(v, GUEST_RFLAGS);
 
-    /* updating host cr0 to sync TS bit */
-    __vmwrite(HOST_CR0, v->arch.hvm.vmx.host_cr0);
-
     /* Setup virtual ETP for L2 guest*/
     if ( nestedhvm_paging_mode_hap(v) )
         /* This will setup the initial np2m for the nested vCPU */
@@ -1468,9 +1465,6 @@ static void virtual_vmexit(struct cpu_user_regs *regs)
     /* VM exit clears all bits except bit 1 */
     regs->rflags = X86_EFLAGS_MBS;
 
-    /* updating host cr0 to sync TS bit */
-    __vmwrite(HOST_CR0, v->arch.hvm.vmx.host_cr0);
-
     if ( cpu_has_vmx_virtual_intr_delivery )
         nvmx_update_apicv(v);
 
@@ -2458,19 +2452,14 @@ int nvmx_n2_vmexit_handler(struct cpu_user_regs *regs,
         __vmread(VM_EXIT_INTR_INFO, &intr_info);
         vector = intr_info & INTR_INFO_VECTOR_MASK;
         /*
-         * decided by L0 and L1 exception bitmap, if the vetor is set by
-         * both, L0 has priority on #PF and #NM, L1 has priority on others
+         * decided by L0 and L1 exception bitmap, if the vector is set by
+         * both, L0 has priority on #PF, L1 has priority on others
          */
         if ( vector == X86_EXC_PF )
         {
             if ( paging_mode_hap(v->domain) )
                 nvcpu->nv_vmexit_pending = 1;
         }
-        else if ( vector == X86_EXC_NM )
-        {
-            if ( v->fpu_dirtied )
-                nvcpu->nv_vmexit_pending = 1;
-        }
         else if ( (intr_info & valid_mask) == valid_mask )
         {
             exec_bitmap = get_vvmcs(v, EXCEPTION_BITMAP);
diff --git a/xen/arch/x86/include/asm/hvm/vmx/vmcs.h b/xen/arch/x86/include/asm/hvm/vmx/vmcs.h
index 879ec10cef..88bded5190 100644
--- a/xen/arch/x86/include/asm/hvm/vmx/vmcs.h
+++ b/xen/arch/x86/include/asm/hvm/vmx/vmcs.h
@@ -149,8 +149,6 @@ struct vmx_vcpu {
     DECLARE_BITMAP(eoi_exit_bitmap, X86_IDT_VECTORS);
     struct pi_desc       pi_desc;
 
-    unsigned long        host_cr0;
-
     /* Do we need to tolerate a spurious EPT_MISCONFIG VM exit? */
     bool                 ept_spurious_misconfig;
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Mar 30 14:56:44 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 30 Mar 2026 14:56:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1267765.1557238 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7E2m-0004Da-Em; Mon, 30 Mar 2026 14:56:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1267765.1557238; Mon, 30 Mar 2026 14:56:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7E2m-0004DS-CH; Mon, 30 Mar 2026 14:56:44 +0000
Received: by outflank-mailman (input) for mailman id 1267765;
 Mon, 30 Mar 2026 14:56:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w7E2l-0004DK-28
 for xen-changelog@lists.xenproject.org; Mon, 30 Mar 2026 14:56:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7E2l-00HKd9-0n
 for xen-changelog@lists.xenproject.org;
 Mon, 30 Mar 2026 14:56:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7E2k-00AVB0-3C
 for xen-changelog@lists.xenproject.org;
 Mon, 30 Mar 2026 14:56:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=bbl0IxJMipxVErKU67lqkhJ70S59E4ylD2JxBKB+yA0=; b=V9JJmFCz7EQCG5mWn8JW2j8XyD
	e9lI/yIfuM9TtTAc0BKmsFijZqNoD3yAfu1AFGjXFqeoPpwSeCzmEXDP+j0aRHFd9HJpnVWA6Kk6B
	q9e/m1jXqtO3Mrl+WrwKxMV2Xe0KdD+M9kgEnPZh1sJHC+pHVPvfGC20LZycaToZXumo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/svm: Remove lazy FPU support
Message-Id: <E1w7E2k-00AVB0-3C@xenbits.xenproject.org>
Date: Mon, 30 Mar 2026 14:56:42 +0000

commit 3356d685dbdaf8f442c652fc216ecbc20bc7f6e3
Author:     Ross Lagerwall <ross.lagerwall@citrix.com>
AuthorDate: Tue Mar 24 18:19:32 2026 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Mar 30 15:48:13 2026 +0100

    x86/svm: Remove lazy FPU support
    
    Remove lazy FPU support from the SVM code since fully_eager_fpu is now
    always true.
    
    No functional change intended.
    
    Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/hvm/svm/nestedsvm.c         | 67 +-------------------------
 xen/arch/x86/hvm/svm/svm.c               | 81 +-------------------------------
 xen/arch/x86/hvm/svm/vmcb.c              |  4 +-
 xen/arch/x86/include/asm/hvm/svm-types.h |  6 ---
 4 files changed, 4 insertions(+), 154 deletions(-)

diff --git a/xen/arch/x86/hvm/svm/nestedsvm.c b/xen/arch/x86/hvm/svm/nestedsvm.c
index a63ec61346..ef6fa5d23b 100644
--- a/xen/arch/x86/hvm/svm/nestedsvm.c
+++ b/xen/arch/x86/hvm/svm/nestedsvm.c
@@ -165,58 +165,6 @@ int cf_check nsvm_vcpu_reset(struct vcpu *v)
     return 0;
 }
 
-static uint64_t nestedsvm_fpu_vmentry(uint64_t n1cr0,
-    struct vmcb_struct *vvmcb,
-    struct vmcb_struct *n1vmcb, struct vmcb_struct *n2vmcb)
-{
-    uint64_t vcr0;
-
-    vcr0 = vvmcb->_cr0;
-    if ( !(n1cr0 & X86_CR0_TS) && (n1vmcb->_cr0 & X86_CR0_TS) )
-    {
-        /*
-         * svm_fpu_leave() run while l1 guest was running.
-         * Sync FPU state with l2 guest.
-         */
-        vcr0 |= X86_CR0_TS;
-        n2vmcb->_exception_intercepts |= (1U << X86_EXC_NM);
-    }
-    else if ( !(vcr0 & X86_CR0_TS) && (n2vmcb->_cr0 & X86_CR0_TS) )
-    {
-        /*
-         * svm_fpu_enter() run while l1 guest was running.
-         * Sync FPU state with l2 guest.
-         */
-        vcr0 &= ~X86_CR0_TS;
-        n2vmcb->_exception_intercepts &= ~(1U << X86_EXC_NM);
-    }
-
-    return vcr0;
-}
-
-static void nestedsvm_fpu_vmexit(struct vmcb_struct *n1vmcb,
-    struct vmcb_struct *n2vmcb, uint64_t n1cr0, uint64_t guest_cr0)
-{
-    if ( !(guest_cr0 & X86_CR0_TS) && (n2vmcb->_cr0 & X86_CR0_TS) )
-    {
-        /*
-         * svm_fpu_leave() run while l2 guest was running.
-         * Sync FPU state with l1 guest.
-         */
-        n1vmcb->_cr0 |= X86_CR0_TS;
-        n1vmcb->_exception_intercepts |= (1U << X86_EXC_NM);
-    }
-    else if ( !(n1cr0 & X86_CR0_TS) && (n1vmcb->_cr0 & X86_CR0_TS) )
-    {
-        /*
-         * svm_fpu_enter() run while l2 guest was running.
-         * Sync FPU state with l1 guest.
-         */
-        n1vmcb->_cr0 &= ~X86_CR0_TS;
-        n1vmcb->_exception_intercepts &= ~(1U << X86_EXC_NM);
-    }
-}
-
 static int nsvm_vcpu_hostsave(struct vcpu *v, unsigned int inst_len)
 {
     struct nestedsvm *svm = &vcpu_nestedsvm(v);
@@ -246,7 +194,6 @@ static int nsvm_vcpu_hostsave(struct vcpu *v, unsigned int inst_len)
 static int nsvm_vcpu_hostrestore(struct vcpu *v, struct cpu_user_regs *regs)
 {
     struct nestedvcpu *nv = &vcpu_nestedhvm(v);
-    struct nestedsvm *svm = &vcpu_nestedsvm(v);
     struct vmcb_struct *n1vmcb, *n2vmcb;
     int rc;
 
@@ -281,8 +228,6 @@ static int nsvm_vcpu_hostrestore(struct vcpu *v, struct cpu_user_regs *regs)
         gdprintk(XENLOG_ERR, "hvm_set_cr4 failed, rc: %u\n", rc);
 
     /* CR0 */
-    nestedsvm_fpu_vmexit(n1vmcb, n2vmcb,
-        svm->ns_cr0, v->arch.hvm.guest_cr[0]);
     v->arch.hvm.guest_cr[0] = n1vmcb->_cr0 | X86_CR0_PE;
     n1vmcb->rflags &= ~X86_EFLAGS_VM;
     rc = hvm_set_cr0(n1vmcb->_cr0 | X86_CR0_PE, true);
@@ -290,7 +235,6 @@ static int nsvm_vcpu_hostrestore(struct vcpu *v, struct cpu_user_regs *regs)
         hvm_inject_hw_exception(X86_EXC_GP, 0);
     if ( rc != X86EMUL_OKAY )
         gdprintk(XENLOG_ERR, "hvm_set_cr0 failed, rc: %u\n", rc);
-    svm->ns_cr0 = v->arch.hvm.guest_cr[0];
 
     /* CR2 */
     v->arch.hvm.guest_cr[2] = n1vmcb->_cr2;
@@ -418,7 +362,6 @@ static int nsvm_vmcb_prepare4vmrun(struct vcpu *v, struct cpu_user_regs *regs)
     struct vmcb_struct *ns_vmcb, *n1vmcb, *n2vmcb;
     vmcbcleanbits_t clean = {};
     int rc;
-    uint64_t cr0;
 
     ns_vmcb = nv->nv_vvmcx;
     n1vmcb = nv->nv_n1vmcx;
@@ -452,7 +395,6 @@ static int nsvm_vmcb_prepare4vmrun(struct vcpu *v, struct cpu_user_regs *regs)
      *   safed here.
      * The overhead comes from (ordered from highest to lowest):
      * - svm_ctxt_switch_to (CPU context switching)
-     * - svm_fpu_enter, svm_fpu_leave (lazy FPU switching)
      * - emulated CLGI (clears VINTR intercept)
      * - host clears VINTR intercept
      * Test results show that the overhead is high enough that the
@@ -551,10 +493,8 @@ static int nsvm_vmcb_prepare4vmrun(struct vcpu *v, struct cpu_user_regs *regs)
         gdprintk(XENLOG_ERR, "hvm_set_cr4 failed, rc: %u\n", rc);
 
     /* CR0 */
-    svm->ns_cr0 = v->arch.hvm.guest_cr[0];
-    cr0 = nestedsvm_fpu_vmentry(svm->ns_cr0, ns_vmcb, n1vmcb, n2vmcb);
     v->arch.hvm.guest_cr[0] = ns_vmcb->_cr0;
-    rc = hvm_set_cr0(cr0, true);
+    rc = hvm_set_cr0(ns_vmcb->_cr0, true);
     if ( rc == X86EMUL_EXCEPTION )
         hvm_inject_hw_exception(X86_EXC_GP, 0);
     if ( rc != X86EMUL_OKAY )
@@ -1305,11 +1245,6 @@ nestedsvm_check_intercepts(struct vcpu *v, struct cpu_user_regs *regs,
     case VMEXIT_INTR:
     case VMEXIT_NMI:
         return NESTEDHVM_VMEXIT_HOST;
-    case VMEXIT_EXCEPTION_NM:
-        /* Host must handle lazy fpu context switching first.
-         * Then inject the VMEXIT if L1 guest intercepts this.
-         */
-        return NESTEDHVM_VMEXIT_HOST;
 
     case VMEXIT_NPF:
         if ( nestedhvm_paging_mode_hap(v) )
diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
index 243c41fb13..2546705d24 100644
--- a/xen/arch/x86/hvm/svm/svm.c
+++ b/xen/arch/x86/hvm/svm/svm.c
@@ -104,38 +104,6 @@ static void cf_check svm_cpu_down(void)
     write_efer(read_efer() & ~EFER_SVME);
 }
 
-static void svm_fpu_enter(struct vcpu *v)
-{
-    struct vmcb_struct *n1vmcb = vcpu_nestedhvm(v).nv_n1vmcx;
-
-    vcpu_restore_fpu_lazy(v);
-    vmcb_set_exception_intercepts(
-        n1vmcb,
-        vmcb_get_exception_intercepts(n1vmcb) & ~(1U << X86_EXC_NM));
-}
-
-static void cf_check svm_fpu_leave(struct vcpu *v)
-{
-    struct vmcb_struct *n1vmcb = vcpu_nestedhvm(v).nv_n1vmcx;
-
-    ASSERT(!v->fpu_dirtied);
-    ASSERT(read_cr0() & X86_CR0_TS);
-
-    /*
-     * If the guest does not have TS enabled then we must cause and handle an
-     * exception on first use of the FPU. If the guest *does* have TS enabled
-     * then this is not necessary: no FPU activity can occur until the guest
-     * clears CR0.TS, and we will initialise the FPU when that happens.
-     */
-    if ( !(v->arch.hvm.guest_cr[0] & X86_CR0_TS) )
-    {
-        vmcb_set_exception_intercepts(
-            n1vmcb,
-            vmcb_get_exception_intercepts(n1vmcb) | (1U << X86_EXC_NM));
-        vmcb_set_cr0(n1vmcb, vmcb_get_cr0(n1vmcb) | X86_CR0_TS);
-    }
-}
-
 static void cf_check svm_update_guest_cr(
     struct vcpu *v, unsigned int cr, unsigned int flags)
 {
@@ -145,20 +113,6 @@ static void cf_check svm_update_guest_cr(
     switch ( cr )
     {
     case 0:
-    {
-        unsigned long hw_cr0_mask = 0;
-
-        if ( !(v->arch.hvm.guest_cr[0] & X86_CR0_TS) )
-        {
-            if ( v != current )
-            {
-                if ( !v->arch.fully_eager_fpu )
-                    hw_cr0_mask |= X86_CR0_TS;
-            }
-            else if ( vmcb_get_cr0(vmcb) & X86_CR0_TS )
-                svm_fpu_enter(v);
-        }
-
         if ( paging_mode_hap(v->domain) )
         {
             uint32_t intercepts = vmcb_get_cr_intercepts(vmcb);
@@ -169,12 +123,12 @@ static void cf_check svm_update_guest_cr(
                vmcb_set_cr_intercepts(vmcb, intercepts | CR_INTERCEPT_CR3_WRITE);
         }
 
-        value = v->arch.hvm.guest_cr[0] | hw_cr0_mask;
+        value = v->arch.hvm.guest_cr[0];
         if ( paging_mode_shadow(v->domain) )
             value |= X86_CR0_PG | X86_CR0_WP;
         vmcb_set_cr0(vmcb, value);
         break;
-    }
+
     case 2:
         vmcb_set_cr2(vmcb, v->arch.hvm.guest_cr[2]);
         break;
@@ -909,9 +863,6 @@ static void cf_check svm_ctxt_switch_from(struct vcpu *v)
     if ( unlikely((read_efer() & EFER_SVME) == 0) )
         return;
 
-    if ( !v->arch.fully_eager_fpu )
-        svm_fpu_leave(v);
-
     svm_save_dr(v);
     svm_tsc_ratio_save(v);
 
@@ -1678,28 +1629,6 @@ static void svm_do_nested_pgfault(struct vcpu *v,
     domain_crash(v->domain);
 }
 
-static void cf_check svm_fpu_dirty_intercept(void)
-{
-    struct vcpu *v = current;
-    struct vmcb_struct *vmcb = v->arch.hvm.svm.vmcb;
-    struct vmcb_struct *n1vmcb = vcpu_nestedhvm(v).nv_n1vmcx;
-
-    svm_fpu_enter(v);
-
-    if ( vmcb != n1vmcb )
-    {
-       /* Check if l1 guest must make FPU ready for the l2 guest */
-       if ( v->arch.hvm.guest_cr[0] & X86_CR0_TS )
-           hvm_inject_hw_exception(X86_EXC_NM, X86_EVENT_NO_EC);
-       else
-           vmcb_set_cr0(n1vmcb, vmcb_get_cr0(n1vmcb) & ~X86_CR0_TS);
-       return;
-    }
-
-    if ( !(v->arch.hvm.guest_cr[0] & X86_CR0_TS) )
-        vmcb_set_cr0(vmcb, vmcb_get_cr0(vmcb) & ~X86_CR0_TS);
-}
-
 static void svm_vmexit_do_cr_access(
     struct vmcb_struct *vmcb, struct cpu_user_regs *regs)
 {
@@ -2459,7 +2388,6 @@ static struct hvm_function_table __initdata_cf_clobber svm_function_table = {
     .update_guest_cr      = svm_update_guest_cr,
     .update_guest_efer    = svm_update_guest_efer,
     .cpuid_policy_changed = svm_cpuid_policy_changed,
-    .fpu_leave            = svm_fpu_leave,
     .set_guest_pat        = svm_set_guest_pat,
     .get_guest_pat        = svm_get_guest_pat,
     .set_tsc_offset       = svm_set_tsc_offset,
@@ -2469,7 +2397,6 @@ static struct hvm_function_table __initdata_cf_clobber svm_function_table = {
     .get_pending_event    = svm_get_pending_event,
     .invlpg               = svm_invlpg,
     .wbinvd_intercept     = svm_wbinvd_intercept,
-    .fpu_dirty_intercept  = svm_fpu_dirty_intercept,
     .msr_read_intercept   = svm_msr_read_intercept,
     .msr_write_intercept  = svm_msr_write_intercept,
 #ifdef CONFIG_VM_EVENT
@@ -2783,10 +2710,6 @@ void asmlinkage svm_vmexit_handler(void)
         }
         break;
 
-    case VMEXIT_EXCEPTION_NM:
-        svm_fpu_dirty_intercept();
-        break;
-
     case VMEXIT_EXCEPTION_PF:
     {
         unsigned long va = vmcb->ei.exc.cr2;
diff --git a/xen/arch/x86/hvm/svm/vmcb.c b/xen/arch/x86/hvm/svm/vmcb.c
index e583ef8548..5ed7123d9a 100644
--- a/xen/arch/x86/hvm/svm/vmcb.c
+++ b/xen/arch/x86/hvm/svm/vmcb.c
@@ -138,9 +138,7 @@ static int construct_vmcb(struct vcpu *v)
 
     paging_update_paging_modes(v);
 
-    vmcb->_exception_intercepts =
-        HVM_TRAP_MASK |
-        (v->arch.fully_eager_fpu ? 0 : (1U << X86_EXC_NM));
+    vmcb->_exception_intercepts = HVM_TRAP_MASK;
 
     if ( paging_mode_hap(v->domain) )
     {
diff --git a/xen/arch/x86/include/asm/hvm/svm-types.h b/xen/arch/x86/include/asm/hvm/svm-types.h
index 051b235d8f..3ede62cade 100644
--- a/xen/arch/x86/include/asm/hvm/svm-types.h
+++ b/xen/arch/x86/include/asm/hvm/svm-types.h
@@ -65,12 +65,6 @@ struct nestedsvm {
     /* Shadow io permission map */
     unsigned long *ns_iomap;
 
-     /*
-      * Cached guest_cr[0] of l1 guest while l2 guest runs.  Needed to handle
-      * FPU context switching.
-      */
-    uint64_t ns_cr0;
-
     /*
      * Cache guest cr3/host cr3 the guest sets up for the l2 guest.
      * Used by Shadow-on-Shadow and Nested-on-Nested.
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Mar 30 14:56:54 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 30 Mar 2026 14:56:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1267766.1557243 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7E2w-0004Fb-GC; Mon, 30 Mar 2026 14:56:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1267766.1557243; Mon, 30 Mar 2026 14:56:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7E2w-0004FT-Df; Mon, 30 Mar 2026 14:56:54 +0000
Received: by outflank-mailman (input) for mailman id 1267766;
 Mon, 30 Mar 2026 14:56:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w7E2v-0004FN-5p
 for xen-changelog@lists.xenproject.org; Mon, 30 Mar 2026 14:56:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7E2v-00HKdD-18
 for xen-changelog@lists.xenproject.org;
 Mon, 30 Mar 2026 14:56:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7E2v-00AVFJ-0J
 for xen-changelog@lists.xenproject.org;
 Mon, 30 Mar 2026 14:56:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=y9v54dqxLoM27e5HGdP4/GISDhpyoRIihwBU0jeGa0A=; b=a7GaPnkSYLK5g+B3ALzbriip5y
	uLIGB5MKbA10NWY5m+W8pdmN6SDkXAB3TTBOGj7Go0pJPuVNLe+4THW1+KSWDbeIBe5Jda0pTUFy0
	uC9ihVjV3FcKJBb740wTXgZeo2Tx/J6UBvsej09E1jhYGQnCyHK5nhtphZMP5e+D0Sok=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/traps: Remove lazy FPU support
Message-Id: <E1w7E2v-00AVFJ-0J@xenbits.xenproject.org>
Date: Mon, 30 Mar 2026 14:56:53 +0000

commit 47d75569250340874e432cfc1706fbd148cecc9d
Author:     Wei Liu <wei.liu2@citrix.com>
AuthorDate: Tue Mar 24 18:19:33 2026 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Mar 30 15:48:13 2026 +0100

    x86/traps: Remove lazy FPU support
    
    Remove lazy FPU support from the #NM exception handler used by PV
    guests since fully_eager_fpu is now always true.
    
    Signed-off-by: Wei Liu <wei.liu2@citrix.com>
    Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
---
 xen/arch/x86/i387.c               | 24 ------------------------
 xen/arch/x86/include/asm/i387.h   |  1 -
 xen/arch/x86/pv/misc-hypercalls.c |  3 +--
 xen/arch/x86/traps.c              | 20 +++++++++++++-------
 4 files changed, 14 insertions(+), 34 deletions(-)

diff --git a/xen/arch/x86/i387.c b/xen/arch/x86/i387.c
index 954ba3b179..7da731865f 100644
--- a/xen/arch/x86/i387.c
+++ b/xen/arch/x86/i387.c
@@ -234,30 +234,6 @@ void vcpu_restore_fpu_nonlazy(struct vcpu *v, bool need_stts)
         stts();
 }
 
-/* 
- * Restore FPU state when #NM is triggered.
- */
-void vcpu_restore_fpu_lazy(struct vcpu *v)
-{
-    ASSERT(!is_idle_vcpu(v));
-
-    /* Avoid recursion. */
-    clts();
-
-    if ( v->fpu_dirtied )
-        return;
-
-    ASSERT(!v->arch.fully_eager_fpu);
-
-    if ( cpu_has_xsave )
-        fpu_xrstor(v, XSTATE_LAZY);
-    else
-        fpu_fxrstor(v);
-
-    v->fpu_initialised = 1;
-    v->fpu_dirtied = 1;
-}
-
 /* 
  * On each context switch, save the necessary FPU info of VCPU being switch 
  * out. It dispatches saving operation based on CPU's capability.
diff --git a/xen/arch/x86/include/asm/i387.h b/xen/arch/x86/include/asm/i387.h
index 652d7ad2de..da0c7e945f 100644
--- a/xen/arch/x86/include/asm/i387.h
+++ b/xen/arch/x86/include/asm/i387.h
@@ -28,7 +28,6 @@ struct ix87_env {
 };
 
 void vcpu_restore_fpu_nonlazy(struct vcpu *v, bool need_stts);
-void vcpu_restore_fpu_lazy(struct vcpu *v);
 void vcpu_save_fpu(struct vcpu *v);
 void save_fpu_enable(void);
 int vcpu_init_fpu(struct vcpu *v);
diff --git a/xen/arch/x86/pv/misc-hypercalls.c b/xen/arch/x86/pv/misc-hypercalls.c
index 7e915d86b7..34a0717540 100644
--- a/xen/arch/x86/pv/misc-hypercalls.c
+++ b/xen/arch/x86/pv/misc-hypercalls.c
@@ -42,8 +42,7 @@ long do_fpu_taskswitch(int set)
     else
     {
         v->arch.pv.ctrlreg[0] &= ~X86_CR0_TS;
-        if ( v->fpu_dirtied )
-            clts();
+        clts();
     }
 
     return 0;
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index b6b1197697..8aa1e4181b 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -2045,15 +2045,21 @@ void asmlinkage do_device_not_available(struct cpu_user_regs *regs)
     }
 
 #ifdef CONFIG_PV
-    vcpu_restore_fpu_lazy(curr);
-
-    if ( curr->arch.pv.ctrlreg[0] & X86_CR0_TS )
+    if ( !(curr->arch.pv.ctrlreg[0] & X86_CR0_TS) )
     {
-        pv_inject_hw_exception(X86_EXC_NM, X86_EVENT_NO_EC);
-        curr->arch.pv.ctrlreg[0] &= ~X86_CR0_TS;
+        ASSERT_UNREACHABLE();
+        domain_crash(curr->domain, "#NM but vCR0.TS clear\n");
+        return;
     }
-    else
-        TRACE_TIME(TRC_PV_MATH_STATE_RESTORE);
+
+    /*
+     * For better or worse, Xen's ABI with PV guests always clears TS on an #NM
+     * exception. Classic-xen Linux depends on this.
+     */
+    clts();
+    curr->arch.pv.ctrlreg[0] &= ~X86_CR0_TS;
+
+    pv_inject_hw_exception(X86_EXC_NM, X86_EVENT_NO_EC);
 #else
     ASSERT_UNREACHABLE();
 #endif
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Mar 30 14:57:04 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 30 Mar 2026 14:57:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1267767.1557247 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7E36-0004Hf-He; Mon, 30 Mar 2026 14:57:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1267767.1557247; Mon, 30 Mar 2026 14:57:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7E36-0004HY-F5; Mon, 30 Mar 2026 14:57:04 +0000
Received: by outflank-mailman (input) for mailman id 1267767;
 Mon, 30 Mar 2026 14:57:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w7E35-0004HS-8M
 for xen-changelog@lists.xenproject.org; Mon, 30 Mar 2026 14:57:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7E35-00HKdS-1Q
 for xen-changelog@lists.xenproject.org;
 Mon, 30 Mar 2026 14:57:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7E35-00AVGN-0f
 for xen-changelog@lists.xenproject.org;
 Mon, 30 Mar 2026 14:57:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Q0sn+dqoIUEdzk2JuRa3v8Pw6YH5wbHSFF/vzUM7OXw=; b=f1fCbGAYCTFJm1kl1I0EJzY4A2
	QYl1JSpVozmx4BULWPuTOeJOxEb1Testx6nrlGOjPFPZOq90QvymsKI548GegURD+kFMII6rRNlkD
	K4kg9ioHnsp2/6G1SKWE1mQj3Sr5tM+xpQUtLSsW+Gfz22gCdDK67M89ZqP38Xxiv3dU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86: Remove fully_eager_fpu
Message-Id: <E1w7E35-00AVGN-0f@xenbits.xenproject.org>
Date: Mon, 30 Mar 2026 14:57:03 +0000

commit dba44e0512097ffb13fedf82c789f0c0c53a6c0c
Author:     Ross Lagerwall <ross.lagerwall@citrix.com>
AuthorDate: Tue Mar 24 18:19:34 2026 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Mar 30 15:48:13 2026 +0100

    x86: Remove fully_eager_fpu
    
    Since fully_eager_fpu is always true, remove it and adjust the code
    accordingly. At the same time, rename vcpu_restore_fpu_nonlazy since it
    always does the full restore.
    
    No functional change intended.
    
    Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/domain.c              |  2 +-
 xen/arch/x86/hvm/emulate.c         | 18 +-----------------
 xen/arch/x86/i387.c                | 35 +++++++++--------------------------
 xen/arch/x86/include/asm/domain.h  |  3 ---
 xen/arch/x86/include/asm/hvm/hvm.h |  2 --
 xen/arch/x86/include/asm/i387.h    |  2 +-
 xen/common/efi/runtime.c           |  2 +-
 7 files changed, 13 insertions(+), 51 deletions(-)

diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index 9ba2774762..c9ae8ee6e3 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -2125,7 +2125,7 @@ static void __context_switch(void)
             if ( cpu_has_xsaves && is_hvm_vcpu(n) )
                 set_msr_xss(n->arch.msrs->xss.raw);
         }
-        vcpu_restore_fpu_nonlazy(n, false);
+        vcpu_restore_fpu(n);
         nd->arch.ctxt_switch->to(n);
     }
 
diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c
index 86b1f75356..2daea084f1 100644
--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -2630,23 +2630,7 @@ static void cf_check hvmemul_put_fpu(
     }
 
     if ( backout == X86EMUL_FPU_fpu )
-    {
-        /*
-         * To back out changes to the register file
-         * - in fully eager mode, restore original state immediately,
-         * - in lazy mode, simply adjust state such that upon next FPU insn
-         *   use by the guest we'll reload the state saved (or freshly loaded)
-         *   by hvmemul_get_fpu().
-         */
-        if ( curr->arch.fully_eager_fpu )
-            vcpu_restore_fpu_nonlazy(curr, false);
-        else
-        {
-            curr->fpu_dirtied = false;
-            stts();
-            alternative_vcall(hvm_funcs.fpu_leave, curr);
-        }
-    }
+        vcpu_restore_fpu(curr);
 }
 
 static int cf_check hvmemul_tlb_op(
diff --git a/xen/arch/x86/i387.c b/xen/arch/x86/i387.c
index 7da731865f..88018397b1 100644
--- a/xen/arch/x86/i387.c
+++ b/xen/arch/x86/i387.c
@@ -194,12 +194,8 @@ static inline void fpu_fxsave(struct vcpu *v)
 /*       VCPU FPU Functions    */
 /*******************************/
 /* Restore FPU state whenever VCPU is schduled in. */
-void vcpu_restore_fpu_nonlazy(struct vcpu *v, bool need_stts)
+void vcpu_restore_fpu(struct vcpu *v)
 {
-    /* Restore nonlazy extended state (i.e. parts not tracked by CR0.TS). */
-    if ( !v->arch.fully_eager_fpu && !v->arch.nonlazy_xstate_used )
-        goto maybe_stts;
-
     ASSERT(!is_idle_vcpu(v));
 
     /* Avoid recursion */
@@ -210,27 +206,16 @@ void vcpu_restore_fpu_nonlazy(struct vcpu *v, bool need_stts)
      * above) we also need to restore full state, to prevent subsequently
      * saving state belonging to another vCPU.
      */
-    if ( v->arch.fully_eager_fpu || xstate_all(v) )
-    {
-        if ( cpu_has_xsave )
-            fpu_xrstor(v, XSTATE_ALL);
-        else
-            fpu_fxrstor(v);
-
-        v->fpu_initialised = 1;
-        v->fpu_dirtied = 1;
-
-        /* Xen doesn't need TS set, but the guest might. */
-        need_stts = is_pv_vcpu(v) && (v->arch.pv.ctrlreg[0] & X86_CR0_TS);
-    }
+    if ( cpu_has_xsave )
+        fpu_xrstor(v, XSTATE_ALL);
     else
-    {
-        fpu_xrstor(v, XSTATE_NONLAZY);
-        need_stts = true;
-    }
+        fpu_fxrstor(v);
 
- maybe_stts:
-    if ( need_stts )
+    v->fpu_initialised = 1;
+    v->fpu_dirtied = 1;
+
+    /* Xen doesn't need TS set, but the guest might. */
+    if ( is_pv_vcpu(v) && (v->arch.pv.ctrlreg[0] & X86_CR0_TS) )
         stts();
 }
 
@@ -273,8 +258,6 @@ void save_fpu_enable(void)
 /* Initialize FPU's context save area */
 int vcpu_init_fpu(struct vcpu *v)
 {
-    v->arch.fully_eager_fpu = true;
-
     return xstate_alloc_save_area(v);
 }
 
diff --git a/xen/arch/x86/include/asm/domain.h b/xen/arch/x86/include/asm/domain.h
index ad7f6adb2c..bd7b02085e 100644
--- a/xen/arch/x86/include/asm/domain.h
+++ b/xen/arch/x86/include/asm/domain.h
@@ -671,9 +671,6 @@ struct arch_vcpu
      * and thus should be saved/restored. */
     bool nonlazy_xstate_used;
 
-    /* Restore all FPU state (lazy and non-lazy state) on context switch? */
-    bool fully_eager_fpu;
-
     struct vmce vmce;
 
     struct paging_vcpu paging;
diff --git a/xen/arch/x86/include/asm/hvm/hvm.h b/xen/arch/x86/include/asm/hvm/hvm.h
index 7d9774df59..a9425c8cff 100644
--- a/xen/arch/x86/include/asm/hvm/hvm.h
+++ b/xen/arch/x86/include/asm/hvm/hvm.h
@@ -160,8 +160,6 @@ struct hvm_function_table {
 
     void (*cpuid_policy_changed)(struct vcpu *v);
 
-    void (*fpu_leave)(struct vcpu *v);
-
     int  (*get_guest_pat)(struct vcpu *v, uint64_t *gpat);
     int  (*set_guest_pat)(struct vcpu *v, uint64_t gpat);
 
diff --git a/xen/arch/x86/include/asm/i387.h b/xen/arch/x86/include/asm/i387.h
index da0c7e945f..fe5e4419b6 100644
--- a/xen/arch/x86/include/asm/i387.h
+++ b/xen/arch/x86/include/asm/i387.h
@@ -27,7 +27,7 @@ struct ix87_env {
     uint16_t fds, _res6;
 };
 
-void vcpu_restore_fpu_nonlazy(struct vcpu *v, bool need_stts);
+void vcpu_restore_fpu(struct vcpu *v);
 void vcpu_save_fpu(struct vcpu *v);
 void save_fpu_enable(void);
 int vcpu_init_fpu(struct vcpu *v);
diff --git a/xen/common/efi/runtime.c b/xen/common/efi/runtime.c
index ba27c62132..982e42e8f3 100644
--- a/xen/common/efi/runtime.c
+++ b/xen/common/efi/runtime.c
@@ -157,7 +157,7 @@ void efi_rs_leave(struct efi_rs_state *state)
     irq_exit();
     efi_rs_on_cpu = NR_CPUS;
     spin_unlock(&efi_rs_lock);
-    vcpu_restore_fpu_nonlazy(curr, true);
+    vcpu_restore_fpu(curr);
 }
 
 bool efi_rs_using_pgtables(void)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Mar 30 14:57:14 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 30 Mar 2026 14:57:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1267768.1557251 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7E3G-0004Jf-JC; Mon, 30 Mar 2026 14:57:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1267768.1557251; Mon, 30 Mar 2026 14:57:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7E3G-0004JX-GW; Mon, 30 Mar 2026 14:57:14 +0000
Received: by outflank-mailman (input) for mailman id 1267768;
 Mon, 30 Mar 2026 14:57:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w7E3F-0004JR-Bt
 for xen-changelog@lists.xenproject.org; Mon, 30 Mar 2026 14:57:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7E3F-00HKdY-1l
 for xen-changelog@lists.xenproject.org;
 Mon, 30 Mar 2026 14:57:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7E3F-00AVHl-0z
 for xen-changelog@lists.xenproject.org;
 Mon, 30 Mar 2026 14:57:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=9mh8jGwi2K6RstpFQuO6L7c4tgAJgbWq0B8M+Ovr0Pw=; b=FJvdzoQrmw/k6656aGSE8o70/D
	3dJhiyQCIUSyQ3j+Y8QAT07MmrJjOWCRfmUXhsLq1Exko2ZT6z6zq/AyiK/WViR8zEBkcG8aiVVOQ
	jFOcK/ueJ5ATjfsXAhvlJ2aXUmIJw5F3F4o8+Gz167ZLDbzDBc0HiAEXx3Ephf6zlXu0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86: Remove fpu_initialised/fpu_dirty
Message-Id: <E1w7E3F-00AVHl-0z@xenbits.xenproject.org>
Date: Mon, 30 Mar 2026 14:57:13 +0000

commit 4b9851c645220903fd996f997102fb63144fac4f
Author:     Ross Lagerwall <ross.lagerwall@citrix.com>
AuthorDate: Tue Mar 24 18:19:35 2026 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Mar 30 15:48:13 2026 +0100

    x86: Remove fpu_initialised/fpu_dirty
    
    With lazy FPU removed, fpu_initialised and fpu_dirty are always set to
    true in vcpu_restore_fpu() so remove them and adjust the code
    accordingly.
    
    There is a small user-visible change here. After this commit, calling
    XEN_DOMCTL_getvcpucontext immediately after vCPU creation would show the
    FPU as initialized (with a clean state) whereas before it would show as
    uninitialized.
    
    Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/domctl.c              |  5 ++---
 xen/arch/x86/hvm/emulate.c         |  6 +-----
 xen/arch/x86/hvm/hvm.c             | 15 ++++++---------
 xen/arch/x86/hvm/vlapic.c          |  3 ---
 xen/arch/x86/i387.c                | 31 ++-----------------------------
 xen/arch/x86/include/asm/hvm/hvm.h |  1 -
 xen/arch/x86/include/asm/xstate.h  | 11 -----------
 xen/arch/x86/xstate.c              | 21 +++++----------------
 xen/common/domain.c                |  2 --
 xen/include/xen/sched.h            |  4 ----
 10 files changed, 16 insertions(+), 83 deletions(-)

diff --git a/xen/arch/x86/domctl.c b/xen/arch/x86/domctl.c
index 942f41c584..8d474b7623 100644
--- a/xen/arch/x86/domctl.c
+++ b/xen/arch/x86/domctl.c
@@ -1406,11 +1406,10 @@ void arch_get_info_guest(struct vcpu *v, vcpu_guest_context_u c)
     VCPU_UNMAP_XSAVE_AREA(v, xsave_area);
 
     if ( is_pv_domain(d) )
-        c(flags = v->arch.pv.vgc_flags & ~(VGCF_i387_valid|VGCF_in_kernel));
+        c(flags = v->arch.pv.vgc_flags & ~VGCF_in_kernel);
     else
         c(flags = 0);
-    if ( v->fpu_initialised )
-        c(flags |= VGCF_i387_valid);
+    c(flags |= VGCF_i387_valid);
     if ( !(v->pause_flags & VPF_down) )
         c(flags |= VGCF_online);
     if ( !compat )
diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c
index 2daea084f1..48c7320360 100644
--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -2517,9 +2517,7 @@ static int cf_check hvmemul_get_fpu(
 {
     struct vcpu *curr = current;
 
-    if ( !curr->fpu_dirtied )
-        alternative_vcall(hvm_funcs.fpu_dirty_intercept);
-    else if ( type == X86EMUL_FPU_fpu )
+    if ( type == X86EMUL_FPU_fpu )
     {
         /* Has a fastpath for `current`, so there's no actual map */
         const struct xsave_struct *xsave_area = VCPU_MAP_XSAVE_AREA(curr);
@@ -2537,8 +2535,6 @@ static int cf_check hvmemul_get_fpu(
          * masking of all exceptions by FNSTENV.)
          */
         save_fpu_enable();
-        curr->fpu_initialised = true;
-        curr->fpu_dirtied = true;
         if ( (fpu_ctxt->fcw & 0x3f) != 0x3f )
         {
             uint16_t fcw;
diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index b62b058861..3edc2491e2 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -866,6 +866,7 @@ static int cf_check hvm_save_cpu_ctxt(struct vcpu *v, hvm_domain_context_t *h)
         .dr7 = v->arch.dr7,
         .msr_efer = v->arch.hvm.guest_efer,
     };
+    const struct xsave_struct *xsave_area;
 
     /*
      * We don't need to save state for a vcpu that is down; the restore
@@ -933,15 +934,11 @@ static int cf_check hvm_save_cpu_ctxt(struct vcpu *v, hvm_domain_context_t *h)
     ctxt.ldtr_base = seg.base;
     ctxt.ldtr_arbytes = seg.attr;
 
-    if ( v->fpu_initialised )
-    {
-        const struct xsave_struct *xsave_area = VCPU_MAP_XSAVE_AREA(v);
-
-        BUILD_BUG_ON(sizeof(ctxt.fpu_regs) != sizeof(xsave_area->fpu_sse));
-        memcpy(ctxt.fpu_regs, &xsave_area->fpu_sse, sizeof(ctxt.fpu_regs));
-        VCPU_UNMAP_XSAVE_AREA(v, xsave_area);
-        ctxt.flags = XEN_X86_FPU_INITIALISED;
-    }
+    xsave_area = VCPU_MAP_XSAVE_AREA(v);
+    BUILD_BUG_ON(sizeof(ctxt.fpu_regs) != sizeof(xsave_area->fpu_sse));
+    memcpy(ctxt.fpu_regs, &xsave_area->fpu_sse, sizeof(ctxt.fpu_regs));
+    VCPU_UNMAP_XSAVE_AREA(v, xsave_area);
+    ctxt.flags = XEN_X86_FPU_INITIALISED;
 
     return hvm_save_entry(CPU, v->vcpu_id, h, &ctxt);
 }
diff --git a/xen/arch/x86/hvm/vlapic.c b/xen/arch/x86/hvm/vlapic.c
index 79697487ba..885f5d304b 100644
--- a/xen/arch/x86/hvm/vlapic.c
+++ b/xen/arch/x86/hvm/vlapic.c
@@ -276,7 +276,6 @@ static void vlapic_init_sipi_one(struct vcpu *target, uint32_t icr)
     switch ( icr & APIC_DM_MASK )
     {
     case APIC_DM_INIT: {
-        bool fpu_initialised;
         int rc;
 
         /* No work on INIT de-assert for P4-type APIC. */
@@ -289,10 +288,8 @@ static void vlapic_init_sipi_one(struct vcpu *target, uint32_t icr)
         hvm_vcpu_down(target);
         domain_lock(target->domain);
         /* Reset necessary VCPU state. This does not include FPU state. */
-        fpu_initialised = target->fpu_initialised;
         rc = vcpu_reset(target);
         ASSERT(!rc);
-        target->fpu_initialised = fpu_initialised;
         vlapic_do_init(vcpu_vlapic(target));
         domain_unlock(target->domain);
         break;
diff --git a/xen/arch/x86/i387.c b/xen/arch/x86/i387.c
index 88018397b1..5e893a2aab 100644
--- a/xen/arch/x86/i387.c
+++ b/xen/arch/x86/i387.c
@@ -110,22 +110,7 @@ static inline void fpu_fxrstor(struct vcpu *v)
 
 static inline uint64_t vcpu_xsave_mask(const struct vcpu *v)
 {
-    if ( v->fpu_dirtied )
-        return v->arch.nonlazy_xstate_used ? XSTATE_ALL : XSTATE_LAZY;
-
-    ASSERT(v->arch.nonlazy_xstate_used);
-
-    /*
-     * The offsets of components which live in the extended region of
-     * compact xsave area are not fixed. Xsave area may be overwritten
-     * when a xsave with v->fpu_dirtied set is followed by one with
-     * v->fpu_dirtied clear.
-     * In such case, if hypervisor uses compact xsave area and guest
-     * has ever used lazy states (checking xcr0_accum excluding
-     * XSTATE_FP_SSE), vcpu_xsave_mask will return XSTATE_ALL. Otherwise
-     * return XSTATE_NONLAZY.
-     */
-    return xstate_all(v) ? XSTATE_ALL : XSTATE_NONLAZY;
+    return v->arch.nonlazy_xstate_used ? XSTATE_ALL : XSTATE_LAZY;
 }
 
 /* Save x87 extended state */
@@ -201,19 +186,11 @@ void vcpu_restore_fpu(struct vcpu *v)
     /* Avoid recursion */
     clts();
 
-    /*
-     * When saving full state even with !v->fpu_dirtied (see vcpu_xsave_mask()
-     * above) we also need to restore full state, to prevent subsequently
-     * saving state belonging to another vCPU.
-     */
     if ( cpu_has_xsave )
         fpu_xrstor(v, XSTATE_ALL);
     else
         fpu_fxrstor(v);
 
-    v->fpu_initialised = 1;
-    v->fpu_dirtied = 1;
-
     /* Xen doesn't need TS set, but the guest might. */
     if ( is_pv_vcpu(v) && (v->arch.pv.ctrlreg[0] & X86_CR0_TS) )
         stts();
@@ -225,7 +202,7 @@ void vcpu_restore_fpu(struct vcpu *v)
  */
 static bool _vcpu_save_fpu(struct vcpu *v)
 {
-    if ( !v->fpu_dirtied && !v->arch.nonlazy_xstate_used )
+    if ( !v->arch.nonlazy_xstate_used )
         return false;
 
     ASSERT(!is_idle_vcpu(v));
@@ -238,8 +215,6 @@ static bool _vcpu_save_fpu(struct vcpu *v)
     else
         fpu_fxsave(v);
 
-    v->fpu_dirtied = 0;
-
     return true;
 }
 
@@ -265,7 +240,6 @@ void vcpu_reset_fpu(struct vcpu *v)
 {
     struct xsave_struct *xsave_area = VCPU_MAP_XSAVE_AREA(v);
 
-    v->fpu_initialised = false;
     *xsave_area = (struct xsave_struct) {
         .xsave_hdr.xstate_bv = X86_XCR0_X87,
     };
@@ -282,7 +256,6 @@ void vcpu_setup_fpu(struct vcpu *v, const void *data)
 {
     struct xsave_struct *xsave_area = VCPU_MAP_XSAVE_AREA(v);
 
-    v->fpu_initialised = true;
     *xsave_area = (struct xsave_struct) {
         .fpu_sse = *(const fpusse_t*)data,
         .xsave_hdr.xstate_bv = XSTATE_FP_SSE,
diff --git a/xen/arch/x86/include/asm/hvm/hvm.h b/xen/arch/x86/include/asm/hvm/hvm.h
index a9425c8cff..846b91ebef 100644
--- a/xen/arch/x86/include/asm/hvm/hvm.h
+++ b/xen/arch/x86/include/asm/hvm/hvm.h
@@ -184,7 +184,6 @@ struct hvm_function_table {
 
     /* Instruction intercepts: non-void return values are X86EMUL codes. */
     void (*wbinvd_intercept)(void);
-    void (*fpu_dirty_intercept)(void);
     int (*msr_read_intercept)(unsigned int msr, uint64_t *msr_content);
     int (*msr_write_intercept)(unsigned int msr, uint64_t msr_content);
     void (*handle_cd)(struct vcpu *v, unsigned long value);
diff --git a/xen/arch/x86/include/asm/xstate.h b/xen/arch/x86/include/asm/xstate.h
index e3b9745543..ca38c43ec1 100644
--- a/xen/arch/x86/include/asm/xstate.h
+++ b/xen/arch/x86/include/asm/xstate.h
@@ -132,17 +132,6 @@ xsave_area_compressed(const struct xsave_struct *xsave_area)
     return xsave_area->xsave_hdr.xcomp_bv & XSTATE_COMPACTION_ENABLED;
 }
 
-static inline bool xstate_all(const struct vcpu *v)
-{
-    /*
-     * XSTATE_FP_SSE may be excluded, because the offsets of XSTATE_FP_SSE
-     * (in the legacy region of xsave area) are fixed, so saving
-     * XSTATE_FP_SSE will not cause overwriting problem with XSAVES/XSAVEC.
-     */
-    return xsave_area_compressed(v->arch.xsave_area) &&
-           (v->arch.xcr0_accum & XSTATE_LAZY & ~XSTATE_FP_SSE);
-}
-
 /*
  * Fetch a pointer to a vCPU's XSAVE area
  *
diff --git a/xen/arch/x86/xstate.c b/xen/arch/x86/xstate.c
index defe9b3f0c..c42cdc9462 100644
--- a/xen/arch/x86/xstate.c
+++ b/xen/arch/x86/xstate.c
@@ -1005,28 +1005,17 @@ int handle_xsetbv(u32 index, u64 new_bv)
     if ( new_bv & XSTATE_NONLAZY )
         curr->arch.nonlazy_xstate_used = 1;
 
-    mask &= curr->fpu_dirtied ? ~XSTATE_FP_SSE : XSTATE_NONLAZY;
+    mask &= ~XSTATE_FP_SSE;
     if ( mask )
     {
         unsigned long cr0 = read_cr0();
+        /* Has a fastpath for `current`, so there's no actual map */
+        struct xsave_struct *xsave_area = VCPU_MAP_XSAVE_AREA(curr);
 
         clts();
-        if ( curr->fpu_dirtied )
-        {
-            /* Has a fastpath for `current`, so there's no actual map */
-            struct xsave_struct *xsave_area = VCPU_MAP_XSAVE_AREA(curr);
 
-            asm ( "stmxcsr %0" : "=m" (xsave_area->fpu_sse.mxcsr) );
-            VCPU_UNMAP_XSAVE_AREA(curr, xsave_area);
-        }
-        else if ( xstate_all(curr) )
-        {
-            /* See the comment in i387.c:vcpu_restore_fpu_eager(). */
-            mask |= XSTATE_LAZY;
-            curr->fpu_initialised = 1;
-            curr->fpu_dirtied = 1;
-            cr0 &= ~X86_CR0_TS;
-        }
+        asm ( "stmxcsr %0" : "=m" (xsave_area->fpu_sse.mxcsr) );
+        VCPU_UNMAP_XSAVE_AREA(curr, xsave_area);
         xrstor(curr, mask);
         if ( cr0 & X86_CR0_TS )
             write_cr0(cr0);
diff --git a/xen/common/domain.c b/xen/common/domain.c
index ab910fcf93..30cfea3045 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -1824,8 +1824,6 @@ int vcpu_reset(struct vcpu *v)
     clear_bit(v->vcpu_id, d->poll_mask);
     v->poll_evtchn = 0;
 
-    v->fpu_initialised = 0;
-    v->fpu_dirtied     = 0;
     v->is_initialised  = 0;
     if ( v->affinity_broken & VCPU_AFFINITY_OVERRIDE )
         vcpu_temporary_affinity(v, NR_CPUS, VCPU_AFFINITY_OVERRIDE);
diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
index 40a35fc15c..212c7d765c 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -212,10 +212,6 @@ struct vcpu
     struct guest_area runstate_guest_area;
     unsigned int     new_state;
 
-    /* Has the FPU been initialised? */
-    bool             fpu_initialised;
-    /* Has the FPU been used since it was last saved? */
-    bool             fpu_dirtied;
     /* Initialization completed for this VCPU? */
     bool             is_initialised;
     /* Currently running on a CPU? */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Mar 30 14:57:24 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 30 Mar 2026 14:57:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1267769.1557255 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7E3Q-0004MJ-Lz; Mon, 30 Mar 2026 14:57:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1267769.1557255; Mon, 30 Mar 2026 14:57:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7E3Q-0004MB-JO; Mon, 30 Mar 2026 14:57:24 +0000
Received: by outflank-mailman (input) for mailman id 1267769;
 Mon, 30 Mar 2026 14:57:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w7E3P-0004Ly-El
 for xen-changelog@lists.xenproject.org; Mon, 30 Mar 2026 14:57:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7E3P-00HKdi-24
 for xen-changelog@lists.xenproject.org;
 Mon, 30 Mar 2026 14:57:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7E3P-00AVJt-1J
 for xen-changelog@lists.xenproject.org;
 Mon, 30 Mar 2026 14:57:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ZqSMVdBkc2+Q9pLy5qZt3Vmd2VvsCs8FExV/4TppTmw=; b=XmuGgwqaSexGrRQJiJzeP7GApe
	ApQ3iBki/tG6AlV45t2PvbeKAxEE4agRctBTBeobkpG1vequKAvXfVuEYdh1MNLHiVZhXKxClZF06
	JmztSimyse4RBtfXYwbalBcnKw3vOPDt7rm+lK8skYKIBB3gVC/lJf4K2XbV/fXlahuY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/xstate: Stop tracking nonlazy xstate use
Message-Id: <E1w7E3P-00AVJt-1J@xenbits.xenproject.org>
Date: Mon, 30 Mar 2026 14:57:23 +0000

commit 7eb3d8420dac4b57db9efcbe2ada5e5455572a73
Author:     Ross Lagerwall <ross.lagerwall@citrix.com>
AuthorDate: Tue Mar 24 18:19:36 2026 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Mar 30 15:48:13 2026 +0100

    x86/xstate: Stop tracking nonlazy xstate use
    
    With the removal of lazy FPU, the full state is always restored on context
    switch so stop tracking whether nonlazy xstate is used.
    
    Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/domctl.c             |  1 -
 xen/arch/x86/hvm/hvm.c            |  1 -
 xen/arch/x86/i387.c               | 12 +-----------
 xen/arch/x86/include/asm/domain.h |  3 ---
 xen/arch/x86/include/asm/xstate.h |  6 ++----
 xen/arch/x86/xstate.c             |  3 ---
 6 files changed, 3 insertions(+), 23 deletions(-)

diff --git a/xen/arch/x86/domctl.c b/xen/arch/x86/domctl.c
index 8d474b7623..bfbc35c08b 100644
--- a/xen/arch/x86/domctl.c
+++ b/xen/arch/x86/domctl.c
@@ -1013,7 +1013,6 @@ long arch_do_domctl(
 
                 v->arch.xcr0 = _xcr0;
                 v->arch.xcr0_accum = _xcr0_accum;
-                v->arch.nonlazy_xstate_used = _xcr0_accum & XSTATE_NONLAZY;
                 compress_xsave_states(v, _xsave_area,
                                       evc->size - PV_XSAVE_HDR_SIZE);
 
diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 3edc2491e2..11e9b2bc88 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -1384,7 +1384,6 @@ static int cf_check hvm_load_cpu_xsave_states(
 
     v->arch.xcr0 = ctxt->xcr0;
     v->arch.xcr0_accum = ctxt->xcr0_accum;
-    v->arch.nonlazy_xstate_used = ctxt->xcr0_accum & XSTATE_NONLAZY;
     compress_xsave_states(v, &ctxt->save_area,
                           size - offsetof(struct hvm_hw_cpu_xsave, save_area));
 
diff --git a/xen/arch/x86/i387.c b/xen/arch/x86/i387.c
index 5e893a2aab..9acaaf4673 100644
--- a/xen/arch/x86/i387.c
+++ b/xen/arch/x86/i387.c
@@ -108,25 +108,18 @@ static inline void fpu_fxrstor(struct vcpu *v)
 /*      FPU Save Functions     */
 /*******************************/
 
-static inline uint64_t vcpu_xsave_mask(const struct vcpu *v)
-{
-    return v->arch.nonlazy_xstate_used ? XSTATE_ALL : XSTATE_LAZY;
-}
-
 /* Save x87 extended state */
 static inline void fpu_xsave(struct vcpu *v)
 {
     bool ok;
-    uint64_t mask = vcpu_xsave_mask(v);
 
-    ASSERT(mask);
     /*
      * XCR0 normally represents what guest OS set. In case of Xen itself,
      * we set the accumulated feature mask before doing save/restore.
      */
     ok = set_xcr0(v->arch.xcr0_accum | XSTATE_FP_SSE);
     ASSERT(ok);
-    xsave(v, mask);
+    xsave(v, XSTATE_ALL);
     ok = set_xcr0(v->arch.xcr0 ?: XSTATE_FP_SSE);
     ASSERT(ok);
 }
@@ -202,9 +195,6 @@ void vcpu_restore_fpu(struct vcpu *v)
  */
 static bool _vcpu_save_fpu(struct vcpu *v)
 {
-    if ( !v->arch.nonlazy_xstate_used )
-        return false;
-
     ASSERT(!is_idle_vcpu(v));
 
     /* This can happen, if a paravirtualised guest OS has set its CR0.TS. */
diff --git a/xen/arch/x86/include/asm/domain.h b/xen/arch/x86/include/asm/domain.h
index bd7b02085e..385a6666da 100644
--- a/xen/arch/x86/include/asm/domain.h
+++ b/xen/arch/x86/include/asm/domain.h
@@ -667,9 +667,6 @@ struct arch_vcpu
      * it explicitly enables it via xcr0.
      */
     uint64_t xcr0_accum;
-    /* This variable determines whether nonlazy extended state has been used,
-     * and thus should be saved/restored. */
-    bool nonlazy_xstate_used;
 
     struct vmce vmce;
 
diff --git a/xen/arch/x86/include/asm/xstate.h b/xen/arch/x86/include/asm/xstate.h
index ca38c43ec1..c96d75e38b 100644
--- a/xen/arch/x86/include/asm/xstate.h
+++ b/xen/arch/x86/include/asm/xstate.h
@@ -33,12 +33,10 @@ extern uint32_t mxcsr_mask;
 #define XSTATE_FP_SSE  (X86_XCR0_X87 | X86_XCR0_SSE)
 #define XCNTXT_MASK    (X86_XCR0_X87 | X86_XCR0_SSE | X86_XCR0_YMM | \
                         X86_XCR0_OPMASK | X86_XCR0_ZMM | X86_XCR0_HI_ZMM | \
-                        XSTATE_NONLAZY)
+                        X86_XCR0_BNDREGS | X86_XCR0_BNDCSR | X86_XCR0_PKRU | \
+                        X86_XCR0_TILE_CFG | X86_XCR0_TILE_DATA)
 
 #define XSTATE_ALL     (~(1ULL << 63))
-#define XSTATE_NONLAZY (X86_XCR0_BNDREGS | X86_XCR0_BNDCSR | X86_XCR0_PKRU | \
-                        X86_XCR0_TILE_CFG | X86_XCR0_TILE_DATA)
-#define XSTATE_LAZY    (XSTATE_ALL & ~XSTATE_NONLAZY)
 #define XSTATE_XSAVES_ONLY         0
 #define XSTATE_COMPACTION_ENABLED  (1ULL << 63)
 
diff --git a/xen/arch/x86/xstate.c b/xen/arch/x86/xstate.c
index c42cdc9462..8336414c52 100644
--- a/xen/arch/x86/xstate.c
+++ b/xen/arch/x86/xstate.c
@@ -1002,9 +1002,6 @@ int handle_xsetbv(u32 index, u64 new_bv)
     curr->arch.xcr0 = new_bv;
     curr->arch.xcr0_accum |= new_bv;
 
-    if ( new_bv & XSTATE_NONLAZY )
-        curr->arch.nonlazy_xstate_used = 1;
-
     mask &= ~XSTATE_FP_SSE;
     if ( mask )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Mar 30 14:57:34 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 30 Mar 2026 14:57:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1267770.1557259 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7E3a-0004R6-NQ; Mon, 30 Mar 2026 14:57:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1267770.1557259; Mon, 30 Mar 2026 14:57:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7E3a-0004Qy-Kk; Mon, 30 Mar 2026 14:57:34 +0000
Received: by outflank-mailman (input) for mailman id 1267770;
 Mon, 30 Mar 2026 14:57:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w7E3Z-0004Qs-Hg
 for xen-changelog@lists.xenproject.org; Mon, 30 Mar 2026 14:57:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7E3Z-00HKdm-2L
 for xen-changelog@lists.xenproject.org;
 Mon, 30 Mar 2026 14:57:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7E3Z-00AVLF-1a
 for xen-changelog@lists.xenproject.org;
 Mon, 30 Mar 2026 14:57:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=cVzQ0MAbgzvqleKtRfQ70XorfMed4a0DAYoVv+8R6Xk=; b=qV0PTrul7Raz3MIFmUvfZGFeYT
	GkjtbjAQaeQ+uERz7Ivccpkx+t1bptKQ4VvYR1sHh9ZZk8kaI8RvW4ItbmYYsjdhP1a4WyE8UihmG
	6MPgDnT7D7pDzTX9Le19xjGcTHHfmcp265tfDYR96DXcyhoTjYmY5WtBtW72XQh0Gz0c=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86: Cleanup cr0.TS flag handling
Message-Id: <E1w7E3Z-00AVLF-1a@xenbits.xenproject.org>
Date: Mon, 30 Mar 2026 14:57:33 +0000

commit 1792bb9a99d27d6b42e72fa28158e32d3ad05cc0
Author:     Ross Lagerwall <ross.lagerwall@citrix.com>
AuthorDate: Tue Mar 24 18:19:37 2026 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Mar 30 15:48:13 2026 +0100

    x86: Cleanup cr0.TS flag handling
    
    Setting/clearing the cr0.TS bit is serializing and setting the cr0.TS
    bit in particular requires a write to CR0 which is implemented in
    microcode and is very slow. Therefore and with lazy FPU removed, avoid
    setting/clearing the cr0.TS flag on context switch except when
    saving/restoring the FPU for a PV guest.
    
    After this, Xen's context switch code and idle CPUs run with the TS bit
    cleared. An unfortunate side effect of this is that any mistaken use of
    XMM registers or extended state will not trap and will therefore be more
    difficult to detect.
    
    Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/cpu/common.c       |  3 ---
 xen/arch/x86/hvm/emulate.c      | 14 ++------------
 xen/arch/x86/i387.c             | 19 +------------------
 xen/arch/x86/include/asm/i387.h |  1 -
 xen/common/efi/runtime.c        |  2 +-
 5 files changed, 4 insertions(+), 35 deletions(-)

diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c
index 5ac76897ae..057592b7c8 100644
--- a/xen/arch/x86/cpu/common.c
+++ b/xen/arch/x86/cpu/common.c
@@ -887,9 +887,6 @@ void cpu_init(void)
 	/* Install correct page table. */
 	write_ptbase(current);
 
-	/* Ensure FPU gets initialised for each domain. */
-	stts();
-
 	/* Reset debug registers: */
 	write_debugreg(0, 0);
 	write_debugreg(1, 0);
diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c
index 48c7320360..f3aae158e9 100644
--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -2527,14 +2527,8 @@ static int cf_check hvmemul_get_fpu(
          * Latch current register state so that we can back out changes
          * if needed (namely when a memory write fails after register state
          * has already been updated).
-         * NB: We don't really need the "enable" part of the called function
-         * (->fpu_dirtied set implies CR0.TS clear), but the additional
-         * overhead should be low enough to not warrant introduction of yet
-         * another slightly different function. However, we need to undo the
-         * ->fpu_dirtied clearing the function does as well as the possible
-         * masking of all exceptions by FNSTENV.)
          */
-        save_fpu_enable();
+        vcpu_save_fpu(curr);
         if ( (fpu_ctxt->fcw & 0x3f) != 0x3f )
         {
             uint16_t fcw;
@@ -2572,12 +2566,8 @@ static void cf_check hvmemul_put_fpu(
          * Latch current register state so that we can replace FIP/FDP/FOP
          * (which have values resulting from our own invocation of the FPU
          * instruction during emulation).
-         * NB: See also the comment in hvmemul_get_fpu(); we don't need to
-         * set ->fpu_dirtied here as it is going to be cleared below, and
-         * we also don't need to reload FCW as we're forcing full state to
-         * be reloaded anyway.
          */
-        save_fpu_enable();
+        vcpu_save_fpu(curr);
 
         if ( boot_cpu_has(X86_FEATURE_FDP_EXCP_ONLY) &&
              !(fpu_ctxt->fsw & ~fpu_ctxt->fcw & 0x003f) )
diff --git a/xen/arch/x86/i387.c b/xen/arch/x86/i387.c
index 9acaaf4673..c6796bc97b 100644
--- a/xen/arch/x86/i387.c
+++ b/xen/arch/x86/i387.c
@@ -176,9 +176,6 @@ void vcpu_restore_fpu(struct vcpu *v)
 {
     ASSERT(!is_idle_vcpu(v));
 
-    /* Avoid recursion */
-    clts();
-
     if ( cpu_has_xsave )
         fpu_xrstor(v, XSTATE_ALL);
     else
@@ -193,7 +190,7 @@ void vcpu_restore_fpu(struct vcpu *v)
  * On each context switch, save the necessary FPU info of VCPU being switch 
  * out. It dispatches saving operation based on CPU's capability.
  */
-static bool _vcpu_save_fpu(struct vcpu *v)
+void vcpu_save_fpu(struct vcpu *v)
 {
     ASSERT(!is_idle_vcpu(v));
 
@@ -204,20 +201,6 @@ static bool _vcpu_save_fpu(struct vcpu *v)
         fpu_xsave(v);
     else
         fpu_fxsave(v);
-
-    return true;
-}
-
-void vcpu_save_fpu(struct vcpu *v)
-{
-    _vcpu_save_fpu(v);
-    stts();
-}
-
-void save_fpu_enable(void)
-{
-    if ( !_vcpu_save_fpu(current) )
-        clts();
 }
 
 /* Initialize FPU's context save area */
diff --git a/xen/arch/x86/include/asm/i387.h b/xen/arch/x86/include/asm/i387.h
index fe5e4419b6..0717005d31 100644
--- a/xen/arch/x86/include/asm/i387.h
+++ b/xen/arch/x86/include/asm/i387.h
@@ -29,7 +29,6 @@ struct ix87_env {
 
 void vcpu_restore_fpu(struct vcpu *v);
 void vcpu_save_fpu(struct vcpu *v);
-void save_fpu_enable(void);
 int vcpu_init_fpu(struct vcpu *v);
 void vcpu_destroy_fpu(struct vcpu *v);
 
diff --git a/xen/common/efi/runtime.c b/xen/common/efi/runtime.c
index 982e42e8f3..0f1cc765ec 100644
--- a/xen/common/efi/runtime.c
+++ b/xen/common/efi/runtime.c
@@ -94,7 +94,7 @@ struct efi_rs_state efi_rs_enter(void)
         return state;
 
     state.cr3 = read_cr3();
-    save_fpu_enable();
+    vcpu_save_fpu(current);
     asm volatile ( "fnclex; fldcw %0" :: "m" (fcw) );
     asm volatile ( "ldmxcsr %0" :: "m" (mxcsr) );
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Mar 30 16:44:07 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 30 Mar 2026 16:44:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1268049.1557399 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7Fid-0000I7-F1; Mon, 30 Mar 2026 16:44:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1268049.1557399; Mon, 30 Mar 2026 16:44:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7Fid-0000Hy-Bm; Mon, 30 Mar 2026 16:44:03 +0000
Received: by outflank-mailman (input) for mailman id 1268049;
 Mon, 30 Mar 2026 16:44:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w7Fic-0000Hs-76
 for xen-changelog@lists.xenproject.org; Mon, 30 Mar 2026 16:44:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7Fic-00HNIN-15
 for xen-changelog@lists.xenproject.org;
 Mon, 30 Mar 2026 16:44:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7Fic-00AgrI-0I
 for xen-changelog@lists.xenproject.org;
 Mon, 30 Mar 2026 16:44:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=x0IsKuxS+F7tpDdoQ/iB1uYdwDEPOtEuw1kn6/A8hpY=; b=EMgiAs2TNkWgId7mFtvbnqWXpR
	nhzk/E0wbuaAjQUgnWRgs3end8IlmS2610OSW/MAQsesO0/s2Lb1h7OqeHz08LJYnAIO23NuvRnaQ
	BaDqhkX+y9sCsEiMAazgUSGHoFlYHKZzRUuI95KuDiwcEUq1uExN/WeLLbyIc39V4/FE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/uart: uniformly set ->ps_bdf_enable for all PCI serial devices
Message-Id: <E1w7Fic-00AgrI-0I@xenbits.xenproject.org>
Date: Mon, 30 Mar 2026 16:44:02 +0000

commit 4bf33360623d9d59c8e7a49b70308c1b58d4d772
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Fri Mar 27 11:16:33 2026 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Mon Mar 30 16:43:14 2026 +0200

    xen/uart: uniformly set ->ps_bdf_enable for all PCI serial devices
    
    Auto-discovered serial PCI devices when using dev=amt|pci won't get
    ->ps_bdf_enable, and as such some of the logic (like making sure the
    respective BARs are enabled) won't be applied to them.
    
    Fix by unconditionally setting ->ps_bdf_enable for all PCI serial devices,
    and removing the special case that was done in some places by checking
    whether the ->bar was set.  This also allows simplifying the logic in
    pci_serial_early_init().
    
    Fixes: 9738db88f68f ("xen: Automatically find serial port on PCI/PCIe and AMT devices.")
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/drivers/char/ns16550.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/xen/drivers/char/ns16550.c b/xen/drivers/char/ns16550.c
index d384f1c69d..45ac089193 100644
--- a/xen/drivers/char/ns16550.c
+++ b/xen/drivers/char/ns16550.c
@@ -283,7 +283,10 @@ static int cf_check ns16550_getc(struct serial_port *port, char *pc)
 static void pci_serial_early_init(struct ns16550 *uart)
 {
 #ifdef NS16550_PCI
-    if ( uart->bar && uart->io_base >= 0x10000 )
+    if ( !uart->ps_bdf_enable )
+        return;
+
+    if ( uart->io_base >= 0x10000 )
     {
         pci_conf_write16(PCI_SBDF(0, uart->ps_bdf[0], uart->ps_bdf[1],
                                   uart->ps_bdf[2]),
@@ -291,9 +294,6 @@ static void pci_serial_early_init(struct ns16550 *uart)
         return;
     }
 
-    if ( !uart->ps_bdf_enable || uart->io_base >= 0x10000 )
-        return;
-
     if ( uart->pb_bdf_enable )
         pci_conf_write16(PCI_SBDF(0, uart->pb_bdf[0], uart->pb_bdf[1],
                                   uart->pb_bdf[2]),
@@ -440,7 +440,7 @@ static void __init cf_check ns16550_init_postirq(struct serial_port *port)
         unsigned int, 1, (bits * uart->fifo_size * 1000) / uart->baud);
 
 #ifdef NS16550_PCI
-    if ( uart->bar || uart->ps_bdf_enable )
+    if ( uart->ps_bdf_enable )
     {
         if ( uart->param && uart->param->mmio &&
              rangeset_add_range(mmio_ro_ranges, PFN_DOWN(uart->io_base),
@@ -1338,6 +1338,7 @@ pci_uart_config(struct ns16550 *uart, bool skip_amt, unsigned int idx)
                 uart->ps_bdf[0] = b;
                 uart->ps_bdf[1] = d;
                 uart->ps_bdf[2] = f;
+                uart->ps_bdf_enable = true;
                 uart->bar_idx = bar_idx;
                 uart->bar = bar;
                 uart->bar64 = bar_64;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Mar 30 16:44:13 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 30 Mar 2026 16:44:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1268050.1557402 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7Fin-0000Js-Fp; Mon, 30 Mar 2026 16:44:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1268050.1557402; Mon, 30 Mar 2026 16:44:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7Fin-0000Jh-D9; Mon, 30 Mar 2026 16:44:13 +0000
Received: by outflank-mailman (input) for mailman id 1268050;
 Mon, 30 Mar 2026 16:44:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w7Fim-0000JZ-8P
 for xen-changelog@lists.xenproject.org; Mon, 30 Mar 2026 16:44:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7Fim-00HNIU-1N
 for xen-changelog@lists.xenproject.org;
 Mon, 30 Mar 2026 16:44:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7Fim-00Agtd-0a
 for xen-changelog@lists.xenproject.org;
 Mon, 30 Mar 2026 16:44:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=EUZWeL9aH7Oaf90UL9L5DO3teOEFEvx0kQp6D/bITxk=; b=pZYKnsdwLkueP0GVDY7ncn9E5N
	cKlNp4pizWTf+00PTjpBlvGITHrUmDqYn1ruWkEky8EgqCpVnOXV8mtx0xbUm3/vBP5ApOIGOWA2t
	i+iqJSMDdDOFf0xSDroxsJvYFJZ5NZXzE18B+xKsNUoqZes8ZEEff2L0bU1kvfIxHk7Y=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/uart: be more careful with changes to the PCI command register
Message-Id: <E1w7Fim-00Agtd-0a@xenbits.xenproject.org>
Date: Mon, 30 Mar 2026 16:44:12 +0000

commit ebf543972560e45b838def3a54859331cc92c970
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Wed Mar 25 14:32:59 2026 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Mon Mar 30 16:43:14 2026 +0200

    xen/uart: be more careful with changes to the PCI command register
    
    Read the existing PCI command register and only add the required bits to
    it, as to avoid clearing bits that might be possibly set by the firmware
    already, which might put the device into a non-working state.
    
    Xen being the owner of the PCI device it's legitimately allowed to change
    command registers bits.  Be careful however in case buggy devices require
    certain command register bits to be enabled, while not strictly required
    from Xen's usage.
    
    Fixes: f2ff5d6628b3 ("ns16550: enable PCI serial card usage")
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/drivers/char/ns16550.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/xen/drivers/char/ns16550.c b/xen/drivers/char/ns16550.c
index 45ac089193..293fc74d63 100644
--- a/xen/drivers/char/ns16550.c
+++ b/xen/drivers/char/ns16550.c
@@ -283,14 +283,19 @@ static int cf_check ns16550_getc(struct serial_port *port, char *pc)
 static void pci_serial_early_init(struct ns16550 *uart)
 {
 #ifdef NS16550_PCI
+    uint16_t cmd;
+
     if ( !uart->ps_bdf_enable )
         return;
 
+    cmd = pci_conf_read16(PCI_SBDF(0, uart->ps_bdf[0], uart->ps_bdf[1],
+                                  uart->ps_bdf[2]), PCI_COMMAND);
+
     if ( uart->io_base >= 0x10000 )
     {
         pci_conf_write16(PCI_SBDF(0, uart->ps_bdf[0], uart->ps_bdf[1],
                                   uart->ps_bdf[2]),
-                         PCI_COMMAND, PCI_COMMAND_MEMORY);
+                         PCI_COMMAND, cmd | PCI_COMMAND_MEMORY);
         return;
     }
 
@@ -307,7 +312,7 @@ static void pci_serial_early_init(struct ns16550 *uart)
                      uart->io_base | PCI_BASE_ADDRESS_SPACE_IO);
     pci_conf_write16(PCI_SBDF(0, uart->ps_bdf[0], uart->ps_bdf[1],
                               uart->ps_bdf[2]),
-                     PCI_COMMAND, PCI_COMMAND_IO);
+                     PCI_COMMAND, cmd | PCI_COMMAND_IO);
 #endif
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Mar 30 16:44:23 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 30 Mar 2026 16:44:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1268051.1557405 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7Fix-0000M4-HX; Mon, 30 Mar 2026 16:44:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1268051.1557405; Mon, 30 Mar 2026 16:44:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7Fix-0000Lw-EZ; Mon, 30 Mar 2026 16:44:23 +0000
Received: by outflank-mailman (input) for mailman id 1268051;
 Mon, 30 Mar 2026 16:44:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w7Fiw-0000Lq-Av
 for xen-changelog@lists.xenproject.org; Mon, 30 Mar 2026 16:44:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7Fiw-00HNIY-1g
 for xen-changelog@lists.xenproject.org;
 Mon, 30 Mar 2026 16:44:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7Fiw-00Aguh-0s
 for xen-changelog@lists.xenproject.org;
 Mon, 30 Mar 2026 16:44:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ICe23U6su3CvnsqOH1z1E7QknsJ7/Slfjuuqryjgwck=; b=By5hCVMlQDGpbDVrTCoZ1ZntWu
	I7ScOtrh5hxz0DpUc/FFuUc9cxyWoKAbhuDCwDwd+/D07DRtACIx+CB2v0z5vn1uzeZdRuXavUp2p
	U57Xwooe01LZvC/Blxl3U+Pd2vusUtPPX84LSHpDHmTKQLZ0DMYtiaeU62CLA5fwjXXo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/uart: switch ns16550 to use pci_sbdf_t
Message-Id: <E1w7Fiw-00Aguh-0s@xenbits.xenproject.org>
Date: Mon, 30 Mar 2026 16:44:22 +0000

commit 1e185afefcfd497b662574c29b53d73d3393df3e
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Fri Mar 20 08:58:15 2026 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Mon Mar 30 16:43:14 2026 +0200

    xen/uart: switch ns16550 to use pci_sbdf_t
    
    No functional change intended.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/drivers/char/ns16550.c | 133 ++++++++++++++++++++-------------------------
 1 file changed, 58 insertions(+), 75 deletions(-)

diff --git a/xen/drivers/char/ns16550.c b/xen/drivers/char/ns16550.c
index 293fc74d63..b23e85a3c6 100644
--- a/xen/drivers/char/ns16550.c
+++ b/xen/drivers/char/ns16550.c
@@ -67,8 +67,8 @@ static struct ns16550 {
     /* PCI card parameters. */
     bool pb_bdf_enable;     /* if =1, pb-bdf effective, port behind bridge */
     bool ps_bdf_enable;     /* if =1, ps_bdf effective, port on pci card */
-    unsigned int pb_bdf[3]; /* pci bridge BDF */
-    unsigned int ps_bdf[3]; /* pci serial port BDF */
+    pci_sbdf_t pci_bridge;
+    pci_sbdf_t pci_device;
     u32 bar;
     u32 bar64;
     u16 cr;
@@ -288,31 +288,22 @@ static void pci_serial_early_init(struct ns16550 *uart)
     if ( !uart->ps_bdf_enable )
         return;
 
-    cmd = pci_conf_read16(PCI_SBDF(0, uart->ps_bdf[0], uart->ps_bdf[1],
-                                  uart->ps_bdf[2]), PCI_COMMAND);
+    cmd = pci_conf_read16(uart->pci_device, PCI_COMMAND);
 
     if ( uart->io_base >= 0x10000 )
     {
-        pci_conf_write16(PCI_SBDF(0, uart->ps_bdf[0], uart->ps_bdf[1],
-                                  uart->ps_bdf[2]),
-                         PCI_COMMAND, cmd | PCI_COMMAND_MEMORY);
+        pci_conf_write16(uart->pci_device, PCI_COMMAND, cmd | PCI_COMMAND_MEMORY);
         return;
     }
 
     if ( uart->pb_bdf_enable )
-        pci_conf_write16(PCI_SBDF(0, uart->pb_bdf[0], uart->pb_bdf[1],
-                                  uart->pb_bdf[2]),
-                         PCI_IO_BASE,
+        pci_conf_write16(uart->pci_bridge, PCI_IO_BASE,
                          (uart->io_base & 0xF000) |
                          ((uart->io_base & 0xF000) >> 8));
 
-    pci_conf_write32(PCI_SBDF(0, uart->ps_bdf[0], uart->ps_bdf[1],
-                              uart->ps_bdf[2]),
-                     PCI_BASE_ADDRESS_0,
+    pci_conf_write32(uart->pci_device, PCI_BASE_ADDRESS_0,
                      uart->io_base | PCI_BASE_ADDRESS_SPACE_IO);
-    pci_conf_write16(PCI_SBDF(0, uart->ps_bdf[0], uart->ps_bdf[1],
-                              uart->ps_bdf[2]),
-                     PCI_COMMAND, cmd | PCI_COMMAND_IO);
+    pci_conf_write16(uart->pci_device, PCI_COMMAND, cmd | PCI_COMMAND_IO);
 #endif
 }
 
@@ -452,17 +443,16 @@ static void __init cf_check ns16550_init_postirq(struct serial_port *port)
                                 PFN_UP(uart->io_base + uart->io_size) - 1) )
             printk(XENLOG_INFO "Error while adding MMIO range of device to mmio_ro_ranges\n");
 
-        if ( pci_ro_device(0, uart->ps_bdf[0],
-                           PCI_DEVFN(uart->ps_bdf[1], uart->ps_bdf[2])) )
-            printk(XENLOG_INFO "Could not mark config space of %02x:%02x.%u read-only.\n",
-                   uart->ps_bdf[0], uart->ps_bdf[1],
-                   uart->ps_bdf[2]);
+        if ( pci_ro_device(uart->pci_device.seg, uart->pci_device.bus,
+                           uart->pci_device.devfn) )
+            printk(XENLOG_INFO
+                   "Could not mark config space of %pp read-only.\n",
+                   &uart->pci_device);
 
         if ( uart->msi )
         {
             struct msi_info msi = {
-                .sbdf = PCI_SBDF(0, uart->ps_bdf[0], uart->ps_bdf[1],
-                                 uart->ps_bdf[2]),
+                .sbdf = uart->pci_device,
                 .irq = uart->irq,
                 .entry_nr = 1
             };
@@ -504,9 +494,8 @@ static void __init cf_check ns16550_init_postirq(struct serial_port *port)
             }
 
             if ( rc )
-                printk(XENLOG_WARNING
-                       "MSI setup failed (%d) for %02x:%02x.%o\n",
-                       rc, uart->ps_bdf[0], uart->ps_bdf[1], uart->ps_bdf[2]);
+                printk(XENLOG_WARNING "MSI setup failed (%d) for %pp\n",
+                       rc, &uart->pci_device);
         }
     }
 #endif
@@ -533,8 +522,7 @@ static void cf_check ns16550_suspend(struct serial_port *port)
 
 #ifdef NS16550_PCI
     if ( uart->bar )
-       uart->cr = pci_conf_read16(PCI_SBDF(0, uart->ps_bdf[0], uart->ps_bdf[1],
-                                  uart->ps_bdf[2]), PCI_COMMAND);
+       uart->cr = pci_conf_read16(uart->pci_device, PCI_COMMAND);
 #endif
 }
 
@@ -545,19 +533,15 @@ static void _ns16550_resume(struct serial_port *port)
 
     if ( uart->bar )
     {
-       pci_conf_write32(PCI_SBDF(0, uart->ps_bdf[0], uart->ps_bdf[1],
-                                 uart->ps_bdf[2]),
+       pci_conf_write32(uart->pci_device,
                         PCI_BASE_ADDRESS_0 + uart->bar_idx*4, uart->bar);
 
         /* If 64 bit BAR, write higher 32 bits to BAR+4 */
         if ( uart->bar & PCI_BASE_ADDRESS_MEM_TYPE_64 )
-            pci_conf_write32(PCI_SBDF(0, uart->ps_bdf[0],  uart->ps_bdf[1],
-                                      uart->ps_bdf[2]),
+            pci_conf_write32(uart->pci_device,
                         PCI_BASE_ADDRESS_0 + (uart->bar_idx+1)*4, uart->bar64);
 
-       pci_conf_write16(PCI_SBDF(0, uart->ps_bdf[0], uart->ps_bdf[1],
-                                 uart->ps_bdf[2]),
-                        PCI_COMMAND, uart->cr);
+       pci_conf_write16(uart->pci_device, PCI_COMMAND, uart->cr);
     }
 #endif
 
@@ -1217,13 +1201,12 @@ pci_uart_config(struct ns16550 *uart, bool skip_amt, unsigned int idx)
                 uint32_t bar, bar_64 = 0, len, len_64;
                 u64 size = 0;
                 const struct ns16550_config_param *param = uart_param;
+                pci_sbdf_t sbdf = PCI_SBDF(0, b, d, f);
 
-                nextf = (f || (pci_conf_read16(PCI_SBDF(0, b, d, f),
-                                               PCI_HEADER_TYPE) &
+                nextf = (f || (pci_conf_read16(sbdf, PCI_HEADER_TYPE) &
                                0x80)) ? f + 1 : 8;
 
-                switch ( pci_conf_read16(PCI_SBDF(0, b, d, f),
-                                         PCI_CLASS_DEVICE) )
+                switch ( pci_conf_read16(sbdf, PCI_CLASS_DEVICE) )
                 {
                 case 0x0700: /* single port serial */
                 case 0x0702: /* multi port serial */
@@ -1240,10 +1223,8 @@ pci_uart_config(struct ns16550 *uart, bool skip_amt, unsigned int idx)
                 /* Check for params in uart_config lookup table */
                 for ( i = 0; i < ARRAY_SIZE(uart_config); i++ )
                 {
-                    u16 vendor = pci_conf_read16(PCI_SBDF(0, b, d, f),
-                                                 PCI_VENDOR_ID);
-                    u16 device = pci_conf_read16(PCI_SBDF(0, b, d, f),
-                                                 PCI_DEVICE_ID);
+                    u16 vendor = pci_conf_read16(sbdf, PCI_VENDOR_ID);
+                    u16 device = pci_conf_read16(sbdf, PCI_DEVICE_ID);
 
                     if ( uart_config[i].vendor_id == vendor &&
                          uart_config[i].dev_id == device )
@@ -1266,29 +1247,26 @@ pci_uart_config(struct ns16550 *uart, bool skip_amt, unsigned int idx)
                 }
 
                 uart->io_base = 0;
-                bar = pci_conf_read32(PCI_SBDF(0, b, d, f),
-                                      PCI_BASE_ADDRESS_0 + bar_idx * 4);
+                bar = pci_conf_read32(sbdf, PCI_BASE_ADDRESS_0 + bar_idx * 4);
 
                 /* MMIO based */
                 if ( param->mmio && !(bar & PCI_BASE_ADDRESS_SPACE_IO) )
                 {
-                    pci_conf_write32(PCI_SBDF(0, b, d, f),
-                                     PCI_BASE_ADDRESS_0 + bar_idx*4, ~0u);
-                    len = pci_conf_read32(PCI_SBDF(0, b, d, f),
+                    pci_conf_write32(sbdf, PCI_BASE_ADDRESS_0 + bar_idx*4, ~0u);
+                    len = pci_conf_read32(sbdf,
                                           PCI_BASE_ADDRESS_0 + bar_idx * 4);
-                    pci_conf_write32(PCI_SBDF(0, b, d, f),
-                                     PCI_BASE_ADDRESS_0 + bar_idx*4, bar);
+                    pci_conf_write32(sbdf, PCI_BASE_ADDRESS_0 + bar_idx*4, bar);
 
                     /* Handle 64 bit BAR if found */
                     if ( bar & PCI_BASE_ADDRESS_MEM_TYPE_64 )
                     {
-                        bar_64 = pci_conf_read32(PCI_SBDF(0, b, d, f),
+                        bar_64 = pci_conf_read32(sbdf,
                                       PCI_BASE_ADDRESS_0 + (bar_idx + 1) * 4);
-                        pci_conf_write32(PCI_SBDF(0, b, d, f),
+                        pci_conf_write32(sbdf,
                                     PCI_BASE_ADDRESS_0 + (bar_idx+1)*4, ~0u);
-                        len_64 = pci_conf_read32(PCI_SBDF(0, b, d, f),
+                        len_64 = pci_conf_read32(sbdf,
                                     PCI_BASE_ADDRESS_0 + (bar_idx + 1) * 4);
-                        pci_conf_write32(PCI_SBDF(0, b, d, f),
+                        pci_conf_write32(sbdf,
                                     PCI_BASE_ADDRESS_0 + (bar_idx+1)*4, bar_64);
                         size  = ((u64)~0 << 32) | PCI_BASE_ADDRESS_MEM_MASK;
                         size &= ((u64)len_64 << 32) | len;
@@ -1302,12 +1280,9 @@ pci_uart_config(struct ns16550 *uart, bool skip_amt, unsigned int idx)
                 /* IO based */
                 else if ( !param->mmio && (bar & PCI_BASE_ADDRESS_SPACE_IO) )
                 {
-                    pci_conf_write32(PCI_SBDF(0, b, d, f),
-                                     PCI_BASE_ADDRESS_0 + bar_idx*4, ~0u);
-                    len = pci_conf_read32(PCI_SBDF(0, b, d, f),
-                                          PCI_BASE_ADDRESS_0);
-                    pci_conf_write32(PCI_SBDF(0, b, d, f),
-                                     PCI_BASE_ADDRESS_0 + bar_idx*4, bar);
+                    pci_conf_write32(sbdf, PCI_BASE_ADDRESS_0 + bar_idx*4, ~0u);
+                    len = pci_conf_read32(sbdf, PCI_BASE_ADDRESS_0);
+                    pci_conf_write32(sbdf, PCI_BASE_ADDRESS_0 + bar_idx*4, bar);
                     size = len & PCI_BASE_ADDRESS_IO_MASK;
 
                     uart->io_base = bar & ~PCI_BASE_ADDRESS_SPACE_IO;
@@ -1340,19 +1315,15 @@ pci_uart_config(struct ns16550 *uart, bool skip_amt, unsigned int idx)
                 if ( param->fifo_size )
                     uart->fifo_size = param->fifo_size;
 
-                uart->ps_bdf[0] = b;
-                uart->ps_bdf[1] = d;
-                uart->ps_bdf[2] = f;
+                uart->pci_device = sbdf;
                 uart->ps_bdf_enable = true;
                 uart->bar_idx = bar_idx;
                 uart->bar = bar;
                 uart->bar64 = bar_64;
                 uart->io_size = max(8U << param->reg_shift,
                                     param->uart_offset);
-                uart->irq = pci_conf_read8(PCI_SBDF(0, b, d, f),
-                                           PCI_INTERRUPT_PIN) ?
-                            pci_conf_read8(PCI_SBDF(0, b, d, f),
-                                           PCI_INTERRUPT_LINE) : 0;
+                uart->irq = pci_conf_read8(sbdf, PCI_INTERRUPT_PIN) ?
+                            pci_conf_read8(sbdf, PCI_INTERRUPT_LINE) : 0;
 
 #ifdef CONFIG_X86
                 /*
@@ -1591,18 +1562,22 @@ static bool __init parse_positional(struct ns16550 *uart, char **str)
 #ifdef CONFIG_HAS_PCI
     if ( *conf == ',' && *++conf != ',' )
     {
-        conf = parse_pci(conf, NULL, &uart->ps_bdf[0],
-                         &uart->ps_bdf[1], &uart->ps_bdf[2]);
+        unsigned int b, d, f;
+
+        conf = parse_pci(conf, NULL, &b, &d, &f);
         if ( !conf )
             PARSE_ERR_RET("Bad port PCI coordinates");
+        uart->pci_device = PCI_SBDF(0, b, d, f);
         uart->ps_bdf_enable = true;
     }
 
     if ( *conf == ',' && *++conf != ',' )
     {
-        if ( !parse_pci(conf, NULL, &uart->pb_bdf[0],
-                        &uart->pb_bdf[1], &uart->pb_bdf[2]) )
+        unsigned int b, d, f;
+
+        if ( !parse_pci(conf, NULL, &b, &d, &f) )
             PARSE_ERR_RET("Bad bridge PCI coordinates");
+        uart->pci_bridge = PCI_SBDF(0, b, d, f);
         uart->pb_bdf_enable = true;
     }
 #endif
@@ -1685,18 +1660,26 @@ static bool __init parse_namevalue_pairs(char *str, struct ns16550 *uart)
             break;
 
         case port_bdf:
-            if ( !parse_pci(param_value, NULL, &uart->ps_bdf[0],
-                            &uart->ps_bdf[1], &uart->ps_bdf[2]) )
+        {
+            unsigned int b, d, f;
+
+            if ( !parse_pci(param_value, NULL, &b, &d, &f) )
                 PARSE_ERR_RET("Bad port PCI coordinates\n");
+            uart->pci_device = PCI_SBDF(0, b, d, f);
             uart->ps_bdf_enable = true;
             break;
+        }
 
         case bridge_bdf:
-            if ( !parse_pci(param_value, NULL, &uart->pb_bdf[0],
-                            &uart->pb_bdf[1], &uart->pb_bdf[2]) )
+        {
+            unsigned int b, d, f;
+
+            if ( !parse_pci(param_value, NULL, &b, &d, &f) )
                 PARSE_ERR_RET("Bad bridge PCI coordinates\n");
+            uart->pci_bridge = PCI_SBDF(0, b, d, f);
             uart->pb_bdf_enable = true;
             break;
+        }
 #endif
 
         default:
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Mar 30 16:44:33 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 30 Mar 2026 16:44:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1268052.1557409 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7Fj7-0000QP-KF; Mon, 30 Mar 2026 16:44:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1268052.1557409; Mon, 30 Mar 2026 16:44:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7Fj7-0000QH-Ho; Mon, 30 Mar 2026 16:44:33 +0000
Received: by outflank-mailman (input) for mailman id 1268052;
 Mon, 30 Mar 2026 16:44:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w7Fj6-0000QB-Em
 for xen-changelog@lists.xenproject.org; Mon, 30 Mar 2026 16:44:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7Fj6-00HNIc-21
 for xen-changelog@lists.xenproject.org;
 Mon, 30 Mar 2026 16:44:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7Fj6-00Agw0-1B
 for xen-changelog@lists.xenproject.org;
 Mon, 30 Mar 2026 16:44:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=08yoSN/YxF00DzZ3lsl8O0QsOpBNK4B200zOaWZ7JCQ=; b=tVEfKs8zLqC1TnOiYMeGe5ubyN
	cuBSCxKAc5l/+pSlKCpM1bqij8+kXS/1BZptP9zGmYEvHlNYRBklkDnW1/d+6aOeYcm4nlnW6Xjf9
	oLpVIIdfM4oPXgFYtqeKymXbW2Z+qfya0XP4qgmpLEjfT6uU2zlSkBvGpIv6Mmgc859s=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/mm: don't unconditionally clear PGC_need_scrub in alloc_heap_pages()
Message-Id: <E1w7Fj6-00Agw0-1B@xenbits.xenproject.org>
Date: Mon, 30 Mar 2026 16:44:32 +0000

commit 009401506e3d6e40f1f22630af7a4a75ee03f7c1
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Tue Mar 24 14:26:47 2026 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Mon Mar 30 16:43:14 2026 +0200

    xen/mm: don't unconditionally clear PGC_need_scrub in alloc_heap_pages()
    
    alloc_heap_pages() will unconditionally clear PGC_need_scrub, even when
    MEMF_no_scrub is requested.  This is kind of expected as otherwise some
    callers will assert on seeing non-expected flags set on the count_info
    field.
    
    Introduce a new MEMF bit to signal to alloc_heap_pages() that non-scrubbed
    pages should keep the PGC_need_scrub bit set. This fixes returning dirty
    pages from alloc_domheap_pages() without the PGC_need_scrub bit set for
    populate_physmap() to consume.
    
    With the above change alloc_domheap_pages() needs an adjustment to cope
    with allocated pages possibly having the PGC_need_scrub set.
    
    Fixes: 83a784a15b47 ("xen/mm: allow deferred scrub of physmap populate allocated pages")
    Reported-by: Ayden Bottos <aydenbottos12@gmail.com>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/common/memory.c     |  3 ++-
 xen/common/page_alloc.c | 31 ++++++++++++++++++++++---------
 xen/include/xen/mm.h    |  3 +++
 3 files changed, 27 insertions(+), 10 deletions(-)

diff --git a/xen/common/memory.c b/xen/common/memory.c
index 918510f287..f0ff131188 100644
--- a/xen/common/memory.c
+++ b/xen/common/memory.c
@@ -345,7 +345,8 @@ static void populate_physmap(struct memop_args *a)
                 unsigned int scrub_start = 0;
                 unsigned int memflags =
                     a->memflags | (d->creation_finished ? 0
-                                                        : MEMF_no_scrub);
+                                                        : (MEMF_no_scrub |
+                                                           MEMF_keep_scrub));
                 nodeid_t node =
                     (a->memflags & MEMF_exact_node) ? MEMF_get_node(a->memflags)
                                                     : NUMA_NO_NODE;
diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
index 588b5b99cb..1316dfbd15 100644
--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -989,6 +989,8 @@ static struct page_info *alloc_heap_pages(
     ASSERT(zone_lo <= zone_hi);
     ASSERT(zone_hi < NR_ZONES);
 
+    ASSERT(!(memflags & MEMF_keep_scrub) || (memflags & MEMF_no_scrub));
+
     if ( unlikely(order > MAX_ORDER) )
         return NULL;
 
@@ -1110,17 +1112,26 @@ static struct page_info *alloc_heap_pages(
     {
         bool cold = d && d != current->domain;
 
-        for ( i = 0; i < (1U << order); i++ )
+        if ( !(memflags & MEMF_no_scrub) )
         {
-            if ( test_and_clear_bit(_PGC_need_scrub, &pg[i].count_info) )
+            for ( i = 0; i < (1U << order); i++ )
             {
-                if ( !(memflags & MEMF_no_scrub) )
+                if ( test_and_clear_bit(_PGC_need_scrub, &pg[i].count_info) )
+                {
                     scrub_one_page(&pg[i], cold);
-
-                dirty_cnt++;
+                    dirty_cnt++;
+                }
+                else
+                    check_one_page(&pg[i]);
             }
-            else if ( !(memflags & MEMF_no_scrub) )
-                check_one_page(&pg[i]);
+        }
+        else
+        {
+            for ( i = 0; i < (1U << order); i++ )
+                if ( (memflags & MEMF_keep_scrub)
+                     ? test_bit(_PGC_need_scrub, &pg[i].count_info)
+                     : test_and_clear_bit(_PGC_need_scrub, &pg[i].count_info) )
+                    dirty_cnt++;
         }
 
         if ( dirty_cnt )
@@ -2696,8 +2707,10 @@ struct page_info *alloc_domheap_pages(
 
             for ( i = 0; i < (1UL << order); i++ )
             {
-                ASSERT(!pg[i].count_info);
-                pg[i].count_info = PGC_extra;
+                ASSERT(!(pg[i].count_info &
+                         ~((memflags & MEMF_keep_scrub) ? PGC_need_scrub
+                                                        : 0UL)));
+                pg[i].count_info |= PGC_extra;
             }
         }
         if ( assign_page(pg, order, d, memflags) )
diff --git a/xen/include/xen/mm.h b/xen/include/xen/mm.h
index d80bfba6d3..5e786c874a 100644
--- a/xen/include/xen/mm.h
+++ b/xen/include/xen/mm.h
@@ -208,6 +208,9 @@ struct npfec {
 #define  MEMF_no_refcount (1U<<_MEMF_no_refcount)
 #define _MEMF_populate_on_demand 1
 #define  MEMF_populate_on_demand (1U<<_MEMF_populate_on_demand)
+/* MEMF_keep_scrub is only valid when specified together with MEMF_no_scrub. */
+#define _MEMF_keep_scrub  2
+#define  MEMF_keep_scrub  (1U << _MEMF_keep_scrub)
 #define _MEMF_no_dma      3
 #define  MEMF_no_dma      (1U<<_MEMF_no_dma)
 #define _MEMF_exact_node  4
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Mar 30 16:44:43 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 30 Mar 2026 16:44:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1268053.1557413 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7FjH-0000Sh-Ll; Mon, 30 Mar 2026 16:44:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1268053.1557413; Mon, 30 Mar 2026 16:44:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7FjH-0000SZ-JB; Mon, 30 Mar 2026 16:44:43 +0000
Received: by outflank-mailman (input) for mailman id 1268053;
 Mon, 30 Mar 2026 16:44:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w7FjG-0000ST-HG
 for xen-changelog@lists.xenproject.org; Mon, 30 Mar 2026 16:44:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7FjG-00HNJ6-2J
 for xen-changelog@lists.xenproject.org;
 Mon, 30 Mar 2026 16:44:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7FjG-00AgxQ-1Y
 for xen-changelog@lists.xenproject.org;
 Mon, 30 Mar 2026 16:44:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=gzWRjgCtQyKJSc1MpyuKwIwPO2UaAo3rS5E6v8s3JN4=; b=V2O9n7vz6CVIhygQiIyLIqc/cn
	J7GuSM0dafXn2W6XOA1nwKczeUD325RgerPdtVLD/lvGnoDUpPN+NQfgAu4N0x0IAPDEu2H5nQh//
	xjytVjXKUQuA04ES97EeS4l/xYmk/pLlrlX5KETiBhIGShtSludFD8RfYWBIStlZ/BpI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/mm: do not assign pages to a domain until they are scrubbed
Message-Id: <E1w7FjG-00AgxQ-1Y@xenbits.xenproject.org>
Date: Mon, 30 Mar 2026 16:44:42 +0000

commit 36522685435ff7e5731310665929df158a017519
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Tue Mar 24 14:48:28 2026 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Mon Mar 30 16:43:14 2026 +0200

    xen/mm: do not assign pages to a domain until they are scrubbed
    
    Assigning pages to a domain make them the possible target of hypercalls
    like XENMEM_decrease_reservation ahead of such pages being scrubbed in
    populate_physmap() when the guest is running in PV mode.  This might allow
    pages to be freed ahead of being scrubbed for example, as a stubdomain
    already running could target them by guessing their MFNs.  It's also
    possible other action could set the page type ahead of scrubbing, which
    would be problematic.
    
    Prevent the pages pending scrub from being assigned to the domain, and only
    do the assign once the scrubbing has finished.  This has the disadvantage
    that the allocated pages will be removed from the free pool, but not yet
    accounted towards the domain consumed page quota.  However there can only
    be one stashed page in that state, and it's maximum size is bounded by the
    memop-max-order option.  This is not too different from the current logic,
    where assigning pages to a domain (and thus checking whether such domain
    doesn't overflow it's quota) is also done after the memory has been
    allocated and removed from the pool of free pages.
    
    Fixes: 83a784a15b47 ("xen/mm: allow deferred scrub of physmap populate allocated pages")
    Reported-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/common/memory.c     | 6 ++++++
 xen/common/page_alloc.c | 9 ++++++++-
 xen/include/xen/mm.h    | 7 ++++++-
 3 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/xen/common/memory.c b/xen/common/memory.c
index f0ff131188..1ad4b51c5b 100644
--- a/xen/common/memory.c
+++ b/xen/common/memory.c
@@ -388,6 +388,12 @@ static void populate_physmap(struct memop_args *a)
                             goto out;
                         }
                     }
+
+                    if ( assign_page(page, a->extent_order, d, memflags) )
+                    {
+                        free_domheap_pages(page, a->extent_order);
+                        goto out;
+                    }
                 }
 
                 if ( unlikely(a->memflags & MEMF_no_tlbflush) )
diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
index 1316dfbd15..b1edef8712 100644
--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -2713,7 +2713,14 @@ struct page_info *alloc_domheap_pages(
                 pg[i].count_info |= PGC_extra;
             }
         }
-        if ( assign_page(pg, order, d, memflags) )
+        /*
+         * Don't add pages with the PGC_need_scrub bit set to the domain, the
+         * caller must clean the bit and then manually call assign_pages().
+         * Otherwise pages still subject to scrubbing would be reachable using
+         * get_page().
+         */
+        if ( !(memflags & MEMF_keep_scrub) &&
+             assign_page(pg, order, d, memflags) )
         {
             free_heap_pages(pg, order, memflags & MEMF_no_scrub);
             return NULL;
diff --git a/xen/include/xen/mm.h b/xen/include/xen/mm.h
index 5e786c874a..b80bec00c1 100644
--- a/xen/include/xen/mm.h
+++ b/xen/include/xen/mm.h
@@ -208,7 +208,12 @@ struct npfec {
 #define  MEMF_no_refcount (1U<<_MEMF_no_refcount)
 #define _MEMF_populate_on_demand 1
 #define  MEMF_populate_on_demand (1U<<_MEMF_populate_on_demand)
-/* MEMF_keep_scrub is only valid when specified together with MEMF_no_scrub. */
+/*
+ * MEMF_keep_scrub is only valid when specified together with MEMF_no_scrub.
+ * Allocations with this flag never assign the pages to the domain, the caller
+ * must call assign_page() after the PGC_need_scrub bit is cleared if
+ * required.
+ */
 #define _MEMF_keep_scrub  2
 #define  MEMF_keep_scrub  (1U << _MEMF_keep_scrub)
 #define _MEMF_no_dma      3
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Mar 30 16:44:53 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 30 Mar 2026 16:44:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1268054.1557419 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7FjR-0000Ug-Nf; Mon, 30 Mar 2026 16:44:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1268054.1557419; Mon, 30 Mar 2026 16:44:53 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7FjR-0000UY-Kc; Mon, 30 Mar 2026 16:44:53 +0000
Received: by outflank-mailman (input) for mailman id 1268054;
 Mon, 30 Mar 2026 16:44:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w7FjQ-0000UR-KS
 for xen-changelog@lists.xenproject.org; Mon, 30 Mar 2026 16:44:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7FjQ-00HNJG-2c
 for xen-changelog@lists.xenproject.org;
 Mon, 30 Mar 2026 16:44:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7FjQ-00AgyQ-1q
 for xen-changelog@lists.xenproject.org;
 Mon, 30 Mar 2026 16:44:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=7C9ttJqUjbxIxUtrIWKNpxWiuO4MM5Ic/zXNvAh88tE=; b=qt38vWmf7DZi9gheYY4BKXVQDG
	kIk943M59S+VwNyURUszxVq8a99fTM+29qmP9OPLSO98LY6v/wKp3cS+L/q6c2X/zNBxTkI1umpt4
	ws6NP4B2fUFSZkjWs/BKc5xFHDa1N/E/GsPH7rQcS4Qb3H5OLXWOrIjegjw+6N//IMgk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/hvm: Configuration for Linear Address Space Separation
Message-Id: <E1w7FjQ-00AgyQ-1q@xenbits.xenproject.org>
Date: Mon, 30 Mar 2026 16:44:52 +0000

commit 4c607bbb1e6c9a88aece17a1778e2fd7b9af6bbd
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Mar 26 13:18:15 2026 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Mar 30 15:48:13 2026 +0100

    x86/hvm: Configuration for Linear Address Space Separation
    
    LASS is a feature designed in the aftermath of Meltdown, which codifies the
    user/kernel split in address space in order to block entire classes of
    sidechanels.  Specifically, it allows the CPU to terminate any memory access
    into the wrong half of the address space based on linear address alone and
    without needing a pagewalk.
    
    It is available in CPUs starting with Intel Sierra Forrest (2023).
    
    For now, allow LASS to be opted in to, but leave it off by default.  Some work
    in the emulator is going to be needed to enable it by default.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/hvm.c                      | 1 +
 xen/arch/x86/include/asm/x86-defns.h        | 1 +
 xen/include/public/arch-x86/cpufeatureset.h | 2 +-
 3 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 4d37a93c57..b62b058861 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -1019,6 +1019,7 @@ unsigned long hvm_cr4_guest_valid_bits(const struct domain *d)
             (p->feat.pku      ? X86_CR4_PKE               : 0) |
             (cet              ? X86_CR4_CET               : 0) |
             (p->feat.pks      ? X86_CR4_PKS               : 0) |
+            (p->feat.lass     ? X86_CR4_LASS              : 0) |
             0);
 }
 
diff --git a/xen/arch/x86/include/asm/x86-defns.h b/xen/arch/x86/include/asm/x86-defns.h
index 6dae36ef81..cce0f4d990 100644
--- a/xen/arch/x86/include/asm/x86-defns.h
+++ b/xen/arch/x86/include/asm/x86-defns.h
@@ -82,6 +82,7 @@
 #define X86_CR4_PKE        0x00400000 /* enable PKE */
 #define X86_CR4_CET        0x00800000 /* Control-flow Enforcement Technology */
 #define X86_CR4_PKS        0x01000000 /* Protection Key Supervisor */
+#define X86_CR4_LASS       (_AC(1, ULL) << 27) /* Linear Address Space Separation */
 #define X86_CR4_FRED       (_AC(1, ULL) << 32) /* Flexible Return and Event Delivery */
 
 #define X86_CR8_VALID_MASK 0xf
diff --git a/xen/include/public/arch-x86/cpufeatureset.h b/xen/include/public/arch-x86/cpufeatureset.h
index 3bc4f5cad6..438acba4e2 100644
--- a/xen/include/public/arch-x86/cpufeatureset.h
+++ b/xen/include/public/arch-x86/cpufeatureset.h
@@ -304,7 +304,7 @@ XEN_CPUFEATURE(SM3,          10*32+ 1) /*A  SM3 Instructions */
 XEN_CPUFEATURE(SM4,          10*32+ 2) /*A  SM4 Instructions */
 XEN_CPUFEATURE(AVX_VNNI,     10*32+ 4) /*A  AVX-VNNI Instructions */
 XEN_CPUFEATURE(AVX512_BF16,  10*32+ 5) /*A  AVX512 BFloat16 Instructions */
-XEN_CPUFEATURE(LASS,         10*32+ 6) /*   Linear Address Space Separation */
+XEN_CPUFEATURE(LASS,         10*32+ 6) /*s  Linear Address Space Separation */
 XEN_CPUFEATURE(CMPCCXADD,    10*32+ 7) /*a  CMPccXADD Instructions */
 XEN_CPUFEATURE(ARCH_PERF_MON, 10*32+8) /*   Architectural Perfmon */
 XEN_CPUFEATURE(FZRM,         10*32+10) /*A  Fast Zero-length REP MOVSB */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Mar 30 16:45:03 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 30 Mar 2026 16:45:03 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1268055.1557422 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7Fjb-0000Wj-Oc; Mon, 30 Mar 2026 16:45:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1268055.1557422; Mon, 30 Mar 2026 16:45:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7Fjb-0000Wb-Lw; Mon, 30 Mar 2026 16:45:03 +0000
Received: by outflank-mailman (input) for mailman id 1268055;
 Mon, 30 Mar 2026 16:45:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w7Fja-0000WV-Mk
 for xen-changelog@lists.xenproject.org; Mon, 30 Mar 2026 16:45:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7Fja-00HNJi-2s
 for xen-changelog@lists.xenproject.org;
 Mon, 30 Mar 2026 16:45:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7Fja-00AgzI-26
 for xen-changelog@lists.xenproject.org;
 Mon, 30 Mar 2026 16:45:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=qb1FbNwlT0LiHG/TAugAlMFUNws2slPiTHNVqlAd6sA=; b=ZDIr0Ahz6vyKr2Dte2PmBzRkR0
	69biCoGTiyVWcFe/KyDY5ihmqPNEkHsiXif8/ya4kJC1d+1lx99XTfVeaIFKJvs0Jh9mz5BZbKY5E
	P4QmNSEoCBbi532LxJWYGi02cK7uvIkd5Lib1MhsgJb7j+pjfqu2OFEtgCtdZ4WTm8G8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] docs/hypfs: Adjust the hypfs layout example
Message-Id: <E1w7Fja-00AgzI-26@xenbits.xenproject.org>
Date: Mon, 30 Mar 2026 16:45:02 +0000

commit d9fcdb0c7a83eb15a238af3c26f5e9960c90d18f
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Mar 26 19:04:28 2026 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Mar 30 15:48:13 2026 +0100

    docs/hypfs: Adjust the hypfs layout example
    
    The controls for cpu-bugs were ultimately not taken.  As the paths are
    documented fully below, pick only a small subset for the example.  Include
    cpupool/ as it exists now.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
---
 docs/misc/hypfs-paths.pandoc | 37 +++++++------------------------------
 1 file changed, 7 insertions(+), 30 deletions(-)

diff --git a/docs/misc/hypfs-paths.pandoc b/docs/misc/hypfs-paths.pandoc
index e86f7d0dbe..dd089d90df 100644
--- a/docs/misc/hypfs-paths.pandoc
+++ b/docs/misc/hypfs-paths.pandoc
@@ -89,36 +89,13 @@ the hypervisors, and in different configurations.  Specifically:
 A populated Xen hypervisor file system might look like the following example:
 
     /
-        buildinfo/           directory containing build-time data
-            config           contents of .config file used to build Xen
-        cpu-bugs/            x86: directory of cpu bug information
-            l1tf             "Vulnerable" or "Not vulnerable"
-            mds              "Vulnerable" or "Not vulnerable"
-            meltdown         "Vulnerable" or "Not vulnerable"
-            spec-store-bypass "Vulnerable" or "Not vulnerable"
-            spectre-v1       "Vulnerable" or "Not vulnerable"
-            spectre-v2       "Vulnerable" or "Not vulnerable"
-            mitigations/     directory of mitigation settings
-                bti-thunk    "N/A", "RETPOLINE", "LFENCE" or "JMP"
-                spec-ctrl    "No", "IBRS+" or "IBRS-"
-                ibpb         "No" or "Yes"
-                l1d-flush    "No" or "Yes"
-                md-clear     "No" or "VERW"
-                l1tf-barrier "No" or "Yes"
-            active-hvm/      directory for mitigations active in hvm doamins
-                msr-spec-ctrl "No" or "Yes"
-                rsb          "No" or "Yes"
-                eager-fpu    "No" or "Yes"
-                md-clear     "No" or "Yes"
-            active-pv/       directory for mitigations active in pv doamins
-                msr-spec-ctrl "No" or "Yes"
-                rsb          "No" or "Yes"
-                eager-fpu    "No" or "Yes"
-                md-clear     "No" or "Yes"
-                xpti         "No" or list of "dom0", "domU", "PCID-on"
-                l1tf-shadow  "No" or list of "dom0", "domU"
-        params/              directory with hypervisor parameter values
-                             (boot/runtime parameters)
+      buildinfo/             directory containing build-time data
+        config               contents of .config file used to build Xen
+      cpupool/               directory containing CPU Pool data
+        0/                   directory for cpupool 0
+          sched-gran         "cpu", "core" or "socket"
+      params/                directory with hypervisor parameter values
+        loglvl               "none", "error", "warning", "info", "all"
 
 ## General Paths
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Mar 30 16:45:14 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 30 Mar 2026 16:45:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1268056.1557425 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7Fjm-0000Yl-Ps; Mon, 30 Mar 2026 16:45:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1268056.1557425; Mon, 30 Mar 2026 16:45:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7Fjm-0000Yd-NF; Mon, 30 Mar 2026 16:45:14 +0000
Received: by outflank-mailman (input) for mailman id 1268056;
 Mon, 30 Mar 2026 16:45:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w7Fjk-0000YW-PW
 for xen-changelog@lists.xenproject.org; Mon, 30 Mar 2026 16:45:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7Fjk-00HNJo-39
 for xen-changelog@lists.xenproject.org;
 Mon, 30 Mar 2026 16:45:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7Fjk-00Agze-2N
 for xen-changelog@lists.xenproject.org;
 Mon, 30 Mar 2026 16:45:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=tatrxn9o28Fl0V7vgMasc4TqS9EKWljaqw4bhBdWjWU=; b=Zo7mal4MioQiEX63rBsY0wPLxc
	9am6C6v4q3j230dPaf3AGT2RxQh6xinzxhT0MMQADUnkCq4r4dpy5xuYDeuQiBw91eWYxYxTvfQ4q
	nxiRQcMxF5GHy4zTPuFTx9DnuBS1Is2Qn6raq/SWWyJOTaVPGEK5sKMweCVb7kiNFQvU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/fpu: Initialise FTW in xstate_alloc_save_area()
Message-Id: <E1w7Fjk-00Agze-2N@xenbits.xenproject.org>
Date: Mon, 30 Mar 2026 16:45:12 +0000

commit 639de2aafa437fd50abc16a46c8a8dd0d0e9e6a7
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Mar 27 17:16:36 2026 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Mar 30 15:48:13 2026 +0100

    x86/fpu: Initialise FTW in xstate_alloc_save_area()
    
    Right now, xstate_alloc_save_area() leaves both XSTATE_BV and FTW clear.  This
    causes a difference in behaviour between FXRSTOR and XRSTOR.
    
    Switch to using using XSTATE's idea of initial configuration which will behave
    the same even on pre-XSAVE hardware.  Expand the comment to explain why.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/xstate.c | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/xstate.c b/xen/arch/x86/xstate.c
index e990abc9d1..defe9b3f0c 100644
--- a/xen/arch/x86/xstate.c
+++ b/xen/arch/x86/xstate.c
@@ -550,11 +550,22 @@ int xstate_alloc_save_area(struct vcpu *v)
         return -ENOMEM;
 
     /*
-     * Set the memory image to default values, but don't force the context
-     * to be loaded from memory (i.e. keep save_area->xsave_hdr.xstate_bv
-     * clear).
+     * We're creating a vCPU, so conceptually we should be choosing the
+     * architectural #RESET values.
+     *
+     * However for historical reasons of configuring the external
+     * co-processor, FCW's #RESET state is different to what F(N)INIT and
+     * XSTATE consider the "initial configuration".
+     *
+     * Guests won't care about the difference; all software tends to executes
+     * FNINIT very early during setup.
+     *
+     * Use XSTATE's idea of initial configuration.  This allows XSTATE_BV to
+     * remain clear and for CPUs to use the INIT optimisation where
+     * applicable.
      */
     save_area->fpu_sse.fcw = FCW_DEFAULT;
+    save_area->fpu_sse.ftw = FXSAVE_FTW_RESET;
     save_area->fpu_sse.mxcsr = MXCSR_DEFAULT;
 
     v->arch.xsave_area = save_area;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Mar 30 16:45:24 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 30 Mar 2026 16:45:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1268057.1557429 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7Fjw-0000an-Ri; Mon, 30 Mar 2026 16:45:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1268057.1557429; Mon, 30 Mar 2026 16:45:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7Fjw-0000af-Oc; Mon, 30 Mar 2026 16:45:24 +0000
Received: by outflank-mailman (input) for mailman id 1268057;
 Mon, 30 Mar 2026 16:45:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w7Fju-0000aS-So
 for xen-changelog@lists.xenproject.org; Mon, 30 Mar 2026 16:45:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7Fjv-00HNJv-0D
 for xen-changelog@lists.xenproject.org;
 Mon, 30 Mar 2026 16:45:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7Fju-00Ah0B-2f
 for xen-changelog@lists.xenproject.org;
 Mon, 30 Mar 2026 16:45:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=g/aiy0PGnHxdqeUpFfIto2TpmparEAyb2i8wo89JDls=; b=Hz7JREAG5TK9n1b/FGrpxLUNoa
	iG8nH745xMB7GejrXKNHxXqwRrqQnbVqY7cCiw4fyGQGzX5UwSRbxO5Tw5KdPQqiLaxqkwtZsE/yj
	Z9Qi5Yfd1N1ParLNXCFJjjDSWocGjn2fQq0YK5EeNaJg1wvvnELrL34plHksa9riWkjE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86: Always use eager-fpu
Message-Id: <E1w7Fju-00Ah0B-2f@xenbits.xenproject.org>
Date: Mon, 30 Mar 2026 16:45:22 +0000

commit 70a6abd2cd17f11b8de29ca5782233e430e97d9a
Author:     Ross Lagerwall <ross.lagerwall@citrix.com>
AuthorDate: Tue Mar 24 18:19:30 2026 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Mar 30 15:48:13 2026 +0100

    x86: Always use eager-fpu
    
    Lazy FPU avoids some work during a context switch but pushes more
    expensive costs elsewhere:
    
    * For a workload running some Windows VMs, I measured about 83% of
      context switches out had used the FPU so most of the time the FPU
      save/restore is not avoided, just delayed.
    * A key difference between 32-bit and 64-bit OSes is that %xmm is in the
      base featureset for 64-bit and thus gets ubiquitous use in userspace.
      This is likely why we hit 83%.
    * Setting/clearing the cr0.TS bit is serializing and reportedly slower
      than the processor optimized xsave/restore.
    * Linux uses PKRU so a partial xsave/restore is performed on each
      context switch anyway, followed by a second xsave/restore at some
      point during execution. This interferes with the 'modified'
      optimisation that hardware uses to try and reduce the cost of the
      following XSAVE.
    
    There is no measurable performance benefit for using lazy FPU and it
    adds unwanted complexity so remove the option and always use eager-fpu.
    
    Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 docs/misc/xen-command-line.pandoc    |  7 +--
 xen/arch/x86/i387.c                  |  2 +-
 xen/arch/x86/include/asm/spec_ctrl.h |  1 -
 xen/arch/x86/spec_ctrl.c             | 88 ++----------------------------------
 4 files changed, 6 insertions(+), 92 deletions(-)

diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index ebdca007d2..6c77129732 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -2470,7 +2470,7 @@ By default SSBD will be mitigated at runtime (i.e `ssbd=runtime`).
 >              {msr-sc,rsb,verw,{ibpb,bhb}-entry}=<bool>|{pv,hvm}=<bool>,
 >              bti-thunk=retpoline|lfence|jmp,bhb-seq=short|tsx|long,
 >              {ibrs,ibpb,ssbd,psfd,
->              eager-fpu,l1d-flush,branch-harden,srb-lock,
+>              l1d-flush,branch-harden,srb-lock,
 >              unpriv-mmio,gds-mit,div-scrub,lock-harden,
 >              bhi-dis-s,bp-spec-reduce,ibpb-alt}=<bool> ]`
 
@@ -2574,11 +2574,6 @@ On hardware supporting IBPB (Indirect Branch Prediction Barrier), the `ibpb=`
 option can be used to force (the default) or prevent Xen from issuing branch
 prediction barriers on vcpu context switches.
 
-On all hardware, the `eager-fpu=` option can be used to force or prevent Xen
-from using fully eager FPU context switches.  This is currently implemented as
-a global control.  By default, Xen will choose to use fully eager context
-switches on hardware believed to speculate past #NM exceptions.
-
 On hardware supporting L1D_FLUSH, the `l1d-flush=` option can be used to force
 or prevent Xen from issuing an L1 data cache flush on each VMEntry.
 Irrespective of Xen's setting, the feature is virtualised for HVM guests to
diff --git a/xen/arch/x86/i387.c b/xen/arch/x86/i387.c
index b84cd6f7a9..954ba3b179 100644
--- a/xen/arch/x86/i387.c
+++ b/xen/arch/x86/i387.c
@@ -297,7 +297,7 @@ void save_fpu_enable(void)
 /* Initialize FPU's context save area */
 int vcpu_init_fpu(struct vcpu *v)
 {
-    v->arch.fully_eager_fpu = opt_eager_fpu;
+    v->arch.fully_eager_fpu = true;
 
     return xstate_alloc_save_area(v);
 }
diff --git a/xen/arch/x86/include/asm/spec_ctrl.h b/xen/arch/x86/include/asm/spec_ctrl.h
index 505e3ab863..8f82533c41 100644
--- a/xen/arch/x86/include/asm/spec_ctrl.h
+++ b/xen/arch/x86/include/asm/spec_ctrl.h
@@ -79,7 +79,6 @@ static always_inline void spec_ctrl_new_guest_context(void)
 extern int8_t opt_ibpb_ctxt_switch;
 extern bool opt_ssbd;
 extern int8_t opt_bhi_dis_s;
-extern int8_t opt_eager_fpu;
 extern int8_t opt_l1d_flush;
 
 extern bool bsp_delay_spec_ctrl;
diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c
index dd0413e1fc..bc8538a56f 100644
--- a/xen/arch/x86/spec_ctrl.c
+++ b/xen/arch/x86/spec_ctrl.c
@@ -61,7 +61,6 @@ static int8_t __initdata opt_psfd = -1;
 int8_t __ro_after_init opt_bhi_dis_s = -1;
 
 int8_t __ro_after_init opt_ibpb_ctxt_switch = -1;
-int8_t __ro_after_init opt_eager_fpu = -1;
 int8_t __ro_after_init opt_l1d_flush = -1;
 static bool __initdata opt_branch_harden =
     IS_ENABLED(CONFIG_SPECULATIVE_HARDEN_BRANCH);
@@ -104,8 +103,6 @@ static int __init cf_check parse_spec_ctrl(const char *s)
             opt_msr_sc_pv = false;
             opt_msr_sc_hvm = false;
 
-            opt_eager_fpu = 0;
-
             if ( opt_xpti_hwdom < 0 )
                 opt_xpti_hwdom = 0;
             if ( opt_xpti_domu < 0 )
@@ -336,8 +333,6 @@ static int __init cf_check parse_spec_ctrl(const char *s)
         /* Misc settings. */
         else if ( (val = parse_boolean("ibpb", s, ss)) >= 0 )
             opt_ibpb_ctxt_switch = val;
-        else if ( (val = parse_boolean("eager-fpu", s, ss)) >= 0 )
-            opt_eager_fpu = val;
         else if ( (val = parse_boolean("l1d-flush", s, ss)) >= 0 )
             opt_l1d_flush = val;
         else if ( (val = parse_boolean("branch-harden", s, ss)) >= 0 )
@@ -648,32 +643,30 @@ static void __init print_details(enum ind_thunk thunk)
      * mitigation support for guests.
      */
 #ifdef CONFIG_HVM
-    printk("  Support for HVM VMs:%s%s%s%s%s%s%s%s\n",
+    printk("  Support for HVM VMs:%s%s%s%s%s%s%s\n",
            (boot_cpu_has(X86_FEATURE_SC_MSR_HVM) ||
             boot_cpu_has(X86_FEATURE_SC_RSB_HVM) ||
             boot_cpu_has(X86_FEATURE_IBPB_ENTRY_HVM) ||
             opt_bhb_entry_hvm || amd_virt_spec_ctrl ||
-            opt_eager_fpu || opt_verw_hvm)           ? ""               : " None",
+            opt_verw_hvm)                            ? ""               : " None",
            boot_cpu_has(X86_FEATURE_SC_MSR_HVM)      ? " MSR_SPEC_CTRL" : "",
            (boot_cpu_has(X86_FEATURE_SC_MSR_HVM) ||
             amd_virt_spec_ctrl)                      ? " MSR_VIRT_SPEC_CTRL" : "",
            boot_cpu_has(X86_FEATURE_SC_RSB_HVM)      ? " RSB"           : "",
-           opt_eager_fpu                             ? " EAGER_FPU"     : "",
            opt_verw_hvm                              ? " VERW"          : "",
            boot_cpu_has(X86_FEATURE_IBPB_ENTRY_HVM)  ? " IBPB-entry"    : "",
            opt_bhb_entry_hvm                         ? " BHB-entry"     : "");
 
 #endif
 #ifdef CONFIG_PV
-    printk("  Support for PV VMs:%s%s%s%s%s%s%s\n",
+    printk("  Support for PV VMs:%s%s%s%s%s%s\n",
            (boot_cpu_has(X86_FEATURE_SC_MSR_PV) ||
             boot_cpu_has(X86_FEATURE_SC_RSB_PV) ||
             boot_cpu_has(X86_FEATURE_IBPB_ENTRY_PV) ||
             opt_bhb_entry_pv ||
-            opt_eager_fpu || opt_verw_pv)            ? ""               : " None",
+            opt_verw_pv)                             ? ""               : " None",
            boot_cpu_has(X86_FEATURE_SC_MSR_PV)       ? " MSR_SPEC_CTRL" : "",
            boot_cpu_has(X86_FEATURE_SC_RSB_PV)       ? " RSB"           : "",
-           opt_eager_fpu                             ? " EAGER_FPU"     : "",
            opt_verw_pv                               ? " VERW"          : "",
            boot_cpu_has(X86_FEATURE_IBPB_ENTRY_PV)   ? " IBPB-entry"    : "",
            opt_bhb_entry_pv                          ? " BHB-entry"     : "");
@@ -959,75 +952,6 @@ static bool __init rsb_is_full_width(void)
     return true;
 }
 
-/* Calculate whether this CPU speculates past #NM */
-static bool __init should_use_eager_fpu(void)
-{
-    /*
-     * Assume all unrecognised processors are ok.  This is only known to
-     * affect Intel Family 6 processors.
-     */
-    if ( boot_cpu_data.vendor != X86_VENDOR_INTEL ||
-         boot_cpu_data.family != 6 )
-        return false;
-
-    switch ( boot_cpu_data.model )
-    {
-        /*
-         * Core processors since at least Nehalem are vulnerable.
-         */
-    case 0x1e: /* Nehalem */
-    case 0x1f: /* Auburndale / Havendale */
-    case 0x1a: /* Nehalem EP */
-    case 0x2e: /* Nehalem EX */
-    case 0x25: /* Westmere */
-    case 0x2c: /* Westmere EP */
-    case 0x2f: /* Westmere EX */
-    case 0x2a: /* SandyBridge */
-    case 0x2d: /* SandyBridge EP/EX */
-    case 0x3a: /* IvyBridge */
-    case 0x3e: /* IvyBridge EP/EX */
-    case 0x3c: /* Haswell */
-    case 0x3f: /* Haswell EX/EP */
-    case 0x45: /* Haswell D */
-    case 0x46: /* Haswell H */
-    case 0x3d: /* Broadwell */
-    case 0x47: /* Broadwell H */
-    case 0x4f: /* Broadwell EP/EX */
-    case 0x56: /* Broadwell D */
-    case 0x4e: /* Skylake M */
-    case 0x55: /* Skylake X */
-    case 0x5e: /* Skylake D */
-    case 0x66: /* Cannonlake */
-    case 0x67: /* Cannonlake? */
-    case 0x8e: /* Kabylake M */
-    case 0x9e: /* Kabylake D */
-        return true;
-
-        /*
-         * Atom processors are not vulnerable.
-         */
-    case 0x1c: /* Pineview */
-    case 0x26: /* Lincroft */
-    case 0x27: /* Penwell */
-    case 0x35: /* Cloverview */
-    case 0x36: /* Cedarview */
-    case 0x37: /* Baytrail / Valleyview (Silvermont) */
-    case 0x4d: /* Avaton / Rangely (Silvermont) */
-    case 0x4c: /* Cherrytrail / Brasswell */
-    case 0x4a: /* Merrifield */
-    case 0x5a: /* Moorefield */
-    case 0x5c: /* Goldmont */
-    case 0x5f: /* Denverton */
-    case 0x7a: /* Gemini Lake */
-        return false;
-
-    default:
-        printk("Unrecognised CPU model %#x - assuming vulnerable to LazyFPU\n",
-               boot_cpu_data.model);
-        return true;
-    }
-}
-
 /*
  * https://www.amd.com/content/dam/amd/en/documents/corporate/cr/speculative-return-stack-overflow-whitepaper.pdf
  */
@@ -2221,10 +2145,6 @@ void __init init_speculation_mitigations(void)
 
     div_calculations(hw_smt_enabled);
 
-    /* Check whether Eager FPU should be enabled by default. */
-    if ( opt_eager_fpu == -1 )
-        opt_eager_fpu = should_use_eager_fpu();
-
     /* (Re)init BSP state now that default_scf has been calculated. */
     init_shadow_spec_ctrl_state(get_cpu_info());
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Mar 30 16:45:34 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 30 Mar 2026 16:45:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1268058.1557434 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7Fk6-0000dJ-Ug; Mon, 30 Mar 2026 16:45:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1268058.1557434; Mon, 30 Mar 2026 16:45:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7Fk6-0000dC-S8; Mon, 30 Mar 2026 16:45:34 +0000
Received: by outflank-mailman (input) for mailman id 1268058;
 Mon, 30 Mar 2026 16:45:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w7Fk4-0000d0-W3
 for xen-changelog@lists.xenproject.org; Mon, 30 Mar 2026 16:45:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7Fk5-00HNK1-0W
 for xen-changelog@lists.xenproject.org;
 Mon, 30 Mar 2026 16:45:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7Fk4-00Ah2B-2z
 for xen-changelog@lists.xenproject.org;
 Mon, 30 Mar 2026 16:45:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=G7HoAx5G58NtA45preHv92hzWMy/D3IVmY1BBVkR7rw=; b=C3ZMwaZQgwZL61g+ZOc2nDNldh
	GFqPjcijFdIQWAOf/chKAa1leQArSydsRBmBnYm/fyj54f7GTy+WCny3u1SmQhz5N3p1Bck4OiXYK
	iLIbqh+4P+5YsT21wsVW/fwRFLyHNZ0qa6oImsQ3Q9cHO7pMUX5CBEmh8BEElZBluyzE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/vmx: Remove lazy FPU support
Message-Id: <E1w7Fk4-00Ah2B-2z@xenbits.xenproject.org>
Date: Mon, 30 Mar 2026 16:45:32 +0000

commit 511ab162efe42bd914f698cbbfe938b4576627e5
Author:     Ross Lagerwall <ross.lagerwall@citrix.com>
AuthorDate: Tue Mar 24 18:19:31 2026 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Mar 30 15:48:13 2026 +0100

    x86/vmx: Remove lazy FPU support
    
    Remove lazy FPU support from the VMX code since fully_eager_fpu is now
    always true.
    
    No functional change intended.
    
    Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/hvm/vmx/vmcs.c             |  8 +---
 xen/arch/x86/hvm/vmx/vmx.c              | 70 +--------------------------------
 xen/arch/x86/hvm/vmx/vvmx.c             | 15 +------
 xen/arch/x86/include/asm/hvm/vmx/vmcs.h |  2 -
 4 files changed, 5 insertions(+), 90 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c
index c2e7f9aed3..8e52ef4d49 100644
--- a/xen/arch/x86/hvm/vmx/vmcs.c
+++ b/xen/arch/x86/hvm/vmx/vmcs.c
@@ -1247,10 +1247,7 @@ static int construct_vmcs(struct vcpu *v)
     __vmwrite(HOST_TR_SELECTOR, TSS_SELECTOR);
 
     /* Host control registers. */
-    v->arch.hvm.vmx.host_cr0 = read_cr0() & ~X86_CR0_TS;
-    if ( !v->arch.fully_eager_fpu )
-        v->arch.hvm.vmx.host_cr0 |= X86_CR0_TS;
-    __vmwrite(HOST_CR0, v->arch.hvm.vmx.host_cr0);
+    __vmwrite(HOST_CR0, read_cr0());
     __vmwrite(HOST_CR4, mmu_cr4_features);
     if ( cpu_has_vmx_efer )
         __vmwrite(HOST_EFER, read_efer());
@@ -1330,8 +1327,7 @@ static int construct_vmcs(struct vcpu *v)
     __vmwrite(VMCS_LINK_POINTER, ~0UL);
 
     v->arch.hvm.vmx.exception_bitmap = HVM_TRAP_MASK
-              | (paging_mode_hap(d) ? 0 : (1U << X86_EXC_PF))
-              | (v->arch.fully_eager_fpu ? 0 : (1U << X86_EXC_NM));
+              | (paging_mode_hap(d) ? 0 : (1U << X86_EXC_PF));
 
     if ( cpu_has_vmx_notify_vm_exiting )
         __vmwrite(NOTIFY_WINDOW, vm_notify_window);
diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index 82c55f49ae..03daf2f52b 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -68,7 +68,6 @@ static void cf_check vmx_update_guest_cr(
     struct vcpu *v, unsigned int cr, unsigned int flags);
 static void cf_check vmx_update_guest_efer(struct vcpu *v);
 static void cf_check vmx_wbinvd_intercept(void);
-static void cf_check vmx_fpu_dirty_intercept(void);
 static int cf_check vmx_msr_read_intercept(
     unsigned int msr, uint64_t *msr_content);
 static int cf_check vmx_msr_write_intercept(
@@ -1130,41 +1129,6 @@ static int cf_check vmx_load_vmcs_ctxt(struct vcpu *v, struct hvm_hw_cpu *ctxt)
     return 0;
 }
 
-static void vmx_fpu_enter(struct vcpu *v)
-{
-    vcpu_restore_fpu_lazy(v);
-    v->arch.hvm.vmx.exception_bitmap &= ~(1u << X86_EXC_NM);
-    vmx_update_exception_bitmap(v);
-    v->arch.hvm.vmx.host_cr0 &= ~X86_CR0_TS;
-    __vmwrite(HOST_CR0, v->arch.hvm.vmx.host_cr0);
-}
-
-static void cf_check vmx_fpu_leave(struct vcpu *v)
-{
-    ASSERT(!v->fpu_dirtied);
-    ASSERT(read_cr0() & X86_CR0_TS);
-
-    if ( !(v->arch.hvm.vmx.host_cr0 & X86_CR0_TS) )
-    {
-        v->arch.hvm.vmx.host_cr0 |= X86_CR0_TS;
-        __vmwrite(HOST_CR0, v->arch.hvm.vmx.host_cr0);
-    }
-
-    /*
-     * If the guest does not have TS enabled then we must cause and handle an
-     * exception on first use of the FPU. If the guest *does* have TS enabled
-     * then this is not necessary: no FPU activity can occur until the guest
-     * clears CR0.TS, and we will initialise the FPU when that happens.
-     */
-    if ( !(v->arch.hvm.guest_cr[0] & X86_CR0_TS) )
-    {
-        v->arch.hvm.hw_cr[0] |= X86_CR0_TS;
-        __vmwrite(GUEST_CR0, v->arch.hvm.hw_cr[0]);
-        v->arch.hvm.vmx.exception_bitmap |= (1u << X86_EXC_NM);
-        vmx_update_exception_bitmap(v);
-    }
-}
-
 static void cf_check vmx_ctxt_switch_from(struct vcpu *v)
 {
     /*
@@ -1187,8 +1151,6 @@ static void cf_check vmx_ctxt_switch_from(struct vcpu *v)
         vmx_vmcs_reload(v);
     }
 
-    if ( !v->arch.fully_eager_fpu )
-        vmx_fpu_leave(v);
     vmx_save_guest_msrs(v);
     vmx_restore_host_msrs();
     vmx_save_dr(v);
@@ -1771,17 +1733,6 @@ static void cf_check vmx_update_guest_cr(
         else
             nvmx_set_cr_read_shadow(v, 0);
 
-        if ( !(v->arch.hvm.guest_cr[0] & X86_CR0_TS) )
-        {
-            if ( v != current )
-            {
-                if ( !v->arch.fully_eager_fpu )
-                    hw_cr0_mask |= X86_CR0_TS;
-            }
-            else if ( v->arch.hvm.hw_cr[0] & X86_CR0_TS )
-                vmx_fpu_enter(v);
-        }
-
         realmode = !(v->arch.hvm.guest_cr[0] & X86_CR0_PE);
 
         if ( !vmx_unrestricted_guest(v) &&
@@ -2915,7 +2866,6 @@ static struct hvm_function_table __initdata_cf_clobber vmx_function_table = {
     .update_guest_cr      = vmx_update_guest_cr,
     .update_guest_efer    = vmx_update_guest_efer,
     .cpuid_policy_changed = vmx_cpuid_policy_changed,
-    .fpu_leave            = vmx_fpu_leave,
     .set_guest_pat        = vmx_set_guest_pat,
     .get_guest_pat        = vmx_get_guest_pat,
     .set_tsc_offset       = vmx_set_tsc_offset,
@@ -2927,7 +2877,6 @@ static struct hvm_function_table __initdata_cf_clobber vmx_function_table = {
     .cpu_up               = vmx_cpu_up,
     .cpu_down             = vmx_cpu_down,
     .wbinvd_intercept     = vmx_wbinvd_intercept,
-    .fpu_dirty_intercept  = vmx_fpu_dirty_intercept,
     .msr_read_intercept   = vmx_msr_read_intercept,
     .msr_write_intercept  = vmx_msr_write_intercept,
     .handle_cd            = vmx_handle_cd,
@@ -3281,20 +3230,6 @@ void update_guest_eip(void)
         hvm_inject_hw_exception(X86_EXC_DB, X86_EVENT_NO_EC);
 }
 
-static void cf_check vmx_fpu_dirty_intercept(void)
-{
-    struct vcpu *curr = current;
-
-    vmx_fpu_enter(curr);
-
-    /* Disable TS in guest CR0 unless the guest wants the exception too. */
-    if ( !(curr->arch.hvm.guest_cr[0] & X86_CR0_TS) )
-    {
-        curr->arch.hvm.hw_cr[0] &= ~X86_CR0_TS;
-        __vmwrite(GUEST_CR0, curr->arch.hvm.hw_cr[0]);
-    }
-}
-
 static void vmx_dr_access(unsigned long exit_qualification,
                           struct cpu_user_regs *regs)
 {
@@ -4543,10 +4478,7 @@ void asmlinkage vmx_vmexit_handler(struct cpu_user_regs *regs)
                 domain_pause_for_debugger();
             }
             break;
-        case X86_EXC_NM:
-            TRACE(TRC_HVM_TRAP, vector);
-            vmx_fpu_dirty_intercept();
-            break;
+
         case X86_EXC_PF:
             __vmread(EXIT_QUALIFICATION, &exit_qualification);
             __vmread(VM_EXIT_INTR_ERROR_CODE, &ecode);
diff --git a/xen/arch/x86/hvm/vmx/vvmx.c b/xen/arch/x86/hvm/vmx/vvmx.c
index 38952f0696..e4cdfe55c1 100644
--- a/xen/arch/x86/hvm/vmx/vvmx.c
+++ b/xen/arch/x86/hvm/vmx/vvmx.c
@@ -1238,9 +1238,6 @@ static void virtual_vmentry(struct cpu_user_regs *regs)
     regs->rsp = get_vvmcs(v, GUEST_RSP);
     regs->rflags = get_vvmcs(v, GUEST_RFLAGS);
 
-    /* updating host cr0 to sync TS bit */
-    __vmwrite(HOST_CR0, v->arch.hvm.vmx.host_cr0);
-
     /* Setup virtual ETP for L2 guest*/
     if ( nestedhvm_paging_mode_hap(v) )
         /* This will setup the initial np2m for the nested vCPU */
@@ -1468,9 +1465,6 @@ static void virtual_vmexit(struct cpu_user_regs *regs)
     /* VM exit clears all bits except bit 1 */
     regs->rflags = X86_EFLAGS_MBS;
 
-    /* updating host cr0 to sync TS bit */
-    __vmwrite(HOST_CR0, v->arch.hvm.vmx.host_cr0);
-
     if ( cpu_has_vmx_virtual_intr_delivery )
         nvmx_update_apicv(v);
 
@@ -2458,19 +2452,14 @@ int nvmx_n2_vmexit_handler(struct cpu_user_regs *regs,
         __vmread(VM_EXIT_INTR_INFO, &intr_info);
         vector = intr_info & INTR_INFO_VECTOR_MASK;
         /*
-         * decided by L0 and L1 exception bitmap, if the vetor is set by
-         * both, L0 has priority on #PF and #NM, L1 has priority on others
+         * decided by L0 and L1 exception bitmap, if the vector is set by
+         * both, L0 has priority on #PF, L1 has priority on others
          */
         if ( vector == X86_EXC_PF )
         {
             if ( paging_mode_hap(v->domain) )
                 nvcpu->nv_vmexit_pending = 1;
         }
-        else if ( vector == X86_EXC_NM )
-        {
-            if ( v->fpu_dirtied )
-                nvcpu->nv_vmexit_pending = 1;
-        }
         else if ( (intr_info & valid_mask) == valid_mask )
         {
             exec_bitmap = get_vvmcs(v, EXCEPTION_BITMAP);
diff --git a/xen/arch/x86/include/asm/hvm/vmx/vmcs.h b/xen/arch/x86/include/asm/hvm/vmx/vmcs.h
index 879ec10cef..88bded5190 100644
--- a/xen/arch/x86/include/asm/hvm/vmx/vmcs.h
+++ b/xen/arch/x86/include/asm/hvm/vmx/vmcs.h
@@ -149,8 +149,6 @@ struct vmx_vcpu {
     DECLARE_BITMAP(eoi_exit_bitmap, X86_IDT_VECTORS);
     struct pi_desc       pi_desc;
 
-    unsigned long        host_cr0;
-
     /* Do we need to tolerate a spurious EPT_MISCONFIG VM exit? */
     bool                 ept_spurious_misconfig;
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Mar 30 16:45:45 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 30 Mar 2026 16:45:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1268059.1557438 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7FkG-0000fk-WA; Mon, 30 Mar 2026 16:45:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1268059.1557438; Mon, 30 Mar 2026 16:45:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7FkG-0000fc-Tf; Mon, 30 Mar 2026 16:45:44 +0000
Received: by outflank-mailman (input) for mailman id 1268059;
 Mon, 30 Mar 2026 16:45:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w7FkF-0000fP-2T
 for xen-changelog@lists.xenproject.org; Mon, 30 Mar 2026 16:45:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7FkF-00HNMi-0q
 for xen-changelog@lists.xenproject.org;
 Mon, 30 Mar 2026 16:45:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7FkF-00Ah5H-03
 for xen-changelog@lists.xenproject.org;
 Mon, 30 Mar 2026 16:45:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=5IZbwaUmU9YsBB1R183DnKgvx/S5RoGNlyM3NcbVYhQ=; b=LPksp/2r3EwzH5CfZ9jXoqFEKN
	4/yDv3Kc/8PlNF7rkUgR0wpIHUL8I5N1GazX4cZCwW4Paj+SrEnKpfF6r+fiXpBb9x2vFm63F4u5D
	GKtwtAILTSjMPpDjOIkmLnHDNvsGR5zYCsPLdTKK4w7CBWA3GTDUHbhBNA4tmVo4fSOg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/svm: Remove lazy FPU support
Message-Id: <E1w7FkF-00Ah5H-03@xenbits.xenproject.org>
Date: Mon, 30 Mar 2026 16:45:43 +0000

commit 3356d685dbdaf8f442c652fc216ecbc20bc7f6e3
Author:     Ross Lagerwall <ross.lagerwall@citrix.com>
AuthorDate: Tue Mar 24 18:19:32 2026 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Mar 30 15:48:13 2026 +0100

    x86/svm: Remove lazy FPU support
    
    Remove lazy FPU support from the SVM code since fully_eager_fpu is now
    always true.
    
    No functional change intended.
    
    Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/hvm/svm/nestedsvm.c         | 67 +-------------------------
 xen/arch/x86/hvm/svm/svm.c               | 81 +-------------------------------
 xen/arch/x86/hvm/svm/vmcb.c              |  4 +-
 xen/arch/x86/include/asm/hvm/svm-types.h |  6 ---
 4 files changed, 4 insertions(+), 154 deletions(-)

diff --git a/xen/arch/x86/hvm/svm/nestedsvm.c b/xen/arch/x86/hvm/svm/nestedsvm.c
index a63ec61346..ef6fa5d23b 100644
--- a/xen/arch/x86/hvm/svm/nestedsvm.c
+++ b/xen/arch/x86/hvm/svm/nestedsvm.c
@@ -165,58 +165,6 @@ int cf_check nsvm_vcpu_reset(struct vcpu *v)
     return 0;
 }
 
-static uint64_t nestedsvm_fpu_vmentry(uint64_t n1cr0,
-    struct vmcb_struct *vvmcb,
-    struct vmcb_struct *n1vmcb, struct vmcb_struct *n2vmcb)
-{
-    uint64_t vcr0;
-
-    vcr0 = vvmcb->_cr0;
-    if ( !(n1cr0 & X86_CR0_TS) && (n1vmcb->_cr0 & X86_CR0_TS) )
-    {
-        /*
-         * svm_fpu_leave() run while l1 guest was running.
-         * Sync FPU state with l2 guest.
-         */
-        vcr0 |= X86_CR0_TS;
-        n2vmcb->_exception_intercepts |= (1U << X86_EXC_NM);
-    }
-    else if ( !(vcr0 & X86_CR0_TS) && (n2vmcb->_cr0 & X86_CR0_TS) )
-    {
-        /*
-         * svm_fpu_enter() run while l1 guest was running.
-         * Sync FPU state with l2 guest.
-         */
-        vcr0 &= ~X86_CR0_TS;
-        n2vmcb->_exception_intercepts &= ~(1U << X86_EXC_NM);
-    }
-
-    return vcr0;
-}
-
-static void nestedsvm_fpu_vmexit(struct vmcb_struct *n1vmcb,
-    struct vmcb_struct *n2vmcb, uint64_t n1cr0, uint64_t guest_cr0)
-{
-    if ( !(guest_cr0 & X86_CR0_TS) && (n2vmcb->_cr0 & X86_CR0_TS) )
-    {
-        /*
-         * svm_fpu_leave() run while l2 guest was running.
-         * Sync FPU state with l1 guest.
-         */
-        n1vmcb->_cr0 |= X86_CR0_TS;
-        n1vmcb->_exception_intercepts |= (1U << X86_EXC_NM);
-    }
-    else if ( !(n1cr0 & X86_CR0_TS) && (n1vmcb->_cr0 & X86_CR0_TS) )
-    {
-        /*
-         * svm_fpu_enter() run while l2 guest was running.
-         * Sync FPU state with l1 guest.
-         */
-        n1vmcb->_cr0 &= ~X86_CR0_TS;
-        n1vmcb->_exception_intercepts &= ~(1U << X86_EXC_NM);
-    }
-}
-
 static int nsvm_vcpu_hostsave(struct vcpu *v, unsigned int inst_len)
 {
     struct nestedsvm *svm = &vcpu_nestedsvm(v);
@@ -246,7 +194,6 @@ static int nsvm_vcpu_hostsave(struct vcpu *v, unsigned int inst_len)
 static int nsvm_vcpu_hostrestore(struct vcpu *v, struct cpu_user_regs *regs)
 {
     struct nestedvcpu *nv = &vcpu_nestedhvm(v);
-    struct nestedsvm *svm = &vcpu_nestedsvm(v);
     struct vmcb_struct *n1vmcb, *n2vmcb;
     int rc;
 
@@ -281,8 +228,6 @@ static int nsvm_vcpu_hostrestore(struct vcpu *v, struct cpu_user_regs *regs)
         gdprintk(XENLOG_ERR, "hvm_set_cr4 failed, rc: %u\n", rc);
 
     /* CR0 */
-    nestedsvm_fpu_vmexit(n1vmcb, n2vmcb,
-        svm->ns_cr0, v->arch.hvm.guest_cr[0]);
     v->arch.hvm.guest_cr[0] = n1vmcb->_cr0 | X86_CR0_PE;
     n1vmcb->rflags &= ~X86_EFLAGS_VM;
     rc = hvm_set_cr0(n1vmcb->_cr0 | X86_CR0_PE, true);
@@ -290,7 +235,6 @@ static int nsvm_vcpu_hostrestore(struct vcpu *v, struct cpu_user_regs *regs)
         hvm_inject_hw_exception(X86_EXC_GP, 0);
     if ( rc != X86EMUL_OKAY )
         gdprintk(XENLOG_ERR, "hvm_set_cr0 failed, rc: %u\n", rc);
-    svm->ns_cr0 = v->arch.hvm.guest_cr[0];
 
     /* CR2 */
     v->arch.hvm.guest_cr[2] = n1vmcb->_cr2;
@@ -418,7 +362,6 @@ static int nsvm_vmcb_prepare4vmrun(struct vcpu *v, struct cpu_user_regs *regs)
     struct vmcb_struct *ns_vmcb, *n1vmcb, *n2vmcb;
     vmcbcleanbits_t clean = {};
     int rc;
-    uint64_t cr0;
 
     ns_vmcb = nv->nv_vvmcx;
     n1vmcb = nv->nv_n1vmcx;
@@ -452,7 +395,6 @@ static int nsvm_vmcb_prepare4vmrun(struct vcpu *v, struct cpu_user_regs *regs)
      *   safed here.
      * The overhead comes from (ordered from highest to lowest):
      * - svm_ctxt_switch_to (CPU context switching)
-     * - svm_fpu_enter, svm_fpu_leave (lazy FPU switching)
      * - emulated CLGI (clears VINTR intercept)
      * - host clears VINTR intercept
      * Test results show that the overhead is high enough that the
@@ -551,10 +493,8 @@ static int nsvm_vmcb_prepare4vmrun(struct vcpu *v, struct cpu_user_regs *regs)
         gdprintk(XENLOG_ERR, "hvm_set_cr4 failed, rc: %u\n", rc);
 
     /* CR0 */
-    svm->ns_cr0 = v->arch.hvm.guest_cr[0];
-    cr0 = nestedsvm_fpu_vmentry(svm->ns_cr0, ns_vmcb, n1vmcb, n2vmcb);
     v->arch.hvm.guest_cr[0] = ns_vmcb->_cr0;
-    rc = hvm_set_cr0(cr0, true);
+    rc = hvm_set_cr0(ns_vmcb->_cr0, true);
     if ( rc == X86EMUL_EXCEPTION )
         hvm_inject_hw_exception(X86_EXC_GP, 0);
     if ( rc != X86EMUL_OKAY )
@@ -1305,11 +1245,6 @@ nestedsvm_check_intercepts(struct vcpu *v, struct cpu_user_regs *regs,
     case VMEXIT_INTR:
     case VMEXIT_NMI:
         return NESTEDHVM_VMEXIT_HOST;
-    case VMEXIT_EXCEPTION_NM:
-        /* Host must handle lazy fpu context switching first.
-         * Then inject the VMEXIT if L1 guest intercepts this.
-         */
-        return NESTEDHVM_VMEXIT_HOST;
 
     case VMEXIT_NPF:
         if ( nestedhvm_paging_mode_hap(v) )
diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
index 243c41fb13..2546705d24 100644
--- a/xen/arch/x86/hvm/svm/svm.c
+++ b/xen/arch/x86/hvm/svm/svm.c
@@ -104,38 +104,6 @@ static void cf_check svm_cpu_down(void)
     write_efer(read_efer() & ~EFER_SVME);
 }
 
-static void svm_fpu_enter(struct vcpu *v)
-{
-    struct vmcb_struct *n1vmcb = vcpu_nestedhvm(v).nv_n1vmcx;
-
-    vcpu_restore_fpu_lazy(v);
-    vmcb_set_exception_intercepts(
-        n1vmcb,
-        vmcb_get_exception_intercepts(n1vmcb) & ~(1U << X86_EXC_NM));
-}
-
-static void cf_check svm_fpu_leave(struct vcpu *v)
-{
-    struct vmcb_struct *n1vmcb = vcpu_nestedhvm(v).nv_n1vmcx;
-
-    ASSERT(!v->fpu_dirtied);
-    ASSERT(read_cr0() & X86_CR0_TS);
-
-    /*
-     * If the guest does not have TS enabled then we must cause and handle an
-     * exception on first use of the FPU. If the guest *does* have TS enabled
-     * then this is not necessary: no FPU activity can occur until the guest
-     * clears CR0.TS, and we will initialise the FPU when that happens.
-     */
-    if ( !(v->arch.hvm.guest_cr[0] & X86_CR0_TS) )
-    {
-        vmcb_set_exception_intercepts(
-            n1vmcb,
-            vmcb_get_exception_intercepts(n1vmcb) | (1U << X86_EXC_NM));
-        vmcb_set_cr0(n1vmcb, vmcb_get_cr0(n1vmcb) | X86_CR0_TS);
-    }
-}
-
 static void cf_check svm_update_guest_cr(
     struct vcpu *v, unsigned int cr, unsigned int flags)
 {
@@ -145,20 +113,6 @@ static void cf_check svm_update_guest_cr(
     switch ( cr )
     {
     case 0:
-    {
-        unsigned long hw_cr0_mask = 0;
-
-        if ( !(v->arch.hvm.guest_cr[0] & X86_CR0_TS) )
-        {
-            if ( v != current )
-            {
-                if ( !v->arch.fully_eager_fpu )
-                    hw_cr0_mask |= X86_CR0_TS;
-            }
-            else if ( vmcb_get_cr0(vmcb) & X86_CR0_TS )
-                svm_fpu_enter(v);
-        }
-
         if ( paging_mode_hap(v->domain) )
         {
             uint32_t intercepts = vmcb_get_cr_intercepts(vmcb);
@@ -169,12 +123,12 @@ static void cf_check svm_update_guest_cr(
                vmcb_set_cr_intercepts(vmcb, intercepts | CR_INTERCEPT_CR3_WRITE);
         }
 
-        value = v->arch.hvm.guest_cr[0] | hw_cr0_mask;
+        value = v->arch.hvm.guest_cr[0];
         if ( paging_mode_shadow(v->domain) )
             value |= X86_CR0_PG | X86_CR0_WP;
         vmcb_set_cr0(vmcb, value);
         break;
-    }
+
     case 2:
         vmcb_set_cr2(vmcb, v->arch.hvm.guest_cr[2]);
         break;
@@ -909,9 +863,6 @@ static void cf_check svm_ctxt_switch_from(struct vcpu *v)
     if ( unlikely((read_efer() & EFER_SVME) == 0) )
         return;
 
-    if ( !v->arch.fully_eager_fpu )
-        svm_fpu_leave(v);
-
     svm_save_dr(v);
     svm_tsc_ratio_save(v);
 
@@ -1678,28 +1629,6 @@ static void svm_do_nested_pgfault(struct vcpu *v,
     domain_crash(v->domain);
 }
 
-static void cf_check svm_fpu_dirty_intercept(void)
-{
-    struct vcpu *v = current;
-    struct vmcb_struct *vmcb = v->arch.hvm.svm.vmcb;
-    struct vmcb_struct *n1vmcb = vcpu_nestedhvm(v).nv_n1vmcx;
-
-    svm_fpu_enter(v);
-
-    if ( vmcb != n1vmcb )
-    {
-       /* Check if l1 guest must make FPU ready for the l2 guest */
-       if ( v->arch.hvm.guest_cr[0] & X86_CR0_TS )
-           hvm_inject_hw_exception(X86_EXC_NM, X86_EVENT_NO_EC);
-       else
-           vmcb_set_cr0(n1vmcb, vmcb_get_cr0(n1vmcb) & ~X86_CR0_TS);
-       return;
-    }
-
-    if ( !(v->arch.hvm.guest_cr[0] & X86_CR0_TS) )
-        vmcb_set_cr0(vmcb, vmcb_get_cr0(vmcb) & ~X86_CR0_TS);
-}
-
 static void svm_vmexit_do_cr_access(
     struct vmcb_struct *vmcb, struct cpu_user_regs *regs)
 {
@@ -2459,7 +2388,6 @@ static struct hvm_function_table __initdata_cf_clobber svm_function_table = {
     .update_guest_cr      = svm_update_guest_cr,
     .update_guest_efer    = svm_update_guest_efer,
     .cpuid_policy_changed = svm_cpuid_policy_changed,
-    .fpu_leave            = svm_fpu_leave,
     .set_guest_pat        = svm_set_guest_pat,
     .get_guest_pat        = svm_get_guest_pat,
     .set_tsc_offset       = svm_set_tsc_offset,
@@ -2469,7 +2397,6 @@ static struct hvm_function_table __initdata_cf_clobber svm_function_table = {
     .get_pending_event    = svm_get_pending_event,
     .invlpg               = svm_invlpg,
     .wbinvd_intercept     = svm_wbinvd_intercept,
-    .fpu_dirty_intercept  = svm_fpu_dirty_intercept,
     .msr_read_intercept   = svm_msr_read_intercept,
     .msr_write_intercept  = svm_msr_write_intercept,
 #ifdef CONFIG_VM_EVENT
@@ -2783,10 +2710,6 @@ void asmlinkage svm_vmexit_handler(void)
         }
         break;
 
-    case VMEXIT_EXCEPTION_NM:
-        svm_fpu_dirty_intercept();
-        break;
-
     case VMEXIT_EXCEPTION_PF:
     {
         unsigned long va = vmcb->ei.exc.cr2;
diff --git a/xen/arch/x86/hvm/svm/vmcb.c b/xen/arch/x86/hvm/svm/vmcb.c
index e583ef8548..5ed7123d9a 100644
--- a/xen/arch/x86/hvm/svm/vmcb.c
+++ b/xen/arch/x86/hvm/svm/vmcb.c
@@ -138,9 +138,7 @@ static int construct_vmcb(struct vcpu *v)
 
     paging_update_paging_modes(v);
 
-    vmcb->_exception_intercepts =
-        HVM_TRAP_MASK |
-        (v->arch.fully_eager_fpu ? 0 : (1U << X86_EXC_NM));
+    vmcb->_exception_intercepts = HVM_TRAP_MASK;
 
     if ( paging_mode_hap(v->domain) )
     {
diff --git a/xen/arch/x86/include/asm/hvm/svm-types.h b/xen/arch/x86/include/asm/hvm/svm-types.h
index 051b235d8f..3ede62cade 100644
--- a/xen/arch/x86/include/asm/hvm/svm-types.h
+++ b/xen/arch/x86/include/asm/hvm/svm-types.h
@@ -65,12 +65,6 @@ struct nestedsvm {
     /* Shadow io permission map */
     unsigned long *ns_iomap;
 
-     /*
-      * Cached guest_cr[0] of l1 guest while l2 guest runs.  Needed to handle
-      * FPU context switching.
-      */
-    uint64_t ns_cr0;
-
     /*
      * Cache guest cr3/host cr3 the guest sets up for the l2 guest.
      * Used by Shadow-on-Shadow and Nested-on-Nested.
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Mar 30 16:45:55 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 30 Mar 2026 16:45:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1268060.1557442 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7FkR-0000hi-1d; Mon, 30 Mar 2026 16:45:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1268060.1557442; Mon, 30 Mar 2026 16:45:55 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7FkQ-0000ha-V1; Mon, 30 Mar 2026 16:45:54 +0000
Received: by outflank-mailman (input) for mailman id 1268060;
 Mon, 30 Mar 2026 16:45:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w7FkP-0000hS-5f
 for xen-changelog@lists.xenproject.org; Mon, 30 Mar 2026 16:45:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7FkP-00HNMn-19
 for xen-changelog@lists.xenproject.org;
 Mon, 30 Mar 2026 16:45:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7FkP-00Ah5y-0L
 for xen-changelog@lists.xenproject.org;
 Mon, 30 Mar 2026 16:45:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=qYdzJQT/3v6KqNFihtj9fxlU5gFpS1qFB7sg+31J3mc=; b=B87HieYnbcxyf4LpIEOi0beKyD
	CT3aj3ipIOzHs5t21/9PkcR1YpC07CSvm6mIKQeD9OOhcsD1/vHzhroA1AmwJRwX9JHaFsjXIBs2c
	9YxOG+iDUJaUBrW2uIYWW70RkR4k9OGLts/gfQILaVPA3SPs2lqaZz9mQiaVL35/BQu8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/traps: Remove lazy FPU support
Message-Id: <E1w7FkP-00Ah5y-0L@xenbits.xenproject.org>
Date: Mon, 30 Mar 2026 16:45:53 +0000

commit 47d75569250340874e432cfc1706fbd148cecc9d
Author:     Wei Liu <wei.liu2@citrix.com>
AuthorDate: Tue Mar 24 18:19:33 2026 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Mar 30 15:48:13 2026 +0100

    x86/traps: Remove lazy FPU support
    
    Remove lazy FPU support from the #NM exception handler used by PV
    guests since fully_eager_fpu is now always true.
    
    Signed-off-by: Wei Liu <wei.liu2@citrix.com>
    Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
---
 xen/arch/x86/i387.c               | 24 ------------------------
 xen/arch/x86/include/asm/i387.h   |  1 -
 xen/arch/x86/pv/misc-hypercalls.c |  3 +--
 xen/arch/x86/traps.c              | 20 +++++++++++++-------
 4 files changed, 14 insertions(+), 34 deletions(-)

diff --git a/xen/arch/x86/i387.c b/xen/arch/x86/i387.c
index 954ba3b179..7da731865f 100644
--- a/xen/arch/x86/i387.c
+++ b/xen/arch/x86/i387.c
@@ -234,30 +234,6 @@ void vcpu_restore_fpu_nonlazy(struct vcpu *v, bool need_stts)
         stts();
 }
 
-/* 
- * Restore FPU state when #NM is triggered.
- */
-void vcpu_restore_fpu_lazy(struct vcpu *v)
-{
-    ASSERT(!is_idle_vcpu(v));
-
-    /* Avoid recursion. */
-    clts();
-
-    if ( v->fpu_dirtied )
-        return;
-
-    ASSERT(!v->arch.fully_eager_fpu);
-
-    if ( cpu_has_xsave )
-        fpu_xrstor(v, XSTATE_LAZY);
-    else
-        fpu_fxrstor(v);
-
-    v->fpu_initialised = 1;
-    v->fpu_dirtied = 1;
-}
-
 /* 
  * On each context switch, save the necessary FPU info of VCPU being switch 
  * out. It dispatches saving operation based on CPU's capability.
diff --git a/xen/arch/x86/include/asm/i387.h b/xen/arch/x86/include/asm/i387.h
index 652d7ad2de..da0c7e945f 100644
--- a/xen/arch/x86/include/asm/i387.h
+++ b/xen/arch/x86/include/asm/i387.h
@@ -28,7 +28,6 @@ struct ix87_env {
 };
 
 void vcpu_restore_fpu_nonlazy(struct vcpu *v, bool need_stts);
-void vcpu_restore_fpu_lazy(struct vcpu *v);
 void vcpu_save_fpu(struct vcpu *v);
 void save_fpu_enable(void);
 int vcpu_init_fpu(struct vcpu *v);
diff --git a/xen/arch/x86/pv/misc-hypercalls.c b/xen/arch/x86/pv/misc-hypercalls.c
index 7e915d86b7..34a0717540 100644
--- a/xen/arch/x86/pv/misc-hypercalls.c
+++ b/xen/arch/x86/pv/misc-hypercalls.c
@@ -42,8 +42,7 @@ long do_fpu_taskswitch(int set)
     else
     {
         v->arch.pv.ctrlreg[0] &= ~X86_CR0_TS;
-        if ( v->fpu_dirtied )
-            clts();
+        clts();
     }
 
     return 0;
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index b6b1197697..8aa1e4181b 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -2045,15 +2045,21 @@ void asmlinkage do_device_not_available(struct cpu_user_regs *regs)
     }
 
 #ifdef CONFIG_PV
-    vcpu_restore_fpu_lazy(curr);
-
-    if ( curr->arch.pv.ctrlreg[0] & X86_CR0_TS )
+    if ( !(curr->arch.pv.ctrlreg[0] & X86_CR0_TS) )
     {
-        pv_inject_hw_exception(X86_EXC_NM, X86_EVENT_NO_EC);
-        curr->arch.pv.ctrlreg[0] &= ~X86_CR0_TS;
+        ASSERT_UNREACHABLE();
+        domain_crash(curr->domain, "#NM but vCR0.TS clear\n");
+        return;
     }
-    else
-        TRACE_TIME(TRC_PV_MATH_STATE_RESTORE);
+
+    /*
+     * For better or worse, Xen's ABI with PV guests always clears TS on an #NM
+     * exception. Classic-xen Linux depends on this.
+     */
+    clts();
+    curr->arch.pv.ctrlreg[0] &= ~X86_CR0_TS;
+
+    pv_inject_hw_exception(X86_EXC_NM, X86_EVENT_NO_EC);
 #else
     ASSERT_UNREACHABLE();
 #endif
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Mar 30 16:46:05 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 30 Mar 2026 16:46:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1268061.1557446 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7Fkb-0000jh-3Y; Mon, 30 Mar 2026 16:46:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1268061.1557446; Mon, 30 Mar 2026 16:46:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7Fkb-0000ja-07; Mon, 30 Mar 2026 16:46:05 +0000
Received: by outflank-mailman (input) for mailman id 1268061;
 Mon, 30 Mar 2026 16:46:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w7FkZ-0000jT-8j
 for xen-changelog@lists.xenproject.org; Mon, 30 Mar 2026 16:46:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7FkZ-00HNN3-1R
 for xen-changelog@lists.xenproject.org;
 Mon, 30 Mar 2026 16:46:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7FkZ-00Ah77-0g
 for xen-changelog@lists.xenproject.org;
 Mon, 30 Mar 2026 16:46:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=LtQKiOU8LA3+EhTcpMNf/tZzTrIfDycbYBtvu5yscN8=; b=ur70Tfv4FXq7nkN9BtQhSv8C3y
	ALsQOBMUUBt0wQy5l5HOlP5XXuJJzoVyhRwy9RX+qYqv5OhJHD+lPGw3t3yWHsop7GcVYCYGUL7n5
	saUwxdXSIjxWldzXks8T8uY7Owzps4BKKfPH4Z5P2fdkDYw40aMnJBEGSv9ilqxnCxHk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86: Remove fully_eager_fpu
Message-Id: <E1w7FkZ-00Ah77-0g@xenbits.xenproject.org>
Date: Mon, 30 Mar 2026 16:46:03 +0000

commit dba44e0512097ffb13fedf82c789f0c0c53a6c0c
Author:     Ross Lagerwall <ross.lagerwall@citrix.com>
AuthorDate: Tue Mar 24 18:19:34 2026 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Mar 30 15:48:13 2026 +0100

    x86: Remove fully_eager_fpu
    
    Since fully_eager_fpu is always true, remove it and adjust the code
    accordingly. At the same time, rename vcpu_restore_fpu_nonlazy since it
    always does the full restore.
    
    No functional change intended.
    
    Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/domain.c              |  2 +-
 xen/arch/x86/hvm/emulate.c         | 18 +-----------------
 xen/arch/x86/i387.c                | 35 +++++++++--------------------------
 xen/arch/x86/include/asm/domain.h  |  3 ---
 xen/arch/x86/include/asm/hvm/hvm.h |  2 --
 xen/arch/x86/include/asm/i387.h    |  2 +-
 xen/common/efi/runtime.c           |  2 +-
 7 files changed, 13 insertions(+), 51 deletions(-)

diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index 9ba2774762..c9ae8ee6e3 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -2125,7 +2125,7 @@ static void __context_switch(void)
             if ( cpu_has_xsaves && is_hvm_vcpu(n) )
                 set_msr_xss(n->arch.msrs->xss.raw);
         }
-        vcpu_restore_fpu_nonlazy(n, false);
+        vcpu_restore_fpu(n);
         nd->arch.ctxt_switch->to(n);
     }
 
diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c
index 86b1f75356..2daea084f1 100644
--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -2630,23 +2630,7 @@ static void cf_check hvmemul_put_fpu(
     }
 
     if ( backout == X86EMUL_FPU_fpu )
-    {
-        /*
-         * To back out changes to the register file
-         * - in fully eager mode, restore original state immediately,
-         * - in lazy mode, simply adjust state such that upon next FPU insn
-         *   use by the guest we'll reload the state saved (or freshly loaded)
-         *   by hvmemul_get_fpu().
-         */
-        if ( curr->arch.fully_eager_fpu )
-            vcpu_restore_fpu_nonlazy(curr, false);
-        else
-        {
-            curr->fpu_dirtied = false;
-            stts();
-            alternative_vcall(hvm_funcs.fpu_leave, curr);
-        }
-    }
+        vcpu_restore_fpu(curr);
 }
 
 static int cf_check hvmemul_tlb_op(
diff --git a/xen/arch/x86/i387.c b/xen/arch/x86/i387.c
index 7da731865f..88018397b1 100644
--- a/xen/arch/x86/i387.c
+++ b/xen/arch/x86/i387.c
@@ -194,12 +194,8 @@ static inline void fpu_fxsave(struct vcpu *v)
 /*       VCPU FPU Functions    */
 /*******************************/
 /* Restore FPU state whenever VCPU is schduled in. */
-void vcpu_restore_fpu_nonlazy(struct vcpu *v, bool need_stts)
+void vcpu_restore_fpu(struct vcpu *v)
 {
-    /* Restore nonlazy extended state (i.e. parts not tracked by CR0.TS). */
-    if ( !v->arch.fully_eager_fpu && !v->arch.nonlazy_xstate_used )
-        goto maybe_stts;
-
     ASSERT(!is_idle_vcpu(v));
 
     /* Avoid recursion */
@@ -210,27 +206,16 @@ void vcpu_restore_fpu_nonlazy(struct vcpu *v, bool need_stts)
      * above) we also need to restore full state, to prevent subsequently
      * saving state belonging to another vCPU.
      */
-    if ( v->arch.fully_eager_fpu || xstate_all(v) )
-    {
-        if ( cpu_has_xsave )
-            fpu_xrstor(v, XSTATE_ALL);
-        else
-            fpu_fxrstor(v);
-
-        v->fpu_initialised = 1;
-        v->fpu_dirtied = 1;
-
-        /* Xen doesn't need TS set, but the guest might. */
-        need_stts = is_pv_vcpu(v) && (v->arch.pv.ctrlreg[0] & X86_CR0_TS);
-    }
+    if ( cpu_has_xsave )
+        fpu_xrstor(v, XSTATE_ALL);
     else
-    {
-        fpu_xrstor(v, XSTATE_NONLAZY);
-        need_stts = true;
-    }
+        fpu_fxrstor(v);
 
- maybe_stts:
-    if ( need_stts )
+    v->fpu_initialised = 1;
+    v->fpu_dirtied = 1;
+
+    /* Xen doesn't need TS set, but the guest might. */
+    if ( is_pv_vcpu(v) && (v->arch.pv.ctrlreg[0] & X86_CR0_TS) )
         stts();
 }
 
@@ -273,8 +258,6 @@ void save_fpu_enable(void)
 /* Initialize FPU's context save area */
 int vcpu_init_fpu(struct vcpu *v)
 {
-    v->arch.fully_eager_fpu = true;
-
     return xstate_alloc_save_area(v);
 }
 
diff --git a/xen/arch/x86/include/asm/domain.h b/xen/arch/x86/include/asm/domain.h
index ad7f6adb2c..bd7b02085e 100644
--- a/xen/arch/x86/include/asm/domain.h
+++ b/xen/arch/x86/include/asm/domain.h
@@ -671,9 +671,6 @@ struct arch_vcpu
      * and thus should be saved/restored. */
     bool nonlazy_xstate_used;
 
-    /* Restore all FPU state (lazy and non-lazy state) on context switch? */
-    bool fully_eager_fpu;
-
     struct vmce vmce;
 
     struct paging_vcpu paging;
diff --git a/xen/arch/x86/include/asm/hvm/hvm.h b/xen/arch/x86/include/asm/hvm/hvm.h
index 7d9774df59..a9425c8cff 100644
--- a/xen/arch/x86/include/asm/hvm/hvm.h
+++ b/xen/arch/x86/include/asm/hvm/hvm.h
@@ -160,8 +160,6 @@ struct hvm_function_table {
 
     void (*cpuid_policy_changed)(struct vcpu *v);
 
-    void (*fpu_leave)(struct vcpu *v);
-
     int  (*get_guest_pat)(struct vcpu *v, uint64_t *gpat);
     int  (*set_guest_pat)(struct vcpu *v, uint64_t gpat);
 
diff --git a/xen/arch/x86/include/asm/i387.h b/xen/arch/x86/include/asm/i387.h
index da0c7e945f..fe5e4419b6 100644
--- a/xen/arch/x86/include/asm/i387.h
+++ b/xen/arch/x86/include/asm/i387.h
@@ -27,7 +27,7 @@ struct ix87_env {
     uint16_t fds, _res6;
 };
 
-void vcpu_restore_fpu_nonlazy(struct vcpu *v, bool need_stts);
+void vcpu_restore_fpu(struct vcpu *v);
 void vcpu_save_fpu(struct vcpu *v);
 void save_fpu_enable(void);
 int vcpu_init_fpu(struct vcpu *v);
diff --git a/xen/common/efi/runtime.c b/xen/common/efi/runtime.c
index ba27c62132..982e42e8f3 100644
--- a/xen/common/efi/runtime.c
+++ b/xen/common/efi/runtime.c
@@ -157,7 +157,7 @@ void efi_rs_leave(struct efi_rs_state *state)
     irq_exit();
     efi_rs_on_cpu = NR_CPUS;
     spin_unlock(&efi_rs_lock);
-    vcpu_restore_fpu_nonlazy(curr, true);
+    vcpu_restore_fpu(curr);
 }
 
 bool efi_rs_using_pgtables(void)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Mar 30 16:46:14 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 30 Mar 2026 16:46:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1268062.1557451 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7Fkk-0000mF-6L; Mon, 30 Mar 2026 16:46:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1268062.1557451; Mon, 30 Mar 2026 16:46:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7Fkk-0000m7-3Q; Mon, 30 Mar 2026 16:46:14 +0000
Received: by outflank-mailman (input) for mailman id 1268062;
 Mon, 30 Mar 2026 16:46:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w7Fkj-0000ly-Bn
 for xen-changelog@lists.xenproject.org; Mon, 30 Mar 2026 16:46:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7Fkj-00HNNE-1l
 for xen-changelog@lists.xenproject.org;
 Mon, 30 Mar 2026 16:46:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7Fkj-00Ah7V-11
 for xen-changelog@lists.xenproject.org;
 Mon, 30 Mar 2026 16:46:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=X3pv3+d6BpLEZ0bv0tx6s88NdIA9a0CaC1vhQEZcdHY=; b=Br9xEyFCedm7o6YUiQiOuWVIAa
	NA66OY/JCBzwMi+l3H2fFU/cKHcr6ONRULhP207V8b1fxwHJIjSmoA0UyE6C484eJkbWZuaoVNW0T
	96jMH5yJxQmlIiiXRikcEMWObcRps/m5wL8UYvld463RJ6OHH2nsZlLB+RyO+qECH2Lk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86: Remove fpu_initialised/fpu_dirty
Message-Id: <E1w7Fkj-00Ah7V-11@xenbits.xenproject.org>
Date: Mon, 30 Mar 2026 16:46:13 +0000

commit 4b9851c645220903fd996f997102fb63144fac4f
Author:     Ross Lagerwall <ross.lagerwall@citrix.com>
AuthorDate: Tue Mar 24 18:19:35 2026 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Mar 30 15:48:13 2026 +0100

    x86: Remove fpu_initialised/fpu_dirty
    
    With lazy FPU removed, fpu_initialised and fpu_dirty are always set to
    true in vcpu_restore_fpu() so remove them and adjust the code
    accordingly.
    
    There is a small user-visible change here. After this commit, calling
    XEN_DOMCTL_getvcpucontext immediately after vCPU creation would show the
    FPU as initialized (with a clean state) whereas before it would show as
    uninitialized.
    
    Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/domctl.c              |  5 ++---
 xen/arch/x86/hvm/emulate.c         |  6 +-----
 xen/arch/x86/hvm/hvm.c             | 15 ++++++---------
 xen/arch/x86/hvm/vlapic.c          |  3 ---
 xen/arch/x86/i387.c                | 31 ++-----------------------------
 xen/arch/x86/include/asm/hvm/hvm.h |  1 -
 xen/arch/x86/include/asm/xstate.h  | 11 -----------
 xen/arch/x86/xstate.c              | 21 +++++----------------
 xen/common/domain.c                |  2 --
 xen/include/xen/sched.h            |  4 ----
 10 files changed, 16 insertions(+), 83 deletions(-)

diff --git a/xen/arch/x86/domctl.c b/xen/arch/x86/domctl.c
index 942f41c584..8d474b7623 100644
--- a/xen/arch/x86/domctl.c
+++ b/xen/arch/x86/domctl.c
@@ -1406,11 +1406,10 @@ void arch_get_info_guest(struct vcpu *v, vcpu_guest_context_u c)
     VCPU_UNMAP_XSAVE_AREA(v, xsave_area);
 
     if ( is_pv_domain(d) )
-        c(flags = v->arch.pv.vgc_flags & ~(VGCF_i387_valid|VGCF_in_kernel));
+        c(flags = v->arch.pv.vgc_flags & ~VGCF_in_kernel);
     else
         c(flags = 0);
-    if ( v->fpu_initialised )
-        c(flags |= VGCF_i387_valid);
+    c(flags |= VGCF_i387_valid);
     if ( !(v->pause_flags & VPF_down) )
         c(flags |= VGCF_online);
     if ( !compat )
diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c
index 2daea084f1..48c7320360 100644
--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -2517,9 +2517,7 @@ static int cf_check hvmemul_get_fpu(
 {
     struct vcpu *curr = current;
 
-    if ( !curr->fpu_dirtied )
-        alternative_vcall(hvm_funcs.fpu_dirty_intercept);
-    else if ( type == X86EMUL_FPU_fpu )
+    if ( type == X86EMUL_FPU_fpu )
     {
         /* Has a fastpath for `current`, so there's no actual map */
         const struct xsave_struct *xsave_area = VCPU_MAP_XSAVE_AREA(curr);
@@ -2537,8 +2535,6 @@ static int cf_check hvmemul_get_fpu(
          * masking of all exceptions by FNSTENV.)
          */
         save_fpu_enable();
-        curr->fpu_initialised = true;
-        curr->fpu_dirtied = true;
         if ( (fpu_ctxt->fcw & 0x3f) != 0x3f )
         {
             uint16_t fcw;
diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index b62b058861..3edc2491e2 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -866,6 +866,7 @@ static int cf_check hvm_save_cpu_ctxt(struct vcpu *v, hvm_domain_context_t *h)
         .dr7 = v->arch.dr7,
         .msr_efer = v->arch.hvm.guest_efer,
     };
+    const struct xsave_struct *xsave_area;
 
     /*
      * We don't need to save state for a vcpu that is down; the restore
@@ -933,15 +934,11 @@ static int cf_check hvm_save_cpu_ctxt(struct vcpu *v, hvm_domain_context_t *h)
     ctxt.ldtr_base = seg.base;
     ctxt.ldtr_arbytes = seg.attr;
 
-    if ( v->fpu_initialised )
-    {
-        const struct xsave_struct *xsave_area = VCPU_MAP_XSAVE_AREA(v);
-
-        BUILD_BUG_ON(sizeof(ctxt.fpu_regs) != sizeof(xsave_area->fpu_sse));
-        memcpy(ctxt.fpu_regs, &xsave_area->fpu_sse, sizeof(ctxt.fpu_regs));
-        VCPU_UNMAP_XSAVE_AREA(v, xsave_area);
-        ctxt.flags = XEN_X86_FPU_INITIALISED;
-    }
+    xsave_area = VCPU_MAP_XSAVE_AREA(v);
+    BUILD_BUG_ON(sizeof(ctxt.fpu_regs) != sizeof(xsave_area->fpu_sse));
+    memcpy(ctxt.fpu_regs, &xsave_area->fpu_sse, sizeof(ctxt.fpu_regs));
+    VCPU_UNMAP_XSAVE_AREA(v, xsave_area);
+    ctxt.flags = XEN_X86_FPU_INITIALISED;
 
     return hvm_save_entry(CPU, v->vcpu_id, h, &ctxt);
 }
diff --git a/xen/arch/x86/hvm/vlapic.c b/xen/arch/x86/hvm/vlapic.c
index 79697487ba..885f5d304b 100644
--- a/xen/arch/x86/hvm/vlapic.c
+++ b/xen/arch/x86/hvm/vlapic.c
@@ -276,7 +276,6 @@ static void vlapic_init_sipi_one(struct vcpu *target, uint32_t icr)
     switch ( icr & APIC_DM_MASK )
     {
     case APIC_DM_INIT: {
-        bool fpu_initialised;
         int rc;
 
         /* No work on INIT de-assert for P4-type APIC. */
@@ -289,10 +288,8 @@ static void vlapic_init_sipi_one(struct vcpu *target, uint32_t icr)
         hvm_vcpu_down(target);
         domain_lock(target->domain);
         /* Reset necessary VCPU state. This does not include FPU state. */
-        fpu_initialised = target->fpu_initialised;
         rc = vcpu_reset(target);
         ASSERT(!rc);
-        target->fpu_initialised = fpu_initialised;
         vlapic_do_init(vcpu_vlapic(target));
         domain_unlock(target->domain);
         break;
diff --git a/xen/arch/x86/i387.c b/xen/arch/x86/i387.c
index 88018397b1..5e893a2aab 100644
--- a/xen/arch/x86/i387.c
+++ b/xen/arch/x86/i387.c
@@ -110,22 +110,7 @@ static inline void fpu_fxrstor(struct vcpu *v)
 
 static inline uint64_t vcpu_xsave_mask(const struct vcpu *v)
 {
-    if ( v->fpu_dirtied )
-        return v->arch.nonlazy_xstate_used ? XSTATE_ALL : XSTATE_LAZY;
-
-    ASSERT(v->arch.nonlazy_xstate_used);
-
-    /*
-     * The offsets of components which live in the extended region of
-     * compact xsave area are not fixed. Xsave area may be overwritten
-     * when a xsave with v->fpu_dirtied set is followed by one with
-     * v->fpu_dirtied clear.
-     * In such case, if hypervisor uses compact xsave area and guest
-     * has ever used lazy states (checking xcr0_accum excluding
-     * XSTATE_FP_SSE), vcpu_xsave_mask will return XSTATE_ALL. Otherwise
-     * return XSTATE_NONLAZY.
-     */
-    return xstate_all(v) ? XSTATE_ALL : XSTATE_NONLAZY;
+    return v->arch.nonlazy_xstate_used ? XSTATE_ALL : XSTATE_LAZY;
 }
 
 /* Save x87 extended state */
@@ -201,19 +186,11 @@ void vcpu_restore_fpu(struct vcpu *v)
     /* Avoid recursion */
     clts();
 
-    /*
-     * When saving full state even with !v->fpu_dirtied (see vcpu_xsave_mask()
-     * above) we also need to restore full state, to prevent subsequently
-     * saving state belonging to another vCPU.
-     */
     if ( cpu_has_xsave )
         fpu_xrstor(v, XSTATE_ALL);
     else
         fpu_fxrstor(v);
 
-    v->fpu_initialised = 1;
-    v->fpu_dirtied = 1;
-
     /* Xen doesn't need TS set, but the guest might. */
     if ( is_pv_vcpu(v) && (v->arch.pv.ctrlreg[0] & X86_CR0_TS) )
         stts();
@@ -225,7 +202,7 @@ void vcpu_restore_fpu(struct vcpu *v)
  */
 static bool _vcpu_save_fpu(struct vcpu *v)
 {
-    if ( !v->fpu_dirtied && !v->arch.nonlazy_xstate_used )
+    if ( !v->arch.nonlazy_xstate_used )
         return false;
 
     ASSERT(!is_idle_vcpu(v));
@@ -238,8 +215,6 @@ static bool _vcpu_save_fpu(struct vcpu *v)
     else
         fpu_fxsave(v);
 
-    v->fpu_dirtied = 0;
-
     return true;
 }
 
@@ -265,7 +240,6 @@ void vcpu_reset_fpu(struct vcpu *v)
 {
     struct xsave_struct *xsave_area = VCPU_MAP_XSAVE_AREA(v);
 
-    v->fpu_initialised = false;
     *xsave_area = (struct xsave_struct) {
         .xsave_hdr.xstate_bv = X86_XCR0_X87,
     };
@@ -282,7 +256,6 @@ void vcpu_setup_fpu(struct vcpu *v, const void *data)
 {
     struct xsave_struct *xsave_area = VCPU_MAP_XSAVE_AREA(v);
 
-    v->fpu_initialised = true;
     *xsave_area = (struct xsave_struct) {
         .fpu_sse = *(const fpusse_t*)data,
         .xsave_hdr.xstate_bv = XSTATE_FP_SSE,
diff --git a/xen/arch/x86/include/asm/hvm/hvm.h b/xen/arch/x86/include/asm/hvm/hvm.h
index a9425c8cff..846b91ebef 100644
--- a/xen/arch/x86/include/asm/hvm/hvm.h
+++ b/xen/arch/x86/include/asm/hvm/hvm.h
@@ -184,7 +184,6 @@ struct hvm_function_table {
 
     /* Instruction intercepts: non-void return values are X86EMUL codes. */
     void (*wbinvd_intercept)(void);
-    void (*fpu_dirty_intercept)(void);
     int (*msr_read_intercept)(unsigned int msr, uint64_t *msr_content);
     int (*msr_write_intercept)(unsigned int msr, uint64_t msr_content);
     void (*handle_cd)(struct vcpu *v, unsigned long value);
diff --git a/xen/arch/x86/include/asm/xstate.h b/xen/arch/x86/include/asm/xstate.h
index e3b9745543..ca38c43ec1 100644
--- a/xen/arch/x86/include/asm/xstate.h
+++ b/xen/arch/x86/include/asm/xstate.h
@@ -132,17 +132,6 @@ xsave_area_compressed(const struct xsave_struct *xsave_area)
     return xsave_area->xsave_hdr.xcomp_bv & XSTATE_COMPACTION_ENABLED;
 }
 
-static inline bool xstate_all(const struct vcpu *v)
-{
-    /*
-     * XSTATE_FP_SSE may be excluded, because the offsets of XSTATE_FP_SSE
-     * (in the legacy region of xsave area) are fixed, so saving
-     * XSTATE_FP_SSE will not cause overwriting problem with XSAVES/XSAVEC.
-     */
-    return xsave_area_compressed(v->arch.xsave_area) &&
-           (v->arch.xcr0_accum & XSTATE_LAZY & ~XSTATE_FP_SSE);
-}
-
 /*
  * Fetch a pointer to a vCPU's XSAVE area
  *
diff --git a/xen/arch/x86/xstate.c b/xen/arch/x86/xstate.c
index defe9b3f0c..c42cdc9462 100644
--- a/xen/arch/x86/xstate.c
+++ b/xen/arch/x86/xstate.c
@@ -1005,28 +1005,17 @@ int handle_xsetbv(u32 index, u64 new_bv)
     if ( new_bv & XSTATE_NONLAZY )
         curr->arch.nonlazy_xstate_used = 1;
 
-    mask &= curr->fpu_dirtied ? ~XSTATE_FP_SSE : XSTATE_NONLAZY;
+    mask &= ~XSTATE_FP_SSE;
     if ( mask )
     {
         unsigned long cr0 = read_cr0();
+        /* Has a fastpath for `current`, so there's no actual map */
+        struct xsave_struct *xsave_area = VCPU_MAP_XSAVE_AREA(curr);
 
         clts();
-        if ( curr->fpu_dirtied )
-        {
-            /* Has a fastpath for `current`, so there's no actual map */
-            struct xsave_struct *xsave_area = VCPU_MAP_XSAVE_AREA(curr);
 
-            asm ( "stmxcsr %0" : "=m" (xsave_area->fpu_sse.mxcsr) );
-            VCPU_UNMAP_XSAVE_AREA(curr, xsave_area);
-        }
-        else if ( xstate_all(curr) )
-        {
-            /* See the comment in i387.c:vcpu_restore_fpu_eager(). */
-            mask |= XSTATE_LAZY;
-            curr->fpu_initialised = 1;
-            curr->fpu_dirtied = 1;
-            cr0 &= ~X86_CR0_TS;
-        }
+        asm ( "stmxcsr %0" : "=m" (xsave_area->fpu_sse.mxcsr) );
+        VCPU_UNMAP_XSAVE_AREA(curr, xsave_area);
         xrstor(curr, mask);
         if ( cr0 & X86_CR0_TS )
             write_cr0(cr0);
diff --git a/xen/common/domain.c b/xen/common/domain.c
index ab910fcf93..30cfea3045 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -1824,8 +1824,6 @@ int vcpu_reset(struct vcpu *v)
     clear_bit(v->vcpu_id, d->poll_mask);
     v->poll_evtchn = 0;
 
-    v->fpu_initialised = 0;
-    v->fpu_dirtied     = 0;
     v->is_initialised  = 0;
     if ( v->affinity_broken & VCPU_AFFINITY_OVERRIDE )
         vcpu_temporary_affinity(v, NR_CPUS, VCPU_AFFINITY_OVERRIDE);
diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
index 40a35fc15c..212c7d765c 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -212,10 +212,6 @@ struct vcpu
     struct guest_area runstate_guest_area;
     unsigned int     new_state;
 
-    /* Has the FPU been initialised? */
-    bool             fpu_initialised;
-    /* Has the FPU been used since it was last saved? */
-    bool             fpu_dirtied;
     /* Initialization completed for this VCPU? */
     bool             is_initialised;
     /* Currently running on a CPU? */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Mar 30 16:46:24 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 30 Mar 2026 16:46:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1268063.1557454 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7Fku-0000oH-7Y; Mon, 30 Mar 2026 16:46:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1268063.1557454; Mon, 30 Mar 2026 16:46:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7Fku-0000o9-4u; Mon, 30 Mar 2026 16:46:24 +0000
Received: by outflank-mailman (input) for mailman id 1268063;
 Mon, 30 Mar 2026 16:46:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w7Fkt-0000o3-Ef
 for xen-changelog@lists.xenproject.org; Mon, 30 Mar 2026 16:46:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7Fkt-00HNNM-24
 for xen-changelog@lists.xenproject.org;
 Mon, 30 Mar 2026 16:46:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7Fkt-00Ah80-1I
 for xen-changelog@lists.xenproject.org;
 Mon, 30 Mar 2026 16:46:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=BMhodMMqoUK86l8BcHaQUOcU/P9GLidt986WjltT8BU=; b=uErmyyyIwbAnDIUy0VvxSVGvWr
	YnPC4FYJZHey/G6i8W30zMtdEdgobPxNlA7BeN3VOaqCDZcyr1jNCCNxgVxSrkKhrxP1AiauS9Nex
	ECke8I9WW9Hz6QOc+Eewfrp7UXMFvcGEsIIARJ5owHLACJEtGqhe1BcZmN6gzoyydBmg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/xstate: Stop tracking nonlazy xstate use
Message-Id: <E1w7Fkt-00Ah80-1I@xenbits.xenproject.org>
Date: Mon, 30 Mar 2026 16:46:23 +0000

commit 7eb3d8420dac4b57db9efcbe2ada5e5455572a73
Author:     Ross Lagerwall <ross.lagerwall@citrix.com>
AuthorDate: Tue Mar 24 18:19:36 2026 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Mar 30 15:48:13 2026 +0100

    x86/xstate: Stop tracking nonlazy xstate use
    
    With the removal of lazy FPU, the full state is always restored on context
    switch so stop tracking whether nonlazy xstate is used.
    
    Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/domctl.c             |  1 -
 xen/arch/x86/hvm/hvm.c            |  1 -
 xen/arch/x86/i387.c               | 12 +-----------
 xen/arch/x86/include/asm/domain.h |  3 ---
 xen/arch/x86/include/asm/xstate.h |  6 ++----
 xen/arch/x86/xstate.c             |  3 ---
 6 files changed, 3 insertions(+), 23 deletions(-)

diff --git a/xen/arch/x86/domctl.c b/xen/arch/x86/domctl.c
index 8d474b7623..bfbc35c08b 100644
--- a/xen/arch/x86/domctl.c
+++ b/xen/arch/x86/domctl.c
@@ -1013,7 +1013,6 @@ long arch_do_domctl(
 
                 v->arch.xcr0 = _xcr0;
                 v->arch.xcr0_accum = _xcr0_accum;
-                v->arch.nonlazy_xstate_used = _xcr0_accum & XSTATE_NONLAZY;
                 compress_xsave_states(v, _xsave_area,
                                       evc->size - PV_XSAVE_HDR_SIZE);
 
diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 3edc2491e2..11e9b2bc88 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -1384,7 +1384,6 @@ static int cf_check hvm_load_cpu_xsave_states(
 
     v->arch.xcr0 = ctxt->xcr0;
     v->arch.xcr0_accum = ctxt->xcr0_accum;
-    v->arch.nonlazy_xstate_used = ctxt->xcr0_accum & XSTATE_NONLAZY;
     compress_xsave_states(v, &ctxt->save_area,
                           size - offsetof(struct hvm_hw_cpu_xsave, save_area));
 
diff --git a/xen/arch/x86/i387.c b/xen/arch/x86/i387.c
index 5e893a2aab..9acaaf4673 100644
--- a/xen/arch/x86/i387.c
+++ b/xen/arch/x86/i387.c
@@ -108,25 +108,18 @@ static inline void fpu_fxrstor(struct vcpu *v)
 /*      FPU Save Functions     */
 /*******************************/
 
-static inline uint64_t vcpu_xsave_mask(const struct vcpu *v)
-{
-    return v->arch.nonlazy_xstate_used ? XSTATE_ALL : XSTATE_LAZY;
-}
-
 /* Save x87 extended state */
 static inline void fpu_xsave(struct vcpu *v)
 {
     bool ok;
-    uint64_t mask = vcpu_xsave_mask(v);
 
-    ASSERT(mask);
     /*
      * XCR0 normally represents what guest OS set. In case of Xen itself,
      * we set the accumulated feature mask before doing save/restore.
      */
     ok = set_xcr0(v->arch.xcr0_accum | XSTATE_FP_SSE);
     ASSERT(ok);
-    xsave(v, mask);
+    xsave(v, XSTATE_ALL);
     ok = set_xcr0(v->arch.xcr0 ?: XSTATE_FP_SSE);
     ASSERT(ok);
 }
@@ -202,9 +195,6 @@ void vcpu_restore_fpu(struct vcpu *v)
  */
 static bool _vcpu_save_fpu(struct vcpu *v)
 {
-    if ( !v->arch.nonlazy_xstate_used )
-        return false;
-
     ASSERT(!is_idle_vcpu(v));
 
     /* This can happen, if a paravirtualised guest OS has set its CR0.TS. */
diff --git a/xen/arch/x86/include/asm/domain.h b/xen/arch/x86/include/asm/domain.h
index bd7b02085e..385a6666da 100644
--- a/xen/arch/x86/include/asm/domain.h
+++ b/xen/arch/x86/include/asm/domain.h
@@ -667,9 +667,6 @@ struct arch_vcpu
      * it explicitly enables it via xcr0.
      */
     uint64_t xcr0_accum;
-    /* This variable determines whether nonlazy extended state has been used,
-     * and thus should be saved/restored. */
-    bool nonlazy_xstate_used;
 
     struct vmce vmce;
 
diff --git a/xen/arch/x86/include/asm/xstate.h b/xen/arch/x86/include/asm/xstate.h
index ca38c43ec1..c96d75e38b 100644
--- a/xen/arch/x86/include/asm/xstate.h
+++ b/xen/arch/x86/include/asm/xstate.h
@@ -33,12 +33,10 @@ extern uint32_t mxcsr_mask;
 #define XSTATE_FP_SSE  (X86_XCR0_X87 | X86_XCR0_SSE)
 #define XCNTXT_MASK    (X86_XCR0_X87 | X86_XCR0_SSE | X86_XCR0_YMM | \
                         X86_XCR0_OPMASK | X86_XCR0_ZMM | X86_XCR0_HI_ZMM | \
-                        XSTATE_NONLAZY)
+                        X86_XCR0_BNDREGS | X86_XCR0_BNDCSR | X86_XCR0_PKRU | \
+                        X86_XCR0_TILE_CFG | X86_XCR0_TILE_DATA)
 
 #define XSTATE_ALL     (~(1ULL << 63))
-#define XSTATE_NONLAZY (X86_XCR0_BNDREGS | X86_XCR0_BNDCSR | X86_XCR0_PKRU | \
-                        X86_XCR0_TILE_CFG | X86_XCR0_TILE_DATA)
-#define XSTATE_LAZY    (XSTATE_ALL & ~XSTATE_NONLAZY)
 #define XSTATE_XSAVES_ONLY         0
 #define XSTATE_COMPACTION_ENABLED  (1ULL << 63)
 
diff --git a/xen/arch/x86/xstate.c b/xen/arch/x86/xstate.c
index c42cdc9462..8336414c52 100644
--- a/xen/arch/x86/xstate.c
+++ b/xen/arch/x86/xstate.c
@@ -1002,9 +1002,6 @@ int handle_xsetbv(u32 index, u64 new_bv)
     curr->arch.xcr0 = new_bv;
     curr->arch.xcr0_accum |= new_bv;
 
-    if ( new_bv & XSTATE_NONLAZY )
-        curr->arch.nonlazy_xstate_used = 1;
-
     mask &= ~XSTATE_FP_SSE;
     if ( mask )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Mar 30 16:46:34 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 30 Mar 2026 16:46:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1268064.1557459 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7Fl4-0000qH-9c; Mon, 30 Mar 2026 16:46:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1268064.1557459; Mon, 30 Mar 2026 16:46:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7Fl4-0000q8-6K; Mon, 30 Mar 2026 16:46:34 +0000
Received: by outflank-mailman (input) for mailman id 1268064;
 Mon, 30 Mar 2026 16:46:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w7Fl3-0000pw-Ha
 for xen-changelog@lists.xenproject.org; Mon, 30 Mar 2026 16:46:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7Fl3-00HNNX-2M
 for xen-changelog@lists.xenproject.org;
 Mon, 30 Mar 2026 16:46:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7Fl3-00Ah8M-1Z
 for xen-changelog@lists.xenproject.org;
 Mon, 30 Mar 2026 16:46:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=BjRigehIxzmXp5EWnyxNJWcM8HsRqPLys10stmKjs2A=; b=XPdVp8nnGhcEXRcWwC7pfKQW8L
	DwCrl6ZVI7Gs8lVylcdRSDNEWq62Vf8C+K2afCVgQ/XdhdDShfP0sYY20GYMUc2Ay/gu0VqfyYyuf
	SFJ9w8/aMqUQl0kyWgpMiug3gV5qO8EU+jyyFmNvSBFBxhvoH9cSxEsH6zXqf7AHw5HQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86: Cleanup cr0.TS flag handling
Message-Id: <E1w7Fl3-00Ah8M-1Z@xenbits.xenproject.org>
Date: Mon, 30 Mar 2026 16:46:33 +0000

commit 1792bb9a99d27d6b42e72fa28158e32d3ad05cc0
Author:     Ross Lagerwall <ross.lagerwall@citrix.com>
AuthorDate: Tue Mar 24 18:19:37 2026 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Mar 30 15:48:13 2026 +0100

    x86: Cleanup cr0.TS flag handling
    
    Setting/clearing the cr0.TS bit is serializing and setting the cr0.TS
    bit in particular requires a write to CR0 which is implemented in
    microcode and is very slow. Therefore and with lazy FPU removed, avoid
    setting/clearing the cr0.TS flag on context switch except when
    saving/restoring the FPU for a PV guest.
    
    After this, Xen's context switch code and idle CPUs run with the TS bit
    cleared. An unfortunate side effect of this is that any mistaken use of
    XMM registers or extended state will not trap and will therefore be more
    difficult to detect.
    
    Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/cpu/common.c       |  3 ---
 xen/arch/x86/hvm/emulate.c      | 14 ++------------
 xen/arch/x86/i387.c             | 19 +------------------
 xen/arch/x86/include/asm/i387.h |  1 -
 xen/common/efi/runtime.c        |  2 +-
 5 files changed, 4 insertions(+), 35 deletions(-)

diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c
index 5ac76897ae..057592b7c8 100644
--- a/xen/arch/x86/cpu/common.c
+++ b/xen/arch/x86/cpu/common.c
@@ -887,9 +887,6 @@ void cpu_init(void)
 	/* Install correct page table. */
 	write_ptbase(current);
 
-	/* Ensure FPU gets initialised for each domain. */
-	stts();
-
 	/* Reset debug registers: */
 	write_debugreg(0, 0);
 	write_debugreg(1, 0);
diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c
index 48c7320360..f3aae158e9 100644
--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -2527,14 +2527,8 @@ static int cf_check hvmemul_get_fpu(
          * Latch current register state so that we can back out changes
          * if needed (namely when a memory write fails after register state
          * has already been updated).
-         * NB: We don't really need the "enable" part of the called function
-         * (->fpu_dirtied set implies CR0.TS clear), but the additional
-         * overhead should be low enough to not warrant introduction of yet
-         * another slightly different function. However, we need to undo the
-         * ->fpu_dirtied clearing the function does as well as the possible
-         * masking of all exceptions by FNSTENV.)
          */
-        save_fpu_enable();
+        vcpu_save_fpu(curr);
         if ( (fpu_ctxt->fcw & 0x3f) != 0x3f )
         {
             uint16_t fcw;
@@ -2572,12 +2566,8 @@ static void cf_check hvmemul_put_fpu(
          * Latch current register state so that we can replace FIP/FDP/FOP
          * (which have values resulting from our own invocation of the FPU
          * instruction during emulation).
-         * NB: See also the comment in hvmemul_get_fpu(); we don't need to
-         * set ->fpu_dirtied here as it is going to be cleared below, and
-         * we also don't need to reload FCW as we're forcing full state to
-         * be reloaded anyway.
          */
-        save_fpu_enable();
+        vcpu_save_fpu(curr);
 
         if ( boot_cpu_has(X86_FEATURE_FDP_EXCP_ONLY) &&
              !(fpu_ctxt->fsw & ~fpu_ctxt->fcw & 0x003f) )
diff --git a/xen/arch/x86/i387.c b/xen/arch/x86/i387.c
index 9acaaf4673..c6796bc97b 100644
--- a/xen/arch/x86/i387.c
+++ b/xen/arch/x86/i387.c
@@ -176,9 +176,6 @@ void vcpu_restore_fpu(struct vcpu *v)
 {
     ASSERT(!is_idle_vcpu(v));
 
-    /* Avoid recursion */
-    clts();
-
     if ( cpu_has_xsave )
         fpu_xrstor(v, XSTATE_ALL);
     else
@@ -193,7 +190,7 @@ void vcpu_restore_fpu(struct vcpu *v)
  * On each context switch, save the necessary FPU info of VCPU being switch 
  * out. It dispatches saving operation based on CPU's capability.
  */
-static bool _vcpu_save_fpu(struct vcpu *v)
+void vcpu_save_fpu(struct vcpu *v)
 {
     ASSERT(!is_idle_vcpu(v));
 
@@ -204,20 +201,6 @@ static bool _vcpu_save_fpu(struct vcpu *v)
         fpu_xsave(v);
     else
         fpu_fxsave(v);
-
-    return true;
-}
-
-void vcpu_save_fpu(struct vcpu *v)
-{
-    _vcpu_save_fpu(v);
-    stts();
-}
-
-void save_fpu_enable(void)
-{
-    if ( !_vcpu_save_fpu(current) )
-        clts();
 }
 
 /* Initialize FPU's context save area */
diff --git a/xen/arch/x86/include/asm/i387.h b/xen/arch/x86/include/asm/i387.h
index fe5e4419b6..0717005d31 100644
--- a/xen/arch/x86/include/asm/i387.h
+++ b/xen/arch/x86/include/asm/i387.h
@@ -29,7 +29,6 @@ struct ix87_env {
 
 void vcpu_restore_fpu(struct vcpu *v);
 void vcpu_save_fpu(struct vcpu *v);
-void save_fpu_enable(void);
 int vcpu_init_fpu(struct vcpu *v);
 void vcpu_destroy_fpu(struct vcpu *v);
 
diff --git a/xen/common/efi/runtime.c b/xen/common/efi/runtime.c
index 982e42e8f3..0f1cc765ec 100644
--- a/xen/common/efi/runtime.c
+++ b/xen/common/efi/runtime.c
@@ -94,7 +94,7 @@ struct efi_rs_state efi_rs_enter(void)
         return state;
 
     state.cr3 = read_cr3();
-    save_fpu_enable();
+    vcpu_save_fpu(current);
     asm volatile ( "fnclex; fldcw %0" :: "m" (fcw) );
     asm volatile ( "ldmxcsr %0" :: "m" (mxcsr) );
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 31 11:33:07 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 31 Mar 2026 11:33:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1268866.1558047 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7XLD-0007kl-8E; Tue, 31 Mar 2026 11:33:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1268866.1558047; Tue, 31 Mar 2026 11:33:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7XLD-0007ke-5M; Tue, 31 Mar 2026 11:33:03 +0000
Received: by outflank-mailman (input) for mailman id 1268866;
 Tue, 31 Mar 2026 11:33:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w7XLC-0007kY-5j
 for xen-changelog@lists.xenproject.org; Tue, 31 Mar 2026 11:33:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7XLC-001L2m-0w
 for xen-changelog@lists.xenproject.org;
 Tue, 31 Mar 2026 11:33:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7XLC-00C0dG-04
 for xen-changelog@lists.xenproject.org;
 Tue, 31 Mar 2026 11:33:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=fv9+RBU53Fxn4rPYKDypsbEGnepHOU0ckP1OUSBUk5Q=; b=29WntK4SmuhbQa35fldnhxlR7J
	/AbwmGCK2jlSaJzRuNTYsq3kpS+hvF9AwJDM/bTT77Ucyo6en60w1cKyLPVzvDOPbbFcj6UsPMq/s
	C+cncj66wwcHo6+fWP4TLf8SAq31ub75srnBW6+919aD3nn9u2JENvNNGDndWtEwCzk4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: Implement PSCI SYSTEM_SUSPEND call for guests
Message-Id: <E1w7XLC-00C0dG-04@xenbits.xenproject.org>
Date: Tue, 31 Mar 2026 11:33:02 +0000

commit 1e3dc2f86695687e354d14091aa876149de4fcdc
Author:     Mykola Kvach <mykola_kvach@epam.com>
AuthorDate: Tue Mar 24 14:26:34 2026 +0200
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Tue Mar 31 10:54:46 2026 +0200

    xen/arm: Implement PSCI SYSTEM_SUSPEND call for guests
    
    Add support for the PSCI SYSTEM_SUSPEND function in the vPSCI interface,
    allowing guests to request suspend via the PSCI v1.0+ SYSTEM_SUSPEND call
    (both 32-bit and 64-bit variants).
    
    Implementation details:
    - Add SYSTEM_SUSPEND function IDs to PSCI definitions
    - Trap and handle SYSTEM_SUSPEND in vPSCI
    - Reject SYSTEM_SUSPEND for the hardware domain to avoid host shutdown
    - Require all secondary VCPUs to be offline before suspend
    - Split arch_set_info_guest() into arch_vcpu_validate_guest_context() and
      arch_vcpu_apply_guest_context() for reuse by vPSCI
    - Add vpsci_build_guest_context() helper and store prevalidated context in
      resume_ctx; resume applies it and frees it
    - Add arch_domain_resume() function is an architecture-specific hook that
      is invoked during domain resume to perform any necessary setup or
      restoration steps required by the platform.
    
    Usage:
    
    For Linux-based guests, suspend can be initiated with:
        echo mem > /sys/power/state
    or via:
        systemctl suspend
    
    Resume from control domain:
          xl resume <domain>
    
    Signed-off-by: Mykola Kvach <mykola_kvach@epam.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
 xen/arch/arm/domain.c                 |  86 ++++++++++++++++----
 xen/arch/arm/include/asm/domain.h     |   7 ++
 xen/arch/arm/include/asm/perfc_defn.h |   1 +
 xen/arch/arm/include/asm/psci.h       |   2 +
 xen/arch/arm/include/asm/suspend.h    |  27 +++++++
 xen/arch/arm/include/asm/vpsci.h      |   2 +-
 xen/arch/arm/vpsci.c                  | 146 +++++++++++++++++++++++++++-------
 xen/common/domain.c                   |   4 +
 xen/include/xen/suspend.h             |  22 +++++
 9 files changed, 255 insertions(+), 42 deletions(-)

diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c
index 94b9858ad2..581f82bddd 100644
--- a/xen/arch/arm/domain.c
+++ b/xen/arch/arm/domain.c
@@ -12,6 +12,8 @@
 #include <xen/softirq.h>
 #include <xen/wait.h>
 
+#include <public/sched.h>
+
 #include <asm/arm64/sve.h>
 #include <asm/cpuerrata.h>
 #include <asm/cpufeature.h>
@@ -24,10 +26,12 @@
 #include <asm/platform.h>
 #include <asm/procinfo.h>
 #include <asm/regs.h>
+#include <asm/suspend.h>
 #include <asm/firmware/sci.h>
 #include <asm/tee/tee.h>
 #include <asm/vfp.h>
 #include <asm/vgic.h>
+#include <asm/vpsci.h>
 #include <asm/vtimer.h>
 
 #include "vpci.h"
@@ -770,8 +774,18 @@ int arch_domain_teardown(struct domain *d)
     return 0;
 }
 
+static void resume_ctx_reset(struct resume_info *ctx)
+{
+    if ( ctx->ctxt )
+        free_vcpu_guest_context(ctx->ctxt);
+
+    memset(ctx, 0, sizeof(*ctx));
+}
+
 void arch_domain_destroy(struct domain *d)
 {
+    resume_ctx_reset(&d->arch.resume_ctx);
+
     tee_free_domain_ctx(d);
     /* IOMMU page table is shared with P2M, always call
      * iommu_domain_destroy() before p2m_final_teardown().
@@ -806,6 +820,28 @@ void arch_domain_creation_finished(struct domain *d)
     p2m_domain_creation_finished(d);
 }
 
+void arch_domain_resume(struct domain *d)
+{
+    struct resume_info *ctx = &d->arch.resume_ctx;
+
+    /*
+     * It is still possible to call domain_shutdown() with a suspend reason
+     * via some hypercalls, such as SCHEDOP_shutdown or SCHEDOP_remote_shutdown.
+     * In these cases, the resume context will be empty, so there is no
+     * suspend-specific state to restore.
+     */
+    if ( !ctx->wake_cpu )
+        return;
+
+    ASSERT(d->shutdown_code == SHUTDOWN_suspend);
+
+    domain_lock(d);
+    arch_vcpu_apply_guest_context(ctx->wake_cpu, ctx->ctxt);
+    domain_unlock(d);
+
+    resume_ctx_reset(ctx);
+}
+
 static int is_guest_pv32_psr(uint32_t psr)
 {
     switch (psr & PSR_MODE_MASK)
@@ -848,15 +884,32 @@ static int is_guest_pv64_psr(uint64_t psr)
 }
 #endif
 
+void arch_vcpu_apply_guest_context(struct vcpu *v,
+                                   const struct vcpu_guest_context *ctxt)
+{
+    vcpu_regs_user_to_hyp(v, &ctxt->user_regs);
+
+    v->arch.sctlr = ctxt->sctlr;
+    v->arch.ttbr0 = ctxt->ttbr0;
+    v->arch.ttbr1 = ctxt->ttbr1;
+    v->arch.ttbcr = ctxt->ttbcr;
+
+    v->is_initialised = 1;
+
+    if ( ctxt->flags & VGCF_online )
+        clear_bit(_VPF_down, &v->pause_flags);
+    else
+        set_bit(_VPF_down, &v->pause_flags);
+}
+
 /*
  * Initialise vCPU state. The context may be supplied by an external entity, so
  * we need to validate it.
  */
-int arch_set_info_guest(
-    struct vcpu *v, vcpu_guest_context_u c)
+int arch_vcpu_validate_guest_context(const struct vcpu *v,
+                                     const struct vcpu_guest_context *ctxt)
 {
-    struct vcpu_guest_context *ctxt = c.nat;
-    struct vcpu_guest_core_regs *regs = &c.nat->user_regs;
+    const struct vcpu_guest_core_regs *regs = &ctxt->user_regs;
 
     if ( is_32bit_domain(v->domain) )
     {
@@ -885,19 +938,24 @@ int arch_set_info_guest(
     }
 #endif
 
-    vcpu_regs_user_to_hyp(v, regs);
+    return 0;
+}
 
-    v->arch.sctlr = ctxt->sctlr;
-    v->arch.ttbr0 = ctxt->ttbr0;
-    v->arch.ttbr1 = ctxt->ttbr1;
-    v->arch.ttbcr = ctxt->ttbcr;
+/*
+ * Initialise vCPU state. The context may be supplied by an external entity, so
+ * we need to validate it.
+ */
+int arch_set_info_guest(
+    struct vcpu *v, vcpu_guest_context_u c)
+{
+    struct vcpu_guest_context *ctxt = c.nat;
+    int rc;
 
-    v->is_initialised = 1;
+    rc = arch_vcpu_validate_guest_context(v, ctxt);
+    if ( rc )
+        return rc;
 
-    if ( ctxt->flags & VGCF_online )
-        clear_bit(_VPF_down, &v->pause_flags);
-    else
-        set_bit(_VPF_down, &v->pause_flags);
+    arch_vcpu_apply_guest_context(v, ctxt);
 
     return 0;
 }
diff --git a/xen/arch/arm/include/asm/domain.h b/xen/arch/arm/include/asm/domain.h
index 758ad807e4..ffe5d0d9f0 100644
--- a/xen/arch/arm/include/asm/domain.h
+++ b/xen/arch/arm/include/asm/domain.h
@@ -5,6 +5,7 @@
 #include <xen/timer.h>
 #include <asm/page.h>
 #include <asm/p2m.h>
+#include <asm/suspend.h>
 #include <asm/vfp.h>
 #include <asm/mmio.h>
 #include <asm/gic.h>
@@ -126,6 +127,7 @@ struct arch_domain
     void *sci_data;
 #endif
 
+    struct resume_info resume_ctx;
 }  __cacheline_aligned;
 
 struct arch_vcpu
@@ -290,6 +292,11 @@ static inline register_t vcpuid_to_vaffinity(unsigned int vcpuid)
     return vaff;
 }
 
+int arch_vcpu_validate_guest_context(const struct vcpu *v,
+                                     const struct vcpu_guest_context *ctxt);
+void arch_vcpu_apply_guest_context(struct vcpu *v,
+                                   const struct vcpu_guest_context *ctxt);
+
 static inline struct vcpu_guest_context *alloc_vcpu_guest_context(void)
 {
     return xmalloc(struct vcpu_guest_context);
diff --git a/xen/arch/arm/include/asm/perfc_defn.h b/xen/arch/arm/include/asm/perfc_defn.h
index effd25b69e..8dfcac7e3b 100644
--- a/xen/arch/arm/include/asm/perfc_defn.h
+++ b/xen/arch/arm/include/asm/perfc_defn.h
@@ -33,6 +33,7 @@ PERFCOUNTER(vpsci_system_reset,        "vpsci: system_reset")
 PERFCOUNTER(vpsci_cpu_suspend,         "vpsci: cpu_suspend")
 PERFCOUNTER(vpsci_cpu_affinity_info,   "vpsci: cpu_affinity_info")
 PERFCOUNTER(vpsci_features,            "vpsci: features")
+PERFCOUNTER(vpsci_system_suspend,      "vpsci: system_suspend")
 
 PERFCOUNTER(vcpu_kick,                 "vcpu: notify other vcpu")
 
diff --git a/xen/arch/arm/include/asm/psci.h b/xen/arch/arm/include/asm/psci.h
index 4780972621..48a93e6b79 100644
--- a/xen/arch/arm/include/asm/psci.h
+++ b/xen/arch/arm/include/asm/psci.h
@@ -47,10 +47,12 @@ void call_psci_system_reset(void);
 #define PSCI_0_2_FN32_SYSTEM_OFF          PSCI_0_2_FN32(8)
 #define PSCI_0_2_FN32_SYSTEM_RESET        PSCI_0_2_FN32(9)
 #define PSCI_1_0_FN32_PSCI_FEATURES       PSCI_0_2_FN32(10)
+#define PSCI_1_0_FN32_SYSTEM_SUSPEND      PSCI_0_2_FN32(14)
 
 #define PSCI_0_2_FN64_CPU_SUSPEND         PSCI_0_2_FN64(1)
 #define PSCI_0_2_FN64_CPU_ON              PSCI_0_2_FN64(3)
 #define PSCI_0_2_FN64_AFFINITY_INFO       PSCI_0_2_FN64(4)
+#define PSCI_1_0_FN64_SYSTEM_SUSPEND      PSCI_0_2_FN64(14)
 
 /* PSCI v0.2 affinity level state returned by AFFINITY_INFO */
 #define PSCI_0_2_AFFINITY_LEVEL_ON      0
diff --git a/xen/arch/arm/include/asm/suspend.h b/xen/arch/arm/include/asm/suspend.h
new file mode 100644
index 0000000000..31a98a1f1b
--- /dev/null
+++ b/xen/arch/arm/include/asm/suspend.h
@@ -0,0 +1,27 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#ifndef ARM_SUSPEND_H
+#define ARM_SUSPEND_H
+
+struct domain;
+struct vcpu;
+struct vcpu_guest_context;
+
+struct resume_info {
+    struct vcpu_guest_context *ctxt;
+    struct vcpu *wake_cpu;
+};
+
+void arch_domain_resume(struct domain *d);
+
+#endif /* ARM_SUSPEND_H */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff --git a/xen/arch/arm/include/asm/vpsci.h b/xen/arch/arm/include/asm/vpsci.h
index 0cca5e6830..69d40f9d7f 100644
--- a/xen/arch/arm/include/asm/vpsci.h
+++ b/xen/arch/arm/include/asm/vpsci.h
@@ -23,7 +23,7 @@
 #include <asm/psci.h>
 
 /* Number of function implemented by virtual PSCI (only 0.2 or later) */
-#define VPSCI_NR_FUNCS  12
+#define VPSCI_NR_FUNCS  14
 
 /* Functions handle PSCI calls from the guests */
 bool do_vpsci_0_1_call(struct cpu_user_regs *regs, uint32_t fid);
diff --git a/xen/arch/arm/vpsci.c b/xen/arch/arm/vpsci.c
index 7ba9ccd94b..bd87ec430d 100644
--- a/xen/arch/arm/vpsci.c
+++ b/xen/arch/arm/vpsci.c
@@ -4,38 +4,24 @@
 #include <xen/types.h>
 
 #include <asm/current.h>
+#include <asm/domain.h>
 #include <asm/vgic.h>
 #include <asm/vpsci.h>
 #include <asm/event.h>
 
 #include <public/sched.h>
 
-static int do_common_cpu_on(register_t target_cpu, register_t entry_point,
-                            register_t context_id)
+static int vpsci_build_guest_context(struct vcpu *v, register_t entry_point,
+                                     register_t context_id,
+                                     struct vcpu_guest_context **out)
 {
-    struct vcpu *v;
-    struct domain *d = current->domain;
+    bool is_thumb = entry_point & 1;
     struct vcpu_guest_context *ctxt;
     int rc;
-    bool is_thumb = entry_point & 1;
-    register_t vcpuid;
-
-    vcpuid = vaffinity_to_vcpuid(target_cpu);
 
-    if ( (v = domain_vcpu(d, vcpuid)) == NULL )
-        return PSCI_INVALID_PARAMETERS;
-
-    /* THUMB set is not allowed with 64-bit domain */
-    if ( is_64bit_domain(d) && is_thumb )
-        return PSCI_INVALID_ADDRESS;
-
-    if ( !test_bit(_VPF_down, &v->pause_flags) )
-        return PSCI_ALREADY_ON;
-
-    if ( (ctxt = alloc_vcpu_guest_context()) == NULL )
-        return PSCI_DENIED;
-
-    vgic_clear_pending_irqs(v);
+    ctxt = alloc_vcpu_guest_context();
+    if ( ctxt == NULL )
+        return -ENOMEM;
 
     memset(ctxt, 0, sizeof(*ctxt));
     ctxt->user_regs.pc64 = (u64) entry_point;
@@ -48,7 +34,7 @@ static int do_common_cpu_on(register_t target_cpu, register_t entry_point,
      * x0/r0_usr are always updated because for PSCI 0.1 the general
      * purpose registers are undefined upon CPU_on.
      */
-    if ( is_32bit_domain(d) )
+    if ( is_32bit_domain(v->domain) )
     {
         ctxt->user_regs.cpsr = PSR_GUEST32_INIT;
         /* Start the VCPU with THUMB set if it's requested by the kernel */
@@ -69,15 +55,51 @@ static int do_common_cpu_on(register_t target_cpu, register_t entry_point,
 #endif
     ctxt->flags = VGCF_online;
 
-    domain_lock(d);
-    rc = arch_set_info_guest(v, ctxt);
-    domain_unlock(d);
+    rc = arch_vcpu_validate_guest_context(v, ctxt);
+    if ( rc )
+    {
+        free_vcpu_guest_context(ctxt);
+        return rc;
+    }
 
-    free_vcpu_guest_context(ctxt);
+    *out = ctxt;
+    return 0;
+}
+
+static int do_common_cpu_on(register_t target_cpu, register_t entry_point,
+                            register_t context_id)
+{
+    struct vcpu *v;
+    struct domain *d = current->domain;
+    struct vcpu_guest_context *ctxt = NULL;
+    int rc;
+    bool is_thumb = entry_point & 1;
+    register_t vcpuid;
+
+    vcpuid = vaffinity_to_vcpuid(target_cpu);
+
+    if ( (v = domain_vcpu(d, vcpuid)) == NULL )
+        return PSCI_INVALID_PARAMETERS;
+
+    /* THUMB set is not allowed with 64-bit domain */
+    if ( is_64bit_domain(d) && is_thumb )
+        return PSCI_INVALID_ADDRESS;
 
+    if ( !test_bit(_VPF_down, &v->pause_flags) )
+        return PSCI_ALREADY_ON;
+
+    rc = vpsci_build_guest_context(v, entry_point, context_id, &ctxt);
     if ( rc < 0 )
         return PSCI_DENIED;
 
+    vgic_clear_pending_irqs(v);
+
+    domain_lock(d);
+    arch_vcpu_apply_guest_context(v, ctxt);
+    domain_unlock(d);
+
+    free_vcpu_guest_context(ctxt);
+
     vcpu_wake(v);
 
     return PSCI_SUCCESS;
@@ -197,6 +219,56 @@ static void do_psci_0_2_system_reset(void)
     domain_shutdown(d,SHUTDOWN_reboot);
 }
 
+static int32_t do_psci_1_0_system_suspend(register_t epoint, register_t cid)
+{
+    int32_t rc;
+    struct vcpu_guest_context *ctxt;
+    struct vcpu *v;
+    struct domain *d = current->domain;
+    bool is_thumb = epoint & 1;
+    struct resume_info *rctx = &d->arch.resume_ctx;
+
+    /* THUMB set is not allowed with 64-bit domain */
+    if ( is_64bit_domain(d) && is_thumb )
+        return PSCI_INVALID_ADDRESS;
+
+    /* SYSTEM_SUSPEND is not supported for the hardware domain yet */
+    if ( is_hardware_domain(d) )
+        return PSCI_NOT_SUPPORTED;
+
+    /* Ensure that all CPUs other than the calling one are offline */
+    domain_lock(d);
+    for_each_vcpu ( d, v )
+    {
+        if ( v != current && is_vcpu_online(v) )
+        {
+            domain_unlock(d);
+            return PSCI_DENIED;
+        }
+    }
+    domain_unlock(d);
+
+    rc = vpsci_build_guest_context(current, epoint, cid, &ctxt);
+    if ( rc )
+        return PSCI_DENIED;
+
+    rc = domain_shutdown(d, SHUTDOWN_suspend);
+    if ( rc )
+    {
+        free_vcpu_guest_context(ctxt);
+        return PSCI_DENIED;
+    }
+
+    rctx->ctxt = ctxt;
+    rctx->wake_cpu = current;
+
+    gprintk(XENLOG_DEBUG,
+            "SYSTEM_SUSPEND requested, epoint=%#"PRIregister", cid=%#"PRIregister"\n",
+            epoint, cid);
+
+    return rc;
+}
+
 static int32_t do_psci_1_0_features(uint32_t psci_func_id)
 {
     /* /!\ Ordered by function ID and not name */
@@ -216,6 +288,9 @@ static int32_t do_psci_1_0_features(uint32_t psci_func_id)
     case PSCI_1_0_FN32_PSCI_FEATURES:
     case ARM_SMCCC_VERSION_FID:
         return 0;
+    case PSCI_1_0_FN32_SYSTEM_SUSPEND:
+    case PSCI_1_0_FN64_SYSTEM_SUSPEND:
+        return is_hardware_domain(current->domain) ? PSCI_NOT_SUPPORTED : 0;
     default:
         return PSCI_NOT_SUPPORTED;
     }
@@ -344,6 +419,23 @@ bool do_vpsci_0_2_call(struct cpu_user_regs *regs, uint32_t fid)
         return true;
     }
 
+    case PSCI_1_0_FN32_SYSTEM_SUSPEND:
+    case PSCI_1_0_FN64_SYSTEM_SUSPEND:
+    {
+        register_t epoint = PSCI_ARG(regs, 1);
+        register_t cid = PSCI_ARG(regs, 2);
+
+        if ( fid == PSCI_1_0_FN32_SYSTEM_SUSPEND )
+        {
+            epoint &= GENMASK(31, 0);
+            cid &= GENMASK(31, 0);
+        }
+
+        perfc_incr(vpsci_system_suspend);
+        PSCI_SET_RESULT(regs, do_psci_1_0_system_suspend(epoint, cid));
+        return true;
+    }
+
     default:
         return false;
     }
diff --git a/xen/common/domain.c b/xen/common/domain.c
index 30cfea3045..bb9e210c28 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -26,6 +26,7 @@
 #include <xen/hypercall.h>
 #include <xen/delay.h>
 #include <xen/shutdown.h>
+#include <xen/suspend.h>
 #include <xen/percpu.h>
 #include <xen/multicall.h>
 #include <xen/rcupdate.h>
@@ -1435,6 +1436,9 @@ void domain_resume(struct domain *d)
     spin_lock(&d->shutdown_lock);
 
     d->is_shutting_down = d->is_shut_down = 0;
+
+    arch_domain_resume(d);
+
     d->shutdown_code = SHUTDOWN_CODE_INVALID;
 
     for_each_vcpu ( d, v )
diff --git a/xen/include/xen/suspend.h b/xen/include/xen/suspend.h
new file mode 100644
index 0000000000..6f94fd53b0
--- /dev/null
+++ b/xen/include/xen/suspend.h
@@ -0,0 +1,22 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#ifndef XEN_SUSPEND_H
+#define XEN_SUSPEND_H
+
+#if __has_include(<asm/suspend.h>)
+#include <asm/suspend.h>
+#else
+static inline void arch_domain_resume(struct domain *d) {}
+#endif
+
+#endif /* XEN_SUSPEND_H */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 31 11:33:13 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 31 Mar 2026 11:33:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1268867.1558053 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7XLN-0007n5-CV; Tue, 31 Mar 2026 11:33:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1268867.1558053; Tue, 31 Mar 2026 11:33:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7XLN-0007mv-9K; Tue, 31 Mar 2026 11:33:13 +0000
Received: by outflank-mailman (input) for mailman id 1268867;
 Tue, 31 Mar 2026 11:33:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w7XLM-0007ml-7O
 for xen-changelog@lists.xenproject.org; Tue, 31 Mar 2026 11:33:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7XLM-001L2q-1J
 for xen-changelog@lists.xenproject.org;
 Tue, 31 Mar 2026 11:33:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7XLM-00C0dl-0T
 for xen-changelog@lists.xenproject.org;
 Tue, 31 Mar 2026 11:33:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=pzrAD8WgNmVmKmt6n57uugp3GIjwLWW2AoL0E6jHbCc=; b=KMmkL/1IKJ8EdvrjWnNGHBD0O9
	+jxIW/ATaZBREbBZo0e4+yUEZJQvSByMglclx7jTDVb/EOa8+DLiGHazTJDkwaezhcHtZyGXBurRT
	2n9yjNmvOKSN78FW3DXB3uhZqlV7fi0deLYob64cwsxMYjZVGXV56UJLcoUbniTezGfU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/xl: Allow compilation of 'xl resume' command on Arm
Message-Id: <E1w7XLM-00C0dl-0T@xenbits.xenproject.org>
Date: Tue, 31 Mar 2026 11:33:12 +0000

commit a3971271ec08476bc888885efbaeaec16a597a69
Author:     Mykola Kvach <mykola_kvach@epam.com>
AuthorDate: Tue Mar 24 14:26:35 2026 +0200
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Tue Mar 31 10:54:52 2026 +0200

    tools/xl: Allow compilation of 'xl resume' command on Arm
    
    The "xl resume" command was previously excluded from Arm builds because
    system suspend/resume (e.g., SYSTEM_SUSPEND via vPSCI) was not
    implemented. On x86, this command is used for resume.
    
    This change enables compilation of `xl resume` on Arm regardless of the
    underlying implementation status, making the tool available for testing
    and future feature support. The relevant libxl infrastructure and handler
    functions are already present and usable.
    
    Note: This does not imply full system suspend/resume support on Arm.
          The `xl suspend` command still does not work on Arm platforms.
    
    Signed-off-by: Mykola Kvach <mykola_kvach@epam.com>
    Acked-by: Anthony PERARD <anthony.perard@vates.tech>
---
 tools/include/libxl.h     |  1 -
 tools/xl/xl.h             |  4 ++--
 tools/xl/xl_cmdtable.c    |  4 ++--
 tools/xl/xl_migrate.c     |  2 +-
 tools/xl/xl_saverestore.c |  2 +-
 tools/xl/xl_vmcontrol.c   | 12 ++++++------
 6 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/tools/include/libxl.h b/tools/include/libxl.h
index 80e3ec8de9..7c098edab6 100644
--- a/tools/include/libxl.h
+++ b/tools/include/libxl.h
@@ -1145,7 +1145,6 @@ typedef struct libxl__ctx libxl_ctx;
  * restoring or migrating a domain. In this case the related functions
  * should be expected to return failure. That is:
  *  - libxl_domain_suspend
- *  - libxl_domain_resume
  *  - libxl_domain_remus_start
  */
 #if defined(__arm__) || defined(__aarch64__)
diff --git a/tools/xl/xl.h b/tools/xl/xl.h
index 0efc07a6ba..7b75f9a493 100644
--- a/tools/xl/xl.h
+++ b/tools/xl/xl.h
@@ -65,7 +65,7 @@ static const char migrate_permission_to_go[]=
     "domain is yours, you are cleared to unpause";
 static const char migrate_report[]=
     "my copy unpause results are as follows";
-#endif
+#endif /* !LIBXL_HAVE_NO_SUSPEND_RESUME */
 
   /* followed by one byte:
    *     0: everything went well, domain is running
@@ -130,8 +130,8 @@ int main_migrate_receive(int argc, char **argv);
 int main_save(int argc, char **argv);
 int main_migrate(int argc, char **argv);
 int main_suspend(int argc, char **argv);
+#endif /* !LIBXL_HAVE_NO_SUSPEND_RESUME */
 int main_resume(int argc, char **argv);
-#endif
 int main_dump_core(int argc, char **argv);
 int main_pause(int argc, char **argv);
 int main_unpause(int argc, char **argv);
diff --git a/tools/xl/xl_cmdtable.c b/tools/xl/xl_cmdtable.c
index 5098f72ab4..502244f683 100644
--- a/tools/xl/xl_cmdtable.c
+++ b/tools/xl/xl_cmdtable.c
@@ -198,12 +198,12 @@ const struct cmd_spec cmd_table[] = {
       "Suspend a domain to RAM",
       "<Domain>",
     },
+#endif /* !LIBXL_HAVE_NO_SUSPEND_RESUME */
     { "resume",
       &main_resume, 0, 1,
       "Resume a domain from RAM",
       "<Domain>",
     },
-#endif
     { "dump-core",
       &main_dump_core, 0, 1,
       "Core dump a domain",
@@ -548,7 +548,7 @@ const struct cmd_spec cmd_table[] = {
       "                        checkpoint must be disabled.\n"
       "-p                      Use COLO userspace proxy."
     },
-#endif
+#endif /* !LIBXL_HAVE_NO_SUSPEND_RESUME */
     { "devd",
       &main_devd, 0, 1,
       "Daemon that listens for devices and launches backends",
diff --git a/tools/xl/xl_migrate.c b/tools/xl/xl_migrate.c
index b8594f44a5..4b4a379aa1 100644
--- a/tools/xl/xl_migrate.c
+++ b/tools/xl/xl_migrate.c
@@ -767,7 +767,7 @@ int main_remus(int argc, char **argv)
     close(send_fd);
     return EXIT_FAILURE;
 }
-#endif
+#endif /* !LIBXL_HAVE_NO_SUSPEND_RESUME */
 
 
 /*
diff --git a/tools/xl/xl_saverestore.c b/tools/xl/xl_saverestore.c
index 953d791d1a..747094ec7b 100644
--- a/tools/xl/xl_saverestore.c
+++ b/tools/xl/xl_saverestore.c
@@ -270,7 +270,7 @@ int main_save(int argc, char **argv)
     return EXIT_SUCCESS;
 }
 
-#endif /* LIBXL_HAVE_NO_SUSPEND_RESUME */
+#endif /* !LIBXL_HAVE_NO_SUSPEND_RESUME */
 
 
 
diff --git a/tools/xl/xl_vmcontrol.c b/tools/xl/xl_vmcontrol.c
index c813732838..93766f631b 100644
--- a/tools/xl/xl_vmcontrol.c
+++ b/tools/xl/xl_vmcontrol.c
@@ -38,11 +38,6 @@ static void suspend_domain(uint32_t domid)
     libxl_domain_suspend_only(ctx, domid, NULL);
 }
 
-static void resume_domain(uint32_t domid)
-{
-    libxl_domain_resume(ctx, domid, 1, NULL);
-}
-
 int main_suspend(int argc, char **argv)
 {
     int opt;
@@ -55,6 +50,12 @@ int main_suspend(int argc, char **argv)
 
     return EXIT_SUCCESS;
 }
+#endif /* !LIBXL_HAVE_NO_SUSPEND_RESUME */
+
+static void resume_domain(uint32_t domid)
+{
+    libxl_domain_resume(ctx, domid, 1, NULL);
+}
 
 int main_resume(int argc, char **argv)
 {
@@ -68,7 +69,6 @@ int main_resume(int argc, char **argv)
 
     return EXIT_SUCCESS;
 }
-#endif
 
 static void pause_domain(uint32_t domid)
 {
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 31 11:33:23 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 31 Mar 2026 11:33:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1268868.1558054 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7XLX-0007pD-DE; Tue, 31 Mar 2026 11:33:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1268868.1558054; Tue, 31 Mar 2026 11:33:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7XLX-0007p6-Ae; Tue, 31 Mar 2026 11:33:23 +0000
Received: by outflank-mailman (input) for mailman id 1268868;
 Tue, 31 Mar 2026 11:33:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w7XLW-0007oz-AT
 for xen-changelog@lists.xenproject.org; Tue, 31 Mar 2026 11:33:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7XLW-001L2u-1d
 for xen-changelog@lists.xenproject.org;
 Tue, 31 Mar 2026 11:33:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7XLW-00C0eF-0n
 for xen-changelog@lists.xenproject.org;
 Tue, 31 Mar 2026 11:33:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=s+LTck4nvAIrZ6PSEgGwUR0L/AnQrBHY8t/eUyXGfNw=; b=dmpTfG6YfKq5Eb2/q0+DBw9as4
	MGyOznx8pi66htieYalBKpfV6PvxlQ7ABsrHpuk9mAZOlwAMcI+dQcJZJHcmxumpfUh3NpgbFEA5Q
	UlgWvHNhYexvwxP2AZnQEEreYicKPmiZVbG6blyahvAvf+v7UbUAJFjsr5hd8UcSGSAU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] SUPPORT.md: Document PSCI SYSTEM_SUSPEND support for guests
Message-Id: <E1w7XLW-00C0eF-0n@xenbits.xenproject.org>
Date: Tue, 31 Mar 2026 11:33:22 +0000

commit 174896b7c170fa4c1d4e274562eb685768a14450
Author:     Mykola Kvach <mykola_kvach@epam.com>
AuthorDate: Tue Mar 24 14:26:36 2026 +0200
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Tue Mar 31 10:54:52 2026 +0200

    SUPPORT.md: Document PSCI SYSTEM_SUSPEND support for guests
    
    Add a new entry under the "Virtual Hardware, Hypervisor" section
    documenting support for the optional PSCI SYSTEM_SUSPEND function
    exposed to guests.
    
    This function is available via the virtual PSCI interface and allows
    guest domains (domUs) to initiate system suspend operations.
    
    The feature is currently marked as "Tech Preview".
    
    Signed-off-by: Mykola Kvach <mykola_kvach@epam.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 SUPPORT.md | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/SUPPORT.md b/SUPPORT.md
index d441bccf37..8e7ab7cb3e 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -962,8 +962,9 @@ Emulated PSCI interface exposed to guests. We support all mandatory
 functions of PSCI 1.1. See below for the list of optional PSCI call
 implemented and their status.
 
-   Status, Mandatory: Supported
-   Status, MIGRATE_INFO_TYPE: Supported
+    Status, Mandatory: Supported
+    Status, MIGRATE_INFO_TYPE: Supported
+    Status, SYSTEM_SUSPEND: Tech Preview
 
 ## Virtual Hardware, QEMU
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 31 11:33:34 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 31 Mar 2026 11:33:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1268869.1558059 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7XLi-0007rE-FB; Tue, 31 Mar 2026 11:33:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1268869.1558059; Tue, 31 Mar 2026 11:33:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7XLi-0007r6-C9; Tue, 31 Mar 2026 11:33:34 +0000
Received: by outflank-mailman (input) for mailman id 1268869;
 Tue, 31 Mar 2026 11:33:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w7XLg-0007qz-DN
 for xen-changelog@lists.xenproject.org; Tue, 31 Mar 2026 11:33:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7XLg-001L2y-1t
 for xen-changelog@lists.xenproject.org;
 Tue, 31 Mar 2026 11:33:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7XLg-00C0ep-17
 for xen-changelog@lists.xenproject.org;
 Tue, 31 Mar 2026 11:33:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=NLxNNvBWJfZREDMlBJMeVSyOtgbr1CFlpmNd2/Cg/PQ=; b=QTtTQKg92MDgemcCqMpBuyxdyr
	9D/Q2f9aT5QB1ZBuqkMcyojBO04bdoyNO9bMlY4QwOSAbclWwrz/nSISWCEL7wKMwIuXpqOQaELzh
	BwCsKBhG0iHHCSbn8NEchBrOoktbDT+8phFNtjkMiWRUhbNc/58XOBPxh9vGRp/VATsA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] CHANGELOG: Document guest suspend/resume to RAM support on Arm
Message-Id: <E1w7XLg-00C0ep-17@xenbits.xenproject.org>
Date: Tue, 31 Mar 2026 11:33:32 +0000

commit d92f27a5c9012e1ec9fb89d518aa5f938f747595
Author:     Mykola Kvach <mykola_kvach@epam.com>
AuthorDate: Tue Mar 24 14:26:37 2026 +0200
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Tue Mar 31 10:54:52 2026 +0200

    CHANGELOG: Document guest suspend/resume to RAM support on Arm
    
    Mention the newly added support for guest suspend and resume to/from
    RAM via vPSCI on Arm platforms.
    
    This support is limited to non-hardware domain guests.
    
    Signed-off-by: Mykola Kvach <mykola_kvach@epam.com>
    Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
---
 CHANGELOG.md | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6d4610d5f1..0a065c7a8e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -17,6 +17,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
      misusing atomic instructions.
    - Support for CPIO microcode in discrete multiboot modules.
 
+ - On Arm:
+   - Support for guest suspend and resume to/from RAM via vPSCI.
+     Applies only to non-hardware domain guests.
+
 ### Removed
  - On x86:
    - The cpuid_mask_* command line options for legacy CPUs.  These were
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 31 11:33:44 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 31 Mar 2026 11:33:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1268870.1558062 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7XLs-0007tF-G7; Tue, 31 Mar 2026 11:33:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1268870.1558062; Tue, 31 Mar 2026 11:33:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7XLs-0007t7-Dc; Tue, 31 Mar 2026 11:33:44 +0000
Received: by outflank-mailman (input) for mailman id 1268870;
 Tue, 31 Mar 2026 11:33:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w7XLq-0007t0-GP
 for xen-changelog@lists.xenproject.org; Tue, 31 Mar 2026 11:33:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7XLq-001L34-2B
 for xen-changelog@lists.xenproject.org;
 Tue, 31 Mar 2026 11:33:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7XLq-00C0fH-1N
 for xen-changelog@lists.xenproject.org;
 Tue, 31 Mar 2026 11:33:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=vf+rGkFFEUgDfhc71HT4X8+nNHTsgV08xJz/Qr4x0WE=; b=e0QhrmmWduqVL2Aya68sIBkyBt
	tFN3uMU2iC0p0xXcMZgE9ZD7IUR2vGiT3UYLevQOzLq1oXU3OjqrcUT6sHPhlZUb/62Z7eCTKhxia
	CNkhvWUTAY5hyrM294frWPEp8IjB6c4+49k0d3qiERoWzN+w5E5HlCQIqXQE2WEjfzCE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: ffa: Fix local ffa_vm_count shadowing
Message-Id: <E1w7XLq-00C0fH-1N@xenbits.xenproject.org>
Date: Tue, 31 Mar 2026 11:33:42 +0000

commit 7e693b967bb5f94d72ed72f32add4d844b154b68
Author:     Bertrand Marquis <bertrand.marquis@arm.com>
AuthorDate: Fri Mar 20 10:07:21 2026 +0100
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Tue Mar 31 11:01:12 2026 +0200

    xen/arm: ffa: Fix local ffa_vm_count shadowing
    
    ffa_handle_partition_info_get() declares a local variable named
    ffa_vm_count, which hides the global atomic ffa_vm_count declared in
    ffa_private.h.
    
    This triggered the ECLAIR Rule 5.3 finding "non-compliant local variable
    `ffa_vm_count'".
    
    Rename the local counters to vm_count and sp_count and update their
    uses.
    
    No functional changes.
    
    Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
---
 xen/arch/arm/tee/ffa_partinfo.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/xen/arch/arm/tee/ffa_partinfo.c b/xen/arch/arm/tee/ffa_partinfo.c
index 4580bd5edb..ed28820502 100644
--- a/xen/arch/arm/tee/ffa_partinfo.c
+++ b/xen/arch/arm/tee/ffa_partinfo.c
@@ -346,7 +346,7 @@ void ffa_handle_partition_info_get(struct cpu_user_regs *regs)
     uint32_t dst_size = 0;
     size_t buf_size;
     void *dst_buf, *end_buf;
-    uint32_t ffa_vm_count = 0, ffa_sp_count = 0;
+    uint32_t vm_count = 0, sp_count = 0;
 
     ffa_uuid_set(&uuid,
              get_user_reg(regs, 1),
@@ -380,7 +380,7 @@ void ffa_handle_partition_info_get(struct cpu_user_regs *regs)
 
         if ( ffa_fw_supports_fid(FFA_PARTITION_INFO_GET) )
         {
-            ret = ffa_get_sp_count(uuid, &ffa_sp_count);
+            ret = ffa_get_sp_count(uuid, &sp_count);
             if ( ret )
                 goto out;
         }
@@ -391,7 +391,7 @@ void ffa_handle_partition_info_get(struct cpu_user_regs *regs)
          */
         if ( ffa_uuid_is_nil(uuid) )
         {
-            ffa_vm_count = get_ffa_vm_count();
+            vm_count = get_ffa_vm_count();
 
             /*
              * Workaround for Linux FF-A Driver not accepting to have its own
@@ -401,7 +401,7 @@ void ffa_handle_partition_info_get(struct cpu_user_regs *regs)
              * the requester endpoint information should be included or not
              */
             if ( ACCESS_ONCE(ctx->guest_vers) < FFA_VERSION_1_2 )
-                ffa_vm_count -= 1;
+                vm_count -= 1;
         }
 
         goto out;
@@ -429,14 +429,14 @@ void ffa_handle_partition_info_get(struct cpu_user_regs *regs)
 
     if ( ffa_fw_supports_fid(FFA_PARTITION_INFO_GET) )
     {
-        ret = ffa_get_sp_partinfo(uuid, &ffa_sp_count, &dst_buf, end_buf,
+        ret = ffa_get_sp_partinfo(uuid, &sp_count, &dst_buf, end_buf,
                                   dst_size);
 
         if ( ret )
             goto out_rx_release;
     }
 
-    ret = ffa_get_vm_partinfo(uuid, 0, &ffa_vm_count, &dst_buf, end_buf,
+    ret = ffa_get_vm_partinfo(uuid, 0, &vm_count, &dst_buf, end_buf,
                               dst_size);
 
 out_rx_release:
@@ -451,7 +451,7 @@ out:
         if ( flags || ACCESS_ONCE(ctx->guest_vers) == FFA_VERSION_1_0 )
             dst_size = 0;
 
-        ffa_set_regs_success(regs, ffa_sp_count + ffa_vm_count, dst_size);
+        ffa_set_regs_success(regs, sp_count + vm_count, dst_size);
     }
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 31 11:33:54 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 31 Mar 2026 11:33:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1268871.1558067 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7XM2-0007vU-Hx; Tue, 31 Mar 2026 11:33:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1268871.1558067; Tue, 31 Mar 2026 11:33:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7XM2-0007vM-Ez; Tue, 31 Mar 2026 11:33:54 +0000
Received: by outflank-mailman (input) for mailman id 1268871;
 Tue, 31 Mar 2026 11:33:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w7XM0-0007vF-Ih
 for xen-changelog@lists.xenproject.org; Tue, 31 Mar 2026 11:33:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7XM0-001L3P-2S
 for xen-changelog@lists.xenproject.org;
 Tue, 31 Mar 2026 11:33:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7XM0-00C0fh-1g
 for xen-changelog@lists.xenproject.org;
 Tue, 31 Mar 2026 11:33:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=e9PV1WXLIx1+Rr3daIXsngdRl8q14ZoIqEdRmtWtfmc=; b=A5sHe4LERu6wZEIQla2B+CJ5EZ
	36ziNbmDb/sr2Xjf9FME8Raw0SzPsqNIWMgSlhQ42fBINf+VI7U3JMf/XRVrB7K26r6o5YGQQEc5W
	gBgbngyl9H1yaJ/KhtyblPVKMGeuRlwzwPZwHijgq7sXfF32DupHwlqZW6Fxvd5Js/gY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: optee: Add MISRA-compliant switch default labels
Message-Id: <E1w7XM0-00C0fh-1g@xenbits.xenproject.org>
Date: Tue, 31 Mar 2026 11:33:52 +0000

commit 4fb391500430aceb97b2367c246d4a68fe6ae13e
Author:     Bertrand Marquis <bertrand.marquis@arm.com>
AuthorDate: Fri Mar 20 10:07:22 2026 +0100
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Tue Mar 31 11:01:12 2026 +0200

    xen/arm: optee: Add MISRA-compliant switch default labels
    
    optee.c has several switch statements over integer-valued OP-TEE fields
    without a default label, and two default clauses that only contain
    break. This triggers MISRA C Rule 16.4 findings.
    
    Add explicit default labels to all reported switches and document the
    intentional no-op defaults with rationale comments. The new default
    paths preserve the existing behavior:
    - unsupported parameter attribute types are ignored;
    - non-handled RPC commands require no post-processing in Xen;
    - unknown RPC function IDs are resumed unchanged.
    
    No functional changes.
    
    Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
---
 xen/arch/arm/tee/optee.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/xen/arch/arm/tee/optee.c b/xen/arch/arm/tee/optee.c
index f719d9d767..3d26332370 100644
--- a/xen/arch/arm/tee/optee.c
+++ b/xen/arch/arm/tee/optee.c
@@ -897,6 +897,9 @@ static int translate_params(struct optee_domain *ctx,
         case OPTEE_MSG_ATTR_TYPE_RMEM_OUTPUT:
         case OPTEE_MSG_ATTR_TYPE_RMEM_INOUT:
             continue;
+        default:
+            /* Ignore unsupported parameter type. */
+            continue;
         }
     }
 
@@ -1027,6 +1030,9 @@ static void copy_std_request_back(struct optee_domain *ctx,
         case OPTEE_MSG_ATTR_TYPE_RMEM_INPUT:
         case OPTEE_MSG_ATTR_TYPE_TMEM_INPUT:
             continue;
+        default:
+            /* No output fields to copy for unsupported parameter type. */
+            continue;
         }
     }
 
@@ -1050,6 +1056,7 @@ static void free_shm_buffers(struct optee_domain *ctx,
             free_optee_shm_buf(ctx, arg->params[i].u.tmem.shm_ref);
             break;
         default:
+            /* No temporary SHM buffer to free for other parameter types. */
             break;
         }
     }
@@ -1503,6 +1510,7 @@ static void handle_rpc_cmd(struct optee_domain *ctx, struct cpu_user_regs *regs,
         case OPTEE_RPC_CMD_SHM_FREE:
             break;
         default:
+            /* Other RPC commands need no Xen-side post-processing here. */
             break;
         }
     }
@@ -1591,6 +1599,9 @@ static void handle_rpc(struct optee_domain *ctx, struct cpu_user_regs *regs)
     case OPTEE_SMC_RPC_FUNC_CMD:
         handle_rpc_cmd(ctx, regs, call);
         return;
+    default:
+        /* Resume the call unchanged for unknown RPC function IDs. */
+        break;
     }
 
     do_call_with_arg(ctx, call, regs, OPTEE_SMC_CALL_RETURN_FROM_RPC,
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 31 12:44:06 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 31 Mar 2026 12:44:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1268909.1558089 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7YRu-0000mb-TB; Tue, 31 Mar 2026 12:44:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1268909.1558089; Tue, 31 Mar 2026 12:44:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7YRu-0000mR-QN; Tue, 31 Mar 2026 12:44:02 +0000
Received: by outflank-mailman (input) for mailman id 1268909;
 Tue, 31 Mar 2026 12:44:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w7YRu-0000mL-7U
 for xen-changelog@lists.xenproject.org; Tue, 31 Mar 2026 12:44:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7YRu-001MMo-1D
 for xen-changelog@lists.xenproject.org;
 Tue, 31 Mar 2026 12:44:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7YRu-00C5Td-0Q
 for xen-changelog@lists.xenproject.org;
 Tue, 31 Mar 2026 12:44:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=N5yr8IgzcEESS7YHPR3oBA+TcvlxJ/36kF9fSi2ryhk=; b=l4wgicNhwcGTKyewgoU7uv1yOC
	yGoPeyU06afW7hM0GsvoiN2WO4om0l0oG1hGwAh7tYrBhwTL+eSsHDSQbyNfmwlds38nCyPlKUczn
	AlfIEip8ZcfcfxvMpok6sX/IoxsfJlO0BFZSKSApfouIDyFsImV3/ISjggZcLlHU4qm4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: Implement PSCI SYSTEM_SUSPEND call for guests
Message-Id: <E1w7YRu-00C5Td-0Q@xenbits.xenproject.org>
Date: Tue, 31 Mar 2026 12:44:02 +0000

commit 1e3dc2f86695687e354d14091aa876149de4fcdc
Author:     Mykola Kvach <mykola_kvach@epam.com>
AuthorDate: Tue Mar 24 14:26:34 2026 +0200
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Tue Mar 31 10:54:46 2026 +0200

    xen/arm: Implement PSCI SYSTEM_SUSPEND call for guests
    
    Add support for the PSCI SYSTEM_SUSPEND function in the vPSCI interface,
    allowing guests to request suspend via the PSCI v1.0+ SYSTEM_SUSPEND call
    (both 32-bit and 64-bit variants).
    
    Implementation details:
    - Add SYSTEM_SUSPEND function IDs to PSCI definitions
    - Trap and handle SYSTEM_SUSPEND in vPSCI
    - Reject SYSTEM_SUSPEND for the hardware domain to avoid host shutdown
    - Require all secondary VCPUs to be offline before suspend
    - Split arch_set_info_guest() into arch_vcpu_validate_guest_context() and
      arch_vcpu_apply_guest_context() for reuse by vPSCI
    - Add vpsci_build_guest_context() helper and store prevalidated context in
      resume_ctx; resume applies it and frees it
    - Add arch_domain_resume() function is an architecture-specific hook that
      is invoked during domain resume to perform any necessary setup or
      restoration steps required by the platform.
    
    Usage:
    
    For Linux-based guests, suspend can be initiated with:
        echo mem > /sys/power/state
    or via:
        systemctl suspend
    
    Resume from control domain:
          xl resume <domain>
    
    Signed-off-by: Mykola Kvach <mykola_kvach@epam.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
 xen/arch/arm/domain.c                 |  86 ++++++++++++++++----
 xen/arch/arm/include/asm/domain.h     |   7 ++
 xen/arch/arm/include/asm/perfc_defn.h |   1 +
 xen/arch/arm/include/asm/psci.h       |   2 +
 xen/arch/arm/include/asm/suspend.h    |  27 +++++++
 xen/arch/arm/include/asm/vpsci.h      |   2 +-
 xen/arch/arm/vpsci.c                  | 146 +++++++++++++++++++++++++++-------
 xen/common/domain.c                   |   4 +
 xen/include/xen/suspend.h             |  22 +++++
 9 files changed, 255 insertions(+), 42 deletions(-)

diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c
index 94b9858ad2..581f82bddd 100644
--- a/xen/arch/arm/domain.c
+++ b/xen/arch/arm/domain.c
@@ -12,6 +12,8 @@
 #include <xen/softirq.h>
 #include <xen/wait.h>
 
+#include <public/sched.h>
+
 #include <asm/arm64/sve.h>
 #include <asm/cpuerrata.h>
 #include <asm/cpufeature.h>
@@ -24,10 +26,12 @@
 #include <asm/platform.h>
 #include <asm/procinfo.h>
 #include <asm/regs.h>
+#include <asm/suspend.h>
 #include <asm/firmware/sci.h>
 #include <asm/tee/tee.h>
 #include <asm/vfp.h>
 #include <asm/vgic.h>
+#include <asm/vpsci.h>
 #include <asm/vtimer.h>
 
 #include "vpci.h"
@@ -770,8 +774,18 @@ int arch_domain_teardown(struct domain *d)
     return 0;
 }
 
+static void resume_ctx_reset(struct resume_info *ctx)
+{
+    if ( ctx->ctxt )
+        free_vcpu_guest_context(ctx->ctxt);
+
+    memset(ctx, 0, sizeof(*ctx));
+}
+
 void arch_domain_destroy(struct domain *d)
 {
+    resume_ctx_reset(&d->arch.resume_ctx);
+
     tee_free_domain_ctx(d);
     /* IOMMU page table is shared with P2M, always call
      * iommu_domain_destroy() before p2m_final_teardown().
@@ -806,6 +820,28 @@ void arch_domain_creation_finished(struct domain *d)
     p2m_domain_creation_finished(d);
 }
 
+void arch_domain_resume(struct domain *d)
+{
+    struct resume_info *ctx = &d->arch.resume_ctx;
+
+    /*
+     * It is still possible to call domain_shutdown() with a suspend reason
+     * via some hypercalls, such as SCHEDOP_shutdown or SCHEDOP_remote_shutdown.
+     * In these cases, the resume context will be empty, so there is no
+     * suspend-specific state to restore.
+     */
+    if ( !ctx->wake_cpu )
+        return;
+
+    ASSERT(d->shutdown_code == SHUTDOWN_suspend);
+
+    domain_lock(d);
+    arch_vcpu_apply_guest_context(ctx->wake_cpu, ctx->ctxt);
+    domain_unlock(d);
+
+    resume_ctx_reset(ctx);
+}
+
 static int is_guest_pv32_psr(uint32_t psr)
 {
     switch (psr & PSR_MODE_MASK)
@@ -848,15 +884,32 @@ static int is_guest_pv64_psr(uint64_t psr)
 }
 #endif
 
+void arch_vcpu_apply_guest_context(struct vcpu *v,
+                                   const struct vcpu_guest_context *ctxt)
+{
+    vcpu_regs_user_to_hyp(v, &ctxt->user_regs);
+
+    v->arch.sctlr = ctxt->sctlr;
+    v->arch.ttbr0 = ctxt->ttbr0;
+    v->arch.ttbr1 = ctxt->ttbr1;
+    v->arch.ttbcr = ctxt->ttbcr;
+
+    v->is_initialised = 1;
+
+    if ( ctxt->flags & VGCF_online )
+        clear_bit(_VPF_down, &v->pause_flags);
+    else
+        set_bit(_VPF_down, &v->pause_flags);
+}
+
 /*
  * Initialise vCPU state. The context may be supplied by an external entity, so
  * we need to validate it.
  */
-int arch_set_info_guest(
-    struct vcpu *v, vcpu_guest_context_u c)
+int arch_vcpu_validate_guest_context(const struct vcpu *v,
+                                     const struct vcpu_guest_context *ctxt)
 {
-    struct vcpu_guest_context *ctxt = c.nat;
-    struct vcpu_guest_core_regs *regs = &c.nat->user_regs;
+    const struct vcpu_guest_core_regs *regs = &ctxt->user_regs;
 
     if ( is_32bit_domain(v->domain) )
     {
@@ -885,19 +938,24 @@ int arch_set_info_guest(
     }
 #endif
 
-    vcpu_regs_user_to_hyp(v, regs);
+    return 0;
+}
 
-    v->arch.sctlr = ctxt->sctlr;
-    v->arch.ttbr0 = ctxt->ttbr0;
-    v->arch.ttbr1 = ctxt->ttbr1;
-    v->arch.ttbcr = ctxt->ttbcr;
+/*
+ * Initialise vCPU state. The context may be supplied by an external entity, so
+ * we need to validate it.
+ */
+int arch_set_info_guest(
+    struct vcpu *v, vcpu_guest_context_u c)
+{
+    struct vcpu_guest_context *ctxt = c.nat;
+    int rc;
 
-    v->is_initialised = 1;
+    rc = arch_vcpu_validate_guest_context(v, ctxt);
+    if ( rc )
+        return rc;
 
-    if ( ctxt->flags & VGCF_online )
-        clear_bit(_VPF_down, &v->pause_flags);
-    else
-        set_bit(_VPF_down, &v->pause_flags);
+    arch_vcpu_apply_guest_context(v, ctxt);
 
     return 0;
 }
diff --git a/xen/arch/arm/include/asm/domain.h b/xen/arch/arm/include/asm/domain.h
index 758ad807e4..ffe5d0d9f0 100644
--- a/xen/arch/arm/include/asm/domain.h
+++ b/xen/arch/arm/include/asm/domain.h
@@ -5,6 +5,7 @@
 #include <xen/timer.h>
 #include <asm/page.h>
 #include <asm/p2m.h>
+#include <asm/suspend.h>
 #include <asm/vfp.h>
 #include <asm/mmio.h>
 #include <asm/gic.h>
@@ -126,6 +127,7 @@ struct arch_domain
     void *sci_data;
 #endif
 
+    struct resume_info resume_ctx;
 }  __cacheline_aligned;
 
 struct arch_vcpu
@@ -290,6 +292,11 @@ static inline register_t vcpuid_to_vaffinity(unsigned int vcpuid)
     return vaff;
 }
 
+int arch_vcpu_validate_guest_context(const struct vcpu *v,
+                                     const struct vcpu_guest_context *ctxt);
+void arch_vcpu_apply_guest_context(struct vcpu *v,
+                                   const struct vcpu_guest_context *ctxt);
+
 static inline struct vcpu_guest_context *alloc_vcpu_guest_context(void)
 {
     return xmalloc(struct vcpu_guest_context);
diff --git a/xen/arch/arm/include/asm/perfc_defn.h b/xen/arch/arm/include/asm/perfc_defn.h
index effd25b69e..8dfcac7e3b 100644
--- a/xen/arch/arm/include/asm/perfc_defn.h
+++ b/xen/arch/arm/include/asm/perfc_defn.h
@@ -33,6 +33,7 @@ PERFCOUNTER(vpsci_system_reset,        "vpsci: system_reset")
 PERFCOUNTER(vpsci_cpu_suspend,         "vpsci: cpu_suspend")
 PERFCOUNTER(vpsci_cpu_affinity_info,   "vpsci: cpu_affinity_info")
 PERFCOUNTER(vpsci_features,            "vpsci: features")
+PERFCOUNTER(vpsci_system_suspend,      "vpsci: system_suspend")
 
 PERFCOUNTER(vcpu_kick,                 "vcpu: notify other vcpu")
 
diff --git a/xen/arch/arm/include/asm/psci.h b/xen/arch/arm/include/asm/psci.h
index 4780972621..48a93e6b79 100644
--- a/xen/arch/arm/include/asm/psci.h
+++ b/xen/arch/arm/include/asm/psci.h
@@ -47,10 +47,12 @@ void call_psci_system_reset(void);
 #define PSCI_0_2_FN32_SYSTEM_OFF          PSCI_0_2_FN32(8)
 #define PSCI_0_2_FN32_SYSTEM_RESET        PSCI_0_2_FN32(9)
 #define PSCI_1_0_FN32_PSCI_FEATURES       PSCI_0_2_FN32(10)
+#define PSCI_1_0_FN32_SYSTEM_SUSPEND      PSCI_0_2_FN32(14)
 
 #define PSCI_0_2_FN64_CPU_SUSPEND         PSCI_0_2_FN64(1)
 #define PSCI_0_2_FN64_CPU_ON              PSCI_0_2_FN64(3)
 #define PSCI_0_2_FN64_AFFINITY_INFO       PSCI_0_2_FN64(4)
+#define PSCI_1_0_FN64_SYSTEM_SUSPEND      PSCI_0_2_FN64(14)
 
 /* PSCI v0.2 affinity level state returned by AFFINITY_INFO */
 #define PSCI_0_2_AFFINITY_LEVEL_ON      0
diff --git a/xen/arch/arm/include/asm/suspend.h b/xen/arch/arm/include/asm/suspend.h
new file mode 100644
index 0000000000..31a98a1f1b
--- /dev/null
+++ b/xen/arch/arm/include/asm/suspend.h
@@ -0,0 +1,27 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#ifndef ARM_SUSPEND_H
+#define ARM_SUSPEND_H
+
+struct domain;
+struct vcpu;
+struct vcpu_guest_context;
+
+struct resume_info {
+    struct vcpu_guest_context *ctxt;
+    struct vcpu *wake_cpu;
+};
+
+void arch_domain_resume(struct domain *d);
+
+#endif /* ARM_SUSPEND_H */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff --git a/xen/arch/arm/include/asm/vpsci.h b/xen/arch/arm/include/asm/vpsci.h
index 0cca5e6830..69d40f9d7f 100644
--- a/xen/arch/arm/include/asm/vpsci.h
+++ b/xen/arch/arm/include/asm/vpsci.h
@@ -23,7 +23,7 @@
 #include <asm/psci.h>
 
 /* Number of function implemented by virtual PSCI (only 0.2 or later) */
-#define VPSCI_NR_FUNCS  12
+#define VPSCI_NR_FUNCS  14
 
 /* Functions handle PSCI calls from the guests */
 bool do_vpsci_0_1_call(struct cpu_user_regs *regs, uint32_t fid);
diff --git a/xen/arch/arm/vpsci.c b/xen/arch/arm/vpsci.c
index 7ba9ccd94b..bd87ec430d 100644
--- a/xen/arch/arm/vpsci.c
+++ b/xen/arch/arm/vpsci.c
@@ -4,38 +4,24 @@
 #include <xen/types.h>
 
 #include <asm/current.h>
+#include <asm/domain.h>
 #include <asm/vgic.h>
 #include <asm/vpsci.h>
 #include <asm/event.h>
 
 #include <public/sched.h>
 
-static int do_common_cpu_on(register_t target_cpu, register_t entry_point,
-                            register_t context_id)
+static int vpsci_build_guest_context(struct vcpu *v, register_t entry_point,
+                                     register_t context_id,
+                                     struct vcpu_guest_context **out)
 {
-    struct vcpu *v;
-    struct domain *d = current->domain;
+    bool is_thumb = entry_point & 1;
     struct vcpu_guest_context *ctxt;
     int rc;
-    bool is_thumb = entry_point & 1;
-    register_t vcpuid;
-
-    vcpuid = vaffinity_to_vcpuid(target_cpu);
 
-    if ( (v = domain_vcpu(d, vcpuid)) == NULL )
-        return PSCI_INVALID_PARAMETERS;
-
-    /* THUMB set is not allowed with 64-bit domain */
-    if ( is_64bit_domain(d) && is_thumb )
-        return PSCI_INVALID_ADDRESS;
-
-    if ( !test_bit(_VPF_down, &v->pause_flags) )
-        return PSCI_ALREADY_ON;
-
-    if ( (ctxt = alloc_vcpu_guest_context()) == NULL )
-        return PSCI_DENIED;
-
-    vgic_clear_pending_irqs(v);
+    ctxt = alloc_vcpu_guest_context();
+    if ( ctxt == NULL )
+        return -ENOMEM;
 
     memset(ctxt, 0, sizeof(*ctxt));
     ctxt->user_regs.pc64 = (u64) entry_point;
@@ -48,7 +34,7 @@ static int do_common_cpu_on(register_t target_cpu, register_t entry_point,
      * x0/r0_usr are always updated because for PSCI 0.1 the general
      * purpose registers are undefined upon CPU_on.
      */
-    if ( is_32bit_domain(d) )
+    if ( is_32bit_domain(v->domain) )
     {
         ctxt->user_regs.cpsr = PSR_GUEST32_INIT;
         /* Start the VCPU with THUMB set if it's requested by the kernel */
@@ -69,15 +55,51 @@ static int do_common_cpu_on(register_t target_cpu, register_t entry_point,
 #endif
     ctxt->flags = VGCF_online;
 
-    domain_lock(d);
-    rc = arch_set_info_guest(v, ctxt);
-    domain_unlock(d);
+    rc = arch_vcpu_validate_guest_context(v, ctxt);
+    if ( rc )
+    {
+        free_vcpu_guest_context(ctxt);
+        return rc;
+    }
 
-    free_vcpu_guest_context(ctxt);
+    *out = ctxt;
+    return 0;
+}
+
+static int do_common_cpu_on(register_t target_cpu, register_t entry_point,
+                            register_t context_id)
+{
+    struct vcpu *v;
+    struct domain *d = current->domain;
+    struct vcpu_guest_context *ctxt = NULL;
+    int rc;
+    bool is_thumb = entry_point & 1;
+    register_t vcpuid;
+
+    vcpuid = vaffinity_to_vcpuid(target_cpu);
+
+    if ( (v = domain_vcpu(d, vcpuid)) == NULL )
+        return PSCI_INVALID_PARAMETERS;
+
+    /* THUMB set is not allowed with 64-bit domain */
+    if ( is_64bit_domain(d) && is_thumb )
+        return PSCI_INVALID_ADDRESS;
 
+    if ( !test_bit(_VPF_down, &v->pause_flags) )
+        return PSCI_ALREADY_ON;
+
+    rc = vpsci_build_guest_context(v, entry_point, context_id, &ctxt);
     if ( rc < 0 )
         return PSCI_DENIED;
 
+    vgic_clear_pending_irqs(v);
+
+    domain_lock(d);
+    arch_vcpu_apply_guest_context(v, ctxt);
+    domain_unlock(d);
+
+    free_vcpu_guest_context(ctxt);
+
     vcpu_wake(v);
 
     return PSCI_SUCCESS;
@@ -197,6 +219,56 @@ static void do_psci_0_2_system_reset(void)
     domain_shutdown(d,SHUTDOWN_reboot);
 }
 
+static int32_t do_psci_1_0_system_suspend(register_t epoint, register_t cid)
+{
+    int32_t rc;
+    struct vcpu_guest_context *ctxt;
+    struct vcpu *v;
+    struct domain *d = current->domain;
+    bool is_thumb = epoint & 1;
+    struct resume_info *rctx = &d->arch.resume_ctx;
+
+    /* THUMB set is not allowed with 64-bit domain */
+    if ( is_64bit_domain(d) && is_thumb )
+        return PSCI_INVALID_ADDRESS;
+
+    /* SYSTEM_SUSPEND is not supported for the hardware domain yet */
+    if ( is_hardware_domain(d) )
+        return PSCI_NOT_SUPPORTED;
+
+    /* Ensure that all CPUs other than the calling one are offline */
+    domain_lock(d);
+    for_each_vcpu ( d, v )
+    {
+        if ( v != current && is_vcpu_online(v) )
+        {
+            domain_unlock(d);
+            return PSCI_DENIED;
+        }
+    }
+    domain_unlock(d);
+
+    rc = vpsci_build_guest_context(current, epoint, cid, &ctxt);
+    if ( rc )
+        return PSCI_DENIED;
+
+    rc = domain_shutdown(d, SHUTDOWN_suspend);
+    if ( rc )
+    {
+        free_vcpu_guest_context(ctxt);
+        return PSCI_DENIED;
+    }
+
+    rctx->ctxt = ctxt;
+    rctx->wake_cpu = current;
+
+    gprintk(XENLOG_DEBUG,
+            "SYSTEM_SUSPEND requested, epoint=%#"PRIregister", cid=%#"PRIregister"\n",
+            epoint, cid);
+
+    return rc;
+}
+
 static int32_t do_psci_1_0_features(uint32_t psci_func_id)
 {
     /* /!\ Ordered by function ID and not name */
@@ -216,6 +288,9 @@ static int32_t do_psci_1_0_features(uint32_t psci_func_id)
     case PSCI_1_0_FN32_PSCI_FEATURES:
     case ARM_SMCCC_VERSION_FID:
         return 0;
+    case PSCI_1_0_FN32_SYSTEM_SUSPEND:
+    case PSCI_1_0_FN64_SYSTEM_SUSPEND:
+        return is_hardware_domain(current->domain) ? PSCI_NOT_SUPPORTED : 0;
     default:
         return PSCI_NOT_SUPPORTED;
     }
@@ -344,6 +419,23 @@ bool do_vpsci_0_2_call(struct cpu_user_regs *regs, uint32_t fid)
         return true;
     }
 
+    case PSCI_1_0_FN32_SYSTEM_SUSPEND:
+    case PSCI_1_0_FN64_SYSTEM_SUSPEND:
+    {
+        register_t epoint = PSCI_ARG(regs, 1);
+        register_t cid = PSCI_ARG(regs, 2);
+
+        if ( fid == PSCI_1_0_FN32_SYSTEM_SUSPEND )
+        {
+            epoint &= GENMASK(31, 0);
+            cid &= GENMASK(31, 0);
+        }
+
+        perfc_incr(vpsci_system_suspend);
+        PSCI_SET_RESULT(regs, do_psci_1_0_system_suspend(epoint, cid));
+        return true;
+    }
+
     default:
         return false;
     }
diff --git a/xen/common/domain.c b/xen/common/domain.c
index 30cfea3045..bb9e210c28 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -26,6 +26,7 @@
 #include <xen/hypercall.h>
 #include <xen/delay.h>
 #include <xen/shutdown.h>
+#include <xen/suspend.h>
 #include <xen/percpu.h>
 #include <xen/multicall.h>
 #include <xen/rcupdate.h>
@@ -1435,6 +1436,9 @@ void domain_resume(struct domain *d)
     spin_lock(&d->shutdown_lock);
 
     d->is_shutting_down = d->is_shut_down = 0;
+
+    arch_domain_resume(d);
+
     d->shutdown_code = SHUTDOWN_CODE_INVALID;
 
     for_each_vcpu ( d, v )
diff --git a/xen/include/xen/suspend.h b/xen/include/xen/suspend.h
new file mode 100644
index 0000000000..6f94fd53b0
--- /dev/null
+++ b/xen/include/xen/suspend.h
@@ -0,0 +1,22 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#ifndef XEN_SUSPEND_H
+#define XEN_SUSPEND_H
+
+#if __has_include(<asm/suspend.h>)
+#include <asm/suspend.h>
+#else
+static inline void arch_domain_resume(struct domain *d) {}
+#endif
+
+#endif /* XEN_SUSPEND_H */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 31 12:44:12 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 31 Mar 2026 12:44:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1268910.1558093 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7YS4-0000oJ-UT; Tue, 31 Mar 2026 12:44:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1268910.1558093; Tue, 31 Mar 2026 12:44:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7YS4-0000o9-Ro; Tue, 31 Mar 2026 12:44:12 +0000
Received: by outflank-mailman (input) for mailman id 1268910;
 Tue, 31 Mar 2026 12:44:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w7YS4-0000o1-9c
 for xen-changelog@lists.xenproject.org; Tue, 31 Mar 2026 12:44:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7YS4-001MMu-1Y
 for xen-changelog@lists.xenproject.org;
 Tue, 31 Mar 2026 12:44:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7YS4-00C5VQ-0j
 for xen-changelog@lists.xenproject.org;
 Tue, 31 Mar 2026 12:44:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=xlh1FnUXy/jWi31f6WrTfAIhQSKFPARV4ZjKfgCc39w=; b=OW+ZB1i2UzeLq7PtXTJ5FHrv/0
	f6X/BeqlM0UmTb9+v+J+qp2lsMHG40RWeincWhml0izamgQzxAV2Idv1abJYl9dehW3fb3bqKqj8m
	r4xeksnbkYiL2ZcpLAbrU59g9G9zDHTKnNE6LFeVgdxavAiyKpEBbX4wJJMsq9JXou1E=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/xl: Allow compilation of 'xl resume' command on Arm
Message-Id: <E1w7YS4-00C5VQ-0j@xenbits.xenproject.org>
Date: Tue, 31 Mar 2026 12:44:12 +0000

commit a3971271ec08476bc888885efbaeaec16a597a69
Author:     Mykola Kvach <mykola_kvach@epam.com>
AuthorDate: Tue Mar 24 14:26:35 2026 +0200
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Tue Mar 31 10:54:52 2026 +0200

    tools/xl: Allow compilation of 'xl resume' command on Arm
    
    The "xl resume" command was previously excluded from Arm builds because
    system suspend/resume (e.g., SYSTEM_SUSPEND via vPSCI) was not
    implemented. On x86, this command is used for resume.
    
    This change enables compilation of `xl resume` on Arm regardless of the
    underlying implementation status, making the tool available for testing
    and future feature support. The relevant libxl infrastructure and handler
    functions are already present and usable.
    
    Note: This does not imply full system suspend/resume support on Arm.
          The `xl suspend` command still does not work on Arm platforms.
    
    Signed-off-by: Mykola Kvach <mykola_kvach@epam.com>
    Acked-by: Anthony PERARD <anthony.perard@vates.tech>
---
 tools/include/libxl.h     |  1 -
 tools/xl/xl.h             |  4 ++--
 tools/xl/xl_cmdtable.c    |  4 ++--
 tools/xl/xl_migrate.c     |  2 +-
 tools/xl/xl_saverestore.c |  2 +-
 tools/xl/xl_vmcontrol.c   | 12 ++++++------
 6 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/tools/include/libxl.h b/tools/include/libxl.h
index 80e3ec8de9..7c098edab6 100644
--- a/tools/include/libxl.h
+++ b/tools/include/libxl.h
@@ -1145,7 +1145,6 @@ typedef struct libxl__ctx libxl_ctx;
  * restoring or migrating a domain. In this case the related functions
  * should be expected to return failure. That is:
  *  - libxl_domain_suspend
- *  - libxl_domain_resume
  *  - libxl_domain_remus_start
  */
 #if defined(__arm__) || defined(__aarch64__)
diff --git a/tools/xl/xl.h b/tools/xl/xl.h
index 0efc07a6ba..7b75f9a493 100644
--- a/tools/xl/xl.h
+++ b/tools/xl/xl.h
@@ -65,7 +65,7 @@ static const char migrate_permission_to_go[]=
     "domain is yours, you are cleared to unpause";
 static const char migrate_report[]=
     "my copy unpause results are as follows";
-#endif
+#endif /* !LIBXL_HAVE_NO_SUSPEND_RESUME */
 
   /* followed by one byte:
    *     0: everything went well, domain is running
@@ -130,8 +130,8 @@ int main_migrate_receive(int argc, char **argv);
 int main_save(int argc, char **argv);
 int main_migrate(int argc, char **argv);
 int main_suspend(int argc, char **argv);
+#endif /* !LIBXL_HAVE_NO_SUSPEND_RESUME */
 int main_resume(int argc, char **argv);
-#endif
 int main_dump_core(int argc, char **argv);
 int main_pause(int argc, char **argv);
 int main_unpause(int argc, char **argv);
diff --git a/tools/xl/xl_cmdtable.c b/tools/xl/xl_cmdtable.c
index 5098f72ab4..502244f683 100644
--- a/tools/xl/xl_cmdtable.c
+++ b/tools/xl/xl_cmdtable.c
@@ -198,12 +198,12 @@ const struct cmd_spec cmd_table[] = {
       "Suspend a domain to RAM",
       "<Domain>",
     },
+#endif /* !LIBXL_HAVE_NO_SUSPEND_RESUME */
     { "resume",
       &main_resume, 0, 1,
       "Resume a domain from RAM",
       "<Domain>",
     },
-#endif
     { "dump-core",
       &main_dump_core, 0, 1,
       "Core dump a domain",
@@ -548,7 +548,7 @@ const struct cmd_spec cmd_table[] = {
       "                        checkpoint must be disabled.\n"
       "-p                      Use COLO userspace proxy."
     },
-#endif
+#endif /* !LIBXL_HAVE_NO_SUSPEND_RESUME */
     { "devd",
       &main_devd, 0, 1,
       "Daemon that listens for devices and launches backends",
diff --git a/tools/xl/xl_migrate.c b/tools/xl/xl_migrate.c
index b8594f44a5..4b4a379aa1 100644
--- a/tools/xl/xl_migrate.c
+++ b/tools/xl/xl_migrate.c
@@ -767,7 +767,7 @@ int main_remus(int argc, char **argv)
     close(send_fd);
     return EXIT_FAILURE;
 }
-#endif
+#endif /* !LIBXL_HAVE_NO_SUSPEND_RESUME */
 
 
 /*
diff --git a/tools/xl/xl_saverestore.c b/tools/xl/xl_saverestore.c
index 953d791d1a..747094ec7b 100644
--- a/tools/xl/xl_saverestore.c
+++ b/tools/xl/xl_saverestore.c
@@ -270,7 +270,7 @@ int main_save(int argc, char **argv)
     return EXIT_SUCCESS;
 }
 
-#endif /* LIBXL_HAVE_NO_SUSPEND_RESUME */
+#endif /* !LIBXL_HAVE_NO_SUSPEND_RESUME */
 
 
 
diff --git a/tools/xl/xl_vmcontrol.c b/tools/xl/xl_vmcontrol.c
index c813732838..93766f631b 100644
--- a/tools/xl/xl_vmcontrol.c
+++ b/tools/xl/xl_vmcontrol.c
@@ -38,11 +38,6 @@ static void suspend_domain(uint32_t domid)
     libxl_domain_suspend_only(ctx, domid, NULL);
 }
 
-static void resume_domain(uint32_t domid)
-{
-    libxl_domain_resume(ctx, domid, 1, NULL);
-}
-
 int main_suspend(int argc, char **argv)
 {
     int opt;
@@ -55,6 +50,12 @@ int main_suspend(int argc, char **argv)
 
     return EXIT_SUCCESS;
 }
+#endif /* !LIBXL_HAVE_NO_SUSPEND_RESUME */
+
+static void resume_domain(uint32_t domid)
+{
+    libxl_domain_resume(ctx, domid, 1, NULL);
+}
 
 int main_resume(int argc, char **argv)
 {
@@ -68,7 +69,6 @@ int main_resume(int argc, char **argv)
 
     return EXIT_SUCCESS;
 }
-#endif
 
 static void pause_domain(uint32_t domid)
 {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 31 12:44:23 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 31 Mar 2026 12:44:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1268911.1558097 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7YSE-0000qX-Vp; Tue, 31 Mar 2026 12:44:22 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1268911.1558097; Tue, 31 Mar 2026 12:44:22 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7YSE-0000qP-TF; Tue, 31 Mar 2026 12:44:22 +0000
Received: by outflank-mailman (input) for mailman id 1268911;
 Tue, 31 Mar 2026 12:44:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w7YSE-0000qJ-DI
 for xen-changelog@lists.xenproject.org; Tue, 31 Mar 2026 12:44:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7YSE-001MMy-1s
 for xen-changelog@lists.xenproject.org;
 Tue, 31 Mar 2026 12:44:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7YSE-00C5XW-13
 for xen-changelog@lists.xenproject.org;
 Tue, 31 Mar 2026 12:44:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ODTHvw/6W2wfu4KmtcymVMIFbNpFosvK6KuqUG9vOTA=; b=5y77+FJB0jjAVpgFWZeXzhzLB3
	TYwxTaLjjKBK/5/FxmCW8WmG6Ll0lun79jr1wKol/JHB2nBd+P8iTEw50+a1j1nld6pczIKOyGKDr
	IpklQn73CtQH5yprQV+IA+kYguJN/3jMUle8ArDOewQWVkUDqmmeLzAPa/5YTBoFk0eU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] SUPPORT.md: Document PSCI SYSTEM_SUSPEND support for guests
Message-Id: <E1w7YSE-00C5XW-13@xenbits.xenproject.org>
Date: Tue, 31 Mar 2026 12:44:22 +0000

commit 174896b7c170fa4c1d4e274562eb685768a14450
Author:     Mykola Kvach <mykola_kvach@epam.com>
AuthorDate: Tue Mar 24 14:26:36 2026 +0200
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Tue Mar 31 10:54:52 2026 +0200

    SUPPORT.md: Document PSCI SYSTEM_SUSPEND support for guests
    
    Add a new entry under the "Virtual Hardware, Hypervisor" section
    documenting support for the optional PSCI SYSTEM_SUSPEND function
    exposed to guests.
    
    This function is available via the virtual PSCI interface and allows
    guest domains (domUs) to initiate system suspend operations.
    
    The feature is currently marked as "Tech Preview".
    
    Signed-off-by: Mykola Kvach <mykola_kvach@epam.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 SUPPORT.md | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/SUPPORT.md b/SUPPORT.md
index d441bccf37..8e7ab7cb3e 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -962,8 +962,9 @@ Emulated PSCI interface exposed to guests. We support all mandatory
 functions of PSCI 1.1. See below for the list of optional PSCI call
 implemented and their status.
 
-   Status, Mandatory: Supported
-   Status, MIGRATE_INFO_TYPE: Supported
+    Status, Mandatory: Supported
+    Status, MIGRATE_INFO_TYPE: Supported
+    Status, SYSTEM_SUSPEND: Tech Preview
 
 ## Virtual Hardware, QEMU
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 31 12:44:33 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 31 Mar 2026 12:44:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1268912.1558101 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7YSP-0000uY-16; Tue, 31 Mar 2026 12:44:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1268912.1558101; Tue, 31 Mar 2026 12:44:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7YSO-0000uQ-Ui; Tue, 31 Mar 2026 12:44:32 +0000
Received: by outflank-mailman (input) for mailman id 1268912;
 Tue, 31 Mar 2026 12:44:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w7YSO-0000uJ-G8
 for xen-changelog@lists.xenproject.org; Tue, 31 Mar 2026 12:44:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7YSO-001MN2-2B
 for xen-changelog@lists.xenproject.org;
 Tue, 31 Mar 2026 12:44:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7YSO-00C5Yo-1M
 for xen-changelog@lists.xenproject.org;
 Tue, 31 Mar 2026 12:44:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=+6iC9ar14zJWz6K3f7AMspwopdEFNx7+0tyHrNkttKg=; b=TGy5xwvHRSD+rhPfcRyykUbvus
	YHFiaAJcQUlejcdpV+6Lv+nyefXmmCDADd9jN4Fl4SJ1xEWks8rNYuXyMHM4nUwGZSde9nftUcrRS
	SEy7lpRY1wVuurq1oQ6hcCB6+XdHCN3xaJBrxkcYQOsaKuz0uiLvkwtdXOCfUr+94M4I=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] CHANGELOG: Document guest suspend/resume to RAM support on Arm
Message-Id: <E1w7YSO-00C5Yo-1M@xenbits.xenproject.org>
Date: Tue, 31 Mar 2026 12:44:32 +0000

commit d92f27a5c9012e1ec9fb89d518aa5f938f747595
Author:     Mykola Kvach <mykola_kvach@epam.com>
AuthorDate: Tue Mar 24 14:26:37 2026 +0200
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Tue Mar 31 10:54:52 2026 +0200

    CHANGELOG: Document guest suspend/resume to RAM support on Arm
    
    Mention the newly added support for guest suspend and resume to/from
    RAM via vPSCI on Arm platforms.
    
    This support is limited to non-hardware domain guests.
    
    Signed-off-by: Mykola Kvach <mykola_kvach@epam.com>
    Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
---
 CHANGELOG.md | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6d4610d5f1..0a065c7a8e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -17,6 +17,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
      misusing atomic instructions.
    - Support for CPIO microcode in discrete multiboot modules.
 
+ - On Arm:
+   - Support for guest suspend and resume to/from RAM via vPSCI.
+     Applies only to non-hardware domain guests.
+
 ### Removed
  - On x86:
    - The cpuid_mask_* command line options for legacy CPUs.  These were
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 31 12:44:43 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 31 Mar 2026 12:44:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1268913.1558105 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7YSZ-0000x4-4R; Tue, 31 Mar 2026 12:44:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1268913.1558105; Tue, 31 Mar 2026 12:44:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7YSZ-0000ww-1h; Tue, 31 Mar 2026 12:44:43 +0000
Received: by outflank-mailman (input) for mailman id 1268913;
 Tue, 31 Mar 2026 12:44:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w7YSY-0000wq-J4
 for xen-changelog@lists.xenproject.org; Tue, 31 Mar 2026 12:44:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7YSY-001MN6-2V
 for xen-changelog@lists.xenproject.org;
 Tue, 31 Mar 2026 12:44:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7YSY-00C5aC-1f
 for xen-changelog@lists.xenproject.org;
 Tue, 31 Mar 2026 12:44:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=wA5j0KGaHJK6p31wfX4wxB0sAzLEs+dG6AdlCaRvJAQ=; b=sd42kgTyPo91YlIl7kbaVsVuky
	gGJx5p34RpRNnrDxPEjlM5l6yBBuAm1aEdfeYTdA4BzDxanWQIElSGNbcCycSpU9O6oZ/9XZXxy4S
	PexdrnutyAMx05/skhGXXSaLmg6ljoPSeiBZVdYmvir0J5zaxEAlofVJ8UJu0Yhm41VI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: ffa: Fix local ffa_vm_count shadowing
Message-Id: <E1w7YSY-00C5aC-1f@xenbits.xenproject.org>
Date: Tue, 31 Mar 2026 12:44:42 +0000

commit 7e693b967bb5f94d72ed72f32add4d844b154b68
Author:     Bertrand Marquis <bertrand.marquis@arm.com>
AuthorDate: Fri Mar 20 10:07:21 2026 +0100
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Tue Mar 31 11:01:12 2026 +0200

    xen/arm: ffa: Fix local ffa_vm_count shadowing
    
    ffa_handle_partition_info_get() declares a local variable named
    ffa_vm_count, which hides the global atomic ffa_vm_count declared in
    ffa_private.h.
    
    This triggered the ECLAIR Rule 5.3 finding "non-compliant local variable
    `ffa_vm_count'".
    
    Rename the local counters to vm_count and sp_count and update their
    uses.
    
    No functional changes.
    
    Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
---
 xen/arch/arm/tee/ffa_partinfo.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/xen/arch/arm/tee/ffa_partinfo.c b/xen/arch/arm/tee/ffa_partinfo.c
index 4580bd5edb..ed28820502 100644
--- a/xen/arch/arm/tee/ffa_partinfo.c
+++ b/xen/arch/arm/tee/ffa_partinfo.c
@@ -346,7 +346,7 @@ void ffa_handle_partition_info_get(struct cpu_user_regs *regs)
     uint32_t dst_size = 0;
     size_t buf_size;
     void *dst_buf, *end_buf;
-    uint32_t ffa_vm_count = 0, ffa_sp_count = 0;
+    uint32_t vm_count = 0, sp_count = 0;
 
     ffa_uuid_set(&uuid,
              get_user_reg(regs, 1),
@@ -380,7 +380,7 @@ void ffa_handle_partition_info_get(struct cpu_user_regs *regs)
 
         if ( ffa_fw_supports_fid(FFA_PARTITION_INFO_GET) )
         {
-            ret = ffa_get_sp_count(uuid, &ffa_sp_count);
+            ret = ffa_get_sp_count(uuid, &sp_count);
             if ( ret )
                 goto out;
         }
@@ -391,7 +391,7 @@ void ffa_handle_partition_info_get(struct cpu_user_regs *regs)
          */
         if ( ffa_uuid_is_nil(uuid) )
         {
-            ffa_vm_count = get_ffa_vm_count();
+            vm_count = get_ffa_vm_count();
 
             /*
              * Workaround for Linux FF-A Driver not accepting to have its own
@@ -401,7 +401,7 @@ void ffa_handle_partition_info_get(struct cpu_user_regs *regs)
              * the requester endpoint information should be included or not
              */
             if ( ACCESS_ONCE(ctx->guest_vers) < FFA_VERSION_1_2 )
-                ffa_vm_count -= 1;
+                vm_count -= 1;
         }
 
         goto out;
@@ -429,14 +429,14 @@ void ffa_handle_partition_info_get(struct cpu_user_regs *regs)
 
     if ( ffa_fw_supports_fid(FFA_PARTITION_INFO_GET) )
     {
-        ret = ffa_get_sp_partinfo(uuid, &ffa_sp_count, &dst_buf, end_buf,
+        ret = ffa_get_sp_partinfo(uuid, &sp_count, &dst_buf, end_buf,
                                   dst_size);
 
         if ( ret )
             goto out_rx_release;
     }
 
-    ret = ffa_get_vm_partinfo(uuid, 0, &ffa_vm_count, &dst_buf, end_buf,
+    ret = ffa_get_vm_partinfo(uuid, 0, &vm_count, &dst_buf, end_buf,
                               dst_size);
 
 out_rx_release:
@@ -451,7 +451,7 @@ out:
         if ( flags || ACCESS_ONCE(ctx->guest_vers) == FFA_VERSION_1_0 )
             dst_size = 0;
 
-        ffa_set_regs_success(regs, ffa_sp_count + ffa_vm_count, dst_size);
+        ffa_set_regs_success(regs, sp_count + vm_count, dst_size);
     }
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 31 12:44:53 2026
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 31 Mar 2026 12:44:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1268914.1558108 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7YSj-0000zL-5Z; Tue, 31 Mar 2026 12:44:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1268914.1558108; Tue, 31 Mar 2026 12:44:53 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1w7YSj-0000zD-30; Tue, 31 Mar 2026 12:44:53 +0000
Received: by outflank-mailman (input) for mailman id 1268914;
 Tue, 31 Mar 2026 12:44:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1w7YSi-0000z7-Lp
 for xen-changelog@lists.xenproject.org; Tue, 31 Mar 2026 12:44:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7YSi-001MNC-2l
 for xen-changelog@lists.xenproject.org;
 Tue, 31 Mar 2026 12:44:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1w7YSi-00C5bU-1z
 for xen-changelog@lists.xenproject.org;
 Tue, 31 Mar 2026 12:44:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=jdxQzf49Y+rN7XwSizLPMz2aFrBukOApPzwDTPwi1f4=; b=R+n90YfDiTyX47urNK1b9WsVQZ
	pQqaKmH0G+hXfypVo7uiU16SGDcI6qzOjflaokzYi3fTElflka4MgiQhwbeJ/6cNdfU9bjwnN34xz
	CRIs46G+s7M4FhhKWSbRrzIEr/ts0q01+eGRwSKNkv88kAQ1/ehbghLL7UxpEJLV+EOw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: optee: Add MISRA-compliant switch default labels
Message-Id: <E1w7YSi-00C5bU-1z@xenbits.xenproject.org>
Date: Tue, 31 Mar 2026 12:44:52 +0000

commit 4fb391500430aceb97b2367c246d4a68fe6ae13e
Author:     Bertrand Marquis <bertrand.marquis@arm.com>
AuthorDate: Fri Mar 20 10:07:22 2026 +0100
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Tue Mar 31 11:01:12 2026 +0200

    xen/arm: optee: Add MISRA-compliant switch default labels
    
    optee.c has several switch statements over integer-valued OP-TEE fields
    without a default label, and two default clauses that only contain
    break. This triggers MISRA C Rule 16.4 findings.
    
    Add explicit default labels to all reported switches and document the
    intentional no-op defaults with rationale comments. The new default
    paths preserve the existing behavior:
    - unsupported parameter attribute types are ignored;
    - non-handled RPC commands require no post-processing in Xen;
    - unknown RPC function IDs are resumed unchanged.
    
    No functional changes.
    
    Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
---
 xen/arch/arm/tee/optee.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/xen/arch/arm/tee/optee.c b/xen/arch/arm/tee/optee.c
index f719d9d767..3d26332370 100644
--- a/xen/arch/arm/tee/optee.c
+++ b/xen/arch/arm/tee/optee.c
@@ -897,6 +897,9 @@ static int translate_params(struct optee_domain *ctx,
         case OPTEE_MSG_ATTR_TYPE_RMEM_OUTPUT:
         case OPTEE_MSG_ATTR_TYPE_RMEM_INOUT:
             continue;
+        default:
+            /* Ignore unsupported parameter type. */
+            continue;
         }
     }
 
@@ -1027,6 +1030,9 @@ static void copy_std_request_back(struct optee_domain *ctx,
         case OPTEE_MSG_ATTR_TYPE_RMEM_INPUT:
         case OPTEE_MSG_ATTR_TYPE_TMEM_INPUT:
             continue;
+        default:
+            /* No output fields to copy for unsupported parameter type. */
+            continue;
         }
     }
 
@@ -1050,6 +1056,7 @@ static void free_shm_buffers(struct optee_domain *ctx,
             free_optee_shm_buf(ctx, arg->params[i].u.tmem.shm_ref);
             break;
         default:
+            /* No temporary SHM buffer to free for other parameter types. */
             break;
         }
     }
@@ -1503,6 +1510,7 @@ static void handle_rpc_cmd(struct optee_domain *ctx, struct cpu_user_regs *regs,
         case OPTEE_RPC_CMD_SHM_FREE:
             break;
         default:
+            /* Other RPC commands need no Xen-side post-processing here. */
             break;
         }
     }
@@ -1591,6 +1599,9 @@ static void handle_rpc(struct optee_domain *ctx, struct cpu_user_regs *regs)
     case OPTEE_SMC_RPC_FUNC_CMD:
         handle_rpc_cmd(ctx, regs, call);
         return;
+    default:
+        /* Resume the call unchanged for unknown RPC function IDs. */
+        break;
     }
 
     do_call_with_arg(ctx, call, regs, OPTEE_SMC_CALL_RETURN_FROM_RPC,
--
generated by git-patchbot for /home/xen/git/xen.git#master


