From xen-changelog-bounces@lists.xenproject.org Mon Sep 01 12:11:07 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 01 Sep 2025 12:11:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1104622.1455639 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ut3NG-0002rh-TG; Mon, 01 Sep 2025 12:11:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1104622.1455639; Mon, 01 Sep 2025 12: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 1ut3NG-0002rZ-Qc; Mon, 01 Sep 2025 12:11:02 +0000
Received: by outflank-mailman (input) for mailman id 1104622;
 Mon, 01 Sep 2025 12: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 1ut3NF-0002rT-Qc
 for xen-changelog@lists.xenproject.org; Mon, 01 Sep 2025 12: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 1ut3NF-0019GC-1b
 for xen-changelog@lists.xenproject.org;
 Mon, 01 Sep 2025 12:11:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1ut3NF-00BrEe-2A
 for xen-changelog@lists.xenproject.org;
 Mon, 01 Sep 2025 12: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=jjuBBZNxK0Hv9W65IqEIE5KHeVk5KNjhm0acqWSh5BQ=; b=EO0gMddxCjeYC5DFeJus7rQtVT
	rXJoCwQodeFKMKbc/3T/CcwUqQX06qQyGEUiEppSbG2XATrl/Pcvrz2dNA6S6MFKc07VvcjJNf29s
	QgcVXauoZZa1DPEpDMa5YRK9yBQgIOUX6h/HTsSF5BxxMfhc67wC0G+xAJNrE3BJKPTM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] symbols: split symbols_num_syms
Message-Id: <E1ut3NF-00BrEe-2A@xenbits.xenproject.org>
Date: Mon, 01 Sep 2025 12:11:01 +0000

commit 16d9721613a05c3af26721d0a3552046bc31671f
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Sep 1 11:07:49 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Sep 1 13:06:47 2025 +0200

    symbols: split symbols_num_syms
    
    In preparation for inserting address entries into symbols_addresses[] /
    symbols_offsets[] without enlarging symbols_sorted_offsets[], split
    symbols_num_syms into symbols_num_addrs (counting entries in the former
    plus symbols_names[] as well as, less directly, symbols_markers[]) and
    symbols_num_names (counting entries in the latter).
    
    While doing the adjustment move declarations to a new private symbols.h,
    to be used by both symbols.c and symbols-dummy.c. Replace u8/u16 while
    doing so.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
---
 xen/common/symbols-dummy.c | 12 ++++++------
 xen/common/symbols.c       | 28 ++++++----------------------
 xen/common/symbols.h       | 36 ++++++++++++++++++++++++++++++++++++
 xen/tools/symbols.c        |  6 +++++-
 4 files changed, 53 insertions(+), 29 deletions(-)

diff --git a/xen/common/symbols-dummy.c b/xen/common/symbols-dummy.c
index 03cf623d69..57817c504b 100644
--- a/xen/common/symbols-dummy.c
+++ b/xen/common/symbols-dummy.c
@@ -3,22 +3,22 @@
  *                  link of the hypervisor image.
  */
 
-#include <xen/types.h>
-#include <xen/symbols.h>
+#include "symbols.h"
 
 #ifdef SYMBOLS_ORIGIN
 const unsigned int symbols_offsets[1];
 #else
 const unsigned long symbols_addresses[1];
 #endif
-const unsigned int symbols_num_syms;
-const u8 symbols_names[1];
+const unsigned int symbols_num_addrs;
+const unsigned char symbols_names[1];
 
 #ifdef CONFIG_FAST_SYMBOL_LOOKUP
+const unsigned int symbols_num_names;
 const struct symbol_offset symbols_sorted_offsets[1];
 #endif
 
-const u8 symbols_token_table[1];
-const u16 symbols_token_index[1];
+const uint8_t symbols_token_table[1];
+const uint16_t symbols_token_index[1];
 
 const unsigned int symbols_markers[1];
diff --git a/xen/common/symbols.c b/xen/common/symbols.c
index 1bc7ce7e05..500d726325 100644
--- a/xen/common/symbols.c
+++ b/xen/common/symbols.c
@@ -10,7 +10,6 @@
  *      compression (see tools/symbols.c for a more complete description)
  */
 
-#include <xen/symbols.h>
 #include <xen/kernel.h>
 #include <xen/init.h>
 #include <xen/lib.h>
@@ -21,22 +20,7 @@
 #include <xen/guest_access.h>
 #include <xen/errno.h>
 
-#ifdef SYMBOLS_ORIGIN
-extern const unsigned int symbols_offsets[];
-#define symbols_address(n) (SYMBOLS_ORIGIN + symbols_offsets[n])
-#else
-extern const unsigned long symbols_addresses[];
-#define symbols_address(n) symbols_addresses[n]
-#endif
-extern const unsigned int symbols_num_syms;
-extern const u8 symbols_names[];
-
-extern const struct symbol_offset symbols_sorted_offsets[];
-
-extern const u8 symbols_token_table[];
-extern const u16 symbols_token_index[];
-
-extern const unsigned int symbols_markers[];
+#include "symbols.h"
 
 /* expand a compressed symbol data into the resulting uncompressed string,
    given the offset to where the symbol is in the compressed stream */
@@ -124,7 +108,7 @@ const char *symbols_lookup(unsigned long addr,
 
         /* do a binary search on the sorted symbols_addresses array */
     low = 0;
-    high = symbols_num_syms;
+    high = symbols_num_addrs;
 
     while (high-low > 1) {
         mid = (low + high) / 2;
@@ -141,7 +125,7 @@ const char *symbols_lookup(unsigned long addr,
     symbols_expand_symbol(get_symbol_offset(low), namebuf);
 
     /* Search for next non-aliased symbol */
-    for (i = low + 1; i < symbols_num_syms; i++) {
+    for (i = low + 1; i < symbols_num_addrs; i++) {
         if (symbols_address(i) > symbols_address(low)) {
             symbol_end = symbols_address(i);
             break;
@@ -182,9 +166,9 @@ int xensyms_read(uint32_t *symnum, char *type,
     static unsigned int next_symbol, next_offset;
     static DEFINE_SPINLOCK(symbols_mutex);
 
-    if ( *symnum > symbols_num_syms )
+    if ( *symnum > symbols_num_addrs )
         return -ERANGE;
-    if ( *symnum == symbols_num_syms )
+    if ( *symnum == symbols_num_addrs )
     {
         /* No more symbols */
         name[0] = '\0';
@@ -227,7 +211,7 @@ unsigned long symbols_lookup_by_name(const char *symname)
 
 #ifdef CONFIG_FAST_SYMBOL_LOOKUP
     low = 0;
-    high = symbols_num_syms;
+    high = symbols_num_names;
     while ( low < high )
     {
         unsigned long mid = low + ((high - low) / 2);
diff --git a/xen/common/symbols.h b/xen/common/symbols.h
new file mode 100644
index 0000000000..a993f41c21
--- /dev/null
+++ b/xen/common/symbols.h
@@ -0,0 +1,36 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+#ifndef SYMBOLS_H
+#define SYMBOLS_H
+
+#include <xen/stdint.h>
+#include <xen/symbols.h>
+
+#ifdef SYMBOLS_ORIGIN
+extern const unsigned int symbols_offsets[];
+#define symbols_address(n) (SYMBOLS_ORIGIN + symbols_offsets[n])
+#else
+extern const unsigned long symbols_addresses[];
+#define symbols_address(n) symbols_addresses[n]
+#endif
+extern const unsigned int symbols_num_addrs;
+extern const unsigned char symbols_names[];
+
+extern const unsigned int symbols_num_names;
+extern const struct symbol_offset symbols_sorted_offsets[];
+
+extern const uint8_t symbols_token_table[];
+extern const uint16_t symbols_token_index[];
+
+extern const unsigned int symbols_markers[];
+
+#endif /* SYMBOLS_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/tools/symbols.c b/xen/tools/symbols.c
index dbf441c6ea..d2d5e1bc83 100644
--- a/xen/tools/symbols.c
+++ b/xen/tools/symbols.c
@@ -323,7 +323,7 @@ static void write_src(void)
 	}
 	printf("\n");
 
-	output_label("symbols_num_syms");
+	output_label("symbols_num_addrs");
 	printf("\t.long\t%d\n", table_cnt);
 	printf("\n");
 
@@ -373,6 +373,10 @@ static void write_src(void)
 		return;
 	}
 
+	output_label("symbols_num_names");
+	printf("\t.long\t%d\n", table_cnt);
+	printf("\n");
+
 	/* Sorted by original symbol names and type. */
 	qsort(table, table_cnt, sizeof(*table), compare_name_orig);
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Sep 01 12:11:12 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 01 Sep 2025 12:11:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1104623.1455643 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ut3NQ-0002xN-Ua; Mon, 01 Sep 2025 12:11:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1104623.1455643; Mon, 01 Sep 2025 12: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 1ut3NQ-0002xF-S1; Mon, 01 Sep 2025 12:11:12 +0000
Received: by outflank-mailman (input) for mailman id 1104623;
 Mon, 01 Sep 2025 12: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 1ut3NP-0002x5-Qg
 for xen-changelog@lists.xenproject.org; Mon, 01 Sep 2025 12: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 1ut3NP-0019GT-1t
 for xen-changelog@lists.xenproject.org;
 Mon, 01 Sep 2025 12:11:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1ut3NP-00BrFP-2T
 for xen-changelog@lists.xenproject.org;
 Mon, 01 Sep 2025 12: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=+hE4RL4PVzbhAzjlk9cpFR244RYzU9mY/JZ8/SVMRbY=; b=HW4n+RaOUU3j0rkl5JkcJr552l
	VLyHkTNj2eYe8rNTuoVBv10kdMtiJT4RmGLRj9ARU2Nhzq6dE8X/6Pax7s5tbGSuMN8sUgavq3DjI
	RXPtuxEGpS/E8J7TBeG9Zp/GIEH5bDWwA4/mN6PSrMNVCaUVrRIWFfrk7h5lcgxiaizE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] symbols: arrange to know where functions end
Message-Id: <E1ut3NP-00BrFP-2T@xenbits.xenproject.org>
Date: Mon, 01 Sep 2025 12:11:11 +0000

commit d3b637fba31b9ea5c43d830d67b558a849b615cc
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Sep 1 11:08:29 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Sep 1 13:07:01 2025 +0200

    symbols: arrange to know where functions end
    
    When determining the symbol for a given address (e.g. for the %pS
    logging format specifier), so far the size of a symbol (function) was
    assumed to be everything until the next symbol. There may be gaps
    though, which would better be recognizable in output (often suggesting
    something odd is going on).
    
    Insert "fake" end symbols in the address table, accompanied by zero-
    length type/name entries (to keep lookup reasonably close to how it
    was).
    
    Note however that this, with GNU binutils prior to 2.45, won't work for
    xen.efi: The linker loses function sizes (they're not part of a normal
    symbol table entry), and hence nm has no way of reporting them.
    
    The address table growth is quite significant on x86 release builds (due
    to functions being aligned to 16-byte boundaries), though: Its size
    almost doubles.
    
    Requested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
---
 xen/common/symbols.c | 41 +++++++++++++++++++++++++++----
 xen/tools/symbols.c  | 68 ++++++++++++++++++++++++++++++++++++++++++----------
 2 files changed, 92 insertions(+), 17 deletions(-)

diff --git a/xen/common/symbols.c b/xen/common/symbols.c
index 500d726325..0d8cc25ab0 100644
--- a/xen/common/symbols.c
+++ b/xen/common/symbols.c
@@ -116,6 +116,13 @@ const char *symbols_lookup(unsigned long addr,
         else high = mid;
     }
 
+    /* If we hit an END symbol, move to the previous (real) one. */
+    if (!symbols_names[get_symbol_offset(low)]) {
+        ASSERT(low);
+        symbol_end = symbols_address(low);
+        --low;
+    }
+
     /* search for the first aliased symbol. Aliased symbols are
            symbols with the same address */
     while (low && symbols_address(low - 1) == symbols_address(low))
@@ -124,11 +131,13 @@ const char *symbols_lookup(unsigned long addr,
         /* Grab name */
     symbols_expand_symbol(get_symbol_offset(low), namebuf);
 
-    /* Search for next non-aliased symbol */
-    for (i = low + 1; i < symbols_num_addrs; i++) {
-        if (symbols_address(i) > symbols_address(low)) {
-            symbol_end = symbols_address(i);
-            break;
+    if (!symbol_end) {
+        /* Search for next non-aliased symbol */
+        for (i = low + 1; i < symbols_num_addrs; i++) {
+            if (symbols_address(i) > symbols_address(low)) {
+                symbol_end = symbols_address(i);
+                break;
+            }
         }
     }
 
@@ -170,6 +179,7 @@ int xensyms_read(uint32_t *symnum, char *type,
         return -ERANGE;
     if ( *symnum == symbols_num_addrs )
     {
+    no_symbol:
         /* No more symbols */
         name[0] = '\0';
         return 0;
@@ -183,10 +193,31 @@ int xensyms_read(uint32_t *symnum, char *type,
         /* Non-sequential access */
         next_offset = get_symbol_offset(*symnum);
 
+    /*
+     * If we're at an END symbol, skip to the next (real) one. This can
+     * happen if the caller ignores the *symnum output from an earlier
+     * iteration (Linux'es /proc/xen/xensyms handling does as of 6.14-rc).
+     */
+    if ( !symbols_names[next_offset] )
+    {
+        ++next_offset;
+        if ( ++*symnum == symbols_num_addrs )
+            goto no_symbol;
+    }
+
     *type = symbols_get_symbol_type(next_offset);
     next_offset = symbols_expand_symbol(next_offset, name);
     *address = symbols_address(*symnum);
 
+    /* If next one is an END symbol, skip it. */
+    if ( !symbols_names[next_offset] )
+    {
+        ++next_offset;
+        /* Make sure not to increment past symbols_num_addrs below. */
+        if ( *symnum + 1 < symbols_num_addrs )
+            ++*symnum;
+    }
+
     next_symbol = ++*symnum;
 
     spin_unlock(&symbols_mutex);
diff --git a/xen/tools/symbols.c b/xen/tools/symbols.c
index d2d5e1bc83..d20e51a31c 100644
--- a/xen/tools/symbols.c
+++ b/xen/tools/symbols.c
@@ -38,6 +38,7 @@
 
 struct sym_entry {
 	unsigned long long addr;
+	unsigned long size;
 	unsigned int len;
 	unsigned char *sym;
 	char *orig_symbol;
@@ -87,6 +88,8 @@ static int read_symbol(FILE *in, struct sym_entry *s)
 	static char *filename;
 	int rc = -1;
 
+	s->size = 0;
+
 	switch (input_format) {
 	case fmt_bsd:
 		rc = fscanf(in, "%llx %c %499s\n", &s->addr, &stype, str);
@@ -96,8 +99,12 @@ static int read_symbol(FILE *in, struct sym_entry *s)
 			/* nothing */;
 		rc = fscanf(in, "%499[^ |] |%llx | %c |",
 			    str, &s->addr, &stype);
-		if (rc == 3 && fscanf(in, " %19[^ |] |", type) != 1)
-			*type = '\0';
+		if (rc == 3) {
+			if(fscanf(in, " %19[^ |] |", type) != 1)
+				*type = '\0';
+			else if(fscanf(in, "%lx |", &s->size) != 1)
+				s->size = 0;
+		}
 		break;
 	}
 	if (rc != 3) {
@@ -287,9 +294,18 @@ static int compare_name_orig(const void *p1, const void *p2)
 	return rc;
 }
 
+/* Determine whether the symbol at address table @idx wants a fake END
+ * symbol (address only) emitted as well. */
+static bool want_symbol_end(unsigned int idx)
+{
+	return table[idx].size &&
+	       (idx + 1 == table_cnt ||
+	        table[idx].addr + table[idx].size < table[idx + 1].addr);
+}
+
 static void write_src(void)
 {
-	unsigned int i, k, off;
+	unsigned int i, k, off, ends;
 	unsigned int best_idx[256];
 	unsigned int *markers;
 	char buf[KSYM_NAME_LEN+1];
@@ -318,24 +334,42 @@ static void write_src(void)
 	printf("#else\n");
 	output_label("symbols_offsets");
 	printf("#endif\n");
-	for (i = 0; i < table_cnt; i++) {
+	for (i = 0, ends = 0; i < table_cnt; i++) {
 		printf("\tPTR\t%#llx - SYMBOLS_ORIGIN\n", table[i].addr);
+
+		table[i].addr_idx = i + ends;
+
+		if (!want_symbol_end(i)) {
+			/* If there's another symbol at the same address,
+			 * propagate this symbol's size if the next one has
+			 * no size, or if the next one's size is larger. */
+			if (table[i].size &&
+			    i + 1 < table_cnt &&
+			    table[i + 1].addr == table[i].addr &&
+			    (!table[i + 1].size ||
+			     table[i + 1].size > table[i].size))
+				table[i + 1].size = table[i].size;
+			continue;
+		}
+
+		++ends;
+		printf("\tPTR\t%#llx - SYMBOLS_ORIGIN\n",
+		       table[i].addr + table[i].size);
 	}
 	printf("\n");
 
 	output_label("symbols_num_addrs");
-	printf("\t.long\t%d\n", table_cnt);
+	printf("\t.long\t%d\n", table_cnt + ends);
 	printf("\n");
 
 	/* table of offset markers, that give the offset in the compressed stream
 	 * every 256 symbols */
-	markers = (unsigned int *) malloc(sizeof(unsigned int) * ((table_cnt + 255) / 256));
+	markers = malloc(sizeof(*markers) * ((table_cnt + ends + 255) >> 8));
 
 	output_label("symbols_names");
-	off = 0;
-	for (i = 0; i < table_cnt; i++) {
-		if ((i & 0xFF) == 0)
-			markers[i >> 8] = off;
+	for (i = 0, off = 0, ends = 0; i < table_cnt; i++) {
+		if (((i + ends) & 0xFF) == 0)
+			markers[(i + ends) >> 8] = off;
 
 		printf("\t.byte 0x%02x", table[i].len);
 		for (k = 0; k < table[i].len; k++)
@@ -344,11 +378,22 @@ static void write_src(void)
 
 		table[i].stream_offset = off;
 		off += table[i].len + 1;
+
+		if (!want_symbol_end(i))
+			continue;
+
+		/* END symbols have no name or type. */
+		++ends;
+		if (((i + ends) & 0xFF) == 0)
+			markers[(i + ends) >> 8] = off;
+
+		printf("\t.byte 0\n");
+		++off;
 	}
 	printf("\n");
 
 	output_label("symbols_markers");
-	for (i = 0; i < ((table_cnt + 255) >> 8); i++)
+	for (i = 0; i < ((table_cnt + ends + 255) >> 8); i++)
 		printf("\t.long\t%d\n", markers[i]);
 	printf("\n");
 
@@ -450,7 +495,6 @@ static void compress_symbols(unsigned char *str, int idx)
 		len = table[i].len;
 		p1 = table[i].sym;
 
-		table[i].addr_idx = i;
 		/* find the token on the symbol */
 		p2 = memmem_pvt(p1, len, str, 2);
 		if (!p2) continue;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Sep 01 12:11:23 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 01 Sep 2025 12:11:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1104624.1455648 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ut3Nb-00031X-07; Mon, 01 Sep 2025 12:11:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1104624.1455648; Mon, 01 Sep 2025 12: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 1ut3Na-00031P-TP; Mon, 01 Sep 2025 12:11:22 +0000
Received: by outflank-mailman (input) for mailman id 1104624;
 Mon, 01 Sep 2025 12: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 1ut3NZ-00031A-TP
 for xen-changelog@lists.xenproject.org; Mon, 01 Sep 2025 12: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 1ut3NZ-0019GX-2A
 for xen-changelog@lists.xenproject.org;
 Mon, 01 Sep 2025 12:11:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1ut3NZ-00BrHG-2k
 for xen-changelog@lists.xenproject.org;
 Mon, 01 Sep 2025 12: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=jQlC2hwptuRdlhF0IS60pSh6qgcjF5emgke9d7PqfHo=; b=2p4m+ohTeOdMEV0heq/s5/2d8E
	j2HRgKUkDZv3VFU/slKWSYvsfxXsJclbApsv8vOe5q1VTvpLQtbG06L1xCzFK95nqiFJK8prPIYGY
	MxksmlvDTsIivZbNeMplmZxhUlLCiPWTJTfCOyz9I3SDHkTsSf+tXcYOolT17tXCEN2o=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] symbols: centralize and re-arrange $(all_symbols) calculation
Message-Id: <E1ut3NZ-00BrHG-2k@xenbits.xenproject.org>
Date: Mon, 01 Sep 2025 12:11:21 +0000

commit 584a2530136c777103047b86dcfee03af40db75c
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Sep 1 11:11:19 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Sep 1 13:07:01 2025 +0200

    symbols: centralize and re-arrange $(all_symbols) calculation
    
    For one there's no need for each architecture to have the same logic.
    Move to the root Makefile, also to calculate just once.
    
    And then re-arrange to permit FAST_SYMBOL_LOOKUP to be independent of
    LIVEPATCH, which may be useful in (at least) debugging.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/Makefile          | 7 ++++++-
 xen/arch/arm/Makefile | 9 ---------
 xen/arch/x86/Makefile | 9 ---------
 3 files changed, 6 insertions(+), 19 deletions(-)

diff --git a/xen/Makefile b/xen/Makefile
index a4d53526bd..49da79e10f 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -465,6 +465,10 @@ ALL_OBJS-$(CONFIG_CRYPTO) += crypto/built_in.o
 
 ALL_LIBS-y                := lib/lib.a
 
+all-symbols-y :=
+all-symbols-$(CONFIG_LIVEPATCH) += --all-symbols
+all-symbols-$(CONFIG_FAST_SYMBOL_LOOKUP) += --sort-by-name
+
 include $(srctree)/arch/$(SRCARCH)/arch.mk
 
 # define new variables to avoid the ones defined in Config.mk
@@ -617,7 +621,8 @@ $(TARGET): outputmakefile asm-generic FORCE
 	$(Q)$(MAKE) $(build)=include all
 	$(Q)$(MAKE) $(build)=arch/$(SRCARCH) include
 	$(Q)$(MAKE) $(build)=. arch/$(SRCARCH)/include/asm/asm-offsets.h
-	$(Q)$(MAKE) $(build)=. MKRELOC=$(MKRELOC) 'ALL_OBJS=$(ALL_OBJS-y)' 'ALL_LIBS=$(ALL_LIBS-y)' $@
+	$(Q)$(MAKE) $(build)=. MKRELOC=$(MKRELOC) 'ALL_OBJS=$(ALL_OBJS-y)' \
+	            'ALL_LIBS=$(ALL_LIBS-y)' 'all_symbols=$(all-symbols-y)' $@
 
 SUBDIRS = xsm arch common crypto drivers lib test
 define all_sources
diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile
index f833cdf207..7e88ddd3d7 100644
--- a/xen/arch/arm/Makefile
+++ b/xen/arch/arm/Makefile
@@ -78,15 +78,6 @@ ifneq ($(CONFIG_DTB_FILE),"")
 obj-y += dtb.o
 endif
 
-ifdef CONFIG_LIVEPATCH
-all_symbols = --all-symbols
-ifdef CONFIG_FAST_SYMBOL_LOOKUP
-all_symbols = --all-symbols --sort-by-name
-endif
-else
-all_symbols =
-endif
-
 $(TARGET): $(TARGET)-syms
 	$(OBJCOPY) -O binary -S $< $@
 ifeq ($(CONFIG_ARM_64),y)
diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile
index 9d67ea7cd4..d7aed7d92c 100644
--- a/xen/arch/x86/Makefile
+++ b/xen/arch/x86/Makefile
@@ -113,15 +113,6 @@ notes_phdrs = --notes
 endif
 endif
 
-ifdef CONFIG_LIVEPATCH
-all_symbols = --all-symbols
-ifdef CONFIG_FAST_SYMBOL_LOOKUP
-all_symbols = --all-symbols --sort-by-name
-endif
-else
-all_symbols =
-endif
-
 syms-warn-dup-y := --warn-dup
 syms-warn-dup-$(CONFIG_SUPPRESS_DUPLICATE_SYMBOL_WARNINGS) :=
 syms-warn-dup-$(CONFIG_ENFORCE_UNIQUE_SYMBOLS) := --error-dup
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Sep 01 12:11:33 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 01 Sep 2025 12:11:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1104625.1455651 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ut3Nl-00035p-1B; Mon, 01 Sep 2025 12:11:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1104625.1455651; Mon, 01 Sep 2025 12: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 1ut3Nk-00035f-Uk; Mon, 01 Sep 2025 12:11:32 +0000
Received: by outflank-mailman (input) for mailman id 1104625;
 Mon, 01 Sep 2025 12: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 1ut3Nk-00035E-0F
 for xen-changelog@lists.xenproject.org; Mon, 01 Sep 2025 12: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 1ut3Nj-0019Gr-2U
 for xen-changelog@lists.xenproject.org;
 Mon, 01 Sep 2025 12:11:31 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1ut3Nj-00BrHj-31
 for xen-changelog@lists.xenproject.org;
 Mon, 01 Sep 2025 12: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=8weND2i2jw25dnDKuH1pF9lPJWmF2gXfMV47q9PFhR8=; b=zjw5SkljzhkDSWbUjdO8l0s02a
	alDpd2JWzDTDLIpVkb+f080umEkrPHsIvnRtvHHbBZhFXVAs0DZc5s/VZTkdoV/DzqfZiXIhHWcnM
	y5MsS2i//i00uqrHc2FxEH02IyRTxZ/s8lmavudYNVHezY8rsABvRgwcxip5NQfxVVlM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] symbols: prefer symbols which have a type
Message-Id: <E1ut3Nj-00BrHj-31@xenbits.xenproject.org>
Date: Mon, 01 Sep 2025 12:11:31 +0000

commit 18ba7e257e16fc3f2299d007af91603c6c83ecb3
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Sep 1 11:12:14 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Sep 1 13:07:01 2025 +0200

    symbols: prefer symbols which have a type
    
    ... and thus typically also a size. Using global vs local is undesirable
    in certain situations, e.g. when a "real" symbol is local and at the
    same address as a section start/end one (which are all global).
    
    Note that for xen.efi the checking for "Function" is only forward-
    looking at this point: The function-ness of symbols (much like their
    size) is lost when linking PE/COFF binaries from ELF objects with GNU ld
    up to at least 2.44.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/tools/symbols.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/xen/tools/symbols.c b/xen/tools/symbols.c
index d20e51a31c..06ad2c25f5 100644
--- a/xen/tools/symbols.c
+++ b/xen/tools/symbols.c
@@ -45,6 +45,7 @@ struct sym_entry {
 	unsigned int addr_idx;
 	unsigned int stream_offset;
 	unsigned char type;
+	bool typed;
 };
 #define SYMBOL_NAME(s) ((char *)(s)->sym + 1)
 
@@ -180,6 +181,9 @@ static int read_symbol(FILE *in, struct sym_entry *s)
 		s->type = stype; /* As s->sym[0] ends mangled. */
 	}
 	s->sym[0] = stype;
+	s->typed = strcmp(type, "FUNC") == 0 ||
+	           strcmp(type, "OBJECT") == 0 ||
+	           strcmp(type, "Function") == 0;
 	rc = 0;
 
  skip_tail:
@@ -613,6 +617,13 @@ static int compare_value(const void *p1, const void *p2)
 		return -1;
 	if (sym1->addr > sym2->addr)
 		return +1;
+
+	/* Prefer symbols which have a type. */
+	if (sym1->typed && !sym2->typed)
+		return -1;
+	if (sym2->typed && !sym1->typed)
+		return +1;
+
 	/* Prefer global symbols. */
 	if (isupper(*sym1->sym))
 		return -1;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Sep 01 12:11:43 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 01 Sep 2025 12:11:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1104626.1455655 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ut3Nv-00038C-2b; Mon, 01 Sep 2025 12:11:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1104626.1455655; Mon, 01 Sep 2025 12: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 1ut3Nu-000384-W9; Mon, 01 Sep 2025 12:11:42 +0000
Received: by outflank-mailman (input) for mailman id 1104626;
 Mon, 01 Sep 2025 12: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 1ut3Nu-00037w-3T
 for xen-changelog@lists.xenproject.org; Mon, 01 Sep 2025 12: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 1ut3Nt-0019Gy-2k
 for xen-changelog@lists.xenproject.org;
 Mon, 01 Sep 2025 12:11:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1ut3Nu-00BrII-06
 for xen-changelog@lists.xenproject.org;
 Mon, 01 Sep 2025 12: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=BGCZPt/RqKU9eAdPPSAtJzMEA3Ao8wq+UqaQ/ai5coI=; b=UNNRk41zWijupuIdCMAyYgFxRF
	iTGfhQVGVwX7W+udW6UgkAK4fz44qXs5yPA2sl3lVY0aMX/YUvEZekji1TPOBdw0qt2Y45Ou7sOiv
	F8f6BP1OMjpwyG1NJCdM8orERWYC4YKiUfTID3RX7IpyNOF7r+YSEdD3BiCQ8SeXxnrY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] vpci: Use cleanup to free capability resource during deassign
Message-Id: <E1ut3Nu-00BrII-06@xenbits.xenproject.org>
Date: Mon, 01 Sep 2025 12:11:42 +0000

commit 70e6dace747e84b489d9e2bccbf3688fff100c89
Author:     Jiqian Chen <Jiqian.Chen@amd.com>
AuthorDate: Mon Sep 1 11:12:57 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Sep 1 13:07:01 2025 +0200

    vpci: Use cleanup to free capability resource during deassign
    
    As cleanup hook of all supported capabilities will be implemented in
    follow-on changes, so to pre-call hook in vpci_deassign_device(), and
    the capability specific clean open-code in there will be removed by
    follow-on corresponding capability changes.
    
    Since vpci_deassign_device() and vpci_init_capabilities() require
    different cleanup actions, add a boolean parameter to cleanup hook
    to distinguish them.
    
    Requested-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Jiqian Chen <Jiqian.Chen@amd.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/drivers/vpci/vpci.c | 26 +++++++++++++++++++++++++-
 xen/include/xen/vpci.h  |  2 +-
 2 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/xen/drivers/vpci/vpci.c b/xen/drivers/vpci/vpci.c
index fd02718b47..36a288ddf4 100644
--- a/xen/drivers/vpci/vpci.c
+++ b/xen/drivers/vpci/vpci.c
@@ -280,7 +280,7 @@ static int vpci_init_capabilities(struct pci_dev *pdev)
 
             if ( capability->cleanup )
             {
-                rc = capability->cleanup(pdev);
+                rc = capability->cleanup(pdev, true);
                 if ( rc )
                 {
                     printk(XENLOG_ERR "%pd %pp: clean %s cap %u fail rc=%d\n",
@@ -321,6 +321,30 @@ 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->sbdf, 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);
+        }
+    }
+
     spin_lock(&pdev->vpci->lock);
     while ( !list_empty(&pdev->vpci->handlers) )
     {
diff --git a/xen/include/xen/vpci.h b/xen/include/xen/vpci.h
index 17cfecb0aa..4b7b9298c4 100644
--- a/xen/include/xen/vpci.h
+++ b/xen/include/xen/vpci.h
@@ -17,7 +17,7 @@ typedef struct {
     unsigned int id;
     bool is_ext;
     int (* init)(struct pci_dev *pdev);
-    int (* cleanup)(const struct pci_dev *pdev);
+    int (* cleanup)(const struct pci_dev *pdev, bool hide);
 } vpci_capability_t;
 
 #define VPCI_ECAM_BDF(addr)     (((addr) & 0x0ffff000) >> 12)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Sep 01 12:11:53 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 01 Sep 2025 12:11:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1104628.1455659 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ut3O5-0003BK-5F; Mon, 01 Sep 2025 12:11:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1104628.1455659; Mon, 01 Sep 2025 12: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 1ut3O5-0003BC-2c; Mon, 01 Sep 2025 12:11:53 +0000
Received: by outflank-mailman (input) for mailman id 1104628;
 Mon, 01 Sep 2025 12: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 1ut3O4-0003B5-5b
 for xen-changelog@lists.xenproject.org; Mon, 01 Sep 2025 12: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 1ut3O3-0019H6-30
 for xen-changelog@lists.xenproject.org;
 Mon, 01 Sep 2025 12:11:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1ut3O4-00BrIo-0N
 for xen-changelog@lists.xenproject.org;
 Mon, 01 Sep 2025 12: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=j/0YPG6Nv2LBY0pKfxBfeoJAJofLUybfvIY5OXI3VP8=; b=sDT80bN4FCPwRRHnnW6a51CIX4
	z2NWaJ6oaiBTueNdkhHK+D/2vz1S3TbFUT5Kni9aOd0NUyZ2RuimqZ9G/+7QOd2Y2RYqtjUdVGa6k
	VzYg1RncATuGkdkk9KaAXfnjfpcEFGUc0sawNU0IsoC6XpzkO0NfdVbedeQ3iSCh43Q0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] vpci: Refactor vpci_remove_register to remove matched registers
Message-Id: <E1ut3O4-00BrIo-0N@xenbits.xenproject.org>
Date: Mon, 01 Sep 2025 12:11:52 +0000

commit 862331815722bbbc7cf4750f5adb45ae0be29220
Author:     Jiqian Chen <Jiqian.Chen@amd.com>
AuthorDate: Mon Sep 1 11:13:22 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Sep 1 13:07:01 2025 +0200

    vpci: Refactor vpci_remove_register to remove matched registers
    
    vpci_remove_register() only supports removing a register in a time,
    but the follow-on changes need to remove all registers within a range.
    So, refactor it to support removing all registers in a given region.
    
    And it is no issue to remove a non exist register, so remove the
    __must_check prefix.
    
    Note: two test cases don't math the new logic of
    vpci_remove_registers(), then modify them.
    
    Signed-off-by: Jiqian Chen <Jiqian.Chen@amd.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 tools/tests/vpci/main.c |  8 ++++----
 xen/drivers/vpci/vpci.c | 38 ++++++++++++++++++++------------------
 xen/include/xen/vpci.h  |  4 ++--
 3 files changed, 26 insertions(+), 24 deletions(-)

diff --git a/tools/tests/vpci/main.c b/tools/tests/vpci/main.c
index 33223db3eb..2ef8d4e03f 100644
--- a/tools/tests/vpci/main.c
+++ b/tools/tests/vpci/main.c
@@ -132,10 +132,10 @@ static void vpci_write32_mask(const struct pci_dev *pdev, unsigned int reg,
                                   rsvdz_mask))
 
 #define VPCI_REMOVE_REG(off, size)                                          \
-    assert(!vpci_remove_register(test_pdev.vpci, off, size))
+    assert(!vpci_remove_registers(test_pdev.vpci, off, size))
 
 #define VPCI_REMOVE_INVALID_REG(off, size)                                  \
-    assert(vpci_remove_register(test_pdev.vpci, off, size))
+    assert(vpci_remove_registers(test_pdev.vpci, off, size))
 
 /* Read a 32b register using all possible sizes. */
 void multiread4_check(unsigned int reg, uint32_t val)
@@ -402,10 +402,10 @@ main(int argc, char **argv)
     VPCI_REMOVE_REG(28, 1);
     VPCI_REMOVE_REG(24, 4);
     VPCI_REMOVE_REG(12, 2);
+    VPCI_REMOVE_REG(16, 2);
+    VPCI_REMOVE_REG(30, 2);
 
     VPCI_REMOVE_INVALID_REG(20, 1);
-    VPCI_REMOVE_INVALID_REG(16, 2);
-    VPCI_REMOVE_INVALID_REG(30, 2);
 
     return 0;
 }
diff --git a/xen/drivers/vpci/vpci.c b/xen/drivers/vpci/vpci.c
index 36a288ddf4..07c7071d0a 100644
--- a/xen/drivers/vpci/vpci.c
+++ b/xen/drivers/vpci/vpci.c
@@ -152,7 +152,7 @@ static int vpci_capability_hide(const struct pci_dev *pdev, unsigned int cap)
 
     prev_r->private = next_r->private;
     /*
-     * Not calling vpci_remove_register() here is to avoid redoing
+     * Not calling vpci_remove_registers() here is to avoid redoing
      * the register search.
      */
     list_del(&next_r->node);
@@ -160,7 +160,7 @@ static int vpci_capability_hide(const struct pci_dev *pdev, unsigned int cap)
     xfree(next_r);
 
     if ( !is_hardware_domain(pdev->domain) )
-        return vpci_remove_register(vpci, offset + PCI_CAP_LIST_ID, 1);
+        return vpci_remove_registers(vpci, offset + PCI_CAP_LIST_ID, 1);
 
     return 0;
 }
@@ -573,34 +573,36 @@ int vpci_add_register_mask(struct vpci *vpci, vpci_read_t *read_handler,
     return 0;
 }
 
-int vpci_remove_register(struct vpci *vpci, unsigned int offset,
-                         unsigned int size)
+int vpci_remove_registers(struct vpci *vpci, unsigned int start,
+                          unsigned int size)
 {
-    const struct vpci_register r = { .offset = offset, .size = size };
-    struct vpci_register *rm;
+    struct vpci_register *rm, *tmp;
+    unsigned int end = start + size;
 
     spin_lock(&vpci->lock);
-    list_for_each_entry ( rm, &vpci->handlers, node )
+    list_for_each_entry_safe ( rm, tmp, &vpci->handlers, node )
     {
-        int cmp = vpci_register_cmp(&r, rm);
-
-        /*
-         * NB: do not use a switch so that we can use break to
-         * get out of the list loop earlier if required.
-         */
-        if ( !cmp && rm->offset == offset && rm->size == size )
+        /* Remove rm if rm is inside the range. */
+        if ( rm->offset >= start && rm->offset + rm->size <= end )
         {
             list_del(&rm->node);
-            spin_unlock(&vpci->lock);
             xfree(rm);
-            return 0;
+            continue;
         }
-        if ( cmp <= 0 )
+
+        /* Return error if registers overlap but not inside. */
+        if ( rm->offset + rm->size > start && rm->offset < end )
+        {
+            spin_unlock(&vpci->lock);
+            return -ERANGE;
+        }
+
+        if ( start < rm->offset )
             break;
     }
     spin_unlock(&vpci->lock);
 
-    return -ENOENT;
+    return 0;
 }
 
 /* Wrappers for performing reads/writes to the underlying hardware. */
diff --git a/xen/include/xen/vpci.h b/xen/include/xen/vpci.h
index 4b7b9298c4..9ae75d946a 100644
--- a/xen/include/xen/vpci.h
+++ b/xen/include/xen/vpci.h
@@ -70,8 +70,8 @@ static inline int __must_check vpci_add_register(struct vpci *vpci,
                                   size, data, 0, 0, 0, 0);
 }
 
-int __must_check vpci_remove_register(struct vpci *vpci, unsigned int offset,
-                                      unsigned int size);
+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);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Sep 01 12:12:03 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 01 Sep 2025 12:12:03 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1104630.1455672 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ut3OF-0003S2-DY; Mon, 01 Sep 2025 12:12:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1104630.1455672; Mon, 01 Sep 2025 12: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 1ut3OF-0003Ru-Av; Mon, 01 Sep 2025 12:12:03 +0000
Received: by outflank-mailman (input) for mailman id 1104630;
 Mon, 01 Sep 2025 12: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 1ut3OE-0003RQ-8c
 for xen-changelog@lists.xenproject.org; Mon, 01 Sep 2025 12: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 1ut3OE-0019HL-05
 for xen-changelog@lists.xenproject.org;
 Mon, 01 Sep 2025 12:12:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1ut3OE-00BrKF-0f
 for xen-changelog@lists.xenproject.org;
 Mon, 01 Sep 2025 12: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=g7m0oJqNBh8PY+qeVgoTk3IQ4N4s1mbAQXg8ACkklOw=; b=I1keBuBTDI3xPi3fBCWaULZ3VR
	G6LCrjpW32UKZ1Z2prG7/48tMFK0KxizyhAKYXnW34uid6/SO7Acz7HxAfUzN0t50NKqu9KSgSXy+
	EV76WYHo/TRtCqY/xnmytVbDjfXMq9Q3pko9+u7Pa7sV25YKOASq02FW0p8ndieOVuTY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86: introduce "hot" and "cold" page copying functions
Message-Id: <E1ut3OE-00BrKF-0f@xenbits.xenproject.org>
Date: Mon, 01 Sep 2025 12:12:02 +0000

commit fc1556a1a6fa57c1de1f7a571dab06323b8b7254
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Sep 1 11:14:32 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Sep 1 13:07:01 2025 +0200

    x86: introduce "hot" and "cold" page copying functions
    
    The present copy_page_sse2() is useful in case the destination page isn't
    going to get touched again soon, or if we want to limit churn on the
    caches. Just rename it, to fit the corresponding {clear,scrub}_page_*()
    naming scheme.
    
    For cases where latency is the most important aspect, or when it is
    expected that sufficiently large parts of a destination page will get
    accessed again soon after the copying, introduce a "hot" alternative.
    Again use alternatives patching to select between a "legacy" and an ERMS
    variant.
    
    Don't switch any callers just yet - this will be the subject of subsequent
    changes.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
---
 xen/arch/x86/copy_page.S        | 19 +++++++++++++++++--
 xen/arch/x86/include/asm/page.h |  5 +++--
 2 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/copy_page.S b/xen/arch/x86/copy_page.S
index e43e5370c8..0e09f0824a 100644
--- a/xen/arch/x86/copy_page.S
+++ b/xen/arch/x86/copy_page.S
@@ -13,7 +13,7 @@
 #define tmp3_reg %r10
 #define tmp4_reg %r11
 
-FUNC(copy_page_sse2)
+FUNC(copy_page_cold)
         mov     $PAGE_SIZE/(4*WORD_SIZE)-3, %ecx
 
         prefetchnta 2*4*WORD_SIZE(src_reg)
@@ -44,4 +44,19 @@ FUNC(copy_page_sse2)
 
         sfence
         RET
-END(copy_page_sse2)
+END(copy_page_cold)
+
+        .macro copy_page_movsb
+        mov     $PAGE_SIZE, %ecx
+        rep movsb
+        .endm
+
+        .macro copy_page_movsq
+        mov     $PAGE_SIZE/8, %ecx
+        rep movsq
+        .endm
+
+FUNC(copy_page_hot)
+        ALTERNATIVE copy_page_movsq, copy_page_movsb, X86_FEATURE_ERMS
+        RET
+END(copy_page_hot)
diff --git a/xen/arch/x86/include/asm/page.h b/xen/arch/x86/include/asm/page.h
index 079ec88cc5..65a01f2402 100644
--- a/xen/arch/x86/include/asm/page.h
+++ b/xen/arch/x86/include/asm/page.h
@@ -221,10 +221,11 @@ typedef struct { u64 pfn; } pagetable_t;
 
 void clear_page_hot(void *pg);
 void clear_page_cold(void *pg);
-void copy_page_sse2(void *to, const void *from);
+void copy_page_hot(void *to, const void *from);
+void copy_page_cold(void *to, const void *from);
 
 #define clear_page(_p)      clear_page_cold(_p)
-#define copy_page(_t, _f)   copy_page_sse2(_t, _f)
+#define copy_page(_t, _f)   copy_page_cold(_t, _f)
 
 #ifdef CONFIG_DEBUG
 void scrub_page_hot(void *ptr);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Sep 01 12:12:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 01 Sep 2025 12:12:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1104632.1455676 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ut3OP-0003YC-Ey; Mon, 01 Sep 2025 12:12:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1104632.1455676; Mon, 01 Sep 2025 12:12: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 1ut3OP-0003Y4-CH; Mon, 01 Sep 2025 12:12:13 +0000
Received: by outflank-mailman (input) for mailman id 1104632;
 Mon, 01 Sep 2025 12: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 1ut3OO-0003XY-BI
 for xen-changelog@lists.xenproject.org; Mon, 01 Sep 2025 12: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 1ut3OO-0019HP-0N
 for xen-changelog@lists.xenproject.org;
 Mon, 01 Sep 2025 12:12:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1ut3OO-00BrKq-0x
 for xen-changelog@lists.xenproject.org;
 Mon, 01 Sep 2025 12: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=XaTI5N7WkjGzV5LfCzCTKszR/K7VKD4KfDKHR2ERsSg=; b=mKbU/Ac7P/Cxw4nJJ47yT4lSTV
	x7bki3a6/1tP5OBcbelUrBCAZKAZ0pvFyj46LMyxqceFtTKzkukyycnlhRKCKss4B+ejPUfdMN4k+
	s6zHKyAOrh1u/qCY3dHPWhCqxdIaVTj70J5lZrpqX4cnt85mkLgVYH3unBxzomg18TDQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/efi: Fix crash with initial empty EFI options
Message-Id: <E1ut3OO-00BrKq-0x@xenbits.xenproject.org>
Date: Mon, 01 Sep 2025 12:12:12 +0000

commit 375f0dd538072ae33b14c52465f94ecbd83625dc
Author:     Frediano Ziglio <frediano.ziglio@cloud.com>
AuthorDate: Mon Sep 1 11:15:04 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Sep 1 13:07:01 2025 +0200

    xen/efi: Fix crash with initial empty EFI options
    
    EFI code path split options from EFI LoadOptions fields in 2
    pieces, first EFI options, second Xen options.
    "get_argv" function is called first to get the number of arguments
    in the LoadOptions, second, after allocating enough space, to
    fill some "argc"/"argv" variable. However the first parsing could
    be different from second as second is able to detect "--" argument
    separator. So it was possible that "argc" was bigger than the
    initialized portion of "argv" array, leading to potential
    uninitialized pointer dereference, in particular a string like
    "-- a b c" would lead to crashes.
    Using EFI shell is possible to pass any kind of string in
    LoadOptions.
    
    Fixes: bf6501a62e80 ("x86-64: EFI boot code")
    Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
    Reviewed-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
---
 xen/common/efi/boot.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c
index b7fdb031d0..e12fa1a7ec 100644
--- a/xen/common/efi/boot.c
+++ b/xen/common/efi/boot.c
@@ -350,10 +350,11 @@ static unsigned int __init get_argv(unsigned int argc, CHAR16 **argv,
 
     if ( argc )
     {
+        argc = 0;
         cmdline = data + *offset;
         /* EFI_LOAD_OPTION does not supply an image name as first component. */
         if ( *offset )
-            *argv++ = NULL;
+            argv[argc++] = NULL;
     }
     else if ( size > sizeof(*cmdline) && !(size % sizeof(*cmdline)) &&
               (wmemchr(data, 0, size / sizeof(*cmdline)) ==
@@ -414,14 +415,14 @@ static unsigned int __init get_argv(unsigned int argc, CHAR16 **argv,
                 ++argc;
             else if ( prev && wstrcmp(prev, L"--") == 0 )
             {
-                --argv;
+                --argc;
                 if ( options )
                     *options = cmdline;
                 break;
             }
             else
             {
-                *argv++ = prev = ptr;
+                argv[argc++] = prev = ptr;
                 *ptr = *cmdline;
                 *++ptr = 0;
             }
@@ -429,7 +430,7 @@ static unsigned int __init get_argv(unsigned int argc, CHAR16 **argv,
         prev_sep = cur_sep;
     }
     if ( argv )
-        *argv = NULL;
+        argv[argc] = NULL;
     return argc;
 }
 
@@ -1355,8 +1356,8 @@ void EFIAPI __init noreturn efi_start(EFI_HANDLE ImageHandle,
                                   (argc + 1) * sizeof(*argv) +
                                       loaded_image->LoadOptionsSize,
                                   (void **)&argv) == EFI_SUCCESS )
-            get_argv(argc, argv, loaded_image->LoadOptions,
-                     loaded_image->LoadOptionsSize, &offset, &options);
+            argc = get_argv(argc, argv, loaded_image->LoadOptions,
+                            loaded_image->LoadOptionsSize, &offset, &options);
         else
             argc = 0;
         for ( i = 1; i < argc; ++i )
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Sep 01 12:12:23 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 01 Sep 2025 12:12:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1104638.1455681 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ut3OZ-0003hX-GN; Mon, 01 Sep 2025 12:12:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1104638.1455681; Mon, 01 Sep 2025 12:12: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 1ut3OZ-0003hP-Dn; Mon, 01 Sep 2025 12:12:23 +0000
Received: by outflank-mailman (input) for mailman id 1104638;
 Mon, 01 Sep 2025 12: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 1ut3OY-0003h9-Dp
 for xen-changelog@lists.xenproject.org; Mon, 01 Sep 2025 12: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 1ut3OY-0019Hs-0c
 for xen-changelog@lists.xenproject.org;
 Mon, 01 Sep 2025 12:12:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1ut3OY-00BrLF-1E
 for xen-changelog@lists.xenproject.org;
 Mon, 01 Sep 2025 12: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=YABB1d5BXdmW8UyUxIqNoPC+cJuXEuqehffyAmU5mrQ=; b=ydwF4J2VW8exqOfim5vf0WHluQ
	QIN+s5UHT4HPc+PTF6Ljm9FllJPQIZbIF5FjFuOEGlxCVY1SfAbxPBtPr6x6rnykMbOMBq2jNR6DV
	dle0EGp3yep6fBoibRBu4zBZ/4BdB7MWiP1rjM1RQbYlVlcLljBMhXbKWv9DX9TEBiZ8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/include: move xc_bitops.h to xen-tools/bitops.h
Message-Id: <E1ut3OY-00BrLF-1E@xenbits.xenproject.org>
Date: Mon, 01 Sep 2025 12:12:22 +0000

commit b0bdfbfc8899f88fe093a5e32c38751d02af6a15
Author:     Denis Mukhin <dmukhin@ford.com>
AuthorDate: Mon Sep 1 11:15:16 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Sep 1 13:07:01 2025 +0200

    tools/include: move xc_bitops.h to xen-tools/bitops.h
    
    Move xc_bitops.h to common tools location to be shared between
    the toolstack and unit test code.
    
    Adjust the guard in xen-tools/bitops.h
    
    Correct the #include directives and comments referring to the old
    xc_bitops.h in the toolstack code.
    
    Signed-off-by: Denis Mukhin <dmukhin@ford.com>
    Acked-by: Anthony PERARD <anthony.perard@vates.tech>
---
 tools/include/xen-tools/bitops.h    | 84 +++++++++++++++++++++++++++++++++++++
 tools/libs/ctrl/xc_bitops.h         | 84 -------------------------------------
 tools/libs/ctrl/xc_misc.c           | 13 +++---
 tools/libs/guest/xg_dom_elfloader.c |  1 -
 tools/libs/guest/xg_dom_hvmloader.c |  1 -
 tools/libs/guest/xg_private.h       |  2 +-
 tools/libs/guest/xg_sr_common.h     |  2 -
 7 files changed, 92 insertions(+), 95 deletions(-)

diff --git a/tools/include/xen-tools/bitops.h b/tools/include/xen-tools/bitops.h
new file mode 100644
index 0000000000..681482f675
--- /dev/null
+++ b/tools/include/xen-tools/bitops.h
@@ -0,0 +1,84 @@
+#ifndef __XEN_TOOLS_BITOPS_H__
+#define __XEN_TOOLS_BITOPS_H__
+
+/* bitmap operations for single threaded access */
+
+#include <stdlib.h>
+#include <string.h>
+
+#ifdef __LP64__
+#define BITS_PER_LONG 64
+#else
+#define BITS_PER_LONG 32
+#endif
+
+#define BITMAP_ENTRY(_nr,_bmap) ((_bmap))[(_nr) / 8]
+#define BITMAP_SHIFT(_nr) ((_nr) % 8)
+
+/* calculate required space for number of bytes needed to hold nr_bits */
+static inline unsigned long bitmap_size(unsigned long nr_bits)
+{
+    return (nr_bits + 7) / 8;
+}
+
+static inline void *bitmap_alloc(unsigned long nr_bits)
+{
+    unsigned long longs;
+
+    longs = (nr_bits + BITS_PER_LONG - 1) / BITS_PER_LONG;
+    return calloc(longs, sizeof(unsigned long));
+}
+
+static inline void bitmap_set(void *addr, unsigned long nr_bits)
+{
+    memset(addr, 0xff, bitmap_size(nr_bits));
+}
+
+static inline void bitmap_clear(void *addr, unsigned long nr_bits)
+{
+    memset(addr, 0, bitmap_size(nr_bits));
+}
+
+static inline int test_bit(unsigned long nr, const void *_addr)
+{
+    const char *addr = _addr;
+    return (BITMAP_ENTRY(nr, addr) >> BITMAP_SHIFT(nr)) & 1;
+}
+
+static inline void clear_bit(unsigned long nr, void *_addr)
+{
+    char *addr = _addr;
+    BITMAP_ENTRY(nr, addr) &= ~(1UL << BITMAP_SHIFT(nr));
+}
+
+static inline void set_bit(unsigned long nr, void *_addr)
+{
+    char *addr = _addr;
+    BITMAP_ENTRY(nr, addr) |= (1UL << BITMAP_SHIFT(nr));
+}
+
+static inline int test_and_clear_bit(unsigned long nr, void *addr)
+{
+    int oldbit = test_bit(nr, addr);
+    clear_bit(nr, addr);
+    return oldbit;
+}
+
+static inline int test_and_set_bit(unsigned long nr, void *addr)
+{
+    int oldbit = test_bit(nr, addr);
+    set_bit(nr, addr);
+    return oldbit;
+}
+
+static inline void bitmap_or(void *_dst, const void *_other,
+                             unsigned long nr_bits)
+{
+    char *dst = _dst;
+    const char *other = _other;
+    unsigned long i;
+    for ( i = 0; i < bitmap_size(nr_bits); ++i )
+        dst[i] |= other[i];
+}
+
+#endif  /* __XEN_TOOLS_BITOPS_H__ */
diff --git a/tools/libs/ctrl/xc_bitops.h b/tools/libs/ctrl/xc_bitops.h
deleted file mode 100644
index 4a776dc3a5..0000000000
--- a/tools/libs/ctrl/xc_bitops.h
+++ /dev/null
@@ -1,84 +0,0 @@
-#ifndef XC_BITOPS_H
-#define XC_BITOPS_H 1
-
-/* bitmap operations for single threaded access */
-
-#include <stdlib.h>
-#include <string.h>
-
-#ifdef __LP64__
-#define BITS_PER_LONG 64
-#else
-#define BITS_PER_LONG 32
-#endif
-
-#define BITMAP_ENTRY(_nr,_bmap) ((_bmap))[(_nr) / 8]
-#define BITMAP_SHIFT(_nr) ((_nr) % 8)
-
-/* calculate required space for number of bytes needed to hold nr_bits */
-static inline unsigned long bitmap_size(unsigned long nr_bits)
-{
-    return (nr_bits + 7) / 8;
-}
-
-static inline void *bitmap_alloc(unsigned long nr_bits)
-{
-    unsigned long longs;
-
-    longs = (nr_bits + BITS_PER_LONG - 1) / BITS_PER_LONG;
-    return calloc(longs, sizeof(unsigned long));
-}
-
-static inline void bitmap_set(void *addr, unsigned long nr_bits)
-{
-    memset(addr, 0xff, bitmap_size(nr_bits));
-}
-
-static inline void bitmap_clear(void *addr, unsigned long nr_bits)
-{
-    memset(addr, 0, bitmap_size(nr_bits));
-}
-
-static inline int test_bit(unsigned long nr, const void *_addr)
-{
-    const char *addr = _addr;
-    return (BITMAP_ENTRY(nr, addr) >> BITMAP_SHIFT(nr)) & 1;
-}
-
-static inline void clear_bit(unsigned long nr, void *_addr)
-{
-    char *addr = _addr;
-    BITMAP_ENTRY(nr, addr) &= ~(1UL << BITMAP_SHIFT(nr));
-}
-
-static inline void set_bit(unsigned long nr, void *_addr)
-{
-    char *addr = _addr;
-    BITMAP_ENTRY(nr, addr) |= (1UL << BITMAP_SHIFT(nr));
-}
-
-static inline int test_and_clear_bit(unsigned long nr, void *addr)
-{
-    int oldbit = test_bit(nr, addr);
-    clear_bit(nr, addr);
-    return oldbit;
-}
-
-static inline int test_and_set_bit(unsigned long nr, void *addr)
-{
-    int oldbit = test_bit(nr, addr);
-    set_bit(nr, addr);
-    return oldbit;
-}
-
-static inline void bitmap_or(void *_dst, const void *_other,
-                             unsigned long nr_bits)
-{
-    char *dst = _dst;
-    const char *other = _other;
-    unsigned long i;
-    for ( i = 0; i < bitmap_size(nr_bits); ++i )
-        dst[i] |= other[i];
-}
-
-#endif  /* XC_BITOPS_H */
diff --git a/tools/libs/ctrl/xc_misc.c b/tools/libs/ctrl/xc_misc.c
index 33e87bac28..10ddf85667 100644
--- a/tools/libs/ctrl/xc_misc.c
+++ b/tools/libs/ctrl/xc_misc.c
@@ -17,8 +17,8 @@
  * License along with this library; If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include "xc_bitops.h"
 #include "xc_private.h"
+#include <xen-tools/bitops.h>
 #include <xen/hvm/hvm_op.h>
 
 int xc_get_max_cpus(xc_interface *xch)
@@ -94,11 +94,12 @@ xc_cpumap_t xc_cpumap_alloc(xc_interface *xch)
 }
 
 /*
- * xc_bitops.h has macros that do this as well - however they assume that
- * the bitmask is word aligned but xc_cpumap_t is only guaranteed to be
- * byte aligned and so we need byte versions for architectures which do
- * not support misaligned accesses (which is basically everyone
- * but x86, although even on x86 it can be inefficient).
+ * <xen-tools/bitops.h> has macros that do this as well - however they
+ * assume that the bitmask is word aligned but xc_cpumap_t is only
+ * guaranteed to be byte aligned and so we need byte versions for
+ * architectures which do not support misaligned accesses (which is
+ * basically everyone but x86, although even on x86 it can be
+ * inefficient).
  *
  * NOTE: The xc_bitops macros now use byte alignment.
  * TODO: Clean up the users of this interface.
diff --git a/tools/libs/guest/xg_dom_elfloader.c b/tools/libs/guest/xg_dom_elfloader.c
index f17930d98b..a55b5e8c3c 100644
--- a/tools/libs/guest/xg_dom_elfloader.c
+++ b/tools/libs/guest/xg_dom_elfloader.c
@@ -26,7 +26,6 @@
 #include <inttypes.h>
 
 #include "xg_private.h"
-#include "xc_bitops.h"
 
 #define XEN_VER "xen-3.0"
 
diff --git a/tools/libs/guest/xg_dom_hvmloader.c b/tools/libs/guest/xg_dom_hvmloader.c
index 39e1e5f579..a98c7fe5d8 100644
--- a/tools/libs/guest/xg_dom_hvmloader.c
+++ b/tools/libs/guest/xg_dom_hvmloader.c
@@ -25,7 +25,6 @@
 #include <assert.h>
 
 #include "xg_private.h"
-#include "xc_bitops.h"
 
 /* ------------------------------------------------------------------------ */
 /* parse elf binary                                                         */
diff --git a/tools/libs/guest/xg_private.h b/tools/libs/guest/xg_private.h
index d73947094f..285229cf82 100644
--- a/tools/libs/guest/xg_private.h
+++ b/tools/libs/guest/xg_private.h
@@ -28,9 +28,9 @@
 #include <sys/stat.h>
 
 #include "xc_private.h"
-#include "xc_bitops.h"
 #include "xenguest.h"
 
+#include <xen-tools/bitops.h>
 #include <xen/memory.h>
 #include <xen/elfnote.h>
 #include <xen/libelf/libelf.h>
diff --git a/tools/libs/guest/xg_sr_common.h b/tools/libs/guest/xg_sr_common.h
index 2f058ee3a6..0e419c3a96 100644
--- a/tools/libs/guest/xg_sr_common.h
+++ b/tools/libs/guest/xg_sr_common.h
@@ -5,8 +5,6 @@
 
 #include "xg_private.h"
 #include "xg_save_restore.h"
-#include "xc_bitops.h"
-
 #include "xg_sr_stream_format.h"
 
 /* String representation of Domain Header types. */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Sep 01 12:12:33 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 01 Sep 2025 12:12:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1104643.1455685 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ut3Oj-0003nD-I6; Mon, 01 Sep 2025 12:12:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1104643.1455685; Mon, 01 Sep 2025 12:12: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 1ut3Oj-0003n5-FC; Mon, 01 Sep 2025 12:12:33 +0000
Received: by outflank-mailman (input) for mailman id 1104643;
 Mon, 01 Sep 2025 12:12: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 1ut3Oi-0003ms-Gl
 for xen-changelog@lists.xenproject.org; Mon, 01 Sep 2025 12:12: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 1ut3Oi-0019Hz-0u
 for xen-changelog@lists.xenproject.org;
 Mon, 01 Sep 2025 12:12:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1ut3Oi-00BrLb-1T
 for xen-changelog@lists.xenproject.org;
 Mon, 01 Sep 2025 12:12: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=4VzeQMc/527ULlwnqcfQl59bgrVgSz72BB4WiSmTi50=; b=AgKn+OgTVnNGefpx2XFVOmpqSw
	yhzybWJ48y7KybRUUeg89tvk/ed9ABcJpvHbVB2q6DyqfYHaY6dHjM+ot70Uub5dZUFHVj45Nvx8v
	MjhZPrAR6vny7SMBzMqjramqrhg+jSsKr/WNe2pjJT2hVgiVsn/opdV2FmDkVBd9acZA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/gen-cpuid: correct cycle detection
Message-Id: <E1ut3Oi-00BrLb-1T@xenbits.xenproject.org>
Date: Mon, 01 Sep 2025 12:12:32 +0000

commit 3999ff0d307a9a901ad1b5ad56e0dde657fec558
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Sep 1 13:07:53 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Sep 1 13:07:53 2025 +0200

    x86/gen-cpuid: correct cycle detection
    
    With the processing done linearly (rather than recursively), checking
    whether any of the features was previously seen is wrong: That would
    e.g. trigger for this simple set of dependencies
    
        X: [A, B]
        A: [C]
        B: [C]
    
    (observed in reality when making AMX-AVX512 dependent upon both
    AMX-TILE and AVX512F, causing XSAVE to see AMX-AVX512 twice in its list
    of dependents). But checking the whole accumulated set also isn't
    necessary - just checking the feature we're processing dependents of is
    sufficient. We may detect a cycle later that way, but we still will
    detect it. What we need to avoid is adding a feature again when we've
    already seen it.
    
    As a result, seeding "seen[]" with "feat" isn't necessary anymore.
    
    Fixes: fe4408d180f4 ("xen/x86: Generate deep dependencies of features")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/tools/gen-cpuid.py | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/xen/tools/gen-cpuid.py b/xen/tools/gen-cpuid.py
index 6f96d1368e..875198f4e6 100755
--- a/xen/tools/gen-cpuid.py
+++ b/xen/tools/gen-cpuid.py
@@ -354,7 +354,7 @@ def crunch_numbers(state):
 
     for feat in deep_features:
 
-        seen = [feat]
+        seen = []
         to_process = list(deps[feat])
 
         while len(to_process):
@@ -367,14 +367,17 @@ def crunch_numbers(state):
 
             f = to_process.pop(0)
 
+            if f == feat:
+                raise Fail("ERROR: Cycle found when processing %s" %
+                           (state.names[f], ))
+
             if f in seen:
-                raise Fail("ERROR: Cycle found with %s when processing %s"
-                           % (state.names[f], state.names[feat]))
+                continue
 
             seen.append(f)
             to_process = list(set(to_process + deps.get(f, [])))
 
-        state.deep_deps[feat] = seen[1:]
+        state.deep_deps[feat] = seen
 
     state.deep_features = deps.keys()
     state.nr_deep_deps = len(state.deep_deps.keys())
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Sep 01 13:11:06 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 01 Sep 2025 13:11:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1104730.1455749 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ut4JL-00060L-0F; Mon, 01 Sep 2025 13:11:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1104730.1455749; Mon, 01 Sep 2025 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 1ut4JK-00060D-Tp; Mon, 01 Sep 2025 13:11:02 +0000
Received: by outflank-mailman (input) for mailman id 1104730;
 Mon, 01 Sep 2025 13: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 1ut4JK-000607-GA
 for xen-changelog@lists.xenproject.org; Mon, 01 Sep 2025 13: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 1ut4JK-001ASw-0P
 for xen-changelog@lists.xenproject.org;
 Mon, 01 Sep 2025 13:11:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1ut4JK-00BuMq-0y
 for xen-changelog@lists.xenproject.org;
 Mon, 01 Sep 2025 13: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=Z9D5OiGcjq1+rx8VjLFjo5uvRKfmXD6eF0xKq0fJj+k=; b=SxfmCkzwAfuneKD/WxjLzx318G
	h5g7Wcmp3tLeqYVEiuMvi+PQd/rDLQC2BfVqewjreCuq4j9Xlzrqx3mvyFGv3Zbg5we8vUlKZJrfE
	QKPEBA2yL0FR4Qs+euVq4HM0i2mA58ZZpvnukj1ETeQum1f1kJXu58BhyFQeMONqJ7kQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] symbols: split symbols_num_syms
Message-Id: <E1ut4JK-00BuMq-0y@xenbits.xenproject.org>
Date: Mon, 01 Sep 2025 13:11:02 +0000

commit 16d9721613a05c3af26721d0a3552046bc31671f
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Sep 1 11:07:49 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Sep 1 13:06:47 2025 +0200

    symbols: split symbols_num_syms
    
    In preparation for inserting address entries into symbols_addresses[] /
    symbols_offsets[] without enlarging symbols_sorted_offsets[], split
    symbols_num_syms into symbols_num_addrs (counting entries in the former
    plus symbols_names[] as well as, less directly, symbols_markers[]) and
    symbols_num_names (counting entries in the latter).
    
    While doing the adjustment move declarations to a new private symbols.h,
    to be used by both symbols.c and symbols-dummy.c. Replace u8/u16 while
    doing so.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
---
 xen/common/symbols-dummy.c | 12 ++++++------
 xen/common/symbols.c       | 28 ++++++----------------------
 xen/common/symbols.h       | 36 ++++++++++++++++++++++++++++++++++++
 xen/tools/symbols.c        |  6 +++++-
 4 files changed, 53 insertions(+), 29 deletions(-)

diff --git a/xen/common/symbols-dummy.c b/xen/common/symbols-dummy.c
index 03cf623d69..57817c504b 100644
--- a/xen/common/symbols-dummy.c
+++ b/xen/common/symbols-dummy.c
@@ -3,22 +3,22 @@
  *                  link of the hypervisor image.
  */
 
-#include <xen/types.h>
-#include <xen/symbols.h>
+#include "symbols.h"
 
 #ifdef SYMBOLS_ORIGIN
 const unsigned int symbols_offsets[1];
 #else
 const unsigned long symbols_addresses[1];
 #endif
-const unsigned int symbols_num_syms;
-const u8 symbols_names[1];
+const unsigned int symbols_num_addrs;
+const unsigned char symbols_names[1];
 
 #ifdef CONFIG_FAST_SYMBOL_LOOKUP
+const unsigned int symbols_num_names;
 const struct symbol_offset symbols_sorted_offsets[1];
 #endif
 
-const u8 symbols_token_table[1];
-const u16 symbols_token_index[1];
+const uint8_t symbols_token_table[1];
+const uint16_t symbols_token_index[1];
 
 const unsigned int symbols_markers[1];
diff --git a/xen/common/symbols.c b/xen/common/symbols.c
index 1bc7ce7e05..500d726325 100644
--- a/xen/common/symbols.c
+++ b/xen/common/symbols.c
@@ -10,7 +10,6 @@
  *      compression (see tools/symbols.c for a more complete description)
  */
 
-#include <xen/symbols.h>
 #include <xen/kernel.h>
 #include <xen/init.h>
 #include <xen/lib.h>
@@ -21,22 +20,7 @@
 #include <xen/guest_access.h>
 #include <xen/errno.h>
 
-#ifdef SYMBOLS_ORIGIN
-extern const unsigned int symbols_offsets[];
-#define symbols_address(n) (SYMBOLS_ORIGIN + symbols_offsets[n])
-#else
-extern const unsigned long symbols_addresses[];
-#define symbols_address(n) symbols_addresses[n]
-#endif
-extern const unsigned int symbols_num_syms;
-extern const u8 symbols_names[];
-
-extern const struct symbol_offset symbols_sorted_offsets[];
-
-extern const u8 symbols_token_table[];
-extern const u16 symbols_token_index[];
-
-extern const unsigned int symbols_markers[];
+#include "symbols.h"
 
 /* expand a compressed symbol data into the resulting uncompressed string,
    given the offset to where the symbol is in the compressed stream */
@@ -124,7 +108,7 @@ const char *symbols_lookup(unsigned long addr,
 
         /* do a binary search on the sorted symbols_addresses array */
     low = 0;
-    high = symbols_num_syms;
+    high = symbols_num_addrs;
 
     while (high-low > 1) {
         mid = (low + high) / 2;
@@ -141,7 +125,7 @@ const char *symbols_lookup(unsigned long addr,
     symbols_expand_symbol(get_symbol_offset(low), namebuf);
 
     /* Search for next non-aliased symbol */
-    for (i = low + 1; i < symbols_num_syms; i++) {
+    for (i = low + 1; i < symbols_num_addrs; i++) {
         if (symbols_address(i) > symbols_address(low)) {
             symbol_end = symbols_address(i);
             break;
@@ -182,9 +166,9 @@ int xensyms_read(uint32_t *symnum, char *type,
     static unsigned int next_symbol, next_offset;
     static DEFINE_SPINLOCK(symbols_mutex);
 
-    if ( *symnum > symbols_num_syms )
+    if ( *symnum > symbols_num_addrs )
         return -ERANGE;
-    if ( *symnum == symbols_num_syms )
+    if ( *symnum == symbols_num_addrs )
     {
         /* No more symbols */
         name[0] = '\0';
@@ -227,7 +211,7 @@ unsigned long symbols_lookup_by_name(const char *symname)
 
 #ifdef CONFIG_FAST_SYMBOL_LOOKUP
     low = 0;
-    high = symbols_num_syms;
+    high = symbols_num_names;
     while ( low < high )
     {
         unsigned long mid = low + ((high - low) / 2);
diff --git a/xen/common/symbols.h b/xen/common/symbols.h
new file mode 100644
index 0000000000..a993f41c21
--- /dev/null
+++ b/xen/common/symbols.h
@@ -0,0 +1,36 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+#ifndef SYMBOLS_H
+#define SYMBOLS_H
+
+#include <xen/stdint.h>
+#include <xen/symbols.h>
+
+#ifdef SYMBOLS_ORIGIN
+extern const unsigned int symbols_offsets[];
+#define symbols_address(n) (SYMBOLS_ORIGIN + symbols_offsets[n])
+#else
+extern const unsigned long symbols_addresses[];
+#define symbols_address(n) symbols_addresses[n]
+#endif
+extern const unsigned int symbols_num_addrs;
+extern const unsigned char symbols_names[];
+
+extern const unsigned int symbols_num_names;
+extern const struct symbol_offset symbols_sorted_offsets[];
+
+extern const uint8_t symbols_token_table[];
+extern const uint16_t symbols_token_index[];
+
+extern const unsigned int symbols_markers[];
+
+#endif /* SYMBOLS_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/tools/symbols.c b/xen/tools/symbols.c
index dbf441c6ea..d2d5e1bc83 100644
--- a/xen/tools/symbols.c
+++ b/xen/tools/symbols.c
@@ -323,7 +323,7 @@ static void write_src(void)
 	}
 	printf("\n");
 
-	output_label("symbols_num_syms");
+	output_label("symbols_num_addrs");
 	printf("\t.long\t%d\n", table_cnt);
 	printf("\n");
 
@@ -373,6 +373,10 @@ static void write_src(void)
 		return;
 	}
 
+	output_label("symbols_num_names");
+	printf("\t.long\t%d\n", table_cnt);
+	printf("\n");
+
 	/* Sorted by original symbol names and type. */
 	qsort(table, table_cnt, sizeof(*table), compare_name_orig);
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Sep 01 13:11:14 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 01 Sep 2025 13:11:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1104731.1455753 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ut4JV-00061s-1W; Mon, 01 Sep 2025 13:11:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1104731.1455753; Mon, 01 Sep 2025 13: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 1ut4JU-00061k-VB; Mon, 01 Sep 2025 13:11:12 +0000
Received: by outflank-mailman (input) for mailman id 1104731;
 Mon, 01 Sep 2025 13: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 1ut4JU-00061e-Eu
 for xen-changelog@lists.xenproject.org; Mon, 01 Sep 2025 13: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 1ut4JU-001AT0-0h
 for xen-changelog@lists.xenproject.org;
 Mon, 01 Sep 2025 13:11:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1ut4JU-00BuNL-1G
 for xen-changelog@lists.xenproject.org;
 Mon, 01 Sep 2025 13: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=Tl9wd6bdfElR1pv4UJKv+cX+thVgWK/u6s4FF7WZgm8=; b=tOleQ8VJVYbLvkPDQNZXmrKzwV
	C+T6/RycQNHkObqfbMzUr3eIKCaftTCyW1rO+cnm2ZBxKFztkOl+2yapfmg8gQTueqZlrtf1ySaxR
	1bpHU3Il/YX6ClMyxr6K5ZB5BM068PtlMQyRUt52i/Akp/bnYwY9aEAVm3huOt+d4wEA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] symbols: arrange to know where functions end
Message-Id: <E1ut4JU-00BuNL-1G@xenbits.xenproject.org>
Date: Mon, 01 Sep 2025 13:11:12 +0000

commit d3b637fba31b9ea5c43d830d67b558a849b615cc
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Sep 1 11:08:29 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Sep 1 13:07:01 2025 +0200

    symbols: arrange to know where functions end
    
    When determining the symbol for a given address (e.g. for the %pS
    logging format specifier), so far the size of a symbol (function) was
    assumed to be everything until the next symbol. There may be gaps
    though, which would better be recognizable in output (often suggesting
    something odd is going on).
    
    Insert "fake" end symbols in the address table, accompanied by zero-
    length type/name entries (to keep lookup reasonably close to how it
    was).
    
    Note however that this, with GNU binutils prior to 2.45, won't work for
    xen.efi: The linker loses function sizes (they're not part of a normal
    symbol table entry), and hence nm has no way of reporting them.
    
    The address table growth is quite significant on x86 release builds (due
    to functions being aligned to 16-byte boundaries), though: Its size
    almost doubles.
    
    Requested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
---
 xen/common/symbols.c | 41 +++++++++++++++++++++++++++----
 xen/tools/symbols.c  | 68 ++++++++++++++++++++++++++++++++++++++++++----------
 2 files changed, 92 insertions(+), 17 deletions(-)

diff --git a/xen/common/symbols.c b/xen/common/symbols.c
index 500d726325..0d8cc25ab0 100644
--- a/xen/common/symbols.c
+++ b/xen/common/symbols.c
@@ -116,6 +116,13 @@ const char *symbols_lookup(unsigned long addr,
         else high = mid;
     }
 
+    /* If we hit an END symbol, move to the previous (real) one. */
+    if (!symbols_names[get_symbol_offset(low)]) {
+        ASSERT(low);
+        symbol_end = symbols_address(low);
+        --low;
+    }
+
     /* search for the first aliased symbol. Aliased symbols are
            symbols with the same address */
     while (low && symbols_address(low - 1) == symbols_address(low))
@@ -124,11 +131,13 @@ const char *symbols_lookup(unsigned long addr,
         /* Grab name */
     symbols_expand_symbol(get_symbol_offset(low), namebuf);
 
-    /* Search for next non-aliased symbol */
-    for (i = low + 1; i < symbols_num_addrs; i++) {
-        if (symbols_address(i) > symbols_address(low)) {
-            symbol_end = symbols_address(i);
-            break;
+    if (!symbol_end) {
+        /* Search for next non-aliased symbol */
+        for (i = low + 1; i < symbols_num_addrs; i++) {
+            if (symbols_address(i) > symbols_address(low)) {
+                symbol_end = symbols_address(i);
+                break;
+            }
         }
     }
 
@@ -170,6 +179,7 @@ int xensyms_read(uint32_t *symnum, char *type,
         return -ERANGE;
     if ( *symnum == symbols_num_addrs )
     {
+    no_symbol:
         /* No more symbols */
         name[0] = '\0';
         return 0;
@@ -183,10 +193,31 @@ int xensyms_read(uint32_t *symnum, char *type,
         /* Non-sequential access */
         next_offset = get_symbol_offset(*symnum);
 
+    /*
+     * If we're at an END symbol, skip to the next (real) one. This can
+     * happen if the caller ignores the *symnum output from an earlier
+     * iteration (Linux'es /proc/xen/xensyms handling does as of 6.14-rc).
+     */
+    if ( !symbols_names[next_offset] )
+    {
+        ++next_offset;
+        if ( ++*symnum == symbols_num_addrs )
+            goto no_symbol;
+    }
+
     *type = symbols_get_symbol_type(next_offset);
     next_offset = symbols_expand_symbol(next_offset, name);
     *address = symbols_address(*symnum);
 
+    /* If next one is an END symbol, skip it. */
+    if ( !symbols_names[next_offset] )
+    {
+        ++next_offset;
+        /* Make sure not to increment past symbols_num_addrs below. */
+        if ( *symnum + 1 < symbols_num_addrs )
+            ++*symnum;
+    }
+
     next_symbol = ++*symnum;
 
     spin_unlock(&symbols_mutex);
diff --git a/xen/tools/symbols.c b/xen/tools/symbols.c
index d2d5e1bc83..d20e51a31c 100644
--- a/xen/tools/symbols.c
+++ b/xen/tools/symbols.c
@@ -38,6 +38,7 @@
 
 struct sym_entry {
 	unsigned long long addr;
+	unsigned long size;
 	unsigned int len;
 	unsigned char *sym;
 	char *orig_symbol;
@@ -87,6 +88,8 @@ static int read_symbol(FILE *in, struct sym_entry *s)
 	static char *filename;
 	int rc = -1;
 
+	s->size = 0;
+
 	switch (input_format) {
 	case fmt_bsd:
 		rc = fscanf(in, "%llx %c %499s\n", &s->addr, &stype, str);
@@ -96,8 +99,12 @@ static int read_symbol(FILE *in, struct sym_entry *s)
 			/* nothing */;
 		rc = fscanf(in, "%499[^ |] |%llx | %c |",
 			    str, &s->addr, &stype);
-		if (rc == 3 && fscanf(in, " %19[^ |] |", type) != 1)
-			*type = '\0';
+		if (rc == 3) {
+			if(fscanf(in, " %19[^ |] |", type) != 1)
+				*type = '\0';
+			else if(fscanf(in, "%lx |", &s->size) != 1)
+				s->size = 0;
+		}
 		break;
 	}
 	if (rc != 3) {
@@ -287,9 +294,18 @@ static int compare_name_orig(const void *p1, const void *p2)
 	return rc;
 }
 
+/* Determine whether the symbol at address table @idx wants a fake END
+ * symbol (address only) emitted as well. */
+static bool want_symbol_end(unsigned int idx)
+{
+	return table[idx].size &&
+	       (idx + 1 == table_cnt ||
+	        table[idx].addr + table[idx].size < table[idx + 1].addr);
+}
+
 static void write_src(void)
 {
-	unsigned int i, k, off;
+	unsigned int i, k, off, ends;
 	unsigned int best_idx[256];
 	unsigned int *markers;
 	char buf[KSYM_NAME_LEN+1];
@@ -318,24 +334,42 @@ static void write_src(void)
 	printf("#else\n");
 	output_label("symbols_offsets");
 	printf("#endif\n");
-	for (i = 0; i < table_cnt; i++) {
+	for (i = 0, ends = 0; i < table_cnt; i++) {
 		printf("\tPTR\t%#llx - SYMBOLS_ORIGIN\n", table[i].addr);
+
+		table[i].addr_idx = i + ends;
+
+		if (!want_symbol_end(i)) {
+			/* If there's another symbol at the same address,
+			 * propagate this symbol's size if the next one has
+			 * no size, or if the next one's size is larger. */
+			if (table[i].size &&
+			    i + 1 < table_cnt &&
+			    table[i + 1].addr == table[i].addr &&
+			    (!table[i + 1].size ||
+			     table[i + 1].size > table[i].size))
+				table[i + 1].size = table[i].size;
+			continue;
+		}
+
+		++ends;
+		printf("\tPTR\t%#llx - SYMBOLS_ORIGIN\n",
+		       table[i].addr + table[i].size);
 	}
 	printf("\n");
 
 	output_label("symbols_num_addrs");
-	printf("\t.long\t%d\n", table_cnt);
+	printf("\t.long\t%d\n", table_cnt + ends);
 	printf("\n");
 
 	/* table of offset markers, that give the offset in the compressed stream
 	 * every 256 symbols */
-	markers = (unsigned int *) malloc(sizeof(unsigned int) * ((table_cnt + 255) / 256));
+	markers = malloc(sizeof(*markers) * ((table_cnt + ends + 255) >> 8));
 
 	output_label("symbols_names");
-	off = 0;
-	for (i = 0; i < table_cnt; i++) {
-		if ((i & 0xFF) == 0)
-			markers[i >> 8] = off;
+	for (i = 0, off = 0, ends = 0; i < table_cnt; i++) {
+		if (((i + ends) & 0xFF) == 0)
+			markers[(i + ends) >> 8] = off;
 
 		printf("\t.byte 0x%02x", table[i].len);
 		for (k = 0; k < table[i].len; k++)
@@ -344,11 +378,22 @@ static void write_src(void)
 
 		table[i].stream_offset = off;
 		off += table[i].len + 1;
+
+		if (!want_symbol_end(i))
+			continue;
+
+		/* END symbols have no name or type. */
+		++ends;
+		if (((i + ends) & 0xFF) == 0)
+			markers[(i + ends) >> 8] = off;
+
+		printf("\t.byte 0\n");
+		++off;
 	}
 	printf("\n");
 
 	output_label("symbols_markers");
-	for (i = 0; i < ((table_cnt + 255) >> 8); i++)
+	for (i = 0; i < ((table_cnt + ends + 255) >> 8); i++)
 		printf("\t.long\t%d\n", markers[i]);
 	printf("\n");
 
@@ -450,7 +495,6 @@ static void compress_symbols(unsigned char *str, int idx)
 		len = table[i].len;
 		p1 = table[i].sym;
 
-		table[i].addr_idx = i;
 		/* find the token on the symbol */
 		p2 = memmem_pvt(p1, len, str, 2);
 		if (!p2) continue;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Sep 01 13:11:23 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 01 Sep 2025 13:11:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1104732.1455757 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ut4Jf-00064R-37; Mon, 01 Sep 2025 13:11:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1104732.1455757; Mon, 01 Sep 2025 13: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 1ut4Jf-00064J-0Y; Mon, 01 Sep 2025 13:11:23 +0000
Received: by outflank-mailman (input) for mailman id 1104732;
 Mon, 01 Sep 2025 13: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 1ut4Je-00064B-Hm
 for xen-changelog@lists.xenproject.org; Mon, 01 Sep 2025 13: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 1ut4Je-001AT6-10
 for xen-changelog@lists.xenproject.org;
 Mon, 01 Sep 2025 13:11:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1ut4Je-00BuOj-1Z
 for xen-changelog@lists.xenproject.org;
 Mon, 01 Sep 2025 13: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=rqbAnCEzWphGxtzEgXei0Jiexn80oerppfwv4O5JEEg=; b=OvMNTMLXSWJrbPb9zsu302kwAw
	cm6qpiwLFGjEmQMRUVE+Xt+XY8+uGbbmXEFaIXSzUU/huUxxHALMfUBQgLy0I3HOt1CLRzgUUu3iT
	oShNyWg5fbTcq4xuGN90kPxMgFoS2JordScaHePa15hCjQ8NvGe1jbbMIlux1CxiXwSc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] symbols: centralize and re-arrange $(all_symbols) calculation
Message-Id: <E1ut4Je-00BuOj-1Z@xenbits.xenproject.org>
Date: Mon, 01 Sep 2025 13:11:22 +0000

commit 584a2530136c777103047b86dcfee03af40db75c
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Sep 1 11:11:19 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Sep 1 13:07:01 2025 +0200

    symbols: centralize and re-arrange $(all_symbols) calculation
    
    For one there's no need for each architecture to have the same logic.
    Move to the root Makefile, also to calculate just once.
    
    And then re-arrange to permit FAST_SYMBOL_LOOKUP to be independent of
    LIVEPATCH, which may be useful in (at least) debugging.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/Makefile          | 7 ++++++-
 xen/arch/arm/Makefile | 9 ---------
 xen/arch/x86/Makefile | 9 ---------
 3 files changed, 6 insertions(+), 19 deletions(-)

diff --git a/xen/Makefile b/xen/Makefile
index a4d53526bd..49da79e10f 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -465,6 +465,10 @@ ALL_OBJS-$(CONFIG_CRYPTO) += crypto/built_in.o
 
 ALL_LIBS-y                := lib/lib.a
 
+all-symbols-y :=
+all-symbols-$(CONFIG_LIVEPATCH) += --all-symbols
+all-symbols-$(CONFIG_FAST_SYMBOL_LOOKUP) += --sort-by-name
+
 include $(srctree)/arch/$(SRCARCH)/arch.mk
 
 # define new variables to avoid the ones defined in Config.mk
@@ -617,7 +621,8 @@ $(TARGET): outputmakefile asm-generic FORCE
 	$(Q)$(MAKE) $(build)=include all
 	$(Q)$(MAKE) $(build)=arch/$(SRCARCH) include
 	$(Q)$(MAKE) $(build)=. arch/$(SRCARCH)/include/asm/asm-offsets.h
-	$(Q)$(MAKE) $(build)=. MKRELOC=$(MKRELOC) 'ALL_OBJS=$(ALL_OBJS-y)' 'ALL_LIBS=$(ALL_LIBS-y)' $@
+	$(Q)$(MAKE) $(build)=. MKRELOC=$(MKRELOC) 'ALL_OBJS=$(ALL_OBJS-y)' \
+	            'ALL_LIBS=$(ALL_LIBS-y)' 'all_symbols=$(all-symbols-y)' $@
 
 SUBDIRS = xsm arch common crypto drivers lib test
 define all_sources
diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile
index f833cdf207..7e88ddd3d7 100644
--- a/xen/arch/arm/Makefile
+++ b/xen/arch/arm/Makefile
@@ -78,15 +78,6 @@ ifneq ($(CONFIG_DTB_FILE),"")
 obj-y += dtb.o
 endif
 
-ifdef CONFIG_LIVEPATCH
-all_symbols = --all-symbols
-ifdef CONFIG_FAST_SYMBOL_LOOKUP
-all_symbols = --all-symbols --sort-by-name
-endif
-else
-all_symbols =
-endif
-
 $(TARGET): $(TARGET)-syms
 	$(OBJCOPY) -O binary -S $< $@
 ifeq ($(CONFIG_ARM_64),y)
diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile
index 9d67ea7cd4..d7aed7d92c 100644
--- a/xen/arch/x86/Makefile
+++ b/xen/arch/x86/Makefile
@@ -113,15 +113,6 @@ notes_phdrs = --notes
 endif
 endif
 
-ifdef CONFIG_LIVEPATCH
-all_symbols = --all-symbols
-ifdef CONFIG_FAST_SYMBOL_LOOKUP
-all_symbols = --all-symbols --sort-by-name
-endif
-else
-all_symbols =
-endif
-
 syms-warn-dup-y := --warn-dup
 syms-warn-dup-$(CONFIG_SUPPRESS_DUPLICATE_SYMBOL_WARNINGS) :=
 syms-warn-dup-$(CONFIG_ENFORCE_UNIQUE_SYMBOLS) := --error-dup
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Sep 01 13:11:33 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 01 Sep 2025 13:11:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1104733.1455760 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ut4Jp-00068O-4V; Mon, 01 Sep 2025 13:11:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1104733.1455760; Mon, 01 Sep 2025 13: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 1ut4Jp-00068G-1v; Mon, 01 Sep 2025 13:11:33 +0000
Received: by outflank-mailman (input) for mailman id 1104733;
 Mon, 01 Sep 2025 13: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 1ut4Jo-000688-KL
 for xen-changelog@lists.xenproject.org; Mon, 01 Sep 2025 13: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 1ut4Jo-001ATQ-1H
 for xen-changelog@lists.xenproject.org;
 Mon, 01 Sep 2025 13:11:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1ut4Jo-00BuP5-1q
 for xen-changelog@lists.xenproject.org;
 Mon, 01 Sep 2025 13: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=sg8Foz87uLhmWF4HoHv2SiYyywAMsKgSn0GoOcQO9dQ=; b=6s+T+Mqipkv25B2vNRffWLpQco
	POycQamp8dSQiCenH5q2CBMhsAgU9ngIESR6JiyhSGCaWnOLOqz3eXC52Ord8F+SQlEp8W5wSJby9
	pjyBsZh6J+rn70v6nyQqfqo/UZVFKa/kimVb+q9uhLpFGsnBLjCy70O71weAKT3744q8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] symbols: prefer symbols which have a type
Message-Id: <E1ut4Jo-00BuP5-1q@xenbits.xenproject.org>
Date: Mon, 01 Sep 2025 13:11:32 +0000

commit 18ba7e257e16fc3f2299d007af91603c6c83ecb3
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Sep 1 11:12:14 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Sep 1 13:07:01 2025 +0200

    symbols: prefer symbols which have a type
    
    ... and thus typically also a size. Using global vs local is undesirable
    in certain situations, e.g. when a "real" symbol is local and at the
    same address as a section start/end one (which are all global).
    
    Note that for xen.efi the checking for "Function" is only forward-
    looking at this point: The function-ness of symbols (much like their
    size) is lost when linking PE/COFF binaries from ELF objects with GNU ld
    up to at least 2.44.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/tools/symbols.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/xen/tools/symbols.c b/xen/tools/symbols.c
index d20e51a31c..06ad2c25f5 100644
--- a/xen/tools/symbols.c
+++ b/xen/tools/symbols.c
@@ -45,6 +45,7 @@ struct sym_entry {
 	unsigned int addr_idx;
 	unsigned int stream_offset;
 	unsigned char type;
+	bool typed;
 };
 #define SYMBOL_NAME(s) ((char *)(s)->sym + 1)
 
@@ -180,6 +181,9 @@ static int read_symbol(FILE *in, struct sym_entry *s)
 		s->type = stype; /* As s->sym[0] ends mangled. */
 	}
 	s->sym[0] = stype;
+	s->typed = strcmp(type, "FUNC") == 0 ||
+	           strcmp(type, "OBJECT") == 0 ||
+	           strcmp(type, "Function") == 0;
 	rc = 0;
 
  skip_tail:
@@ -613,6 +617,13 @@ static int compare_value(const void *p1, const void *p2)
 		return -1;
 	if (sym1->addr > sym2->addr)
 		return +1;
+
+	/* Prefer symbols which have a type. */
+	if (sym1->typed && !sym2->typed)
+		return -1;
+	if (sym2->typed && !sym1->typed)
+		return +1;
+
 	/* Prefer global symbols. */
 	if (isupper(*sym1->sym))
 		return -1;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Sep 01 13:11:43 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 01 Sep 2025 13:11:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1104734.1455764 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ut4Jz-0006Ac-5w; Mon, 01 Sep 2025 13:11:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1104734.1455764; Mon, 01 Sep 2025 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 1ut4Jz-0006AU-3M; Mon, 01 Sep 2025 13:11:43 +0000
Received: by outflank-mailman (input) for mailman id 1104734;
 Mon, 01 Sep 2025 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 1ut4Jy-0006AO-OE
 for xen-changelog@lists.xenproject.org; Mon, 01 Sep 2025 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 1ut4Jy-001ATX-1e
 for xen-changelog@lists.xenproject.org;
 Mon, 01 Sep 2025 13:11:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1ut4Jy-00BuPc-28
 for xen-changelog@lists.xenproject.org;
 Mon, 01 Sep 2025 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=FvTdGzpoTYINucV1LnWqmwv5fn2nNidu9PLRgEFQ69o=; b=ebMAEodMKN9luOYZkxMruE/J20
	1hpG8aTEY9ygVdpru8xD6KttuVD87hn2KbWq4RCLt6H62ZfJtiBmoeRSobAwe5Us5R8s6AwS5Kjmh
	8DkRnagcTyF1h4LxTFK8A5Pwsi1g6QBGiNWtk1Mr72O12V2tPORlLehGxA6v1iLsmlzw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] vpci: Use cleanup to free capability resource during deassign
Message-Id: <E1ut4Jy-00BuPc-28@xenbits.xenproject.org>
Date: Mon, 01 Sep 2025 13:11:42 +0000

commit 70e6dace747e84b489d9e2bccbf3688fff100c89
Author:     Jiqian Chen <Jiqian.Chen@amd.com>
AuthorDate: Mon Sep 1 11:12:57 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Sep 1 13:07:01 2025 +0200

    vpci: Use cleanup to free capability resource during deassign
    
    As cleanup hook of all supported capabilities will be implemented in
    follow-on changes, so to pre-call hook in vpci_deassign_device(), and
    the capability specific clean open-code in there will be removed by
    follow-on corresponding capability changes.
    
    Since vpci_deassign_device() and vpci_init_capabilities() require
    different cleanup actions, add a boolean parameter to cleanup hook
    to distinguish them.
    
    Requested-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Jiqian Chen <Jiqian.Chen@amd.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/drivers/vpci/vpci.c | 26 +++++++++++++++++++++++++-
 xen/include/xen/vpci.h  |  2 +-
 2 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/xen/drivers/vpci/vpci.c b/xen/drivers/vpci/vpci.c
index fd02718b47..36a288ddf4 100644
--- a/xen/drivers/vpci/vpci.c
+++ b/xen/drivers/vpci/vpci.c
@@ -280,7 +280,7 @@ static int vpci_init_capabilities(struct pci_dev *pdev)
 
             if ( capability->cleanup )
             {
-                rc = capability->cleanup(pdev);
+                rc = capability->cleanup(pdev, true);
                 if ( rc )
                 {
                     printk(XENLOG_ERR "%pd %pp: clean %s cap %u fail rc=%d\n",
@@ -321,6 +321,30 @@ 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->sbdf, 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);
+        }
+    }
+
     spin_lock(&pdev->vpci->lock);
     while ( !list_empty(&pdev->vpci->handlers) )
     {
diff --git a/xen/include/xen/vpci.h b/xen/include/xen/vpci.h
index 17cfecb0aa..4b7b9298c4 100644
--- a/xen/include/xen/vpci.h
+++ b/xen/include/xen/vpci.h
@@ -17,7 +17,7 @@ typedef struct {
     unsigned int id;
     bool is_ext;
     int (* init)(struct pci_dev *pdev);
-    int (* cleanup)(const struct pci_dev *pdev);
+    int (* cleanup)(const struct pci_dev *pdev, bool hide);
 } vpci_capability_t;
 
 #define VPCI_ECAM_BDF(addr)     (((addr) & 0x0ffff000) >> 12)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Sep 01 13:11:54 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 01 Sep 2025 13:11:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1104736.1455769 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ut4KA-0006DU-9G; Mon, 01 Sep 2025 13:11:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1104736.1455769; Mon, 01 Sep 2025 13:11: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 1ut4KA-0006DM-6m; Mon, 01 Sep 2025 13:11:54 +0000
Received: by outflank-mailman (input) for mailman id 1104736;
 Mon, 01 Sep 2025 13: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 1ut4K8-0006DC-Ss
 for xen-changelog@lists.xenproject.org; Mon, 01 Sep 2025 13: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 1ut4K8-001ATb-1w
 for xen-changelog@lists.xenproject.org;
 Mon, 01 Sep 2025 13:11:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1ut4K8-00BuPz-2W
 for xen-changelog@lists.xenproject.org;
 Mon, 01 Sep 2025 13: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=5aPLD/SMnqFbdMRGLOfZ+AKOx0fCqUfcnKWuuLkx+7Q=; b=Y54CmkjvraICpDnFZI2DICr2Bq
	FMc9ekTTBOCUmdMDCdgizHYTCVk5DdVSI5g2kx34tNrIHYnzhr2z10FLvAXo1vXQKB1pOd8sj2Bvn
	Xfw45LIqK7vzHiAdljVACjTn7bEt9rtNcIgh36Wsjx8WegBrnANXqR2c8dvhy8255sSs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] vpci: Refactor vpci_remove_register to remove matched registers
Message-Id: <E1ut4K8-00BuPz-2W@xenbits.xenproject.org>
Date: Mon, 01 Sep 2025 13:11:52 +0000

commit 862331815722bbbc7cf4750f5adb45ae0be29220
Author:     Jiqian Chen <Jiqian.Chen@amd.com>
AuthorDate: Mon Sep 1 11:13:22 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Sep 1 13:07:01 2025 +0200

    vpci: Refactor vpci_remove_register to remove matched registers
    
    vpci_remove_register() only supports removing a register in a time,
    but the follow-on changes need to remove all registers within a range.
    So, refactor it to support removing all registers in a given region.
    
    And it is no issue to remove a non exist register, so remove the
    __must_check prefix.
    
    Note: two test cases don't math the new logic of
    vpci_remove_registers(), then modify them.
    
    Signed-off-by: Jiqian Chen <Jiqian.Chen@amd.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 tools/tests/vpci/main.c |  8 ++++----
 xen/drivers/vpci/vpci.c | 38 ++++++++++++++++++++------------------
 xen/include/xen/vpci.h  |  4 ++--
 3 files changed, 26 insertions(+), 24 deletions(-)

diff --git a/tools/tests/vpci/main.c b/tools/tests/vpci/main.c
index 33223db3eb..2ef8d4e03f 100644
--- a/tools/tests/vpci/main.c
+++ b/tools/tests/vpci/main.c
@@ -132,10 +132,10 @@ static void vpci_write32_mask(const struct pci_dev *pdev, unsigned int reg,
                                   rsvdz_mask))
 
 #define VPCI_REMOVE_REG(off, size)                                          \
-    assert(!vpci_remove_register(test_pdev.vpci, off, size))
+    assert(!vpci_remove_registers(test_pdev.vpci, off, size))
 
 #define VPCI_REMOVE_INVALID_REG(off, size)                                  \
-    assert(vpci_remove_register(test_pdev.vpci, off, size))
+    assert(vpci_remove_registers(test_pdev.vpci, off, size))
 
 /* Read a 32b register using all possible sizes. */
 void multiread4_check(unsigned int reg, uint32_t val)
@@ -402,10 +402,10 @@ main(int argc, char **argv)
     VPCI_REMOVE_REG(28, 1);
     VPCI_REMOVE_REG(24, 4);
     VPCI_REMOVE_REG(12, 2);
+    VPCI_REMOVE_REG(16, 2);
+    VPCI_REMOVE_REG(30, 2);
 
     VPCI_REMOVE_INVALID_REG(20, 1);
-    VPCI_REMOVE_INVALID_REG(16, 2);
-    VPCI_REMOVE_INVALID_REG(30, 2);
 
     return 0;
 }
diff --git a/xen/drivers/vpci/vpci.c b/xen/drivers/vpci/vpci.c
index 36a288ddf4..07c7071d0a 100644
--- a/xen/drivers/vpci/vpci.c
+++ b/xen/drivers/vpci/vpci.c
@@ -152,7 +152,7 @@ static int vpci_capability_hide(const struct pci_dev *pdev, unsigned int cap)
 
     prev_r->private = next_r->private;
     /*
-     * Not calling vpci_remove_register() here is to avoid redoing
+     * Not calling vpci_remove_registers() here is to avoid redoing
      * the register search.
      */
     list_del(&next_r->node);
@@ -160,7 +160,7 @@ static int vpci_capability_hide(const struct pci_dev *pdev, unsigned int cap)
     xfree(next_r);
 
     if ( !is_hardware_domain(pdev->domain) )
-        return vpci_remove_register(vpci, offset + PCI_CAP_LIST_ID, 1);
+        return vpci_remove_registers(vpci, offset + PCI_CAP_LIST_ID, 1);
 
     return 0;
 }
@@ -573,34 +573,36 @@ int vpci_add_register_mask(struct vpci *vpci, vpci_read_t *read_handler,
     return 0;
 }
 
-int vpci_remove_register(struct vpci *vpci, unsigned int offset,
-                         unsigned int size)
+int vpci_remove_registers(struct vpci *vpci, unsigned int start,
+                          unsigned int size)
 {
-    const struct vpci_register r = { .offset = offset, .size = size };
-    struct vpci_register *rm;
+    struct vpci_register *rm, *tmp;
+    unsigned int end = start + size;
 
     spin_lock(&vpci->lock);
-    list_for_each_entry ( rm, &vpci->handlers, node )
+    list_for_each_entry_safe ( rm, tmp, &vpci->handlers, node )
     {
-        int cmp = vpci_register_cmp(&r, rm);
-
-        /*
-         * NB: do not use a switch so that we can use break to
-         * get out of the list loop earlier if required.
-         */
-        if ( !cmp && rm->offset == offset && rm->size == size )
+        /* Remove rm if rm is inside the range. */
+        if ( rm->offset >= start && rm->offset + rm->size <= end )
         {
             list_del(&rm->node);
-            spin_unlock(&vpci->lock);
             xfree(rm);
-            return 0;
+            continue;
         }
-        if ( cmp <= 0 )
+
+        /* Return error if registers overlap but not inside. */
+        if ( rm->offset + rm->size > start && rm->offset < end )
+        {
+            spin_unlock(&vpci->lock);
+            return -ERANGE;
+        }
+
+        if ( start < rm->offset )
             break;
     }
     spin_unlock(&vpci->lock);
 
-    return -ENOENT;
+    return 0;
 }
 
 /* Wrappers for performing reads/writes to the underlying hardware. */
diff --git a/xen/include/xen/vpci.h b/xen/include/xen/vpci.h
index 4b7b9298c4..9ae75d946a 100644
--- a/xen/include/xen/vpci.h
+++ b/xen/include/xen/vpci.h
@@ -70,8 +70,8 @@ static inline int __must_check vpci_add_register(struct vpci *vpci,
                                   size, data, 0, 0, 0, 0);
 }
 
-int __must_check vpci_remove_register(struct vpci *vpci, unsigned int offset,
-                                      unsigned int size);
+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);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Sep 01 13:12:04 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 01 Sep 2025 13:12:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1104737.1455773 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ut4KK-0006Fc-An; Mon, 01 Sep 2025 13:12:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1104737.1455773; Mon, 01 Sep 2025 13: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 1ut4KK-0006FT-87; Mon, 01 Sep 2025 13:12:04 +0000
Received: by outflank-mailman (input) for mailman id 1104737;
 Mon, 01 Sep 2025 13: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 1ut4KI-0006FJ-Tq
 for xen-changelog@lists.xenproject.org; Mon, 01 Sep 2025 13: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 1ut4KI-001ATv-2E
 for xen-changelog@lists.xenproject.org;
 Mon, 01 Sep 2025 13:12:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1ut4KI-00BuQs-2n
 for xen-changelog@lists.xenproject.org;
 Mon, 01 Sep 2025 13: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=m/VRSVG9rZljKENBC1nBXyvNMjcbTn9PpiM6I1v0qJs=; b=WuaZFrkFPczukNEdKoWMz6RAO1
	pEQdKUAq9/L0fFBh/6dDs4N2MCyfkuyMRPTlVSPvAxYSIEbijZaPRtYFBn2PyTVzJq/1yjposAcQS
	kgFi+X5fhPQE9zUrS6Gf/k50RUPMYeNqawMn4lu9VwZLw/KsY2NUnOes92cWCBWS2AGc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86: introduce "hot" and "cold" page copying functions
Message-Id: <E1ut4KI-00BuQs-2n@xenbits.xenproject.org>
Date: Mon, 01 Sep 2025 13:12:02 +0000

commit fc1556a1a6fa57c1de1f7a571dab06323b8b7254
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Sep 1 11:14:32 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Sep 1 13:07:01 2025 +0200

    x86: introduce "hot" and "cold" page copying functions
    
    The present copy_page_sse2() is useful in case the destination page isn't
    going to get touched again soon, or if we want to limit churn on the
    caches. Just rename it, to fit the corresponding {clear,scrub}_page_*()
    naming scheme.
    
    For cases where latency is the most important aspect, or when it is
    expected that sufficiently large parts of a destination page will get
    accessed again soon after the copying, introduce a "hot" alternative.
    Again use alternatives patching to select between a "legacy" and an ERMS
    variant.
    
    Don't switch any callers just yet - this will be the subject of subsequent
    changes.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
---
 xen/arch/x86/copy_page.S        | 19 +++++++++++++++++--
 xen/arch/x86/include/asm/page.h |  5 +++--
 2 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/copy_page.S b/xen/arch/x86/copy_page.S
index e43e5370c8..0e09f0824a 100644
--- a/xen/arch/x86/copy_page.S
+++ b/xen/arch/x86/copy_page.S
@@ -13,7 +13,7 @@
 #define tmp3_reg %r10
 #define tmp4_reg %r11
 
-FUNC(copy_page_sse2)
+FUNC(copy_page_cold)
         mov     $PAGE_SIZE/(4*WORD_SIZE)-3, %ecx
 
         prefetchnta 2*4*WORD_SIZE(src_reg)
@@ -44,4 +44,19 @@ FUNC(copy_page_sse2)
 
         sfence
         RET
-END(copy_page_sse2)
+END(copy_page_cold)
+
+        .macro copy_page_movsb
+        mov     $PAGE_SIZE, %ecx
+        rep movsb
+        .endm
+
+        .macro copy_page_movsq
+        mov     $PAGE_SIZE/8, %ecx
+        rep movsq
+        .endm
+
+FUNC(copy_page_hot)
+        ALTERNATIVE copy_page_movsq, copy_page_movsb, X86_FEATURE_ERMS
+        RET
+END(copy_page_hot)
diff --git a/xen/arch/x86/include/asm/page.h b/xen/arch/x86/include/asm/page.h
index 079ec88cc5..65a01f2402 100644
--- a/xen/arch/x86/include/asm/page.h
+++ b/xen/arch/x86/include/asm/page.h
@@ -221,10 +221,11 @@ typedef struct { u64 pfn; } pagetable_t;
 
 void clear_page_hot(void *pg);
 void clear_page_cold(void *pg);
-void copy_page_sse2(void *to, const void *from);
+void copy_page_hot(void *to, const void *from);
+void copy_page_cold(void *to, const void *from);
 
 #define clear_page(_p)      clear_page_cold(_p)
-#define copy_page(_t, _f)   copy_page_sse2(_t, _f)
+#define copy_page(_t, _f)   copy_page_cold(_t, _f)
 
 #ifdef CONFIG_DEBUG
 void scrub_page_hot(void *ptr);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Sep 01 13:12:14 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 01 Sep 2025 13:12:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1104738.1455778 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ut4KU-0006Ho-Cu; Mon, 01 Sep 2025 13:12:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1104738.1455778; Mon, 01 Sep 2025 13: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 1ut4KU-0006Hg-9U; Mon, 01 Sep 2025 13:12:14 +0000
Received: by outflank-mailman (input) for mailman id 1104738;
 Mon, 01 Sep 2025 13: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 1ut4KT-0006HT-0L
 for xen-changelog@lists.xenproject.org; Mon, 01 Sep 2025 13: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 1ut4KS-001AU1-2U
 for xen-changelog@lists.xenproject.org;
 Mon, 01 Sep 2025 13:12:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1ut4KS-00BuRR-34
 for xen-changelog@lists.xenproject.org;
 Mon, 01 Sep 2025 13: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=8CjMrJNQ1cFHu2W8nLqU97YLaXTOuE6kUs//U8kZm/Y=; b=KEFnFjcT2GKPD7XyGp8pj3IMF9
	rJCDXB1G2eOH37oY4J5axyv9KzqCE6DMnyl1S/8y2Ot+akH5e1NG8bSVb4kHhuutzebzKExPIVTGU
	sbT/Z0c9d9Gv9Xo5VVDW45mRqvAUg+xHaalONYCd/ET19/rC4i5btQNk9eRO6AEFEva0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/efi: Fix crash with initial empty EFI options
Message-Id: <E1ut4KS-00BuRR-34@xenbits.xenproject.org>
Date: Mon, 01 Sep 2025 13:12:12 +0000

commit 375f0dd538072ae33b14c52465f94ecbd83625dc
Author:     Frediano Ziglio <frediano.ziglio@cloud.com>
AuthorDate: Mon Sep 1 11:15:04 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Sep 1 13:07:01 2025 +0200

    xen/efi: Fix crash with initial empty EFI options
    
    EFI code path split options from EFI LoadOptions fields in 2
    pieces, first EFI options, second Xen options.
    "get_argv" function is called first to get the number of arguments
    in the LoadOptions, second, after allocating enough space, to
    fill some "argc"/"argv" variable. However the first parsing could
    be different from second as second is able to detect "--" argument
    separator. So it was possible that "argc" was bigger than the
    initialized portion of "argv" array, leading to potential
    uninitialized pointer dereference, in particular a string like
    "-- a b c" would lead to crashes.
    Using EFI shell is possible to pass any kind of string in
    LoadOptions.
    
    Fixes: bf6501a62e80 ("x86-64: EFI boot code")
    Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
    Reviewed-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
---
 xen/common/efi/boot.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c
index b7fdb031d0..e12fa1a7ec 100644
--- a/xen/common/efi/boot.c
+++ b/xen/common/efi/boot.c
@@ -350,10 +350,11 @@ static unsigned int __init get_argv(unsigned int argc, CHAR16 **argv,
 
     if ( argc )
     {
+        argc = 0;
         cmdline = data + *offset;
         /* EFI_LOAD_OPTION does not supply an image name as first component. */
         if ( *offset )
-            *argv++ = NULL;
+            argv[argc++] = NULL;
     }
     else if ( size > sizeof(*cmdline) && !(size % sizeof(*cmdline)) &&
               (wmemchr(data, 0, size / sizeof(*cmdline)) ==
@@ -414,14 +415,14 @@ static unsigned int __init get_argv(unsigned int argc, CHAR16 **argv,
                 ++argc;
             else if ( prev && wstrcmp(prev, L"--") == 0 )
             {
-                --argv;
+                --argc;
                 if ( options )
                     *options = cmdline;
                 break;
             }
             else
             {
-                *argv++ = prev = ptr;
+                argv[argc++] = prev = ptr;
                 *ptr = *cmdline;
                 *++ptr = 0;
             }
@@ -429,7 +430,7 @@ static unsigned int __init get_argv(unsigned int argc, CHAR16 **argv,
         prev_sep = cur_sep;
     }
     if ( argv )
-        *argv = NULL;
+        argv[argc] = NULL;
     return argc;
 }
 
@@ -1355,8 +1356,8 @@ void EFIAPI __init noreturn efi_start(EFI_HANDLE ImageHandle,
                                   (argc + 1) * sizeof(*argv) +
                                       loaded_image->LoadOptionsSize,
                                   (void **)&argv) == EFI_SUCCESS )
-            get_argv(argc, argv, loaded_image->LoadOptions,
-                     loaded_image->LoadOptionsSize, &offset, &options);
+            argc = get_argv(argc, argv, loaded_image->LoadOptions,
+                            loaded_image->LoadOptionsSize, &offset, &options);
         else
             argc = 0;
         for ( i = 1; i < argc; ++i )
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Sep 01 13:12:24 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 01 Sep 2025 13:12:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1104739.1455781 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ut4Ke-0006Jn-Dr; Mon, 01 Sep 2025 13:12:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1104739.1455781; Mon, 01 Sep 2025 13: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 1ut4Ke-0006Jf-Aw; Mon, 01 Sep 2025 13:12:24 +0000
Received: by outflank-mailman (input) for mailman id 1104739;
 Mon, 01 Sep 2025 13: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 1ut4Kd-0006JX-3l
 for xen-changelog@lists.xenproject.org; Mon, 01 Sep 2025 13: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 1ut4Kc-001AU7-2o
 for xen-changelog@lists.xenproject.org;
 Mon, 01 Sep 2025 13:12:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1ut4Kd-00BuSO-08
 for xen-changelog@lists.xenproject.org;
 Mon, 01 Sep 2025 13: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=qmQ7Re9h+vymy/N9OXMgSqSJukCcQb8VMvKIJcYsS/c=; b=NCIfDMSRX7Li348G1NCPkpm05A
	39WwTno2jUhSS2ZQ5vr0Q2WcTEYD8Pr9kXyPkOo1t6D4uNMeXx4syNPokRm6+tKdJ4iPU2HVXR2qL
	cr92ggi0dwqJE1PV8zMtNeBX5JPTVJ1VNyqOY2ZwqCL3ste90qNlwPghEHVn8CUALV6U=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/include: move xc_bitops.h to xen-tools/bitops.h
Message-Id: <E1ut4Kd-00BuSO-08@xenbits.xenproject.org>
Date: Mon, 01 Sep 2025 13:12:23 +0000

commit b0bdfbfc8899f88fe093a5e32c38751d02af6a15
Author:     Denis Mukhin <dmukhin@ford.com>
AuthorDate: Mon Sep 1 11:15:16 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Sep 1 13:07:01 2025 +0200

    tools/include: move xc_bitops.h to xen-tools/bitops.h
    
    Move xc_bitops.h to common tools location to be shared between
    the toolstack and unit test code.
    
    Adjust the guard in xen-tools/bitops.h
    
    Correct the #include directives and comments referring to the old
    xc_bitops.h in the toolstack code.
    
    Signed-off-by: Denis Mukhin <dmukhin@ford.com>
    Acked-by: Anthony PERARD <anthony.perard@vates.tech>
---
 tools/include/xen-tools/bitops.h    | 84 +++++++++++++++++++++++++++++++++++++
 tools/libs/ctrl/xc_bitops.h         | 84 -------------------------------------
 tools/libs/ctrl/xc_misc.c           | 13 +++---
 tools/libs/guest/xg_dom_elfloader.c |  1 -
 tools/libs/guest/xg_dom_hvmloader.c |  1 -
 tools/libs/guest/xg_private.h       |  2 +-
 tools/libs/guest/xg_sr_common.h     |  2 -
 7 files changed, 92 insertions(+), 95 deletions(-)

diff --git a/tools/include/xen-tools/bitops.h b/tools/include/xen-tools/bitops.h
new file mode 100644
index 0000000000..681482f675
--- /dev/null
+++ b/tools/include/xen-tools/bitops.h
@@ -0,0 +1,84 @@
+#ifndef __XEN_TOOLS_BITOPS_H__
+#define __XEN_TOOLS_BITOPS_H__
+
+/* bitmap operations for single threaded access */
+
+#include <stdlib.h>
+#include <string.h>
+
+#ifdef __LP64__
+#define BITS_PER_LONG 64
+#else
+#define BITS_PER_LONG 32
+#endif
+
+#define BITMAP_ENTRY(_nr,_bmap) ((_bmap))[(_nr) / 8]
+#define BITMAP_SHIFT(_nr) ((_nr) % 8)
+
+/* calculate required space for number of bytes needed to hold nr_bits */
+static inline unsigned long bitmap_size(unsigned long nr_bits)
+{
+    return (nr_bits + 7) / 8;
+}
+
+static inline void *bitmap_alloc(unsigned long nr_bits)
+{
+    unsigned long longs;
+
+    longs = (nr_bits + BITS_PER_LONG - 1) / BITS_PER_LONG;
+    return calloc(longs, sizeof(unsigned long));
+}
+
+static inline void bitmap_set(void *addr, unsigned long nr_bits)
+{
+    memset(addr, 0xff, bitmap_size(nr_bits));
+}
+
+static inline void bitmap_clear(void *addr, unsigned long nr_bits)
+{
+    memset(addr, 0, bitmap_size(nr_bits));
+}
+
+static inline int test_bit(unsigned long nr, const void *_addr)
+{
+    const char *addr = _addr;
+    return (BITMAP_ENTRY(nr, addr) >> BITMAP_SHIFT(nr)) & 1;
+}
+
+static inline void clear_bit(unsigned long nr, void *_addr)
+{
+    char *addr = _addr;
+    BITMAP_ENTRY(nr, addr) &= ~(1UL << BITMAP_SHIFT(nr));
+}
+
+static inline void set_bit(unsigned long nr, void *_addr)
+{
+    char *addr = _addr;
+    BITMAP_ENTRY(nr, addr) |= (1UL << BITMAP_SHIFT(nr));
+}
+
+static inline int test_and_clear_bit(unsigned long nr, void *addr)
+{
+    int oldbit = test_bit(nr, addr);
+    clear_bit(nr, addr);
+    return oldbit;
+}
+
+static inline int test_and_set_bit(unsigned long nr, void *addr)
+{
+    int oldbit = test_bit(nr, addr);
+    set_bit(nr, addr);
+    return oldbit;
+}
+
+static inline void bitmap_or(void *_dst, const void *_other,
+                             unsigned long nr_bits)
+{
+    char *dst = _dst;
+    const char *other = _other;
+    unsigned long i;
+    for ( i = 0; i < bitmap_size(nr_bits); ++i )
+        dst[i] |= other[i];
+}
+
+#endif  /* __XEN_TOOLS_BITOPS_H__ */
diff --git a/tools/libs/ctrl/xc_bitops.h b/tools/libs/ctrl/xc_bitops.h
deleted file mode 100644
index 4a776dc3a5..0000000000
--- a/tools/libs/ctrl/xc_bitops.h
+++ /dev/null
@@ -1,84 +0,0 @@
-#ifndef XC_BITOPS_H
-#define XC_BITOPS_H 1
-
-/* bitmap operations for single threaded access */
-
-#include <stdlib.h>
-#include <string.h>
-
-#ifdef __LP64__
-#define BITS_PER_LONG 64
-#else
-#define BITS_PER_LONG 32
-#endif
-
-#define BITMAP_ENTRY(_nr,_bmap) ((_bmap))[(_nr) / 8]
-#define BITMAP_SHIFT(_nr) ((_nr) % 8)
-
-/* calculate required space for number of bytes needed to hold nr_bits */
-static inline unsigned long bitmap_size(unsigned long nr_bits)
-{
-    return (nr_bits + 7) / 8;
-}
-
-static inline void *bitmap_alloc(unsigned long nr_bits)
-{
-    unsigned long longs;
-
-    longs = (nr_bits + BITS_PER_LONG - 1) / BITS_PER_LONG;
-    return calloc(longs, sizeof(unsigned long));
-}
-
-static inline void bitmap_set(void *addr, unsigned long nr_bits)
-{
-    memset(addr, 0xff, bitmap_size(nr_bits));
-}
-
-static inline void bitmap_clear(void *addr, unsigned long nr_bits)
-{
-    memset(addr, 0, bitmap_size(nr_bits));
-}
-
-static inline int test_bit(unsigned long nr, const void *_addr)
-{
-    const char *addr = _addr;
-    return (BITMAP_ENTRY(nr, addr) >> BITMAP_SHIFT(nr)) & 1;
-}
-
-static inline void clear_bit(unsigned long nr, void *_addr)
-{
-    char *addr = _addr;
-    BITMAP_ENTRY(nr, addr) &= ~(1UL << BITMAP_SHIFT(nr));
-}
-
-static inline void set_bit(unsigned long nr, void *_addr)
-{
-    char *addr = _addr;
-    BITMAP_ENTRY(nr, addr) |= (1UL << BITMAP_SHIFT(nr));
-}
-
-static inline int test_and_clear_bit(unsigned long nr, void *addr)
-{
-    int oldbit = test_bit(nr, addr);
-    clear_bit(nr, addr);
-    return oldbit;
-}
-
-static inline int test_and_set_bit(unsigned long nr, void *addr)
-{
-    int oldbit = test_bit(nr, addr);
-    set_bit(nr, addr);
-    return oldbit;
-}
-
-static inline void bitmap_or(void *_dst, const void *_other,
-                             unsigned long nr_bits)
-{
-    char *dst = _dst;
-    const char *other = _other;
-    unsigned long i;
-    for ( i = 0; i < bitmap_size(nr_bits); ++i )
-        dst[i] |= other[i];
-}
-
-#endif  /* XC_BITOPS_H */
diff --git a/tools/libs/ctrl/xc_misc.c b/tools/libs/ctrl/xc_misc.c
index 33e87bac28..10ddf85667 100644
--- a/tools/libs/ctrl/xc_misc.c
+++ b/tools/libs/ctrl/xc_misc.c
@@ -17,8 +17,8 @@
  * License along with this library; If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include "xc_bitops.h"
 #include "xc_private.h"
+#include <xen-tools/bitops.h>
 #include <xen/hvm/hvm_op.h>
 
 int xc_get_max_cpus(xc_interface *xch)
@@ -94,11 +94,12 @@ xc_cpumap_t xc_cpumap_alloc(xc_interface *xch)
 }
 
 /*
- * xc_bitops.h has macros that do this as well - however they assume that
- * the bitmask is word aligned but xc_cpumap_t is only guaranteed to be
- * byte aligned and so we need byte versions for architectures which do
- * not support misaligned accesses (which is basically everyone
- * but x86, although even on x86 it can be inefficient).
+ * <xen-tools/bitops.h> has macros that do this as well - however they
+ * assume that the bitmask is word aligned but xc_cpumap_t is only
+ * guaranteed to be byte aligned and so we need byte versions for
+ * architectures which do not support misaligned accesses (which is
+ * basically everyone but x86, although even on x86 it can be
+ * inefficient).
  *
  * NOTE: The xc_bitops macros now use byte alignment.
  * TODO: Clean up the users of this interface.
diff --git a/tools/libs/guest/xg_dom_elfloader.c b/tools/libs/guest/xg_dom_elfloader.c
index f17930d98b..a55b5e8c3c 100644
--- a/tools/libs/guest/xg_dom_elfloader.c
+++ b/tools/libs/guest/xg_dom_elfloader.c
@@ -26,7 +26,6 @@
 #include <inttypes.h>
 
 #include "xg_private.h"
-#include "xc_bitops.h"
 
 #define XEN_VER "xen-3.0"
 
diff --git a/tools/libs/guest/xg_dom_hvmloader.c b/tools/libs/guest/xg_dom_hvmloader.c
index 39e1e5f579..a98c7fe5d8 100644
--- a/tools/libs/guest/xg_dom_hvmloader.c
+++ b/tools/libs/guest/xg_dom_hvmloader.c
@@ -25,7 +25,6 @@
 #include <assert.h>
 
 #include "xg_private.h"
-#include "xc_bitops.h"
 
 /* ------------------------------------------------------------------------ */
 /* parse elf binary                                                         */
diff --git a/tools/libs/guest/xg_private.h b/tools/libs/guest/xg_private.h
index d73947094f..285229cf82 100644
--- a/tools/libs/guest/xg_private.h
+++ b/tools/libs/guest/xg_private.h
@@ -28,9 +28,9 @@
 #include <sys/stat.h>
 
 #include "xc_private.h"
-#include "xc_bitops.h"
 #include "xenguest.h"
 
+#include <xen-tools/bitops.h>
 #include <xen/memory.h>
 #include <xen/elfnote.h>
 #include <xen/libelf/libelf.h>
diff --git a/tools/libs/guest/xg_sr_common.h b/tools/libs/guest/xg_sr_common.h
index 2f058ee3a6..0e419c3a96 100644
--- a/tools/libs/guest/xg_sr_common.h
+++ b/tools/libs/guest/xg_sr_common.h
@@ -5,8 +5,6 @@
 
 #include "xg_private.h"
 #include "xg_save_restore.h"
-#include "xc_bitops.h"
-
 #include "xg_sr_stream_format.h"
 
 /* String representation of Domain Header types. */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Sep 01 13:12:34 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 01 Sep 2025 13:12:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1104740.1455784 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ut4Ko-0006MA-FE; Mon, 01 Sep 2025 13:12:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1104740.1455784; Mon, 01 Sep 2025 13: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 1ut4Ko-0006M3-CO; Mon, 01 Sep 2025 13:12:34 +0000
Received: by outflank-mailman (input) for mailman id 1104740;
 Mon, 01 Sep 2025 13: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 1ut4Kn-0006Lr-6A
 for xen-changelog@lists.xenproject.org; Mon, 01 Sep 2025 13: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 1ut4Km-001AUW-35
 for xen-changelog@lists.xenproject.org;
 Mon, 01 Sep 2025 13:12:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1ut4Kn-00BuTK-0R
 for xen-changelog@lists.xenproject.org;
 Mon, 01 Sep 2025 13: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=toNe0tImZGFdwlO9K8b0FLt72A0nZul5VJTjL4LkZL4=; b=FXmQoLovHfn0PwPadj5nlHMl43
	10+jUwnYgThGEk6I9N6kR+Q1Tvr25H3sFcGsCRgdcBlvIvdiO52zA3dbO5NwVy5OCztyMvnC2jo5U
	EHPXLHIGuo0a7B9hemZdzqniTA3oDEU8HDnoV5nr+Ay04Dw1CAZ+VxQ73H24SrZY3y8U=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/gen-cpuid: correct cycle detection
Message-Id: <E1ut4Kn-00BuTK-0R@xenbits.xenproject.org>
Date: Mon, 01 Sep 2025 13:12:33 +0000

commit 3999ff0d307a9a901ad1b5ad56e0dde657fec558
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Sep 1 13:07:53 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Sep 1 13:07:53 2025 +0200

    x86/gen-cpuid: correct cycle detection
    
    With the processing done linearly (rather than recursively), checking
    whether any of the features was previously seen is wrong: That would
    e.g. trigger for this simple set of dependencies
    
        X: [A, B]
        A: [C]
        B: [C]
    
    (observed in reality when making AMX-AVX512 dependent upon both
    AMX-TILE and AVX512F, causing XSAVE to see AMX-AVX512 twice in its list
    of dependents). But checking the whole accumulated set also isn't
    necessary - just checking the feature we're processing dependents of is
    sufficient. We may detect a cycle later that way, but we still will
    detect it. What we need to avoid is adding a feature again when we've
    already seen it.
    
    As a result, seeding "seen[]" with "feat" isn't necessary anymore.
    
    Fixes: fe4408d180f4 ("xen/x86: Generate deep dependencies of features")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/tools/gen-cpuid.py | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/xen/tools/gen-cpuid.py b/xen/tools/gen-cpuid.py
index 6f96d1368e..875198f4e6 100755
--- a/xen/tools/gen-cpuid.py
+++ b/xen/tools/gen-cpuid.py
@@ -354,7 +354,7 @@ def crunch_numbers(state):
 
     for feat in deep_features:
 
-        seen = [feat]
+        seen = []
         to_process = list(deps[feat])
 
         while len(to_process):
@@ -367,14 +367,17 @@ def crunch_numbers(state):
 
             f = to_process.pop(0)
 
+            if f == feat:
+                raise Fail("ERROR: Cycle found when processing %s" %
+                           (state.names[f], ))
+
             if f in seen:
-                raise Fail("ERROR: Cycle found with %s when processing %s"
-                           % (state.names[f], state.names[feat]))
+                continue
 
             seen.append(f)
             to_process = list(set(to_process + deps.get(f, [])))
 
-        state.deep_deps[feat] = seen[1:]
+        state.deep_deps[feat] = seen
 
     state.deep_features = deps.keys()
     state.nr_deep_deps = len(state.deep_deps.keys())
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Sep 01 20:00:10 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 01 Sep 2025 20:00:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1105359.1456260 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1utAhA-0005m1-D5; Mon, 01 Sep 2025 20:00:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1105359.1456260; Mon, 01 Sep 2025 20: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 1utAhA-0005ln-9w; Mon, 01 Sep 2025 20:00:04 +0000
Received: by outflank-mailman (input) for mailman id 1105359;
 Mon, 01 Sep 2025 20: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 1utAh8-0005QA-IW
 for xen-changelog@lists.xenproject.org; Mon, 01 Sep 2025 20: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 1utAh8-001Jiq-08
 for xen-changelog@lists.xenproject.org;
 Mon, 01 Sep 2025 20:00:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1utAh8-00CIak-0g
 for xen-changelog@lists.xenproject.org;
 Mon, 01 Sep 2025 20: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=LbGMId1snHQ7Y1BiN6UXI5UFyQWiLiORI3QJ0SXtrOw=; b=LNfsOmyaWfAmp97R8z8/5CA4x3
	oSD+Tz9lwFgf8UAtksVcLBIWBAMvjmkDghu7YhzpGWSFDaHw3+0FwTAbsCtc526nKThJ/5gFojiuE
	u81L08M7N0u4IIEbzG5qCQy/AkzE30EFsxdsehp+YzuMbcW1HCc+zRZZaUAV/Az7+1m4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/traps: Set MSR_PL0_SSP in load_system_tables()
Message-Id: <E1utAh8-00CIak-0g@xenbits.xenproject.org>
Date: Mon, 01 Sep 2025 20:00:02 +0000

commit 667f90711b058cc9306232ab4d2215f41719cb0b
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon May 26 18:48:26 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Sep 1 19:54:21 2025 +0100

    x86/traps: Set MSR_PL0_SSP in load_system_tables()
    
    FRED and IDT differ by a Supervisor Token on the base of the shstk.  This
    means that the value they load into MSR_PL0_SSP differs by 8.
    
    s3_resume() in particular has logic which is otherwise invariant of FRED mode,
    and must not clobber a FRED MSR_PL0_SSP with an IDT one.
    
    This also simplifies the AP path too.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/acpi/wakeup_prot.S |  9 ---------
 xen/arch/x86/boot/x86_64.S      | 12 +++---------
 xen/arch/x86/setup.c            |  2 --
 xen/arch/x86/traps-setup.c      |  2 ++
 4 files changed, 5 insertions(+), 20 deletions(-)

diff --git a/xen/arch/x86/acpi/wakeup_prot.S b/xen/arch/x86/acpi/wakeup_prot.S
index fceb4ca353..ba0bd77806 100644
--- a/xen/arch/x86/acpi/wakeup_prot.S
+++ b/xen/arch/x86/acpi/wakeup_prot.S
@@ -104,15 +104,6 @@ LABEL(s3_resume)
          */
         mov     saved_ssp(%rip), %rdi
 
-        /* Calculate MSR_PL0_SSP from SSP. */
-        mov     $MSR_PL0_SSP, %ecx
-        mov     %rdi, %rdx
-        shr     $32, %rdx
-        mov     %edi, %eax
-        and     $~(STACK_SIZE - 1), %eax
-        or      $(PRIMARY_SHSTK_SLOT + 1) * PAGE_SIZE - 8, %eax
-        wrmsr
-
         /*
          * A Restore Token's value is &token + 8 + 64BIT (bit 0).
          * We want to put this on the shstk at SSP - 8.
diff --git a/xen/arch/x86/boot/x86_64.S b/xen/arch/x86/boot/x86_64.S
index 3a5ad27644..11a7e9d3bd 100644
--- a/xen/arch/x86/boot/x86_64.S
+++ b/xen/arch/x86/boot/x86_64.S
@@ -65,17 +65,11 @@ ENTRY(__high_start)
         or      $(PRIMARY_SHSTK_SLOT + 1) * PAGE_SIZE - 8, %rdx
 
         /*
-         * Write a new supervisor token.  Doesn't matter on boot, but for S3
-         * resume this clears the busy bit.
+         * 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
+         * SETSSBSY can set it again.
          */
         wrssq   %rdx, (%rdx)
-
-        /* Point MSR_PL0_SSP at the token. */
-        mov     $MSR_PL0_SSP, %ecx
-        mov     %edx, %eax
-        shr     $32, %rdx
-        wrmsr
-
         setssbsy
 
 #endif /* CONFIG_XEN_SHSTK */
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 6c81841426..a810bdf6d3 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -907,8 +907,6 @@ static void __init noreturn reinit_bsp_stack(void)
 
     if ( cpu_has_xen_shstk )
     {
-        wrmsrl(MSR_PL0_SSP,
-               (unsigned long)stack + (PRIMARY_SHSTK_SLOT + 1) * PAGE_SIZE - 8);
         wrmsrl(MSR_S_CET, xen_msr_s_cet_value());
         asm volatile ("setssbsy" ::: "memory");
     }
diff --git a/xen/arch/x86/traps-setup.c b/xen/arch/x86/traps-setup.c
index 6e2af58ba0..d77be8f839 100644
--- a/xen/arch/x86/traps-setup.c
+++ b/xen/arch/x86/traps-setup.c
@@ -92,6 +92,7 @@ static void load_system_tables(void)
     {
         volatile uint64_t *ist_ssp = tss_page->ist_ssp;
         unsigned long
+            ssp = stack_top + (PRIMARY_SHSTK_SLOT + 1) * PAGE_SIZE - 8,
             mce_ssp = stack_top + (IST_MCE * IST_SHSTK_SIZE) - 8,
             nmi_ssp = stack_top + (IST_NMI * IST_SHSTK_SIZE) - 8,
             db_ssp  = stack_top + (IST_DB  * IST_SHSTK_SIZE) - 8,
@@ -118,6 +119,7 @@ static void load_system_tables(void)
         }
 
         wrmsrns(MSR_ISST, (unsigned long)ist_ssp);
+        wrmsrns(MSR_PL0_SSP, (unsigned long)ssp);
     }
 
     _set_tssldt_desc(gdt + TSS_ENTRY, (unsigned long)tss,
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Sep 01 20:00:14 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 01 Sep 2025 20:00:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1105360.1456263 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1utAhK-0006DC-EG; Mon, 01 Sep 2025 20:00:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1105360.1456263; Mon, 01 Sep 2025 20: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 1utAhK-0006D4-BJ; Mon, 01 Sep 2025 20:00:14 +0000
Received: by outflank-mailman (input) for mailman id 1105360;
 Mon, 01 Sep 2025 20: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 1utAhI-0006Cs-Dr
 for xen-changelog@lists.xenproject.org; Mon, 01 Sep 2025 20: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 1utAhI-001Jiv-0Z
 for xen-changelog@lists.xenproject.org;
 Mon, 01 Sep 2025 20:00:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1utAhI-00CIbr-10
 for xen-changelog@lists.xenproject.org;
 Mon, 01 Sep 2025 20: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=oz1WGGBzR5jQL8xaYnVit72NHG5nASqcZcfTox7LDUk=; b=jbj8T3n1y+jAI5xY4CcEGP7l8N
	bwN3sn2Y2eXS4wuTj92jrTY3zcLDi95k0WNvoxU3OyfCTg1ZIvh+iwtBeBF6wAbuVjOCw/HL83ZeJ
	kENvVbW5c9ChJCH52uyPNEIL5kSS3BPAjZRwJ8t8tQyd/fvLmWaUsmF7kqMYWZyuUSRM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/gen-cpuid: Fix debugging for cycle detection
Message-Id: <E1utAhI-00CIbr-10@xenbits.xenproject.org>
Date: Mon, 01 Sep 2025 20:00:12 +0000

commit 5edb4ccff6a13ea10d1c1888942dff0c868c7844
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Aug 29 20:06:46 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Sep 1 19:54:21 2025 +0100

    x86/gen-cpuid: Fix debugging for cycle detection
    
    Jan reports the following exception when using the cycle debugging:
    
      Feature IBRSB, seen [IBRSB, STIBP, INTEL_PSFD, EIBRS, IPRED_CTRL, RRSBA_CTRL, RRSBA, BHI_CTRL], to_process [SSBD]
      Traceback (most recent call last):
        File "/local/xen.git/xen/../xen/tools/gen-cpuid.py", line 594, in <module>
          sys.exit(main())
                   ^^^^^^
        File "/local/xen.git/xen/../xen/tools/gen-cpuid.py", line 588, in main
          crunch_numbers(state)
        File "/local/xen.git/xen/../xen/tools/gen-cpuid.py", line 366, in crunch_numbers
          (state.names[feat], repl(seen), repl(to_process)))
                                          ^^^^^^^^^^^^^^^^
        File "/local/xen.git/xen/../xen/tools/gen-cpuid.py", line 364, in repl
          return "[" + ", ".join((state.names[x] for x in l)) + "]"
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/local/xen.git/xen/../xen/tools/gen-cpuid.py", line 364, in <genexpr>
          return "[" + ", ".join((state.names[x] for x in l)) + "]"
                                  ~~~~~~~~~~~^^^
      KeyError: 534
      make[2]: *** [/local/xen.git/xen/include/xen/lib/x86/Makefile:9: cpuid-autogen.h] Error 1
    
    This is caused by commit ce8c930851a5 ("x86/cpu-policy: MSR_ARCH_CAPS feature
    names") being rather lazy and marking dependenices on unknown features.
    
    Introduce a helper to pick the known features in a range, and use it for
    ARCH_CAPS.
    
    Additionally, remove trailing whitespace and an unnecessary line continuation
    from the debug print.
    
    Reported-by: Jan Beulich <jbeulich@suse.com>
    Fixes: ce8c930851a5 ("x86/cpu-policy: MSR_ARCH_CAPS feature names")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/tools/gen-cpuid.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/xen/tools/gen-cpuid.py b/xen/tools/gen-cpuid.py
index 875198f4e6..13d85a4348 100755
--- a/xen/tools/gen-cpuid.py
+++ b/xen/tools/gen-cpuid.py
@@ -168,6 +168,10 @@ def crunch_numbers(state):
     state.hvm_shadow_max = state.pv_max         | state.raw['S'] | state.raw['s']
     state.hvm_hap_max =    state.hvm_shadow_max | state.raw['H'] | state.raw['h']
 
+    def feat_range(start, last):
+        """ Select all known features in the given range """
+        return [ x for x in state.names.keys() if start <= x <= last ]
+
     #
     # Feature dependency information.
     #
@@ -338,7 +342,7 @@ def crunch_numbers(state):
         PSFD: [EPSF],
 
         # The ARCH_CAPS CPUID bit enumerates the availability of the whole register.
-        ARCH_CAPS: list(range(RDCL_NO, RDCL_NO + 64)),
+        ARCH_CAPS: feat_range(RDCL_NO, RDCL_NO + 63),
 
         # The behaviour described by RRSBA depend on eIBRS being active.
         EIBRS: [RRSBA],
@@ -362,7 +366,7 @@ def crunch_numbers(state):
             # To debug, uncomment the following lines:
             # def repl(l):
             #     return "[" + ", ".join((state.names[x] for x in l)) + "]"
-            # sys.stderr.write("Feature %s, seen %s, to_process %s \n" % \
+            # sys.stderr.write("Feature %s, seen %s, to_process %s\n" %
             #     (state.names[feat], repl(seen), repl(to_process)))
 
             f = to_process.pop(0)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Sep 01 20:00:24 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 01 Sep 2025 20:00:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1105361.1456267 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1utAhU-0006FS-FO; Mon, 01 Sep 2025 20:00:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1105361.1456267; Mon, 01 Sep 2025 20:00: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 1utAhU-0006FH-Ci; Mon, 01 Sep 2025 20:00:24 +0000
Received: by outflank-mailman (input) for mailman id 1105361;
 Mon, 01 Sep 2025 20: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 1utAhS-0006Ez-GD
 for xen-changelog@lists.xenproject.org; Mon, 01 Sep 2025 20: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 1utAhS-001Jj1-0p
 for xen-changelog@lists.xenproject.org;
 Mon, 01 Sep 2025 20:00:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1utAhS-00CIcj-1Q
 for xen-changelog@lists.xenproject.org;
 Mon, 01 Sep 2025 20: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=/lEnRcjBxeJWi1vOIYc5lj57C7VDuXNINt6A9CB6xBQ=; b=WKZpeUA2apQ2LlsRygGxPsCBVO
	OB/qF2lw467yc42HGdpCFLNzy+Zy5yMPubLaGZreGTgG9emhqivx6i9EhJKBhR6/qNwpg1vCxZvl4
	ggRLr0t6sikmhTezaQy4X5RXughukOOEGBuEm9L0uT9MzORqPlgi7KvWIqvraCs7XQUc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/apic: Get rid of get_physical_broadcast()
Message-Id: <E1utAhS-00CIcj-1Q@xenbits.xenproject.org>
Date: Mon, 01 Sep 2025 20:00:22 +0000

commit 944fdddbfd38e9d6379c129327a84662233e6e68
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Aug 28 20:20:35 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Sep 1 19:54:21 2025 +0100

    x86/apic: Get rid of get_physical_broadcast()
    
    This is a port of Linux commit 517234446c1a ("x86/apic: Get rid of
    get_physical_broadcast()") to Xen.  Thomas Gleixner notes:
    
      There is no point for this function. The only case where this is used is
      when there is no XAPIC available, which means the broadcast address is 0xF.
    
    In Linux, users of get_physical_broadcast() have already been hidden behind
    CONFIG_X86_32 suggesting we can drop all of this, but that's a task for some
    other time.
    
    In Xen as with Linux, setup_ioapic_ids_from_mpc() and io_apic_get_unique_id()
    only apply to pre-xAPIC cases, so can use a broadcast ID of 0xf.  The only
    other user is __print_IO_APIC() for diagnostics, which can simply drop the
    check.
    
    No functional change.
    
    Link: https://lore.kernel.org/r/20240212154639.057209154@linutronix.de
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/apic.c             |  8 --------
 xen/arch/x86/include/asm/apic.h |  2 --
 xen/arch/x86/io_apic.c          | 16 ++++++++--------
 3 files changed, 8 insertions(+), 18 deletions(-)

diff --git a/xen/arch/x86/apic.c b/xen/arch/x86/apic.c
index e3a2b84f1a..70636b0bb5 100644
--- a/xen/arch/x86/apic.c
+++ b/xen/arch/x86/apic.c
@@ -133,14 +133,6 @@ static bool __read_mostly using_apic_timer;
 
 static bool __read_mostly enabled_via_apicbase;
 
-int get_physical_broadcast(void)
-{
-    if (modern_apic())
-        return 0xff;
-    else
-        return 0xf;
-}
-
 int get_maxlvt(void)
 {
     unsigned int v = apic_read(APIC_LVR);
diff --git a/xen/arch/x86/include/asm/apic.h b/xen/arch/x86/include/asm/apic.h
index d8eda6df6d..d228549536 100644
--- a/xen/arch/x86/include/asm/apic.h
+++ b/xen/arch/x86/include/asm/apic.h
@@ -153,8 +153,6 @@ static inline u32 get_apic_id(void)
 
 void apic_wait_icr_idle(void);
 
-int get_physical_broadcast(void);
-
 static inline void ack_APIC_irq(void)
 {
 	/* Docs say use 0 for future compatibility */
diff --git a/xen/arch/x86/io_apic.c b/xen/arch/x86/io_apic.c
index 1816e1c0b9..42a9b653d3 100644
--- a/xen/arch/x86/io_apic.c
+++ b/xen/arch/x86/io_apic.c
@@ -1217,8 +1217,6 @@ static void /*__init*/ __print_IO_APIC(bool boot)
 	printk(KERN_DEBUG ".......    : physical APIC id: %02X\n", reg_00.bits.ID);
 	printk(KERN_DEBUG ".......    : Delivery Type: %X\n", reg_00.bits.delivery_type);
 	printk(KERN_DEBUG ".......    : LTS          : %X\n", reg_00.bits.LTS);
-	if (reg_00.bits.ID >= get_physical_broadcast())
-            UNEXPECTED_IO_APIC();
 	if (reg_00.bits.__reserved_1 || reg_00.bits.__reserved_2)
             UNEXPECTED_IO_APIC();
 
@@ -1475,6 +1473,7 @@ static void __init setup_ioapic_ids_from_mpc(void)
     int i;
     unsigned char old_id;
     unsigned long flags;
+    const uint32_t broadcast_id = 0xf;
 
     /*
      * Don't check I/O APIC IDs for xAPIC systems. They have
@@ -1504,7 +1503,7 @@ static void __init setup_ioapic_ids_from_mpc(void)
 		
         old_id = mp_ioapics[apic].mpc_apicid;
 
-        if (mp_ioapics[apic].mpc_apicid >= get_physical_broadcast()) {
+        if (mp_ioapics[apic].mpc_apicid >= broadcast_id) {
             printk(KERN_ERR "BIOS bug, IO-APIC#%d ID is %d in the MPC table!...\n",
                    apic, mp_ioapics[apic].mpc_apicid);
             printk(KERN_ERR "... fixing up to %d. (tell your hw vendor)\n",
@@ -1521,10 +1520,10 @@ static void __init setup_ioapic_ids_from_mpc(void)
         {
             printk(KERN_ERR "BIOS bug, IO-APIC#%d ID %d is already used!...\n",
                    apic, mp_ioapics[apic].mpc_apicid);
-            for (i = 0; i < get_physical_broadcast(); i++)
+            for (i = 0; i < broadcast_id; i++)
                 if (!physid_isset(i, phys_id_present_map))
                     break;
-            if (i >= get_physical_broadcast())
+            if (i >= broadcast_id)
                 panic("Max APIC ID exceeded\n");
             printk(KERN_ERR "... fixing up to %d. (tell your hw vendor)\n",
                    i);
@@ -2223,6 +2222,7 @@ int __init io_apic_get_unique_id (int ioapic, int apic_id)
     static physid_mask_t __initdata apic_id_map = PHYSID_MASK_NONE;
     unsigned long flags;
     int i = 0;
+    const uint32_t broadcast_id = 0xf;
 
     /*
      * The P4 platform supports up to 256 APIC IDs on two separate APIC 
@@ -2240,7 +2240,7 @@ int __init io_apic_get_unique_id (int ioapic, int apic_id)
     reg_00.raw = io_apic_read(ioapic, 0);
     spin_unlock_irqrestore(&ioapic_lock, flags);
 
-    if (apic_id >= get_physical_broadcast()) {
+    if (apic_id >= broadcast_id) {
         printk(KERN_WARNING "IOAPIC[%d]: Invalid apic_id %d, trying "
                "%d\n", ioapic, apic_id, reg_00.bits.ID);
         apic_id = reg_00.bits.ID;
@@ -2253,12 +2253,12 @@ int __init io_apic_get_unique_id (int ioapic, int apic_id)
     if ( physid_isset(apic_id, apic_id_map) )
     {
 
-        for (i = 0; i < get_physical_broadcast(); i++) {
+        for (i = 0; i < broadcast_id; i++) {
             if ( !physid_isset(i, apic_id_map) )
                 break;
         }
 
-        if (i == get_physical_broadcast())
+        if (i == broadcast_id)
             panic("Max apic_id exceeded\n");
 
         printk(KERN_WARNING "IOAPIC[%d]: apic_id %d already used, "
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Sep 01 20:00:33 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 01 Sep 2025 20:00:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1105362.1456270 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1utAhd-0006I5-GY; Mon, 01 Sep 2025 20:00:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1105362.1456270; Mon, 01 Sep 2025 20: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 1utAhd-0006Hx-E0; Mon, 01 Sep 2025 20:00:33 +0000
Received: by outflank-mailman (input) for mailman id 1105362;
 Mon, 01 Sep 2025 20: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 1utAhc-0006Hn-Jv
 for xen-changelog@lists.xenproject.org; Mon, 01 Sep 2025 20: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 1utAhc-001JjS-1A
 for xen-changelog@lists.xenproject.org;
 Mon, 01 Sep 2025 20:00:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1utAhc-00CIdg-1h
 for xen-changelog@lists.xenproject.org;
 Mon, 01 Sep 2025 20: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=P747VjtQMk5oqNuvOv2heaEvXFQFEqqkzYLM+417/tQ=; b=BuOCQz2dZdOeyMzl8GJuunaJVc
	nNiQZnCaCLU8TcdsihCbwpo0XPDQJcKOYwpmG+RSfUtiUpEFmRuQjxG9s0V9wZkp7nzPguT6ithXf
	uE6+PB3+UN9RTgVjOvwDgNNWfncW4QHxX1WzYITt257QQGBzwxw1PRw6BWPZrhTWOcfs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/apic: Drop sync_Arb_IDs()
Message-Id: <E1utAhc-00CIdg-1h@xenbits.xenproject.org>
Date: Mon, 01 Sep 2025 20:00:32 +0000

commit b89f8f054f9611804a920af4046fa1e97f9e3029
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Aug 29 17:02:47 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Sep 1 19:54:21 2025 +0100

    x86/apic: Drop sync_Arb_IDs()
    
    It is not obvious at first glance, but this is dead logic.
    
    On Intel, xAPIC (which is what modern_apic() is really checking for) predates
    64bit support, while the Family 0xf check on AMD is the K8 processor.
    
    Simply drop the logic, rather than trying to adjust vendor/family logic.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/apic.c             | 32 --------------------------------
 xen/arch/x86/include/asm/apic.h |  1 -
 xen/arch/x86/io_apic.c          |  2 +-
 3 files changed, 1 insertion(+), 34 deletions(-)

diff --git a/xen/arch/x86/apic.c b/xen/arch/x86/apic.c
index 70636b0bb5..7747718600 100644
--- a/xen/arch/x86/apic.c
+++ b/xen/arch/x86/apic.c
@@ -91,23 +91,6 @@ static enum apic_mode apic_boot_mode = APIC_MODE_INVALID;
 bool __read_mostly x2apic_enabled;
 bool __read_mostly directed_eoi_enabled;
 
-static int modern_apic(void)
-{
-    unsigned int lvr, version;
-    /* AMD systems use old APIC versions, so check the CPU */
-    if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD &&
-        boot_cpu_data.x86 >= 0xf)
-        return 1;
-
-    /* Hygon systems use modern APIC */
-    if (boot_cpu_data.x86_vendor == X86_VENDOR_HYGON)
-        return 1;
-
-    lvr = apic_read(APIC_LVR);
-    version = GET_APIC_VERSION(lvr);
-    return version >= 0x14;
-}
-
 /*
  * 'what should we do if we get a hw irq event on an illegal vector'.
  * each architecture has to answer this themselves.
@@ -396,21 +379,6 @@ int __init verify_local_APIC(void)
     return 1;
 }
 
-void __init sync_Arb_IDs(void)
-{
-    /* Unsupported on P4 - see Intel Dev. Manual Vol. 3, Ch. 8.6.1
-       And not needed on AMD */
-    if (modern_apic())
-        return;
-    /*
-     * Wait for idle.
-     */
-    apic_wait_icr_idle();
-
-    apic_printk(APIC_DEBUG, "Synchronizing Arb IDs.\n");
-    apic_write(APIC_ICR, APIC_DEST_ALLINC | APIC_INT_LEVELTRIG | APIC_DM_INIT);
-}
-
 /*
  * An initial setup of the virtual wire mode.
  */
diff --git a/xen/arch/x86/include/asm/apic.h b/xen/arch/x86/include/asm/apic.h
index d228549536..918f1cee35 100644
--- a/xen/arch/x86/include/asm/apic.h
+++ b/xen/arch/x86/include/asm/apic.h
@@ -166,7 +166,6 @@ extern void disconnect_bsp_APIC (int virt_wire_setup);
 extern void disable_local_APIC (void);
 extern int verify_local_APIC (void);
 extern void cache_APIC_registers (void);
-extern void sync_Arb_IDs (void);
 extern void init_bsp_APIC (void);
 extern void setup_local_APIC(bool bsp);
 extern void init_apic_mappings (void);
diff --git a/xen/arch/x86/io_apic.c b/xen/arch/x86/io_apic.c
index 42a9b653d3..17e6827f4b 100644
--- a/xen/arch/x86/io_apic.c
+++ b/xen/arch/x86/io_apic.c
@@ -2163,7 +2163,7 @@ void __init setup_IO_APIC(void)
      */
     if (!acpi_ioapic)
         setup_ioapic_ids_from_mpc();
-    sync_Arb_IDs();
+
     setup_IO_APIC_irqs();
     init_IO_APIC_traps();
     check_timer();
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Sep 01 20:00:43 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 01 Sep 2025 20:00:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1105363.1456274 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1utAhn-0006Kr-I0; Mon, 01 Sep 2025 20:00:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1105363.1456274; Mon, 01 Sep 2025 20: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 1utAhn-0006Kl-FO; Mon, 01 Sep 2025 20:00:43 +0000
Received: by outflank-mailman (input) for mailman id 1105363;
 Mon, 01 Sep 2025 20: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 1utAhm-0006Kf-Mr
 for xen-changelog@lists.xenproject.org; Mon, 01 Sep 2025 20: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 1utAhm-001JjY-1U
 for xen-changelog@lists.xenproject.org;
 Mon, 01 Sep 2025 20:00:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1utAhm-00CIg4-20
 for xen-changelog@lists.xenproject.org;
 Mon, 01 Sep 2025 20: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=Fc2J0qTsGTKikpS/o39jRHq70INozXEOA2UeaP8W884=; b=gbgjXzLlgFo5GWmlvm8S0Mn37Q
	i7eEGvrqzABII44cHm0mtDf81YE4sJNxVgcjbR3ZkVFbK5gYYO1wgnVVFeneqlGAtpSCSPlp3wlsn
	CTW2Co8tOj4kuRT81fnDQpMpdOLxvNftCAHVVRX/XZHSNx1HGj6NEk+UUIABqZCTWIg8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/bitops: Optimise arch_ffs{,l}() some more on AMD
Message-Id: <E1utAhm-00CIg4-20@xenbits.xenproject.org>
Date: Mon, 01 Sep 2025 20:00:42 +0000

commit 437f07b2b52b32929c74c2e19a52437ce7e5b88f
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Apr 30 14:35:39 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Sep 1 19:54:21 2025 +0100

    x86/bitops: Optimise arch_ffs{,l}() some more on AMD
    
    One aspect of the old ffs() infrastructure was the use of TZCNT without a
    CPUID check.  Given no obvious justification, I dropped it during the cleanup.
    
    It turns out there is a good reason, on all but the most recent AMD CPUs.
    
    Reinstate the use of "blind" TZCNT when safe to do so.  This happens to be
    preferentially in loops where a repeated saving of 5-6 uops becomes far more
    relevant than a one-off scenario.  Leave an explanation of why.
    
    It is not safe to perform this transformation for BSR and LZCNT, because they
    count from opposite ends of the input operand.  Furthermore, this incorrect
    transform was not caught by the selftests.
    
    Extend the selftests with test_for_each_set_bit_reverse() as that exercises
    the "x known non-zero" optimsiation path in x86's helpers.  Adjust the
    existing test_for_each_set_bit() to intentionally use an asymmetric input bit
    pattern, otherwise "counting from the wrong end" bugs continue to slip by.
    
    No functional change.
    
    Fixes: 989e5f08d33e ("x86/bitops: Improve arch_ffs() in the general case")
    Fixes: 5ed26fc0768d ("xen/bitops: Implement ffsl() in common logic")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/include/asm/bitops.h | 13 +++++--
 xen/common/bitops.c               | 78 ++++++++++++++++++++++++++++++++++++++-
 2 files changed, 86 insertions(+), 5 deletions(-)

diff --git a/xen/arch/x86/include/asm/bitops.h b/xen/arch/x86/include/asm/bitops.h
index 87eac7782f..b17d67e8ca 100644
--- a/xen/arch/x86/include/asm/bitops.h
+++ b/xen/arch/x86/include/asm/bitops.h
@@ -399,9 +399,16 @@ static always_inline unsigned int arch_ffs(unsigned int x)
          *
          * and the optimiser really can work with the knowledge of x being
          * non-zero without knowing it's exact value, in which case we don't
-         * need to compensate for BSF's corner cases.  Otherwise...
+         * need to compensate for BSF's corner cases.
+         *
+         * That said, we intentionally use TZCNT on capable hardware when the
+         * behaviour for the 0 case doesn't matter.  On AMD CPUs prior to
+         * Zen4, TZCNT is 1-2 uops while BSF is 6-8 with a latency to match.
+         * Intel CPUs don't suffer this discrepancy.
+         *
+         * Otherwise...
          */
-        asm ( "bsf %[val], %[res]"
+        asm ( "tzcnt %[val], %[res]"
               : [res] "=r" (r)
               : [val] "rm" (x) );
     }
@@ -428,7 +435,7 @@ static always_inline unsigned int arch_ffsl(unsigned long x)
 
     /* See arch_ffs() for safety discussions. */
     if ( __builtin_constant_p(x > 0) && x > 0 )
-        asm ( "bsf %[val], %q[res]"
+        asm ( "tzcnt %[val], %q[res]"
               : [res] "=r" (r)
               : [val] "rm" (x) );
     else
diff --git a/xen/common/bitops.c b/xen/common/bitops.c
index bd17ddef57..14e6265037 100644
--- a/xen/common/bitops.c
+++ b/xen/common/bitops.c
@@ -97,14 +97,14 @@ static void __init test_for_each_set_bit(void)
     if ( ui != ui_res )
         panic("for_each_set_bit(uint) expected %#x, got %#x\n", ui, ui_res);
 
-    ul = HIDE(1UL << (BITS_PER_LONG - 1) | 1);
+    ul = HIDE(1UL << (BITS_PER_LONG - 1) | 0x11);
     for_each_set_bit ( i, ul )
         ul_res |= 1UL << i;
 
     if ( ul != ul_res )
         panic("for_each_set_bit(ulong) expected %#lx, got %#lx\n", ul, ul_res);
 
-    ull = HIDE(0x8000000180000001ULL);
+    ull = HIDE(0x8000000180000011ULL);
     for_each_set_bit ( i, ull )
         ull_res |= 1ULL << i;
 
@@ -127,6 +127,79 @@ static void __init test_for_each_set_bit(void)
         panic("for_each_set_bit(break) expected 0x1008, got %#x\n", ui_res);
 }
 
+/*
+ * A type-generic fls() which picks the appropriate fls{,l,64}() based on it's
+ * argument.
+ */
+#define fls_g(x)                                        \
+    (sizeof(x) <= sizeof(int)      ? fls(x) :           \
+     sizeof(x) <= sizeof(long)     ? flsl(x) :          \
+     sizeof(x) <= sizeof(uint64_t) ? fls64(x) :         \
+     ({ BUILD_ERROR("fls_g() Bad input type"); 0; }))
+
+/*
+ * for_each_set_bit_reverse() - Iterate over all set bits in a scalar value,
+ * from MSB to LSB.
+ *
+ * @iter An iterator name.  Scoped is within the loop only.
+ * @val  A scalar value to iterate over.
+ *
+ * A copy of @val is taken internally.
+ */
+#define for_each_set_bit_reverse(iter, val)             \
+    for ( typeof(val) __v = (val); __v; __v = 0 )       \
+        for ( unsigned int (iter);                      \
+              __v && ((iter) = fls_g(__v) - 1, true);   \
+              __clear_bit(iter, &__v) )
+
+/*
+ * Xen doesn't have need of for_each_set_bit_reverse() at present, but the
+ * construct does exercise a case of arch_fls*() not covered anywhere else by
+ * these tests.
+ */
+static void __init test_for_each_set_bit_reverse(void)
+{
+    unsigned int  ui,  ui_res = 0, tmp;
+    unsigned long ul,  ul_res = 0;
+    uint64_t      ull, ull_res = 0;
+
+    ui = HIDE(0x80008001U);
+    for_each_set_bit_reverse ( i, ui )
+        ui_res |= 1U << i;
+
+    if ( ui != ui_res )
+        panic("for_each_set_bit_reverse(uint) expected %#x, got %#x\n", ui, ui_res);
+
+    ul = HIDE(1UL << (BITS_PER_LONG - 1) | 0x11);
+    for_each_set_bit_reverse ( i, ul )
+        ul_res |= 1UL << i;
+
+    if ( ul != ul_res )
+        panic("for_each_set_bit_reverse(ulong) expected %#lx, got %#lx\n", ul, ul_res);
+
+    ull = HIDE(0x8000000180000011ULL);
+    for_each_set_bit_reverse ( i, ull )
+        ull_res |= 1ULL << i;
+
+    if ( ull != ull_res )
+        panic("for_each_set_bit_reverse(uint64) expected %#"PRIx64", got %#"PRIx64"\n", ull, ull_res);
+
+    /* Check that we can break from the middle of the loop. */
+    ui = HIDE(0x80001008U);
+    tmp = 0;
+    ui_res = 0;
+    for_each_set_bit_reverse ( i, ui )
+    {
+        if ( tmp++ > 1 )
+            break;
+
+        ui_res |= 1U << i;
+    }
+
+    if ( ui_res != 0x80001000U )
+        panic("for_each_set_bit_reverse(break) expected 0x80001000, got %#x\n", ui_res);
+}
+
 static void __init test_multiple_bits_set(void)
 {
     /*
@@ -169,6 +242,7 @@ static void __init __constructor test_bitops(void)
     test_ffs();
     test_fls();
     test_for_each_set_bit();
+    test_for_each_set_bit_reverse();
 
     test_multiple_bits_set();
     test_hweight();
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Sep 01 20:55:05 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 01 Sep 2025 20:55:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1105367.1456278 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1utBYN-0003Of-AZ; Mon, 01 Sep 2025 20:55:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1105367.1456278; Mon, 01 Sep 2025 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 1utBYN-0003OX-82; Mon, 01 Sep 2025 20:55:03 +0000
Received: by outflank-mailman (input) for mailman id 1105367;
 Mon, 01 Sep 2025 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 1utBYM-0003OR-BS
 for xen-changelog@lists.xenproject.org; Mon, 01 Sep 2025 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 1utBYM-001KtY-03
 for xen-changelog@lists.xenproject.org;
 Mon, 01 Sep 2025 20:55:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1utBYM-00CLUT-0Y
 for xen-changelog@lists.xenproject.org;
 Mon, 01 Sep 2025 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=l8zh9AxEHiZbKWz/2IkQBfvl0vxjI+Wqy1HgX9srVAg=; b=Cl6Ccg3HbyFR3oJdnhO+oewfaX
	Sm3EreUwtM05rs6UO2iI5jvXGA63M+nuUDAx0H7GBcaYmamMSiyAYMtEt518dVAXPafjfQ3BQ6hkv
	DjwMaT0pz82UYp+2TRHFTOaLye4XA3qZMA1/aYNywtw/D93T3uZsQ94qW1v/PnTZ63R4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/traps: Set MSR_PL0_SSP in load_system_tables()
Message-Id: <E1utBYM-00CLUT-0Y@xenbits.xenproject.org>
Date: Mon, 01 Sep 2025 20:55:02 +0000

commit 667f90711b058cc9306232ab4d2215f41719cb0b
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon May 26 18:48:26 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Sep 1 19:54:21 2025 +0100

    x86/traps: Set MSR_PL0_SSP in load_system_tables()
    
    FRED and IDT differ by a Supervisor Token on the base of the shstk.  This
    means that the value they load into MSR_PL0_SSP differs by 8.
    
    s3_resume() in particular has logic which is otherwise invariant of FRED mode,
    and must not clobber a FRED MSR_PL0_SSP with an IDT one.
    
    This also simplifies the AP path too.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/acpi/wakeup_prot.S |  9 ---------
 xen/arch/x86/boot/x86_64.S      | 12 +++---------
 xen/arch/x86/setup.c            |  2 --
 xen/arch/x86/traps-setup.c      |  2 ++
 4 files changed, 5 insertions(+), 20 deletions(-)

diff --git a/xen/arch/x86/acpi/wakeup_prot.S b/xen/arch/x86/acpi/wakeup_prot.S
index fceb4ca353..ba0bd77806 100644
--- a/xen/arch/x86/acpi/wakeup_prot.S
+++ b/xen/arch/x86/acpi/wakeup_prot.S
@@ -104,15 +104,6 @@ LABEL(s3_resume)
          */
         mov     saved_ssp(%rip), %rdi
 
-        /* Calculate MSR_PL0_SSP from SSP. */
-        mov     $MSR_PL0_SSP, %ecx
-        mov     %rdi, %rdx
-        shr     $32, %rdx
-        mov     %edi, %eax
-        and     $~(STACK_SIZE - 1), %eax
-        or      $(PRIMARY_SHSTK_SLOT + 1) * PAGE_SIZE - 8, %eax
-        wrmsr
-
         /*
          * A Restore Token's value is &token + 8 + 64BIT (bit 0).
          * We want to put this on the shstk at SSP - 8.
diff --git a/xen/arch/x86/boot/x86_64.S b/xen/arch/x86/boot/x86_64.S
index 3a5ad27644..11a7e9d3bd 100644
--- a/xen/arch/x86/boot/x86_64.S
+++ b/xen/arch/x86/boot/x86_64.S
@@ -65,17 +65,11 @@ ENTRY(__high_start)
         or      $(PRIMARY_SHSTK_SLOT + 1) * PAGE_SIZE - 8, %rdx
 
         /*
-         * Write a new supervisor token.  Doesn't matter on boot, but for S3
-         * resume this clears the busy bit.
+         * 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
+         * SETSSBSY can set it again.
          */
         wrssq   %rdx, (%rdx)
-
-        /* Point MSR_PL0_SSP at the token. */
-        mov     $MSR_PL0_SSP, %ecx
-        mov     %edx, %eax
-        shr     $32, %rdx
-        wrmsr
-
         setssbsy
 
 #endif /* CONFIG_XEN_SHSTK */
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 6c81841426..a810bdf6d3 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -907,8 +907,6 @@ static void __init noreturn reinit_bsp_stack(void)
 
     if ( cpu_has_xen_shstk )
     {
-        wrmsrl(MSR_PL0_SSP,
-               (unsigned long)stack + (PRIMARY_SHSTK_SLOT + 1) * PAGE_SIZE - 8);
         wrmsrl(MSR_S_CET, xen_msr_s_cet_value());
         asm volatile ("setssbsy" ::: "memory");
     }
diff --git a/xen/arch/x86/traps-setup.c b/xen/arch/x86/traps-setup.c
index 6e2af58ba0..d77be8f839 100644
--- a/xen/arch/x86/traps-setup.c
+++ b/xen/arch/x86/traps-setup.c
@@ -92,6 +92,7 @@ static void load_system_tables(void)
     {
         volatile uint64_t *ist_ssp = tss_page->ist_ssp;
         unsigned long
+            ssp = stack_top + (PRIMARY_SHSTK_SLOT + 1) * PAGE_SIZE - 8,
             mce_ssp = stack_top + (IST_MCE * IST_SHSTK_SIZE) - 8,
             nmi_ssp = stack_top + (IST_NMI * IST_SHSTK_SIZE) - 8,
             db_ssp  = stack_top + (IST_DB  * IST_SHSTK_SIZE) - 8,
@@ -118,6 +119,7 @@ static void load_system_tables(void)
         }
 
         wrmsrns(MSR_ISST, (unsigned long)ist_ssp);
+        wrmsrns(MSR_PL0_SSP, (unsigned long)ssp);
     }
 
     _set_tssldt_desc(gdt + TSS_ENTRY, (unsigned long)tss,
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Sep 01 20:55:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 01 Sep 2025 20:55:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1105368.1456284 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1utBYX-0003QM-CP; Mon, 01 Sep 2025 20:55:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1105368.1456284; Mon, 01 Sep 2025 20: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 1utBYX-0003QE-9T; Mon, 01 Sep 2025 20:55:13 +0000
Received: by outflank-mailman (input) for mailman id 1105368;
 Mon, 01 Sep 2025 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 1utBYW-0003Q8-Bd
 for xen-changelog@lists.xenproject.org; Mon, 01 Sep 2025 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 1utBYW-001Ktf-0K
 for xen-changelog@lists.xenproject.org;
 Mon, 01 Sep 2025 20:55:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1utBYW-00CLUp-0u
 for xen-changelog@lists.xenproject.org;
 Mon, 01 Sep 2025 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=HeDgjC6C24ubrRgBC7Ltr3D01Ui9rCJ11zqB+FHIuIE=; b=M7OLOcnj2LrYALUHacnykzkNe5
	sH3Z8TlA/C36egqcY9LWOCStMW9/d4KYSJifKi9ni0okJgcrA3cT+/HH6gVvKd/njH4CMHBf5lwaV
	UFcUpruTdjsZyJSZMM0DF5ZrHRAO+vfa9k5LEhMX05aNYczBf97g4uWjsDTbCREuUcZU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/gen-cpuid: Fix debugging for cycle detection
Message-Id: <E1utBYW-00CLUp-0u@xenbits.xenproject.org>
Date: Mon, 01 Sep 2025 20:55:12 +0000

commit 5edb4ccff6a13ea10d1c1888942dff0c868c7844
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Aug 29 20:06:46 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Sep 1 19:54:21 2025 +0100

    x86/gen-cpuid: Fix debugging for cycle detection
    
    Jan reports the following exception when using the cycle debugging:
    
      Feature IBRSB, seen [IBRSB, STIBP, INTEL_PSFD, EIBRS, IPRED_CTRL, RRSBA_CTRL, RRSBA, BHI_CTRL], to_process [SSBD]
      Traceback (most recent call last):
        File "/local/xen.git/xen/../xen/tools/gen-cpuid.py", line 594, in <module>
          sys.exit(main())
                   ^^^^^^
        File "/local/xen.git/xen/../xen/tools/gen-cpuid.py", line 588, in main
          crunch_numbers(state)
        File "/local/xen.git/xen/../xen/tools/gen-cpuid.py", line 366, in crunch_numbers
          (state.names[feat], repl(seen), repl(to_process)))
                                          ^^^^^^^^^^^^^^^^
        File "/local/xen.git/xen/../xen/tools/gen-cpuid.py", line 364, in repl
          return "[" + ", ".join((state.names[x] for x in l)) + "]"
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/local/xen.git/xen/../xen/tools/gen-cpuid.py", line 364, in <genexpr>
          return "[" + ", ".join((state.names[x] for x in l)) + "]"
                                  ~~~~~~~~~~~^^^
      KeyError: 534
      make[2]: *** [/local/xen.git/xen/include/xen/lib/x86/Makefile:9: cpuid-autogen.h] Error 1
    
    This is caused by commit ce8c930851a5 ("x86/cpu-policy: MSR_ARCH_CAPS feature
    names") being rather lazy and marking dependenices on unknown features.
    
    Introduce a helper to pick the known features in a range, and use it for
    ARCH_CAPS.
    
    Additionally, remove trailing whitespace and an unnecessary line continuation
    from the debug print.
    
    Reported-by: Jan Beulich <jbeulich@suse.com>
    Fixes: ce8c930851a5 ("x86/cpu-policy: MSR_ARCH_CAPS feature names")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/tools/gen-cpuid.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/xen/tools/gen-cpuid.py b/xen/tools/gen-cpuid.py
index 875198f4e6..13d85a4348 100755
--- a/xen/tools/gen-cpuid.py
+++ b/xen/tools/gen-cpuid.py
@@ -168,6 +168,10 @@ def crunch_numbers(state):
     state.hvm_shadow_max = state.pv_max         | state.raw['S'] | state.raw['s']
     state.hvm_hap_max =    state.hvm_shadow_max | state.raw['H'] | state.raw['h']
 
+    def feat_range(start, last):
+        """ Select all known features in the given range """
+        return [ x for x in state.names.keys() if start <= x <= last ]
+
     #
     # Feature dependency information.
     #
@@ -338,7 +342,7 @@ def crunch_numbers(state):
         PSFD: [EPSF],
 
         # The ARCH_CAPS CPUID bit enumerates the availability of the whole register.
-        ARCH_CAPS: list(range(RDCL_NO, RDCL_NO + 64)),
+        ARCH_CAPS: feat_range(RDCL_NO, RDCL_NO + 63),
 
         # The behaviour described by RRSBA depend on eIBRS being active.
         EIBRS: [RRSBA],
@@ -362,7 +366,7 @@ def crunch_numbers(state):
             # To debug, uncomment the following lines:
             # def repl(l):
             #     return "[" + ", ".join((state.names[x] for x in l)) + "]"
-            # sys.stderr.write("Feature %s, seen %s, to_process %s \n" % \
+            # sys.stderr.write("Feature %s, seen %s, to_process %s\n" %
             #     (state.names[feat], repl(seen), repl(to_process)))
 
             f = to_process.pop(0)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Sep 01 20:55:23 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 01 Sep 2025 20:55:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1105369.1456287 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1utBYh-0003Ss-Dc; Mon, 01 Sep 2025 20:55:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1105369.1456287; Mon, 01 Sep 2025 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 1utBYh-0003Sj-Ap; Mon, 01 Sep 2025 20:55:23 +0000
Received: by outflank-mailman (input) for mailman id 1105369;
 Mon, 01 Sep 2025 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 1utBYg-0003SU-Ef
 for xen-changelog@lists.xenproject.org; Mon, 01 Sep 2025 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 1utBYg-001Ktn-0e
 for xen-changelog@lists.xenproject.org;
 Mon, 01 Sep 2025 20:55:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1utBYg-00CLVD-1C
 for xen-changelog@lists.xenproject.org;
 Mon, 01 Sep 2025 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=KYkOha1HbFLmAozXi5eC6fIcs5pHcTjTMz3Gsau2z5k=; b=PwfqpbW6kOak4OzTNrq0/vsXjf
	XrLWfHJCiW3Kci8x7b2PtKfMPeGmAvMe3jLFqcureuydfwkK7obTbosi7aM3puiuaSrbCz3OI98Gv
	PdNl9VFXC54JkA+cPtpxXDS45HYQtgr17TEVM6lsNOjCFAkkDAoQIFthkSHKdN9LeUC0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/apic: Get rid of get_physical_broadcast()
Message-Id: <E1utBYg-00CLVD-1C@xenbits.xenproject.org>
Date: Mon, 01 Sep 2025 20:55:22 +0000

commit 944fdddbfd38e9d6379c129327a84662233e6e68
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Aug 28 20:20:35 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Sep 1 19:54:21 2025 +0100

    x86/apic: Get rid of get_physical_broadcast()
    
    This is a port of Linux commit 517234446c1a ("x86/apic: Get rid of
    get_physical_broadcast()") to Xen.  Thomas Gleixner notes:
    
      There is no point for this function. The only case where this is used is
      when there is no XAPIC available, which means the broadcast address is 0xF.
    
    In Linux, users of get_physical_broadcast() have already been hidden behind
    CONFIG_X86_32 suggesting we can drop all of this, but that's a task for some
    other time.
    
    In Xen as with Linux, setup_ioapic_ids_from_mpc() and io_apic_get_unique_id()
    only apply to pre-xAPIC cases, so can use a broadcast ID of 0xf.  The only
    other user is __print_IO_APIC() for diagnostics, which can simply drop the
    check.
    
    No functional change.
    
    Link: https://lore.kernel.org/r/20240212154639.057209154@linutronix.de
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/apic.c             |  8 --------
 xen/arch/x86/include/asm/apic.h |  2 --
 xen/arch/x86/io_apic.c          | 16 ++++++++--------
 3 files changed, 8 insertions(+), 18 deletions(-)

diff --git a/xen/arch/x86/apic.c b/xen/arch/x86/apic.c
index e3a2b84f1a..70636b0bb5 100644
--- a/xen/arch/x86/apic.c
+++ b/xen/arch/x86/apic.c
@@ -133,14 +133,6 @@ static bool __read_mostly using_apic_timer;
 
 static bool __read_mostly enabled_via_apicbase;
 
-int get_physical_broadcast(void)
-{
-    if (modern_apic())
-        return 0xff;
-    else
-        return 0xf;
-}
-
 int get_maxlvt(void)
 {
     unsigned int v = apic_read(APIC_LVR);
diff --git a/xen/arch/x86/include/asm/apic.h b/xen/arch/x86/include/asm/apic.h
index d8eda6df6d..d228549536 100644
--- a/xen/arch/x86/include/asm/apic.h
+++ b/xen/arch/x86/include/asm/apic.h
@@ -153,8 +153,6 @@ static inline u32 get_apic_id(void)
 
 void apic_wait_icr_idle(void);
 
-int get_physical_broadcast(void);
-
 static inline void ack_APIC_irq(void)
 {
 	/* Docs say use 0 for future compatibility */
diff --git a/xen/arch/x86/io_apic.c b/xen/arch/x86/io_apic.c
index 1816e1c0b9..42a9b653d3 100644
--- a/xen/arch/x86/io_apic.c
+++ b/xen/arch/x86/io_apic.c
@@ -1217,8 +1217,6 @@ static void /*__init*/ __print_IO_APIC(bool boot)
 	printk(KERN_DEBUG ".......    : physical APIC id: %02X\n", reg_00.bits.ID);
 	printk(KERN_DEBUG ".......    : Delivery Type: %X\n", reg_00.bits.delivery_type);
 	printk(KERN_DEBUG ".......    : LTS          : %X\n", reg_00.bits.LTS);
-	if (reg_00.bits.ID >= get_physical_broadcast())
-            UNEXPECTED_IO_APIC();
 	if (reg_00.bits.__reserved_1 || reg_00.bits.__reserved_2)
             UNEXPECTED_IO_APIC();
 
@@ -1475,6 +1473,7 @@ static void __init setup_ioapic_ids_from_mpc(void)
     int i;
     unsigned char old_id;
     unsigned long flags;
+    const uint32_t broadcast_id = 0xf;
 
     /*
      * Don't check I/O APIC IDs for xAPIC systems. They have
@@ -1504,7 +1503,7 @@ static void __init setup_ioapic_ids_from_mpc(void)
 		
         old_id = mp_ioapics[apic].mpc_apicid;
 
-        if (mp_ioapics[apic].mpc_apicid >= get_physical_broadcast()) {
+        if (mp_ioapics[apic].mpc_apicid >= broadcast_id) {
             printk(KERN_ERR "BIOS bug, IO-APIC#%d ID is %d in the MPC table!...\n",
                    apic, mp_ioapics[apic].mpc_apicid);
             printk(KERN_ERR "... fixing up to %d. (tell your hw vendor)\n",
@@ -1521,10 +1520,10 @@ static void __init setup_ioapic_ids_from_mpc(void)
         {
             printk(KERN_ERR "BIOS bug, IO-APIC#%d ID %d is already used!...\n",
                    apic, mp_ioapics[apic].mpc_apicid);
-            for (i = 0; i < get_physical_broadcast(); i++)
+            for (i = 0; i < broadcast_id; i++)
                 if (!physid_isset(i, phys_id_present_map))
                     break;
-            if (i >= get_physical_broadcast())
+            if (i >= broadcast_id)
                 panic("Max APIC ID exceeded\n");
             printk(KERN_ERR "... fixing up to %d. (tell your hw vendor)\n",
                    i);
@@ -2223,6 +2222,7 @@ int __init io_apic_get_unique_id (int ioapic, int apic_id)
     static physid_mask_t __initdata apic_id_map = PHYSID_MASK_NONE;
     unsigned long flags;
     int i = 0;
+    const uint32_t broadcast_id = 0xf;
 
     /*
      * The P4 platform supports up to 256 APIC IDs on two separate APIC 
@@ -2240,7 +2240,7 @@ int __init io_apic_get_unique_id (int ioapic, int apic_id)
     reg_00.raw = io_apic_read(ioapic, 0);
     spin_unlock_irqrestore(&ioapic_lock, flags);
 
-    if (apic_id >= get_physical_broadcast()) {
+    if (apic_id >= broadcast_id) {
         printk(KERN_WARNING "IOAPIC[%d]: Invalid apic_id %d, trying "
                "%d\n", ioapic, apic_id, reg_00.bits.ID);
         apic_id = reg_00.bits.ID;
@@ -2253,12 +2253,12 @@ int __init io_apic_get_unique_id (int ioapic, int apic_id)
     if ( physid_isset(apic_id, apic_id_map) )
     {
 
-        for (i = 0; i < get_physical_broadcast(); i++) {
+        for (i = 0; i < broadcast_id; i++) {
             if ( !physid_isset(i, apic_id_map) )
                 break;
         }
 
-        if (i == get_physical_broadcast())
+        if (i == broadcast_id)
             panic("Max apic_id exceeded\n");
 
         printk(KERN_WARNING "IOAPIC[%d]: apic_id %d already used, "
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Sep 01 20:55:33 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 01 Sep 2025 20:55:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1105370.1456291 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1utBYr-0003VJ-Eo; Mon, 01 Sep 2025 20:55:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1105370.1456291; Mon, 01 Sep 2025 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 1utBYr-0003VB-CE; Mon, 01 Sep 2025 20:55:33 +0000
Received: by outflank-mailman (input) for mailman id 1105370;
 Mon, 01 Sep 2025 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 1utBYq-0003Ux-I4
 for xen-changelog@lists.xenproject.org; Mon, 01 Sep 2025 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 1utBYq-001KuC-0z
 for xen-changelog@lists.xenproject.org;
 Mon, 01 Sep 2025 20:55:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1utBYq-00CLVZ-1W
 for xen-changelog@lists.xenproject.org;
 Mon, 01 Sep 2025 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=PdAQNHEruwPL4y3bYACzgbuV8cFZPNPsBLh9hwnqm8s=; b=xvB+lvA5AL56uVpHt+hI5ByQup
	j3+xifcDdfa6f2hqyI5ZcRtv7QZTDrdryusnATb/TkRWwzzQt+QmOBwyuCkyzxfrQM95VDr3itdrh
	ZQ2djeZ2caFkOLPFUEz5KIPZMra55QV2qbfqR6m6QDSA7RSpxZxa+O8OjcIx2RUYo9QQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/apic: Drop sync_Arb_IDs()
Message-Id: <E1utBYq-00CLVZ-1W@xenbits.xenproject.org>
Date: Mon, 01 Sep 2025 20:55:32 +0000

commit b89f8f054f9611804a920af4046fa1e97f9e3029
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Aug 29 17:02:47 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Sep 1 19:54:21 2025 +0100

    x86/apic: Drop sync_Arb_IDs()
    
    It is not obvious at first glance, but this is dead logic.
    
    On Intel, xAPIC (which is what modern_apic() is really checking for) predates
    64bit support, while the Family 0xf check on AMD is the K8 processor.
    
    Simply drop the logic, rather than trying to adjust vendor/family logic.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/apic.c             | 32 --------------------------------
 xen/arch/x86/include/asm/apic.h |  1 -
 xen/arch/x86/io_apic.c          |  2 +-
 3 files changed, 1 insertion(+), 34 deletions(-)

diff --git a/xen/arch/x86/apic.c b/xen/arch/x86/apic.c
index 70636b0bb5..7747718600 100644
--- a/xen/arch/x86/apic.c
+++ b/xen/arch/x86/apic.c
@@ -91,23 +91,6 @@ static enum apic_mode apic_boot_mode = APIC_MODE_INVALID;
 bool __read_mostly x2apic_enabled;
 bool __read_mostly directed_eoi_enabled;
 
-static int modern_apic(void)
-{
-    unsigned int lvr, version;
-    /* AMD systems use old APIC versions, so check the CPU */
-    if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD &&
-        boot_cpu_data.x86 >= 0xf)
-        return 1;
-
-    /* Hygon systems use modern APIC */
-    if (boot_cpu_data.x86_vendor == X86_VENDOR_HYGON)
-        return 1;
-
-    lvr = apic_read(APIC_LVR);
-    version = GET_APIC_VERSION(lvr);
-    return version >= 0x14;
-}
-
 /*
  * 'what should we do if we get a hw irq event on an illegal vector'.
  * each architecture has to answer this themselves.
@@ -396,21 +379,6 @@ int __init verify_local_APIC(void)
     return 1;
 }
 
-void __init sync_Arb_IDs(void)
-{
-    /* Unsupported on P4 - see Intel Dev. Manual Vol. 3, Ch. 8.6.1
-       And not needed on AMD */
-    if (modern_apic())
-        return;
-    /*
-     * Wait for idle.
-     */
-    apic_wait_icr_idle();
-
-    apic_printk(APIC_DEBUG, "Synchronizing Arb IDs.\n");
-    apic_write(APIC_ICR, APIC_DEST_ALLINC | APIC_INT_LEVELTRIG | APIC_DM_INIT);
-}
-
 /*
  * An initial setup of the virtual wire mode.
  */
diff --git a/xen/arch/x86/include/asm/apic.h b/xen/arch/x86/include/asm/apic.h
index d228549536..918f1cee35 100644
--- a/xen/arch/x86/include/asm/apic.h
+++ b/xen/arch/x86/include/asm/apic.h
@@ -166,7 +166,6 @@ extern void disconnect_bsp_APIC (int virt_wire_setup);
 extern void disable_local_APIC (void);
 extern int verify_local_APIC (void);
 extern void cache_APIC_registers (void);
-extern void sync_Arb_IDs (void);
 extern void init_bsp_APIC (void);
 extern void setup_local_APIC(bool bsp);
 extern void init_apic_mappings (void);
diff --git a/xen/arch/x86/io_apic.c b/xen/arch/x86/io_apic.c
index 42a9b653d3..17e6827f4b 100644
--- a/xen/arch/x86/io_apic.c
+++ b/xen/arch/x86/io_apic.c
@@ -2163,7 +2163,7 @@ void __init setup_IO_APIC(void)
      */
     if (!acpi_ioapic)
         setup_ioapic_ids_from_mpc();
-    sync_Arb_IDs();
+
     setup_IO_APIC_irqs();
     init_IO_APIC_traps();
     check_timer();
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Sep 01 20:55:43 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 01 Sep 2025 20:55:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1105371.1456295 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1utBZ1-0003XG-GT; Mon, 01 Sep 2025 20:55:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1105371.1456295; Mon, 01 Sep 2025 20: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 1utBZ1-0003X8-De; Mon, 01 Sep 2025 20:55:43 +0000
Received: by outflank-mailman (input) for mailman id 1105371;
 Mon, 01 Sep 2025 20: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 1utBZ0-0003X0-KN
 for xen-changelog@lists.xenproject.org; Mon, 01 Sep 2025 20: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 1utBZ0-001KuK-1G
 for xen-changelog@lists.xenproject.org;
 Mon, 01 Sep 2025 20:55:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1utBZ0-00CLXj-1r
 for xen-changelog@lists.xenproject.org;
 Mon, 01 Sep 2025 20: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=6MeojlqU83t/9GW2o8tyPstUFRbfoMN9baumg1pDEG4=; b=PYvSD0Ki2Qutq4YU9DiwK+IYMg
	hEWizpgZrNQQBBo8wv1Jp2vT6+5NaezoSWplyrwh85IRIPH/TtiNUp9tesd+Ss99iNRmwpBkorKRl
	sNIfRn7+nQKFeQVSkKoHckLIng3liRbFMTUvH+Yu/DTON1P7wLT0A5KUtqzudK3N8O/E=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/bitops: Optimise arch_ffs{,l}() some more on AMD
Message-Id: <E1utBZ0-00CLXj-1r@xenbits.xenproject.org>
Date: Mon, 01 Sep 2025 20:55:42 +0000

commit 437f07b2b52b32929c74c2e19a52437ce7e5b88f
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Apr 30 14:35:39 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Sep 1 19:54:21 2025 +0100

    x86/bitops: Optimise arch_ffs{,l}() some more on AMD
    
    One aspect of the old ffs() infrastructure was the use of TZCNT without a
    CPUID check.  Given no obvious justification, I dropped it during the cleanup.
    
    It turns out there is a good reason, on all but the most recent AMD CPUs.
    
    Reinstate the use of "blind" TZCNT when safe to do so.  This happens to be
    preferentially in loops where a repeated saving of 5-6 uops becomes far more
    relevant than a one-off scenario.  Leave an explanation of why.
    
    It is not safe to perform this transformation for BSR and LZCNT, because they
    count from opposite ends of the input operand.  Furthermore, this incorrect
    transform was not caught by the selftests.
    
    Extend the selftests with test_for_each_set_bit_reverse() as that exercises
    the "x known non-zero" optimsiation path in x86's helpers.  Adjust the
    existing test_for_each_set_bit() to intentionally use an asymmetric input bit
    pattern, otherwise "counting from the wrong end" bugs continue to slip by.
    
    No functional change.
    
    Fixes: 989e5f08d33e ("x86/bitops: Improve arch_ffs() in the general case")
    Fixes: 5ed26fc0768d ("xen/bitops: Implement ffsl() in common logic")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/include/asm/bitops.h | 13 +++++--
 xen/common/bitops.c               | 78 ++++++++++++++++++++++++++++++++++++++-
 2 files changed, 86 insertions(+), 5 deletions(-)

diff --git a/xen/arch/x86/include/asm/bitops.h b/xen/arch/x86/include/asm/bitops.h
index 87eac7782f..b17d67e8ca 100644
--- a/xen/arch/x86/include/asm/bitops.h
+++ b/xen/arch/x86/include/asm/bitops.h
@@ -399,9 +399,16 @@ static always_inline unsigned int arch_ffs(unsigned int x)
          *
          * and the optimiser really can work with the knowledge of x being
          * non-zero without knowing it's exact value, in which case we don't
-         * need to compensate for BSF's corner cases.  Otherwise...
+         * need to compensate for BSF's corner cases.
+         *
+         * That said, we intentionally use TZCNT on capable hardware when the
+         * behaviour for the 0 case doesn't matter.  On AMD CPUs prior to
+         * Zen4, TZCNT is 1-2 uops while BSF is 6-8 with a latency to match.
+         * Intel CPUs don't suffer this discrepancy.
+         *
+         * Otherwise...
          */
-        asm ( "bsf %[val], %[res]"
+        asm ( "tzcnt %[val], %[res]"
               : [res] "=r" (r)
               : [val] "rm" (x) );
     }
@@ -428,7 +435,7 @@ static always_inline unsigned int arch_ffsl(unsigned long x)
 
     /* See arch_ffs() for safety discussions. */
     if ( __builtin_constant_p(x > 0) && x > 0 )
-        asm ( "bsf %[val], %q[res]"
+        asm ( "tzcnt %[val], %q[res]"
               : [res] "=r" (r)
               : [val] "rm" (x) );
     else
diff --git a/xen/common/bitops.c b/xen/common/bitops.c
index bd17ddef57..14e6265037 100644
--- a/xen/common/bitops.c
+++ b/xen/common/bitops.c
@@ -97,14 +97,14 @@ static void __init test_for_each_set_bit(void)
     if ( ui != ui_res )
         panic("for_each_set_bit(uint) expected %#x, got %#x\n", ui, ui_res);
 
-    ul = HIDE(1UL << (BITS_PER_LONG - 1) | 1);
+    ul = HIDE(1UL << (BITS_PER_LONG - 1) | 0x11);
     for_each_set_bit ( i, ul )
         ul_res |= 1UL << i;
 
     if ( ul != ul_res )
         panic("for_each_set_bit(ulong) expected %#lx, got %#lx\n", ul, ul_res);
 
-    ull = HIDE(0x8000000180000001ULL);
+    ull = HIDE(0x8000000180000011ULL);
     for_each_set_bit ( i, ull )
         ull_res |= 1ULL << i;
 
@@ -127,6 +127,79 @@ static void __init test_for_each_set_bit(void)
         panic("for_each_set_bit(break) expected 0x1008, got %#x\n", ui_res);
 }
 
+/*
+ * A type-generic fls() which picks the appropriate fls{,l,64}() based on it's
+ * argument.
+ */
+#define fls_g(x)                                        \
+    (sizeof(x) <= sizeof(int)      ? fls(x) :           \
+     sizeof(x) <= sizeof(long)     ? flsl(x) :          \
+     sizeof(x) <= sizeof(uint64_t) ? fls64(x) :         \
+     ({ BUILD_ERROR("fls_g() Bad input type"); 0; }))
+
+/*
+ * for_each_set_bit_reverse() - Iterate over all set bits in a scalar value,
+ * from MSB to LSB.
+ *
+ * @iter An iterator name.  Scoped is within the loop only.
+ * @val  A scalar value to iterate over.
+ *
+ * A copy of @val is taken internally.
+ */
+#define for_each_set_bit_reverse(iter, val)             \
+    for ( typeof(val) __v = (val); __v; __v = 0 )       \
+        for ( unsigned int (iter);                      \
+              __v && ((iter) = fls_g(__v) - 1, true);   \
+              __clear_bit(iter, &__v) )
+
+/*
+ * Xen doesn't have need of for_each_set_bit_reverse() at present, but the
+ * construct does exercise a case of arch_fls*() not covered anywhere else by
+ * these tests.
+ */
+static void __init test_for_each_set_bit_reverse(void)
+{
+    unsigned int  ui,  ui_res = 0, tmp;
+    unsigned long ul,  ul_res = 0;
+    uint64_t      ull, ull_res = 0;
+
+    ui = HIDE(0x80008001U);
+    for_each_set_bit_reverse ( i, ui )
+        ui_res |= 1U << i;
+
+    if ( ui != ui_res )
+        panic("for_each_set_bit_reverse(uint) expected %#x, got %#x\n", ui, ui_res);
+
+    ul = HIDE(1UL << (BITS_PER_LONG - 1) | 0x11);
+    for_each_set_bit_reverse ( i, ul )
+        ul_res |= 1UL << i;
+
+    if ( ul != ul_res )
+        panic("for_each_set_bit_reverse(ulong) expected %#lx, got %#lx\n", ul, ul_res);
+
+    ull = HIDE(0x8000000180000011ULL);
+    for_each_set_bit_reverse ( i, ull )
+        ull_res |= 1ULL << i;
+
+    if ( ull != ull_res )
+        panic("for_each_set_bit_reverse(uint64) expected %#"PRIx64", got %#"PRIx64"\n", ull, ull_res);
+
+    /* Check that we can break from the middle of the loop. */
+    ui = HIDE(0x80001008U);
+    tmp = 0;
+    ui_res = 0;
+    for_each_set_bit_reverse ( i, ui )
+    {
+        if ( tmp++ > 1 )
+            break;
+
+        ui_res |= 1U << i;
+    }
+
+    if ( ui_res != 0x80001000U )
+        panic("for_each_set_bit_reverse(break) expected 0x80001000, got %#x\n", ui_res);
+}
+
 static void __init test_multiple_bits_set(void)
 {
     /*
@@ -169,6 +242,7 @@ static void __init __constructor test_bitops(void)
     test_ffs();
     test_fls();
     test_for_each_set_bit();
+    test_for_each_set_bit_reverse();
 
     test_multiple_bits_set();
     test_hweight();
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Sep 03 12:11:09 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 03 Sep 2025 12:11:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1108190.1458277 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1utmKN-0001bK-Fo; Wed, 03 Sep 2025 12:11:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1108190.1458277; Wed, 03 Sep 2025 12: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 1utmKN-0001bB-D4; Wed, 03 Sep 2025 12:11:03 +0000
Received: by outflank-mailman (input) for mailman id 1108190;
 Wed, 03 Sep 2025 12: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 1utmKM-0001Zr-DV
 for xen-changelog@lists.xenproject.org; Wed, 03 Sep 2025 12: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 1utmKL-004ZaG-2x
 for xen-changelog@lists.xenproject.org;
 Wed, 03 Sep 2025 12:11:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1utmKM-00EJZl-0I
 for xen-changelog@lists.xenproject.org;
 Wed, 03 Sep 2025 12: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=gLPu7q+bOB3hfaYKC2WMCtqSWh1OwGKYBNP4BnWdw+g=; b=ylqSY9dBUeCulz1iYp5zLQMJwN
	kYTuK98VsaQATYn6ZTkxiUwsHMHe1mlrqnmWY+xFBzvSSYnnHjHoDQeqkq6o/MgrBdPz2dOR7JSL4
	zb7SlDrX8/4PeCnj3QpzP1X/p8gxCITTpPHcnqmIY8YLyoK3Rgqb5ZTk4gcfYY49Xap8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.20] x86/hpet: do local APIC EOI after interrupt processing
Message-Id: <E1utmKM-00EJZl-0I@xenbits.xenproject.org>
Date: Wed, 03 Sep 2025 12:11:02 +0000

commit 67fcd2d2e59558a2b0936f35e4b9be10fb5848f1
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Sep 3 13:54:21 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 3 13:54:21 2025 +0200

    x86/hpet: do local APIC EOI after interrupt processing
    
    The current logic in the HPET interrupt ->ack() hook will perform a local
    APIC EOI ahead of enabling interrupts, possibly leading to recursion in the
    interrupt handler.
    
    Fix this by doing the local APIC EOI strictly after the window with
    interrupt enabled, as that prevents the recursion, and would only allow for
    interrupts with higher priority to be serviced.
    
    Use the generic ack_nonmaskable_msi_irq() and end_nonmaskable_irq()
    functions, removing the need for hpet_msi_ack().
    
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Fixes: 3ba523ff957c ('CPUIDLE: enable MSI capable HPET for timer broadcast')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 1db7829e56578970c1037c4dd1c27f939be4c054
    master date: 2025-08-06 10:47:16 +0200
---
 xen/arch/x86/hpet.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/xen/arch/x86/hpet.c b/xen/arch/x86/hpet.c
index 9290cf7a42..7e9d996436 100644
--- a/xen/arch/x86/hpet.c
+++ b/xen/arch/x86/hpet.c
@@ -299,13 +299,6 @@ static unsigned int cf_check hpet_msi_startup(struct irq_desc *desc)
 
 #define hpet_msi_shutdown hpet_msi_mask
 
-static void cf_check hpet_msi_ack(struct irq_desc *desc)
-{
-    irq_complete_move(desc);
-    move_native_irq(desc);
-    ack_APIC_irq();
-}
-
 static void cf_check hpet_msi_set_affinity(
     struct irq_desc *desc, const cpumask_t *mask)
 {
@@ -333,7 +326,8 @@ static hw_irq_controller hpet_msi_type = {
     .shutdown   = hpet_msi_shutdown,
     .enable	    = hpet_msi_unmask,
     .disable    = hpet_msi_mask,
-    .ack        = hpet_msi_ack,
+    .ack        = ack_nonmaskable_msi_irq,
+    .end        = end_nonmaskable_irq,
     .set_affinity   = hpet_msi_set_affinity,
 };
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.20


From xen-changelog-bounces@lists.xenproject.org Wed Sep 03 12:11:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 03 Sep 2025 12:11:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1108191.1458282 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1utmKX-0001fQ-HY; Wed, 03 Sep 2025 12:11:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1108191.1458282; Wed, 03 Sep 2025 12: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 1utmKX-0001fI-EV; Wed, 03 Sep 2025 12:11:13 +0000
Received: by outflank-mailman (input) for mailman id 1108191;
 Wed, 03 Sep 2025 12: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 1utmKW-0001dq-8E
 for xen-changelog@lists.xenproject.org; Wed, 03 Sep 2025 12: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 1utmKW-004Zaf-03
 for xen-changelog@lists.xenproject.org;
 Wed, 03 Sep 2025 12:11:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1utmKW-00EJcC-0a
 for xen-changelog@lists.xenproject.org;
 Wed, 03 Sep 2025 12: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=Ur5VWuRtD2FYn5tVqgFCX+1g9Hilc2C9g6LmDTskg8s=; b=IaBsxGvz9kboD+PdDm6rjt+JKJ
	3ggJLS/vU8M3pMO5xqcsjMnIbsAnKjRAowobZqUoRuHT7QTkrus3mZnefDy45HQb0cA8WpfOdeoCp
	zhA2QJtO7/Mb3jZJawRplPaTOiMZjcW5JJG/tlCzLb52XA8IMYvjlYJ4MIpLYW0aEa2w=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.20] efi: Call FreePages() only if needed
Message-Id: <E1utmKW-00EJcC-0a@xenbits.xenproject.org>
Date: Wed, 03 Sep 2025 12:11:12 +0000

commit 16dae1e1cff369c9127b6207ec1d1b2f000a06ca
Author:     Ross Lagerwall <ross.lagerwall@citrix.com>
AuthorDate: Wed Sep 3 13:55:02 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 3 13:55:02 2025 +0200

    efi: Call FreePages() only if needed
    
    If the config file is builtin, cfg.addr will be zero but Xen
    unconditionally calls FreePages() on the address.
    
    Xen may also call FreePages() with a zero address if blexit() is called
    after this point since cfg.need_to_free is not set to false.
    
    The UEFI specification does not say whether calling FreePages() with a
    zero address is allowed so let's be cautious and use cfg.need_to_free
    properly.
    
    Fixes: 8a71d50ed40b ("efi: Enable booting unified hypervisor/kernel/initrd images")
    Fixes: 04be2c3a0678 ("efi/boot.c: add file.need_to_free")
    Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by Daniel P. Smith <dpsmith@apertussolutions.com>
    master commit: 7fddedd530561797d8ce5fba78e83cc9cc6b58dd
    master date: 2025-08-12 11:40:28 +0200
---
 xen/common/efi/boot.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c
index efbec00af9..01062bb39f 100644
--- a/xen/common/efi/boot.c
+++ b/xen/common/efi/boot.c
@@ -1484,8 +1484,11 @@ void EFIAPI __init noreturn efi_start(EFI_HANDLE ImageHandle,
 
         efi_arch_cfg_file_late(loaded_image, dir_handle, section.s);
 
-        efi_bs->FreePages(cfg.addr, PFN_UP(cfg.size));
-        cfg.addr = 0;
+        if ( cfg.need_to_free )
+        {
+            efi_bs->FreePages(cfg.addr, PFN_UP(cfg.size));
+            cfg.need_to_free = false;
+        }
 
         dir_handle->Close(dir_handle);
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.20


From xen-changelog-bounces@lists.xenproject.org Wed Sep 03 12:11:23 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 03 Sep 2025 12:11:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1108193.1458284 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1utmKh-0001i8-Ij; Wed, 03 Sep 2025 12:11:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1108193.1458284; Wed, 03 Sep 2025 12: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 1utmKh-0001i0-G2; Wed, 03 Sep 2025 12:11:23 +0000
Received: by outflank-mailman (input) for mailman id 1108193;
 Wed, 03 Sep 2025 12: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 1utmKg-0001hj-BD
 for xen-changelog@lists.xenproject.org; Wed, 03 Sep 2025 12: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 1utmKg-004Zal-0L
 for xen-changelog@lists.xenproject.org;
 Wed, 03 Sep 2025 12:11:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1utmKg-00EJe0-0u
 for xen-changelog@lists.xenproject.org;
 Wed, 03 Sep 2025 12: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=q6v888N16L0Bqdpc7JBnVL4Hu35h0bVWdvENlcqr0O4=; b=m6sa1jTsAIAM1Hfy1d33hCd/tx
	coiPZpOT3BAzep0tINifa85k7PP9IMPacok/cUsz4H86NGzyZrZB+L3arJDv0SYBz2IKg0WkQmjR1
	mV5AwPo3FVC8Mzp2cJDFssL9ZVDDX6CPM9N2xX1Tu/aV8wuk3MUDTjmDfu5NN6Am+trU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.20] x86/mkelf32: pad load segment to 2Mb boundary
Message-Id: <E1utmKg-00EJe0-0u@xenbits.xenproject.org>
Date: Wed, 03 Sep 2025 12:11:22 +0000

commit e2590544d5651170dd889b1c6f0328b6a439a43f
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Sep 3 13:55:37 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 3 13:55:37 2025 +0200

    x86/mkelf32: pad load segment to 2Mb boundary
    
    In order to legitimately set up initial mappings past _end[], we need
    to make sure that the entire mapped range is inside a RAM region.
    Therefore we need to inform the bootloader (or alike) that our allocated
    size is larger than just the next SECTION_ALIGN-ed boundary past _end[].
    
    This allows dropping a command line option from the tool, which was
    introduced to work around a supposed linker bug, when the problem was
    really Xen's.
    
    While adjusting adjacent code, correct the argc check to also cover the
    case correctly when --notes was passed.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 4fb075201f54b16c0800af0107162461a93065fb
    master date: 2025-08-18 10:42:24 +0200
---
 xen/arch/x86/Makefile       |  3 +--
 xen/arch/x86/boot/mkelf32.c | 18 +++++++++++-------
 2 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile
index a0954a6a8c..95b30a888f 100644
--- a/xen/arch/x86/Makefile
+++ b/xen/arch/x86/Makefile
@@ -126,8 +126,7 @@ orphan-handling-$(call ld-option,--orphan-handling=warn) += --orphan-handling=wa
 
 $(TARGET): TMP = $(dot-target).elf32
 $(TARGET): $(TARGET)-syms $(efi-y) $(obj)/boot/mkelf32
-	$(obj)/boot/mkelf32 $(notes_phdrs) $(TARGET)-syms $(TMP) $(XEN_IMG_OFFSET) \
-	               `$(NM) $(TARGET)-syms | sed -ne 's/^\([^ ]*\) . __2M_rwdata_end$$/0x\1/p'`
+	$(obj)/boot/mkelf32 $(notes_phdrs) $(TARGET)-syms $(TMP) $(XEN_IMG_OFFSET)
 	od -t x4 -N 8192 $(TMP)  | grep 1badb002 > /dev/null || \
 		{ echo "No Multiboot1 header found" >&2; false; }
 	od -t x4 -N 32768 $(TMP) | grep e85250d6 > /dev/null || \
diff --git a/xen/arch/x86/boot/mkelf32.c b/xen/arch/x86/boot/mkelf32.c
index f0f406687c..373ba4ddd5 100644
--- a/xen/arch/x86/boot/mkelf32.c
+++ b/xen/arch/x86/boot/mkelf32.c
@@ -248,7 +248,6 @@ static void do_read(int fd, void *data, int len)
 
 int main(int argc, char **argv)
 {
-    uint64_t   final_exec_addr;
     uint32_t   loadbase, dat_siz, mem_siz, note_base, note_sz, offset;
     char      *inimage, *outimage;
     int        infd, outfd;
@@ -261,22 +260,24 @@ int main(int argc, char **argv)
     Elf64_Ehdr in64_ehdr;
     Elf64_Phdr in64_phdr;
 
-    if ( argc < 5 )
+    if ( argc < 4 )
     {
+    help:
         fprintf(stderr, "Usage: mkelf32 [--notes] <in-image> <out-image> "
-                "<load-base> <final-exec-addr>\n");
+                "<load-base>\n");
         return 1;
     }
 
     if ( !strcmp(argv[1], "--notes") )
     {
+        if ( argc < 5 )
+            goto help;
         i = 2;
         num_phdrs = 2;
     }
     inimage  = argv[i++];
     outimage = argv[i++];
     loadbase = strtoul(argv[i++], NULL, 16);
-    final_exec_addr = strtoull(argv[i++], NULL, 16);
 
     infd = open(inimage, O_RDONLY);
     if ( infd == -1 )
@@ -339,9 +340,12 @@ int main(int argc, char **argv)
     (void)lseek(infd, in64_phdr.p_offset, SEEK_SET);
     dat_siz = (uint32_t)in64_phdr.p_filesz;
 
-    /* Do not use p_memsz: it does not include BSS alignment padding. */
-    /*mem_siz = (uint32_t)in64_phdr.p_memsz;*/
-    mem_siz = (uint32_t)(final_exec_addr - in64_phdr.p_vaddr);
+    /*
+     * We don't pad .bss in the linker script, but during early boot we map
+     * the Xen image using 2M pages.  To avoid running into adjacent non-RAM
+     * regions, pad the segment to the next 2M boundary.
+     */
+    mem_siz = ((uint32_t)in64_phdr.p_memsz + (1U << 20) - 1) & (-1U << 20);
 
     note_sz = note_base = offset = 0;
     if ( num_phdrs > 1 )
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.20


From xen-changelog-bounces@lists.xenproject.org Wed Sep 03 12:11:33 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 03 Sep 2025 12:11:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1108194.1458289 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1utmKr-0001m5-K9; Wed, 03 Sep 2025 12:11:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1108194.1458289; Wed, 03 Sep 2025 12: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 1utmKr-0001lv-HR; Wed, 03 Sep 2025 12:11:33 +0000
Received: by outflank-mailman (input) for mailman id 1108194;
 Wed, 03 Sep 2025 12: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 1utmKq-0001ll-E1
 for xen-changelog@lists.xenproject.org; Wed, 03 Sep 2025 12: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 1utmKq-004Zap-0b
 for xen-changelog@lists.xenproject.org;
 Wed, 03 Sep 2025 12:11:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1utmKq-00EJeb-1C
 for xen-changelog@lists.xenproject.org;
 Wed, 03 Sep 2025 12: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=o2gFDpt8zBUiXqc/CwFG91mh+1Q0V141otONhd2Cx5M=; b=uShNR9yJZ4DGwb7HT3vlNoaUVw
	juLSiIX/KyDSVkFi0Jo2i9zJ6fckVfURe3IHjW9EBLkz5xnReuPdRksSKPX1KSgCy/AzU8W4Y7jKV
	YZ4RPLyHi76bhgYGetZhMpG/buFRaXCEUNGVKL7dD+dqLZ6sI8aOg3UG969JP0DW2810=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.20] x86/hvm/ioreq: Fix condition in hvm_alloc_legacy_ioreq_gfn()
Message-Id: <E1utmKq-00EJeb-1C@xenbits.xenproject.org>
Date: Wed, 03 Sep 2025 12:11:32 +0000

commit cb827d83175e41e1aa3f6a4de1ef5a88f91dc16a
Author:     Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
AuthorDate: Wed Sep 3 13:56:04 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 3 13:56:04 2025 +0200

    x86/hvm/ioreq: Fix condition in hvm_alloc_legacy_ioreq_gfn()
    
    Fix the incorrect condition that causes hvm_alloc_legacy_ioreq_gfn()
    to return INVALID_GFN even if the HVM param was installed properly by
    the toolstack.
    
    Fixes: 3486f398a3dd (' x86/hvm/ioreq: allow ioreq servers to use HVM_PARAM_[BUF]IOREQ_PFN')
    Signed-off-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 282ed258a59195698a81ab4408a17336eb6ea7ed
    master date: 2025-08-18 10:43:52 +0200
---
 xen/arch/x86/hvm/ioreq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/hvm/ioreq.c b/xen/arch/x86/hvm/ioreq.c
index d6491df8e7..c1c9da819d 100644
--- a/xen/arch/x86/hvm/ioreq.c
+++ b/xen/arch/x86/hvm/ioreq.c
@@ -63,7 +63,7 @@ static gfn_t hvm_alloc_legacy_ioreq_gfn(struct ioreq_server *s)
 
     for ( i = HVM_PARAM_IOREQ_PFN; i <= HVM_PARAM_BUFIOREQ_PFN; i++ )
     {
-        if ( !test_and_clear_bit(i, &d->arch.hvm.ioreq_gfn.legacy_mask) )
+        if ( test_and_clear_bit(i, &d->arch.hvm.ioreq_gfn.legacy_mask) )
             return _gfn(d->arch.hvm.params[i]);
     }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.20


From xen-changelog-bounces@lists.xenproject.org Wed Sep 03 12:11:43 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 03 Sep 2025 12:11:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1108195.1458294 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1utmL1-0001ol-Ly; Wed, 03 Sep 2025 12:11:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1108195.1458294; Wed, 03 Sep 2025 12: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 1utmL1-0001oc-Im; Wed, 03 Sep 2025 12:11:43 +0000
Received: by outflank-mailman (input) for mailman id 1108195;
 Wed, 03 Sep 2025 12: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 1utmL0-0001oQ-Gd
 for xen-changelog@lists.xenproject.org; Wed, 03 Sep 2025 12: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 1utmL0-004Zb0-0t
 for xen-changelog@lists.xenproject.org;
 Wed, 03 Sep 2025 12:11:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1utmL0-00EJfI-1T
 for xen-changelog@lists.xenproject.org;
 Wed, 03 Sep 2025 12: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=d4/P4WIpwlIya+eZMD2KFxH1teHcr9uCVrNTT7lremI=; b=mh0sdL062QxwZUd/Etl5VBa7ht
	aJGsrP9zNjqH55TFBZgAP9mcjCEN27z+QWQLnRx8gcR0sMjLvTuKxqNZr8UPlGDVdZxjg4c4fpxRT
	YEjC5pCYOLeO6tQD7cVFxeeQObM75RYi54YU0mHfmEE3z0EgZu+AZoY2Q1UT6ZdjZFTo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.20] x86/iommu: setup MMCFG ahead of IOMMU
Message-Id: <E1utmL0-00EJfI-1T@xenbits.xenproject.org>
Date: Wed, 03 Sep 2025 12:11:42 +0000

commit a98591e217b7d1bdd5bb27d81184456bb69771b2
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Sep 3 13:56:27 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 3 13:56:27 2025 +0200

    x86/iommu: setup MMCFG ahead of IOMMU
    
    Otherwise the PCI accesses to segments different than the first one done by
    the IOMMU initialization code would silently fail by returning all ones.
    
    Introduce a new helper, called pci_setup(), and move both the creation of
    PCI segment 0 internal data structures, plus the parsing of ACPI MMCFG
    table to it.  This moves acpi_mmcfg_init() slightly earlier from
    acpi_boot_init() into pci_setup().
    
    Note that further work will be needed to support systems where access
    methods to segments different than 0 is not discoverable by Xen.
    
    Fixes: 3950f2485bbc ('x86/x2APIC: defer probe until after IOMMU ACPI table parsing')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: c292772b4945d3a264a61c3c1920f1aebd17998b
    master date: 2025-08-21 11:57:25 +0200
---
 xen/arch/x86/acpi/boot.c              | 2 --
 xen/arch/x86/setup.c                  | 6 ++++++
 xen/arch/x86/x86_64/mmconfig-shared.c | 3 +++
 3 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/acpi/boot.c b/xen/arch/x86/acpi/boot.c
index 3901f9d982..1ca2360e00 100644
--- a/xen/arch/x86/acpi/boot.c
+++ b/xen/arch/x86/acpi/boot.c
@@ -748,8 +748,6 @@ int __init acpi_boot_init(void)
 
 	acpi_table_parse(ACPI_SIG_HPET, acpi_parse_hpet);
 
-	acpi_mmcfg_init();
-
 	erst_init();
 
 	acpi_hest_init();
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 6e49d2705b..10d55884ab 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -1897,6 +1897,12 @@ void asmlinkage __init noreturn __start_xen(void)
      */
     setup_system_domains();
 
+    /*
+     * Initialize PCI (create segment 0, setup MMCFG access) ahead of IOMMU
+     * setup, as devices in segment > 0 must also be discoverable.
+     */
+    acpi_mmcfg_init();
+
     /*
      * IOMMU-related ACPI table parsing has to happen before APIC probing, for
      * check_x2apic_preenabled() to be able to observe respective findings, in
diff --git a/xen/arch/x86/x86_64/mmconfig-shared.c b/xen/arch/x86/x86_64/mmconfig-shared.c
index 77ba1e28f1..d2ec3d808f 100644
--- a/xen/arch/x86/x86_64/mmconfig-shared.c
+++ b/xen/arch/x86/x86_64/mmconfig-shared.c
@@ -404,6 +404,9 @@ void __init acpi_mmcfg_init(void)
 
     pci_segments_init();
 
+    if ( acpi_disabled )
+        return;
+
     /* MMCONFIG disabled */
     if ((pci_probe & PCI_PROBE_MMCONF) == 0)
         return;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.20


From xen-changelog-bounces@lists.xenproject.org Wed Sep 03 12:11:53 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 03 Sep 2025 12:11:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1108196.1458297 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1utmLB-0001r4-Mf; Wed, 03 Sep 2025 12:11:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1108196.1458297; Wed, 03 Sep 2025 12: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 1utmLB-0001qx-K8; Wed, 03 Sep 2025 12:11:53 +0000
Received: by outflank-mailman (input) for mailman id 1108196;
 Wed, 03 Sep 2025 12: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 1utmLA-0001qp-Jb
 for xen-changelog@lists.xenproject.org; Wed, 03 Sep 2025 12: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 1utmLA-004Zb8-1C
 for xen-changelog@lists.xenproject.org;
 Wed, 03 Sep 2025 12:11:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1utmLA-00EJg1-1k
 for xen-changelog@lists.xenproject.org;
 Wed, 03 Sep 2025 12: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=CzZHYkWyf5hcOCZcPz74oNF13mNpTqxidwwQXnBYhRA=; b=L1Y9UMgJW+ke1x3FIdO4k/wNWQ
	4Av6GIDg8k5vAz8ZKE9vBJjYStDr+GBrEnW/AMdgXHEZZot+8e+WK6V/5v8oNrEM6invE74iF2iNm
	TqOwYaYgiy0zhIur7QA7QEcvBUo41UYRkN0X6SzxlCDcJbEElC2qeuIcemWZHox/SfO8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.20] x86/mce: Adjustments to intel_init_ppin()
Message-Id: <E1utmLA-00EJg1-1k@xenbits.xenproject.org>
Date: Wed, 03 Sep 2025 12:11:52 +0000

commit 96b7183a021eccf8e4ed7e0a642e3f7a25081c34
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Sep 3 13:56:55 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 3 13:56:55 2025 +0200

    x86/mce: Adjustments to intel_init_ppin()
    
    There's no family check gating intel_init_ppin(), making it incorrect to
    use on non Fam6 CPUs.
    
    Emerald Rapids is the final CPU to have PPIN but lack the architectural
    enumeration, so include it too.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 49e6eb744eba01f5d4b4cfce49154c0802d4f5c6
    master date: 2025-08-25 14:04:41 +0100
---
 xen/arch/x86/cpu/mcheck/mce_intel.c | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/xen/arch/x86/cpu/mcheck/mce_intel.c b/xen/arch/x86/cpu/mcheck/mce_intel.c
index 07b50f8793..f09a190b6c 100644
--- a/xen/arch/x86/cpu/mcheck/mce_intel.c
+++ b/xen/arch/x86/cpu/mcheck/mce_intel.c
@@ -10,6 +10,7 @@
 #include <xen/cpu.h>
 #include <asm/processor.h>
 #include <public/sysctl.h>
+#include <asm/intel-family.h>
 #include <asm/system.h>
 #include <asm/msr.h>
 #include <asm/p2m.h>
@@ -859,7 +860,7 @@ static void intel_init_ppin(const struct cpuinfo_x86 *c)
      * other purposes.  Despite the late addition of a CPUID bit (rendering
      * the MSR architectural), keep using the same detection logic there.
      */
-    switch ( c->x86_model )
+    switch ( c->x86 == 6 ? c->x86_model : 0 )
     {
         uint64_t val;
 
@@ -870,14 +871,15 @@ static void intel_init_ppin(const struct cpuinfo_x86 *c)
             return;
         }
         fallthrough;
-    case 0x3e: /* IvyBridge X */
-    case 0x3f: /* Haswell X */
-    case 0x4f: /* Broadwell X */
-    case 0x55: /* Skylake X */
-    case 0x56: /* Broadwell Xeon D */
-    case 0x6a: /* Icelake X */
-    case 0x6c: /* Icelake D */
-    case 0x8f: /* Sapphire Rapids X */
+    case INTEL_FAM6_IVYBRIDGE_X:
+    case INTEL_FAM6_HASWELL_X:
+    case INTEL_FAM6_BROADWELL_X:
+    case INTEL_FAM6_BROADWELL_D:
+    case INTEL_FAM6_SKYLAKE_X:
+    case INTEL_FAM6_ICELAKE_X:
+    case INTEL_FAM6_ICELAKE_D:
+    case INTEL_FAM6_SAPPHIRERAPIDS_X:
+    case INTEL_FAM6_EMERALDRAPIDS_X:
 
         if ( (c != &boot_cpu_data && !ppin_msr) ||
              rdmsr_safe(MSR_PPIN_CTL, val) )
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.20


From xen-changelog-bounces@lists.xenproject.org Wed Sep 03 12:12:03 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 03 Sep 2025 12:12:03 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1108197.1458303 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1utmLL-0001tt-PF; Wed, 03 Sep 2025 12:12:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1108197.1458303; Wed, 03 Sep 2025 12: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 1utmLL-0001tj-Lh; Wed, 03 Sep 2025 12:12:03 +0000
Received: by outflank-mailman (input) for mailman id 1108197;
 Wed, 03 Sep 2025 12: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 1utmLK-0001tU-Mi
 for xen-changelog@lists.xenproject.org; Wed, 03 Sep 2025 12: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 1utmLK-004ZbN-1S
 for xen-changelog@lists.xenproject.org;
 Wed, 03 Sep 2025 12:12:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1utmLK-00EJhC-22
 for xen-changelog@lists.xenproject.org;
 Wed, 03 Sep 2025 12: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=FjGnRo/Hh0L9Ue0lLKNwW4bZRgdTzT4YVGGpQcLxht4=; b=IwZ9fJ5chvB4W4CYTU/DFSHab9
	kQn3r0N/4DAFDdnD1apxiyJcxc8xQw1urkY02apqVuB4IGC+aXyFjpExOoCHHSDli3QUCCxmHQE9F
	IGGAHmSsGcnQ3sqP2sv6t5AtQCh8EWKaBJIIbsNanTuiEusQWQkYODT78357dYOS2lto=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.20] x86/suspend: unconditionally raise a timer softirq on resume
Message-Id: <E1utmLK-00EJhC-22@xenbits.xenproject.org>
Date: Wed, 03 Sep 2025 12:12:02 +0000

commit 1541866d47002db71b3f4760174f556c8206e776
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Sep 3 13:57:31 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 3 13:57:31 2025 +0200

    x86/suspend: unconditionally raise a timer softirq on resume
    
    The current code to restore the timer state on resume is incomplete.  While
    the local APIC Initial Count Register is saved and restored across
    suspension (even if possibly no longer accurate since it's not adjusted to
    account for the time spent in suspension), the TSC deadline MSR is not
    saved and restored, hence hosts using the TSC deadline timer will likely
    get stuck when resuming from suspension.
    
    The lack of restoring of the TSC deadline MSR was mitigated by the raising
    of a timer softirq in mwait_idle_with_hints() if the timer had expired,
    previous to commit 3faf0866a33070b926ab78e6298290403f85e76c, which removed
    that logic.
    
    This patch fixes the usage of the TSC deadline timer with suspension, by
    unconditionally raising a timer softirq on resume, that will take care of
    rearming the hardware timer.  Given that a timer softirq will be
    unconditionally risen, there's no need to save and restore the APIC Initial
    Count Register anymore either.
    
    Note that secondary processors don't need this special treatment when
    resuming, since they are offlined before suspension and brought back up
    during resume, the first timer that gets setup will trigger a timer softirq
    unconditionally, for example from sched_migrate_timers() that gets called
    for each secondary processor.
    
    Link: https://github.com/QubesOS/qubes-issues/issues/10110
    Reported-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Fixes: fd1291a826e1 ('X86: Prefer TSC-deadline timer in Xen')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Tested-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    master commit: 757abedabbb64f18a28ae61a7bd67a927bb03130
    master date: 2025-08-27 09:33:12 +0200
---
 xen/arch/x86/acpi/power.c | 2 ++
 xen/arch/x86/apic.c       | 3 ---
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/acpi/power.c b/xen/arch/x86/acpi/power.c
index b69be6e898..be96268195 100644
--- a/xen/arch/x86/acpi/power.c
+++ b/xen/arch/x86/acpi/power.c
@@ -22,6 +22,7 @@
 #include <xen/domain.h>
 #include <xen/console.h>
 #include <xen/iommu.h>
+#include <xen/softirq.h>
 #include <xen/watchdog.h>
 #include <xen/cpu.h>
 #include <public/platform.h>
@@ -332,6 +333,7 @@ static int enter_state(u32 state)
     thaw_domains();
     system_state = SYS_STATE_active;
     spin_unlock(&pm_lock);
+    raise_softirq(TIMER_SOFTIRQ);
     return error;
 }
 
diff --git a/xen/arch/x86/apic.c b/xen/arch/x86/apic.c
index bb86a1c161..7a0920d11c 100644
--- a/xen/arch/x86/apic.c
+++ b/xen/arch/x86/apic.c
@@ -65,7 +65,6 @@ static struct {
     unsigned int apic_lvt0;
     unsigned int apic_lvt1;
     unsigned int apic_lvterr;
-    unsigned int apic_tmict;
     unsigned int apic_tdcr;
     unsigned int apic_thmr;
 } apic_pm_state;
@@ -658,7 +657,6 @@ int lapic_suspend(void)
     apic_pm_state.apic_lvt0 = apic_read(APIC_LVT0);
     apic_pm_state.apic_lvt1 = apic_read(APIC_LVT1);
     apic_pm_state.apic_lvterr = apic_read(APIC_LVTERR);
-    apic_pm_state.apic_tmict = apic_read(APIC_TMICT);
     apic_pm_state.apic_tdcr = apic_read(APIC_TDCR);
     if (maxlvt >= 5)
         apic_pm_state.apic_thmr = apic_read(APIC_LVTTHMR);
@@ -718,7 +716,6 @@ int lapic_resume(void)
         apic_write(APIC_LVTPC, apic_pm_state.apic_lvtpc);
     apic_write(APIC_LVTT, apic_pm_state.apic_lvtt);
     apic_write(APIC_TDCR, apic_pm_state.apic_tdcr);
-    apic_write(APIC_TMICT, apic_pm_state.apic_tmict);
     apic_write(APIC_ESR, 0);
     apic_read(APIC_ESR);
     apic_write(APIC_LVTERR, apic_pm_state.apic_lvterr);
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.20


From xen-changelog-bounces@lists.xenproject.org Wed Sep 03 12:12:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 03 Sep 2025 12:12:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1108199.1458305 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1utmLV-0001wr-RA; Wed, 03 Sep 2025 12:12:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1108199.1458305; Wed, 03 Sep 2025 12:12: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 1utmLV-0001wj-OS; Wed, 03 Sep 2025 12:12:13 +0000
Received: by outflank-mailman (input) for mailman id 1108199;
 Wed, 03 Sep 2025 12: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 1utmLU-0001wZ-P6
 for xen-changelog@lists.xenproject.org; Wed, 03 Sep 2025 12: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 1utmLU-004Zbi-1k
 for xen-changelog@lists.xenproject.org;
 Wed, 03 Sep 2025 12:12:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1utmLU-00EJiI-2I
 for xen-changelog@lists.xenproject.org;
 Wed, 03 Sep 2025 12: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=tgki2SypCRIw3UwHfuABc0FPpzqsMtA870I/kTj7PpQ=; b=D4ZN5gO5CTVJequGc1XoSae2Ic
	v79egKy4B4do6Omvt+lJZ2MhM+CTX2pceA5APEPev4sh695SSGcEpu4Ain4zI1MNltZzXQXGdcA2Z
	IjsTw5dIkl1PSz0kyHvBrtGjd2nyoJmIHxfgs9/+nj4FLAbecVHtsTy3KAMIpBMRhVsc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.20] tools: add sizeof_field and endof_field macros
Message-Id: <E1utmLU-00EJiI-2I@xenbits.xenproject.org>
Date: Wed, 03 Sep 2025 12:12:12 +0000

commit 68f5ecf690be4b8b6979eb55f2467ee4020e08d3
Author:     Petr Beneš <w1benny@gmail.com>
AuthorDate: Wed Sep 3 13:57:54 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 3 13:57:54 2025 +0200

    tools: add sizeof_field and endof_field macros
    
    * `sizeof_field` returns the size of a specific struct member
    * `endof_field` returns the offset to the end of the member within the struct
    
    It will be useful in upcoming layout checks of SMBIOS structs.
    
    Signed-off-by: Petr Beneš <w1benny@gmail.com>
    Acked-by: Anthony PERARD <anthony.perard@vates.tech>
    master commit: 17e66ca9188b423eee35e6b4bf878e62d3879a04
    master date: 2025-08-27 11:26:33 +0200
---
 tools/include/xen-tools/common-macros.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tools/include/xen-tools/common-macros.h b/tools/include/xen-tools/common-macros.h
index 0088208c2e..9838a108aa 100644
--- a/tools/include/xen-tools/common-macros.h
+++ b/tools/include/xen-tools/common-macros.h
@@ -83,6 +83,11 @@
 #define __packed __attribute__((__packed__))
 #endif
 
+#define sizeof_field(type, member) sizeof(((type *)NULL)->member)
+
+#define endof_field(type, member) \
+    (offsetof(type, member) + sizeof_field(type, member))
+
 #define container_of(ptr, type, member) ({              \
     typeof(((type *)0)->member) *mptr__ = (ptr);        \
     (type *)((char *)mptr__ - offsetof(type, member));  \
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.20


From xen-changelog-bounces@lists.xenproject.org Wed Sep 03 12:12:23 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 03 Sep 2025 12:12:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1108200.1458309 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1utmLf-0001zF-So; Wed, 03 Sep 2025 12:12:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1108200.1458309; Wed, 03 Sep 2025 12:12: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 1utmLf-0001z7-Q3; Wed, 03 Sep 2025 12:12:23 +0000
Received: by outflank-mailman (input) for mailman id 1108200;
 Wed, 03 Sep 2025 12: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 1utmLe-0001yt-Rp
 for xen-changelog@lists.xenproject.org; Wed, 03 Sep 2025 12: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 1utmLe-004Zbq-20
 for xen-changelog@lists.xenproject.org;
 Wed, 03 Sep 2025 12:12:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1utmLe-00EJiq-2a
 for xen-changelog@lists.xenproject.org;
 Wed, 03 Sep 2025 12: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=B+Aa+EcGyDE/cdzQn44T9FoL9WN1IY5B0jl3wJ8e0cM=; b=ZvK+J7LZ2zmAz5lUngGdozaEjh
	/XQgNbCB0OOm5LN7edeom9vQIrrnOLJiJqsRXQNrzWcUpiZu3ZJS0UTdFyp5v/yt3DL4erlWcelve
	IB9NwPyvd4e26Z7G4VCYmCvnoVgcU7o26xIrdBEPDLpMElZ7ZNBsoqoU1Jci4BpRuyI0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.20] hvmloader: fix SMBIOS table length checks
Message-Id: <E1utmLe-00EJiq-2a@xenbits.xenproject.org>
Date: Wed, 03 Sep 2025 12:12:22 +0000

commit 9eb436c4612338c2807c929e87e9b966cca2dc34
Author:     Petr Beneš <w1benny@gmail.com>
AuthorDate: Wed Sep 3 13:58:03 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 3 13:58:03 2025 +0200

    hvmloader: fix SMBIOS table length checks
    
    SMBIOS specification dictates that tables should have a minimal length.
    This commit introduces further validation for user-input SMBIOS tables.
    
    As per SMBIOS Reference Specification:
    * Type 0: For version 2.3 and later implementations, the length is at least 14h
    * Type 1: 1Bh for 2.4 and later
    * Type 2: at least 08h
    * Type 3: 0Dh for version 2.1 and later
    * Type 11: 5h (+ strings)
    * Type 22: 1Ah (+ strings)
    * Type 39: a minimum of 10h
    
    Notably, this also fixes previously incorrect check for chassis handle in
    smbios_type_2_init. Chassis handle is a WORD, therefore, the condition now
    correctly checks for >= 13 instead of > 13.
    
    hvmloader currently implements version 2.4
    
    Furthermore, this commit introduces smbios_pt_copy helper function to substitute
    previously repeating pattern of locating the struct in physical memory (via
    get_smbios_pt_struct), checking the length and copying it into SMBIOS region.
    
    Fixes: 4d23036e7096 ("HVM firmware passthrough SMBIOS processing")
    Signed-off-by: Petr Beneš <w1benny@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    master commit: 2f7d52f0165a5b62dbec1e507d0de427abe9b5d5
    master date: 2025-08-27 11:26:33 +0200
---
 tools/firmware/hvmloader/smbios.c       | 178 +++++++++++++++++++-------------
 tools/firmware/hvmloader/smbios_types.h |  32 +++---
 2 files changed, 123 insertions(+), 87 deletions(-)

diff --git a/tools/firmware/hvmloader/smbios.c b/tools/firmware/hvmloader/smbios.c
index 97a054e9e3..27b242a832 100644
--- a/tools/firmware/hvmloader/smbios.c
+++ b/tools/firmware/hvmloader/smbios.c
@@ -47,6 +47,8 @@ static void
 smbios_pt_init(void);
 static void*
 get_smbios_pt_struct(uint8_t type, uint32_t *length_out);
+static void *
+smbios_pt_copy(void *start, uint8_t type, uint16_t handle, size_t table_size);
 static void
 get_cpu_manufacturer(char *buf, int len);
 static int
@@ -154,6 +156,24 @@ get_smbios_pt_struct(uint8_t type, uint32_t *length_out)
     return NULL;
 }
 
+static void *
+smbios_pt_copy(void *start, uint8_t type, uint16_t handle, size_t min_size)
+{
+    struct smbios_structure_header *header = start;
+    void *pts;
+    uint32_t length;
+
+    pts = get_smbios_pt_struct(type, &length);
+    if ( pts != NULL && length >= min_size )
+    {
+        memcpy(start, pts, length);
+        header->handle = handle;
+        return start + length;
+    }
+
+    return start;
+}
+
 static void
 get_cpu_manufacturer(char *buf, int len)
 {
@@ -381,16 +401,17 @@ smbios_type_0_init(void *start, const char *xen_version,
     struct smbios_type_0 *p = (struct smbios_type_0 *)start;
     static const char *smbios_release_date = __SMBIOS_DATE__;
     const char *s;
-    void *pts;
-    uint32_t length;
+    void *next;
 
-    pts = get_smbios_pt_struct(0, &length);
-    if ( (pts != NULL)&&(length > 0) )
-    {
-        memcpy(start, pts, length);
-        p->header.handle = SMBIOS_HANDLE_TYPE0;
-        return (start + length);
-    }
+    /*
+     * Specification says Type 0 table has length of at least 18h for v2.4-3.0.
+     */
+
+    BUILD_BUG_ON(sizeof(*p) != 24);
+
+    next = smbios_pt_copy(start, 0, SMBIOS_HANDLE_TYPE0, sizeof(*p));
+    if ( next != start )
+        return next;
 
     memset(p, 0, sizeof(*p));
 
@@ -440,16 +461,14 @@ smbios_type_1_init(void *start, const char *xen_version,
     char uuid_str[37];
     struct smbios_type_1 *p = (struct smbios_type_1 *)start;
     const char *s;
-    void *pts;
-    uint32_t length;
+    void *next;
 
-    pts = get_smbios_pt_struct(1, &length);
-    if ( (pts != NULL)&&(length > 0) )
-    {
-        memcpy(start, pts, length);
-        p->header.handle = SMBIOS_HANDLE_TYPE1;
-        return (start + length);
-    }
+    /* Specification says Type 1 table has length of 1Bh for v2.4 and later. */
+    BUILD_BUG_ON(sizeof(*p) != 27);
+
+    next = smbios_pt_copy(start, 1, SMBIOS_HANDLE_TYPE1, sizeof(*p));
+    if ( next != start )
+        return next;
 
     memset(p, 0, sizeof(*p));
 
@@ -498,26 +517,29 @@ smbios_type_2_init(void *start)
 {
     struct smbios_type_2 *p = (struct smbios_type_2 *)start;
     const char *s;
-    uint8_t *ptr;
-    void *pts;
-    uint32_t length;
+    void *next;
     unsigned int counter = 0;
 
-    pts = get_smbios_pt_struct(2, &length);
-    if ( (pts != NULL)&&(length > 0) )
-    {
-        memcpy(start, pts, length);
-        p->header.handle = SMBIOS_HANDLE_TYPE2;
+    /*
+     * Specification says Type 2 table has length of at least 08h,
+     * which corresponds with the end of the "Serial Number" field.
+     */
 
+    BUILD_BUG_ON(endof_field(struct smbios_type_2, serial_number_str) != 8);
+
+    next = smbios_pt_copy(start, 2, SMBIOS_HANDLE_TYPE2,
+                          endof_field(struct smbios_type_2, serial_number_str));
+    if ( next != start )
+    {
         /* Set current chassis handle if present */
-        if ( p->header.length > 13 )
+        if ( p->header.length >= endof_field(struct smbios_type_2,
+                                             chassis_handle) )
         {
-            ptr = ((uint8_t*)start) + 11;            
-            if ( *((uint16_t*)ptr) != 0 )
-                *((uint16_t*)ptr) = SMBIOS_HANDLE_TYPE3;
+            if ( p->chassis_handle != 0 )
+                p->chassis_handle = SMBIOS_HANDLE_TYPE3;
         }
 
-        return (start + length);
+        return next;
     }
 
     memset(p, 0, sizeof(*p));
@@ -593,18 +615,21 @@ smbios_type_3_init(void *start)
 {
     struct smbios_type_3 *p = (struct smbios_type_3 *)start;
     const char *s;
-    void *pts;
-    uint32_t length;
+    void *next;
     uint32_t counter = 0;
 
-    pts = get_smbios_pt_struct(3, &length);
-    if ( (pts != NULL)&&(length > 0) )
-    {
-        memcpy(start, pts, length);
-        p->header.handle = SMBIOS_HANDLE_TYPE3;
-        return (start + length);
-    }
-    
+    /*
+     * Specification says Type 3 table has length of at least 0Dh (for v2.1+),
+     * which corresponds with the end of the "Security Status" field.
+     */
+
+    BUILD_BUG_ON(endof_field(struct smbios_type_3, security_status) != 13);
+
+    next = smbios_pt_copy(start, 3, SMBIOS_HANDLE_TYPE3,
+                          offsetof(struct smbios_type_3, security_status));
+    if ( next != start )
+        return next;
+
     memset(p, 0, sizeof(*p));
 
     p->header.type = 3;
@@ -656,6 +681,9 @@ smbios_type_4_init(
     struct smbios_type_4 *p = (struct smbios_type_4 *)start;
     uint32_t eax, ebx, ecx, edx;
 
+    /* Specification says Type 4 table has length of 23h for v2.3+. */
+    BUILD_BUG_ON(sizeof(*p) != 35);
+
     memset(p, 0, sizeof(*p));
 
     p->header.type = 4;
@@ -707,17 +735,15 @@ smbios_type_11_init(void *start)
     struct smbios_type_11 *p = (struct smbios_type_11 *)start;
     char path[20];
     const char *s;
+    void *next;
     int i;
-    void *pts;
-    uint32_t length;
 
-    pts = get_smbios_pt_struct(11, &length);
-    if ( (pts != NULL)&&(length > 0) )
-    {
-        memcpy(start, pts, length);
-        p->header.handle = SMBIOS_HANDLE_TYPE11;
-        return (start + length);
-    }
+    /* Specification says Type 11 table has length of 05h. */
+    BUILD_BUG_ON(sizeof(*p) != 5);
+    
+    next = smbios_pt_copy(start, 11, SMBIOS_HANDLE_TYPE11, sizeof(*p));
+    if ( next != start )
+        return next;
 
     p->header.type = 11;
     p->header.length = sizeof(struct smbios_type_11);
@@ -756,6 +782,9 @@ smbios_type_16_init(void *start, uint32_t memsize, int nr_mem_devs)
 {
     struct smbios_type_16 *p = (struct smbios_type_16*)start;
 
+    /* Specification says Type 16 table has length of 0Fh for v2.1-2.7. */
+    BUILD_BUG_ON(sizeof(*p) != 15);
+
     memset(p, 0, sizeof(*p));
 
     p->header.type = 16;
@@ -781,6 +810,9 @@ smbios_type_17_init(void *start, uint32_t memory_size_mb, int instance)
     char buf[16];
     struct smbios_type_17 *p = (struct smbios_type_17 *)start;
     
+    /* Specification says Type 17 table has length of 1Bh for v2.3-2.6. */
+    BUILD_BUG_ON(sizeof(*p) != 27);
+
     memset(p, 0, sizeof(*p));
 
     p->header.type = 17;
@@ -816,6 +848,9 @@ smbios_type_19_init(void *start, uint32_t memory_size_mb, int instance)
 {
     struct smbios_type_19 *p = (struct smbios_type_19 *)start;
     
+    /* Specification says Type 19 table has length of 0Fh for v2.1-2.7. */
+    BUILD_BUG_ON(sizeof(*p) != 15);
+
     memset(p, 0, sizeof(*p));
 
     p->header.type = 19;
@@ -838,6 +873,9 @@ smbios_type_20_init(void *start, uint32_t memory_size_mb, int instance)
 {
     struct smbios_type_20 *p = (struct smbios_type_20 *)start;
 
+    /* Specification says Type 20 table has length of 13h for v2.1-2.7. */
+    BUILD_BUG_ON(sizeof(*p) != 19);
+
     memset(p, 0, sizeof(*p));
 
     p->header.type = 20;
@@ -865,16 +903,14 @@ smbios_type_22_init(void *start)
     struct smbios_type_22 *p = (struct smbios_type_22 *)start;
     static const char *smbios_release_date = __SMBIOS_DATE__;
     const char *s;
-    void *pts;
-    uint32_t length;
+    void *next;
 
-    pts = get_smbios_pt_struct(22, &length);
-    if ( (pts != NULL)&&(length > 0) )
-    {
-        memcpy(start, pts, length);
-        p->header.handle = SMBIOS_HANDLE_TYPE22;
-        return (start + length);
-    }
+    /* Specification says Type 22 table has length of 1Ah. */
+    BUILD_BUG_ON(sizeof(*p) != 26);
+
+    next = smbios_pt_copy(start, 22, SMBIOS_HANDLE_TYPE22, sizeof(*p));
+    if ( next != start )
+        return next;
 
     s = xenstore_read(HVM_XS_SMBIOS_DEFAULT_BATTERY, "0");
     if ( strncmp(s, "1", 1) != 0 )
@@ -929,6 +965,9 @@ smbios_type_32_init(void *start)
 {
     struct smbios_type_32 *p = (struct smbios_type_32 *)start;
 
+    /* Specification says Type 32 table has length of at least 0Bh. */
+    BUILD_BUG_ON(sizeof(*p) != 11);
+
     memset(p, 0, sizeof(*p));
 
     p->header.type = 32;
@@ -946,20 +985,17 @@ smbios_type_32_init(void *start)
 static void *
 smbios_type_39_init(void *start)
 {
-    struct smbios_type_39 *p = (struct smbios_type_39 *)start;
-    void *pts;
-    uint32_t length;
+    /*
+     * Specification says Type 39 table has length of at least 10h,
+     * which corresponds with the end of the "Characteristics" field.
+     *
+     * Only present when passed in.
+     */
 
-    pts = get_smbios_pt_struct(39, &length);
-    if ( (pts != NULL)&&(length > 0) )
-    {
-        memcpy(start, pts, length);
-        p->header.handle = SMBIOS_HANDLE_TYPE39;
-        return (start + length);
-    }
+    BUILD_BUG_ON(endof_field(struct smbios_type_39, characteristics) != 16);
 
-    /* Only present when passed in */
-    return start;
+    return smbios_pt_copy(start, 39, SMBIOS_HANDLE_TYPE39,
+                          endof_field(struct smbios_type_39, characteristics));
 }
 
 static void *
diff --git a/tools/firmware/hvmloader/smbios_types.h b/tools/firmware/hvmloader/smbios_types.h
index 7c648ece71..a04d194975 100644
--- a/tools/firmware/hvmloader/smbios_types.h
+++ b/tools/firmware/hvmloader/smbios_types.h
@@ -90,13 +90,13 @@ struct smbios_type_2 {
     uint8_t product_name_str;
     uint8_t version_str;
     uint8_t serial_number_str;
-    uint8_t asset_tag_str;
-    uint8_t feature_flags;
-    uint8_t location_in_chassis_str;
-    uint16_t chassis_handle;
-    uint8_t board_type;
-    uint8_t contained_handle_count;
-    uint16_t contained_handles[];
+    uint8_t asset_tag_str;                  /* Optional */
+    uint8_t feature_flags;                  /* Optional */
+    uint8_t location_in_chassis_str;        /* Optional */
+    uint16_t chassis_handle;                /* Optional */
+    uint8_t board_type;                     /* Optional */
+    uint8_t contained_handle_count;         /* Optional */
+    uint16_t contained_handles[];           /* Optional */
 } __attribute__ ((packed));
 
 /* System Enclosure - Contained Elements */
@@ -118,12 +118,12 @@ struct smbios_type_3 {
     uint8_t power_supply_state;
     uint8_t thermal_state;
     uint8_t security_status;
-    uint32_t oem_specific;
-    uint8_t height;
-    uint8_t number_of_power_cords;
-    uint8_t contained_element_count;
-    uint8_t contained_element_length;
-    struct smbios_contained_element contained_elements[];
+    uint32_t oem_specific;                  /* Optional */
+    uint8_t height;                         /* Optional */
+    uint8_t number_of_power_cords;          /* Optional */
+    uint8_t contained_element_count;        /* Optional */
+    uint8_t contained_element_length;       /* Optional */
+    struct smbios_contained_element contained_elements[]; /* Optional */
 } __attribute__ ((packed));
 
 /* SMBIOS type 4 - Processor Information */
@@ -252,9 +252,9 @@ struct smbios_type_39 {
     uint8_t revision_level_str;
     uint16_t max_capacity;
     uint16_t characteristics;
-    uint16_t input_voltage_probe_handle;
-    uint16_t cooling_device_handle;
-    uint16_t input_current_probe_handle;
+    uint16_t input_voltage_probe_handle;    /* Optional */
+    uint16_t cooling_device_handle;         /* Optional */
+    uint16_t input_current_probe_handle;    /* Optional */
 } __attribute__ ((packed));
 
 /* SMBIOS type 127 -- End-of-table */
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.20


From xen-changelog-bounces@lists.xenproject.org Wed Sep 03 12:12:34 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 03 Sep 2025 12:12:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1108201.1458313 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1utmLq-00021d-Uf; Wed, 03 Sep 2025 12:12:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1108201.1458313; Wed, 03 Sep 2025 12: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 1utmLq-00021V-Rj; Wed, 03 Sep 2025 12:12:34 +0000
Received: by outflank-mailman (input) for mailman id 1108201;
 Wed, 03 Sep 2025 12:12: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 1utmLo-00021D-UU
 for xen-changelog@lists.xenproject.org; Wed, 03 Sep 2025 12:12: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 1utmLo-004Zbu-2I
 for xen-changelog@lists.xenproject.org;
 Wed, 03 Sep 2025 12:12:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1utmLo-00EJjU-2r
 for xen-changelog@lists.xenproject.org;
 Wed, 03 Sep 2025 12:12: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=dQ9KISswr5Ix3yNgPMJ8QpEqzPZcRQn5x3xctWu60FM=; b=eSiSm5AZlEHvdMmtqhAO5qUm6a
	pjnUsWO3jOpsxxZeCo5QRasHrsYu9/MtVZ1NEiTdzzWqf/4Knj1XnlFo984eHTGDs7uDiAI3gNy5R
	GhcSq5koIt90JkxPJP5wWJXLPUbso1Bzo4ZDW2i3Ggh6V9/f5ZBFY6AOHbfkumCQk6qM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.20] xen/efi: Fix crash with initial empty EFI options
Message-Id: <E1utmLo-00EJjU-2r@xenbits.xenproject.org>
Date: Wed, 03 Sep 2025 12:12:32 +0000

commit eb1dc440b2ca18acbf98dadbcc208e4a21dc4f8b
Author:     Frediano Ziglio <frediano.ziglio@cloud.com>
AuthorDate: Wed Sep 3 13:58:31 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 3 13:58:31 2025 +0200

    xen/efi: Fix crash with initial empty EFI options
    
    EFI code path split options from EFI LoadOptions fields in 2
    pieces, first EFI options, second Xen options.
    "get_argv" function is called first to get the number of arguments
    in the LoadOptions, second, after allocating enough space, to
    fill some "argc"/"argv" variable. However the first parsing could
    be different from second as second is able to detect "--" argument
    separator. So it was possible that "argc" was bigger than the
    initialized portion of "argv" array, leading to potential
    uninitialized pointer dereference, in particular a string like
    "-- a b c" would lead to crashes.
    Using EFI shell is possible to pass any kind of string in
    LoadOptions.
    
    Fixes: bf6501a62e80 ("x86-64: EFI boot code")
    Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
    Reviewed-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    master commit: 375f0dd538072ae33b14c52465f94ecbd83625dc
    master date: 2025-09-01 13:07:01 +0200
---
 xen/common/efi/boot.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c
index 01062bb39f..04d4bbd801 100644
--- a/xen/common/efi/boot.c
+++ b/xen/common/efi/boot.c
@@ -327,10 +327,11 @@ static unsigned int __init get_argv(unsigned int argc, CHAR16 **argv,
 
     if ( argc )
     {
+        argc = 0;
         cmdline = data + *offset;
         /* EFI_LOAD_OPTION does not supply an image name as first component. */
         if ( *offset )
-            *argv++ = NULL;
+            argv[argc++] = NULL;
     }
     else if ( size > sizeof(*cmdline) && !(size % sizeof(*cmdline)) &&
               (wmemchr(data, 0, size / sizeof(*cmdline)) ==
@@ -391,14 +392,14 @@ static unsigned int __init get_argv(unsigned int argc, CHAR16 **argv,
                 ++argc;
             else if ( prev && wstrcmp(prev, L"--") == 0 )
             {
-                --argv;
+                --argc;
                 if ( options )
                     *options = cmdline;
                 break;
             }
             else
             {
-                *argv++ = prev = ptr;
+                argv[argc++] = prev = ptr;
                 *ptr = *cmdline;
                 *++ptr = 0;
             }
@@ -406,7 +407,7 @@ static unsigned int __init get_argv(unsigned int argc, CHAR16 **argv,
         prev_sep = cur_sep;
     }
     if ( argv )
-        *argv = NULL;
+        argv[argc] = NULL;
     return argc;
 }
 
@@ -1302,8 +1303,8 @@ void EFIAPI __init noreturn efi_start(EFI_HANDLE ImageHandle,
                                   (argc + 1) * sizeof(*argv) +
                                       loaded_image->LoadOptionsSize,
                                   (void **)&argv) == EFI_SUCCESS )
-            get_argv(argc, argv, loaded_image->LoadOptions,
-                     loaded_image->LoadOptionsSize, &offset, &options);
+            argc = get_argv(argc, argv, loaded_image->LoadOptions,
+                            loaded_image->LoadOptionsSize, &offset, &options);
         else
             argc = 0;
         for ( i = 1; i < argc; ++i )
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.20


From xen-changelog-bounces@lists.xenproject.org Wed Sep 03 12:12:45 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 03 Sep 2025 12:12:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1108202.1458317 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1utmM0-00023x-Vl; Wed, 03 Sep 2025 12:12:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1108202.1458317; Wed, 03 Sep 2025 12: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 1utmM0-00023p-T7; Wed, 03 Sep 2025 12:12:44 +0000
Received: by outflank-mailman (input) for mailman id 1108202;
 Wed, 03 Sep 2025 12: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 1utmLz-00023b-0i
 for xen-changelog@lists.xenproject.org; Wed, 03 Sep 2025 12: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 1utmLy-004Zby-2X
 for xen-changelog@lists.xenproject.org;
 Wed, 03 Sep 2025 12:12:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1utmLy-00EJkN-38
 for xen-changelog@lists.xenproject.org;
 Wed, 03 Sep 2025 12:12: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=IsCIG8G8WmPpXLQ9dhpDd7NYf7VfLogOMbZ5TXkOmO8=; b=BwaoknlZTOzAElDqKac3GsAYyy
	as4ettt+eKHgF69ElrtmQrqSx+K7XzYYB4gRQ0bLWW452cjPQMVsC0o8UI3+d/qR7BqUJZsXwX/PC
	q6BWSfcAS1I+l/RQFasp6x/Sc6nPRZ5xGZ7c+34FYpBJK+J6VRjMwRalFs7BJW+2uopI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.20] x86/gen-cpuid: correct cycle detection
Message-Id: <E1utmLy-00EJkN-38@xenbits.xenproject.org>
Date: Wed, 03 Sep 2025 12:12:42 +0000

commit 24fef7a86f668a6d46881bf32a85e8ab10b32740
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Sep 3 13:58:55 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 3 13:58:55 2025 +0200

    x86/gen-cpuid: correct cycle detection
    
    With the processing done linearly (rather than recursively), checking
    whether any of the features was previously seen is wrong: That would
    e.g. trigger for this simple set of dependencies
    
        X: [A, B]
        A: [C]
        B: [C]
    
    (observed in reality when making AMX-AVX512 dependent upon both
    AMX-TILE and AVX512F, causing XSAVE to see AMX-AVX512 twice in its list
    of dependents). But checking the whole accumulated set also isn't
    necessary - just checking the feature we're processing dependents of is
    sufficient. We may detect a cycle later that way, but we still will
    detect it. What we need to avoid is adding a feature again when we've
    already seen it.
    
    As a result, seeding "seen[]" with "feat" isn't necessary anymore.
    
    Fixes: fe4408d180f4 ("xen/x86: Generate deep dependencies of features")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 3999ff0d307a9a901ad1b5ad56e0dde657fec558
    master date: 2025-09-01 13:07:53 +0200
---
 xen/tools/gen-cpuid.py | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/xen/tools/gen-cpuid.py b/xen/tools/gen-cpuid.py
index 163b105bc6..98327d0144 100755
--- a/xen/tools/gen-cpuid.py
+++ b/xen/tools/gen-cpuid.py
@@ -350,7 +350,7 @@ def crunch_numbers(state):
 
     for feat in deep_features:
 
-        seen = [feat]
+        seen = []
         to_process = list(deps[feat])
 
         while len(to_process):
@@ -363,14 +363,17 @@ def crunch_numbers(state):
 
             f = to_process.pop(0)
 
+            if f == feat:
+                raise Fail("ERROR: Cycle found when processing %s" %
+                           (state.names[f], ))
+
             if f in seen:
-                raise Fail("ERROR: Cycle found with %s when processing %s"
-                           % (state.names[f], state.names[feat]))
+                continue
 
             seen.append(f)
             to_process = list(set(to_process + deps.get(f, [])))
 
-        state.deep_deps[feat] = seen[1:]
+        state.deep_deps[feat] = seen
 
     state.deep_features = deps.keys()
     state.nr_deep_deps = len(state.deep_deps.keys())
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.20


From xen-changelog-bounces@lists.xenproject.org Wed Sep 03 12:12:55 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 03 Sep 2025 12:12:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1108203.1458321 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1utmMB-00026P-1j; Wed, 03 Sep 2025 12:12:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1108203.1458321; Wed, 03 Sep 2025 12:12: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 1utmMA-00026H-US; Wed, 03 Sep 2025 12:12:54 +0000
Received: by outflank-mailman (input) for mailman id 1108203;
 Wed, 03 Sep 2025 12: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 1utmM9-000261-3X
 for xen-changelog@lists.xenproject.org; Wed, 03 Sep 2025 12: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 1utmM8-004Zcp-2o
 for xen-changelog@lists.xenproject.org;
 Wed, 03 Sep 2025 12:12:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1utmM9-00EJlL-0A
 for xen-changelog@lists.xenproject.org;
 Wed, 03 Sep 2025 12: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=OqF282yBH+pkDM88EPtKheQWZ+LDcfKq0xHadAe7pPE=; b=dTCTgi0YIJiMGn/t2ZPPxxnD8P
	Rg6WoZJgqs8OLaEuEyaG9maBSOBUTPdN3Fi+WqcRmiqAR7XV/jbyqGPb0mFSgl9h1aRKXchQSGJSx
	NGFOmFesCErA/qn1M7T/KaM/Szsk3bcZCe/jKTcFD57RoUKqlRp5V3wyU+KYYo67JmdE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.20] x86/gen-cpuid: Fix debugging for cycle detection
Message-Id: <E1utmM9-00EJlL-0A@xenbits.xenproject.org>
Date: Wed, 03 Sep 2025 12:12:53 +0000

commit c59a69ae9ebdebb83298578030ddc79c8c9d56cc
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Sep 3 13:59:33 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 3 13:59:33 2025 +0200

    x86/gen-cpuid: Fix debugging for cycle detection
    
    Jan reports the following exception when using the cycle debugging:
    
      Feature IBRSB, seen [IBRSB, STIBP, INTEL_PSFD, EIBRS, IPRED_CTRL, RRSBA_CTRL, RRSBA, BHI_CTRL], to_process [SSBD]
      Traceback (most recent call last):
        File "/local/xen.git/xen/../xen/tools/gen-cpuid.py", line 594, in <module>
          sys.exit(main())
                   ^^^^^^
        File "/local/xen.git/xen/../xen/tools/gen-cpuid.py", line 588, in main
          crunch_numbers(state)
        File "/local/xen.git/xen/../xen/tools/gen-cpuid.py", line 366, in crunch_numbers
          (state.names[feat], repl(seen), repl(to_process)))
                                          ^^^^^^^^^^^^^^^^
        File "/local/xen.git/xen/../xen/tools/gen-cpuid.py", line 364, in repl
          return "[" + ", ".join((state.names[x] for x in l)) + "]"
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/local/xen.git/xen/../xen/tools/gen-cpuid.py", line 364, in <genexpr>
          return "[" + ", ".join((state.names[x] for x in l)) + "]"
                                  ~~~~~~~~~~~^^^
      KeyError: 534
      make[2]: *** [/local/xen.git/xen/include/xen/lib/x86/Makefile:9: cpuid-autogen.h] Error 1
    
    This is caused by commit ce8c930851a5 ("x86/cpu-policy: MSR_ARCH_CAPS feature
    names") being rather lazy and marking dependenices on unknown features.
    
    Introduce a helper to pick the known features in a range, and use it for
    ARCH_CAPS.
    
    Additionally, remove trailing whitespace and an unnecessary line continuation
    from the debug print.
    
    Reported-by: Jan Beulich <jbeulich@suse.com>
    Fixes: ce8c930851a5 ("x86/cpu-policy: MSR_ARCH_CAPS feature names")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    master commit: 5edb4ccff6a13ea10d1c1888942dff0c868c7844
    master date: 2025-09-01 19:54:21 +0100
---
 xen/tools/gen-cpuid.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/xen/tools/gen-cpuid.py b/xen/tools/gen-cpuid.py
index 98327d0144..cd0c87a048 100755
--- a/xen/tools/gen-cpuid.py
+++ b/xen/tools/gen-cpuid.py
@@ -168,6 +168,10 @@ def crunch_numbers(state):
     state.hvm_shadow_max = state.pv_max         | state.raw['S'] | state.raw['s']
     state.hvm_hap_max =    state.hvm_shadow_max | state.raw['H'] | state.raw['h']
 
+    def feat_range(start, last):
+        """ Select all known features in the given range """
+        return [ x for x in state.names.keys() if start <= x <= last ]
+
     #
     # Feature dependency information.
     #
@@ -334,7 +338,7 @@ def crunch_numbers(state):
         PSFD: [EPSF],
 
         # The ARCH_CAPS CPUID bit enumerates the availability of the whole register.
-        ARCH_CAPS: list(range(RDCL_NO, RDCL_NO + 64)),
+        ARCH_CAPS: feat_range(RDCL_NO, RDCL_NO + 63),
 
         # The behaviour described by RRSBA depend on eIBRS being active.
         EIBRS: [RRSBA],
@@ -358,7 +362,7 @@ def crunch_numbers(state):
             # To debug, uncomment the following lines:
             # def repl(l):
             #     return "[" + ", ".join((state.names[x] for x in l)) + "]"
-            # sys.stderr.write("Feature %s, seen %s, to_process %s \n" % \
+            # sys.stderr.write("Feature %s, seen %s, to_process %s\n" %
             #     (state.names[feat], repl(seen), repl(to_process)))
 
             f = to_process.pop(0)
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.20


From xen-changelog-bounces@lists.xenproject.org Wed Sep 03 12:13:05 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 03 Sep 2025 12:13:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1108205.1458325 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1utmML-00029n-4c; Wed, 03 Sep 2025 12:13:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1108205.1458325; Wed, 03 Sep 2025 12:13: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 1utmML-00029g-1z; Wed, 03 Sep 2025 12:13:05 +0000
Received: by outflank-mailman (input) for mailman id 1108205;
 Wed, 03 Sep 2025 12:13: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 1utmMJ-00029S-KQ
 for xen-changelog@lists.xenproject.org; Wed, 03 Sep 2025 12:13: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 1utmMJ-004Zf0-1H
 for xen-changelog@lists.xenproject.org;
 Wed, 03 Sep 2025 12:13:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1utmMJ-00EJni-1r
 for xen-changelog@lists.xenproject.org;
 Wed, 03 Sep 2025 12:13: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=4iQ/MaEzjeernaoTUQ0ESvdOB1ByRP/I9uKcuYfBHa0=; b=g390BuNs2hKCnoqsNQk4a+n3qA
	Yrtk1IUCSUmbcCE/11UncxLBypHJ41fEx8QqZ48uRm21qCeF5XhHAIGvl/qqY3dLVrHCowcmCVtxR
	SCLUEgFNXMC1Y5DpBjMEcPN5I/FknkYVBxvqx/uDrNtrmZFwD3F9YU+67FiZmh+OSqoU=;
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.4-pre
Message-Id: <E1utmMJ-00EJni-1r@xenbits.xenproject.org>
Date: Wed, 03 Sep 2025 12:13:03 +0000

commit 7f149db6e8b71798e9502fd09a4a843b665748a8
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Sep 3 14:04:06 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 3 14:04:06 2025 +0200

    update Xen version to 4.19.4-pre
---
 xen/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/Makefile b/xen/Makefile
index df5319fdee..4201eb4d16 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 ?= .3$(XEN_VENDORVERSION)
+export XEN_EXTRAVERSION ?= .4-pre$(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 Wed Sep 03 12:13:15 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 03 Sep 2025 12:13:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1108206.1458328 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1utmMV-0002CD-6T; Wed, 03 Sep 2025 12:13:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1108206.1458328; Wed, 03 Sep 2025 12:13: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 1utmMV-0002C5-3b; Wed, 03 Sep 2025 12:13:15 +0000
Received: by outflank-mailman (input) for mailman id 1108206;
 Wed, 03 Sep 2025 12:13: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 1utmMT-0002Bt-Mv
 for xen-changelog@lists.xenproject.org; Wed, 03 Sep 2025 12:13: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 1utmMT-004ZfA-1X
 for xen-changelog@lists.xenproject.org;
 Wed, 03 Sep 2025 12:13:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1utmMT-00EJoU-27
 for xen-changelog@lists.xenproject.org;
 Wed, 03 Sep 2025 12:13: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=puUZy0xG9zYfVMJ59/GRYkBhM/4E/XNlTXyvXBOI9Qo=; b=IgZkA06Wn/OA5xv8YtoB2tsmwJ
	qy/cEMZpMSXNbVgS4YjZxgPKMNbh2OL3L2D8mBDre0k7jtmxJJhaBgien/7zwpiocfKifnJjTt9i5
	WD89Fn6uyANeLpxPMXw6oDzaRqlrxbkitU12Lm9kkIeWJsIiO4awcD5hkz+RiDtjaFSc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] x86/hpet: do local APIC EOI after interrupt processing
Message-Id: <E1utmMT-00EJoU-27@xenbits.xenproject.org>
Date: Wed, 03 Sep 2025 12:13:13 +0000

commit 8b6383f53184156ea7dcdc53ed943bdfc5c1ec83
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Sep 3 14:04:29 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 3 14:04:29 2025 +0200

    x86/hpet: do local APIC EOI after interrupt processing
    
    The current logic in the HPET interrupt ->ack() hook will perform a local
    APIC EOI ahead of enabling interrupts, possibly leading to recursion in the
    interrupt handler.
    
    Fix this by doing the local APIC EOI strictly after the window with
    interrupt enabled, as that prevents the recursion, and would only allow for
    interrupts with higher priority to be serviced.
    
    Use the generic ack_nonmaskable_msi_irq() and end_nonmaskable_irq()
    functions, removing the need for hpet_msi_ack().
    
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Fixes: 3ba523ff957c ('CPUIDLE: enable MSI capable HPET for timer broadcast')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 1db7829e56578970c1037c4dd1c27f939be4c054
    master date: 2025-08-06 10:47:16 +0200
---
 xen/arch/x86/hpet.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/xen/arch/x86/hpet.c b/xen/arch/x86/hpet.c
index 84f820fef6..9727bcd163 100644
--- a/xen/arch/x86/hpet.c
+++ b/xen/arch/x86/hpet.c
@@ -298,13 +298,6 @@ static unsigned int cf_check hpet_msi_startup(struct irq_desc *desc)
 
 #define hpet_msi_shutdown hpet_msi_mask
 
-static void cf_check hpet_msi_ack(struct irq_desc *desc)
-{
-    irq_complete_move(desc);
-    move_native_irq(desc);
-    ack_APIC_irq();
-}
-
 static void cf_check hpet_msi_set_affinity(
     struct irq_desc *desc, const cpumask_t *mask)
 {
@@ -332,7 +325,8 @@ static hw_irq_controller hpet_msi_type = {
     .shutdown   = hpet_msi_shutdown,
     .enable	    = hpet_msi_unmask,
     .disable    = hpet_msi_mask,
-    .ack        = hpet_msi_ack,
+    .ack        = ack_nonmaskable_msi_irq,
+    .end        = end_nonmaskable_irq,
     .set_affinity   = hpet_msi_set_affinity,
 };
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Sep 03 12:13:25 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 03 Sep 2025 12:13:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1108207.1458333 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1utmMf-0002EZ-7l; Wed, 03 Sep 2025 12:13:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1108207.1458333; Wed, 03 Sep 2025 12:13: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 1utmMf-0002ER-53; Wed, 03 Sep 2025 12:13:25 +0000
Received: by outflank-mailman (input) for mailman id 1108207;
 Wed, 03 Sep 2025 12:13: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 1utmMd-0002EH-Q2
 for xen-changelog@lists.xenproject.org; Wed, 03 Sep 2025 12:13: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 1utmMd-004ZfE-1q
 for xen-changelog@lists.xenproject.org;
 Wed, 03 Sep 2025 12:13:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1utmMd-00EJpR-2O
 for xen-changelog@lists.xenproject.org;
 Wed, 03 Sep 2025 12:13: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=e+MhMKaoPIb2V8skbhdlJelSvPBbJM+9a2ee6iJXVvo=; b=OKp9LaMZhzag/MPifoemjUazJ8
	9g/KeuPEr3xrnUxgs4SU4gyN0v6wQWzBc9yNJV4ujId6T+ZgxXGxa/HxiA3P+YKXoWb2i+hQO0NJ5
	vmHaEfaVS6hWRQ1bh6vcyHZJdbHcnfsZ6p7pDyK7TGeQy4FDNVWsFoR/T8GF0VS/Q0+E=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] efi: Call FreePages() only if needed
Message-Id: <E1utmMd-00EJpR-2O@xenbits.xenproject.org>
Date: Wed, 03 Sep 2025 12:13:23 +0000

commit 6aaca5200bac1a4536151dbaab5ec46b1729b3a1
Author:     Ross Lagerwall <ross.lagerwall@citrix.com>
AuthorDate: Wed Sep 3 14:04:57 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 3 14:04:57 2025 +0200

    efi: Call FreePages() only if needed
    
    If the config file is builtin, cfg.addr will be zero but Xen
    unconditionally calls FreePages() on the address.
    
    Xen may also call FreePages() with a zero address if blexit() is called
    after this point since cfg.need_to_free is not set to false.
    
    The UEFI specification does not say whether calling FreePages() with a
    zero address is allowed so let's be cautious and use cfg.need_to_free
    properly.
    
    Fixes: 8a71d50ed40b ("efi: Enable booting unified hypervisor/kernel/initrd images")
    Fixes: 04be2c3a0678 ("efi/boot.c: add file.need_to_free")
    Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by Daniel P. Smith <dpsmith@apertussolutions.com>
    master commit: 7fddedd530561797d8ce5fba78e83cc9cc6b58dd
    master date: 2025-08-12 11:40:28 +0200
---
 xen/common/efi/boot.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c
index efbec00af9..01062bb39f 100644
--- a/xen/common/efi/boot.c
+++ b/xen/common/efi/boot.c
@@ -1484,8 +1484,11 @@ void EFIAPI __init noreturn efi_start(EFI_HANDLE ImageHandle,
 
         efi_arch_cfg_file_late(loaded_image, dir_handle, section.s);
 
-        efi_bs->FreePages(cfg.addr, PFN_UP(cfg.size));
-        cfg.addr = 0;
+        if ( cfg.need_to_free )
+        {
+            efi_bs->FreePages(cfg.addr, PFN_UP(cfg.size));
+            cfg.need_to_free = false;
+        }
 
         dir_handle->Close(dir_handle);
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Sep 03 12:13:34 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 03 Sep 2025 12:13:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1108208.1458337 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1utmMo-0002Gz-9H; Wed, 03 Sep 2025 12:13:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1108208.1458337; Wed, 03 Sep 2025 12:13: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 1utmMo-0002Gr-6b; Wed, 03 Sep 2025 12:13:34 +0000
Received: by outflank-mailman (input) for mailman id 1108208;
 Wed, 03 Sep 2025 12:13: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 1utmMn-0002Gh-Sf
 for xen-changelog@lists.xenproject.org; Wed, 03 Sep 2025 12:13: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 1utmMn-004ZfN-26
 for xen-changelog@lists.xenproject.org;
 Wed, 03 Sep 2025 12:13:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1utmMn-00EJqQ-2i
 for xen-changelog@lists.xenproject.org;
 Wed, 03 Sep 2025 12:13: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=ATqOrAQuXw4x0AscpdVtt07V+oZuil8U8KuGEwL/Ycs=; b=iiTCB2pxf2NRHXjmr/1UNgRqGj
	Ebb+Pl3ZVFLQEQ8bvW+pNgPU4DOdUKhpeiS2sJZWmOiPCOKgDvABnvygS5UML1P66Io/W1yXG6auw
	3msf3m6whDkcpd0uCEyzsW7K60OsOJrs9cFz1LJo60cGQgJj9YtYiF/JuEYXHbaJEfwo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] x86/mkelf32: pad load segment to 2Mb boundary
Message-Id: <E1utmMn-00EJqQ-2i@xenbits.xenproject.org>
Date: Wed, 03 Sep 2025 12:13:33 +0000

commit 9876248a545f356b44580d5b604188a63bc46ca5
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Sep 3 14:05:18 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 3 14:05:18 2025 +0200

    x86/mkelf32: pad load segment to 2Mb boundary
    
    In order to legitimately set up initial mappings past _end[], we need
    to make sure that the entire mapped range is inside a RAM region.
    Therefore we need to inform the bootloader (or alike) that our allocated
    size is larger than just the next SECTION_ALIGN-ed boundary past _end[].
    
    This allows dropping a command line option from the tool, which was
    introduced to work around a supposed linker bug, when the problem was
    really Xen's.
    
    While adjusting adjacent code, correct the argc check to also cover the
    case correctly when --notes was passed.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 4fb075201f54b16c0800af0107162461a93065fb
    master date: 2025-08-18 10:42:24 +0200
---
 xen/arch/x86/Makefile       |  3 +--
 xen/arch/x86/boot/mkelf32.c | 18 +++++++++++-------
 2 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile
index 27806a81ac..66bc43456b 100644
--- a/xen/arch/x86/Makefile
+++ b/xen/arch/x86/Makefile
@@ -125,8 +125,7 @@ orphan-handling-$(call ld-option,--orphan-handling=warn) += --orphan-handling=wa
 
 $(TARGET): TMP = $(dot-target).elf32
 $(TARGET): $(TARGET)-syms $(efi-y) $(obj)/boot/mkelf32
-	$(obj)/boot/mkelf32 $(notes_phdrs) $(TARGET)-syms $(TMP) $(XEN_IMG_OFFSET) \
-	               `$(NM) $(TARGET)-syms | sed -ne 's/^\([^ ]*\) . __2M_rwdata_end$$/0x\1/p'`
+	$(obj)/boot/mkelf32 $(notes_phdrs) $(TARGET)-syms $(TMP) $(XEN_IMG_OFFSET)
 	od -t x4 -N 8192 $(TMP)  | grep 1badb002 > /dev/null || \
 		{ echo "No Multiboot1 header found" >&2; false; }
 	od -t x4 -N 32768 $(TMP) | grep e85250d6 > /dev/null || \
diff --git a/xen/arch/x86/boot/mkelf32.c b/xen/arch/x86/boot/mkelf32.c
index 7b90338ca8..f9ca047efa 100644
--- a/xen/arch/x86/boot/mkelf32.c
+++ b/xen/arch/x86/boot/mkelf32.c
@@ -256,7 +256,6 @@ static void do_read(int fd, void *data, int len)
 
 int main(int argc, char **argv)
 {
-    u64        final_exec_addr;
     u32        loadbase, dat_siz, mem_siz, note_base, note_sz, offset;
     char      *inimage, *outimage;
     int        infd, outfd;
@@ -269,22 +268,24 @@ int main(int argc, char **argv)
     Elf64_Ehdr in64_ehdr;
     Elf64_Phdr in64_phdr;
 
-    if ( argc < 5 )
+    if ( argc < 4 )
     {
+    help:
         fprintf(stderr, "Usage: mkelf32 [--notes] <in-image> <out-image> "
-                "<load-base> <final-exec-addr>\n");
+                "<load-base>\n");
         return 1;
     }
 
     if ( !strcmp(argv[1], "--notes") )
     {
+        if ( argc < 5 )
+            goto help;
         i = 2;
         num_phdrs = 2;
     }
     inimage  = argv[i++];
     outimage = argv[i++];
     loadbase = strtoul(argv[i++], NULL, 16);
-    final_exec_addr = strtoull(argv[i++], NULL, 16);
 
     infd = open(inimage, O_RDONLY);
     if ( infd == -1 )
@@ -347,9 +348,12 @@ int main(int argc, char **argv)
     (void)lseek(infd, in64_phdr.p_offset, SEEK_SET);
     dat_siz = (u32)in64_phdr.p_filesz;
 
-    /* Do not use p_memsz: it does not include BSS alignment padding. */
-    /*mem_siz = (u32)in64_phdr.p_memsz;*/
-    mem_siz = (u32)(final_exec_addr - in64_phdr.p_vaddr);
+    /*
+     * We don't pad .bss in the linker script, but during early boot we map
+     * the Xen image using 2M pages.  To avoid running into adjacent non-RAM
+     * regions, pad the segment to the next 2M boundary.
+     */
+    mem_siz = ((uint32_t)in64_phdr.p_memsz + (1U << 20) - 1) & (-1U << 20);
 
     note_sz = note_base = offset = 0;
     if ( num_phdrs > 1 )
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Sep 03 12:13:44 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 03 Sep 2025 12:13:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1108209.1458341 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1utmMy-0002JO-Aq; Wed, 03 Sep 2025 12:13:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1108209.1458341; Wed, 03 Sep 2025 12:13: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 1utmMy-0002JG-83; Wed, 03 Sep 2025 12:13:44 +0000
Received: by outflank-mailman (input) for mailman id 1108209;
 Wed, 03 Sep 2025 12:13: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 1utmMx-0002J6-VE
 for xen-changelog@lists.xenproject.org; Wed, 03 Sep 2025 12:13: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 1utmMx-004ZfU-2M
 for xen-changelog@lists.xenproject.org;
 Wed, 03 Sep 2025 12:13:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1utmMx-00EJr6-2w
 for xen-changelog@lists.xenproject.org;
 Wed, 03 Sep 2025 12:13: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=mYzbZbzXqIo4RpK4e4HVrYQ9U8B6lIVSYoE78zs2RJI=; b=vl8Xn4FEFG2x6jSF7/dRRWchg8
	DFhV0QCsUJ6fk2UlAgpU/6QIwzWB/ojHP0vAJJWNNj7Wampt3/fQLuQ6Z+PFqmegosMpogVyUqLZ7
	oAuuIMBi8T6M+pKEujJcgUQkvZI+eHAuLV6O6g18GOYobA8LVckdS/bQDtOMQgG6f/wE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] x86/hvm/ioreq: Fix condition in hvm_alloc_legacy_ioreq_gfn()
Message-Id: <E1utmMx-00EJr6-2w@xenbits.xenproject.org>
Date: Wed, 03 Sep 2025 12:13:43 +0000

commit 0e0e09205d9a2ab94dc4bc4d40bc65d2ceb6fb95
Author:     Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
AuthorDate: Wed Sep 3 14:05:34 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 3 14:05:34 2025 +0200

    x86/hvm/ioreq: Fix condition in hvm_alloc_legacy_ioreq_gfn()
    
    Fix the incorrect condition that causes hvm_alloc_legacy_ioreq_gfn()
    to return INVALID_GFN even if the HVM param was installed properly by
    the toolstack.
    
    Fixes: 3486f398a3dd (' x86/hvm/ioreq: allow ioreq servers to use HVM_PARAM_[BUF]IOREQ_PFN')
    Signed-off-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 282ed258a59195698a81ab4408a17336eb6ea7ed
    master date: 2025-08-18 10:43:52 +0200
---
 xen/arch/x86/hvm/ioreq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/hvm/ioreq.c b/xen/arch/x86/hvm/ioreq.c
index 4eb7a70182..549e652657 100644
--- a/xen/arch/x86/hvm/ioreq.c
+++ b/xen/arch/x86/hvm/ioreq.c
@@ -61,7 +61,7 @@ static gfn_t hvm_alloc_legacy_ioreq_gfn(struct ioreq_server *s)
 
     for ( i = HVM_PARAM_IOREQ_PFN; i <= HVM_PARAM_BUFIOREQ_PFN; i++ )
     {
-        if ( !test_and_clear_bit(i, &d->arch.hvm.ioreq_gfn.legacy_mask) )
+        if ( test_and_clear_bit(i, &d->arch.hvm.ioreq_gfn.legacy_mask) )
             return _gfn(d->arch.hvm.params[i]);
     }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Sep 03 12:13:54 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 03 Sep 2025 12:13:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1108210.1458345 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1utmN8-0002Ly-C3; Wed, 03 Sep 2025 12:13:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1108210.1458345; Wed, 03 Sep 2025 12:13: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 1utmN8-0002Lq-9V; Wed, 03 Sep 2025 12:13:54 +0000
Received: by outflank-mailman (input) for mailman id 1108210;
 Wed, 03 Sep 2025 12:13: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 1utmN8-0002Lg-1g
 for xen-changelog@lists.xenproject.org; Wed, 03 Sep 2025 12:13: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 1utmN7-004Zfb-2d
 for xen-changelog@lists.xenproject.org;
 Wed, 03 Sep 2025 12:13:54 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1utmN7-00EJsn-3D
 for xen-changelog@lists.xenproject.org;
 Wed, 03 Sep 2025 12:13: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=8LrAAfkTjyIyHQOeqfPjVJUyjZ7tAuZGRd27rCM+JLI=; b=gVeD2ErMPgr0VjQic6t3wyOVz7
	+fm8krcQ0NHECmMDi+KzizhGTQYpHhqKTnSyxLbT7s8+Himp5WJPCyWtSpaATxBBkVI0zoTNCTb9x
	DcaLbPfH6CEQDfIJs/DWX3sn0KmNye9I8oAYXr9NsAuLayra1OQIN7yQSSjIC5hPR2yI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] x86/iommu: setup MMCFG ahead of IOMMU
Message-Id: <E1utmN7-00EJsn-3D@xenbits.xenproject.org>
Date: Wed, 03 Sep 2025 12:13:53 +0000

commit 3f250a375fc02b87f69328d3fa6120056232ef3e
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Sep 3 14:06:00 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 3 14:06:00 2025 +0200

    x86/iommu: setup MMCFG ahead of IOMMU
    
    Otherwise the PCI accesses to segments different than the first one done by
    the IOMMU initialization code would silently fail by returning all ones.
    
    Introduce a new helper, called pci_setup(), and move both the creation of
    PCI segment 0 internal data structures, plus the parsing of ACPI MMCFG
    table to it.  This moves acpi_mmcfg_init() slightly earlier from
    acpi_boot_init() into pci_setup().
    
    Note that further work will be needed to support systems where access
    methods to segments different than 0 is not discoverable by Xen.
    
    Fixes: 3950f2485bbc ('x86/x2APIC: defer probe until after IOMMU ACPI table parsing')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: c292772b4945d3a264a61c3c1920f1aebd17998b
    master date: 2025-08-21 11:57:25 +0200
---
 xen/arch/x86/acpi/boot.c              | 2 --
 xen/arch/x86/setup.c                  | 6 ++++++
 xen/arch/x86/x86_64/mmconfig-shared.c | 3 +++
 3 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/acpi/boot.c b/xen/arch/x86/acpi/boot.c
index 170f9783c5..aa9ab1a2e3 100644
--- a/xen/arch/x86/acpi/boot.c
+++ b/xen/arch/x86/acpi/boot.c
@@ -748,8 +748,6 @@ int __init acpi_boot_init(void)
 
 	acpi_table_parse(ACPI_SIG_HPET, acpi_parse_hpet);
 
-	acpi_mmcfg_init();
-
 	erst_init();
 
 	acpi_hest_init();
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 2148dde05f..a123f94e85 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -1802,6 +1802,12 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
      */
     setup_system_domains();
 
+    /*
+     * Initialize PCI (create segment 0, setup MMCFG access) ahead of IOMMU
+     * setup, as devices in segment > 0 must also be discoverable.
+     */
+    acpi_mmcfg_init();
+
     /*
      * IOMMU-related ACPI table parsing has to happen before APIC probing, for
      * check_x2apic_preenabled() to be able to observe respective findings, in
diff --git a/xen/arch/x86/x86_64/mmconfig-shared.c b/xen/arch/x86/x86_64/mmconfig-shared.c
index b3b2da7362..7818ae5c3f 100644
--- a/xen/arch/x86/x86_64/mmconfig-shared.c
+++ b/xen/arch/x86/x86_64/mmconfig-shared.c
@@ -403,6 +403,9 @@ void __init acpi_mmcfg_init(void)
 
     pci_segments_init();
 
+    if ( acpi_disabled )
+        return;
+
     /* MMCONFIG disabled */
     if ((pci_probe & PCI_PROBE_MMCONF) == 0)
         return;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Sep 03 12:14:05 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 03 Sep 2025 12:14:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1108211.1458350 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1utmNJ-0002Oi-Dm; Wed, 03 Sep 2025 12:14:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1108211.1458350; Wed, 03 Sep 2025 12:14: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 1utmNJ-0002OY-Au; Wed, 03 Sep 2025 12:14:05 +0000
Received: by outflank-mailman (input) for mailman id 1108211;
 Wed, 03 Sep 2025 12:14: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 1utmNI-0002OP-4S
 for xen-changelog@lists.xenproject.org; Wed, 03 Sep 2025 12:14: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 1utmNH-004ZgC-2t
 for xen-changelog@lists.xenproject.org;
 Wed, 03 Sep 2025 12:14:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1utmNI-00EJu3-0G
 for xen-changelog@lists.xenproject.org;
 Wed, 03 Sep 2025 12:14: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=PcGVMAYok2i2/BDyKYmhgLXt8gs+2+5Ocn67iG+02hU=; b=KgPljuUB3rf9R6aottAkCdjW+3
	x5V0uSVEzbfu3LxHaIAxImK0MhEw5UFMw2ricx89DoDh/UFBZOZ8pyCYfzoX1uuzt2GOmzC3rQHAf
	elzN17msJOc1lA/UlVBfNX5KX8OzcGm2UTFtHy+liLc8yUpef4B6H/A0CzbTRZa5Iqi8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] x86/mce: Adjustments to intel_init_ppin()
Message-Id: <E1utmNI-00EJu3-0G@xenbits.xenproject.org>
Date: Wed, 03 Sep 2025 12:14:04 +0000

commit 880d61a783be958edcec8864920c549719292274
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Sep 3 14:06:20 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 3 14:06:20 2025 +0200

    x86/mce: Adjustments to intel_init_ppin()
    
    There's no family check gating intel_init_ppin(), making it incorrect to
    use on non Fam6 CPUs.
    
    Emerald Rapids is the final CPU to have PPIN but lack the architectural
    enumeration, so include it too.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 49e6eb744eba01f5d4b4cfce49154c0802d4f5c6
    master date: 2025-08-25 14:04:41 +0100
---
 xen/arch/x86/cpu/mcheck/mce_intel.c | 24 +++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/xen/arch/x86/cpu/mcheck/mce_intel.c b/xen/arch/x86/cpu/mcheck/mce_intel.c
index dd812f4b8a..76d6202809 100644
--- a/xen/arch/x86/cpu/mcheck/mce_intel.c
+++ b/xen/arch/x86/cpu/mcheck/mce_intel.c
@@ -10,6 +10,7 @@
 #include <xen/cpu.h>
 #include <asm/processor.h>
 #include <public/sysctl.h>
+#include <asm/intel-family.h>
 #include <asm/system.h>
 #include <asm/msr.h>
 #include <asm/p2m.h>
@@ -859,7 +860,7 @@ static void intel_init_ppin(const struct cpuinfo_x86 *c)
      * other purposes.  Despite the late addition of a CPUID bit (rendering
      * the MSR architectural), keep using the same detection logic there.
      */
-    switch ( c->x86_model )
+    switch ( c->x86 == 6 ? c->x86_model : 0 )
     {
         uint64_t val;
 
@@ -870,16 +871,17 @@ static void intel_init_ppin(const struct cpuinfo_x86 *c)
             return;
         }
         fallthrough;
-    case 0x3e: /* IvyBridge X */
-    case 0x3f: /* Haswell X */
-    case 0x4f: /* Broadwell X */
-    case 0x55: /* Skylake X */
-    case 0x56: /* Broadwell Xeon D */
-    case 0x57: /* Knights Landing */
-    case 0x6a: /* Icelake X */
-    case 0x6c: /* Icelake D */
-    case 0x85: /* Knights Mill */
-    case 0x8f: /* Sapphire Rapids X */
+    case INTEL_FAM6_IVYBRIDGE_X:
+    case INTEL_FAM6_HASWELL_X:
+    case INTEL_FAM6_BROADWELL_X:
+    case INTEL_FAM6_BROADWELL_D:
+    case INTEL_FAM6_SKYLAKE_X:
+    case INTEL_FAM6_XEON_PHI_KNL:
+    case INTEL_FAM6_XEON_PHI_KNM:
+    case INTEL_FAM6_ICELAKE_X:
+    case INTEL_FAM6_ICELAKE_D:
+    case INTEL_FAM6_SAPPHIRERAPIDS_X:
+    case INTEL_FAM6_EMERALDRAPIDS_X:
 
         if ( (c != &boot_cpu_data && !ppin_msr) ||
              rdmsr_safe(MSR_PPIN_CTL, val) )
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Sep 03 12:14:15 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 03 Sep 2025 12:14:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1108212.1458353 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1utmNT-0002R2-Ez; Wed, 03 Sep 2025 12:14:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1108212.1458353; Wed, 03 Sep 2025 12:14: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 1utmNT-0002Qu-CG; Wed, 03 Sep 2025 12:14:15 +0000
Received: by outflank-mailman (input) for mailman id 1108212;
 Wed, 03 Sep 2025 12:14: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 1utmNS-0002Qk-74
 for xen-changelog@lists.xenproject.org; Wed, 03 Sep 2025 12:14: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 1utmNR-004ZgK-3A
 for xen-changelog@lists.xenproject.org;
 Wed, 03 Sep 2025 12:14:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1utmNS-00EJvl-0X
 for xen-changelog@lists.xenproject.org;
 Wed, 03 Sep 2025 12:14: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=wbHluQFZxcE5TJIztsyEVIziJsmLzNrEM6uypzP/oi4=; b=IHZGiGNpMs1lhYE2tpyTh+vjma
	VRnF3mO7+w8d5+AjwonUtn06pYbJzTCHXQFZMr5xxECw7/x9GkngkXfXjrEH9OLk7QQ4mz/ys4jmH
	yLnG2qnwq7hE2S7Fn0PJHI9tMD8DxbDpvUpwpnIa8sN3YLykh/4qI6FfAeUGm8jcAbWg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] x86/suspend: unconditionally raise a timer softirq on resume
Message-Id: <E1utmNS-00EJvl-0X@xenbits.xenproject.org>
Date: Wed, 03 Sep 2025 12:14:14 +0000

commit c1a9db15d174ee82e945282b18f98c00bf9078bf
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Sep 3 14:06:38 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 3 14:06:38 2025 +0200

    x86/suspend: unconditionally raise a timer softirq on resume
    
    The current code to restore the timer state on resume is incomplete.  While
    the local APIC Initial Count Register is saved and restored across
    suspension (even if possibly no longer accurate since it's not adjusted to
    account for the time spent in suspension), the TSC deadline MSR is not
    saved and restored, hence hosts using the TSC deadline timer will likely
    get stuck when resuming from suspension.
    
    The lack of restoring of the TSC deadline MSR was mitigated by the raising
    of a timer softirq in mwait_idle_with_hints() if the timer had expired,
    previous to commit 3faf0866a33070b926ab78e6298290403f85e76c, which removed
    that logic.
    
    This patch fixes the usage of the TSC deadline timer with suspension, by
    unconditionally raising a timer softirq on resume, that will take care of
    rearming the hardware timer.  Given that a timer softirq will be
    unconditionally risen, there's no need to save and restore the APIC Initial
    Count Register anymore either.
    
    Note that secondary processors don't need this special treatment when
    resuming, since they are offlined before suspension and brought back up
    during resume, the first timer that gets setup will trigger a timer softirq
    unconditionally, for example from sched_migrate_timers() that gets called
    for each secondary processor.
    
    Link: https://github.com/QubesOS/qubes-issues/issues/10110
    Reported-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Fixes: fd1291a826e1 ('X86: Prefer TSC-deadline timer in Xen')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Tested-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    master commit: 757abedabbb64f18a28ae61a7bd67a927bb03130
    master date: 2025-08-27 09:33:12 +0200
---
 xen/arch/x86/acpi/power.c | 2 ++
 xen/arch/x86/apic.c       | 3 ---
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/acpi/power.c b/xen/arch/x86/acpi/power.c
index 01cdaf9052..f1d2ea614f 100644
--- a/xen/arch/x86/acpi/power.c
+++ b/xen/arch/x86/acpi/power.c
@@ -22,6 +22,7 @@
 #include <xen/domain.h>
 #include <xen/console.h>
 #include <xen/iommu.h>
+#include <xen/softirq.h>
 #include <xen/watchdog.h>
 #include <xen/cpu.h>
 #include <public/platform.h>
@@ -330,6 +331,7 @@ static int enter_state(u32 state)
     thaw_domains();
     system_state = SYS_STATE_active;
     spin_unlock(&pm_lock);
+    raise_softirq(TIMER_SOFTIRQ);
     return error;
 }
 
diff --git a/xen/arch/x86/apic.c b/xen/arch/x86/apic.c
index 6567af685a..16e03ebd91 100644
--- a/xen/arch/x86/apic.c
+++ b/xen/arch/x86/apic.c
@@ -63,7 +63,6 @@ static struct {
     unsigned int apic_lvt0;
     unsigned int apic_lvt1;
     unsigned int apic_lvterr;
-    unsigned int apic_tmict;
     unsigned int apic_tdcr;
     unsigned int apic_thmr;
 } apic_pm_state;
@@ -658,7 +657,6 @@ int lapic_suspend(void)
     apic_pm_state.apic_lvt0 = apic_read(APIC_LVT0);
     apic_pm_state.apic_lvt1 = apic_read(APIC_LVT1);
     apic_pm_state.apic_lvterr = apic_read(APIC_LVTERR);
-    apic_pm_state.apic_tmict = apic_read(APIC_TMICT);
     apic_pm_state.apic_tdcr = apic_read(APIC_TDCR);
     if (maxlvt >= 5)
         apic_pm_state.apic_thmr = apic_read(APIC_LVTTHMR);
@@ -718,7 +716,6 @@ int lapic_resume(void)
         apic_write(APIC_LVTPC, apic_pm_state.apic_lvtpc);
     apic_write(APIC_LVTT, apic_pm_state.apic_lvtt);
     apic_write(APIC_TDCR, apic_pm_state.apic_tdcr);
-    apic_write(APIC_TMICT, apic_pm_state.apic_tmict);
     apic_write(APIC_ESR, 0);
     apic_read(APIC_ESR);
     apic_write(APIC_LVTERR, apic_pm_state.apic_lvterr);
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Sep 03 12:14:25 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 03 Sep 2025 12:14:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1108214.1458356 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1utmNd-0002UC-HL; Wed, 03 Sep 2025 12:14:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1108214.1458356; Wed, 03 Sep 2025 12:14: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 1utmNd-0002U4-Ev; Wed, 03 Sep 2025 12:14:25 +0000
Received: by outflank-mailman (input) for mailman id 1108214;
 Wed, 03 Sep 2025 12:14: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 1utmNc-0002Ts-9r
 for xen-changelog@lists.xenproject.org; Wed, 03 Sep 2025 12:14: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 1utmNc-004ZgS-0E
 for xen-changelog@lists.xenproject.org;
 Wed, 03 Sep 2025 12:14:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1utmNc-00EJwM-0o
 for xen-changelog@lists.xenproject.org;
 Wed, 03 Sep 2025 12:14: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=CP/SIgdKBcVDQjEnAUYF6MGiMauDcvMqEe2E6zS8VB8=; b=IqKkgERv4l06PMIBDUzCFaVccf
	jwJ6KySM/SZKDfF8CJJyAtLI1K+N6CGfQ3D8YQ3g8Ot9tKgNEo23H3e85s/HX1lBDA6CRMj6vtr+q
	1RCZHWUdsLeqsmeAv5yhh0Cchofv7g9d14Xyc9bFM4RHNXNLsT64dGjVH59NgYyNloWc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] tools: add sizeof_field and endof_field macros
Message-Id: <E1utmNc-00EJwM-0o@xenbits.xenproject.org>
Date: Wed, 03 Sep 2025 12:14:24 +0000

commit ba930c34b3361514de536fba97b154553ebff1d0
Author:     Petr Beneš <w1benny@gmail.com>
AuthorDate: Wed Sep 3 14:06:59 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 3 14:06:59 2025 +0200

    tools: add sizeof_field and endof_field macros
    
    * `sizeof_field` returns the size of a specific struct member
    * `endof_field` returns the offset to the end of the member within the struct
    
    It will be useful in upcoming layout checks of SMBIOS structs.
    
    Signed-off-by: Petr Beneš <w1benny@gmail.com>
    Acked-by: Anthony PERARD <anthony.perard@vates.tech>
    master commit: 17e66ca9188b423eee35e6b4bf878e62d3879a04
    master date: 2025-08-27 11:26:33 +0200
---
 tools/include/xen-tools/common-macros.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tools/include/xen-tools/common-macros.h b/tools/include/xen-tools/common-macros.h
index 0088208c2e..9838a108aa 100644
--- a/tools/include/xen-tools/common-macros.h
+++ b/tools/include/xen-tools/common-macros.h
@@ -83,6 +83,11 @@
 #define __packed __attribute__((__packed__))
 #endif
 
+#define sizeof_field(type, member) sizeof(((type *)NULL)->member)
+
+#define endof_field(type, member) \
+    (offsetof(type, member) + sizeof_field(type, member))
+
 #define container_of(ptr, type, member) ({              \
     typeof(((type *)0)->member) *mptr__ = (ptr);        \
     (type *)((char *)mptr__ - offsetof(type, member));  \
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Sep 03 12:14:35 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 03 Sep 2025 12:14:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1108215.1458361 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1utmNn-0002Wf-J3; Wed, 03 Sep 2025 12:14:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1108215.1458361; Wed, 03 Sep 2025 12:14: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 1utmNn-0002WX-GG; Wed, 03 Sep 2025 12:14:35 +0000
Received: by outflank-mailman (input) for mailman id 1108215;
 Wed, 03 Sep 2025 12:14: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 1utmNm-0002WK-Ci
 for xen-changelog@lists.xenproject.org; Wed, 03 Sep 2025 12:14: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 1utmNm-004ZgY-0T
 for xen-changelog@lists.xenproject.org;
 Wed, 03 Sep 2025 12:14:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1utmNm-00EJwz-14
 for xen-changelog@lists.xenproject.org;
 Wed, 03 Sep 2025 12:14: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=TENtKprqRmt4fubYFawXhruvFuAMkdkWGYjQCfznvMU=; b=F6sCtcBy3Ci7v3EKCBfzIoeqeO
	cC2m/4jfElmOmg1qVdTlAgMRZiPtjxOU7b5YNEBrrgP7jhpRLcr93BM0H94PP5iXCZAd6buE5IMp8
	0w5yxaf0v0XLEuogwYhLryi52BH+jl2JwI44hoS22CkZpujrQKELLsbUploWjpW53fi0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] hvmloader: fix SMBIOS table length checks
Message-Id: <E1utmNm-00EJwz-14@xenbits.xenproject.org>
Date: Wed, 03 Sep 2025 12:14:34 +0000

commit c275e90b3ce79ba371ba0a8fff7aeee84468359e
Author:     Petr Beneš <w1benny@gmail.com>
AuthorDate: Wed Sep 3 14:07:14 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 3 14:07:14 2025 +0200

    hvmloader: fix SMBIOS table length checks
    
    SMBIOS specification dictates that tables should have a minimal length.
    This commit introduces further validation for user-input SMBIOS tables.
    
    As per SMBIOS Reference Specification:
    * Type 0: For version 2.3 and later implementations, the length is at least 14h
    * Type 1: 1Bh for 2.4 and later
    * Type 2: at least 08h
    * Type 3: 0Dh for version 2.1 and later
    * Type 11: 5h (+ strings)
    * Type 22: 1Ah (+ strings)
    * Type 39: a minimum of 10h
    
    Notably, this also fixes previously incorrect check for chassis handle in
    smbios_type_2_init. Chassis handle is a WORD, therefore, the condition now
    correctly checks for >= 13 instead of > 13.
    
    hvmloader currently implements version 2.4
    
    Furthermore, this commit introduces smbios_pt_copy helper function to substitute
    previously repeating pattern of locating the struct in physical memory (via
    get_smbios_pt_struct), checking the length and copying it into SMBIOS region.
    
    Fixes: 4d23036e7096 ("HVM firmware passthrough SMBIOS processing")
    Signed-off-by: Petr Beneš <w1benny@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    master commit: 2f7d52f0165a5b62dbec1e507d0de427abe9b5d5
    master date: 2025-08-27 11:26:33 +0200
---
 tools/firmware/hvmloader/smbios.c       | 178 +++++++++++++++++++-------------
 tools/firmware/hvmloader/smbios_types.h |  32 +++---
 2 files changed, 123 insertions(+), 87 deletions(-)

diff --git a/tools/firmware/hvmloader/smbios.c b/tools/firmware/hvmloader/smbios.c
index 97a054e9e3..27b242a832 100644
--- a/tools/firmware/hvmloader/smbios.c
+++ b/tools/firmware/hvmloader/smbios.c
@@ -47,6 +47,8 @@ static void
 smbios_pt_init(void);
 static void*
 get_smbios_pt_struct(uint8_t type, uint32_t *length_out);
+static void *
+smbios_pt_copy(void *start, uint8_t type, uint16_t handle, size_t table_size);
 static void
 get_cpu_manufacturer(char *buf, int len);
 static int
@@ -154,6 +156,24 @@ get_smbios_pt_struct(uint8_t type, uint32_t *length_out)
     return NULL;
 }
 
+static void *
+smbios_pt_copy(void *start, uint8_t type, uint16_t handle, size_t min_size)
+{
+    struct smbios_structure_header *header = start;
+    void *pts;
+    uint32_t length;
+
+    pts = get_smbios_pt_struct(type, &length);
+    if ( pts != NULL && length >= min_size )
+    {
+        memcpy(start, pts, length);
+        header->handle = handle;
+        return start + length;
+    }
+
+    return start;
+}
+
 static void
 get_cpu_manufacturer(char *buf, int len)
 {
@@ -381,16 +401,17 @@ smbios_type_0_init(void *start, const char *xen_version,
     struct smbios_type_0 *p = (struct smbios_type_0 *)start;
     static const char *smbios_release_date = __SMBIOS_DATE__;
     const char *s;
-    void *pts;
-    uint32_t length;
+    void *next;
 
-    pts = get_smbios_pt_struct(0, &length);
-    if ( (pts != NULL)&&(length > 0) )
-    {
-        memcpy(start, pts, length);
-        p->header.handle = SMBIOS_HANDLE_TYPE0;
-        return (start + length);
-    }
+    /*
+     * Specification says Type 0 table has length of at least 18h for v2.4-3.0.
+     */
+
+    BUILD_BUG_ON(sizeof(*p) != 24);
+
+    next = smbios_pt_copy(start, 0, SMBIOS_HANDLE_TYPE0, sizeof(*p));
+    if ( next != start )
+        return next;
 
     memset(p, 0, sizeof(*p));
 
@@ -440,16 +461,14 @@ smbios_type_1_init(void *start, const char *xen_version,
     char uuid_str[37];
     struct smbios_type_1 *p = (struct smbios_type_1 *)start;
     const char *s;
-    void *pts;
-    uint32_t length;
+    void *next;
 
-    pts = get_smbios_pt_struct(1, &length);
-    if ( (pts != NULL)&&(length > 0) )
-    {
-        memcpy(start, pts, length);
-        p->header.handle = SMBIOS_HANDLE_TYPE1;
-        return (start + length);
-    }
+    /* Specification says Type 1 table has length of 1Bh for v2.4 and later. */
+    BUILD_BUG_ON(sizeof(*p) != 27);
+
+    next = smbios_pt_copy(start, 1, SMBIOS_HANDLE_TYPE1, sizeof(*p));
+    if ( next != start )
+        return next;
 
     memset(p, 0, sizeof(*p));
 
@@ -498,26 +517,29 @@ smbios_type_2_init(void *start)
 {
     struct smbios_type_2 *p = (struct smbios_type_2 *)start;
     const char *s;
-    uint8_t *ptr;
-    void *pts;
-    uint32_t length;
+    void *next;
     unsigned int counter = 0;
 
-    pts = get_smbios_pt_struct(2, &length);
-    if ( (pts != NULL)&&(length > 0) )
-    {
-        memcpy(start, pts, length);
-        p->header.handle = SMBIOS_HANDLE_TYPE2;
+    /*
+     * Specification says Type 2 table has length of at least 08h,
+     * which corresponds with the end of the "Serial Number" field.
+     */
 
+    BUILD_BUG_ON(endof_field(struct smbios_type_2, serial_number_str) != 8);
+
+    next = smbios_pt_copy(start, 2, SMBIOS_HANDLE_TYPE2,
+                          endof_field(struct smbios_type_2, serial_number_str));
+    if ( next != start )
+    {
         /* Set current chassis handle if present */
-        if ( p->header.length > 13 )
+        if ( p->header.length >= endof_field(struct smbios_type_2,
+                                             chassis_handle) )
         {
-            ptr = ((uint8_t*)start) + 11;            
-            if ( *((uint16_t*)ptr) != 0 )
-                *((uint16_t*)ptr) = SMBIOS_HANDLE_TYPE3;
+            if ( p->chassis_handle != 0 )
+                p->chassis_handle = SMBIOS_HANDLE_TYPE3;
         }
 
-        return (start + length);
+        return next;
     }
 
     memset(p, 0, sizeof(*p));
@@ -593,18 +615,21 @@ smbios_type_3_init(void *start)
 {
     struct smbios_type_3 *p = (struct smbios_type_3 *)start;
     const char *s;
-    void *pts;
-    uint32_t length;
+    void *next;
     uint32_t counter = 0;
 
-    pts = get_smbios_pt_struct(3, &length);
-    if ( (pts != NULL)&&(length > 0) )
-    {
-        memcpy(start, pts, length);
-        p->header.handle = SMBIOS_HANDLE_TYPE3;
-        return (start + length);
-    }
-    
+    /*
+     * Specification says Type 3 table has length of at least 0Dh (for v2.1+),
+     * which corresponds with the end of the "Security Status" field.
+     */
+
+    BUILD_BUG_ON(endof_field(struct smbios_type_3, security_status) != 13);
+
+    next = smbios_pt_copy(start, 3, SMBIOS_HANDLE_TYPE3,
+                          offsetof(struct smbios_type_3, security_status));
+    if ( next != start )
+        return next;
+
     memset(p, 0, sizeof(*p));
 
     p->header.type = 3;
@@ -656,6 +681,9 @@ smbios_type_4_init(
     struct smbios_type_4 *p = (struct smbios_type_4 *)start;
     uint32_t eax, ebx, ecx, edx;
 
+    /* Specification says Type 4 table has length of 23h for v2.3+. */
+    BUILD_BUG_ON(sizeof(*p) != 35);
+
     memset(p, 0, sizeof(*p));
 
     p->header.type = 4;
@@ -707,17 +735,15 @@ smbios_type_11_init(void *start)
     struct smbios_type_11 *p = (struct smbios_type_11 *)start;
     char path[20];
     const char *s;
+    void *next;
     int i;
-    void *pts;
-    uint32_t length;
 
-    pts = get_smbios_pt_struct(11, &length);
-    if ( (pts != NULL)&&(length > 0) )
-    {
-        memcpy(start, pts, length);
-        p->header.handle = SMBIOS_HANDLE_TYPE11;
-        return (start + length);
-    }
+    /* Specification says Type 11 table has length of 05h. */
+    BUILD_BUG_ON(sizeof(*p) != 5);
+    
+    next = smbios_pt_copy(start, 11, SMBIOS_HANDLE_TYPE11, sizeof(*p));
+    if ( next != start )
+        return next;
 
     p->header.type = 11;
     p->header.length = sizeof(struct smbios_type_11);
@@ -756,6 +782,9 @@ smbios_type_16_init(void *start, uint32_t memsize, int nr_mem_devs)
 {
     struct smbios_type_16 *p = (struct smbios_type_16*)start;
 
+    /* Specification says Type 16 table has length of 0Fh for v2.1-2.7. */
+    BUILD_BUG_ON(sizeof(*p) != 15);
+
     memset(p, 0, sizeof(*p));
 
     p->header.type = 16;
@@ -781,6 +810,9 @@ smbios_type_17_init(void *start, uint32_t memory_size_mb, int instance)
     char buf[16];
     struct smbios_type_17 *p = (struct smbios_type_17 *)start;
     
+    /* Specification says Type 17 table has length of 1Bh for v2.3-2.6. */
+    BUILD_BUG_ON(sizeof(*p) != 27);
+
     memset(p, 0, sizeof(*p));
 
     p->header.type = 17;
@@ -816,6 +848,9 @@ smbios_type_19_init(void *start, uint32_t memory_size_mb, int instance)
 {
     struct smbios_type_19 *p = (struct smbios_type_19 *)start;
     
+    /* Specification says Type 19 table has length of 0Fh for v2.1-2.7. */
+    BUILD_BUG_ON(sizeof(*p) != 15);
+
     memset(p, 0, sizeof(*p));
 
     p->header.type = 19;
@@ -838,6 +873,9 @@ smbios_type_20_init(void *start, uint32_t memory_size_mb, int instance)
 {
     struct smbios_type_20 *p = (struct smbios_type_20 *)start;
 
+    /* Specification says Type 20 table has length of 13h for v2.1-2.7. */
+    BUILD_BUG_ON(sizeof(*p) != 19);
+
     memset(p, 0, sizeof(*p));
 
     p->header.type = 20;
@@ -865,16 +903,14 @@ smbios_type_22_init(void *start)
     struct smbios_type_22 *p = (struct smbios_type_22 *)start;
     static const char *smbios_release_date = __SMBIOS_DATE__;
     const char *s;
-    void *pts;
-    uint32_t length;
+    void *next;
 
-    pts = get_smbios_pt_struct(22, &length);
-    if ( (pts != NULL)&&(length > 0) )
-    {
-        memcpy(start, pts, length);
-        p->header.handle = SMBIOS_HANDLE_TYPE22;
-        return (start + length);
-    }
+    /* Specification says Type 22 table has length of 1Ah. */
+    BUILD_BUG_ON(sizeof(*p) != 26);
+
+    next = smbios_pt_copy(start, 22, SMBIOS_HANDLE_TYPE22, sizeof(*p));
+    if ( next != start )
+        return next;
 
     s = xenstore_read(HVM_XS_SMBIOS_DEFAULT_BATTERY, "0");
     if ( strncmp(s, "1", 1) != 0 )
@@ -929,6 +965,9 @@ smbios_type_32_init(void *start)
 {
     struct smbios_type_32 *p = (struct smbios_type_32 *)start;
 
+    /* Specification says Type 32 table has length of at least 0Bh. */
+    BUILD_BUG_ON(sizeof(*p) != 11);
+
     memset(p, 0, sizeof(*p));
 
     p->header.type = 32;
@@ -946,20 +985,17 @@ smbios_type_32_init(void *start)
 static void *
 smbios_type_39_init(void *start)
 {
-    struct smbios_type_39 *p = (struct smbios_type_39 *)start;
-    void *pts;
-    uint32_t length;
+    /*
+     * Specification says Type 39 table has length of at least 10h,
+     * which corresponds with the end of the "Characteristics" field.
+     *
+     * Only present when passed in.
+     */
 
-    pts = get_smbios_pt_struct(39, &length);
-    if ( (pts != NULL)&&(length > 0) )
-    {
-        memcpy(start, pts, length);
-        p->header.handle = SMBIOS_HANDLE_TYPE39;
-        return (start + length);
-    }
+    BUILD_BUG_ON(endof_field(struct smbios_type_39, characteristics) != 16);
 
-    /* Only present when passed in */
-    return start;
+    return smbios_pt_copy(start, 39, SMBIOS_HANDLE_TYPE39,
+                          endof_field(struct smbios_type_39, characteristics));
 }
 
 static void *
diff --git a/tools/firmware/hvmloader/smbios_types.h b/tools/firmware/hvmloader/smbios_types.h
index 7c648ece71..a04d194975 100644
--- a/tools/firmware/hvmloader/smbios_types.h
+++ b/tools/firmware/hvmloader/smbios_types.h
@@ -90,13 +90,13 @@ struct smbios_type_2 {
     uint8_t product_name_str;
     uint8_t version_str;
     uint8_t serial_number_str;
-    uint8_t asset_tag_str;
-    uint8_t feature_flags;
-    uint8_t location_in_chassis_str;
-    uint16_t chassis_handle;
-    uint8_t board_type;
-    uint8_t contained_handle_count;
-    uint16_t contained_handles[];
+    uint8_t asset_tag_str;                  /* Optional */
+    uint8_t feature_flags;                  /* Optional */
+    uint8_t location_in_chassis_str;        /* Optional */
+    uint16_t chassis_handle;                /* Optional */
+    uint8_t board_type;                     /* Optional */
+    uint8_t contained_handle_count;         /* Optional */
+    uint16_t contained_handles[];           /* Optional */
 } __attribute__ ((packed));
 
 /* System Enclosure - Contained Elements */
@@ -118,12 +118,12 @@ struct smbios_type_3 {
     uint8_t power_supply_state;
     uint8_t thermal_state;
     uint8_t security_status;
-    uint32_t oem_specific;
-    uint8_t height;
-    uint8_t number_of_power_cords;
-    uint8_t contained_element_count;
-    uint8_t contained_element_length;
-    struct smbios_contained_element contained_elements[];
+    uint32_t oem_specific;                  /* Optional */
+    uint8_t height;                         /* Optional */
+    uint8_t number_of_power_cords;          /* Optional */
+    uint8_t contained_element_count;        /* Optional */
+    uint8_t contained_element_length;       /* Optional */
+    struct smbios_contained_element contained_elements[]; /* Optional */
 } __attribute__ ((packed));
 
 /* SMBIOS type 4 - Processor Information */
@@ -252,9 +252,9 @@ struct smbios_type_39 {
     uint8_t revision_level_str;
     uint16_t max_capacity;
     uint16_t characteristics;
-    uint16_t input_voltage_probe_handle;
-    uint16_t cooling_device_handle;
-    uint16_t input_current_probe_handle;
+    uint16_t input_voltage_probe_handle;    /* Optional */
+    uint16_t cooling_device_handle;         /* Optional */
+    uint16_t input_current_probe_handle;    /* Optional */
 } __attribute__ ((packed));
 
 /* SMBIOS type 127 -- End-of-table */
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Sep 03 12:14:45 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 03 Sep 2025 12:14:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1108216.1458364 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1utmNx-0002Yg-KC; Wed, 03 Sep 2025 12:14:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1108216.1458364; Wed, 03 Sep 2025 12:14: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 1utmNx-0002YY-Hh; Wed, 03 Sep 2025 12:14:45 +0000
Received: by outflank-mailman (input) for mailman id 1108216;
 Wed, 03 Sep 2025 12:14: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 1utmNw-0002YO-Es
 for xen-changelog@lists.xenproject.org; Wed, 03 Sep 2025 12:14: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 1utmNw-004Zgk-0j
 for xen-changelog@lists.xenproject.org;
 Wed, 03 Sep 2025 12:14:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1utmNw-00EJxb-1K
 for xen-changelog@lists.xenproject.org;
 Wed, 03 Sep 2025 12:14: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=xBbq4JQHKCNuMpg4gdhiEaDZIYDvonP2Ds5NocAaH0o=; b=M0O5ou0xj9AYChKrEPXTIZ7sUg
	2TNDwSa4MWqwcig4I0n+DS15FuZ0YyiWT5AQ5XtviBmfmno82qXC/AiG1VGZu4i/wxetd13CWn9Wv
	mbQb0iYPl4e336uypYtK6NCbpsl6ryGqV0p08XcYRjqhDn5n+Yt8hKCJqa/pC9+p62xc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] xen/efi: Fix crash with initial empty EFI options
Message-Id: <E1utmNw-00EJxb-1K@xenbits.xenproject.org>
Date: Wed, 03 Sep 2025 12:14:44 +0000

commit dc04d4e8c767b5ef21b8b62a8bbc2eb07d21d5b5
Author:     Frediano Ziglio <frediano.ziglio@cloud.com>
AuthorDate: Wed Sep 3 14:07:33 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 3 14:07:33 2025 +0200

    xen/efi: Fix crash with initial empty EFI options
    
    EFI code path split options from EFI LoadOptions fields in 2
    pieces, first EFI options, second Xen options.
    "get_argv" function is called first to get the number of arguments
    in the LoadOptions, second, after allocating enough space, to
    fill some "argc"/"argv" variable. However the first parsing could
    be different from second as second is able to detect "--" argument
    separator. So it was possible that "argc" was bigger than the
    initialized portion of "argv" array, leading to potential
    uninitialized pointer dereference, in particular a string like
    "-- a b c" would lead to crashes.
    Using EFI shell is possible to pass any kind of string in
    LoadOptions.
    
    Fixes: bf6501a62e80 ("x86-64: EFI boot code")
    Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
    Reviewed-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    master commit: 375f0dd538072ae33b14c52465f94ecbd83625dc
    master date: 2025-09-01 13:07:01 +0200
---
 xen/common/efi/boot.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c
index 01062bb39f..04d4bbd801 100644
--- a/xen/common/efi/boot.c
+++ b/xen/common/efi/boot.c
@@ -327,10 +327,11 @@ static unsigned int __init get_argv(unsigned int argc, CHAR16 **argv,
 
     if ( argc )
     {
+        argc = 0;
         cmdline = data + *offset;
         /* EFI_LOAD_OPTION does not supply an image name as first component. */
         if ( *offset )
-            *argv++ = NULL;
+            argv[argc++] = NULL;
     }
     else if ( size > sizeof(*cmdline) && !(size % sizeof(*cmdline)) &&
               (wmemchr(data, 0, size / sizeof(*cmdline)) ==
@@ -391,14 +392,14 @@ static unsigned int __init get_argv(unsigned int argc, CHAR16 **argv,
                 ++argc;
             else if ( prev && wstrcmp(prev, L"--") == 0 )
             {
-                --argv;
+                --argc;
                 if ( options )
                     *options = cmdline;
                 break;
             }
             else
             {
-                *argv++ = prev = ptr;
+                argv[argc++] = prev = ptr;
                 *ptr = *cmdline;
                 *++ptr = 0;
             }
@@ -406,7 +407,7 @@ static unsigned int __init get_argv(unsigned int argc, CHAR16 **argv,
         prev_sep = cur_sep;
     }
     if ( argv )
-        *argv = NULL;
+        argv[argc] = NULL;
     return argc;
 }
 
@@ -1302,8 +1303,8 @@ void EFIAPI __init noreturn efi_start(EFI_HANDLE ImageHandle,
                                   (argc + 1) * sizeof(*argv) +
                                       loaded_image->LoadOptionsSize,
                                   (void **)&argv) == EFI_SUCCESS )
-            get_argv(argc, argv, loaded_image->LoadOptions,
-                     loaded_image->LoadOptionsSize, &offset, &options);
+            argc = get_argv(argc, argv, loaded_image->LoadOptions,
+                            loaded_image->LoadOptionsSize, &offset, &options);
         else
             argc = 0;
         for ( i = 1; i < argc; ++i )
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Sep 03 12:14:55 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 03 Sep 2025 12:14:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1108217.1458369 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1utmO7-0002b3-Ln; Wed, 03 Sep 2025 12:14:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1108217.1458369; Wed, 03 Sep 2025 12:14: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 1utmO7-0002av-J3; Wed, 03 Sep 2025 12:14:55 +0000
Received: by outflank-mailman (input) for mailman id 1108217;
 Wed, 03 Sep 2025 12:14: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 1utmO6-0002al-HH
 for xen-changelog@lists.xenproject.org; Wed, 03 Sep 2025 12:14: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 1utmO6-004Zgq-0y
 for xen-changelog@lists.xenproject.org;
 Wed, 03 Sep 2025 12:14:54 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1utmO6-00EJzi-1Z
 for xen-changelog@lists.xenproject.org;
 Wed, 03 Sep 2025 12:14: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=6fwvqWpBej5XwIgtvyKtezmr650/DG7kOZ9JWP+PzhQ=; b=xBHGAzxzPtOeRktwrBl4v9k/JN
	iKL8z7HAkQTG44bjDTgZTzBLgqoJ4k6uztF+NMcPzpMKE/MIsqLi6nxE16I1Rkd7tluo7To99o8aO
	dCF3hP0P2pXC9dUmvO9xlVFme7rgwSZKa0Zr7JgBUYIY5up0pefH0IDFRQBcXok5J5Aw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] x86/gen-cpuid: correct cycle detection
Message-Id: <E1utmO6-00EJzi-1Z@xenbits.xenproject.org>
Date: Wed, 03 Sep 2025 12:14:54 +0000

commit f41d24890fafc2cf8567f28066cb112bd5fb08b6
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Sep 3 14:07:50 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 3 14:07:50 2025 +0200

    x86/gen-cpuid: correct cycle detection
    
    With the processing done linearly (rather than recursively), checking
    whether any of the features was previously seen is wrong: That would
    e.g. trigger for this simple set of dependencies
    
        X: [A, B]
        A: [C]
        B: [C]
    
    (observed in reality when making AMX-AVX512 dependent upon both
    AMX-TILE and AVX512F, causing XSAVE to see AMX-AVX512 twice in its list
    of dependents). But checking the whole accumulated set also isn't
    necessary - just checking the feature we're processing dependents of is
    sufficient. We may detect a cycle later that way, but we still will
    detect it. What we need to avoid is adding a feature again when we've
    already seen it.
    
    As a result, seeding "seen[]" with "feat" isn't necessary anymore.
    
    Fixes: fe4408d180f4 ("xen/x86: Generate deep dependencies of features")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 3999ff0d307a9a901ad1b5ad56e0dde657fec558
    master date: 2025-09-01 13:07:53 +0200
---
 xen/tools/gen-cpuid.py | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/xen/tools/gen-cpuid.py b/xen/tools/gen-cpuid.py
index dc33ca3181..045965facb 100755
--- a/xen/tools/gen-cpuid.py
+++ b/xen/tools/gen-cpuid.py
@@ -345,7 +345,7 @@ def crunch_numbers(state):
 
     for feat in deep_features:
 
-        seen = [feat]
+        seen = []
         to_process = list(deps[feat])
 
         while len(to_process):
@@ -358,14 +358,17 @@ def crunch_numbers(state):
 
             f = to_process.pop(0)
 
+            if f == feat:
+                raise Fail("ERROR: Cycle found when processing %s" %
+                           (state.names[f], ))
+
             if f in seen:
-                raise Fail("ERROR: Cycle found with %s when processing %s"
-                           % (state.names[f], state.names[feat]))
+                continue
 
             seen.append(f)
             to_process = list(set(to_process + deps.get(f, [])))
 
-        state.deep_deps[feat] = seen[1:]
+        state.deep_deps[feat] = seen
 
     state.deep_features = deps.keys()
     state.nr_deep_deps = len(state.deep_deps.keys())
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Sep 03 12:15:05 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 03 Sep 2025 12:15:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1108218.1458373 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1utmOH-0002eE-NO; Wed, 03 Sep 2025 12:15:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1108218.1458373; Wed, 03 Sep 2025 12:15: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 1utmOH-0002e7-KY; Wed, 03 Sep 2025 12:15:05 +0000
Received: by outflank-mailman (input) for mailman id 1108218;
 Wed, 03 Sep 2025 12:15: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 1utmOG-0002dr-Jm
 for xen-changelog@lists.xenproject.org; Wed, 03 Sep 2025 12:15: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 1utmOG-004Zhf-1D
 for xen-changelog@lists.xenproject.org;
 Wed, 03 Sep 2025 12:15:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1utmOG-00EK0d-1p
 for xen-changelog@lists.xenproject.org;
 Wed, 03 Sep 2025 12:15: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=Ps9l/IdjCRp2vEDphVrQZQxPWcScFwBXObfnSdsjCKQ=; b=wFeJtyHoNiWAMZeb/E9HTO+luA
	04BVCDLe8gtdsRxXflhQ4SQhwmfuZ3qzaKKspKA9KZG+UYvYxDk8WD+9tsjkq5LRiY0Xxq5adqjvd
	F3EABFdgQbiUizikbrKjuxTUUF9hnZ/Zh8NjQJhtcYZ5t0ZGyzFIGa9cmCq+F/YQJnI0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] x86/gen-cpuid: Fix debugging for cycle detection
Message-Id: <E1utmOG-00EK0d-1p@xenbits.xenproject.org>
Date: Wed, 03 Sep 2025 12:15:04 +0000

commit dabd719321b652286b9d0b0c23e29c8427eb7da5
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Sep 3 14:08:00 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 3 14:08:00 2025 +0200

    x86/gen-cpuid: Fix debugging for cycle detection
    
    Jan reports the following exception when using the cycle debugging:
    
      Feature IBRSB, seen [IBRSB, STIBP, INTEL_PSFD, EIBRS, IPRED_CTRL, RRSBA_CTRL, RRSBA, BHI_CTRL], to_process [SSBD]
      Traceback (most recent call last):
        File "/local/xen.git/xen/../xen/tools/gen-cpuid.py", line 594, in <module>
          sys.exit(main())
                   ^^^^^^
        File "/local/xen.git/xen/../xen/tools/gen-cpuid.py", line 588, in main
          crunch_numbers(state)
        File "/local/xen.git/xen/../xen/tools/gen-cpuid.py", line 366, in crunch_numbers
          (state.names[feat], repl(seen), repl(to_process)))
                                          ^^^^^^^^^^^^^^^^
        File "/local/xen.git/xen/../xen/tools/gen-cpuid.py", line 364, in repl
          return "[" + ", ".join((state.names[x] for x in l)) + "]"
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/local/xen.git/xen/../xen/tools/gen-cpuid.py", line 364, in <genexpr>
          return "[" + ", ".join((state.names[x] for x in l)) + "]"
                                  ~~~~~~~~~~~^^^
      KeyError: 534
      make[2]: *** [/local/xen.git/xen/include/xen/lib/x86/Makefile:9: cpuid-autogen.h] Error 1
    
    This is caused by commit ce8c930851a5 ("x86/cpu-policy: MSR_ARCH_CAPS feature
    names") being rather lazy and marking dependenices on unknown features.
    
    Introduce a helper to pick the known features in a range, and use it for
    ARCH_CAPS.
    
    Additionally, remove trailing whitespace and an unnecessary line continuation
    from the debug print.
    
    Reported-by: Jan Beulich <jbeulich@suse.com>
    Fixes: ce8c930851a5 ("x86/cpu-policy: MSR_ARCH_CAPS feature names")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    master commit: 5edb4ccff6a13ea10d1c1888942dff0c868c7844
    master date: 2025-09-01 19:54:21 +0100
---
 xen/tools/gen-cpuid.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/xen/tools/gen-cpuid.py b/xen/tools/gen-cpuid.py
index 045965facb..e31012fbd4 100755
--- a/xen/tools/gen-cpuid.py
+++ b/xen/tools/gen-cpuid.py
@@ -168,6 +168,10 @@ def crunch_numbers(state):
     state.hvm_shadow_max = state.pv_max         | state.raw['S'] | state.raw['s']
     state.hvm_hap_max =    state.hvm_shadow_max | state.raw['H'] | state.raw['h']
 
+    def feat_range(start, last):
+        """ Select all known features in the given range """
+        return [ x for x in state.names.keys() if start <= x <= last ]
+
     #
     # Feature dependency information.
     #
@@ -334,7 +338,7 @@ def crunch_numbers(state):
         PSFD: [EPSF],
 
         # The ARCH_CAPS CPUID bit enumerates the availability of the whole register.
-        ARCH_CAPS: list(range(RDCL_NO, RDCL_NO + 64)),
+        ARCH_CAPS: feat_range(RDCL_NO, RDCL_NO + 63),
 
         # The behaviour described by RRSBA depend on eIBRS being active.
         EIBRS: [RRSBA],
@@ -353,7 +357,7 @@ def crunch_numbers(state):
             # To debug, uncomment the following lines:
             # def repl(l):
             #     return "[" + ", ".join((state.names[x] for x in l)) + "]"
-            # sys.stderr.write("Feature %s, seen %s, to_process %s \n" % \
+            # sys.stderr.write("Feature %s, seen %s, to_process %s\n" %
             #     (state.names[feat], repl(seen), repl(to_process)))
 
             f = to_process.pop(0)
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Sep 03 12:15:15 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 03 Sep 2025 12:15:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1108220.1458377 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1utmOR-0002hM-Q5; Wed, 03 Sep 2025 12:15:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1108220.1458377; Wed, 03 Sep 2025 12:15: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 1utmOR-0002hE-NU; Wed, 03 Sep 2025 12:15:15 +0000
Received: by outflank-mailman (input) for mailman id 1108220;
 Wed, 03 Sep 2025 12:15: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 1utmOQ-0002h1-S5
 for xen-changelog@lists.xenproject.org; Wed, 03 Sep 2025 12:15: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 1utmOQ-004Zho-22
 for xen-changelog@lists.xenproject.org;
 Wed, 03 Sep 2025 12:15:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1utmOQ-00EK1r-2d
 for xen-changelog@lists.xenproject.org;
 Wed, 03 Sep 2025 12:15: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=ETZyOHxq+3Z5kzsQ+IPai8TQ28rZY9XyjIXMQJ89J1g=; b=1NNi4I/8LdEZYk7BA8DunFQcDg
	q5Ycj6zUBZ/dlaqPNutloU0ovgV5yfXe6tfjJWWIrkY0Wpvn3AjW/FLO2e9oI6cwQ/SN1XTx15uFB
	C9EaCc6e7ztRKqPTpFQdGawi9d4l4DT088QLGUU8CIXkWGBUjazytg/VAPrWZOHRoJr4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] x86/suspend: unconditionally raise a timer softirq on resume
Message-Id: <E1utmOQ-00EK1r-2d@xenbits.xenproject.org>
Date: Wed, 03 Sep 2025 12:15:14 +0000

commit 51190865a4918c443c310c0478247d5f9caa5dad
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Sep 3 14:09:11 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 3 14:09:11 2025 +0200

    x86/suspend: unconditionally raise a timer softirq on resume
    
    The current code to restore the timer state on resume is incomplete.  While
    the local APIC Initial Count Register is saved and restored across
    suspension (even if possibly no longer accurate since it's not adjusted to
    account for the time spent in suspension), the TSC deadline MSR is not
    saved and restored, hence hosts using the TSC deadline timer will likely
    get stuck when resuming from suspension.
    
    The lack of restoring of the TSC deadline MSR was mitigated by the raising
    of a timer softirq in mwait_idle_with_hints() if the timer had expired,
    previous to commit 3faf0866a33070b926ab78e6298290403f85e76c, which removed
    that logic.
    
    This patch fixes the usage of the TSC deadline timer with suspension, by
    unconditionally raising a timer softirq on resume, that will take care of
    rearming the hardware timer.  Given that a timer softirq will be
    unconditionally risen, there's no need to save and restore the APIC Initial
    Count Register anymore either.
    
    Note that secondary processors don't need this special treatment when
    resuming, since they are offlined before suspension and brought back up
    during resume, the first timer that gets setup will trigger a timer softirq
    unconditionally, for example from sched_migrate_timers() that gets called
    for each secondary processor.
    
    Link: https://github.com/QubesOS/qubes-issues/issues/10110
    Reported-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Fixes: fd1291a826e1 ('X86: Prefer TSC-deadline timer in Xen')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Tested-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    master commit: 757abedabbb64f18a28ae61a7bd67a927bb03130
    master date: 2025-08-27 09:33:12 +0200
---
 xen/arch/x86/acpi/power.c | 2 ++
 xen/arch/x86/apic.c       | 3 ---
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/acpi/power.c b/xen/arch/x86/acpi/power.c
index 783b4a2f2c..5fc7fef24f 100644
--- a/xen/arch/x86/acpi/power.c
+++ b/xen/arch/x86/acpi/power.c
@@ -22,6 +22,7 @@
 #include <xen/domain.h>
 #include <xen/console.h>
 #include <xen/iommu.h>
+#include <xen/softirq.h>
 #include <xen/watchdog.h>
 #include <xen/cpu.h>
 #include <public/platform.h>
@@ -330,6 +331,7 @@ static int enter_state(u32 state)
     thaw_domains();
     system_state = SYS_STATE_active;
     spin_unlock(&pm_lock);
+    raise_softirq(TIMER_SOFTIRQ);
     return error;
 }
 
diff --git a/xen/arch/x86/apic.c b/xen/arch/x86/apic.c
index 6acdd0ec14..ab1bb29ab0 100644
--- a/xen/arch/x86/apic.c
+++ b/xen/arch/x86/apic.c
@@ -63,7 +63,6 @@ static struct {
     unsigned int apic_lvt0;
     unsigned int apic_lvt1;
     unsigned int apic_lvterr;
-    unsigned int apic_tmict;
     unsigned int apic_tdcr;
     unsigned int apic_thmr;
 } apic_pm_state;
@@ -660,7 +659,6 @@ int lapic_suspend(void)
     apic_pm_state.apic_lvt0 = apic_read(APIC_LVT0);
     apic_pm_state.apic_lvt1 = apic_read(APIC_LVT1);
     apic_pm_state.apic_lvterr = apic_read(APIC_LVTERR);
-    apic_pm_state.apic_tmict = apic_read(APIC_TMICT);
     apic_pm_state.apic_tdcr = apic_read(APIC_TDCR);
     if (maxlvt >= 5)
         apic_pm_state.apic_thmr = apic_read(APIC_LVTTHMR);
@@ -720,7 +718,6 @@ int lapic_resume(void)
         apic_write(APIC_LVTPC, apic_pm_state.apic_lvtpc);
     apic_write(APIC_LVTT, apic_pm_state.apic_lvtt);
     apic_write(APIC_TDCR, apic_pm_state.apic_tdcr);
-    apic_write(APIC_TMICT, apic_pm_state.apic_tmict);
     apic_write(APIC_ESR, 0);
     apic_read(APIC_ESR);
     apic_write(APIC_LVTERR, apic_pm_state.apic_lvterr);
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Sep 03 12:15:25 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 03 Sep 2025 12:15:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1108221.1458381 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1utmOb-0002jj-Rl; Wed, 03 Sep 2025 12:15:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1108221.1458381; Wed, 03 Sep 2025 12:15: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 1utmOb-0002jb-Ov; Wed, 03 Sep 2025 12:15:25 +0000
Received: by outflank-mailman (input) for mailman id 1108221;
 Wed, 03 Sep 2025 12:15:25 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1utmOb-0002jR-3k
 for xen-changelog@lists.xenproject.org; Wed, 03 Sep 2025 12:15:25 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1utmOa-004Zhu-2q
 for xen-changelog@lists.xenproject.org;
 Wed, 03 Sep 2025 12:15:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1utmOb-00EK3g-0C
 for xen-changelog@lists.xenproject.org;
 Wed, 03 Sep 2025 12:15:25 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=KaqukTQcMGrYXUs78/lUoCRC1mKukvbkcSlvOGDZURQ=; b=0yQCF1N6S2AHl/xE2tuYLqQEJO
	F6puAQrELoqz+6P8fp7HDtnGxxE+OmMrmQPt5N5we3epZn+lfzyjP/K8wpVfFIQyuP1oQAeeCbQ/E
	CsqiL766Pfu44/ZbKbR8tqPUDyC2N43TbmQKi9nASQOeXeKpQG8SRVv1fwOmaMdET4Yo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.17] x86/suspend: unconditionally raise a timer softirq on resume
Message-Id: <E1utmOb-00EK3g-0C@xenbits.xenproject.org>
Date: Wed, 03 Sep 2025 12:15:25 +0000

commit 746543f6d9dce3e90921192df453b1b26c88086f
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Sep 3 14:09:59 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 3 14:09:59 2025 +0200

    x86/suspend: unconditionally raise a timer softirq on resume
    
    The current code to restore the timer state on resume is incomplete.  While
    the local APIC Initial Count Register is saved and restored across
    suspension (even if possibly no longer accurate since it's not adjusted to
    account for the time spent in suspension), the TSC deadline MSR is not
    saved and restored, hence hosts using the TSC deadline timer will likely
    get stuck when resuming from suspension.
    
    The lack of restoring of the TSC deadline MSR was mitigated by the raising
    of a timer softirq in mwait_idle_with_hints() if the timer had expired,
    previous to commit 3faf0866a33070b926ab78e6298290403f85e76c, which removed
    that logic.
    
    This patch fixes the usage of the TSC deadline timer with suspension, by
    unconditionally raising a timer softirq on resume, that will take care of
    rearming the hardware timer.  Given that a timer softirq will be
    unconditionally risen, there's no need to save and restore the APIC Initial
    Count Register anymore either.
    
    Note that secondary processors don't need this special treatment when
    resuming, since they are offlined before suspension and brought back up
    during resume, the first timer that gets setup will trigger a timer softirq
    unconditionally, for example from sched_migrate_timers() that gets called
    for each secondary processor.
    
    Link: https://github.com/QubesOS/qubes-issues/issues/10110
    Reported-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Fixes: fd1291a826e1 ('X86: Prefer TSC-deadline timer in Xen')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Tested-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    master commit: 757abedabbb64f18a28ae61a7bd67a927bb03130
    master date: 2025-08-27 09:33:12 +0200
---
 xen/arch/x86/acpi/power.c | 2 ++
 xen/arch/x86/apic.c       | 3 ---
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/acpi/power.c b/xen/arch/x86/acpi/power.c
index 5cddb0f0f6..0c3ed9fb4f 100644
--- a/xen/arch/x86/acpi/power.c
+++ b/xen/arch/x86/acpi/power.c
@@ -23,6 +23,7 @@
 #include <xen/domain.h>
 #include <xen/console.h>
 #include <xen/iommu.h>
+#include <xen/softirq.h>
 #include <xen/watchdog.h>
 #include <xen/cpu.h>
 #include <public/platform.h>
@@ -320,6 +321,7 @@ static int enter_state(u32 state)
     thaw_domains();
     system_state = SYS_STATE_active;
     spin_unlock(&pm_lock);
+    raise_softirq(TIMER_SOFTIRQ);
     return error;
 }
 
diff --git a/xen/arch/x86/apic.c b/xen/arch/x86/apic.c
index e43b779036..52b7010b2a 100644
--- a/xen/arch/x86/apic.c
+++ b/xen/arch/x86/apic.c
@@ -63,7 +63,6 @@ static struct {
     unsigned int apic_lvt0;
     unsigned int apic_lvt1;
     unsigned int apic_lvterr;
-    unsigned int apic_tmict;
     unsigned int apic_tdcr;
     unsigned int apic_thmr;
 } apic_pm_state;
@@ -695,7 +694,6 @@ int lapic_suspend(void)
     apic_pm_state.apic_lvt0 = apic_read(APIC_LVT0);
     apic_pm_state.apic_lvt1 = apic_read(APIC_LVT1);
     apic_pm_state.apic_lvterr = apic_read(APIC_LVTERR);
-    apic_pm_state.apic_tmict = apic_read(APIC_TMICT);
     apic_pm_state.apic_tdcr = apic_read(APIC_TDCR);
     if (maxlvt >= 5)
         apic_pm_state.apic_thmr = apic_read(APIC_LVTTHMR);
@@ -755,7 +753,6 @@ int lapic_resume(void)
         apic_write(APIC_LVTPC, apic_pm_state.apic_lvtpc);
     apic_write(APIC_LVTT, apic_pm_state.apic_lvtt);
     apic_write(APIC_TDCR, apic_pm_state.apic_tdcr);
-    apic_write(APIC_TMICT, apic_pm_state.apic_tmict);
     apic_write(APIC_ESR, 0);
     apic_read(APIC_ESR);
     apic_write(APIC_LVTERR, apic_pm_state.apic_lvterr);
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.17


From xen-changelog-bounces@lists.xenproject.org Wed Sep 03 13:00:06 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 03 Sep 2025 13:00:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1108249.1458387 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1utn5m-0007qT-Vi; Wed, 03 Sep 2025 13:00:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1108249.1458387; Wed, 03 Sep 2025 13: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 1utn5m-0007pz-Rs; Wed, 03 Sep 2025 13:00:02 +0000
Received: by outflank-mailman (input) for mailman id 1108249;
 Wed, 03 Sep 2025 13: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 1utn5m-0007dz-1H
 for xen-changelog@lists.xenproject.org; Wed, 03 Sep 2025 13: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 1utn5l-004acj-2R
 for xen-changelog@lists.xenproject.org;
 Wed, 03 Sep 2025 13:00:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1utn5l-00ENEB-30
 for xen-changelog@lists.xenproject.org;
 Wed, 03 Sep 2025 13: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=PY+2O5/CwMWQw+hv5ROCxsoUQvXut5c18ZYq+uiEIU0=; b=ZMAydnG0DN2qkBSP2IB/kJSh9L
	Z5QYwDUJGI5cDeJofGTToPTvUJCLAyFOM5uVCDhlwOcO9j9K9a8s7pQyPFQqqSVuMdNUmWr0s1zvq
	PkWsFsgpfLjRwxdCVwCEUQtGawEkXx8SV2EzJjvE/px8p4Us1LhufTHDTv8gbtENyNes=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.20] x86/hpet: do local APIC EOI after interrupt processing
Message-Id: <E1utn5l-00ENEB-30@xenbits.xenproject.org>
Date: Wed, 03 Sep 2025 13:00:01 +0000

commit 67fcd2d2e59558a2b0936f35e4b9be10fb5848f1
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Sep 3 13:54:21 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 3 13:54:21 2025 +0200

    x86/hpet: do local APIC EOI after interrupt processing
    
    The current logic in the HPET interrupt ->ack() hook will perform a local
    APIC EOI ahead of enabling interrupts, possibly leading to recursion in the
    interrupt handler.
    
    Fix this by doing the local APIC EOI strictly after the window with
    interrupt enabled, as that prevents the recursion, and would only allow for
    interrupts with higher priority to be serviced.
    
    Use the generic ack_nonmaskable_msi_irq() and end_nonmaskable_irq()
    functions, removing the need for hpet_msi_ack().
    
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Fixes: 3ba523ff957c ('CPUIDLE: enable MSI capable HPET for timer broadcast')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 1db7829e56578970c1037c4dd1c27f939be4c054
    master date: 2025-08-06 10:47:16 +0200
---
 xen/arch/x86/hpet.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/xen/arch/x86/hpet.c b/xen/arch/x86/hpet.c
index 9290cf7a42..7e9d996436 100644
--- a/xen/arch/x86/hpet.c
+++ b/xen/arch/x86/hpet.c
@@ -299,13 +299,6 @@ static unsigned int cf_check hpet_msi_startup(struct irq_desc *desc)
 
 #define hpet_msi_shutdown hpet_msi_mask
 
-static void cf_check hpet_msi_ack(struct irq_desc *desc)
-{
-    irq_complete_move(desc);
-    move_native_irq(desc);
-    ack_APIC_irq();
-}
-
 static void cf_check hpet_msi_set_affinity(
     struct irq_desc *desc, const cpumask_t *mask)
 {
@@ -333,7 +326,8 @@ static hw_irq_controller hpet_msi_type = {
     .shutdown   = hpet_msi_shutdown,
     .enable	    = hpet_msi_unmask,
     .disable    = hpet_msi_mask,
-    .ack        = hpet_msi_ack,
+    .ack        = ack_nonmaskable_msi_irq,
+    .end        = end_nonmaskable_irq,
     .set_affinity   = hpet_msi_set_affinity,
 };
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.20


From xen-changelog-bounces@lists.xenproject.org Wed Sep 03 13:00:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 03 Sep 2025 13:00:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1108250.1458389 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1utn5x-0008OU-06; Wed, 03 Sep 2025 13:00:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1108250.1458389; Wed, 03 Sep 2025 13:00: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 1utn5w-0008OM-TQ; Wed, 03 Sep 2025 13:00:12 +0000
Received: by outflank-mailman (input) for mailman id 1108250;
 Wed, 03 Sep 2025 13: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 1utn5w-0008OE-2x
 for xen-changelog@lists.xenproject.org; Wed, 03 Sep 2025 13: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 1utn5v-004ad5-2k
 for xen-changelog@lists.xenproject.org;
 Wed, 03 Sep 2025 13:00:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1utn5w-00ENFp-05
 for xen-changelog@lists.xenproject.org;
 Wed, 03 Sep 2025 13: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=NcDGK34jl/V1oXjpdo92XlCOE1BiZEu6v16Vaf6v+/k=; b=i0glhfaYnVC9ugGqQBU9izMhvu
	XY+PvjeHq/jnfecm4LukllkcX+XrZ2YdzlzUiZaYifT/lVmSytNPpVcPWTWdQMFtt9S7/uoA+pqrn
	CmapJy8QiBgt4bl7wIgq4/wuOyfV5QS7l3HJVYoxIOBJuuHckhBAEtGR023yghF70KpQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.20] efi: Call FreePages() only if needed
Message-Id: <E1utn5w-00ENFp-05@xenbits.xenproject.org>
Date: Wed, 03 Sep 2025 13:00:12 +0000

commit 16dae1e1cff369c9127b6207ec1d1b2f000a06ca
Author:     Ross Lagerwall <ross.lagerwall@citrix.com>
AuthorDate: Wed Sep 3 13:55:02 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 3 13:55:02 2025 +0200

    efi: Call FreePages() only if needed
    
    If the config file is builtin, cfg.addr will be zero but Xen
    unconditionally calls FreePages() on the address.
    
    Xen may also call FreePages() with a zero address if blexit() is called
    after this point since cfg.need_to_free is not set to false.
    
    The UEFI specification does not say whether calling FreePages() with a
    zero address is allowed so let's be cautious and use cfg.need_to_free
    properly.
    
    Fixes: 8a71d50ed40b ("efi: Enable booting unified hypervisor/kernel/initrd images")
    Fixes: 04be2c3a0678 ("efi/boot.c: add file.need_to_free")
    Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by Daniel P. Smith <dpsmith@apertussolutions.com>
    master commit: 7fddedd530561797d8ce5fba78e83cc9cc6b58dd
    master date: 2025-08-12 11:40:28 +0200
---
 xen/common/efi/boot.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c
index efbec00af9..01062bb39f 100644
--- a/xen/common/efi/boot.c
+++ b/xen/common/efi/boot.c
@@ -1484,8 +1484,11 @@ void EFIAPI __init noreturn efi_start(EFI_HANDLE ImageHandle,
 
         efi_arch_cfg_file_late(loaded_image, dir_handle, section.s);
 
-        efi_bs->FreePages(cfg.addr, PFN_UP(cfg.size));
-        cfg.addr = 0;
+        if ( cfg.need_to_free )
+        {
+            efi_bs->FreePages(cfg.addr, PFN_UP(cfg.size));
+            cfg.need_to_free = false;
+        }
 
         dir_handle->Close(dir_handle);
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.20


From xen-changelog-bounces@lists.xenproject.org Wed Sep 03 13:00:24 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 03 Sep 2025 13:00:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1108251.1458393 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1utn68-0008Qy-1P; Wed, 03 Sep 2025 13:00:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1108251.1458393; Wed, 03 Sep 2025 13:00: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 1utn67-0008Qq-Ur; Wed, 03 Sep 2025 13:00:23 +0000
Received: by outflank-mailman (input) for mailman id 1108251;
 Wed, 03 Sep 2025 13: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 1utn66-0008Qf-7X
 for xen-changelog@lists.xenproject.org; Wed, 03 Sep 2025 13: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 1utn65-004adB-3C
 for xen-changelog@lists.xenproject.org;
 Wed, 03 Sep 2025 13:00:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1utn66-00ENGS-0M
 for xen-changelog@lists.xenproject.org;
 Wed, 03 Sep 2025 13: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=AnjZZUceVCh0x8Futz5V9Koood3Py1DZ8x/0sDuZIzo=; b=kRywWpTwO6e201CpAeV3S2rLys
	XJZ51rBamuXYC7wmao0Vdrx6Jv2+JOxccsSK26Vv26+4djk3zbcn9hPvFjjf7bw2LlCWYZRlZeOAd
	Zh/GaDs4h9SMWV/vvnH5/5EalYAzY/NmiDZsg9d44j8BNSo1Fn74tyIJMSGrWCML8j2A=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.20] x86/mkelf32: pad load segment to 2Mb boundary
Message-Id: <E1utn66-00ENGS-0M@xenbits.xenproject.org>
Date: Wed, 03 Sep 2025 13:00:22 +0000

commit e2590544d5651170dd889b1c6f0328b6a439a43f
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Sep 3 13:55:37 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 3 13:55:37 2025 +0200

    x86/mkelf32: pad load segment to 2Mb boundary
    
    In order to legitimately set up initial mappings past _end[], we need
    to make sure that the entire mapped range is inside a RAM region.
    Therefore we need to inform the bootloader (or alike) that our allocated
    size is larger than just the next SECTION_ALIGN-ed boundary past _end[].
    
    This allows dropping a command line option from the tool, which was
    introduced to work around a supposed linker bug, when the problem was
    really Xen's.
    
    While adjusting adjacent code, correct the argc check to also cover the
    case correctly when --notes was passed.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 4fb075201f54b16c0800af0107162461a93065fb
    master date: 2025-08-18 10:42:24 +0200
---
 xen/arch/x86/Makefile       |  3 +--
 xen/arch/x86/boot/mkelf32.c | 18 +++++++++++-------
 2 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile
index a0954a6a8c..95b30a888f 100644
--- a/xen/arch/x86/Makefile
+++ b/xen/arch/x86/Makefile
@@ -126,8 +126,7 @@ orphan-handling-$(call ld-option,--orphan-handling=warn) += --orphan-handling=wa
 
 $(TARGET): TMP = $(dot-target).elf32
 $(TARGET): $(TARGET)-syms $(efi-y) $(obj)/boot/mkelf32
-	$(obj)/boot/mkelf32 $(notes_phdrs) $(TARGET)-syms $(TMP) $(XEN_IMG_OFFSET) \
-	               `$(NM) $(TARGET)-syms | sed -ne 's/^\([^ ]*\) . __2M_rwdata_end$$/0x\1/p'`
+	$(obj)/boot/mkelf32 $(notes_phdrs) $(TARGET)-syms $(TMP) $(XEN_IMG_OFFSET)
 	od -t x4 -N 8192 $(TMP)  | grep 1badb002 > /dev/null || \
 		{ echo "No Multiboot1 header found" >&2; false; }
 	od -t x4 -N 32768 $(TMP) | grep e85250d6 > /dev/null || \
diff --git a/xen/arch/x86/boot/mkelf32.c b/xen/arch/x86/boot/mkelf32.c
index f0f406687c..373ba4ddd5 100644
--- a/xen/arch/x86/boot/mkelf32.c
+++ b/xen/arch/x86/boot/mkelf32.c
@@ -248,7 +248,6 @@ static void do_read(int fd, void *data, int len)
 
 int main(int argc, char **argv)
 {
-    uint64_t   final_exec_addr;
     uint32_t   loadbase, dat_siz, mem_siz, note_base, note_sz, offset;
     char      *inimage, *outimage;
     int        infd, outfd;
@@ -261,22 +260,24 @@ int main(int argc, char **argv)
     Elf64_Ehdr in64_ehdr;
     Elf64_Phdr in64_phdr;
 
-    if ( argc < 5 )
+    if ( argc < 4 )
     {
+    help:
         fprintf(stderr, "Usage: mkelf32 [--notes] <in-image> <out-image> "
-                "<load-base> <final-exec-addr>\n");
+                "<load-base>\n");
         return 1;
     }
 
     if ( !strcmp(argv[1], "--notes") )
     {
+        if ( argc < 5 )
+            goto help;
         i = 2;
         num_phdrs = 2;
     }
     inimage  = argv[i++];
     outimage = argv[i++];
     loadbase = strtoul(argv[i++], NULL, 16);
-    final_exec_addr = strtoull(argv[i++], NULL, 16);
 
     infd = open(inimage, O_RDONLY);
     if ( infd == -1 )
@@ -339,9 +340,12 @@ int main(int argc, char **argv)
     (void)lseek(infd, in64_phdr.p_offset, SEEK_SET);
     dat_siz = (uint32_t)in64_phdr.p_filesz;
 
-    /* Do not use p_memsz: it does not include BSS alignment padding. */
-    /*mem_siz = (uint32_t)in64_phdr.p_memsz;*/
-    mem_siz = (uint32_t)(final_exec_addr - in64_phdr.p_vaddr);
+    /*
+     * We don't pad .bss in the linker script, but during early boot we map
+     * the Xen image using 2M pages.  To avoid running into adjacent non-RAM
+     * regions, pad the segment to the next 2M boundary.
+     */
+    mem_siz = ((uint32_t)in64_phdr.p_memsz + (1U << 20) - 1) & (-1U << 20);
 
     note_sz = note_base = offset = 0;
     if ( num_phdrs > 1 )
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.20


From xen-changelog-bounces@lists.xenproject.org Wed Sep 03 13:00:34 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 03 Sep 2025 13:00:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1108252.1458397 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1utn6I-0008Sx-2Z; Wed, 03 Sep 2025 13:00:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1108252.1458397; Wed, 03 Sep 2025 13: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 1utn6H-0008Sp-WD; Wed, 03 Sep 2025 13:00:34 +0000
Received: by outflank-mailman (input) for mailman id 1108252;
 Wed, 03 Sep 2025 13: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 1utn6G-0008Sd-AQ
 for xen-changelog@lists.xenproject.org; Wed, 03 Sep 2025 13: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 1utn6G-004adH-0G
 for xen-changelog@lists.xenproject.org;
 Wed, 03 Sep 2025 13:00:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1utn6G-00ENHT-0p
 for xen-changelog@lists.xenproject.org;
 Wed, 03 Sep 2025 13: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=P8JO+rOmvzjX+A+Wcxsz+NeyQiufT9xKw/wlOnvRH+E=; b=1lvcG3dpD12zaosc8hmGH9q2xD
	7CumRGmSmUsAQt4cToHTqCUjORYraQbqPpUuK8eqZdeyOlhn4+JX9fkgO/cGbuh87v0VnPeDWHZ3q
	4Y/T4+DBFxk1GhG6c+m+gAwyVEx56+qEHl8+oTxEtRn8XJKOkDyYc92Fvts4ov/ljLC0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.20] x86/hvm/ioreq: Fix condition in hvm_alloc_legacy_ioreq_gfn()
Message-Id: <E1utn6G-00ENHT-0p@xenbits.xenproject.org>
Date: Wed, 03 Sep 2025 13:00:32 +0000

commit cb827d83175e41e1aa3f6a4de1ef5a88f91dc16a
Author:     Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
AuthorDate: Wed Sep 3 13:56:04 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 3 13:56:04 2025 +0200

    x86/hvm/ioreq: Fix condition in hvm_alloc_legacy_ioreq_gfn()
    
    Fix the incorrect condition that causes hvm_alloc_legacy_ioreq_gfn()
    to return INVALID_GFN even if the HVM param was installed properly by
    the toolstack.
    
    Fixes: 3486f398a3dd (' x86/hvm/ioreq: allow ioreq servers to use HVM_PARAM_[BUF]IOREQ_PFN')
    Signed-off-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 282ed258a59195698a81ab4408a17336eb6ea7ed
    master date: 2025-08-18 10:43:52 +0200
---
 xen/arch/x86/hvm/ioreq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/hvm/ioreq.c b/xen/arch/x86/hvm/ioreq.c
index d6491df8e7..c1c9da819d 100644
--- a/xen/arch/x86/hvm/ioreq.c
+++ b/xen/arch/x86/hvm/ioreq.c
@@ -63,7 +63,7 @@ static gfn_t hvm_alloc_legacy_ioreq_gfn(struct ioreq_server *s)
 
     for ( i = HVM_PARAM_IOREQ_PFN; i <= HVM_PARAM_BUFIOREQ_PFN; i++ )
     {
-        if ( !test_and_clear_bit(i, &d->arch.hvm.ioreq_gfn.legacy_mask) )
+        if ( test_and_clear_bit(i, &d->arch.hvm.ioreq_gfn.legacy_mask) )
             return _gfn(d->arch.hvm.params[i]);
     }
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.20


From xen-changelog-bounces@lists.xenproject.org Wed Sep 03 13:00:44 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 03 Sep 2025 13:00:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1108253.1458403 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1utn6S-0008Vt-4t; Wed, 03 Sep 2025 13:00:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1108253.1458403; Wed, 03 Sep 2025 13: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 1utn6S-0008Vl-1E; Wed, 03 Sep 2025 13:00:44 +0000
Received: by outflank-mailman (input) for mailman id 1108253;
 Wed, 03 Sep 2025 13: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 1utn6Q-0008Vd-EX
 for xen-changelog@lists.xenproject.org; Wed, 03 Sep 2025 13: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 1utn6Q-004adL-0d
 for xen-changelog@lists.xenproject.org;
 Wed, 03 Sep 2025 13:00:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1utn6Q-00ENKF-18
 for xen-changelog@lists.xenproject.org;
 Wed, 03 Sep 2025 13: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=sFXvoEV9eSY42Lk3+I+RAgduLORfRx9Mf5TDI7wtuAc=; b=e45sDLN3GdiqP1T7w7yXY1Jd9D
	jlX+qaYsASCNJUJ+Anu7m7sGUBFtlLssfEdzvisr/oZBI3jxIe7VlP1WmmzbfyChX96nuRtTnRMeD
	kbaFhMmGzA54rUdq9+vJg0bGo+Uff9Nw3x2vtN4jjknki0AkrTQPhADvSfXd3WTep2Sw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.20] x86/iommu: setup MMCFG ahead of IOMMU
Message-Id: <E1utn6Q-00ENKF-18@xenbits.xenproject.org>
Date: Wed, 03 Sep 2025 13:00:42 +0000

commit a98591e217b7d1bdd5bb27d81184456bb69771b2
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Sep 3 13:56:27 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 3 13:56:27 2025 +0200

    x86/iommu: setup MMCFG ahead of IOMMU
    
    Otherwise the PCI accesses to segments different than the first one done by
    the IOMMU initialization code would silently fail by returning all ones.
    
    Introduce a new helper, called pci_setup(), and move both the creation of
    PCI segment 0 internal data structures, plus the parsing of ACPI MMCFG
    table to it.  This moves acpi_mmcfg_init() slightly earlier from
    acpi_boot_init() into pci_setup().
    
    Note that further work will be needed to support systems where access
    methods to segments different than 0 is not discoverable by Xen.
    
    Fixes: 3950f2485bbc ('x86/x2APIC: defer probe until after IOMMU ACPI table parsing')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: c292772b4945d3a264a61c3c1920f1aebd17998b
    master date: 2025-08-21 11:57:25 +0200
---
 xen/arch/x86/acpi/boot.c              | 2 --
 xen/arch/x86/setup.c                  | 6 ++++++
 xen/arch/x86/x86_64/mmconfig-shared.c | 3 +++
 3 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/acpi/boot.c b/xen/arch/x86/acpi/boot.c
index 3901f9d982..1ca2360e00 100644
--- a/xen/arch/x86/acpi/boot.c
+++ b/xen/arch/x86/acpi/boot.c
@@ -748,8 +748,6 @@ int __init acpi_boot_init(void)
 
 	acpi_table_parse(ACPI_SIG_HPET, acpi_parse_hpet);
 
-	acpi_mmcfg_init();
-
 	erst_init();
 
 	acpi_hest_init();
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 6e49d2705b..10d55884ab 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -1897,6 +1897,12 @@ void asmlinkage __init noreturn __start_xen(void)
      */
     setup_system_domains();
 
+    /*
+     * Initialize PCI (create segment 0, setup MMCFG access) ahead of IOMMU
+     * setup, as devices in segment > 0 must also be discoverable.
+     */
+    acpi_mmcfg_init();
+
     /*
      * IOMMU-related ACPI table parsing has to happen before APIC probing, for
      * check_x2apic_preenabled() to be able to observe respective findings, in
diff --git a/xen/arch/x86/x86_64/mmconfig-shared.c b/xen/arch/x86/x86_64/mmconfig-shared.c
index 77ba1e28f1..d2ec3d808f 100644
--- a/xen/arch/x86/x86_64/mmconfig-shared.c
+++ b/xen/arch/x86/x86_64/mmconfig-shared.c
@@ -404,6 +404,9 @@ void __init acpi_mmcfg_init(void)
 
     pci_segments_init();
 
+    if ( acpi_disabled )
+        return;
+
     /* MMCONFIG disabled */
     if ((pci_probe & PCI_PROBE_MMCONF) == 0)
         return;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.20


From xen-changelog-bounces@lists.xenproject.org Wed Sep 03 13:00:54 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 03 Sep 2025 13:00:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1108254.1458405 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1utn6c-00006X-6R; Wed, 03 Sep 2025 13:00:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1108254.1458405; Wed, 03 Sep 2025 13: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 1utn6c-00006P-3u; Wed, 03 Sep 2025 13:00:54 +0000
Received: by outflank-mailman (input) for mailman id 1108254;
 Wed, 03 Sep 2025 13: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 1utn6a-00006G-HU
 for xen-changelog@lists.xenproject.org; Wed, 03 Sep 2025 13: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 1utn6a-004adP-0u
 for xen-changelog@lists.xenproject.org;
 Wed, 03 Sep 2025 13:00:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1utn6a-00ENLc-1U
 for xen-changelog@lists.xenproject.org;
 Wed, 03 Sep 2025 13: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=m21Fltfa9RZ1bZnRsT0AWhB5/pNAw98gNm/EESwdjHw=; b=RoIYVzqEBZqTluZnF1tMCraw3F
	N17iAwQJrpiJD0KNnkAeBsjlUgTC90sWPzEkA7CAnl9wSUtItkNra2ru0+8XKjcUxkc+neXYGbLyr
	c+mVY5ZD0enoHDbUn4ixkEIW8ItFMKd8i7aHmMDcGcfDrolWWpFYFELPyVInzClwLZ6U=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.20] x86/mce: Adjustments to intel_init_ppin()
Message-Id: <E1utn6a-00ENLc-1U@xenbits.xenproject.org>
Date: Wed, 03 Sep 2025 13:00:52 +0000

commit 96b7183a021eccf8e4ed7e0a642e3f7a25081c34
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Sep 3 13:56:55 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 3 13:56:55 2025 +0200

    x86/mce: Adjustments to intel_init_ppin()
    
    There's no family check gating intel_init_ppin(), making it incorrect to
    use on non Fam6 CPUs.
    
    Emerald Rapids is the final CPU to have PPIN but lack the architectural
    enumeration, so include it too.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 49e6eb744eba01f5d4b4cfce49154c0802d4f5c6
    master date: 2025-08-25 14:04:41 +0100
---
 xen/arch/x86/cpu/mcheck/mce_intel.c | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/xen/arch/x86/cpu/mcheck/mce_intel.c b/xen/arch/x86/cpu/mcheck/mce_intel.c
index 07b50f8793..f09a190b6c 100644
--- a/xen/arch/x86/cpu/mcheck/mce_intel.c
+++ b/xen/arch/x86/cpu/mcheck/mce_intel.c
@@ -10,6 +10,7 @@
 #include <xen/cpu.h>
 #include <asm/processor.h>
 #include <public/sysctl.h>
+#include <asm/intel-family.h>
 #include <asm/system.h>
 #include <asm/msr.h>
 #include <asm/p2m.h>
@@ -859,7 +860,7 @@ static void intel_init_ppin(const struct cpuinfo_x86 *c)
      * other purposes.  Despite the late addition of a CPUID bit (rendering
      * the MSR architectural), keep using the same detection logic there.
      */
-    switch ( c->x86_model )
+    switch ( c->x86 == 6 ? c->x86_model : 0 )
     {
         uint64_t val;
 
@@ -870,14 +871,15 @@ static void intel_init_ppin(const struct cpuinfo_x86 *c)
             return;
         }
         fallthrough;
-    case 0x3e: /* IvyBridge X */
-    case 0x3f: /* Haswell X */
-    case 0x4f: /* Broadwell X */
-    case 0x55: /* Skylake X */
-    case 0x56: /* Broadwell Xeon D */
-    case 0x6a: /* Icelake X */
-    case 0x6c: /* Icelake D */
-    case 0x8f: /* Sapphire Rapids X */
+    case INTEL_FAM6_IVYBRIDGE_X:
+    case INTEL_FAM6_HASWELL_X:
+    case INTEL_FAM6_BROADWELL_X:
+    case INTEL_FAM6_BROADWELL_D:
+    case INTEL_FAM6_SKYLAKE_X:
+    case INTEL_FAM6_ICELAKE_X:
+    case INTEL_FAM6_ICELAKE_D:
+    case INTEL_FAM6_SAPPHIRERAPIDS_X:
+    case INTEL_FAM6_EMERALDRAPIDS_X:
 
         if ( (c != &boot_cpu_data && !ppin_msr) ||
              rdmsr_safe(MSR_PPIN_CTL, val) )
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.20


From xen-changelog-bounces@lists.xenproject.org Wed Sep 03 13:01:04 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 03 Sep 2025 13:01:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1108255.1458408 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1utn6m-00009J-7v; Wed, 03 Sep 2025 13:01:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1108255.1458408; Wed, 03 Sep 2025 13: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 1utn6m-00009B-5I; Wed, 03 Sep 2025 13:01:04 +0000
Received: by outflank-mailman (input) for mailman id 1108255;
 Wed, 03 Sep 2025 13: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 1utn6k-000094-JS
 for xen-changelog@lists.xenproject.org; Wed, 03 Sep 2025 13: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 1utn6k-004adi-1B
 for xen-changelog@lists.xenproject.org;
 Wed, 03 Sep 2025 13:01:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1utn6k-00ENMX-1k
 for xen-changelog@lists.xenproject.org;
 Wed, 03 Sep 2025 13: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=Bl6heb/H3gSdOgUMmjWZC4PzKAeVGQ+iiTn02WICBLA=; b=AtrosPI0RvIIyy1Y71I47XqWiD
	IHdhiV81lG/GNcX3A6h2whEocarWI7hLeVeoO9zrx4xwDawVA5pUgfgdPGkmt188F/N4A5gjE3S87
	IZ6mQomQz3XFpdMlRB1o0ydkUL4MqVN+QELLrcdSYFgUQXBg7WGrDzJ+4MT4bhC9X2J0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.20] x86/suspend: unconditionally raise a timer softirq on resume
Message-Id: <E1utn6k-00ENMX-1k@xenbits.xenproject.org>
Date: Wed, 03 Sep 2025 13:01:02 +0000

commit 1541866d47002db71b3f4760174f556c8206e776
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Sep 3 13:57:31 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 3 13:57:31 2025 +0200

    x86/suspend: unconditionally raise a timer softirq on resume
    
    The current code to restore the timer state on resume is incomplete.  While
    the local APIC Initial Count Register is saved and restored across
    suspension (even if possibly no longer accurate since it's not adjusted to
    account for the time spent in suspension), the TSC deadline MSR is not
    saved and restored, hence hosts using the TSC deadline timer will likely
    get stuck when resuming from suspension.
    
    The lack of restoring of the TSC deadline MSR was mitigated by the raising
    of a timer softirq in mwait_idle_with_hints() if the timer had expired,
    previous to commit 3faf0866a33070b926ab78e6298290403f85e76c, which removed
    that logic.
    
    This patch fixes the usage of the TSC deadline timer with suspension, by
    unconditionally raising a timer softirq on resume, that will take care of
    rearming the hardware timer.  Given that a timer softirq will be
    unconditionally risen, there's no need to save and restore the APIC Initial
    Count Register anymore either.
    
    Note that secondary processors don't need this special treatment when
    resuming, since they are offlined before suspension and brought back up
    during resume, the first timer that gets setup will trigger a timer softirq
    unconditionally, for example from sched_migrate_timers() that gets called
    for each secondary processor.
    
    Link: https://github.com/QubesOS/qubes-issues/issues/10110
    Reported-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Fixes: fd1291a826e1 ('X86: Prefer TSC-deadline timer in Xen')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Tested-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    master commit: 757abedabbb64f18a28ae61a7bd67a927bb03130
    master date: 2025-08-27 09:33:12 +0200
---
 xen/arch/x86/acpi/power.c | 2 ++
 xen/arch/x86/apic.c       | 3 ---
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/acpi/power.c b/xen/arch/x86/acpi/power.c
index b69be6e898..be96268195 100644
--- a/xen/arch/x86/acpi/power.c
+++ b/xen/arch/x86/acpi/power.c
@@ -22,6 +22,7 @@
 #include <xen/domain.h>
 #include <xen/console.h>
 #include <xen/iommu.h>
+#include <xen/softirq.h>
 #include <xen/watchdog.h>
 #include <xen/cpu.h>
 #include <public/platform.h>
@@ -332,6 +333,7 @@ static int enter_state(u32 state)
     thaw_domains();
     system_state = SYS_STATE_active;
     spin_unlock(&pm_lock);
+    raise_softirq(TIMER_SOFTIRQ);
     return error;
 }
 
diff --git a/xen/arch/x86/apic.c b/xen/arch/x86/apic.c
index bb86a1c161..7a0920d11c 100644
--- a/xen/arch/x86/apic.c
+++ b/xen/arch/x86/apic.c
@@ -65,7 +65,6 @@ static struct {
     unsigned int apic_lvt0;
     unsigned int apic_lvt1;
     unsigned int apic_lvterr;
-    unsigned int apic_tmict;
     unsigned int apic_tdcr;
     unsigned int apic_thmr;
 } apic_pm_state;
@@ -658,7 +657,6 @@ int lapic_suspend(void)
     apic_pm_state.apic_lvt0 = apic_read(APIC_LVT0);
     apic_pm_state.apic_lvt1 = apic_read(APIC_LVT1);
     apic_pm_state.apic_lvterr = apic_read(APIC_LVTERR);
-    apic_pm_state.apic_tmict = apic_read(APIC_TMICT);
     apic_pm_state.apic_tdcr = apic_read(APIC_TDCR);
     if (maxlvt >= 5)
         apic_pm_state.apic_thmr = apic_read(APIC_LVTTHMR);
@@ -718,7 +716,6 @@ int lapic_resume(void)
         apic_write(APIC_LVTPC, apic_pm_state.apic_lvtpc);
     apic_write(APIC_LVTT, apic_pm_state.apic_lvtt);
     apic_write(APIC_TDCR, apic_pm_state.apic_tdcr);
-    apic_write(APIC_TMICT, apic_pm_state.apic_tmict);
     apic_write(APIC_ESR, 0);
     apic_read(APIC_ESR);
     apic_write(APIC_LVTERR, apic_pm_state.apic_lvterr);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.20


From xen-changelog-bounces@lists.xenproject.org Wed Sep 03 13:01:14 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 03 Sep 2025 13:01:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1108258.1458413 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1utn6w-0000Bz-9d; Wed, 03 Sep 2025 13:01:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1108258.1458413; Wed, 03 Sep 2025 13: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 1utn6w-0000Br-6d; Wed, 03 Sep 2025 13:01:14 +0000
Received: by outflank-mailman (input) for mailman id 1108258;
 Wed, 03 Sep 2025 13: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 1utn6u-0000Bg-ML
 for xen-changelog@lists.xenproject.org; Wed, 03 Sep 2025 13: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 1utn6u-004ae8-1T
 for xen-changelog@lists.xenproject.org;
 Wed, 03 Sep 2025 13:01:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1utn6u-00ENN3-21
 for xen-changelog@lists.xenproject.org;
 Wed, 03 Sep 2025 13: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=UtYDf2gQLKJbuiUSlWw9/QQmaVsXIv8OBqt1LcVV/jk=; b=Rt8f5iHIB6LAKoNK88IIrd0ANf
	3N28S7ruHdqDAnMAVRwhl0yREYW5sXF088CWfGOkCHCvDRT6TVXSDXC1cXrwtXatUiRf8mDsihksn
	ZmsIzNGLlLrqXPavon5BIhrlx1tix7o4dLBODAWz99VAOCwQbCRDsdhqrSy9Wakmkuh8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.20] tools: add sizeof_field and endof_field macros
Message-Id: <E1utn6u-00ENN3-21@xenbits.xenproject.org>
Date: Wed, 03 Sep 2025 13:01:12 +0000

commit 68f5ecf690be4b8b6979eb55f2467ee4020e08d3
Author:     Petr Beneš <w1benny@gmail.com>
AuthorDate: Wed Sep 3 13:57:54 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 3 13:57:54 2025 +0200

    tools: add sizeof_field and endof_field macros
    
    * `sizeof_field` returns the size of a specific struct member
    * `endof_field` returns the offset to the end of the member within the struct
    
    It will be useful in upcoming layout checks of SMBIOS structs.
    
    Signed-off-by: Petr Beneš <w1benny@gmail.com>
    Acked-by: Anthony PERARD <anthony.perard@vates.tech>
    master commit: 17e66ca9188b423eee35e6b4bf878e62d3879a04
    master date: 2025-08-27 11:26:33 +0200
---
 tools/include/xen-tools/common-macros.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tools/include/xen-tools/common-macros.h b/tools/include/xen-tools/common-macros.h
index 0088208c2e..9838a108aa 100644
--- a/tools/include/xen-tools/common-macros.h
+++ b/tools/include/xen-tools/common-macros.h
@@ -83,6 +83,11 @@
 #define __packed __attribute__((__packed__))
 #endif
 
+#define sizeof_field(type, member) sizeof(((type *)NULL)->member)
+
+#define endof_field(type, member) \
+    (offsetof(type, member) + sizeof_field(type, member))
+
 #define container_of(ptr, type, member) ({              \
     typeof(((type *)0)->member) *mptr__ = (ptr);        \
     (type *)((char *)mptr__ - offsetof(type, member));  \
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.20


From xen-changelog-bounces@lists.xenproject.org Wed Sep 03 13:01:24 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 03 Sep 2025 13:01:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1108259.1458417 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1utn76-0000EC-Ac; Wed, 03 Sep 2025 13:01:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1108259.1458417; Wed, 03 Sep 2025 13: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 1utn76-0000E4-7w; Wed, 03 Sep 2025 13:01:24 +0000
Received: by outflank-mailman (input) for mailman id 1108259;
 Wed, 03 Sep 2025 13: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 1utn74-0000Du-P7
 for xen-changelog@lists.xenproject.org; Wed, 03 Sep 2025 13: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 1utn74-004aeC-1k
 for xen-changelog@lists.xenproject.org;
 Wed, 03 Sep 2025 13:01:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1utn74-00ENOh-2K
 for xen-changelog@lists.xenproject.org;
 Wed, 03 Sep 2025 13: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=3Ukcy8yF+sSHnVZG4fpn06E3sZEMi8erADshhswXXgQ=; b=ymCyGf6eDon1jvodT70uqjy87+
	/4PbvBYT/ckG0GqTv5ZKy3XcJihx8XAn2nDiCkNYjy6aZWombi24G2MDV+k6pvtyC1rOmCkvMprvH
	9foMsJCtvCVtC81YyB1NsDHH+4PM/cHrvH4vcimVVdqwNaVahPcCZ8VGFNiuJRD24xQs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.20] hvmloader: fix SMBIOS table length checks
Message-Id: <E1utn74-00ENOh-2K@xenbits.xenproject.org>
Date: Wed, 03 Sep 2025 13:01:22 +0000

commit 9eb436c4612338c2807c929e87e9b966cca2dc34
Author:     Petr Beneš <w1benny@gmail.com>
AuthorDate: Wed Sep 3 13:58:03 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 3 13:58:03 2025 +0200

    hvmloader: fix SMBIOS table length checks
    
    SMBIOS specification dictates that tables should have a minimal length.
    This commit introduces further validation for user-input SMBIOS tables.
    
    As per SMBIOS Reference Specification:
    * Type 0: For version 2.3 and later implementations, the length is at least 14h
    * Type 1: 1Bh for 2.4 and later
    * Type 2: at least 08h
    * Type 3: 0Dh for version 2.1 and later
    * Type 11: 5h (+ strings)
    * Type 22: 1Ah (+ strings)
    * Type 39: a minimum of 10h
    
    Notably, this also fixes previously incorrect check for chassis handle in
    smbios_type_2_init. Chassis handle is a WORD, therefore, the condition now
    correctly checks for >= 13 instead of > 13.
    
    hvmloader currently implements version 2.4
    
    Furthermore, this commit introduces smbios_pt_copy helper function to substitute
    previously repeating pattern of locating the struct in physical memory (via
    get_smbios_pt_struct), checking the length and copying it into SMBIOS region.
    
    Fixes: 4d23036e7096 ("HVM firmware passthrough SMBIOS processing")
    Signed-off-by: Petr Beneš <w1benny@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    master commit: 2f7d52f0165a5b62dbec1e507d0de427abe9b5d5
    master date: 2025-08-27 11:26:33 +0200
---
 tools/firmware/hvmloader/smbios.c       | 178 +++++++++++++++++++-------------
 tools/firmware/hvmloader/smbios_types.h |  32 +++---
 2 files changed, 123 insertions(+), 87 deletions(-)

diff --git a/tools/firmware/hvmloader/smbios.c b/tools/firmware/hvmloader/smbios.c
index 97a054e9e3..27b242a832 100644
--- a/tools/firmware/hvmloader/smbios.c
+++ b/tools/firmware/hvmloader/smbios.c
@@ -47,6 +47,8 @@ static void
 smbios_pt_init(void);
 static void*
 get_smbios_pt_struct(uint8_t type, uint32_t *length_out);
+static void *
+smbios_pt_copy(void *start, uint8_t type, uint16_t handle, size_t table_size);
 static void
 get_cpu_manufacturer(char *buf, int len);
 static int
@@ -154,6 +156,24 @@ get_smbios_pt_struct(uint8_t type, uint32_t *length_out)
     return NULL;
 }
 
+static void *
+smbios_pt_copy(void *start, uint8_t type, uint16_t handle, size_t min_size)
+{
+    struct smbios_structure_header *header = start;
+    void *pts;
+    uint32_t length;
+
+    pts = get_smbios_pt_struct(type, &length);
+    if ( pts != NULL && length >= min_size )
+    {
+        memcpy(start, pts, length);
+        header->handle = handle;
+        return start + length;
+    }
+
+    return start;
+}
+
 static void
 get_cpu_manufacturer(char *buf, int len)
 {
@@ -381,16 +401,17 @@ smbios_type_0_init(void *start, const char *xen_version,
     struct smbios_type_0 *p = (struct smbios_type_0 *)start;
     static const char *smbios_release_date = __SMBIOS_DATE__;
     const char *s;
-    void *pts;
-    uint32_t length;
+    void *next;
 
-    pts = get_smbios_pt_struct(0, &length);
-    if ( (pts != NULL)&&(length > 0) )
-    {
-        memcpy(start, pts, length);
-        p->header.handle = SMBIOS_HANDLE_TYPE0;
-        return (start + length);
-    }
+    /*
+     * Specification says Type 0 table has length of at least 18h for v2.4-3.0.
+     */
+
+    BUILD_BUG_ON(sizeof(*p) != 24);
+
+    next = smbios_pt_copy(start, 0, SMBIOS_HANDLE_TYPE0, sizeof(*p));
+    if ( next != start )
+        return next;
 
     memset(p, 0, sizeof(*p));
 
@@ -440,16 +461,14 @@ smbios_type_1_init(void *start, const char *xen_version,
     char uuid_str[37];
     struct smbios_type_1 *p = (struct smbios_type_1 *)start;
     const char *s;
-    void *pts;
-    uint32_t length;
+    void *next;
 
-    pts = get_smbios_pt_struct(1, &length);
-    if ( (pts != NULL)&&(length > 0) )
-    {
-        memcpy(start, pts, length);
-        p->header.handle = SMBIOS_HANDLE_TYPE1;
-        return (start + length);
-    }
+    /* Specification says Type 1 table has length of 1Bh for v2.4 and later. */
+    BUILD_BUG_ON(sizeof(*p) != 27);
+
+    next = smbios_pt_copy(start, 1, SMBIOS_HANDLE_TYPE1, sizeof(*p));
+    if ( next != start )
+        return next;
 
     memset(p, 0, sizeof(*p));
 
@@ -498,26 +517,29 @@ smbios_type_2_init(void *start)
 {
     struct smbios_type_2 *p = (struct smbios_type_2 *)start;
     const char *s;
-    uint8_t *ptr;
-    void *pts;
-    uint32_t length;
+    void *next;
     unsigned int counter = 0;
 
-    pts = get_smbios_pt_struct(2, &length);
-    if ( (pts != NULL)&&(length > 0) )
-    {
-        memcpy(start, pts, length);
-        p->header.handle = SMBIOS_HANDLE_TYPE2;
+    /*
+     * Specification says Type 2 table has length of at least 08h,
+     * which corresponds with the end of the "Serial Number" field.
+     */
 
+    BUILD_BUG_ON(endof_field(struct smbios_type_2, serial_number_str) != 8);
+
+    next = smbios_pt_copy(start, 2, SMBIOS_HANDLE_TYPE2,
+                          endof_field(struct smbios_type_2, serial_number_str));
+    if ( next != start )
+    {
         /* Set current chassis handle if present */
-        if ( p->header.length > 13 )
+        if ( p->header.length >= endof_field(struct smbios_type_2,
+                                             chassis_handle) )
         {
-            ptr = ((uint8_t*)start) + 11;            
-            if ( *((uint16_t*)ptr) != 0 )
-                *((uint16_t*)ptr) = SMBIOS_HANDLE_TYPE3;
+            if ( p->chassis_handle != 0 )
+                p->chassis_handle = SMBIOS_HANDLE_TYPE3;
         }
 
-        return (start + length);
+        return next;
     }
 
     memset(p, 0, sizeof(*p));
@@ -593,18 +615,21 @@ smbios_type_3_init(void *start)
 {
     struct smbios_type_3 *p = (struct smbios_type_3 *)start;
     const char *s;
-    void *pts;
-    uint32_t length;
+    void *next;
     uint32_t counter = 0;
 
-    pts = get_smbios_pt_struct(3, &length);
-    if ( (pts != NULL)&&(length > 0) )
-    {
-        memcpy(start, pts, length);
-        p->header.handle = SMBIOS_HANDLE_TYPE3;
-        return (start + length);
-    }
-    
+    /*
+     * Specification says Type 3 table has length of at least 0Dh (for v2.1+),
+     * which corresponds with the end of the "Security Status" field.
+     */
+
+    BUILD_BUG_ON(endof_field(struct smbios_type_3, security_status) != 13);
+
+    next = smbios_pt_copy(start, 3, SMBIOS_HANDLE_TYPE3,
+                          offsetof(struct smbios_type_3, security_status));
+    if ( next != start )
+        return next;
+
     memset(p, 0, sizeof(*p));
 
     p->header.type = 3;
@@ -656,6 +681,9 @@ smbios_type_4_init(
     struct smbios_type_4 *p = (struct smbios_type_4 *)start;
     uint32_t eax, ebx, ecx, edx;
 
+    /* Specification says Type 4 table has length of 23h for v2.3+. */
+    BUILD_BUG_ON(sizeof(*p) != 35);
+
     memset(p, 0, sizeof(*p));
 
     p->header.type = 4;
@@ -707,17 +735,15 @@ smbios_type_11_init(void *start)
     struct smbios_type_11 *p = (struct smbios_type_11 *)start;
     char path[20];
     const char *s;
+    void *next;
     int i;
-    void *pts;
-    uint32_t length;
 
-    pts = get_smbios_pt_struct(11, &length);
-    if ( (pts != NULL)&&(length > 0) )
-    {
-        memcpy(start, pts, length);
-        p->header.handle = SMBIOS_HANDLE_TYPE11;
-        return (start + length);
-    }
+    /* Specification says Type 11 table has length of 05h. */
+    BUILD_BUG_ON(sizeof(*p) != 5);
+    
+    next = smbios_pt_copy(start, 11, SMBIOS_HANDLE_TYPE11, sizeof(*p));
+    if ( next != start )
+        return next;
 
     p->header.type = 11;
     p->header.length = sizeof(struct smbios_type_11);
@@ -756,6 +782,9 @@ smbios_type_16_init(void *start, uint32_t memsize, int nr_mem_devs)
 {
     struct smbios_type_16 *p = (struct smbios_type_16*)start;
 
+    /* Specification says Type 16 table has length of 0Fh for v2.1-2.7. */
+    BUILD_BUG_ON(sizeof(*p) != 15);
+
     memset(p, 0, sizeof(*p));
 
     p->header.type = 16;
@@ -781,6 +810,9 @@ smbios_type_17_init(void *start, uint32_t memory_size_mb, int instance)
     char buf[16];
     struct smbios_type_17 *p = (struct smbios_type_17 *)start;
     
+    /* Specification says Type 17 table has length of 1Bh for v2.3-2.6. */
+    BUILD_BUG_ON(sizeof(*p) != 27);
+
     memset(p, 0, sizeof(*p));
 
     p->header.type = 17;
@@ -816,6 +848,9 @@ smbios_type_19_init(void *start, uint32_t memory_size_mb, int instance)
 {
     struct smbios_type_19 *p = (struct smbios_type_19 *)start;
     
+    /* Specification says Type 19 table has length of 0Fh for v2.1-2.7. */
+    BUILD_BUG_ON(sizeof(*p) != 15);
+
     memset(p, 0, sizeof(*p));
 
     p->header.type = 19;
@@ -838,6 +873,9 @@ smbios_type_20_init(void *start, uint32_t memory_size_mb, int instance)
 {
     struct smbios_type_20 *p = (struct smbios_type_20 *)start;
 
+    /* Specification says Type 20 table has length of 13h for v2.1-2.7. */
+    BUILD_BUG_ON(sizeof(*p) != 19);
+
     memset(p, 0, sizeof(*p));
 
     p->header.type = 20;
@@ -865,16 +903,14 @@ smbios_type_22_init(void *start)
     struct smbios_type_22 *p = (struct smbios_type_22 *)start;
     static const char *smbios_release_date = __SMBIOS_DATE__;
     const char *s;
-    void *pts;
-    uint32_t length;
+    void *next;
 
-    pts = get_smbios_pt_struct(22, &length);
-    if ( (pts != NULL)&&(length > 0) )
-    {
-        memcpy(start, pts, length);
-        p->header.handle = SMBIOS_HANDLE_TYPE22;
-        return (start + length);
-    }
+    /* Specification says Type 22 table has length of 1Ah. */
+    BUILD_BUG_ON(sizeof(*p) != 26);
+
+    next = smbios_pt_copy(start, 22, SMBIOS_HANDLE_TYPE22, sizeof(*p));
+    if ( next != start )
+        return next;
 
     s = xenstore_read(HVM_XS_SMBIOS_DEFAULT_BATTERY, "0");
     if ( strncmp(s, "1", 1) != 0 )
@@ -929,6 +965,9 @@ smbios_type_32_init(void *start)
 {
     struct smbios_type_32 *p = (struct smbios_type_32 *)start;
 
+    /* Specification says Type 32 table has length of at least 0Bh. */
+    BUILD_BUG_ON(sizeof(*p) != 11);
+
     memset(p, 0, sizeof(*p));
 
     p->header.type = 32;
@@ -946,20 +985,17 @@ smbios_type_32_init(void *start)
 static void *
 smbios_type_39_init(void *start)
 {
-    struct smbios_type_39 *p = (struct smbios_type_39 *)start;
-    void *pts;
-    uint32_t length;
+    /*
+     * Specification says Type 39 table has length of at least 10h,
+     * which corresponds with the end of the "Characteristics" field.
+     *
+     * Only present when passed in.
+     */
 
-    pts = get_smbios_pt_struct(39, &length);
-    if ( (pts != NULL)&&(length > 0) )
-    {
-        memcpy(start, pts, length);
-        p->header.handle = SMBIOS_HANDLE_TYPE39;
-        return (start + length);
-    }
+    BUILD_BUG_ON(endof_field(struct smbios_type_39, characteristics) != 16);
 
-    /* Only present when passed in */
-    return start;
+    return smbios_pt_copy(start, 39, SMBIOS_HANDLE_TYPE39,
+                          endof_field(struct smbios_type_39, characteristics));
 }
 
 static void *
diff --git a/tools/firmware/hvmloader/smbios_types.h b/tools/firmware/hvmloader/smbios_types.h
index 7c648ece71..a04d194975 100644
--- a/tools/firmware/hvmloader/smbios_types.h
+++ b/tools/firmware/hvmloader/smbios_types.h
@@ -90,13 +90,13 @@ struct smbios_type_2 {
     uint8_t product_name_str;
     uint8_t version_str;
     uint8_t serial_number_str;
-    uint8_t asset_tag_str;
-    uint8_t feature_flags;
-    uint8_t location_in_chassis_str;
-    uint16_t chassis_handle;
-    uint8_t board_type;
-    uint8_t contained_handle_count;
-    uint16_t contained_handles[];
+    uint8_t asset_tag_str;                  /* Optional */
+    uint8_t feature_flags;                  /* Optional */
+    uint8_t location_in_chassis_str;        /* Optional */
+    uint16_t chassis_handle;                /* Optional */
+    uint8_t board_type;                     /* Optional */
+    uint8_t contained_handle_count;         /* Optional */
+    uint16_t contained_handles[];           /* Optional */
 } __attribute__ ((packed));
 
 /* System Enclosure - Contained Elements */
@@ -118,12 +118,12 @@ struct smbios_type_3 {
     uint8_t power_supply_state;
     uint8_t thermal_state;
     uint8_t security_status;
-    uint32_t oem_specific;
-    uint8_t height;
-    uint8_t number_of_power_cords;
-    uint8_t contained_element_count;
-    uint8_t contained_element_length;
-    struct smbios_contained_element contained_elements[];
+    uint32_t oem_specific;                  /* Optional */
+    uint8_t height;                         /* Optional */
+    uint8_t number_of_power_cords;          /* Optional */
+    uint8_t contained_element_count;        /* Optional */
+    uint8_t contained_element_length;       /* Optional */
+    struct smbios_contained_element contained_elements[]; /* Optional */
 } __attribute__ ((packed));
 
 /* SMBIOS type 4 - Processor Information */
@@ -252,9 +252,9 @@ struct smbios_type_39 {
     uint8_t revision_level_str;
     uint16_t max_capacity;
     uint16_t characteristics;
-    uint16_t input_voltage_probe_handle;
-    uint16_t cooling_device_handle;
-    uint16_t input_current_probe_handle;
+    uint16_t input_voltage_probe_handle;    /* Optional */
+    uint16_t cooling_device_handle;         /* Optional */
+    uint16_t input_current_probe_handle;    /* Optional */
 } __attribute__ ((packed));
 
 /* SMBIOS type 127 -- End-of-table */
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.20


From xen-changelog-bounces@lists.xenproject.org Wed Sep 03 13:01:34 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 03 Sep 2025 13:01:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1108260.1458421 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1utn7G-0000Hz-CN; Wed, 03 Sep 2025 13:01:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1108260.1458421; Wed, 03 Sep 2025 13: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 1utn7G-0000Hn-9N; Wed, 03 Sep 2025 13:01:34 +0000
Received: by outflank-mailman (input) for mailman id 1108260;
 Wed, 03 Sep 2025 13: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 1utn7E-0000Hd-Ro
 for xen-changelog@lists.xenproject.org; Wed, 03 Sep 2025 13: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 1utn7E-004aeI-21
 for xen-changelog@lists.xenproject.org;
 Wed, 03 Sep 2025 13:01:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1utn7E-00ENPR-2b
 for xen-changelog@lists.xenproject.org;
 Wed, 03 Sep 2025 13: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=nIfYsdKZYxYFlqaooY4SsmnxnTZPXb5I2Gq2znpeJY4=; b=xt3/p+DwUAYw996c+7sNnBhY1w
	JyTxl1G4EHoihmgHtUqRfxA8NegWEnwP4R2GLFRS7RFPt8l8t+AjXRuRKdyge0/uD/lB4/Chazfni
	VUFGLklIg+D7sjyORDBcDt4fENxCslpHDUMtbNKefPpAGIYqG/6vIRqRaZE3hYfvN4sY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.20] xen/efi: Fix crash with initial empty EFI options
Message-Id: <E1utn7E-00ENPR-2b@xenbits.xenproject.org>
Date: Wed, 03 Sep 2025 13:01:32 +0000

commit eb1dc440b2ca18acbf98dadbcc208e4a21dc4f8b
Author:     Frediano Ziglio <frediano.ziglio@cloud.com>
AuthorDate: Wed Sep 3 13:58:31 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 3 13:58:31 2025 +0200

    xen/efi: Fix crash with initial empty EFI options
    
    EFI code path split options from EFI LoadOptions fields in 2
    pieces, first EFI options, second Xen options.
    "get_argv" function is called first to get the number of arguments
    in the LoadOptions, second, after allocating enough space, to
    fill some "argc"/"argv" variable. However the first parsing could
    be different from second as second is able to detect "--" argument
    separator. So it was possible that "argc" was bigger than the
    initialized portion of "argv" array, leading to potential
    uninitialized pointer dereference, in particular a string like
    "-- a b c" would lead to crashes.
    Using EFI shell is possible to pass any kind of string in
    LoadOptions.
    
    Fixes: bf6501a62e80 ("x86-64: EFI boot code")
    Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
    Reviewed-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    master commit: 375f0dd538072ae33b14c52465f94ecbd83625dc
    master date: 2025-09-01 13:07:01 +0200
---
 xen/common/efi/boot.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c
index 01062bb39f..04d4bbd801 100644
--- a/xen/common/efi/boot.c
+++ b/xen/common/efi/boot.c
@@ -327,10 +327,11 @@ static unsigned int __init get_argv(unsigned int argc, CHAR16 **argv,
 
     if ( argc )
     {
+        argc = 0;
         cmdline = data + *offset;
         /* EFI_LOAD_OPTION does not supply an image name as first component. */
         if ( *offset )
-            *argv++ = NULL;
+            argv[argc++] = NULL;
     }
     else if ( size > sizeof(*cmdline) && !(size % sizeof(*cmdline)) &&
               (wmemchr(data, 0, size / sizeof(*cmdline)) ==
@@ -391,14 +392,14 @@ static unsigned int __init get_argv(unsigned int argc, CHAR16 **argv,
                 ++argc;
             else if ( prev && wstrcmp(prev, L"--") == 0 )
             {
-                --argv;
+                --argc;
                 if ( options )
                     *options = cmdline;
                 break;
             }
             else
             {
-                *argv++ = prev = ptr;
+                argv[argc++] = prev = ptr;
                 *ptr = *cmdline;
                 *++ptr = 0;
             }
@@ -406,7 +407,7 @@ static unsigned int __init get_argv(unsigned int argc, CHAR16 **argv,
         prev_sep = cur_sep;
     }
     if ( argv )
-        *argv = NULL;
+        argv[argc] = NULL;
     return argc;
 }
 
@@ -1302,8 +1303,8 @@ void EFIAPI __init noreturn efi_start(EFI_HANDLE ImageHandle,
                                   (argc + 1) * sizeof(*argv) +
                                       loaded_image->LoadOptionsSize,
                                   (void **)&argv) == EFI_SUCCESS )
-            get_argv(argc, argv, loaded_image->LoadOptions,
-                     loaded_image->LoadOptionsSize, &offset, &options);
+            argc = get_argv(argc, argv, loaded_image->LoadOptions,
+                            loaded_image->LoadOptionsSize, &offset, &options);
         else
             argc = 0;
         for ( i = 1; i < argc; ++i )
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.20


From xen-changelog-bounces@lists.xenproject.org Wed Sep 03 13:01:44 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 03 Sep 2025 13:01:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1108262.1458425 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1utn7Q-0000KW-FE; Wed, 03 Sep 2025 13:01:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1108262.1458425; Wed, 03 Sep 2025 13: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 1utn7Q-0000KO-CZ; Wed, 03 Sep 2025 13:01:44 +0000
Received: by outflank-mailman (input) for mailman id 1108262;
 Wed, 03 Sep 2025 13: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 1utn7O-0000KG-Uh
 for xen-changelog@lists.xenproject.org; Wed, 03 Sep 2025 13: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 1utn7O-004aeR-2H
 for xen-changelog@lists.xenproject.org;
 Wed, 03 Sep 2025 13:01:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1utn7O-00ENQ4-2r
 for xen-changelog@lists.xenproject.org;
 Wed, 03 Sep 2025 13: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=JZNWAJtR5xSeRsRgoAlHCsF7QHp2sGTgTTRUArtvX5Y=; b=VtkpZ20gQUWn6oz7sp8VZ3igML
	eGgxcxJMcF8QwHoMuW4dU10C6CHUSavjX7VwH29tjTDVlUNyh60mnOawwb3h4NgxKUhiqYavsPjla
	kNMiz23qbljOojdw1IpzzPvH6bUY23WXCxWQ4ucLcK94ZYZdb6RUnXjEI8Ppcs3Z87YA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.20] x86/gen-cpuid: correct cycle detection
Message-Id: <E1utn7O-00ENQ4-2r@xenbits.xenproject.org>
Date: Wed, 03 Sep 2025 13:01:42 +0000

commit 24fef7a86f668a6d46881bf32a85e8ab10b32740
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Sep 3 13:58:55 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 3 13:58:55 2025 +0200

    x86/gen-cpuid: correct cycle detection
    
    With the processing done linearly (rather than recursively), checking
    whether any of the features was previously seen is wrong: That would
    e.g. trigger for this simple set of dependencies
    
        X: [A, B]
        A: [C]
        B: [C]
    
    (observed in reality when making AMX-AVX512 dependent upon both
    AMX-TILE and AVX512F, causing XSAVE to see AMX-AVX512 twice in its list
    of dependents). But checking the whole accumulated set also isn't
    necessary - just checking the feature we're processing dependents of is
    sufficient. We may detect a cycle later that way, but we still will
    detect it. What we need to avoid is adding a feature again when we've
    already seen it.
    
    As a result, seeding "seen[]" with "feat" isn't necessary anymore.
    
    Fixes: fe4408d180f4 ("xen/x86: Generate deep dependencies of features")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 3999ff0d307a9a901ad1b5ad56e0dde657fec558
    master date: 2025-09-01 13:07:53 +0200
---
 xen/tools/gen-cpuid.py | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/xen/tools/gen-cpuid.py b/xen/tools/gen-cpuid.py
index 163b105bc6..98327d0144 100755
--- a/xen/tools/gen-cpuid.py
+++ b/xen/tools/gen-cpuid.py
@@ -350,7 +350,7 @@ def crunch_numbers(state):
 
     for feat in deep_features:
 
-        seen = [feat]
+        seen = []
         to_process = list(deps[feat])
 
         while len(to_process):
@@ -363,14 +363,17 @@ def crunch_numbers(state):
 
             f = to_process.pop(0)
 
+            if f == feat:
+                raise Fail("ERROR: Cycle found when processing %s" %
+                           (state.names[f], ))
+
             if f in seen:
-                raise Fail("ERROR: Cycle found with %s when processing %s"
-                           % (state.names[f], state.names[feat]))
+                continue
 
             seen.append(f)
             to_process = list(set(to_process + deps.get(f, [])))
 
-        state.deep_deps[feat] = seen[1:]
+        state.deep_deps[feat] = seen
 
     state.deep_features = deps.keys()
     state.nr_deep_deps = len(state.deep_deps.keys())
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.20


From xen-changelog-bounces@lists.xenproject.org Wed Sep 03 13:01:54 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 03 Sep 2025 13:01:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1108263.1458430 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1utn7a-0000Md-HV; Wed, 03 Sep 2025 13:01:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1108263.1458430; Wed, 03 Sep 2025 13: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 1utn7a-0000MW-Dz; Wed, 03 Sep 2025 13:01:54 +0000
Received: by outflank-mailman (input) for mailman id 1108263;
 Wed, 03 Sep 2025 13: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 1utn7Z-0000MK-10
 for xen-changelog@lists.xenproject.org; Wed, 03 Sep 2025 13: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 1utn7Y-004aeX-2Y
 for xen-changelog@lists.xenproject.org;
 Wed, 03 Sep 2025 13:01:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1utn7Y-00ENQx-38
 for xen-changelog@lists.xenproject.org;
 Wed, 03 Sep 2025 13: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=P7tAi0g9p/m3Gbdh/pKjrtVgUI/dWGoWA53jpssBIfk=; b=hmAOmt9Wgr3izRqOK30eS50jjv
	/cw54bOjLqPJlw+XJLWlBvVDQ3lP5xkvuzuYghNS7NdEvpZ32MUeeyr/X1rByX+tCaxj3G8ude+Bq
	77oMGRLobEIXZUPhPSCPJ7DVRo+P0bpbpV/wWZKxd4Es5NoSdwP5rsLiDCt87ne6EG50=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.20] x86/gen-cpuid: Fix debugging for cycle detection
Message-Id: <E1utn7Y-00ENQx-38@xenbits.xenproject.org>
Date: Wed, 03 Sep 2025 13:01:52 +0000

commit c59a69ae9ebdebb83298578030ddc79c8c9d56cc
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Sep 3 13:59:33 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 3 13:59:33 2025 +0200

    x86/gen-cpuid: Fix debugging for cycle detection
    
    Jan reports the following exception when using the cycle debugging:
    
      Feature IBRSB, seen [IBRSB, STIBP, INTEL_PSFD, EIBRS, IPRED_CTRL, RRSBA_CTRL, RRSBA, BHI_CTRL], to_process [SSBD]
      Traceback (most recent call last):
        File "/local/xen.git/xen/../xen/tools/gen-cpuid.py", line 594, in <module>
          sys.exit(main())
                   ^^^^^^
        File "/local/xen.git/xen/../xen/tools/gen-cpuid.py", line 588, in main
          crunch_numbers(state)
        File "/local/xen.git/xen/../xen/tools/gen-cpuid.py", line 366, in crunch_numbers
          (state.names[feat], repl(seen), repl(to_process)))
                                          ^^^^^^^^^^^^^^^^
        File "/local/xen.git/xen/../xen/tools/gen-cpuid.py", line 364, in repl
          return "[" + ", ".join((state.names[x] for x in l)) + "]"
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/local/xen.git/xen/../xen/tools/gen-cpuid.py", line 364, in <genexpr>
          return "[" + ", ".join((state.names[x] for x in l)) + "]"
                                  ~~~~~~~~~~~^^^
      KeyError: 534
      make[2]: *** [/local/xen.git/xen/include/xen/lib/x86/Makefile:9: cpuid-autogen.h] Error 1
    
    This is caused by commit ce8c930851a5 ("x86/cpu-policy: MSR_ARCH_CAPS feature
    names") being rather lazy and marking dependenices on unknown features.
    
    Introduce a helper to pick the known features in a range, and use it for
    ARCH_CAPS.
    
    Additionally, remove trailing whitespace and an unnecessary line continuation
    from the debug print.
    
    Reported-by: Jan Beulich <jbeulich@suse.com>
    Fixes: ce8c930851a5 ("x86/cpu-policy: MSR_ARCH_CAPS feature names")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    master commit: 5edb4ccff6a13ea10d1c1888942dff0c868c7844
    master date: 2025-09-01 19:54:21 +0100
---
 xen/tools/gen-cpuid.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/xen/tools/gen-cpuid.py b/xen/tools/gen-cpuid.py
index 98327d0144..cd0c87a048 100755
--- a/xen/tools/gen-cpuid.py
+++ b/xen/tools/gen-cpuid.py
@@ -168,6 +168,10 @@ def crunch_numbers(state):
     state.hvm_shadow_max = state.pv_max         | state.raw['S'] | state.raw['s']
     state.hvm_hap_max =    state.hvm_shadow_max | state.raw['H'] | state.raw['h']
 
+    def feat_range(start, last):
+        """ Select all known features in the given range """
+        return [ x for x in state.names.keys() if start <= x <= last ]
+
     #
     # Feature dependency information.
     #
@@ -334,7 +338,7 @@ def crunch_numbers(state):
         PSFD: [EPSF],
 
         # The ARCH_CAPS CPUID bit enumerates the availability of the whole register.
-        ARCH_CAPS: list(range(RDCL_NO, RDCL_NO + 64)),
+        ARCH_CAPS: feat_range(RDCL_NO, RDCL_NO + 63),
 
         # The behaviour described by RRSBA depend on eIBRS being active.
         EIBRS: [RRSBA],
@@ -358,7 +362,7 @@ def crunch_numbers(state):
             # To debug, uncomment the following lines:
             # def repl(l):
             #     return "[" + ", ".join((state.names[x] for x in l)) + "]"
-            # sys.stderr.write("Feature %s, seen %s, to_process %s \n" % \
+            # sys.stderr.write("Feature %s, seen %s, to_process %s\n" %
             #     (state.names[feat], repl(seen), repl(to_process)))
 
             f = to_process.pop(0)
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.20


From xen-changelog-bounces@lists.xenproject.org Wed Sep 03 13:11:06 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 03 Sep 2025 13:11:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1108269.1458432 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1utnGS-0001Sd-5Z; Wed, 03 Sep 2025 13:11:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1108269.1458432; Wed, 03 Sep 2025 13: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 1utnGS-0001SV-2s; Wed, 03 Sep 2025 13:11:04 +0000
Received: by outflank-mailman (input) for mailman id 1108269;
 Wed, 03 Sep 2025 13: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 1utnGQ-0001SP-Df
 for xen-changelog@lists.xenproject.org; Wed, 03 Sep 2025 13: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 1utnGP-004aq7-2q
 for xen-changelog@lists.xenproject.org;
 Wed, 03 Sep 2025 13:11:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1utnGQ-00ENxd-0A
 for xen-changelog@lists.xenproject.org;
 Wed, 03 Sep 2025 13: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=sYs96b7gShIh3MFFrzMGhobC+ERkdbybsri9jNPPY1E=; b=jU3cFR5cFxd91ZFjYju6AR3zwE
	6bFRoiRznHryQPkliNWgIfcVbij4VOVB+0Txf02s9DF9MhLWhUJrfL0qWX4HgaKfWRGELP10AhGJF
	j/pinh16k0/3DmUk5y7uspZYI2iUUkNHkJ8qYUE60eiRS/3Qc0qf29JAvtRJsYEJoE+A=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] Tidy up .gitignore
Message-Id: <E1utnGQ-00ENxd-0A@xenbits.xenproject.org>
Date: Wed, 03 Sep 2025 13:11:02 +0000

commit 518732bf01b6076a42480c11b38ddc287fcd6eb5
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Sep 2 14:50:08 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Sep 2 16:47:38 2025 +0100

    Tidy up .gitignore
    
    Drop unused or stale lines.
    
     * While it's necessary to have .git and .hg in each others ignore files if
       using multiple SCMs (as we did for a while), they should not be in their
       own.  The mercurial files were dropped in commit ba5bae659d90 ("Drop
       remains of prior SCMs") (2023).
    
     * The ignore for LibVNCServer* was added by commit a090ca495e7f ("VNC pasword
       authentication support for the paravirt framebuffer server.")  (2006) but
       without justification or any obvious reason.
    
     * The ignore for tools/misc/lowmemd was added in commit c812282081bb ("Low
       mem virq incremental adjustments") (2012), but xen-lowmemd (from the same
       author) already existed and was ignored properly.
    
     * tools/libs/guest/xc_* were added in commit af6c78d9dc68 ("tools: move
       libxenctrl below tools/libs") for bisectibility, but should have been
       dropped in the following change, commit e3dd624e487c ("tools/libxc: move
       libxenguest to tools/libs/guest").
    
     * tools/debugger/xenitp/ was dropped in commit e567964a54b8 ("tools: drop
       ia64 support") (2012).
    
     * tools/debugger/gdb/ was dropped in commit
       baa1aae9cfdd ("tools/debugger/gdb: Remove gdb") (2010).
    
     * tools/misc/cpuperf/ was dropped in commit ae95fdf65a72 ("[TOOLS] Remove the
       'cpuperf' misc tool.")  (2006).
    
     * tools/misc/xc_shadow was dropped in commit 7133144e3abf ("Remove xc_shadow
       tool") (2007).
    
     * tools/misc/xen_cpuperf was dropped in commit 60eba9b0d265 ("Delete some
       unused tools") (2004).
    
     * tools/misc/xen-tmem-list-parse was dropped in commit c588c002cc19 ("tools:
       remove tmem code and commands") (2018).
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
---
 .gitignore | 18 ------------------
 1 file changed, 18 deletions(-)

diff --git a/.gitignore b/.gitignore
index 7b7f5e7a4a..84a01e8afe 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,3 @@
-.hg
 .*.cmd
 .*.d
 .*.d2
@@ -62,11 +61,6 @@ tools/config.cache
 config/Tools.mk
 config/Stubdom.mk
 config/Docs.mk
-tools/libs/guest/xc_bitops.h
-tools/libs/guest/xc_core.h
-tools/libs/guest/xc_core_arm.h
-tools/libs/guest/xc_core_x86.h
-tools/libs/guest/xc_private.h
 tools/libs/light/_*.[ch]
 tools/libs/light/*.pyc
 tools/libs/light/_libxl.api-for-check
@@ -84,11 +78,7 @@ tools/libs/store/list.h
 tools/libs/store/utils.h
 tools/libs/store/xs_lib.c
 tools/libs/util/libxlu_cfg_y.output
-tools/debugger/gdb/gdb-6.2.1-linux-i386-xen/*
-tools/debugger/gdb/gdb-6.2.1/*
-tools/debugger/gdb/gdb-6.2.1.tar.bz2
 tools/debugger/gdbsx/gdbsx
-tools/debugger/xenitp/xenitp
 tools/firmware/*/biossums
 tools/firmware/*.bin
 tools/firmware/*.sym
@@ -147,20 +137,14 @@ tools/include/_libxl*.h
 tools/include/xen-xsm/*
 tools/include/xen-foreign/*.(c|h|size)
 tools/include/xen-foreign/checker
-tools/misc/cpuperf/cpuperf-perfcntr
-tools/misc/cpuperf/cpuperf-xen
-tools/misc/xc_shadow
-tools/misc/xen_cpuperf
 tools/misc/xen-cpuid
 tools/misc/xen-detect
 tools/misc/xen-diag
-tools/misc/xen-tmem-list-parse
 tools/misc/xen-livepatch
 tools/misc/xenperf
 tools/misc/xenpm
 tools/misc/xen-hvmctx
 tools/misc/xenlockprof
-tools/misc/lowmemd
 tools/misc/xencov
 tools/pkg-config/*
 tools/qemu-xen-build
@@ -249,7 +233,6 @@ xen/suppression-list.txt
 xen/xen-syms
 xen/xen-syms.map
 xen/xen.*
-LibVNCServer*
 
 tools/qemu-xen-dir-remote
 tools/qemu-xen-dir
@@ -270,7 +253,6 @@ tools/include/xen-foreign/x86_64.h
 tools/include/xen-foreign/arm32.h
 tools/include/xen-foreign/arm64.h
 
-.git
 tools/misc/xen-hptool
 tools/misc/xen-mfndump
 tools/firmware/etherboot/eb-roms.h
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Sep 03 13:11:14 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 03 Sep 2025 13:11:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1108270.1458437 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1utnGc-0001UO-75; Wed, 03 Sep 2025 13:11:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1108270.1458437; Wed, 03 Sep 2025 13: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 1utnGc-0001UF-4E; Wed, 03 Sep 2025 13:11:14 +0000
Received: by outflank-mailman (input) for mailman id 1108270;
 Wed, 03 Sep 2025 13: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 1utnGa-0001U2-7U
 for xen-changelog@lists.xenproject.org; Wed, 03 Sep 2025 13: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 1utnGZ-004aqU-3C
 for xen-changelog@lists.xenproject.org;
 Wed, 03 Sep 2025 13:11:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1utnGa-00ENy2-0T
 for xen-changelog@lists.xenproject.org;
 Wed, 03 Sep 2025 13: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=dOpJ+rMuvoSvldywCoUCo/qoL+6aBceXREFIBW77w7k=; b=NIJTZ3os3gAoZGAW4u8Q1HDnyh
	FuAwU2HhZA3UVnBZ6mwjCFmlJqrvutqEA3vwEVbzTN7rUd4BI6sFqiGx0fhaOihMlbCq/WGwrpa0N
	fyWAnyN3WjrT268fLFt8D4S8kSK/gJAcULl+vU9D4FjkWgnzguPk93Q4//T4+Z+2BW4E=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/misc: Move ignores into local .gitignore
Message-Id: <E1utnGa-00ENy2-0T@xenbits.xenproject.org>
Date: Wed, 03 Sep 2025 13:11:12 +0000

commit 949cc342d45b05c70a25f788df196d2f97786f80
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Sep 2 15:33:02 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Sep 2 16:47:38 2025 +0100

    tools/misc: Move ignores into local .gitignore
    
    ... instead of having them split across multiple.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
---
 .gitignore            | 15 ---------------
 tools/misc/.gitignore | 15 +++++++++++++++
 2 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/.gitignore b/.gitignore
index 84a01e8afe..d83427aba8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -137,15 +137,6 @@ tools/include/_libxl*.h
 tools/include/xen-xsm/*
 tools/include/xen-foreign/*.(c|h|size)
 tools/include/xen-foreign/checker
-tools/misc/xen-cpuid
-tools/misc/xen-detect
-tools/misc/xen-diag
-tools/misc/xen-livepatch
-tools/misc/xenperf
-tools/misc/xenpm
-tools/misc/xen-hvmctx
-tools/misc/xenlockprof
-tools/misc/xencov
 tools/pkg-config/*
 tools/qemu-xen-build
 tools/xentrace/xenalyze
@@ -253,14 +244,8 @@ tools/include/xen-foreign/x86_64.h
 tools/include/xen-foreign/arm32.h
 tools/include/xen-foreign/arm64.h
 
-tools/misc/xen-hptool
-tools/misc/xen-mfndump
 tools/firmware/etherboot/eb-roms.h
 tools/firmware/etherboot/gpxe-git-snapshot.tar.gz
-tools/misc/xenhypfs
-tools/misc/xenwatchdogd
-tools/misc/xen-hvmcrash
-tools/misc/xen-lowmemd
 tools/vchan/vchan-node[12]
 tools/vchan/vchan-socket-proxy
 tools/debugger/kdd/kdd
diff --git a/tools/misc/.gitignore b/tools/misc/.gitignore
index 73ce95e6d7..28af46280f 100644
--- a/tools/misc/.gitignore
+++ b/tools/misc/.gitignore
@@ -1,5 +1,20 @@
 xen-access
+xen-cpuid
+xen-detect
+xen-diag
+xen-hptool
+xen-hvmcrash
+xen-hvmctx
+xen-livepatch
+xen-lowmemd
 xen-mceinj
 xen-memshare
+xen-mfndump
 xen-ucode
 xen-vmtrace
+xencov
+xenhypfs
+xenlockprof
+xenperf
+xenpm
+xenwatchdogd
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Sep 03 13:55:05 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 03 Sep 2025 13:55:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1108361.1458501 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1utnx1-0001Nd-0u; Wed, 03 Sep 2025 13:55:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1108361.1458501; Wed, 03 Sep 2025 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 1utnx0-0001NV-UV; Wed, 03 Sep 2025 13:55:02 +0000
Received: by outflank-mailman (input) for mailman id 1108361;
 Wed, 03 Sep 2025 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 1utnx0-0001NP-40
 for xen-changelog@lists.xenproject.org; Wed, 03 Sep 2025 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 1utnwz-004bhv-2E
 for xen-changelog@lists.xenproject.org;
 Wed, 03 Sep 2025 13:55:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1utnwz-00EQdf-2i
 for xen-changelog@lists.xenproject.org;
 Wed, 03 Sep 2025 13: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=5GunC3VJOfk7mIFsxrCkLy6askEVnJbbRp8azwWfusQ=; b=CiW4mz6aWdp9IjOSYvIW5owUAO
	wVerPtTTbNJ0V/Mt1CDpRGJHbU6ehBpyvboqE0Er+KNzigqcqgeEUrv49kodaSJVE0sLZ431plYvm
	vz2hMdb5xUB6kZBgJMY19RbZg2ssPUhwqMSdz8OpNuJofuxLzrPpEngEGJDYhhr/My6A=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] x86/suspend: unconditionally raise a timer softirq on resume
Message-Id: <E1utnwz-00EQdf-2i@xenbits.xenproject.org>
Date: Wed, 03 Sep 2025 13:55:01 +0000

commit 746543f6d9dce3e90921192df453b1b26c88086f
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Sep 3 14:09:59 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 3 14:09:59 2025 +0200

    x86/suspend: unconditionally raise a timer softirq on resume
    
    The current code to restore the timer state on resume is incomplete.  While
    the local APIC Initial Count Register is saved and restored across
    suspension (even if possibly no longer accurate since it's not adjusted to
    account for the time spent in suspension), the TSC deadline MSR is not
    saved and restored, hence hosts using the TSC deadline timer will likely
    get stuck when resuming from suspension.
    
    The lack of restoring of the TSC deadline MSR was mitigated by the raising
    of a timer softirq in mwait_idle_with_hints() if the timer had expired,
    previous to commit 3faf0866a33070b926ab78e6298290403f85e76c, which removed
    that logic.
    
    This patch fixes the usage of the TSC deadline timer with suspension, by
    unconditionally raising a timer softirq on resume, that will take care of
    rearming the hardware timer.  Given that a timer softirq will be
    unconditionally risen, there's no need to save and restore the APIC Initial
    Count Register anymore either.
    
    Note that secondary processors don't need this special treatment when
    resuming, since they are offlined before suspension and brought back up
    during resume, the first timer that gets setup will trigger a timer softirq
    unconditionally, for example from sched_migrate_timers() that gets called
    for each secondary processor.
    
    Link: https://github.com/QubesOS/qubes-issues/issues/10110
    Reported-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Fixes: fd1291a826e1 ('X86: Prefer TSC-deadline timer in Xen')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Tested-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    master commit: 757abedabbb64f18a28ae61a7bd67a927bb03130
    master date: 2025-08-27 09:33:12 +0200
---
 xen/arch/x86/acpi/power.c | 2 ++
 xen/arch/x86/apic.c       | 3 ---
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/acpi/power.c b/xen/arch/x86/acpi/power.c
index 5cddb0f0f6..0c3ed9fb4f 100644
--- a/xen/arch/x86/acpi/power.c
+++ b/xen/arch/x86/acpi/power.c
@@ -23,6 +23,7 @@
 #include <xen/domain.h>
 #include <xen/console.h>
 #include <xen/iommu.h>
+#include <xen/softirq.h>
 #include <xen/watchdog.h>
 #include <xen/cpu.h>
 #include <public/platform.h>
@@ -320,6 +321,7 @@ static int enter_state(u32 state)
     thaw_domains();
     system_state = SYS_STATE_active;
     spin_unlock(&pm_lock);
+    raise_softirq(TIMER_SOFTIRQ);
     return error;
 }
 
diff --git a/xen/arch/x86/apic.c b/xen/arch/x86/apic.c
index e43b779036..52b7010b2a 100644
--- a/xen/arch/x86/apic.c
+++ b/xen/arch/x86/apic.c
@@ -63,7 +63,6 @@ static struct {
     unsigned int apic_lvt0;
     unsigned int apic_lvt1;
     unsigned int apic_lvterr;
-    unsigned int apic_tmict;
     unsigned int apic_tdcr;
     unsigned int apic_thmr;
 } apic_pm_state;
@@ -695,7 +694,6 @@ int lapic_suspend(void)
     apic_pm_state.apic_lvt0 = apic_read(APIC_LVT0);
     apic_pm_state.apic_lvt1 = apic_read(APIC_LVT1);
     apic_pm_state.apic_lvterr = apic_read(APIC_LVTERR);
-    apic_pm_state.apic_tmict = apic_read(APIC_TMICT);
     apic_pm_state.apic_tdcr = apic_read(APIC_TDCR);
     if (maxlvt >= 5)
         apic_pm_state.apic_thmr = apic_read(APIC_LVTTHMR);
@@ -755,7 +753,6 @@ int lapic_resume(void)
         apic_write(APIC_LVTPC, apic_pm_state.apic_lvtpc);
     apic_write(APIC_LVTT, apic_pm_state.apic_lvtt);
     apic_write(APIC_TDCR, apic_pm_state.apic_tdcr);
-    apic_write(APIC_TMICT, apic_pm_state.apic_tmict);
     apic_write(APIC_ESR, 0);
     apic_read(APIC_ESR);
     apic_write(APIC_LVTERR, apic_pm_state.apic_lvterr);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Wed Sep 03 15:22:06 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 03 Sep 2025 15:22:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1108652.1458705 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1utpJC-0006uU-N6; Wed, 03 Sep 2025 15:22:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1108652.1458705; Wed, 03 Sep 2025 15: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 1utpJC-0006uL-KG; Wed, 03 Sep 2025 15:22:02 +0000
Received: by outflank-mailman (input) for mailman id 1108652;
 Wed, 03 Sep 2025 15: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 1utpJB-0006uB-I1
 for xen-changelog@lists.xenproject.org; Wed, 03 Sep 2025 15: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 1utpJB-004dmC-12
 for xen-changelog@lists.xenproject.org;
 Wed, 03 Sep 2025 15:22:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1utpJB-00EUwW-1d
 for xen-changelog@lists.xenproject.org;
 Wed, 03 Sep 2025 15: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=InathZE5cVtGTiQUVhPrPbwbsQsXiaoYGJrWNIrP/ok=; b=k5l2uYHcXFSvp+vz9dEZpFuOPv
	IgJBnjqA7pSeAEvPijbim/uupGaCaKI7bivlIgtHMiRKW7Vw8HIk+dIUG1upVbOAHtiksuI/EpdG+
	3dOpj+CMDF3Ot1Vc8izDkpB9xWb36k9DLwXzHqV+jlhfOupUBp0sXhOj7URl3ANiTiI0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] Tidy up .gitignore
Message-Id: <E1utpJB-00EUwW-1d@xenbits.xenproject.org>
Date: Wed, 03 Sep 2025 15:22:01 +0000

commit 518732bf01b6076a42480c11b38ddc287fcd6eb5
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Sep 2 14:50:08 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Sep 2 16:47:38 2025 +0100

    Tidy up .gitignore
    
    Drop unused or stale lines.
    
     * While it's necessary to have .git and .hg in each others ignore files if
       using multiple SCMs (as we did for a while), they should not be in their
       own.  The mercurial files were dropped in commit ba5bae659d90 ("Drop
       remains of prior SCMs") (2023).
    
     * The ignore for LibVNCServer* was added by commit a090ca495e7f ("VNC pasword
       authentication support for the paravirt framebuffer server.")  (2006) but
       without justification or any obvious reason.
    
     * The ignore for tools/misc/lowmemd was added in commit c812282081bb ("Low
       mem virq incremental adjustments") (2012), but xen-lowmemd (from the same
       author) already existed and was ignored properly.
    
     * tools/libs/guest/xc_* were added in commit af6c78d9dc68 ("tools: move
       libxenctrl below tools/libs") for bisectibility, but should have been
       dropped in the following change, commit e3dd624e487c ("tools/libxc: move
       libxenguest to tools/libs/guest").
    
     * tools/debugger/xenitp/ was dropped in commit e567964a54b8 ("tools: drop
       ia64 support") (2012).
    
     * tools/debugger/gdb/ was dropped in commit
       baa1aae9cfdd ("tools/debugger/gdb: Remove gdb") (2010).
    
     * tools/misc/cpuperf/ was dropped in commit ae95fdf65a72 ("[TOOLS] Remove the
       'cpuperf' misc tool.")  (2006).
    
     * tools/misc/xc_shadow was dropped in commit 7133144e3abf ("Remove xc_shadow
       tool") (2007).
    
     * tools/misc/xen_cpuperf was dropped in commit 60eba9b0d265 ("Delete some
       unused tools") (2004).
    
     * tools/misc/xen-tmem-list-parse was dropped in commit c588c002cc19 ("tools:
       remove tmem code and commands") (2018).
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
---
 .gitignore | 18 ------------------
 1 file changed, 18 deletions(-)

diff --git a/.gitignore b/.gitignore
index 7b7f5e7a4a..84a01e8afe 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,3 @@
-.hg
 .*.cmd
 .*.d
 .*.d2
@@ -62,11 +61,6 @@ tools/config.cache
 config/Tools.mk
 config/Stubdom.mk
 config/Docs.mk
-tools/libs/guest/xc_bitops.h
-tools/libs/guest/xc_core.h
-tools/libs/guest/xc_core_arm.h
-tools/libs/guest/xc_core_x86.h
-tools/libs/guest/xc_private.h
 tools/libs/light/_*.[ch]
 tools/libs/light/*.pyc
 tools/libs/light/_libxl.api-for-check
@@ -84,11 +78,7 @@ tools/libs/store/list.h
 tools/libs/store/utils.h
 tools/libs/store/xs_lib.c
 tools/libs/util/libxlu_cfg_y.output
-tools/debugger/gdb/gdb-6.2.1-linux-i386-xen/*
-tools/debugger/gdb/gdb-6.2.1/*
-tools/debugger/gdb/gdb-6.2.1.tar.bz2
 tools/debugger/gdbsx/gdbsx
-tools/debugger/xenitp/xenitp
 tools/firmware/*/biossums
 tools/firmware/*.bin
 tools/firmware/*.sym
@@ -147,20 +137,14 @@ tools/include/_libxl*.h
 tools/include/xen-xsm/*
 tools/include/xen-foreign/*.(c|h|size)
 tools/include/xen-foreign/checker
-tools/misc/cpuperf/cpuperf-perfcntr
-tools/misc/cpuperf/cpuperf-xen
-tools/misc/xc_shadow
-tools/misc/xen_cpuperf
 tools/misc/xen-cpuid
 tools/misc/xen-detect
 tools/misc/xen-diag
-tools/misc/xen-tmem-list-parse
 tools/misc/xen-livepatch
 tools/misc/xenperf
 tools/misc/xenpm
 tools/misc/xen-hvmctx
 tools/misc/xenlockprof
-tools/misc/lowmemd
 tools/misc/xencov
 tools/pkg-config/*
 tools/qemu-xen-build
@@ -249,7 +233,6 @@ xen/suppression-list.txt
 xen/xen-syms
 xen/xen-syms.map
 xen/xen.*
-LibVNCServer*
 
 tools/qemu-xen-dir-remote
 tools/qemu-xen-dir
@@ -270,7 +253,6 @@ tools/include/xen-foreign/x86_64.h
 tools/include/xen-foreign/arm32.h
 tools/include/xen-foreign/arm64.h
 
-.git
 tools/misc/xen-hptool
 tools/misc/xen-mfndump
 tools/firmware/etherboot/eb-roms.h
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Sep 03 15:22:12 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 03 Sep 2025 15:22:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1108654.1458710 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1utpJM-0006x8-Pw; Wed, 03 Sep 2025 15:22:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1108654.1458710; Wed, 03 Sep 2025 15: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 1utpJM-0006x0-Ms; Wed, 03 Sep 2025 15:22:12 +0000
Received: by outflank-mailman (input) for mailman id 1108654;
 Wed, 03 Sep 2025 15: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 1utpJL-0006wo-Ke
 for xen-changelog@lists.xenproject.org; Wed, 03 Sep 2025 15: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 1utpJL-004dmm-1I
 for xen-changelog@lists.xenproject.org;
 Wed, 03 Sep 2025 15:22:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1utpJL-00EUx8-1s
 for xen-changelog@lists.xenproject.org;
 Wed, 03 Sep 2025 15: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=6lFv8Acczsp2uYFRi1gToweWn76GUiR3YdD7zlt297k=; b=WeWOgtzUUlkQ5eSdkkH22mYzK1
	leCe7gMi7SXd/jGQaG16SNmSBo1AyYeqsR59P5B6aL2iDdyMR9/Ie69z3d/xtgSTxoOT4TfL3oXB7
	zv5ds6pKsBpkBtz1JXKcXwGZv379szP/fj3ne3tOsJ/aKB/YGntkFPvDCMGFHM9Cyykg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/misc: Move ignores into local .gitignore
Message-Id: <E1utpJL-00EUx8-1s@xenbits.xenproject.org>
Date: Wed, 03 Sep 2025 15:22:11 +0000

commit 949cc342d45b05c70a25f788df196d2f97786f80
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Sep 2 15:33:02 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Sep 2 16:47:38 2025 +0100

    tools/misc: Move ignores into local .gitignore
    
    ... instead of having them split across multiple.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
---
 .gitignore            | 15 ---------------
 tools/misc/.gitignore | 15 +++++++++++++++
 2 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/.gitignore b/.gitignore
index 84a01e8afe..d83427aba8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -137,15 +137,6 @@ tools/include/_libxl*.h
 tools/include/xen-xsm/*
 tools/include/xen-foreign/*.(c|h|size)
 tools/include/xen-foreign/checker
-tools/misc/xen-cpuid
-tools/misc/xen-detect
-tools/misc/xen-diag
-tools/misc/xen-livepatch
-tools/misc/xenperf
-tools/misc/xenpm
-tools/misc/xen-hvmctx
-tools/misc/xenlockprof
-tools/misc/xencov
 tools/pkg-config/*
 tools/qemu-xen-build
 tools/xentrace/xenalyze
@@ -253,14 +244,8 @@ tools/include/xen-foreign/x86_64.h
 tools/include/xen-foreign/arm32.h
 tools/include/xen-foreign/arm64.h
 
-tools/misc/xen-hptool
-tools/misc/xen-mfndump
 tools/firmware/etherboot/eb-roms.h
 tools/firmware/etherboot/gpxe-git-snapshot.tar.gz
-tools/misc/xenhypfs
-tools/misc/xenwatchdogd
-tools/misc/xen-hvmcrash
-tools/misc/xen-lowmemd
 tools/vchan/vchan-node[12]
 tools/vchan/vchan-socket-proxy
 tools/debugger/kdd/kdd
diff --git a/tools/misc/.gitignore b/tools/misc/.gitignore
index 73ce95e6d7..28af46280f 100644
--- a/tools/misc/.gitignore
+++ b/tools/misc/.gitignore
@@ -1,5 +1,20 @@
 xen-access
+xen-cpuid
+xen-detect
+xen-diag
+xen-hptool
+xen-hvmcrash
+xen-hvmctx
+xen-livepatch
+xen-lowmemd
 xen-mceinj
 xen-memshare
+xen-mfndump
 xen-ucode
 xen-vmtrace
+xencov
+xenhypfs
+xenlockprof
+xenperf
+xenpm
+xenwatchdogd
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Sep 04 00:33:07 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Sep 2025 00:33:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1109250.1458991 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1utxuR-0001zW-Od; Thu, 04 Sep 2025 00:33:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1109250.1458991; Thu, 04 Sep 2025 00: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 1utxuR-0001zO-Lr; Thu, 04 Sep 2025 00:33:03 +0000
Received: by outflank-mailman (input) for mailman id 1109250;
 Thu, 04 Sep 2025 00: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 1utxuQ-0001zI-E0
 for xen-changelog@lists.xenproject.org; Thu, 04 Sep 2025 00: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 1utxuQ-004pke-02
 for xen-changelog@lists.xenproject.org;
 Thu, 04 Sep 2025 00:33:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1utxuQ-00F1CY-0a
 for xen-changelog@lists.xenproject.org;
 Thu, 04 Sep 2025 00: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=e2P0Fk1qQ/uWcAJNQpyAg2WXyComPi53D1JUi9Ugutc=; b=t5uGn7fiIkPKQkn+It4FOGhjCV
	2Q6pEIScDo/9WcClA0gBeWuaYKXjS32QKgaf/0IH6GITtBmcxzl7giPumSt3EVjexL8LB78KajwrC
	+LXh+2Pm0OxjVOtSvxy6jwroBKq66vzwFvTAGw0GIFTLwP05uMpnOOOVdMtDz1hO5eSs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] automation: call expect script with redirected standard error
Message-Id: <E1utxuQ-00F1CY-0a@xenbits.xenproject.org>
Date: Thu, 04 Sep 2025 00:33:02 +0000

commit a406195c15ddb9fb2152b0882e0e477418a5b4e4
Author:     Victor Lira <victorm.lira@amd.com>
AuthorDate: Tue Sep 2 11:52:34 2025 -0700
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Wed Sep 3 17:20:05 2025 -0700

    automation: call expect script with redirected standard error
    
    In the console expect script, "send_error" will send a message to standard
    error. Current use of this script redirects only standard output into a
    pipeline. This causes the error messages to sometimes appear hidden in the
    middle of the test logs.
    
    Redirect also standard error to clearly show when a test has timed out or hit
    EOF.
    
    Signed-off-by: Victor Lira <victorm.lira@amd.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 .cirrus.yml                                       | 2 +-
 automation/scripts/include/xtf-runner             | 2 +-
 automation/scripts/qemu-alpine-x86_64.sh          | 2 +-
 automation/scripts/qemu-smoke-dom0-arm32.sh       | 2 +-
 automation/scripts/qemu-smoke-dom0-arm64.sh       | 2 +-
 automation/scripts/qemu-smoke-dom0less-arm32.sh   | 2 +-
 automation/scripts/qemu-smoke-dom0less-arm64.sh   | 2 +-
 automation/scripts/qemu-smoke-ppc64le.sh          | 2 +-
 automation/scripts/qemu-smoke-riscv64.sh          | 2 +-
 automation/scripts/qubes-x86-64.sh                | 2 +-
 automation/scripts/xilinx-smoke-dom0-x86_64.sh    | 2 +-
 automation/scripts/xilinx-smoke-dom0less-arm64.sh | 2 +-
 12 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/.cirrus.yml b/.cirrus.yml
index 3163ab8f11..f295c8cb0a 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -166,7 +166,7 @@ task:
     export TEST_LOG="serial-${FREEBSD_BUILD}-${XTF_ARCH}.txt"
     export PASSED="Test result: SUCCESS"
     export TEST_TIMEOUT=120
-    ./automation/scripts/console.exp | sed 's/\r\+$//'
+    ./automation/scripts/console.exp |& sed 's/\r\+$//'
 
   always:
     serial_artifacts:
diff --git a/automation/scripts/include/xtf-runner b/automation/scripts/include/xtf-runner
index b7fea52dad..43ff2d4d88 100644
--- a/automation/scripts/include/xtf-runner
+++ b/automation/scripts/include/xtf-runner
@@ -114,7 +114,7 @@ function xtf_run_test()
 {
     rm -f ${TEST_LOG}
     export BOOT_MSG PASSED TEST_CMD TEST_LOG UBOOT_CMD
-    ./console.exp | sed 's/\r\+$//'
+    ./console.exp |& sed 's/\r\+$//'
 }
 
 # Setup environment and run an XTF test.
diff --git a/automation/scripts/qemu-alpine-x86_64.sh b/automation/scripts/qemu-alpine-x86_64.sh
index 746e70483d..c4666b9507 100755
--- a/automation/scripts/qemu-alpine-x86_64.sh
+++ b/automation/scripts/qemu-alpine-x86_64.sh
@@ -84,4 +84,4 @@ export BOOT_MSG="Latest ChangeSet: "
 export LOG_MSG="Domain-0"
 export PASSED="BusyBox"
 
-./automation/scripts/console.exp | sed 's/\r\+$//'
+./automation/scripts/console.exp |& sed 's/\r\+$//'
diff --git a/automation/scripts/qemu-smoke-dom0-arm32.sh b/automation/scripts/qemu-smoke-dom0-arm32.sh
index 4f50eabdef..36c47daa42 100755
--- a/automation/scripts/qemu-smoke-dom0-arm32.sh
+++ b/automation/scripts/qemu-smoke-dom0-arm32.sh
@@ -96,4 +96,4 @@ export BOOT_MSG="Latest ChangeSet: "
 export LOG_MSG="Domain-0"
 export PASSED="/ #"
 
-../automation/scripts/console.exp | sed 's/\r\+$//'
+../automation/scripts/console.exp |& sed 's/\r\+$//'
diff --git a/automation/scripts/qemu-smoke-dom0-arm64.sh b/automation/scripts/qemu-smoke-dom0-arm64.sh
index d6f6b74880..ee682015a0 100755
--- a/automation/scripts/qemu-smoke-dom0-arm64.sh
+++ b/automation/scripts/qemu-smoke-dom0-arm64.sh
@@ -106,4 +106,4 @@ export TEST_LOG="smoke.serial"
 export LOG_MSG="Domain-0"
 export PASSED="BusyBox"
 
-./automation/scripts/console.exp | sed 's/\r\+$//'
+./automation/scripts/console.exp |& sed 's/\r\+$//'
diff --git a/automation/scripts/qemu-smoke-dom0less-arm32.sh b/automation/scripts/qemu-smoke-dom0less-arm32.sh
index 0e2c5496db..e27636dc9e 100755
--- a/automation/scripts/qemu-smoke-dom0less-arm32.sh
+++ b/automation/scripts/qemu-smoke-dom0less-arm32.sh
@@ -149,4 +149,4 @@ export TEST_LOG="${serial_log}"
 export LOG_MSG="${dom0_prompt}"
 export PASSED="${passed}"
 
-../automation/scripts/console.exp | sed 's/\r\+$//'
+../automation/scripts/console.exp |& sed 's/\r\+$//'
diff --git a/automation/scripts/qemu-smoke-dom0less-arm64.sh b/automation/scripts/qemu-smoke-dom0less-arm64.sh
index e7a3e670d0..e660485f3a 100755
--- a/automation/scripts/qemu-smoke-dom0less-arm64.sh
+++ b/automation/scripts/qemu-smoke-dom0less-arm64.sh
@@ -218,4 +218,4 @@ export TEST_LOG="smoke.serial"
 export LOG_MSG="Welcome to Alpine Linux"
 export PASSED="${passed}"
 
-./automation/scripts/console.exp | sed 's/\r\+$//'
+./automation/scripts/console.exp |& sed 's/\r\+$//'
diff --git a/automation/scripts/qemu-smoke-ppc64le.sh b/automation/scripts/qemu-smoke-ppc64le.sh
index 617096ad1f..119c3ed4d5 100755
--- a/automation/scripts/qemu-smoke-ppc64le.sh
+++ b/automation/scripts/qemu-smoke-ppc64le.sh
@@ -24,4 +24,4 @@ export TEST_CMD="qemu-system-ppc64 \
 export TEST_LOG="${serial_log}"
 export PASSED="Hello, ppc64le!"
 
-./automation/scripts/console.exp | sed 's/\r\+$//'
+./automation/scripts/console.exp |& sed 's/\r\+$//'
diff --git a/automation/scripts/qemu-smoke-riscv64.sh b/automation/scripts/qemu-smoke-riscv64.sh
index 25f9e4190e..c0b1082a08 100755
--- a/automation/scripts/qemu-smoke-riscv64.sh
+++ b/automation/scripts/qemu-smoke-riscv64.sh
@@ -16,4 +16,4 @@ export TEST_CMD="qemu-system-riscv64 \
 export TEST_LOG="smoke.serial"
 export PASSED="All set up"
 
-./automation/scripts/console.exp | sed 's/\r\+$//'
+./automation/scripts/console.exp |& sed 's/\r\+$//'
diff --git a/automation/scripts/qubes-x86-64.sh b/automation/scripts/qubes-x86-64.sh
index b49a44c5b1..bd939dc948 100755
--- a/automation/scripts/qubes-x86-64.sh
+++ b/automation/scripts/qubes-x86-64.sh
@@ -292,7 +292,7 @@ export LOG_MSG="\nWelcome to Alpine Linux"
 export TEST_CMD="ssh $CONTROLLER console"
 export TEST_LOG="smoke.serial"
 export TEST_TIMEOUT="$timeout"
-./automation/scripts/console.exp | sed 's/\r\+$//'
+./automation/scripts/console.exp |& sed 's/\r\+$//'
 TEST_RESULT=$?
 
 if [ -n "$retrieve_xml" ]; then
diff --git a/automation/scripts/xilinx-smoke-dom0-x86_64.sh b/automation/scripts/xilinx-smoke-dom0-x86_64.sh
index 0ad8f658e3..96f534f3aa 100755
--- a/automation/scripts/xilinx-smoke-dom0-x86_64.sh
+++ b/automation/scripts/xilinx-smoke-dom0-x86_64.sh
@@ -173,7 +173,7 @@ export BOOT_MSG="Latest ChangeSet: "
 export TEST_CMD="cat ${SERIAL_DEV}"
 export TEST_LOG="smoke.serial"
 
-./automation/scripts/console.exp | sed 's/\r\+$//'
+./automation/scripts/console.exp |& sed 's/\r\+$//'
 TEST_RESULT=$?
 sh "/scratch/gitlab-runner/${TEST_BOARD}.sh" 2
 exit ${TEST_RESULT}
diff --git a/automation/scripts/xilinx-smoke-dom0less-arm64.sh b/automation/scripts/xilinx-smoke-dom0less-arm64.sh
index 1d7162f1b3..a6da7a830c 100755
--- a/automation/scripts/xilinx-smoke-dom0less-arm64.sh
+++ b/automation/scripts/xilinx-smoke-dom0less-arm64.sh
@@ -137,7 +137,7 @@ export LOG_MSG="Welcome to Alpine Linux"
 export TEST_CMD="cat ${SERIAL_DEV}"
 export TEST_LOG="smoke.serial"
 
-./automation/scripts/console.exp | sed 's/\r\+$//'
+./automation/scripts/console.exp |& sed 's/\r\+$//'
 TEST_RESULT=$?
 sh "/scratch/gitlab-runner/zcu102.sh" 2
 exit ${TEST_RESULT}
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Sep 04 00:33:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Sep 2025 00:33:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1109251.1458996 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1utxub-00021f-Q6; Thu, 04 Sep 2025 00:33:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1109251.1458996; Thu, 04 Sep 2025 00: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 1utxub-00021W-NF; Thu, 04 Sep 2025 00:33:13 +0000
Received: by outflank-mailman (input) for mailman id 1109251;
 Thu, 04 Sep 2025 00: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 1utxua-00021B-Ay
 for xen-changelog@lists.xenproject.org; Thu, 04 Sep 2025 00: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 1utxua-004pkm-0K
 for xen-changelog@lists.xenproject.org;
 Thu, 04 Sep 2025 00:33:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1utxua-00F1Cz-0s
 for xen-changelog@lists.xenproject.org;
 Thu, 04 Sep 2025 00: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=r0etVjhkJGZmltilyIcbuNb7SwxVc/zJ+l095KCPPVg=; b=QA5D523rHaBDu0IQLjAqVzEKKT
	KRIGXzCFDsU32OAggqhYBapsxQrW08I5CHmSMe/bjIQgs0p4dFBDLOIL2wGLrlBjyhY8M1I10pl0M
	EyWuJugPgerdFLO70/DAkxRf4qhqlE3FkrHv/joMieqz7p+ITfJdxCgLdBWj8E73wtCA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] automation: edit expect script to separate error message lines
Message-Id: <E1utxua-00F1Cz-0s@xenbits.xenproject.org>
Date: Thu, 04 Sep 2025 00:33:12 +0000

commit 0dcc23db961cad01159ea12aa377924af0218e00
Author:     Victor Lira <victorm.lira@amd.com>
AuthorDate: Tue Sep 2 11:52:35 2025 -0700
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Wed Sep 3 17:20:05 2025 -0700

    automation: edit expect script to separate error message lines
    
    The errors can happen in the middle of a console line which causes the message
    to appear at the end of the current line.
    
    Prepend a newline to clearly separate the error line.
    
    Signed-off-by: Victor Lira <victorm.lira@amd.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/scripts/console.exp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/automation/scripts/console.exp b/automation/scripts/console.exp
index fc80513dfb..e27886bbef 100755
--- a/automation/scripts/console.exp
+++ b/automation/scripts/console.exp
@@ -35,8 +35,8 @@ expect_after {
     -re "(.*)\r" {
         exp_continue -continue_timer
     }
-    timeout {send_error "ERROR-Timeout!\n"; exit 1}
-    eof {send_error "ERROR-EOF!\n"; exit 1}
+    timeout {send_error "\nERROR-Timeout!\n"; exit 1}
+    eof {send_error "\nERROR-EOF!\n"; exit 1}
 }
 
 if {[info exists env(UBOOT_CMD)]} {
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Sep 04 06:44:07 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Sep 2025 06:44:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1109617.1459139 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uu3hT-0000Z7-N5; Thu, 04 Sep 2025 06:44:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1109617.1459139; Thu, 04 Sep 2025 06: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 1uu3hT-0000Yz-KM; Thu, 04 Sep 2025 06:44:03 +0000
Received: by outflank-mailman (input) for mailman id 1109617;
 Thu, 04 Sep 2025 06: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 1uu3hS-0000Yr-BP
 for xen-changelog@lists.xenproject.org; Thu, 04 Sep 2025 06: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 1uu3hR-0068YP-3C
 for xen-changelog@lists.xenproject.org;
 Thu, 04 Sep 2025 06:44:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uu3hS-00FJ92-0V
 for xen-changelog@lists.xenproject.org;
 Thu, 04 Sep 2025 06: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=CKLsRwpTVoe0xWvxmWYLM3Hd72VkMZCqAdNgOFc9cd4=; b=MeyvmPD6UtO6FAaVpko2OGjPo4
	0Ld3oUMrxq4GdS5Xev1akc3q6QOKRB5o56DWdhGr6xTuIV6iB5xu22vy8Ui01dHdJF1IGYXm0tlUO
	oawaZPjMENw5UHqU70wX+bfaPAdqQgllbtaQrVXWSW9/KcR0JG+le7RlaI1aAAQE8pqw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: call expect script with redirected standard error
Message-Id: <E1uu3hS-00FJ92-0V@xenbits.xenproject.org>
Date: Thu, 04 Sep 2025 06:44:02 +0000

commit a406195c15ddb9fb2152b0882e0e477418a5b4e4
Author:     Victor Lira <victorm.lira@amd.com>
AuthorDate: Tue Sep 2 11:52:34 2025 -0700
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Wed Sep 3 17:20:05 2025 -0700

    automation: call expect script with redirected standard error
    
    In the console expect script, "send_error" will send a message to standard
    error. Current use of this script redirects only standard output into a
    pipeline. This causes the error messages to sometimes appear hidden in the
    middle of the test logs.
    
    Redirect also standard error to clearly show when a test has timed out or hit
    EOF.
    
    Signed-off-by: Victor Lira <victorm.lira@amd.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 .cirrus.yml                                       | 2 +-
 automation/scripts/include/xtf-runner             | 2 +-
 automation/scripts/qemu-alpine-x86_64.sh          | 2 +-
 automation/scripts/qemu-smoke-dom0-arm32.sh       | 2 +-
 automation/scripts/qemu-smoke-dom0-arm64.sh       | 2 +-
 automation/scripts/qemu-smoke-dom0less-arm32.sh   | 2 +-
 automation/scripts/qemu-smoke-dom0less-arm64.sh   | 2 +-
 automation/scripts/qemu-smoke-ppc64le.sh          | 2 +-
 automation/scripts/qemu-smoke-riscv64.sh          | 2 +-
 automation/scripts/qubes-x86-64.sh                | 2 +-
 automation/scripts/xilinx-smoke-dom0-x86_64.sh    | 2 +-
 automation/scripts/xilinx-smoke-dom0less-arm64.sh | 2 +-
 12 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/.cirrus.yml b/.cirrus.yml
index 3163ab8f11..f295c8cb0a 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -166,7 +166,7 @@ task:
     export TEST_LOG="serial-${FREEBSD_BUILD}-${XTF_ARCH}.txt"
     export PASSED="Test result: SUCCESS"
     export TEST_TIMEOUT=120
-    ./automation/scripts/console.exp | sed 's/\r\+$//'
+    ./automation/scripts/console.exp |& sed 's/\r\+$//'
 
   always:
     serial_artifacts:
diff --git a/automation/scripts/include/xtf-runner b/automation/scripts/include/xtf-runner
index b7fea52dad..43ff2d4d88 100644
--- a/automation/scripts/include/xtf-runner
+++ b/automation/scripts/include/xtf-runner
@@ -114,7 +114,7 @@ function xtf_run_test()
 {
     rm -f ${TEST_LOG}
     export BOOT_MSG PASSED TEST_CMD TEST_LOG UBOOT_CMD
-    ./console.exp | sed 's/\r\+$//'
+    ./console.exp |& sed 's/\r\+$//'
 }
 
 # Setup environment and run an XTF test.
diff --git a/automation/scripts/qemu-alpine-x86_64.sh b/automation/scripts/qemu-alpine-x86_64.sh
index 746e70483d..c4666b9507 100755
--- a/automation/scripts/qemu-alpine-x86_64.sh
+++ b/automation/scripts/qemu-alpine-x86_64.sh
@@ -84,4 +84,4 @@ export BOOT_MSG="Latest ChangeSet: "
 export LOG_MSG="Domain-0"
 export PASSED="BusyBox"
 
-./automation/scripts/console.exp | sed 's/\r\+$//'
+./automation/scripts/console.exp |& sed 's/\r\+$//'
diff --git a/automation/scripts/qemu-smoke-dom0-arm32.sh b/automation/scripts/qemu-smoke-dom0-arm32.sh
index 4f50eabdef..36c47daa42 100755
--- a/automation/scripts/qemu-smoke-dom0-arm32.sh
+++ b/automation/scripts/qemu-smoke-dom0-arm32.sh
@@ -96,4 +96,4 @@ export BOOT_MSG="Latest ChangeSet: "
 export LOG_MSG="Domain-0"
 export PASSED="/ #"
 
-../automation/scripts/console.exp | sed 's/\r\+$//'
+../automation/scripts/console.exp |& sed 's/\r\+$//'
diff --git a/automation/scripts/qemu-smoke-dom0-arm64.sh b/automation/scripts/qemu-smoke-dom0-arm64.sh
index d6f6b74880..ee682015a0 100755
--- a/automation/scripts/qemu-smoke-dom0-arm64.sh
+++ b/automation/scripts/qemu-smoke-dom0-arm64.sh
@@ -106,4 +106,4 @@ export TEST_LOG="smoke.serial"
 export LOG_MSG="Domain-0"
 export PASSED="BusyBox"
 
-./automation/scripts/console.exp | sed 's/\r\+$//'
+./automation/scripts/console.exp |& sed 's/\r\+$//'
diff --git a/automation/scripts/qemu-smoke-dom0less-arm32.sh b/automation/scripts/qemu-smoke-dom0less-arm32.sh
index 0e2c5496db..e27636dc9e 100755
--- a/automation/scripts/qemu-smoke-dom0less-arm32.sh
+++ b/automation/scripts/qemu-smoke-dom0less-arm32.sh
@@ -149,4 +149,4 @@ export TEST_LOG="${serial_log}"
 export LOG_MSG="${dom0_prompt}"
 export PASSED="${passed}"
 
-../automation/scripts/console.exp | sed 's/\r\+$//'
+../automation/scripts/console.exp |& sed 's/\r\+$//'
diff --git a/automation/scripts/qemu-smoke-dom0less-arm64.sh b/automation/scripts/qemu-smoke-dom0less-arm64.sh
index e7a3e670d0..e660485f3a 100755
--- a/automation/scripts/qemu-smoke-dom0less-arm64.sh
+++ b/automation/scripts/qemu-smoke-dom0less-arm64.sh
@@ -218,4 +218,4 @@ export TEST_LOG="smoke.serial"
 export LOG_MSG="Welcome to Alpine Linux"
 export PASSED="${passed}"
 
-./automation/scripts/console.exp | sed 's/\r\+$//'
+./automation/scripts/console.exp |& sed 's/\r\+$//'
diff --git a/automation/scripts/qemu-smoke-ppc64le.sh b/automation/scripts/qemu-smoke-ppc64le.sh
index 617096ad1f..119c3ed4d5 100755
--- a/automation/scripts/qemu-smoke-ppc64le.sh
+++ b/automation/scripts/qemu-smoke-ppc64le.sh
@@ -24,4 +24,4 @@ export TEST_CMD="qemu-system-ppc64 \
 export TEST_LOG="${serial_log}"
 export PASSED="Hello, ppc64le!"
 
-./automation/scripts/console.exp | sed 's/\r\+$//'
+./automation/scripts/console.exp |& sed 's/\r\+$//'
diff --git a/automation/scripts/qemu-smoke-riscv64.sh b/automation/scripts/qemu-smoke-riscv64.sh
index 25f9e4190e..c0b1082a08 100755
--- a/automation/scripts/qemu-smoke-riscv64.sh
+++ b/automation/scripts/qemu-smoke-riscv64.sh
@@ -16,4 +16,4 @@ export TEST_CMD="qemu-system-riscv64 \
 export TEST_LOG="smoke.serial"
 export PASSED="All set up"
 
-./automation/scripts/console.exp | sed 's/\r\+$//'
+./automation/scripts/console.exp |& sed 's/\r\+$//'
diff --git a/automation/scripts/qubes-x86-64.sh b/automation/scripts/qubes-x86-64.sh
index b49a44c5b1..bd939dc948 100755
--- a/automation/scripts/qubes-x86-64.sh
+++ b/automation/scripts/qubes-x86-64.sh
@@ -292,7 +292,7 @@ export LOG_MSG="\nWelcome to Alpine Linux"
 export TEST_CMD="ssh $CONTROLLER console"
 export TEST_LOG="smoke.serial"
 export TEST_TIMEOUT="$timeout"
-./automation/scripts/console.exp | sed 's/\r\+$//'
+./automation/scripts/console.exp |& sed 's/\r\+$//'
 TEST_RESULT=$?
 
 if [ -n "$retrieve_xml" ]; then
diff --git a/automation/scripts/xilinx-smoke-dom0-x86_64.sh b/automation/scripts/xilinx-smoke-dom0-x86_64.sh
index 0ad8f658e3..96f534f3aa 100755
--- a/automation/scripts/xilinx-smoke-dom0-x86_64.sh
+++ b/automation/scripts/xilinx-smoke-dom0-x86_64.sh
@@ -173,7 +173,7 @@ export BOOT_MSG="Latest ChangeSet: "
 export TEST_CMD="cat ${SERIAL_DEV}"
 export TEST_LOG="smoke.serial"
 
-./automation/scripts/console.exp | sed 's/\r\+$//'
+./automation/scripts/console.exp |& sed 's/\r\+$//'
 TEST_RESULT=$?
 sh "/scratch/gitlab-runner/${TEST_BOARD}.sh" 2
 exit ${TEST_RESULT}
diff --git a/automation/scripts/xilinx-smoke-dom0less-arm64.sh b/automation/scripts/xilinx-smoke-dom0less-arm64.sh
index 1d7162f1b3..a6da7a830c 100755
--- a/automation/scripts/xilinx-smoke-dom0less-arm64.sh
+++ b/automation/scripts/xilinx-smoke-dom0less-arm64.sh
@@ -137,7 +137,7 @@ export LOG_MSG="Welcome to Alpine Linux"
 export TEST_CMD="cat ${SERIAL_DEV}"
 export TEST_LOG="smoke.serial"
 
-./automation/scripts/console.exp | sed 's/\r\+$//'
+./automation/scripts/console.exp |& sed 's/\r\+$//'
 TEST_RESULT=$?
 sh "/scratch/gitlab-runner/zcu102.sh" 2
 exit ${TEST_RESULT}
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Sep 04 06:44:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Sep 2025 06:44:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1109618.1459142 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uu3hd-0000bF-OP; Thu, 04 Sep 2025 06:44:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1109618.1459142; Thu, 04 Sep 2025 06: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 1uu3hd-0000b7-Lk; Thu, 04 Sep 2025 06:44:13 +0000
Received: by outflank-mailman (input) for mailman id 1109618;
 Thu, 04 Sep 2025 06: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 1uu3hc-0000ap-AP
 for xen-changelog@lists.xenproject.org; Thu, 04 Sep 2025 06: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 1uu3hc-0068YW-0G
 for xen-changelog@lists.xenproject.org;
 Thu, 04 Sep 2025 06:44:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uu3hc-00FJAR-0q
 for xen-changelog@lists.xenproject.org;
 Thu, 04 Sep 2025 06: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=UjgaCmDtnEr1MWHzq6K9E1ABuBnnalfOdSDCbOJWGO0=; b=VOsNGybVjhvbTXx5X4BQlfWLNi
	6ByPJf3tzPrsadtr7gHO63IqTcZ+/PmasCzLK6hiGJPcekNPOeZyJ5gXdJn/ntGGp4wHaUKdj9Nz0
	M+sgBIXAwC5qLJXSIuOggnG4zyjR8Dvaar5nCIz5oxMmfMyIGzBTnVvMwHPrb98o2Uh8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: edit expect script to separate error message lines
Message-Id: <E1uu3hc-00FJAR-0q@xenbits.xenproject.org>
Date: Thu, 04 Sep 2025 06:44:12 +0000

commit 0dcc23db961cad01159ea12aa377924af0218e00
Author:     Victor Lira <victorm.lira@amd.com>
AuthorDate: Tue Sep 2 11:52:35 2025 -0700
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Wed Sep 3 17:20:05 2025 -0700

    automation: edit expect script to separate error message lines
    
    The errors can happen in the middle of a console line which causes the message
    to appear at the end of the current line.
    
    Prepend a newline to clearly separate the error line.
    
    Signed-off-by: Victor Lira <victorm.lira@amd.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/scripts/console.exp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/automation/scripts/console.exp b/automation/scripts/console.exp
index fc80513dfb..e27886bbef 100755
--- a/automation/scripts/console.exp
+++ b/automation/scripts/console.exp
@@ -35,8 +35,8 @@ expect_after {
     -re "(.*)\r" {
         exp_continue -continue_timer
     }
-    timeout {send_error "ERROR-Timeout!\n"; exit 1}
-    eof {send_error "ERROR-EOF!\n"; exit 1}
+    timeout {send_error "\nERROR-Timeout!\n"; exit 1}
+    eof {send_error "\nERROR-EOF!\n"; exit 1}
 }
 
 if {[info exists env(UBOOT_CMD)]} {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Sep 04 09:11:08 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Sep 2025 09:11:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1109746.1459186 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uu5zj-0004qF-Ro; Thu, 04 Sep 2025 09:11:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1109746.1459186; Thu, 04 Sep 2025 09: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 1uu5zj-0004q7-Ob; Thu, 04 Sep 2025 09:11:03 +0000
Received: by outflank-mailman (input) for mailman id 1109746;
 Thu, 04 Sep 2025 09: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 1uu5zi-0004py-Hb
 for xen-changelog@lists.xenproject.org; Thu, 04 Sep 2025 09: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 1uu5zi-006Bu6-0V
 for xen-changelog@lists.xenproject.org;
 Thu, 04 Sep 2025 09:11:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uu5zi-00FS6B-10
 for xen-changelog@lists.xenproject.org;
 Thu, 04 Sep 2025 09: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=E5uwpsOsCVzSK32OzmG2i58DgRLoqHiZ6DxK9aec+S4=; b=YLoWEuYphHnFXq0o5AXgk4+Df8
	rgmXp7DC5xE/JT6FnJ5o18xZfAeuOY8UcTNKoX04HJ1Q2o2+1dWwlEq7fSBs08Kh7Kqmzsr/KXYBO
	UVdqZblzLOmzXxWMEf+NrwNxb7F89kAAJOXKKWbg3tIRC5taBFre63yME/EECRjIk4wg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] arm/mpu: Implement setup_frametable_mappings for MPU systems
Message-Id: <E1uu5zi-00FS6B-10@xenbits.xenproject.org>
Date: Thu, 04 Sep 2025 09:11:02 +0000

commit 6addccb789e17b22ff67d0f8d4862d3e5d1e6758
Author:     Luca Fancellu <luca.fancellu@arm.com>
AuthorDate: Thu Aug 28 12:12:03 2025 +0100
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Thu Sep 4 10:18:50 2025 +0200

    arm/mpu: Implement setup_frametable_mappings for MPU systems
    
    Implement the MPU variant of `setup_frametable_mappings`. This function
    will be called by `setup_mm` when an implementation for MPU systems is
    added in a follow up commit.
    
    Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
    Signed-off-by: Hari Limaye <hari.limaye@arm.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
 xen/arch/arm/mpu/mm.c | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/xen/arch/arm/mpu/mm.c b/xen/arch/arm/mpu/mm.c
index c6891607ec..3f155b7db2 100644
--- a/xen/arch/arm/mpu/mm.c
+++ b/xen/arch/arm/mpu/mm.c
@@ -168,6 +168,39 @@ int mpumap_contains_region(pr_t *table, uint8_t nr_regions, paddr_t base,
     return MPUMAP_REGION_NOTFOUND;
 }
 
+/* Map a frame table to cover physical addresses ps through pe */
+void __init setup_frametable_mappings(paddr_t ps, paddr_t pe)
+{
+    mfn_t base_mfn;
+    paddr_t aligned_ps = ROUNDUP(ps, PAGE_SIZE);
+    paddr_t aligned_pe = ROUNDDOWN(pe, PAGE_SIZE);
+
+    unsigned long nr_pdxs = mfn_to_pdx(mfn_add(maddr_to_mfn(aligned_pe), -1)) -
+                            mfn_to_pdx(maddr_to_mfn(aligned_ps)) + 1;
+    unsigned long frametable_size = nr_pdxs * sizeof(struct page_info);
+
+    /*
+     * The size of paddr_t should be sufficient for the complete range of
+     * physical address.
+     */
+    BUILD_BUG_ON((sizeof(paddr_t) * BITS_PER_BYTE) < PADDR_BITS);
+    BUILD_BUG_ON(sizeof(struct page_info) != PAGE_INFO_SIZE);
+
+    if ( frametable_size > FRAMETABLE_SIZE )
+        panic("The frametable cannot cover the physical region %#"PRIpaddr" - %#"PRIpaddr"\n",
+              ps, pe);
+
+    frametable_base_pdx = paddr_to_pdx(aligned_ps);
+    frametable_size = ROUNDUP(frametable_size, PAGE_SIZE);
+
+    base_mfn = alloc_boot_pages(frametable_size >> PAGE_SHIFT, 1);
+    frame_table = (struct page_info *)mfn_to_virt(mfn_x(base_mfn));
+
+    memset(&frame_table[0], 0, nr_pdxs * sizeof(struct page_info));
+    memset(&frame_table[nr_pdxs], -1,
+           frametable_size - (nr_pdxs * sizeof(struct page_info)));
+}
+
 /*
  * Allocate an entry for a new EL2 MPU region in the bitmap xen_mpumap_mask.
  * @param idx   Set to the index of the allocated EL2 MPU region on success.
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Sep 04 09:11:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Sep 2025 09:11:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1109748.1459190 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uu5zt-0004t5-UT; Thu, 04 Sep 2025 09:11:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1109748.1459190; Thu, 04 Sep 2025 09: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 1uu5zt-0004sx-Rz; Thu, 04 Sep 2025 09:11:13 +0000
Received: by outflank-mailman (input) for mailman id 1109748;
 Thu, 04 Sep 2025 09: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 1uu5zs-0004si-G6
 for xen-changelog@lists.xenproject.org; Thu, 04 Sep 2025 09: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 1uu5zs-006BuE-0n
 for xen-changelog@lists.xenproject.org;
 Thu, 04 Sep 2025 09:11:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uu5zs-00FS6l-1M
 for xen-changelog@lists.xenproject.org;
 Thu, 04 Sep 2025 09: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=LtL1usJja3GajrIiIvZymRg54QYzXjjMGQCTN4Hp1L4=; b=mXMnzwREIXcetBJF2qL4LAewqt
	Fzi3QP72gDd5oOqiPtBjMYWggGzIdG7GaPp9qJEwxCRycP1EvjDjhCP/TpwG7CYZ/uPx2k7E/+kgk
	RLw0iu+OPTrx33LLqjkUuuONP0jYnSzkqLGsQLtiYPJgi+J8KXa+fakMiy3PtIv6mhSE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: platform: Select GICV3 dependency for RCAR4
Message-Id: <E1uu5zs-00FS6l-1M@xenbits.xenproject.org>
Date: Thu, 04 Sep 2025 09:11:12 +0000

commit 1e9635b0442e05e1baefa0d50490c3c7860f6076
Author:     Oleksandr Tyshchenko <Oleksandr_Tyshchenko@epam.com>
AuthorDate: Mon Sep 1 14:02:32 2025 +0000
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Thu Sep 4 10:18:55 2025 +0200

    xen/arm: platform: Select GICV3 dependency for RCAR4
    
    The Renesas R-Car Gen4 platform requires the GICv3 driver,
    including support for the Interrupt Translation Service (ITS).
    
    Without explicitly selecting GICV3, it was possible to create a
    configuration with RCAR4=y and GICV3=n, leading to a build failure
    due to unmet dependencies.
    
    GICv3 driver (GICV3) [Y/n/?] (NEW) n
    WARNING: unmet direct dependencies detected for HAS_ITS
      Depends on [n]: GICV3 [=n] && !NEW_VGIC [=n] && !ARM_32 [=n]
      Selected by [y]:
      - RCAR4 [=y] && <choice> && ARM_64 [=y]
    
    ...
    
    arch/arm/gic-v3-its.c: In function 'gicv3_its_map_guest_device':
    arch/arm/gic-v3-its.c:729:41: error: 'struct vgic_dist' has no member named 'its_devices'
      729 |     struct rb_node **new = &d->arch.vgic.its_devices.rb_node, *parent = NULL;
          |                                         ^
    arch/arm/gic-v3-its.c:755:28: error: 'struct vgic_dist' has no member named 'its_devices_lock'
      755 |     spin_lock(&d->arch.vgic.its_devices_lock);
          |                            ^
    arch/arm/gic-v3-its.c:768:54: error: 'struct vgic_dist' has no member named 'its_devices'
      768 |                 rb_erase(&temp->rbnode, &d->arch.vgic.its_devices);
          |                                                      ^
    In file included from ./include/xen/sched.h:6,
                     from ./include/xen/iocap.h:10,
                     from arch/arm/gic-v3-its.c:13:
    
    ...
    
    Fix this by adding "select GICV3" to the RCAR4 Kconfig entry.
    
    Fixes: 336fc7a19b49 ("xen/arm: platform: Add support for R-Car Gen4")
    Signed-off-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
 xen/arch/arm/platforms/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/xen/arch/arm/platforms/Kconfig b/xen/arch/arm/platforms/Kconfig
index c8bc0bfae3..888d0b85d5 100644
--- a/xen/arch/arm/platforms/Kconfig
+++ b/xen/arch/arm/platforms/Kconfig
@@ -33,6 +33,7 @@ config RCAR3
 config RCAR4
 	bool "Renesas R-Car Gen4 support"
 	depends on ARM_64
+	select GICV3
 	select HAS_SCIF
 	select HAS_ITS
 	select IPMMU_VMSA
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Sep 04 09:11:24 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Sep 2025 09:11:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1109749.1459195 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uu603-0004vT-Vy; Thu, 04 Sep 2025 09:11:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1109749.1459195; Thu, 04 Sep 2025 09: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 1uu603-0004vL-TP; Thu, 04 Sep 2025 09:11:23 +0000
Received: by outflank-mailman (input) for mailman id 1109749;
 Thu, 04 Sep 2025 09: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 1uu602-0004vE-If
 for xen-changelog@lists.xenproject.org; Thu, 04 Sep 2025 09: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 1uu602-006Bub-16
 for xen-changelog@lists.xenproject.org;
 Thu, 04 Sep 2025 09:11:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uu602-00FS8A-1d
 for xen-changelog@lists.xenproject.org;
 Thu, 04 Sep 2025 09: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=4Iet5g2TGELjqBeZcIzK5OAis+8v3EiW31e/qCYoMWg=; b=rybgRw1JVk3ysZX1bF3pA9mzmG
	FDZbOzE7uvC/WkZqTa6LnD7YqDkCTNt5M9REpiiBN2NVp77UXMllBOaZUiB3rYwJY5OEfdGL59svp
	CKe97qB9/k2BwY/G8HOG/M4Jp3V+s0Z6Kw0vMPPNFuHEZboIN0rYrk/ixZY1jQ9T6FZE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] device-tree: fix infinite loop issue in 'assign_shared_memory()'
Message-Id: <E1uu602-00FS8A-1d@xenbits.xenproject.org>
Date: Thu, 04 Sep 2025 09:11:22 +0000

commit 30f5b19f41ee4c5e639ef49878c63e99bc5f6ce5
Author:     Dmytro Prokopchuk1 <dmytro_prokopchuk1@epam.com>
AuthorDate: Mon Sep 1 09:26:45 2025 +0000
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Thu Sep 4 10:20:01 2025 +0200

    device-tree: fix infinite loop issue in 'assign_shared_memory()'
    
    Fix an issue in the 'fail:' cleanup path of the 'assign_shared_memory()'
    function where the use of an unsigned long 'i' with the condition
    '--i >= 0' caused an infinite loop. Update the loop to use 'i--',
    ensuring correct loop termination.
    
    This change adheres to MISRA C Rule 14.3: "Controlling expressions shall
    not be invariant."
    
    Fixes: 041957bad382 ("xen/arm: Add additional reference to owner domain when the owner is allocated")
    Signed-off-by: Dmytro Prokopchuk <dmytro_prokopchuk1@epam.com>
    Acked-by: Michal Orzel <michal.orzel@amd.com>
---
 xen/common/device-tree/static-shmem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/common/device-tree/static-shmem.c b/xen/common/device-tree/static-shmem.c
index 8023c0a484..79f23caa77 100644
--- a/xen/common/device-tree/static-shmem.c
+++ b/xen/common/device-tree/static-shmem.c
@@ -185,7 +185,7 @@ static int __init assign_shared_memory(struct domain *d, paddr_t gbase,
     return 0;
 
  fail:
-    while ( --i >= 0 )
+    while ( i-- )
         put_page_nr(page + i, nr_borrowers);
     return ret;
 }
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Sep 04 09:11:34 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Sep 2025 09:11:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1109750.1459200 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uu60E-0004zJ-1a; Thu, 04 Sep 2025 09:11:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1109750.1459200; Thu, 04 Sep 2025 09: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 1uu60D-0004zB-Uy; Thu, 04 Sep 2025 09:11:33 +0000
Received: by outflank-mailman (input) for mailman id 1109750;
 Thu, 04 Sep 2025 09: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 1uu60C-0004z5-Lu
 for xen-changelog@lists.xenproject.org; Thu, 04 Sep 2025 09: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 1uu60C-006Buf-1O
 for xen-changelog@lists.xenproject.org;
 Thu, 04 Sep 2025 09:11:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uu60C-00FS9C-1x
 for xen-changelog@lists.xenproject.org;
 Thu, 04 Sep 2025 09: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=v4QMgsLOC8ek123+Hc+0Fq0rGnwPGiV4VG3DaYgbFtE=; b=rI0O9/Sxy/RbFALSuGsqlb1ZYy
	4TScNvESMvye3bMpyPrOCkb8QmOIbpTjJSfu4aFNOluWqPwgv9QlQ7Q9lLkbi+OCLFdT8VvJ1LH8a
	7Zjvohnv4wOPA+pRa2SBov0yrbr8gyg7oVY34SyBnOum0/OY68z6Tbf9wBXFYIbBurBg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: smmuv3: Add cache maintenance for non-coherent SMMU queues
Message-Id: <E1uu60C-00FS9C-1x@xenbits.xenproject.org>
Date: Thu, 04 Sep 2025 09:11:32 +0000

commit 3a11099edd748dee5be882ef5b27e2e08bc249d5
Author:     Dmytro Firsov <Dmytro_Firsov@epam.com>
AuthorDate: Wed Sep 3 18:40:00 2025 +0000
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Thu Sep 4 10:20:42 2025 +0200

    xen/arm: smmuv3: Add cache maintenance for non-coherent SMMU queues
    
    According to the Arm SMMUv3 spec (ARM IHI 0070), a system may have
    SMMU(s) that is/are non-coherent to the PE (processing element). In such
    cases, memory accesses from the PE should be either non-cached or be
    augmented with manual cache maintenance. SMMU cache coherency is reported
    by bit 4 (COHACC) of the SMMU_IDR0 register and is already present in the
    Xen driver. However, the current implementation is not aware of cache
    maintenance for memory that is shared between the PE and non-coherent
    SMMUs. It contains dmam_alloc_coherent() function, that is added during
    Linux driver porting. But it is actually a wrapper for _xzalloc(), that
    returns normal writeback memory (which is OK for coherent SMMUs).
    
    During Xen bring-up on a system with non-coherent SMMUs, the driver did
    not work properly - the SMMU was not functional and halted initialization
    at the very beginning due to a timeout while waiting for CMD_SYNC
    completion:
    
      (XEN) SMMUv3: /soc/iommu@fa000000: CMD_SYNC timeout
      (XEN) SMMUv3: /soc/iommu@fa000000: CMD_SYNC timeout
    
    To properly handle such scenarios, add the non_coherent flag to the
    arm_smmu_queue struct. It is initialized using features reported by the
    SMMU HW and will be used for triggering cache clean/invalidate operations.
    This flag is not queue-specific (it is applicable to the whole SMMU), but
    adding it to arm_smmu_queue allows us to not change function signatures
    and simplify the patch (smmu->features, which contains the required flag,
    are not available in code parts that require cache maintenance).
    
    Signed-off-by: Dmytro Firsov <dmytro_firsov@epam.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
    Tested-by: Mykola Kvach <mykola_kvach@epam.com>
    Acked-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 xen/drivers/passthrough/arm/smmu-v3.c | 27 +++++++++++++++++++++++----
 xen/drivers/passthrough/arm/smmu-v3.h |  3 +++
 2 files changed, 26 insertions(+), 4 deletions(-)

diff --git a/xen/drivers/passthrough/arm/smmu-v3.c b/xen/drivers/passthrough/arm/smmu-v3.c
index 5e9e3e048e..bf153227db 100644
--- a/xen/drivers/passthrough/arm/smmu-v3.c
+++ b/xen/drivers/passthrough/arm/smmu-v3.c
@@ -346,10 +346,14 @@ static void queue_write(__le64 *dst, u64 *src, size_t n_dwords)
 
 static int queue_insert_raw(struct arm_smmu_queue *q, u64 *ent)
 {
+	__le64 *q_addr = Q_ENT(q, q->llq.prod);
+
 	if (queue_full(&q->llq))
 		return -ENOSPC;
 
-	queue_write(Q_ENT(q, q->llq.prod), ent, q->ent_dwords);
+	queue_write(q_addr, ent, q->ent_dwords);
+	if (q->non_coherent)
+		clean_dcache_va_range(q_addr, q->ent_dwords * sizeof(*q_addr));
 	queue_inc_prod(&q->llq);
 	queue_sync_prod_out(q);
 	return 0;
@@ -365,10 +369,15 @@ static void queue_read(u64 *dst, __le64 *src, size_t n_dwords)
 
 static int queue_remove_raw(struct arm_smmu_queue *q, u64 *ent)
 {
+	__le64 *q_addr = Q_ENT(q, q->llq.cons);
+
 	if (queue_empty(&q->llq))
 		return -EAGAIN;
 
-	queue_read(ent, Q_ENT(q, q->llq.cons), q->ent_dwords);
+	if (q->non_coherent)
+		invalidate_dcache_va_range(q_addr, q->ent_dwords * sizeof(*q_addr));
+
+	queue_read(ent, q_addr, q->ent_dwords);
 	queue_inc_cons(&q->llq);
 	queue_sync_cons_out(q);
 	return 0;
@@ -463,6 +472,7 @@ static void arm_smmu_cmdq_skip_err(struct arm_smmu_device *smmu)
 	struct arm_smmu_queue *q = &smmu->cmdq.q;
 	u32 cons = readl_relaxed(q->cons_reg);
 	u32 idx = FIELD_GET(CMDQ_CONS_ERR, cons);
+	__le64 *q_addr = Q_ENT(q, cons);
 	struct arm_smmu_cmdq_ent cmd_sync = {
 		.opcode = CMDQ_OP_CMD_SYNC,
 	};
@@ -489,11 +499,14 @@ static void arm_smmu_cmdq_skip_err(struct arm_smmu_device *smmu)
 		break;
 	}
 
+	if (q->non_coherent)
+		invalidate_dcache_va_range(q_addr, q->ent_dwords * sizeof(*q_addr));
+
 	/*
 	 * We may have concurrent producers, so we need to be careful
 	 * not to touch any of the shadow cmdq state.
 	 */
-	queue_read(cmd, Q_ENT(q, cons), q->ent_dwords);
+	queue_read(cmd, q_addr, q->ent_dwords);
 	dev_err(smmu->dev, "skipping command in error state:\n");
 	for (i = 0; i < ARRAY_SIZE(cmd); ++i)
 		dev_err(smmu->dev, "\t0x%016llx\n", (unsigned long long)cmd[i]);
@@ -504,7 +517,10 @@ static void arm_smmu_cmdq_skip_err(struct arm_smmu_device *smmu)
 		return;
 	}
 
-	queue_write(Q_ENT(q, cons), cmd, q->ent_dwords);
+	queue_write(q_addr, cmd, q->ent_dwords);
+
+	if (q->non_coherent)
+		clean_dcache_va_range(q_addr, q->ent_dwords * sizeof(*q_addr));
 }
 
 static void arm_smmu_cmdq_insert_cmd(struct arm_smmu_device *smmu, u64 *cmd)
@@ -1634,6 +1650,9 @@ static int __init arm_smmu_init_one_queue(struct arm_smmu_device *smmu,
 	q->q_base |= FIELD_PREP(Q_BASE_LOG2SIZE, q->llq.max_n_shift);
 
 	q->llq.prod = q->llq.cons = 0;
+
+	q->non_coherent = !(smmu->features & ARM_SMMU_FEAT_COHERENCY);
+
 	return 0;
 }
 
diff --git a/xen/drivers/passthrough/arm/smmu-v3.h b/xen/drivers/passthrough/arm/smmu-v3.h
index f09048812c..ab07366294 100644
--- a/xen/drivers/passthrough/arm/smmu-v3.h
+++ b/xen/drivers/passthrough/arm/smmu-v3.h
@@ -522,6 +522,9 @@ struct arm_smmu_queue {
 
 	u32 __iomem			*prod_reg;
 	u32 __iomem			*cons_reg;
+
+	/* Is the memory access coherent? */
+	bool				non_coherent;
 };
 
 struct arm_smmu_cmdq {
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Sep 04 10:11:07 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Sep 2025 10:11:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1109779.1459207 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uu6vn-0003Eo-VA; Thu, 04 Sep 2025 10:11:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1109779.1459207; Thu, 04 Sep 2025 10: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 1uu6vn-0003Eg-Sc; Thu, 04 Sep 2025 10:11:03 +0000
Received: by outflank-mailman (input) for mailman id 1109779;
 Thu, 04 Sep 2025 10: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 1uu6vm-0003EY-6s
 for xen-changelog@lists.xenproject.org; Thu, 04 Sep 2025 10: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 1uu6vl-006D8t-1x
 for xen-changelog@lists.xenproject.org;
 Thu, 04 Sep 2025 10:11:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uu6vl-00FVOX-2S
 for xen-changelog@lists.xenproject.org;
 Thu, 04 Sep 2025 10: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=OoJZ1x8Hqx+i8+VN8aUmZthmk7mFK5jt8hoR/G0jNig=; b=GMyD4amsHAsB6YOWyjLSY/8yy2
	dg/SkPh4+1b1BNbLYnsfWeLg8bhduACbaGuQHE2vDbl3imv6IJ3VI/lDIZTspyJigbU2KC3BFqVWw
	rG9pwUvBQKPf4b8fC189JGGU2S7SosRZktmbb0Av9Odf9zWp5zIEl/Tl60Icl9D2BoOU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] arm/mpu: Implement setup_frametable_mappings for MPU systems
Message-Id: <E1uu6vl-00FVOX-2S@xenbits.xenproject.org>
Date: Thu, 04 Sep 2025 10:11:01 +0000

commit 6addccb789e17b22ff67d0f8d4862d3e5d1e6758
Author:     Luca Fancellu <luca.fancellu@arm.com>
AuthorDate: Thu Aug 28 12:12:03 2025 +0100
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Thu Sep 4 10:18:50 2025 +0200

    arm/mpu: Implement setup_frametable_mappings for MPU systems
    
    Implement the MPU variant of `setup_frametable_mappings`. This function
    will be called by `setup_mm` when an implementation for MPU systems is
    added in a follow up commit.
    
    Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
    Signed-off-by: Hari Limaye <hari.limaye@arm.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
 xen/arch/arm/mpu/mm.c | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/xen/arch/arm/mpu/mm.c b/xen/arch/arm/mpu/mm.c
index c6891607ec..3f155b7db2 100644
--- a/xen/arch/arm/mpu/mm.c
+++ b/xen/arch/arm/mpu/mm.c
@@ -168,6 +168,39 @@ int mpumap_contains_region(pr_t *table, uint8_t nr_regions, paddr_t base,
     return MPUMAP_REGION_NOTFOUND;
 }
 
+/* Map a frame table to cover physical addresses ps through pe */
+void __init setup_frametable_mappings(paddr_t ps, paddr_t pe)
+{
+    mfn_t base_mfn;
+    paddr_t aligned_ps = ROUNDUP(ps, PAGE_SIZE);
+    paddr_t aligned_pe = ROUNDDOWN(pe, PAGE_SIZE);
+
+    unsigned long nr_pdxs = mfn_to_pdx(mfn_add(maddr_to_mfn(aligned_pe), -1)) -
+                            mfn_to_pdx(maddr_to_mfn(aligned_ps)) + 1;
+    unsigned long frametable_size = nr_pdxs * sizeof(struct page_info);
+
+    /*
+     * The size of paddr_t should be sufficient for the complete range of
+     * physical address.
+     */
+    BUILD_BUG_ON((sizeof(paddr_t) * BITS_PER_BYTE) < PADDR_BITS);
+    BUILD_BUG_ON(sizeof(struct page_info) != PAGE_INFO_SIZE);
+
+    if ( frametable_size > FRAMETABLE_SIZE )
+        panic("The frametable cannot cover the physical region %#"PRIpaddr" - %#"PRIpaddr"\n",
+              ps, pe);
+
+    frametable_base_pdx = paddr_to_pdx(aligned_ps);
+    frametable_size = ROUNDUP(frametable_size, PAGE_SIZE);
+
+    base_mfn = alloc_boot_pages(frametable_size >> PAGE_SHIFT, 1);
+    frame_table = (struct page_info *)mfn_to_virt(mfn_x(base_mfn));
+
+    memset(&frame_table[0], 0, nr_pdxs * sizeof(struct page_info));
+    memset(&frame_table[nr_pdxs], -1,
+           frametable_size - (nr_pdxs * sizeof(struct page_info)));
+}
+
 /*
  * Allocate an entry for a new EL2 MPU region in the bitmap xen_mpumap_mask.
  * @param idx   Set to the index of the allocated EL2 MPU region on success.
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Sep 04 10:11:14 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Sep 2025 10:11:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1109780.1459211 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uu6vx-0003Gg-06; Thu, 04 Sep 2025 10:11:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1109780.1459211; Thu, 04 Sep 2025 10: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 1uu6vw-0003GY-Tv; Thu, 04 Sep 2025 10:11:12 +0000
Received: by outflank-mailman (input) for mailman id 1109780;
 Thu, 04 Sep 2025 10: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 1uu6vv-0003GO-UJ
 for xen-changelog@lists.xenproject.org; Thu, 04 Sep 2025 10: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 1uu6vv-006D8x-2G
 for xen-changelog@lists.xenproject.org;
 Thu, 04 Sep 2025 10:11:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uu6vv-00FVOz-2o
 for xen-changelog@lists.xenproject.org;
 Thu, 04 Sep 2025 10: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=v37EZ8fixl8iXBFZRhRM07GYOT0uS3ySdPtjcf4tb80=; b=dGLfTqi9G1sxuZ2P43ngnZNTUh
	D0SX92yq7sRXSOv3DCyS+qbvL/9J3FX76QZPwBNRuMw4OxlfP/TzVs6SG30Cqyga9T8d5nJ5OSJCx
	40keXt+ryrKDKBeqrjWSF48YlxvdYed6EABL5hH4WppxhTuDaI/JuVYW30alWUCkzQVg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: platform: Select GICV3 dependency for RCAR4
Message-Id: <E1uu6vv-00FVOz-2o@xenbits.xenproject.org>
Date: Thu, 04 Sep 2025 10:11:11 +0000

commit 1e9635b0442e05e1baefa0d50490c3c7860f6076
Author:     Oleksandr Tyshchenko <Oleksandr_Tyshchenko@epam.com>
AuthorDate: Mon Sep 1 14:02:32 2025 +0000
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Thu Sep 4 10:18:55 2025 +0200

    xen/arm: platform: Select GICV3 dependency for RCAR4
    
    The Renesas R-Car Gen4 platform requires the GICv3 driver,
    including support for the Interrupt Translation Service (ITS).
    
    Without explicitly selecting GICV3, it was possible to create a
    configuration with RCAR4=y and GICV3=n, leading to a build failure
    due to unmet dependencies.
    
    GICv3 driver (GICV3) [Y/n/?] (NEW) n
    WARNING: unmet direct dependencies detected for HAS_ITS
      Depends on [n]: GICV3 [=n] && !NEW_VGIC [=n] && !ARM_32 [=n]
      Selected by [y]:
      - RCAR4 [=y] && <choice> && ARM_64 [=y]
    
    ...
    
    arch/arm/gic-v3-its.c: In function 'gicv3_its_map_guest_device':
    arch/arm/gic-v3-its.c:729:41: error: 'struct vgic_dist' has no member named 'its_devices'
      729 |     struct rb_node **new = &d->arch.vgic.its_devices.rb_node, *parent = NULL;
          |                                         ^
    arch/arm/gic-v3-its.c:755:28: error: 'struct vgic_dist' has no member named 'its_devices_lock'
      755 |     spin_lock(&d->arch.vgic.its_devices_lock);
          |                            ^
    arch/arm/gic-v3-its.c:768:54: error: 'struct vgic_dist' has no member named 'its_devices'
      768 |                 rb_erase(&temp->rbnode, &d->arch.vgic.its_devices);
          |                                                      ^
    In file included from ./include/xen/sched.h:6,
                     from ./include/xen/iocap.h:10,
                     from arch/arm/gic-v3-its.c:13:
    
    ...
    
    Fix this by adding "select GICV3" to the RCAR4 Kconfig entry.
    
    Fixes: 336fc7a19b49 ("xen/arm: platform: Add support for R-Car Gen4")
    Signed-off-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
 xen/arch/arm/platforms/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/xen/arch/arm/platforms/Kconfig b/xen/arch/arm/platforms/Kconfig
index c8bc0bfae3..888d0b85d5 100644
--- a/xen/arch/arm/platforms/Kconfig
+++ b/xen/arch/arm/platforms/Kconfig
@@ -33,6 +33,7 @@ config RCAR3
 config RCAR4
 	bool "Renesas R-Car Gen4 support"
 	depends on ARM_64
+	select GICV3
 	select HAS_SCIF
 	select HAS_ITS
 	select IPMMU_VMSA
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Sep 04 10:11:23 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Sep 2025 10:11:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1109781.1459215 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uu6w7-0003Io-1a; Thu, 04 Sep 2025 10:11:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1109781.1459215; Thu, 04 Sep 2025 10: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 1uu6w6-0003Ig-VO; Thu, 04 Sep 2025 10:11:22 +0000
Received: by outflank-mailman (input) for mailman id 1109781;
 Thu, 04 Sep 2025 10: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 1uu6w6-0003IY-1X
 for xen-changelog@lists.xenproject.org; Thu, 04 Sep 2025 10: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 1uu6w5-006D9Q-2Y
 for xen-changelog@lists.xenproject.org;
 Thu, 04 Sep 2025 10:11:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uu6w5-00FVQH-37
 for xen-changelog@lists.xenproject.org;
 Thu, 04 Sep 2025 10: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=EEDtLSAyxDeMZ9lGvc8gdb1kiz2EBqUc9Kl2x+nKpnI=; b=vb0gCoTmpe4k9i5VVGMxUgWqBi
	fU6oZSpSn9EwDP61eQsQ+azbiV9JM9yEQs46QcE0khBe4NOAsBXhF4Y/WwwNtzc7OtUa8Hs0nOPUQ
	rVt1Wr+9E5QHUW0wxafcTUo+3z4PH0ZYsjeVkXhOXa2VtP/4ArDYzRobL1WmhoxmnlbU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] device-tree: fix infinite loop issue in 'assign_shared_memory()'
Message-Id: <E1uu6w5-00FVQH-37@xenbits.xenproject.org>
Date: Thu, 04 Sep 2025 10:11:21 +0000

commit 30f5b19f41ee4c5e639ef49878c63e99bc5f6ce5
Author:     Dmytro Prokopchuk1 <dmytro_prokopchuk1@epam.com>
AuthorDate: Mon Sep 1 09:26:45 2025 +0000
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Thu Sep 4 10:20:01 2025 +0200

    device-tree: fix infinite loop issue in 'assign_shared_memory()'
    
    Fix an issue in the 'fail:' cleanup path of the 'assign_shared_memory()'
    function where the use of an unsigned long 'i' with the condition
    '--i >= 0' caused an infinite loop. Update the loop to use 'i--',
    ensuring correct loop termination.
    
    This change adheres to MISRA C Rule 14.3: "Controlling expressions shall
    not be invariant."
    
    Fixes: 041957bad382 ("xen/arm: Add additional reference to owner domain when the owner is allocated")
    Signed-off-by: Dmytro Prokopchuk <dmytro_prokopchuk1@epam.com>
    Acked-by: Michal Orzel <michal.orzel@amd.com>
---
 xen/common/device-tree/static-shmem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/common/device-tree/static-shmem.c b/xen/common/device-tree/static-shmem.c
index 8023c0a484..79f23caa77 100644
--- a/xen/common/device-tree/static-shmem.c
+++ b/xen/common/device-tree/static-shmem.c
@@ -185,7 +185,7 @@ static int __init assign_shared_memory(struct domain *d, paddr_t gbase,
     return 0;
 
  fail:
-    while ( --i >= 0 )
+    while ( i-- )
         put_page_nr(page + i, nr_borrowers);
     return ret;
 }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Sep 04 10:11:33 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Sep 2025 10:11:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1109782.1459219 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uu6wH-0003Mh-2z; Thu, 04 Sep 2025 10:11:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1109782.1459219; Thu, 04 Sep 2025 10: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 1uu6wH-0003MZ-0U; Thu, 04 Sep 2025 10:11:33 +0000
Received: by outflank-mailman (input) for mailman id 1109782;
 Thu, 04 Sep 2025 10: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 1uu6wG-0003ML-5p
 for xen-changelog@lists.xenproject.org; Thu, 04 Sep 2025 10: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 1uu6wF-006D9U-2r
 for xen-changelog@lists.xenproject.org;
 Thu, 04 Sep 2025 10:11:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uu6wG-00FVQs-0C
 for xen-changelog@lists.xenproject.org;
 Thu, 04 Sep 2025 10: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=tk3tDQjSgjtY5Xpw75PkfoTmFesZxhKRSUFDFfCrb+Y=; b=sgY17B0aI9/ggHpljgNWx+M4V9
	8Z8pDk4ZFXSGIOcsl33iYkwPMziHz3w2ZSrUu7IdziOEYnesGqH/hvxyJDHLnSCVrpw8rntgQGA3i
	oviY8/4yVltx1pAV4E1jRgMec9e/RAlHrywGkz/6FTFtosqNC9lBVGSChjIIZmv11T50=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: smmuv3: Add cache maintenance for non-coherent SMMU queues
Message-Id: <E1uu6wG-00FVQs-0C@xenbits.xenproject.org>
Date: Thu, 04 Sep 2025 10:11:32 +0000

commit 3a11099edd748dee5be882ef5b27e2e08bc249d5
Author:     Dmytro Firsov <Dmytro_Firsov@epam.com>
AuthorDate: Wed Sep 3 18:40:00 2025 +0000
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Thu Sep 4 10:20:42 2025 +0200

    xen/arm: smmuv3: Add cache maintenance for non-coherent SMMU queues
    
    According to the Arm SMMUv3 spec (ARM IHI 0070), a system may have
    SMMU(s) that is/are non-coherent to the PE (processing element). In such
    cases, memory accesses from the PE should be either non-cached or be
    augmented with manual cache maintenance. SMMU cache coherency is reported
    by bit 4 (COHACC) of the SMMU_IDR0 register and is already present in the
    Xen driver. However, the current implementation is not aware of cache
    maintenance for memory that is shared between the PE and non-coherent
    SMMUs. It contains dmam_alloc_coherent() function, that is added during
    Linux driver porting. But it is actually a wrapper for _xzalloc(), that
    returns normal writeback memory (which is OK for coherent SMMUs).
    
    During Xen bring-up on a system with non-coherent SMMUs, the driver did
    not work properly - the SMMU was not functional and halted initialization
    at the very beginning due to a timeout while waiting for CMD_SYNC
    completion:
    
      (XEN) SMMUv3: /soc/iommu@fa000000: CMD_SYNC timeout
      (XEN) SMMUv3: /soc/iommu@fa000000: CMD_SYNC timeout
    
    To properly handle such scenarios, add the non_coherent flag to the
    arm_smmu_queue struct. It is initialized using features reported by the
    SMMU HW and will be used for triggering cache clean/invalidate operations.
    This flag is not queue-specific (it is applicable to the whole SMMU), but
    adding it to arm_smmu_queue allows us to not change function signatures
    and simplify the patch (smmu->features, which contains the required flag,
    are not available in code parts that require cache maintenance).
    
    Signed-off-by: Dmytro Firsov <dmytro_firsov@epam.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
    Tested-by: Mykola Kvach <mykola_kvach@epam.com>
    Acked-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 xen/drivers/passthrough/arm/smmu-v3.c | 27 +++++++++++++++++++++++----
 xen/drivers/passthrough/arm/smmu-v3.h |  3 +++
 2 files changed, 26 insertions(+), 4 deletions(-)

diff --git a/xen/drivers/passthrough/arm/smmu-v3.c b/xen/drivers/passthrough/arm/smmu-v3.c
index 5e9e3e048e..bf153227db 100644
--- a/xen/drivers/passthrough/arm/smmu-v3.c
+++ b/xen/drivers/passthrough/arm/smmu-v3.c
@@ -346,10 +346,14 @@ static void queue_write(__le64 *dst, u64 *src, size_t n_dwords)
 
 static int queue_insert_raw(struct arm_smmu_queue *q, u64 *ent)
 {
+	__le64 *q_addr = Q_ENT(q, q->llq.prod);
+
 	if (queue_full(&q->llq))
 		return -ENOSPC;
 
-	queue_write(Q_ENT(q, q->llq.prod), ent, q->ent_dwords);
+	queue_write(q_addr, ent, q->ent_dwords);
+	if (q->non_coherent)
+		clean_dcache_va_range(q_addr, q->ent_dwords * sizeof(*q_addr));
 	queue_inc_prod(&q->llq);
 	queue_sync_prod_out(q);
 	return 0;
@@ -365,10 +369,15 @@ static void queue_read(u64 *dst, __le64 *src, size_t n_dwords)
 
 static int queue_remove_raw(struct arm_smmu_queue *q, u64 *ent)
 {
+	__le64 *q_addr = Q_ENT(q, q->llq.cons);
+
 	if (queue_empty(&q->llq))
 		return -EAGAIN;
 
-	queue_read(ent, Q_ENT(q, q->llq.cons), q->ent_dwords);
+	if (q->non_coherent)
+		invalidate_dcache_va_range(q_addr, q->ent_dwords * sizeof(*q_addr));
+
+	queue_read(ent, q_addr, q->ent_dwords);
 	queue_inc_cons(&q->llq);
 	queue_sync_cons_out(q);
 	return 0;
@@ -463,6 +472,7 @@ static void arm_smmu_cmdq_skip_err(struct arm_smmu_device *smmu)
 	struct arm_smmu_queue *q = &smmu->cmdq.q;
 	u32 cons = readl_relaxed(q->cons_reg);
 	u32 idx = FIELD_GET(CMDQ_CONS_ERR, cons);
+	__le64 *q_addr = Q_ENT(q, cons);
 	struct arm_smmu_cmdq_ent cmd_sync = {
 		.opcode = CMDQ_OP_CMD_SYNC,
 	};
@@ -489,11 +499,14 @@ static void arm_smmu_cmdq_skip_err(struct arm_smmu_device *smmu)
 		break;
 	}
 
+	if (q->non_coherent)
+		invalidate_dcache_va_range(q_addr, q->ent_dwords * sizeof(*q_addr));
+
 	/*
 	 * We may have concurrent producers, so we need to be careful
 	 * not to touch any of the shadow cmdq state.
 	 */
-	queue_read(cmd, Q_ENT(q, cons), q->ent_dwords);
+	queue_read(cmd, q_addr, q->ent_dwords);
 	dev_err(smmu->dev, "skipping command in error state:\n");
 	for (i = 0; i < ARRAY_SIZE(cmd); ++i)
 		dev_err(smmu->dev, "\t0x%016llx\n", (unsigned long long)cmd[i]);
@@ -504,7 +517,10 @@ static void arm_smmu_cmdq_skip_err(struct arm_smmu_device *smmu)
 		return;
 	}
 
-	queue_write(Q_ENT(q, cons), cmd, q->ent_dwords);
+	queue_write(q_addr, cmd, q->ent_dwords);
+
+	if (q->non_coherent)
+		clean_dcache_va_range(q_addr, q->ent_dwords * sizeof(*q_addr));
 }
 
 static void arm_smmu_cmdq_insert_cmd(struct arm_smmu_device *smmu, u64 *cmd)
@@ -1634,6 +1650,9 @@ static int __init arm_smmu_init_one_queue(struct arm_smmu_device *smmu,
 	q->q_base |= FIELD_PREP(Q_BASE_LOG2SIZE, q->llq.max_n_shift);
 
 	q->llq.prod = q->llq.cons = 0;
+
+	q->non_coherent = !(smmu->features & ARM_SMMU_FEAT_COHERENCY);
+
 	return 0;
 }
 
diff --git a/xen/drivers/passthrough/arm/smmu-v3.h b/xen/drivers/passthrough/arm/smmu-v3.h
index f09048812c..ab07366294 100644
--- a/xen/drivers/passthrough/arm/smmu-v3.h
+++ b/xen/drivers/passthrough/arm/smmu-v3.h
@@ -522,6 +522,9 @@ struct arm_smmu_queue {
 
 	u32 __iomem			*prod_reg;
 	u32 __iomem			*cons_reg;
+
+	/* Is the memory access coherent? */
+	bool				non_coherent;
 };
 
 struct arm_smmu_cmdq {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Sep 04 13:00:06 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Sep 2025 13:00:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1110070.1459372 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uu9ZL-0004hk-I4; Thu, 04 Sep 2025 13:00:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1110070.1459372; Thu, 04 Sep 2025 13: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 1uu9ZL-0004hK-F5; Thu, 04 Sep 2025 13:00:03 +0000
Received: by outflank-mailman (input) for mailman id 1110070;
 Thu, 04 Sep 2025 13: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 1uu9ZK-0004Sy-KN
 for xen-changelog@lists.xenproject.org; Thu, 04 Sep 2025 13: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 1uu9ZK-006GRO-0a
 for xen-changelog@lists.xenproject.org;
 Thu, 04 Sep 2025 13:00:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uu9ZK-00Fear-19
 for xen-changelog@lists.xenproject.org;
 Thu, 04 Sep 2025 13: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=qM2aIEzmBoLFfkSeUVJuOWKUcGTugfxGknOXOVn+UdM=; b=w5xPO+1aOwqQXwbi5IGEZIaybl
	zrcXqKDrv38e2hHlU02+OY+J4CN8aZuD6yEniLG3b88k+vfNgtbhV2I411eTgJkIE4bsrekoVRdAT
	1+RnEs1JjBEcFf+jBIE9SFeNcJopOj4HAPQkweLWxZHTAFPEfiCvXui8mn/hJHLbksNE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xl: move printf_info prototype to an header
Message-Id: <E1uu9ZK-00Fear-19@xenbits.xenproject.org>
Date: Thu, 04 Sep 2025 13:00:02 +0000

commit e5843b402043965abf180b1f4a0ab95692c6c25c
Author:     Anthony PERARD <anthony.perard@vates.tech>
AuthorDate: Fri Aug 8 16:55:52 2025 +0200
Commit:     Anthony PERARD <anthony.perard@vates.tech>
CommitDate: Thu Sep 4 14:26:26 2025 +0200

    xl: move printf_info prototype to an header
    
    In a single place.
    
    Signed-off-by: Anthony PERARD <anthony.perard@vates.tech>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
---
 tools/xl/xl.h      | 3 +++
 tools/xl/xl_info.c | 3 ---
 tools/xl/xl_misc.c | 3 ---
 3 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/tools/xl/xl.h b/tools/xl/xl.h
index 45745f0dbb..9000df00de 100644
--- a/tools/xl/xl.h
+++ b/tools/xl/xl.h
@@ -310,6 +310,9 @@ extern void printf_info_sexp(int domid, libxl_domain_config *d_config, FILE *fh)
 extern void apply_global_affinity_masks(libxl_domain_type type,
                                         libxl_bitmap *vcpu_affinity_array,
                                         unsigned int size);
+void printf_info(enum output_format output_format,
+                 int domid,
+                 libxl_domain_config *d_config, FILE *fh);
 
 #define XL_GLOBAL_CONFIG XEN_CONFIG_DIR "/xl.conf"
 #define XL_LOCK_FILE XEN_LOCK_DIR "/xl"
diff --git a/tools/xl/xl_info.c b/tools/xl/xl_info.c
index d3583cbf8f..83a02f45fe 100644
--- a/tools/xl/xl_info.c
+++ b/tools/xl/xl_info.c
@@ -96,9 +96,6 @@ out:
     return s;
 }
 
-void printf_info(enum output_format output_format,
-                 int domid,
-                 libxl_domain_config *d_config, FILE *fh);
 void printf_info(enum output_format output_format,
                  int domid,
                  libxl_domain_config *d_config, FILE *fh)
diff --git a/tools/xl/xl_misc.c b/tools/xl/xl_misc.c
index 08f0fb6dc9..f0167e1603 100644
--- a/tools/xl/xl_misc.c
+++ b/tools/xl/xl_misc.c
@@ -256,9 +256,6 @@ int main_dump_core(int argc, char **argv)
     return EXIT_SUCCESS;
 }
 
-extern void printf_info(enum output_format output_format,
-                        int domid,
-                        libxl_domain_config *d_config, FILE *fh);
 int main_config_update(int argc, char **argv)
 {
     uint32_t domid;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Sep 04 13:00:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Sep 2025 13:00:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1110071.1459375 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uu9ZV-0005Cx-JU; Thu, 04 Sep 2025 13:00:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1110071.1459375; Thu, 04 Sep 2025 13: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 1uu9ZV-0005Cp-GW; Thu, 04 Sep 2025 13:00:13 +0000
Received: by outflank-mailman (input) for mailman id 1110071;
 Thu, 04 Sep 2025 13: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 1uu9ZU-0005CK-I3
 for xen-changelog@lists.xenproject.org; Thu, 04 Sep 2025 13: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 1uu9ZU-006GRT-0r
 for xen-changelog@lists.xenproject.org;
 Thu, 04 Sep 2025 13:00:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uu9ZU-00Febb-1Q
 for xen-changelog@lists.xenproject.org;
 Thu, 04 Sep 2025 13: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=N/baOwWLFUPDv0KqSIjW7fav1IO9pMElDVPJ/TFNaFA=; b=qytrz5dNksmu36MZ5SYgL1lX9/
	8Z/aXnUGCeXcGdl6Mk4FQLq28LjwJoQ8M6OyCuOK9fgHJ7oshz9gg6SxZzjI3ZmlW4tj/RpyqDGdo
	DTZI1LmJwLv+MMbDBs7acPc6NK876YNku9za0kcPZJa8iigRHnxhkXRH9Inrjo9YMzgw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] libxl: Remove duplicate libxl_domain_config_gen_json prototype
Message-Id: <E1uu9ZU-00Febb-1Q@xenbits.xenproject.org>
Date: Thu, 04 Sep 2025 13:00:12 +0000

commit f5aadd575bb5b858295dd936eba7d720f5c1b949
Author:     Anthony PERARD <anthony.perard@vates.tech>
AuthorDate: Fri Aug 8 16:55:53 2025 +0200
Commit:     Anthony PERARD <anthony.perard@vates.tech>
CommitDate: Thu Sep 4 14:26:38 2025 +0200

    libxl: Remove duplicate libxl_domain_config_gen_json prototype
    
    Since f9e681d3d1b8, the prototype of libxl_domain_config_gen_json is
    generated from IDL in _libxl_types_json.h.
    
    Fixes: f9e681d3d1b8 ("libxl: move definition of libxl_domain_config into the IDL")
    Signed-off-by: Anthony PERARD <anthony.perard@vates.tech>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
---
 tools/include/libxl_json.h | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/tools/include/libxl_json.h b/tools/include/libxl_json.h
index 260783bfde..3f97267eae 100644
--- a/tools/include/libxl_json.h
+++ b/tools/include/libxl_json.h
@@ -90,7 +90,4 @@ static inline yajl_gen libxl_yajl_gen_alloc(const yajl_alloc_funcs *allocFuncs)
 
 #endif /* !HAVE_YAJL_V2 */
 
-yajl_gen_status libxl_domain_config_gen_json(yajl_gen hand,
-                                             libxl_domain_config *p);
-
 #endif /* LIBXL_JSON_H */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Sep 04 13:00:23 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Sep 2025 13:00:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1110072.1459379 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uu9Zf-0005FR-Kf; Thu, 04 Sep 2025 13:00:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1110072.1459379; Thu, 04 Sep 2025 13: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 1uu9Zf-0005FK-I0; Thu, 04 Sep 2025 13:00:23 +0000
Received: by outflank-mailman (input) for mailman id 1110072;
 Thu, 04 Sep 2025 13: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 1uu9Ze-0005F4-Kt
 for xen-changelog@lists.xenproject.org; Thu, 04 Sep 2025 13: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 1uu9Ze-006GRX-19
 for xen-changelog@lists.xenproject.org;
 Thu, 04 Sep 2025 13:00:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uu9Ze-00Fec4-1j
 for xen-changelog@lists.xenproject.org;
 Thu, 04 Sep 2025 13: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=QLhH0f30gpJk6WIernVwAObRpdHC8zW0BsehMLtR74w=; b=jZgvoWUKoVYpSXBX9Xu2LvxM+I
	/i3G9uWraRgPq2yeSBhXBpey3npTi9H+w5eyPHyOF30w1fH3DSPfxecoRiGU/6J4DHKBFdfAWokH8
	zx+2581EkPDc8Epx925nTAhjNIhRsNl9IZ+xb6wGO2+NrE3NTTt/G++erd9thDw/UhiI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] libxl: remove duplicated libxl__yajl_gen_asciiz() prototype
Message-Id: <E1uu9Ze-00Fec4-1j@xenbits.xenproject.org>
Date: Thu, 04 Sep 2025 13:00:22 +0000

commit ccb11468b69f7289695ae1594f036e5af2238e61
Author:     Anthony PERARD <anthony.perard@vates.tech>
AuthorDate: Fri Aug 8 16:55:54 2025 +0200
Commit:     Anthony PERARD <anthony.perard@vates.tech>
CommitDate: Thu Sep 4 14:26:44 2025 +0200

    libxl: remove duplicated libxl__yajl_gen_asciiz() prototype
    
    Signed-off-by: Anthony PERARD <anthony.perard@vates.tech>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
---
 tools/libs/light/libxl_internal.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/tools/libs/light/libxl_internal.h b/tools/libs/light/libxl_internal.h
index 2a5b233caa..4b6587a27a 100644
--- a/tools/libs/light/libxl_internal.h
+++ b/tools/libs/light/libxl_internal.h
@@ -1993,8 +1993,6 @@ _hidden char *libxl__cpupoolid_to_name(libxl__gc *gc, uint32_t poolid);
 _hidden int libxl__enum_from_string(const libxl_enum_string_table *t,
                                     const char *s, int *e) NN(2);
 
-_hidden yajl_gen_status libxl__yajl_gen_asciiz(yajl_gen hand, const char *str);
-
 _hidden yajl_gen_status libxl__string_gen_json(yajl_gen hand, const char *p);
 
 typedef yajl_gen_status (*libxl__gen_json_callback)(yajl_gen hand, void *);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Sep 04 13:00:33 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Sep 2025 13:00:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1110073.1459382 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uu9Zp-0005Hk-M3; Thu, 04 Sep 2025 13:00:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1110073.1459382; Thu, 04 Sep 2025 13: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 1uu9Zp-0005Hd-JV; Thu, 04 Sep 2025 13:00:33 +0000
Received: by outflank-mailman (input) for mailman id 1110073;
 Thu, 04 Sep 2025 13: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 1uu9Zo-0005HT-Ls
 for xen-changelog@lists.xenproject.org; Thu, 04 Sep 2025 13: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 1uu9Zo-006GRr-1Q
 for xen-changelog@lists.xenproject.org;
 Thu, 04 Sep 2025 13:00:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uu9Zo-00FecS-20
 for xen-changelog@lists.xenproject.org;
 Thu, 04 Sep 2025 13: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=5JoRdEhie3wDZvF38hlD+8JNaJFpc8yussYaqI1Jlok=; b=hgedhCXaOmJnaZOznj+1TlH1DT
	X+KLBKI2eFVVFb2Vm950vGs8fsG3WixlmxScz7F7aCFKvYKn3N8SU8lcmSKQDGkBFXehkj0FiwFgB
	zp789BtpZXqPXwh3qyMNAKWTg4NYmAeE9zqRZN+0jTrtX9ad/Qt0PKmk9VW3YTEkiCJ0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/xentop: Add physical CPU statistics support
Message-Id: <E1uu9Zo-00FecS-20@xenbits.xenproject.org>
Date: Thu, 04 Sep 2025 13:00:32 +0000

commit 45bb8868ef21459b266919fbbda98f2256295a0f
Author:     Jahan Murudi <jahan.murudi.zg@renesas.com>
AuthorDate: Mon Aug 4 18:36:43 2025 +0530
Commit:     Anthony PERARD <anthony.perard@vates.tech>
CommitDate: Thu Sep 4 14:30:53 2025 +0200

    tools/xentop: Add physical CPU statistics support
    
    Introduce a new '-p/--pcpus' flag to display physical CPU utilization metrics
    using xc_interface. This provides hypervisor-level CPU usage insights alongside
    existing domain statistics. This helps correlate VM resource usage with host CPU
    load patterns.
    
    Changes:
    - Add pcpu.c/pcpu.h for PCPU stat collection logic
    - Link against libxenctrl for xc_handle access
    - Extend CLI with '-p' flag and output formatting
    - Forward declare xenstat_handle to access xc_handle
    - Include cleanup for PCPU resources in exit handler
    
    Example usage:
      xentop -p  # Shows physical CPU stats
      xentop -bp # Batch mode
      xentop -d 1 -p # With different delays
    
    Example output with '-p':
      NAME      STATE   CPU(%)  MEM(%)  VCPUS ...
      Domain-0  -----r    17.0     6.3      8
      DomD      -----r   767.0    38.1      8
    
      Physical CPU Usage:
      ┌───────┬────────┐
      │ Core  │ Usage  │
      ├───────┼────────┤
      │ 0     │  98.1% │
      │ ...   │  ...   │
      │ 7     │  97.3% │
      └───────┴────────┘
    
    Signed-off-by: Jahan Murudi <jahan.murudi.zg@renesas.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
---
 tools/xentop/Makefile |   5 +-
 tools/xentop/pcpu.c   | 141 ++++++++++++++++++++++++++++++++++++++++++++++++++
 tools/xentop/pcpu.h   |  17 ++++++
 tools/xentop/xentop.c |  79 +++++++++++++++++++++-------
 4 files changed, 222 insertions(+), 20 deletions(-)

diff --git a/tools/xentop/Makefile b/tools/xentop/Makefile
index 70cc2211c5..f514a6f7a8 100644
--- a/tools/xentop/Makefile
+++ b/tools/xentop/Makefile
@@ -15,6 +15,7 @@ include $(XEN_ROOT)/tools/Rules.mk
 
 CFLAGS += -DGCC_PRINTF $(CFLAGS_libxenstat)
 LDLIBS += $(LDLIBS_libxenstat) $(CURSES_LIBS) $(TINFO_LIBS) $(SOCKET_LIBS) -lm
+LDLIBS += $(LDLIBS_libxenctrl)
 CFLAGS += -DHOST_$(XEN_OS)
 
 # Include configure output (config.h)
@@ -25,8 +26,8 @@ TARGETS := xentop
 .PHONY: all
 all: $(TARGETS)
 
-xentop: xentop.o
-	$(CC) $(LDFLAGS) -o $@ $< $(LDLIBS) $(APPEND_LDFLAGS)
+xentop: xentop.o pcpu.o
+	$(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS) $(APPEND_LDFLAGS)
 
 .PHONY: install
 install: all
diff --git a/tools/xentop/pcpu.c b/tools/xentop/pcpu.c
new file mode 100644
index 0000000000..cdb4cb2131
--- /dev/null
+++ b/tools/xentop/pcpu.c
@@ -0,0 +1,141 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright (C) 2025 Renesas Electronics Corporation
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include <sys/time.h>
+#include <xenctrl.h>
+#include "pcpu.h"
+
+#define MAX_PCPUS 128
+
+typedef struct {
+    float usage_pct;
+} pcpu_stat_t;
+
+static pcpu_stat_t *pcpu_stats = NULL;
+static uint64_t *prev_idle = NULL;
+static int allocated_pcpus = 0;
+static xc_interface *xc_handle = NULL;
+static uint64_t prev_global_time = 0;
+
+static void report_pcpu_error(const char *context)
+{
+    fprintf(stderr, "PCPU error: %s (%s)\n", context, strerror(errno));
+}
+
+int update_pcpu_stats(const struct timeval *now, unsigned int delay_sec)
+{
+    struct xen_sysctl_cpuinfo info[MAX_PCPUS];
+    int detected_cpus = 0;
+    int ret, i;
+    uint64_t current_time = (uint64_t)now->tv_sec * 1000000ULL + now->tv_usec;
+    uint64_t time_diff;
+
+    if (!xc_handle) {
+        xc_handle = xc_interface_open(NULL, NULL, 0);
+        if (!xc_handle) {
+            report_pcpu_error("xc_interface_open failed");
+            return -1;
+        }
+    }
+
+    ret = xc_getcpuinfo(xc_handle, MAX_PCPUS, info, &detected_cpus);
+    if (ret < 0) {
+        report_pcpu_error("xc_getcpuinfo failed");
+        return -1;
+    }
+
+    /* Allocate/reallocate memory if needed */
+    if (!pcpu_stats || detected_cpus > allocated_pcpus) {
+        pcpu_stat_t *new_stats = realloc(pcpu_stats,
+                        detected_cpus * sizeof(*pcpu_stats));
+        if (!new_stats) goto alloc_error;
+
+        pcpu_stats = new_stats;
+
+        uint64_t *new_prev_idle = realloc(prev_idle,
+                        detected_cpus * sizeof(*prev_idle));
+        if (!new_prev_idle) goto alloc_error;
+
+        prev_idle = new_prev_idle;
+        allocated_pcpus = detected_cpus;
+
+        /* Initialize new entries */
+        for (i = 0; i < detected_cpus; i++) {
+            prev_idle[i] = info[i].idletime / 1000; /* ns->us */
+            pcpu_stats[i].usage_pct = 0.0;
+        }
+
+        /* Set initial global time reference */
+        prev_global_time = current_time;
+        return 0;
+    }
+
+    /* Calculate time difference since last update */
+    time_diff = current_time - prev_global_time;
+
+    /* Calculate CPU usage for each core */
+    for (i = 0; i < detected_cpus; i++) {
+        uint64_t current_idle = info[i].idletime / 1000;
+        uint64_t idle_diff = current_idle - prev_idle[i];
+
+        if (time_diff > 0) {
+            double usage = 100.0 * (1.0 - ((double)idle_diff / time_diff));
+            /* Clamp between 0-100% */
+            pcpu_stats[i].usage_pct = (usage < 0) ? 0.0 :
+                                     (usage > 100) ? 100.0 : usage;
+        } else {
+            pcpu_stats[i].usage_pct = 0.0;
+        }
+
+        prev_idle[i] = current_idle;
+    }
+
+    /* Update global time reference for next calculation */
+    prev_global_time = current_time;
+
+    return 0;
+
+alloc_error:
+    free_pcpu_stats();
+    errno = ENOMEM;
+    report_pcpu_error("memory allocation failed");
+    return -1;
+}
+
+/* Accessor functions for xentop.c */
+int get_pcpu_count(void)
+{
+    return allocated_pcpus;
+}
+
+float get_pcpu_usage(int cpu_index)
+{
+    if (!pcpu_stats || cpu_index < 0 || cpu_index >= allocated_pcpus) {
+        return 0.0;
+    }
+    return pcpu_stats[cpu_index].usage_pct;
+}
+
+int has_pcpu_data(void)
+{
+    return (pcpu_stats != NULL && allocated_pcpus > 0);
+}
+
+void free_pcpu_stats(void)
+{
+    if (xc_handle) {
+        xc_interface_close(xc_handle);
+        xc_handle = NULL;
+    }
+    free(pcpu_stats);
+    pcpu_stats = NULL;
+    free(prev_idle);
+    prev_idle = NULL;
+    allocated_pcpus = 0;
+}
diff --git a/tools/xentop/pcpu.h b/tools/xentop/pcpu.h
new file mode 100644
index 0000000000..a528177476
--- /dev/null
+++ b/tools/xentop/pcpu.h
@@ -0,0 +1,17 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright (C) 2025 Renesas Electronics Corporation
+ */
+
+#ifndef __XENTOP_PCPU_H__
+#define __XENTOP_PCPU_H__
+
+#include <sys/time.h>
+
+int update_pcpu_stats(const struct timeval *now, unsigned int delay);
+int get_pcpu_count(void);
+float get_pcpu_usage(int cpu_index);
+int has_pcpu_data(void);
+void free_pcpu_stats(void);
+
+#endif /* __XENTOP_PCPU_H__ */
diff --git a/tools/xentop/xentop.c b/tools/xentop/xentop.c
index f5d6c19cf9..addb1c70c9 100644
--- a/tools/xentop/xentop.c
+++ b/tools/xentop/xentop.c
@@ -37,6 +37,7 @@
 #endif
 
 #include <xenstat.h>
+#include "pcpu.h"
 
 #define XENTOP_VERSION "1.0"
 
@@ -205,6 +206,7 @@ field_id sort_field = FIELD_DOMID;
 unsigned int first_domain_index = 0;
 unsigned int delay = 3;
 unsigned int batch = 0;
+static unsigned int show_pcpus = 0;
 unsigned int loop = 1;
 unsigned int iterations = 0;
 int show_vcpus = 0;
@@ -230,22 +232,23 @@ static WINDOW *cwin;
 /* Print usage message, using given program name */
 static void usage(const char *program)
 {
-	printf("Usage: %s [OPTION]\n"
-	       "Displays ongoing information about xen vm resources \n\n"
-	       "-h, --help           display this help and exit\n"
-	       "-V, --version        output version information and exit\n"
-	       "-d, --delay=SECONDS  seconds between updates (default 3)\n"
-	       "-n, --networks       output vif network data\n"
-	       "-x, --vbds           output vbd block device data\n"
-	       "-r, --repeat-header  repeat table header before each domain\n"
-	       "-v, --vcpus          output vcpu data\n"
-	       "-b, --batch	     output in batch mode, no user input accepted\n"
-	       "-i, --iterations     number of iterations before exiting\n"
-	       "-f, --full-name      output the full domain name (not truncated)\n"
-	       "-z, --dom0-first     display dom0 first (ignore sorting)\n"
-	       "\n" XENTOP_BUGSTO,
-	       program);
-	return;
+    printf("Usage: %s [OPTION]\n"
+           "Displays ongoing information about xen vm resources \n\n"
+           "-h, --help           display this help and exit\n"
+           "-V, --version        output version information and exit\n"
+           "-d, --delay=SECONDS  seconds between updates (default 3)\n"
+           "-n, --networks       output vif network data\n"
+           "-x, --vbds           output vbd block device data\n"
+           "-r, --repeat-header  repeat table header before each domain\n"
+           "-v, --vcpus          output vcpu data\n"
+           "-b, --batch          output in batch mode, no user input accepted\n"
+           "-p, --pcpus          show physical CPU stats\n"
+           "-i, --iterations     number of iterations before exiting\n"
+           "-f, --full-name      output the full domain name (not truncated)\n"
+           "-z, --dom0-first     display dom0 first (ignore sorting)\n"
+           "\n" XENTOP_BUGSTO,
+           program);
+    return;
 }
 
 /* Print program version information */
@@ -267,6 +270,8 @@ static void cleanup(void)
 		xenstat_free_node(cur_node);
 	if(xhandle != NULL)
 		xenstat_uninit(xhandle);
+
+	free_pcpu_stats();
 }
 
 /* Display the given message and gracefully exit */
@@ -313,6 +318,32 @@ static void print(const char *fmt, ...)
 	}
 }
 
+/* PCPU statistics display function */
+static void print_pcpu_stats_display(void)
+{
+    int i;
+    int num_cpus;
+
+    if (!has_pcpu_data()) {
+        print("\nNo PCPU data available\n");
+        return;
+    }
+
+    num_cpus = get_pcpu_count();
+
+    /* Use the existing print() function which handles cursor bounds */
+    print("\nPhysical CPU Usage:\n");
+    print("+-------+--------+\n");
+    print("| Core  | Usage  |\n");
+    print("+-------+--------+\n");
+
+    for (i = 0; i < num_cpus; i++) {
+        print("| %-5d | %5.1f%% |\n", i, get_pcpu_usage(i));
+    }
+
+    print("+-------+--------+\n");
+}
+
 static void xentop_attron(int attr)
 {
 	if (!batch)
@@ -1245,6 +1276,14 @@ static void top(void)
 			do_vbd(domains[i]);
 	}
 
+    if (show_pcpus) {
+        if (update_pcpu_stats(&curtime, delay) == 0) {
+            print_pcpu_stats_display();
+        } else {
+            fail("Error getting PCPU stats\n");
+        }
+    }
+
 	if (!batch)
 		do_bottom_line();
 
@@ -1271,13 +1310,14 @@ int main(int argc, char **argv)
 		{ "repeat-header", no_argument,       NULL, 'r' },
 		{ "vcpus",         no_argument,       NULL, 'v' },
 		{ "delay",         required_argument, NULL, 'd' },
-		{ "batch",	   no_argument,	      NULL, 'b' },
+		{ "batch",         no_argument,	      NULL, 'b' },
+		{ "pcpus",         no_argument,       NULL, 'p' },
 		{ "iterations",	   required_argument, NULL, 'i' },
 		{ "full-name",     no_argument,       NULL, 'f' },
 		{ "dom0-first",    no_argument,       NULL, 'z' },
 		{ 0, 0, 0, 0 },
 	};
-	const char *sopts = "hVnxrvd:bi:fz";
+	const char *sopts = "hVnxrvd:bpi:fz";
 
 	if (atexit(cleanup) != 0)
 		fail("Failed to install cleanup handler.\n");
@@ -1312,6 +1352,9 @@ int main(int argc, char **argv)
 		case 'b':
 			batch = 1;
 			break;
+		case 'p':
+			show_pcpus = 1;
+			break;
 		case 'i':
 			iterations = atoi(optarg);
 			loop = 0;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Sep 04 14:11:06 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Sep 2025 14:11:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1110254.1459516 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uuAg1-0003Qv-Vl; Thu, 04 Sep 2025 14:11:01 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1110254.1459516; Thu, 04 Sep 2025 14:11: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 1uuAg1-0003Qn-T1; Thu, 04 Sep 2025 14:11:01 +0000
Received: by outflank-mailman (input) for mailman id 1110254;
 Thu, 04 Sep 2025 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 1uuAg1-0003Qh-Hj
 for xen-changelog@lists.xenproject.org; Thu, 04 Sep 2025 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 1uuAg1-006HrA-0z
 for xen-changelog@lists.xenproject.org;
 Thu, 04 Sep 2025 14:11:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uuAg1-00Fiid-1Y
 for xen-changelog@lists.xenproject.org;
 Thu, 04 Sep 2025 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=//VV85gV9iWxeXfVMs3daOyvtAodiL7OZQ9uupuPLVc=; b=MtEPbLiJT5LO7YYFMSNzzxDjXF
	0h9Gk9FrRZtOeoWvTqKYktaBZiWGNxQ+KpPxbVjlcF4uTYce7GRe43hdWAtspL4F2oC197AmttGOV
	uUM4zuEnAHLYSY08oB7jmKyeaA0T9kcZGZT1c2595R2/aLDPWbavo7kj/AcZhWetOO9U=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xl: move printf_info prototype to an header
Message-Id: <E1uuAg1-00Fiid-1Y@xenbits.xenproject.org>
Date: Thu, 04 Sep 2025 14:11:01 +0000

commit e5843b402043965abf180b1f4a0ab95692c6c25c
Author:     Anthony PERARD <anthony.perard@vates.tech>
AuthorDate: Fri Aug 8 16:55:52 2025 +0200
Commit:     Anthony PERARD <anthony.perard@vates.tech>
CommitDate: Thu Sep 4 14:26:26 2025 +0200

    xl: move printf_info prototype to an header
    
    In a single place.
    
    Signed-off-by: Anthony PERARD <anthony.perard@vates.tech>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
---
 tools/xl/xl.h      | 3 +++
 tools/xl/xl_info.c | 3 ---
 tools/xl/xl_misc.c | 3 ---
 3 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/tools/xl/xl.h b/tools/xl/xl.h
index 45745f0dbb..9000df00de 100644
--- a/tools/xl/xl.h
+++ b/tools/xl/xl.h
@@ -310,6 +310,9 @@ extern void printf_info_sexp(int domid, libxl_domain_config *d_config, FILE *fh)
 extern void apply_global_affinity_masks(libxl_domain_type type,
                                         libxl_bitmap *vcpu_affinity_array,
                                         unsigned int size);
+void printf_info(enum output_format output_format,
+                 int domid,
+                 libxl_domain_config *d_config, FILE *fh);
 
 #define XL_GLOBAL_CONFIG XEN_CONFIG_DIR "/xl.conf"
 #define XL_LOCK_FILE XEN_LOCK_DIR "/xl"
diff --git a/tools/xl/xl_info.c b/tools/xl/xl_info.c
index d3583cbf8f..83a02f45fe 100644
--- a/tools/xl/xl_info.c
+++ b/tools/xl/xl_info.c
@@ -96,9 +96,6 @@ out:
     return s;
 }
 
-void printf_info(enum output_format output_format,
-                 int domid,
-                 libxl_domain_config *d_config, FILE *fh);
 void printf_info(enum output_format output_format,
                  int domid,
                  libxl_domain_config *d_config, FILE *fh)
diff --git a/tools/xl/xl_misc.c b/tools/xl/xl_misc.c
index 08f0fb6dc9..f0167e1603 100644
--- a/tools/xl/xl_misc.c
+++ b/tools/xl/xl_misc.c
@@ -256,9 +256,6 @@ int main_dump_core(int argc, char **argv)
     return EXIT_SUCCESS;
 }
 
-extern void printf_info(enum output_format output_format,
-                        int domid,
-                        libxl_domain_config *d_config, FILE *fh);
 int main_config_update(int argc, char **argv)
 {
     uint32_t domid;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Sep 04 14:11:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Sep 2025 14:11:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1110255.1459521 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uuAgD-0003Si-16; Thu, 04 Sep 2025 14:11:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1110255.1459521; Thu, 04 Sep 2025 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 1uuAgC-0003Sa-UY; Thu, 04 Sep 2025 14:11:12 +0000
Received: by outflank-mailman (input) for mailman id 1110255;
 Thu, 04 Sep 2025 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 1uuAgB-0003SM-MS
 for xen-changelog@lists.xenproject.org; Thu, 04 Sep 2025 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 1uuAgB-006HrG-1T
 for xen-changelog@lists.xenproject.org;
 Thu, 04 Sep 2025 14:11:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uuAgB-00FikM-1r
 for xen-changelog@lists.xenproject.org;
 Thu, 04 Sep 2025 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=j0I8LOVYQqimPM6qmyvvGzQHEHysbmXB8YE3+CuHOs4=; b=2H5TIvYiJ162yQboOD+0oGtCF+
	x1bphUh3XY+ap5AixJFtireEkreozUJxfdKrYQE0e4yu/dNNxvn/k9bbe2vPJMWK0XeRtSXBCTSBp
	tQ/K9Y4sZNWf89M+GlmsiR8dq9SoV25w6nPED9ekXX57qg4gf3Hr3un6y3nRrPh/zfR8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] libxl: Remove duplicate libxl_domain_config_gen_json prototype
Message-Id: <E1uuAgB-00FikM-1r@xenbits.xenproject.org>
Date: Thu, 04 Sep 2025 14:11:11 +0000

commit f5aadd575bb5b858295dd936eba7d720f5c1b949
Author:     Anthony PERARD <anthony.perard@vates.tech>
AuthorDate: Fri Aug 8 16:55:53 2025 +0200
Commit:     Anthony PERARD <anthony.perard@vates.tech>
CommitDate: Thu Sep 4 14:26:38 2025 +0200

    libxl: Remove duplicate libxl_domain_config_gen_json prototype
    
    Since f9e681d3d1b8, the prototype of libxl_domain_config_gen_json is
    generated from IDL in _libxl_types_json.h.
    
    Fixes: f9e681d3d1b8 ("libxl: move definition of libxl_domain_config into the IDL")
    Signed-off-by: Anthony PERARD <anthony.perard@vates.tech>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
---
 tools/include/libxl_json.h | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/tools/include/libxl_json.h b/tools/include/libxl_json.h
index 260783bfde..3f97267eae 100644
--- a/tools/include/libxl_json.h
+++ b/tools/include/libxl_json.h
@@ -90,7 +90,4 @@ static inline yajl_gen libxl_yajl_gen_alloc(const yajl_alloc_funcs *allocFuncs)
 
 #endif /* !HAVE_YAJL_V2 */
 
-yajl_gen_status libxl_domain_config_gen_json(yajl_gen hand,
-                                             libxl_domain_config *p);
-
 #endif /* LIBXL_JSON_H */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Sep 04 14:11:23 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Sep 2025 14:11:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1110257.1459535 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uuAgN-0003m9-HS; Thu, 04 Sep 2025 14:11:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1110257.1459535; Thu, 04 Sep 2025 14: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 1uuAgN-0003m1-Eh; Thu, 04 Sep 2025 14:11:23 +0000
Received: by outflank-mailman (input) for mailman id 1110257;
 Thu, 04 Sep 2025 14: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 1uuAgL-0003lD-PR
 for xen-changelog@lists.xenproject.org; Thu, 04 Sep 2025 14: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 1uuAgL-006HrT-1m
 for xen-changelog@lists.xenproject.org;
 Thu, 04 Sep 2025 14:11:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uuAgL-00FinS-2L
 for xen-changelog@lists.xenproject.org;
 Thu, 04 Sep 2025 14: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=KtXjvl1QV5wNEEz0sj4jMuTCVo+mvm2gJ8L1qOCtXKM=; b=3J3t3qvAIWDNJ+7WZDrj/tI/Ag
	RSXzte7F9UUJ/vjqKbFMuJmnWkvBojnyc1zAhprBgYodumkk7w5mmp2Yz/sDzvk0S3Kpn4nZNvqoc
	eQ7SgLOsOtHtFbQwgc9QXGT3oC92NAJRWzFcYgc5pE4ChYFfrMqIpclYri5IlURMtlqA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] libxl: remove duplicated libxl__yajl_gen_asciiz() prototype
Message-Id: <E1uuAgL-00FinS-2L@xenbits.xenproject.org>
Date: Thu, 04 Sep 2025 14:11:21 +0000

commit ccb11468b69f7289695ae1594f036e5af2238e61
Author:     Anthony PERARD <anthony.perard@vates.tech>
AuthorDate: Fri Aug 8 16:55:54 2025 +0200
Commit:     Anthony PERARD <anthony.perard@vates.tech>
CommitDate: Thu Sep 4 14:26:44 2025 +0200

    libxl: remove duplicated libxl__yajl_gen_asciiz() prototype
    
    Signed-off-by: Anthony PERARD <anthony.perard@vates.tech>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
---
 tools/libs/light/libxl_internal.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/tools/libs/light/libxl_internal.h b/tools/libs/light/libxl_internal.h
index 2a5b233caa..4b6587a27a 100644
--- a/tools/libs/light/libxl_internal.h
+++ b/tools/libs/light/libxl_internal.h
@@ -1993,8 +1993,6 @@ _hidden char *libxl__cpupoolid_to_name(libxl__gc *gc, uint32_t poolid);
 _hidden int libxl__enum_from_string(const libxl_enum_string_table *t,
                                     const char *s, int *e) NN(2);
 
-_hidden yajl_gen_status libxl__yajl_gen_asciiz(yajl_gen hand, const char *str);
-
 _hidden yajl_gen_status libxl__string_gen_json(yajl_gen hand, const char *p);
 
 typedef yajl_gen_status (*libxl__gen_json_callback)(yajl_gen hand, void *);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Sep 04 14:11:33 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Sep 2025 14:11:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1110259.1459538 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uuAgX-0003tm-Ih; Thu, 04 Sep 2025 14:11:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1110259.1459538; Thu, 04 Sep 2025 14: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 1uuAgX-0003tf-G4; Thu, 04 Sep 2025 14:11:33 +0000
Received: by outflank-mailman (input) for mailman id 1110259;
 Thu, 04 Sep 2025 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 1uuAgW-0003sx-6s
 for xen-changelog@lists.xenproject.org; Thu, 04 Sep 2025 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 1uuAgV-006Hrs-2E
 for xen-changelog@lists.xenproject.org;
 Thu, 04 Sep 2025 14:11:31 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uuAgV-00Finv-2d
 for xen-changelog@lists.xenproject.org;
 Thu, 04 Sep 2025 14: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=A8SHa3GQYge3ObC9NmfV3Xg0E+/zq8c8JIGKW0keCb8=; b=tn7WpPQGwJMakyxgvngl+8mOSZ
	pa0uKDW83bb/hWu3qRmIB02cvbt884BkgmZ7fqKP6sOk3xcVr8zMhJB5AwKEjbmSrWxn2i/054Dgb
	3x6HWFAYPm+d0lBpbcD/2t3cCsYeAb2yPR9eJHNtXxn1ledI0LPcrlucfp6aVMykCqUo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/xentop: Add physical CPU statistics support
Message-Id: <E1uuAgV-00Finv-2d@xenbits.xenproject.org>
Date: Thu, 04 Sep 2025 14:11:31 +0000

commit 45bb8868ef21459b266919fbbda98f2256295a0f
Author:     Jahan Murudi <jahan.murudi.zg@renesas.com>
AuthorDate: Mon Aug 4 18:36:43 2025 +0530
Commit:     Anthony PERARD <anthony.perard@vates.tech>
CommitDate: Thu Sep 4 14:30:53 2025 +0200

    tools/xentop: Add physical CPU statistics support
    
    Introduce a new '-p/--pcpus' flag to display physical CPU utilization metrics
    using xc_interface. This provides hypervisor-level CPU usage insights alongside
    existing domain statistics. This helps correlate VM resource usage with host CPU
    load patterns.
    
    Changes:
    - Add pcpu.c/pcpu.h for PCPU stat collection logic
    - Link against libxenctrl for xc_handle access
    - Extend CLI with '-p' flag and output formatting
    - Forward declare xenstat_handle to access xc_handle
    - Include cleanup for PCPU resources in exit handler
    
    Example usage:
      xentop -p  # Shows physical CPU stats
      xentop -bp # Batch mode
      xentop -d 1 -p # With different delays
    
    Example output with '-p':
      NAME      STATE   CPU(%)  MEM(%)  VCPUS ...
      Domain-0  -----r    17.0     6.3      8
      DomD      -----r   767.0    38.1      8
    
      Physical CPU Usage:
      ┌───────┬────────┐
      │ Core  │ Usage  │
      ├───────┼────────┤
      │ 0     │  98.1% │
      │ ...   │  ...   │
      │ 7     │  97.3% │
      └───────┴────────┘
    
    Signed-off-by: Jahan Murudi <jahan.murudi.zg@renesas.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
---
 tools/xentop/Makefile |   5 +-
 tools/xentop/pcpu.c   | 141 ++++++++++++++++++++++++++++++++++++++++++++++++++
 tools/xentop/pcpu.h   |  17 ++++++
 tools/xentop/xentop.c |  79 +++++++++++++++++++++-------
 4 files changed, 222 insertions(+), 20 deletions(-)

diff --git a/tools/xentop/Makefile b/tools/xentop/Makefile
index 70cc2211c5..f514a6f7a8 100644
--- a/tools/xentop/Makefile
+++ b/tools/xentop/Makefile
@@ -15,6 +15,7 @@ include $(XEN_ROOT)/tools/Rules.mk
 
 CFLAGS += -DGCC_PRINTF $(CFLAGS_libxenstat)
 LDLIBS += $(LDLIBS_libxenstat) $(CURSES_LIBS) $(TINFO_LIBS) $(SOCKET_LIBS) -lm
+LDLIBS += $(LDLIBS_libxenctrl)
 CFLAGS += -DHOST_$(XEN_OS)
 
 # Include configure output (config.h)
@@ -25,8 +26,8 @@ TARGETS := xentop
 .PHONY: all
 all: $(TARGETS)
 
-xentop: xentop.o
-	$(CC) $(LDFLAGS) -o $@ $< $(LDLIBS) $(APPEND_LDFLAGS)
+xentop: xentop.o pcpu.o
+	$(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS) $(APPEND_LDFLAGS)
 
 .PHONY: install
 install: all
diff --git a/tools/xentop/pcpu.c b/tools/xentop/pcpu.c
new file mode 100644
index 0000000000..cdb4cb2131
--- /dev/null
+++ b/tools/xentop/pcpu.c
@@ -0,0 +1,141 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright (C) 2025 Renesas Electronics Corporation
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include <sys/time.h>
+#include <xenctrl.h>
+#include "pcpu.h"
+
+#define MAX_PCPUS 128
+
+typedef struct {
+    float usage_pct;
+} pcpu_stat_t;
+
+static pcpu_stat_t *pcpu_stats = NULL;
+static uint64_t *prev_idle = NULL;
+static int allocated_pcpus = 0;
+static xc_interface *xc_handle = NULL;
+static uint64_t prev_global_time = 0;
+
+static void report_pcpu_error(const char *context)
+{
+    fprintf(stderr, "PCPU error: %s (%s)\n", context, strerror(errno));
+}
+
+int update_pcpu_stats(const struct timeval *now, unsigned int delay_sec)
+{
+    struct xen_sysctl_cpuinfo info[MAX_PCPUS];
+    int detected_cpus = 0;
+    int ret, i;
+    uint64_t current_time = (uint64_t)now->tv_sec * 1000000ULL + now->tv_usec;
+    uint64_t time_diff;
+
+    if (!xc_handle) {
+        xc_handle = xc_interface_open(NULL, NULL, 0);
+        if (!xc_handle) {
+            report_pcpu_error("xc_interface_open failed");
+            return -1;
+        }
+    }
+
+    ret = xc_getcpuinfo(xc_handle, MAX_PCPUS, info, &detected_cpus);
+    if (ret < 0) {
+        report_pcpu_error("xc_getcpuinfo failed");
+        return -1;
+    }
+
+    /* Allocate/reallocate memory if needed */
+    if (!pcpu_stats || detected_cpus > allocated_pcpus) {
+        pcpu_stat_t *new_stats = realloc(pcpu_stats,
+                        detected_cpus * sizeof(*pcpu_stats));
+        if (!new_stats) goto alloc_error;
+
+        pcpu_stats = new_stats;
+
+        uint64_t *new_prev_idle = realloc(prev_idle,
+                        detected_cpus * sizeof(*prev_idle));
+        if (!new_prev_idle) goto alloc_error;
+
+        prev_idle = new_prev_idle;
+        allocated_pcpus = detected_cpus;
+
+        /* Initialize new entries */
+        for (i = 0; i < detected_cpus; i++) {
+            prev_idle[i] = info[i].idletime / 1000; /* ns->us */
+            pcpu_stats[i].usage_pct = 0.0;
+        }
+
+        /* Set initial global time reference */
+        prev_global_time = current_time;
+        return 0;
+    }
+
+    /* Calculate time difference since last update */
+    time_diff = current_time - prev_global_time;
+
+    /* Calculate CPU usage for each core */
+    for (i = 0; i < detected_cpus; i++) {
+        uint64_t current_idle = info[i].idletime / 1000;
+        uint64_t idle_diff = current_idle - prev_idle[i];
+
+        if (time_diff > 0) {
+            double usage = 100.0 * (1.0 - ((double)idle_diff / time_diff));
+            /* Clamp between 0-100% */
+            pcpu_stats[i].usage_pct = (usage < 0) ? 0.0 :
+                                     (usage > 100) ? 100.0 : usage;
+        } else {
+            pcpu_stats[i].usage_pct = 0.0;
+        }
+
+        prev_idle[i] = current_idle;
+    }
+
+    /* Update global time reference for next calculation */
+    prev_global_time = current_time;
+
+    return 0;
+
+alloc_error:
+    free_pcpu_stats();
+    errno = ENOMEM;
+    report_pcpu_error("memory allocation failed");
+    return -1;
+}
+
+/* Accessor functions for xentop.c */
+int get_pcpu_count(void)
+{
+    return allocated_pcpus;
+}
+
+float get_pcpu_usage(int cpu_index)
+{
+    if (!pcpu_stats || cpu_index < 0 || cpu_index >= allocated_pcpus) {
+        return 0.0;
+    }
+    return pcpu_stats[cpu_index].usage_pct;
+}
+
+int has_pcpu_data(void)
+{
+    return (pcpu_stats != NULL && allocated_pcpus > 0);
+}
+
+void free_pcpu_stats(void)
+{
+    if (xc_handle) {
+        xc_interface_close(xc_handle);
+        xc_handle = NULL;
+    }
+    free(pcpu_stats);
+    pcpu_stats = NULL;
+    free(prev_idle);
+    prev_idle = NULL;
+    allocated_pcpus = 0;
+}
diff --git a/tools/xentop/pcpu.h b/tools/xentop/pcpu.h
new file mode 100644
index 0000000000..a528177476
--- /dev/null
+++ b/tools/xentop/pcpu.h
@@ -0,0 +1,17 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright (C) 2025 Renesas Electronics Corporation
+ */
+
+#ifndef __XENTOP_PCPU_H__
+#define __XENTOP_PCPU_H__
+
+#include <sys/time.h>
+
+int update_pcpu_stats(const struct timeval *now, unsigned int delay);
+int get_pcpu_count(void);
+float get_pcpu_usage(int cpu_index);
+int has_pcpu_data(void);
+void free_pcpu_stats(void);
+
+#endif /* __XENTOP_PCPU_H__ */
diff --git a/tools/xentop/xentop.c b/tools/xentop/xentop.c
index f5d6c19cf9..addb1c70c9 100644
--- a/tools/xentop/xentop.c
+++ b/tools/xentop/xentop.c
@@ -37,6 +37,7 @@
 #endif
 
 #include <xenstat.h>
+#include "pcpu.h"
 
 #define XENTOP_VERSION "1.0"
 
@@ -205,6 +206,7 @@ field_id sort_field = FIELD_DOMID;
 unsigned int first_domain_index = 0;
 unsigned int delay = 3;
 unsigned int batch = 0;
+static unsigned int show_pcpus = 0;
 unsigned int loop = 1;
 unsigned int iterations = 0;
 int show_vcpus = 0;
@@ -230,22 +232,23 @@ static WINDOW *cwin;
 /* Print usage message, using given program name */
 static void usage(const char *program)
 {
-	printf("Usage: %s [OPTION]\n"
-	       "Displays ongoing information about xen vm resources \n\n"
-	       "-h, --help           display this help and exit\n"
-	       "-V, --version        output version information and exit\n"
-	       "-d, --delay=SECONDS  seconds between updates (default 3)\n"
-	       "-n, --networks       output vif network data\n"
-	       "-x, --vbds           output vbd block device data\n"
-	       "-r, --repeat-header  repeat table header before each domain\n"
-	       "-v, --vcpus          output vcpu data\n"
-	       "-b, --batch	     output in batch mode, no user input accepted\n"
-	       "-i, --iterations     number of iterations before exiting\n"
-	       "-f, --full-name      output the full domain name (not truncated)\n"
-	       "-z, --dom0-first     display dom0 first (ignore sorting)\n"
-	       "\n" XENTOP_BUGSTO,
-	       program);
-	return;
+    printf("Usage: %s [OPTION]\n"
+           "Displays ongoing information about xen vm resources \n\n"
+           "-h, --help           display this help and exit\n"
+           "-V, --version        output version information and exit\n"
+           "-d, --delay=SECONDS  seconds between updates (default 3)\n"
+           "-n, --networks       output vif network data\n"
+           "-x, --vbds           output vbd block device data\n"
+           "-r, --repeat-header  repeat table header before each domain\n"
+           "-v, --vcpus          output vcpu data\n"
+           "-b, --batch          output in batch mode, no user input accepted\n"
+           "-p, --pcpus          show physical CPU stats\n"
+           "-i, --iterations     number of iterations before exiting\n"
+           "-f, --full-name      output the full domain name (not truncated)\n"
+           "-z, --dom0-first     display dom0 first (ignore sorting)\n"
+           "\n" XENTOP_BUGSTO,
+           program);
+    return;
 }
 
 /* Print program version information */
@@ -267,6 +270,8 @@ static void cleanup(void)
 		xenstat_free_node(cur_node);
 	if(xhandle != NULL)
 		xenstat_uninit(xhandle);
+
+	free_pcpu_stats();
 }
 
 /* Display the given message and gracefully exit */
@@ -313,6 +318,32 @@ static void print(const char *fmt, ...)
 	}
 }
 
+/* PCPU statistics display function */
+static void print_pcpu_stats_display(void)
+{
+    int i;
+    int num_cpus;
+
+    if (!has_pcpu_data()) {
+        print("\nNo PCPU data available\n");
+        return;
+    }
+
+    num_cpus = get_pcpu_count();
+
+    /* Use the existing print() function which handles cursor bounds */
+    print("\nPhysical CPU Usage:\n");
+    print("+-------+--------+\n");
+    print("| Core  | Usage  |\n");
+    print("+-------+--------+\n");
+
+    for (i = 0; i < num_cpus; i++) {
+        print("| %-5d | %5.1f%% |\n", i, get_pcpu_usage(i));
+    }
+
+    print("+-------+--------+\n");
+}
+
 static void xentop_attron(int attr)
 {
 	if (!batch)
@@ -1245,6 +1276,14 @@ static void top(void)
 			do_vbd(domains[i]);
 	}
 
+    if (show_pcpus) {
+        if (update_pcpu_stats(&curtime, delay) == 0) {
+            print_pcpu_stats_display();
+        } else {
+            fail("Error getting PCPU stats\n");
+        }
+    }
+
 	if (!batch)
 		do_bottom_line();
 
@@ -1271,13 +1310,14 @@ int main(int argc, char **argv)
 		{ "repeat-header", no_argument,       NULL, 'r' },
 		{ "vcpus",         no_argument,       NULL, 'v' },
 		{ "delay",         required_argument, NULL, 'd' },
-		{ "batch",	   no_argument,	      NULL, 'b' },
+		{ "batch",         no_argument,	      NULL, 'b' },
+		{ "pcpus",         no_argument,       NULL, 'p' },
 		{ "iterations",	   required_argument, NULL, 'i' },
 		{ "full-name",     no_argument,       NULL, 'f' },
 		{ "dom0-first",    no_argument,       NULL, 'z' },
 		{ 0, 0, 0, 0 },
 	};
-	const char *sopts = "hVnxrvd:bi:fz";
+	const char *sopts = "hVnxrvd:bpi:fz";
 
 	if (atexit(cleanup) != 0)
 		fail("Failed to install cleanup handler.\n");
@@ -1312,6 +1352,9 @@ int main(int argc, char **argv)
 		case 'b':
 			batch = 1;
 			break;
+		case 'p':
+			show_pcpus = 1;
+			break;
 		case 'i':
 			iterations = atoi(optarg);
 			loop = 0;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Sep 04 15:00:05 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Sep 2025 15:00:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1110413.1459633 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uuBRT-0006S6-EY; Thu, 04 Sep 2025 15:00:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1110413.1459633; Thu, 04 Sep 2025 15: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 1uuBRT-0006Rk-Bo; Thu, 04 Sep 2025 15:00:03 +0000
Received: by outflank-mailman (input) for mailman id 1110413;
 Thu, 04 Sep 2025 15: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 1uuBRR-00066M-RX
 for xen-changelog@lists.xenproject.org; Thu, 04 Sep 2025 15: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 1uuBRR-006Iv5-16
 for xen-changelog@lists.xenproject.org;
 Thu, 04 Sep 2025 15:00:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uuBRR-00FlTD-1U
 for xen-changelog@lists.xenproject.org;
 Thu, 04 Sep 2025 15: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=9d9+nT3a7cHf3StRFkWfYy45Ow1DF1WIXSC8vXNlI0o=; b=zzYXZidKH+zGccY2pl12cgDexe
	wB/425KtO5ousFW8KI2bkQ0Kn8XFhXIdT6KnZcCbSMnP6d3W64pqIV4azxACgCP8gngBRVjq5RMAM
	t93hUQKVF4ei5bNRS1avCNsx3n1FpsNTAyAbkigFBomGKV3luNesgFW0OzOuW+cjG5YI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] docs/sending-patches: document "Amends:" tag
Message-Id: <E1uuBRR-00FlTD-1U@xenbits.xenproject.org>
Date: Thu, 04 Sep 2025 15:00:01 +0000

commit c08845e230f160d8b25347a4df68c2195dd03e4b
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Sep 4 16:54:47 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Sep 4 16:54:47 2025 +0200

    docs/sending-patches: document "Amends:" tag
    
    On rare occasions Fixes: isn't quite appropriate to use, yet another
    commit still wants making a connection to in a formalized way. Such could
    e.g. happen if a pretty obvious optimization was left out (which isn't a
    bug, but still a shortcoming). Formalize Amends: as a tage to use in such
    a situation.
    
    Requested-by: Roger Pau Monné <roger.pau@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Michal Orzel <michal.orzel@amd.com>
---
 docs/process/sending-patches.pandoc | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/docs/process/sending-patches.pandoc b/docs/process/sending-patches.pandoc
index 1991932b68..798ecceb39 100644
--- a/docs/process/sending-patches.pandoc
+++ b/docs/process/sending-patches.pandoc
@@ -42,7 +42,7 @@ should be mentioned.
 
 When referencing other patches (e.g. `similar to patch xy ...`) those
 patches should be referenced via their commit id (at least 12 digits)
-and the patch subject, if the very same patch isn't referenced by the
+and the patch subject, if the very same patch isn't referenced by e.g. a
 `Fixes:` tag, too:
 
     Similar to commit 67d01cdb5518 ("x86: infrastructure to allow converting
@@ -106,6 +106,12 @@ If git was configured as explained earlier, this can be retrieved using
 ``git log --pretty=fixes`` otherwise ``git log --abbrev=12 --oneline`` will
 give the proper tag and commit-id.
 
+### Amends:
+
+If your patch doesn't quite fix a bug, but still amends a specific commit,
+e.g. because an omission was found, please consider using an `Amends:` tag.
+See the `Fixes:` tag description above for how to use it.
+
 ### Resolves:
 
 If your patch addresses an issue logged in a GitLab ticket, use the `Resolves:`
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Sep 04 16:33:07 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Sep 2025 16:33:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1110504.1459677 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uuCtS-0003SR-Mi; Thu, 04 Sep 2025 16:33:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1110504.1459677; Thu, 04 Sep 2025 16: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 1uuCtS-0003SJ-K7; Thu, 04 Sep 2025 16:33:02 +0000
Received: by outflank-mailman (input) for mailman id 1110504;
 Thu, 04 Sep 2025 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 1uuCtS-0003SD-0t
 for xen-changelog@lists.xenproject.org; Thu, 04 Sep 2025 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 1uuCtR-006LD0-2G
 for xen-changelog@lists.xenproject.org;
 Thu, 04 Sep 2025 16:33:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uuCtR-00Fpgm-2o
 for xen-changelog@lists.xenproject.org;
 Thu, 04 Sep 2025 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=3liobhlVKsvYVYvrrfqeyQ+xS+83qberm+vD5a2nl5s=; b=HGEIUD0NrSdtivsD2x48hCxsWA
	BZRGvpjypay6qiQ2LkVawRTIOIKLafab3II/QvJFs7VoQhyCZN4y/EZ0o+hvubCcmMcMMiWoEibwo
	+ItBsa7YDrfHu9/FtqbOxT5rZ3zUMYVqzzk8kWan3kQtMtRUTv66xSgLLas+Ce7FU9P8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] x86/suspend: unconditionally raise a timer softirq on resume
Message-Id: <E1uuCtR-00Fpgm-2o@xenbits.xenproject.org>
Date: Thu, 04 Sep 2025 16:33:01 +0000

commit 51190865a4918c443c310c0478247d5f9caa5dad
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Sep 3 14:09:11 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 3 14:09:11 2025 +0200

    x86/suspend: unconditionally raise a timer softirq on resume
    
    The current code to restore the timer state on resume is incomplete.  While
    the local APIC Initial Count Register is saved and restored across
    suspension (even if possibly no longer accurate since it's not adjusted to
    account for the time spent in suspension), the TSC deadline MSR is not
    saved and restored, hence hosts using the TSC deadline timer will likely
    get stuck when resuming from suspension.
    
    The lack of restoring of the TSC deadline MSR was mitigated by the raising
    of a timer softirq in mwait_idle_with_hints() if the timer had expired,
    previous to commit 3faf0866a33070b926ab78e6298290403f85e76c, which removed
    that logic.
    
    This patch fixes the usage of the TSC deadline timer with suspension, by
    unconditionally raising a timer softirq on resume, that will take care of
    rearming the hardware timer.  Given that a timer softirq will be
    unconditionally risen, there's no need to save and restore the APIC Initial
    Count Register anymore either.
    
    Note that secondary processors don't need this special treatment when
    resuming, since they are offlined before suspension and brought back up
    during resume, the first timer that gets setup will trigger a timer softirq
    unconditionally, for example from sched_migrate_timers() that gets called
    for each secondary processor.
    
    Link: https://github.com/QubesOS/qubes-issues/issues/10110
    Reported-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Fixes: fd1291a826e1 ('X86: Prefer TSC-deadline timer in Xen')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Tested-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    master commit: 757abedabbb64f18a28ae61a7bd67a927bb03130
    master date: 2025-08-27 09:33:12 +0200
---
 xen/arch/x86/acpi/power.c | 2 ++
 xen/arch/x86/apic.c       | 3 ---
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/acpi/power.c b/xen/arch/x86/acpi/power.c
index 783b4a2f2c..5fc7fef24f 100644
--- a/xen/arch/x86/acpi/power.c
+++ b/xen/arch/x86/acpi/power.c
@@ -22,6 +22,7 @@
 #include <xen/domain.h>
 #include <xen/console.h>
 #include <xen/iommu.h>
+#include <xen/softirq.h>
 #include <xen/watchdog.h>
 #include <xen/cpu.h>
 #include <public/platform.h>
@@ -330,6 +331,7 @@ static int enter_state(u32 state)
     thaw_domains();
     system_state = SYS_STATE_active;
     spin_unlock(&pm_lock);
+    raise_softirq(TIMER_SOFTIRQ);
     return error;
 }
 
diff --git a/xen/arch/x86/apic.c b/xen/arch/x86/apic.c
index 6acdd0ec14..ab1bb29ab0 100644
--- a/xen/arch/x86/apic.c
+++ b/xen/arch/x86/apic.c
@@ -63,7 +63,6 @@ static struct {
     unsigned int apic_lvt0;
     unsigned int apic_lvt1;
     unsigned int apic_lvterr;
-    unsigned int apic_tmict;
     unsigned int apic_tdcr;
     unsigned int apic_thmr;
 } apic_pm_state;
@@ -660,7 +659,6 @@ int lapic_suspend(void)
     apic_pm_state.apic_lvt0 = apic_read(APIC_LVT0);
     apic_pm_state.apic_lvt1 = apic_read(APIC_LVT1);
     apic_pm_state.apic_lvterr = apic_read(APIC_LVTERR);
-    apic_pm_state.apic_tmict = apic_read(APIC_TMICT);
     apic_pm_state.apic_tdcr = apic_read(APIC_TDCR);
     if (maxlvt >= 5)
         apic_pm_state.apic_thmr = apic_read(APIC_LVTTHMR);
@@ -720,7 +718,6 @@ int lapic_resume(void)
         apic_write(APIC_LVTPC, apic_pm_state.apic_lvtpc);
     apic_write(APIC_LVTT, apic_pm_state.apic_lvtt);
     apic_write(APIC_TDCR, apic_pm_state.apic_tdcr);
-    apic_write(APIC_TMICT, apic_pm_state.apic_tmict);
     apic_write(APIC_ESR, 0);
     apic_read(APIC_ESR);
     apic_write(APIC_LVTERR, apic_pm_state.apic_lvterr);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Sep 04 20:44:07 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Sep 2025 20:44:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1110921.1459912 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uuGoO-0003WS-4s; Thu, 04 Sep 2025 20:44:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1110921.1459912; Thu, 04 Sep 2025 20: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 1uuGoO-0003WK-1X; Thu, 04 Sep 2025 20:44:04 +0000
Received: by outflank-mailman (input) for mailman id 1110921;
 Thu, 04 Sep 2025 20: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 1uuGoM-0003WE-Fz
 for xen-changelog@lists.xenproject.org; Thu, 04 Sep 2025 20: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 1uuGoM-006QU5-0E
 for xen-changelog@lists.xenproject.org;
 Thu, 04 Sep 2025 20:44:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uuGoM-00G80k-0n
 for xen-changelog@lists.xenproject.org;
 Thu, 04 Sep 2025 20: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=cyXr864cznGUhIJHX735gr68AKfgSsJ9c82k1hHTuQ4=; b=W4saAp7kMb9qI/2zybh+MmYpMl
	ykL/5Ns/JvEwng2kG/WGkVCfN0PQ+XyFCc5emzVFSL4IQU7+jiiU8RLWlnzMkSW8mdE+IWaCkBZQh
	yNr5mNxeG88ugWKJLTQ+/2F8zbbzbxQs8YXGwqI40lXJ4oT2gayvWW4xQ388GMdzhj18=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: add generic SCI subsystem
Message-Id: <E1uuGoM-00G80k-0n@xenbits.xenproject.org>
Date: Thu, 04 Sep 2025 20:44:02 +0000

commit e2cc10867b633b10b4ac65ddebca37421eec6882
Author:     Oleksii Moisieiev <Oleksii_Moisieiev@epam.com>
AuthorDate: Thu Sep 4 14:21:27 2025 +0000
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Thu Sep 4 12:11:43 2025 -0700

    xen/arm: add generic SCI subsystem
    
    This patch adds the basic framework for ARM SCI mediator. SCI is System
    Control Interface, which is designed to redirect requests from the Domains
    to ARM specific Firmware (for example SCMI). This will allow the devices,
    passed-through to the different Domains, to access to the System resources
    (such as clocks/resets etc) by sending requests to the firmware.
    
    ARM SCI subsystem allows to implement different SCI drivers to handle
    specific ARM firmware interfaces (like ARM SCMI) and mediate requests
    -between the Domains and the Firmware. Also it allows SCI drivers to perform
    proper action during Domain creation/destruction which is vital for
    handling use cases like Domain reboot.
    
    This patch introduces new DEVICE_FIRMWARE device subclass for probing SCI
    drivers basing on device tree, SCI drivers register itself with
    DT_DEVICE_START/END macro. On init - the SCI drivers should register its
    SCI ops with sci_register(). Only one SCI driver can be supported.
    
    At run-time, the following SCI API calls are introduced:
    
    - sci_domain_sanitise_config() called from arch_sanitise_domain_config()
    - sci_domain_init() called from arch_domain_create()
    - sci_relinquish_resources() called from domain_relinquish_resources()
    - sci_domain_destroy() called from arch_domain_destroy()
    - sci_handle_call() called from vsmccc_handle_call()
    - sci_dt_handle_node()
    - sci_dt_finalize() called from handle_node() (Dom0 DT)
    
    Signed-off-by: Oleksii Moisieiev <oleksii_moisieiev@epam.com>
    Signed-off-by: Grygorii Strashko <grygorii_strashko@epam.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 MAINTAINERS                             |   6 +
 xen/arch/arm/device.c                   |   5 +
 xen/arch/arm/dom0less-build.c           |   8 ++
 xen/arch/arm/domain.c                   |  12 +-
 xen/arch/arm/domain_build.c             |   8 ++
 xen/arch/arm/firmware/Kconfig           |   8 ++
 xen/arch/arm/firmware/Makefile          |   1 +
 xen/arch/arm/firmware/sci.c             | 154 ++++++++++++++++++++++++
 xen/arch/arm/include/asm/domain.h       |   5 +
 xen/arch/arm/include/asm/firmware/sci.h | 200 ++++++++++++++++++++++++++++++++
 xen/arch/arm/vsmc.c                     |   3 +-
 xen/common/device-tree/dom0less-build.c |   4 +
 xen/include/asm-generic/device.h        |   1 +
 xen/include/public/arch-arm.h           |   4 +
 xen/include/xen/dom0less-build.h        |   3 +
 15 files changed, 420 insertions(+), 2 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index c4886c1159..31dbba54bb 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -509,6 +509,12 @@ R:	George Dunlap <gwd@xenproject.org>
 S:	Supported
 F:	xen/common/sched/
 
+SCI MEDIATORS
+R:	Oleksii Moisieiev <oleksii_moisieiev@epam.com>
+S:	Supported
+F:	xen/arch/arm/firmware/sci.c
+F:	xen/arch/arm/include/asm/firmware/sci.h
+
 SEABIOS UPSTREAM
 M:	Wei Liu <wl@xen.org>
 S:	Supported
diff --git a/xen/arch/arm/device.c b/xen/arch/arm/device.c
index 11523750ae..74b54cad34 100644
--- a/xen/arch/arm/device.c
+++ b/xen/arch/arm/device.c
@@ -13,6 +13,7 @@
 #include <xen/iocap.h>
 #include <xen/lib.h>
 
+#include <asm/firmware/sci.h>
 #include <asm/setup.h>
 
 int map_irq_to_domain(struct domain *d, unsigned int irq,
@@ -303,6 +304,10 @@ int handle_device(struct domain *d, struct dt_device_node *dev, p2m_type_t p2mt,
                 return res;
             }
         }
+
+        res = sci_assign_dt_device(d, dev);
+        if ( res )
+            return res;
     }
 
     res = map_device_irqs_to_domain(d, dev, own_device, irq_ranges);
diff --git a/xen/arch/arm/dom0less-build.c b/xen/arch/arm/dom0less-build.c
index c8d07213e2..0094cf9e40 100644
--- a/xen/arch/arm/dom0less-build.c
+++ b/xen/arch/arm/dom0less-build.c
@@ -22,6 +22,7 @@
 
 #include <asm/arm64/sve.h>
 #include <asm/domain_build.h>
+#include <asm/firmware/sci.h>
 #include <asm/grant_table.h>
 #include <asm/setup.h>
 
@@ -272,6 +273,12 @@ int __init init_vuart(struct domain *d, struct kernel_info *kinfo,
     return rc;
 }
 
+int __init arch_handle_passthrough_prop(struct kernel_info *kinfo,
+                                        struct dt_device_node *node)
+{
+    return sci_assign_dt_device(kinfo->bd.d, node);
+}
+
 int __init arch_parse_dom0less_node(struct dt_device_node *node,
                                     struct boot_domain *bd)
 {
@@ -281,6 +288,7 @@ int __init arch_parse_dom0less_node(struct dt_device_node *node,
 
     d_cfg->arch.gic_version = XEN_DOMCTL_CONFIG_GIC_NATIVE;
     d_cfg->flags |= XEN_DOMCTL_CDF_hvm | XEN_DOMCTL_CDF_hap;
+    d_cfg->arch.arm_sci_type = XEN_DOMCTL_CONFIG_ARM_SCI_NONE;
 
     if ( !dt_property_read_u32(node, "nr_spis", &d_cfg->arch.nr_spis) )
     {
diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c
index 863ae18157..1a8585d02b 100644
--- a/xen/arch/arm/domain.c
+++ b/xen/arch/arm/domain.c
@@ -24,6 +24,7 @@
 #include <asm/platform.h>
 #include <asm/procinfo.h>
 #include <asm/regs.h>
+#include <asm/firmware/sci.h>
 #include <asm/tee/tee.h>
 #include <asm/vfp.h>
 #include <asm/vgic.h>
@@ -699,7 +700,7 @@ int arch_sanitise_domain_config(struct xen_domctl_createdomain *config)
         return -EINVAL;
     }
 
-    return 0;
+    return sci_domain_sanitise_config(config);
 }
 
 int arch_domain_create(struct domain *d,
@@ -791,6 +792,9 @@ int arch_domain_create(struct domain *d,
     d->arch.sve_vl = config->arch.sve_vl;
 #endif
 
+    if ( (rc = sci_domain_init(d, config)) != 0 )
+        goto fail;
+
     return 0;
 
 fail:
@@ -851,6 +855,7 @@ void arch_domain_destroy(struct domain *d)
     domain_vgic_free(d);
     domain_vuart_free(d);
     free_xenheap_page(d->shared_info);
+    sci_domain_destroy(d);
 #ifdef CONFIG_ACPI
     free_xenheap_pages(d->arch.efi_acpi_table,
                        get_order_from_bytes(d->arch.efi_acpi_len));
@@ -1044,6 +1049,7 @@ enum {
     PROG_p2m_root,
     PROG_p2m,
     PROG_p2m_pool,
+    PROG_sci,
     PROG_done,
 };
 
@@ -1103,6 +1109,10 @@ int domain_relinquish_resources(struct domain *d)
         ret = relinquish_p2m_mapping(d);
         if ( ret )
             return ret;
+    PROGRESS(sci):
+        ret = sci_relinquish_resources(d);
+        if ( ret )
+            return ret;
 
     PROGRESS(p2m_root):
         /*
diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index a9e4153e3c..039aa71439 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -28,6 +28,7 @@
 #include <asm/setup.h>
 #include <asm/tee/tee.h>
 #include <asm/pci.h>
+#include <asm/firmware/sci.h>
 #include <asm/platform.h>
 #include <asm/psci.h>
 #include <asm/setup.h>
@@ -1640,6 +1641,9 @@ static int __init handle_node(struct domain *d, struct kernel_info *kinfo,
         return 0;
     }
 
+    if ( sci_dt_handle_node(d, node) )
+        return 0;
+
     /*
      * The vGIC does not support routing hardware PPIs to guest. So
      * we need to skip any node using PPIs.
@@ -1740,6 +1744,10 @@ static int __init handle_node(struct domain *d, struct kernel_info *kinfo,
         if ( res )
             return res;
 
+        res = sci_dt_finalize(d, kinfo->fdt);
+        if ( res )
+            return res;
+
         /*
          * Create a second memory node to store the ranges covering
          * reserved-memory regions.
diff --git a/xen/arch/arm/firmware/Kconfig b/xen/arch/arm/firmware/Kconfig
index 817da745fd..fc7918c7fc 100644
--- a/xen/arch/arm/firmware/Kconfig
+++ b/xen/arch/arm/firmware/Kconfig
@@ -1,3 +1,11 @@
+config ARM_SCI
+	bool
+	depends on ARM
+	help
+	  This option enables generic Arm SCI (System Control Interface) mediators
+	  support. It allows domains to control system resources via one of
+	  Arm SCI mediators drivers implemented in XEN, like SCMI.
+
 menu "Firmware Drivers"
 
 config SCMI_SMC
diff --git a/xen/arch/arm/firmware/Makefile b/xen/arch/arm/firmware/Makefile
index a5e4542666..71bdefc24a 100644
--- a/xen/arch/arm/firmware/Makefile
+++ b/xen/arch/arm/firmware/Makefile
@@ -1 +1,2 @@
+obj-$(CONFIG_ARM_SCI) += sci.o
 obj-$(CONFIG_SCMI_SMC) += scmi-smc.o
diff --git a/xen/arch/arm/firmware/sci.c b/xen/arch/arm/firmware/sci.c
new file mode 100644
index 0000000000..aa93cda7f0
--- /dev/null
+++ b/xen/arch/arm/firmware/sci.c
@@ -0,0 +1,154 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Generic part of the SCI (System Control Interface) subsystem.
+ *
+ * Oleksii Moisieiev <oleksii_moisieiev@epam.com>
+ * Copyright (c) 2025 EPAM Systems
+ */
+
+#include <xen/acpi.h>
+#include <xen/errno.h>
+#include <xen/init.h>
+#include <xen/sched.h>
+#include <xen/types.h>
+
+#include <asm/firmware/sci.h>
+
+static const struct sci_mediator_ops __read_mostly *cur_mediator;
+
+int sci_register(const struct sci_mediator_ops *ops)
+{
+    if ( cur_mediator )
+        return -EEXIST;
+
+    if ( !ops->domain_init || !ops->domain_destroy || !ops->handle_call )
+        return -EINVAL;
+
+    cur_mediator = ops;
+
+    return 0;
+};
+
+bool sci_handle_call(struct cpu_user_regs *regs)
+{
+    if ( unlikely(!cur_mediator) )
+        return false;
+
+    return cur_mediator->handle_call(regs);
+}
+
+int sci_domain_init(struct domain *d, struct xen_domctl_createdomain *config)
+{
+    if ( !cur_mediator )
+        return 0;
+
+    return cur_mediator->domain_init(d, config);
+}
+
+int sci_domain_sanitise_config(struct xen_domctl_createdomain *config)
+{
+    if ( !cur_mediator )
+        return 0;
+
+    if ( !cur_mediator->domain_sanitise_config )
+        return 0;
+
+    return cur_mediator->domain_sanitise_config(config);
+}
+
+void sci_domain_destroy(struct domain *d)
+{
+    if ( !cur_mediator )
+        return;
+
+    cur_mediator->domain_destroy(d);
+}
+
+int sci_relinquish_resources(struct domain *d)
+{
+    if ( !cur_mediator )
+        return 0;
+
+    if ( !cur_mediator->relinquish_resources )
+        return 0;
+
+    return cur_mediator->relinquish_resources(d);
+}
+
+bool sci_dt_handle_node(struct domain *d, struct dt_device_node *node)
+{
+    if ( !cur_mediator )
+        return 0;
+
+    if ( !cur_mediator->dom0_dt_handle_node )
+        return 0;
+
+    return cur_mediator->dom0_dt_handle_node(d, node);
+}
+
+int sci_dt_finalize(struct domain *d, void *fdt)
+{
+    if ( !cur_mediator )
+        return 0;
+
+    if ( !cur_mediator->dom0_dt_finalize )
+        return 0;
+
+    return cur_mediator->dom0_dt_finalize(d, fdt);
+}
+
+int sci_assign_dt_device(struct domain *d, struct dt_device_node *dev)
+{
+    struct dt_phandle_args ac_spec;
+    int index = 0;
+    int ret;
+
+    if ( !cur_mediator )
+        return 0;
+
+    if ( !cur_mediator->assign_dt_device )
+        return 0;
+
+    while ( !dt_parse_phandle_with_args(dev, "access-controllers",
+                                        "#access-controller-cells", index,
+                                        &ac_spec) )
+    {
+        printk(XENLOG_DEBUG "sci: assign device %s to %pd\n",
+               dt_node_full_name(dev), d);
+
+        ret = cur_mediator->assign_dt_device(d, &ac_spec);
+        if ( ret )
+            return ret;
+
+        index++;
+    }
+
+    return 0;
+}
+
+static int __init sci_init(void)
+{
+    struct dt_device_node *np;
+    unsigned int num_sci = 0;
+    int rc;
+
+    dt_for_each_device_node(dt_host, np)
+    {
+        rc = device_init(np, DEVICE_FIRMWARE, NULL);
+        if ( !rc && num_sci )
+        {
+            printk(XENLOG_ERR
+                   "SCMI: Only one SCI controller is supported. found second %s\n",
+                   np->name);
+            return -EOPNOTSUPP;
+        }
+        else if ( !rc )
+            num_sci++;
+        else if ( rc != -EBADF && rc != -ENODEV )
+            return rc;
+    }
+
+    return 0;
+}
+
+__initcall(sci_init);
diff --git a/xen/arch/arm/include/asm/domain.h b/xen/arch/arm/include/asm/domain.h
index a3487ca713..af3e168374 100644
--- a/xen/arch/arm/include/asm/domain.h
+++ b/xen/arch/arm/include/asm/domain.h
@@ -120,6 +120,11 @@ struct arch_domain
 #ifdef CONFIG_TEE
     void *tee;
 #endif
+#ifdef CONFIG_ARM_SCI
+    bool sci_enabled;
+    /* ARM SCI driver's specific data */
+    void *sci_data;
+#endif
 
 }  __cacheline_aligned;
 
diff --git a/xen/arch/arm/include/asm/firmware/sci.h b/xen/arch/arm/include/asm/firmware/sci.h
new file mode 100644
index 0000000000..3500216bc2
--- /dev/null
+++ b/xen/arch/arm/include/asm/firmware/sci.h
@@ -0,0 +1,200 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Generic ARM SCI (System Control Interface) subsystem.
+ *
+ * Oleksii Moisieiev <oleksii_moisieiev@epam.com>
+ * Copyright (c) 2025 EPAM Systems
+ */
+
+#ifndef __ASM_ARM_SCI_H
+#define __ASM_ARM_SCI_H
+
+#include <xen/device_tree.h>
+#include <xen/errno.h>
+#include <xen/lib.h>
+#include <xen/sched.h>
+#include <xen/types.h>
+
+#ifdef CONFIG_ARM_SCI
+
+struct sci_mediator_ops {
+    /*
+     * Called during domain construction. If it is requested to enable
+     * SCI support, so SCI driver can create own structures for the new domain
+     * and inform firmware about new domain (if required).
+     * Mandatory.
+     */
+    int (*domain_init)(struct domain *d,
+                       struct xen_domctl_createdomain *config);
+
+    /*
+     * Called during domain construction. The SCI driver uses
+     * it to sanitize domain SCI configuration parameters.
+     * Optional.
+     */
+    int (*domain_sanitise_config)(struct xen_domctl_createdomain *config);
+
+    /*
+     * Called during domain destruction, releases all resources, that
+     * were allocated for domain.
+     * Mandatory.
+     */
+    void (*domain_destroy)(struct domain *d);
+
+    /*
+     * Called during domain destruction to relinquish resources used
+     * by SCI driver itself and request resources releasing from firmware.
+     * Optional.
+     */
+    int (*relinquish_resources)(struct domain *d);
+
+    /* SMC/HVC Handle callback */
+    bool (*handle_call)(struct cpu_user_regs *regs);
+
+    /*
+     * Dom0 DT nodes handling callback so SCI driver can detect DT nodes it
+     * need to handle and decide if those nodes need to be provided to Dom0.
+     * Optional.
+     */
+    bool (*dom0_dt_handle_node)(struct domain *d, struct dt_device_node *node);
+
+    /*
+     * SCI driver callback called at the end of Dom0 DT generation, so
+     * it can perform steps to modify DT to enable/disable SCI
+     * functionality for Dom0.
+     */
+    int (*dom0_dt_finalize)(struct domain *d, void *fdt);
+
+    /*
+     * SCI driver callback called when DT device is passed through to guest,
+     * so SCI driver can enable device access to the domain if SCI FW provides
+     * Device specific access control functionality.
+     * Optional.
+     */
+    int (*assign_dt_device)(struct domain *d, struct dt_phandle_args *ac_spec);
+};
+
+
+static inline bool sci_domain_is_enabled(struct domain *d)
+{
+    return d->arch.sci_enabled;
+}
+
+/*
+ * Register SCI subsystem ops.
+ *
+ * Register SCI drivers operation and so enable SCI functionality.
+ * Only one SCI driver is supported.
+ */
+int sci_register(const struct sci_mediator_ops *ops);
+
+/*
+ * Initialize SCI functionality for domain if configured.
+ *
+ * Initialization routine to enable SCI functionality for the domain.
+ * The SCI configuration data and decision about enabling SCI functionality
+ * for the domain is SCI driver specific.
+ */
+int sci_domain_init(struct domain *d, struct xen_domctl_createdomain *config);
+
+/*
+ * Sanitise domain configuration parameters.
+ *
+ */
+int sci_domain_sanitise_config(struct xen_domctl_createdomain *config);
+
+/*
+ * Destroy SCI domain instance.
+ */
+void sci_domain_destroy(struct domain *d);
+
+/*
+ * Free resources assigned to the certain domain.
+ */
+int sci_relinquish_resources(struct domain *d);
+
+/*
+ * SMC/HVC Handle callback.
+ *
+ * SCI driver acts as SMC/HVC server for the registered domains and
+ * does redirection of the domain calls to the SCI firmware,
+ * such as ARM TF-A or similar.
+ */
+bool sci_handle_call(struct cpu_user_regs *regs);
+
+/*
+ * Dom0 DT nodes handling function.
+ *
+ * Allows SCI driver to detect DT nodes it need to handle and decide if
+ * those nodes need to be provided to Dom0.
+ */
+bool sci_dt_handle_node(struct domain *d, struct dt_device_node *node);
+
+/*
+ * Dom0 DT generation finalize.
+ *
+ * Called at the end of Dom0 DT generation, so SCI driver can perform steps
+ * to modify DT to enable/disable SCI functionality for Dom0.
+ */
+int sci_dt_finalize(struct domain *d, void *fdt);
+
+/*
+ * Assign DT device to domain.
+ *
+ * Called when DT device is passed through to guest, so SCI driver can enable
+ * device access to the domain if SCI FW provides "Device specific access
+ * control" functionality.
+ */
+int sci_assign_dt_device(struct domain *d, struct dt_device_node *dev);
+#else
+
+static inline bool sci_domain_is_enabled(struct domain *d)
+{
+    return false;
+}
+
+static inline int sci_domain_init(struct domain *d,
+                                  struct xen_domctl_createdomain *config)
+{
+    return 0;
+}
+
+static inline int
+sci_domain_sanitise_config(struct xen_domctl_createdomain *config)
+{
+    return 0;
+}
+
+static inline void sci_domain_destroy(struct domain *d)
+{}
+
+static inline int sci_relinquish_resources(struct domain *d)
+{
+    return 0;
+}
+
+static inline bool sci_handle_call(struct cpu_user_regs *regs)
+{
+    return false;
+}
+
+static inline bool sci_dt_handle_node(struct domain *d,
+                                      struct dt_device_node *node)
+{
+    return false;
+}
+
+static inline int sci_dt_finalize(struct domain *d, void *fdt)
+{
+    return 0;
+}
+
+static inline int sci_assign_dt_device(struct domain *d,
+                                       struct dt_device_node *dev)
+{
+    return 0;
+}
+
+#endif /* CONFIG_ARM_SCI */
+
+#endif /* __ASM_ARM_SCI_H */
diff --git a/xen/arch/arm/vsmc.c b/xen/arch/arm/vsmc.c
index 6081f14ed0..4095171533 100644
--- a/xen/arch/arm/vsmc.c
+++ b/xen/arch/arm/vsmc.c
@@ -12,6 +12,7 @@
 #include <public/arch-arm/smccc.h>
 #include <asm/cpuerrata.h>
 #include <asm/cpufeature.h>
+#include <asm/firmware/sci.h>
 #include <asm/monitor.h>
 #include <asm/regs.h>
 #include <asm/smccc.h>
@@ -232,7 +233,7 @@ static bool handle_sip(struct cpu_user_regs *regs)
     if ( platform_smc(regs) )
         return true;
 
-    return scmi_handle_smc(regs);
+    return (scmi_handle_smc(regs)) ? true : sci_handle_call(regs);
 }
 
 /*
diff --git a/xen/common/device-tree/dom0less-build.c b/xen/common/device-tree/dom0less-build.c
index badc227031..aaa5e9b22c 100644
--- a/xen/common/device-tree/dom0less-build.c
+++ b/xen/common/device-tree/dom0less-build.c
@@ -228,6 +228,10 @@ static int __init handle_passthrough_prop(struct kernel_info *kinfo,
     if ( res < 0 )
         return res;
 
+    res = arch_handle_passthrough_prop(kinfo, node);
+    if ( res )
+        return res;
+
     /* If xen_force, we allow assignment of devices without IOMMU protection. */
     if ( xen_force && !dt_device_is_protected(node) )
         return 0;
diff --git a/xen/include/asm-generic/device.h b/xen/include/asm-generic/device.h
index 3bd97e33c5..cb13f7faea 100644
--- a/xen/include/asm-generic/device.h
+++ b/xen/include/asm-generic/device.h
@@ -18,6 +18,7 @@ enum device_class
     DEVICE_IOMMU,
     DEVICE_INTERRUPT_CONTROLLER,
     DEVICE_PCI_HOSTBRIDGE,
+    DEVICE_FIRMWARE,
     /* Use for error */
     DEVICE_UNKNOWN,
 };
diff --git a/xen/include/public/arch-arm.h b/xen/include/public/arch-arm.h
index e2412a1747..e7a17ede3e 100644
--- a/xen/include/public/arch-arm.h
+++ b/xen/include/public/arch-arm.h
@@ -327,6 +327,8 @@ DEFINE_XEN_GUEST_HANDLE(vcpu_guest_context_t);
 #define XEN_DOMCTL_CONFIG_TEE_OPTEE     1
 #define XEN_DOMCTL_CONFIG_TEE_FFA       2
 
+#define XEN_DOMCTL_CONFIG_ARM_SCI_NONE      0
+
 struct xen_arch_domainconfig {
     /* IN/OUT */
     uint8_t gic_version;
@@ -350,6 +352,8 @@ struct xen_arch_domainconfig {
      *
      */
     uint32_t clock_frequency;
+    /* IN */
+    uint8_t arm_sci_type;
 };
 #endif /* __XEN__ || __XEN_TOOLS__ */
 
diff --git a/xen/include/xen/dom0less-build.h b/xen/include/xen/dom0less-build.h
index 408859e325..faaf660424 100644
--- a/xen/include/xen/dom0less-build.h
+++ b/xen/include/xen/dom0less-build.h
@@ -62,6 +62,9 @@ void set_domain_type(struct domain *d, struct kernel_info *kinfo);
 int init_intc_phandle(struct kernel_info *kinfo, const char *name,
                       const int node_next, const void *pfdt);
 
+int arch_handle_passthrough_prop(struct kernel_info *kinfo,
+                                 struct dt_device_node *node);
+
 #else /* !CONFIG_DOM0LESS_BOOT */
 
 static inline void create_domUs(void) {}
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Sep 04 20:44:14 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Sep 2025 20:44:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1110923.1459915 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uuGoY-0003Yv-7g; Thu, 04 Sep 2025 20:44:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1110923.1459915; Thu, 04 Sep 2025 20: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 1uuGoY-0003Yn-59; Thu, 04 Sep 2025 20:44:14 +0000
Received: by outflank-mailman (input) for mailman id 1110923;
 Thu, 04 Sep 2025 20: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 1uuGoW-0003YX-D1
 for xen-changelog@lists.xenproject.org; Thu, 04 Sep 2025 20: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 1uuGoW-006QUC-0X
 for xen-changelog@lists.xenproject.org;
 Thu, 04 Sep 2025 20:44:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uuGoW-00G82D-16
 for xen-changelog@lists.xenproject.org;
 Thu, 04 Sep 2025 20: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=vRMKkUF8UrvAuwlN/fH0OCT8Vz3TQbPl4FZcigkDsMo=; b=Vt/5FI9DW5cQUJGu2AwH9UdA5X
	Ij3a1ro6xa8AxW9pf/L1H8HkaV8fYb2D4h8f68n2tQ5hME6NNVVU0BcWNmVImcfIW5uJg9KiW8Oap
	+UOBfFDrbgJgENyYQwUSRqhcveQkZ63SaEvzPWCcZweVJuKTeZgdCiIWwbDnICjtm3wA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: scmi-smc: update to be used under sci subsystem
Message-Id: <E1uuGoW-00G82D-16@xenbits.xenproject.org>
Date: Thu, 04 Sep 2025 20:44:12 +0000

commit 8e284f5ea30a6446cd39f0e7ef8de037b536563f
Author:     Grygorii Strashko <grygorii_strashko@epam.com>
AuthorDate: Thu Sep 4 14:21:27 2025 +0000
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Thu Sep 4 12:11:43 2025 -0700

    xen/arm: scmi-smc: update to be used under sci subsystem
    
    The introduced SCI (System Control Interface) subsystem provides unified
    interface to integrate in Xen SCI drivers which adds support for ARM
    firmware (EL3, SCP) based software interfaces (like SCMI) that are used in
    system management. The SCI subsystem allows to add drivers for different FW
    interfaces or have different drivers for the same FW interface (for example,
    SCMI with different transports).
    
    This patch updates SCMI over SMC calls handling layer, introduced by
    commit 3e322bef8bc0 ("xen/arm: firmware: Add SCMI over SMC calls handling
    layer"), to be SCI driver:
    - convert to DT device;
    - convert to SCI Xen interface.
    
    There are no functional changes in general, the driver is just adopted
    to the SCI interface.
    
    Signed-off-by: Grygorii Strashko <grygorii_strashko@epam.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/arch/arm/firmware/Kconfig                | 13 +++-
 xen/arch/arm/firmware/scmi-smc.c             | 93 +++++++++++++++-------------
 xen/arch/arm/include/asm/firmware/scmi-smc.h | 41 ------------
 xen/arch/arm/vsmc.c                          |  3 +-
 xen/include/public/arch-arm.h                |  1 +
 5 files changed, 64 insertions(+), 87 deletions(-)

diff --git a/xen/arch/arm/firmware/Kconfig b/xen/arch/arm/firmware/Kconfig
index fc7918c7fc..bbf88fbb9a 100644
--- a/xen/arch/arm/firmware/Kconfig
+++ b/xen/arch/arm/firmware/Kconfig
@@ -8,9 +8,18 @@ config ARM_SCI
 
 menu "Firmware Drivers"
 
+choice
+	prompt "ARM SCI driver type"
+	default SCMI_SMC
+	help
+	Choose which ARM SCI driver to enable.
+
+config ARM_SCI_NONE
+	bool "none"
+
 config SCMI_SMC
 	bool "Forward SCMI over SMC calls from hwdom to EL3 firmware"
-	default y
+	select ARM_SCI
 	help
 	  This option enables basic awareness for SCMI calls using SMC as
 	  doorbell mechanism and Shared Memory for transport ("arm,scmi-smc"
@@ -18,4 +27,6 @@ config SCMI_SMC
 	  firmware node is used to trap and forward corresponding SCMI SMCs
 	  to firmware running at EL3, for calls coming from the hardware domain.
 
+endchoice
+
 endmenu
diff --git a/xen/arch/arm/firmware/scmi-smc.c b/xen/arch/arm/firmware/scmi-smc.c
index 33473c04b1..4c5df714c2 100644
--- a/xen/arch/arm/firmware/scmi-smc.c
+++ b/xen/arch/arm/firmware/scmi-smc.c
@@ -16,12 +16,12 @@
 #include <xen/sched.h>
 #include <xen/types.h>
 
+#include <asm/device.h>
+#include <asm/firmware/sci.h>
 #include <asm/smccc.h>
-#include <asm/firmware/scmi-smc.h>
 
 #define SCMI_SMC_ID_PROP   "arm,smc-id"
 
-static bool __ro_after_init scmi_enabled;
 static uint32_t __ro_after_init scmi_smc_id;
 
 /*
@@ -41,14 +41,11 @@ static bool scmi_is_valid_smc_id(uint32_t fid)
  *
  * Returns true if SMC was handled (regardless of response), false otherwise.
  */
-bool scmi_handle_smc(struct cpu_user_regs *regs)
+static bool scmi_handle_smc(struct cpu_user_regs *regs)
 {
     uint32_t fid = (uint32_t)get_user_reg(regs, 0);
     struct arm_smccc_res res;
 
-    if ( !scmi_enabled )
-        return false;
-
     if ( !scmi_is_valid_smc_id(fid) )
         return false;
 
@@ -78,49 +75,45 @@ bool scmi_handle_smc(struct cpu_user_regs *regs)
     return true;
 }
 
-static int __init scmi_check_smccc_ver(void)
+static int scmi_smc_domain_init(struct domain *d,
+                                struct xen_domctl_createdomain *config)
 {
-    if ( smccc_ver < ARM_SMCCC_VERSION_1_1 )
-    {
-        printk(XENLOG_WARNING
-               "SCMI: No SMCCC 1.1 support, SCMI calls forwarding disabled\n");
-        return -ENOSYS;
-    }
+    if ( !is_hardware_domain(d) )
+        return 0;
 
+    d->arch.sci_enabled = true;
+    printk(XENLOG_DEBUG "SCMI: %pd init\n", d);
     return 0;
 }
 
-static int __init scmi_dt_init_smccc(void)
+static void scmi_smc_domain_destroy(struct domain *d)
 {
-    static const struct dt_device_match scmi_ids[] __initconst =
-    {
-        /* We only support "arm,scmi-smc" binding for now */
-        DT_MATCH_COMPATIBLE("arm,scmi-smc"),
-        { /* sentinel */ },
-    };
-    const struct dt_device_node *scmi_node;
-    int ret;
+    if ( !is_hardware_domain(d) )
+        return;
 
-    /* If no SCMI firmware node found, fail silently as it's not mandatory */
-    scmi_node = dt_find_matching_node(NULL, scmi_ids);
-    if ( !scmi_node )
-        return -EOPNOTSUPP;
+    printk(XENLOG_DEBUG "SCMI: %pd destroy\n", d);
+}
 
-    ret = dt_property_read_u32(scmi_node, SCMI_SMC_ID_PROP, &scmi_smc_id);
-    if ( !ret )
+static int __init scmi_check_smccc_ver(void)
+{
+    if ( smccc_ver < ARM_SMCCC_VERSION_1_1 )
     {
-        printk(XENLOG_ERR "SCMI: No valid \"%s\" property in \"%s\" DT node\n",
-               SCMI_SMC_ID_PROP, scmi_node->full_name);
-        return -ENOENT;
+        printk(XENLOG_WARNING
+               "SCMI: No SMCCC 1.1 support, SCMI calls forwarding disabled\n");
+        return -ENOSYS;
     }
 
-    scmi_enabled = true;
-
     return 0;
 }
 
+static const struct sci_mediator_ops scmi_smc_ops = {
+    .handle_call = scmi_handle_smc,
+    .domain_init = scmi_smc_domain_init,
+    .domain_destroy = scmi_smc_domain_destroy,
+};
+
 /* Initialize the SCMI layer based on SMCs and Device-tree */
-static int __init scmi_init(void)
+static int __init scmi_dom0_init(struct dt_device_node *dev, const void *data)
 {
     int ret;
 
@@ -134,22 +127,36 @@ static int __init scmi_init(void)
     if ( ret )
         return ret;
 
-    ret = scmi_dt_init_smccc();
-    if ( ret == -EOPNOTSUPP )
-        return ret;
+    ret = dt_property_read_u32(dev, SCMI_SMC_ID_PROP, &scmi_smc_id);
+    if ( !ret )
+    {
+        printk(XENLOG_ERR "SCMI: No valid \"%s\" property in \"%s\" DT node\n",
+               SCMI_SMC_ID_PROP, dt_node_full_name(dev));
+        return -ENOENT;
+    }
+
+    ret = sci_register(&scmi_smc_ops);
     if ( ret )
-        goto err;
+    {
+        printk(XENLOG_ERR "SCMI: mediator already registered (ret = %d)\n",
+               ret);
+        return ret;
+    }
 
     printk(XENLOG_INFO "Using SCMI with SMC ID: 0x%x\n", scmi_smc_id);
 
     return 0;
-
- err:
-    printk(XENLOG_ERR "SCMI: Initialization failed (ret = %d)\n", ret);
-    return ret;
 }
 
-__initcall(scmi_init);
+static const struct dt_device_match scmi_smc_match[] __initconst = {
+    DT_MATCH_COMPATIBLE("arm,scmi-smc"),
+    { /* sentinel */ },
+};
+
+DT_DEVICE_START(scmi_smc, "SCMI SMC DOM0", DEVICE_FIRMWARE)
+    .dt_match = scmi_smc_match,
+    .init = scmi_dom0_init,
+DT_DEVICE_END
 
 /*
  * Local variables:
diff --git a/xen/arch/arm/include/asm/firmware/scmi-smc.h b/xen/arch/arm/include/asm/firmware/scmi-smc.h
deleted file mode 100644
index 6b1a164a40..0000000000
--- a/xen/arch/arm/include/asm/firmware/scmi-smc.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-/*
- * xen/arch/arm/include/asm/firmware/scmi-smc.h
- *
- * ARM System Control and Management Interface (SCMI) over SMC
- * Generic handling layer
- *
- * Andrei Cherechesu <andrei.cherechesu@nxp.com>
- * Copyright 2024 NXP
- */
-
-#ifndef __ASM_SCMI_SMC_H__
-#define __ASM_SCMI_SMC_H__
-
-#include <xen/types.h>
-
-struct cpu_user_regs;
-
-#ifdef CONFIG_SCMI_SMC
-
-bool scmi_handle_smc(struct cpu_user_regs *regs);
-
-#else
-
-static inline bool scmi_handle_smc(struct cpu_user_regs *regs)
-{
-    return false;
-}
-
-#endif /* CONFIG_SCMI_SMC */
-
-#endif /* __ASM_SCMI_H__ */
-
-/*
- * Local variables:
- * mode: C
- * c-file-style: "BSD"
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- */
diff --git a/xen/arch/arm/vsmc.c b/xen/arch/arm/vsmc.c
index 4095171533..78d5bdf56f 100644
--- a/xen/arch/arm/vsmc.c
+++ b/xen/arch/arm/vsmc.c
@@ -21,7 +21,6 @@
 #include <asm/traps.h>
 #include <asm/vpsci.h>
 #include <asm/platform.h>
-#include <asm/firmware/scmi-smc.h>
 
 /* Number of functions currently supported by Hypervisor Service. */
 #define XEN_SMCCC_FUNCTION_COUNT 3
@@ -233,7 +232,7 @@ static bool handle_sip(struct cpu_user_regs *regs)
     if ( platform_smc(regs) )
         return true;
 
-    return (scmi_handle_smc(regs)) ? true : sci_handle_call(regs);
+    return sci_handle_call(regs);
 }
 
 /*
diff --git a/xen/include/public/arch-arm.h b/xen/include/public/arch-arm.h
index e7a17ede3e..b31324f8d4 100644
--- a/xen/include/public/arch-arm.h
+++ b/xen/include/public/arch-arm.h
@@ -328,6 +328,7 @@ DEFINE_XEN_GUEST_HANDLE(vcpu_guest_context_t);
 #define XEN_DOMCTL_CONFIG_TEE_FFA       2
 
 #define XEN_DOMCTL_CONFIG_ARM_SCI_NONE      0
+#define XEN_DOMCTL_CONFIG_ARM_SCI_SCMI_SMC  1
 
 struct xen_arch_domainconfig {
     /* IN/OUT */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Sep 04 20:44:24 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Sep 2025 20:44:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1110924.1459918 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uuGoi-0003bb-9F; Thu, 04 Sep 2025 20:44:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1110924.1459918; Thu, 04 Sep 2025 20: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 1uuGoi-0003bU-6e; Thu, 04 Sep 2025 20:44:24 +0000
Received: by outflank-mailman (input) for mailman id 1110924;
 Thu, 04 Sep 2025 20: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 1uuGog-0003bG-HO
 for xen-changelog@lists.xenproject.org; Thu, 04 Sep 2025 20: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 1uuGog-006QUK-0u
 for xen-changelog@lists.xenproject.org;
 Thu, 04 Sep 2025 20:44:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uuGog-00G83S-1U
 for xen-changelog@lists.xenproject.org;
 Thu, 04 Sep 2025 20: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=DXHMBdIyA0yFqn+NLp/I0Fdl2suYI3f44F8rsWyeztI=; b=V0pT6svGkTAe+2defU81iab6/n
	xLrkWiyBSD3XlEZv8aGt4gdpaVRnBFJlwawKQVaLRnG4UM7X9+e1rkVTanMnyGu2ZLQCjNbnA1mt1
	6msf3nHwEMh1VPfn3KZj2H7B8W6IoUQOmhowpt8DAYBDA93tj7el+914uQHuHAySzmVc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: scmi-smc: passthrough SCMI SMC to domain, single agent
Message-Id: <E1uuGog-00G83S-1U@xenbits.xenproject.org>
Date: Thu, 04 Sep 2025 20:44:22 +0000

commit 10e7473d6024b436d5caf0f88d447dabf5bfb07c
Author:     Grygorii Strashko <grygorii_strashko@epam.com>
AuthorDate: Thu Sep 4 14:21:27 2025 +0000
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Thu Sep 4 12:11:44 2025 -0700

    xen/arm: scmi-smc: passthrough SCMI SMC to domain, single agent
    
    The commit 3e322bef8bc0 ("xen/arm: firmware: Add SCMI over SMC calls
    handling layer") introduces simple driver which forwards SCMI over SMC
    calls from hwdom/dom0 to EL3 firmware (TF-A) with a single SCMI OSPM agent
    support. While it is working gracefully for hwdom/dom0 use case it doesn't
    cover "thin Dom0 with guest domain, which serves as Driver domain"
    use-case. In this case HW need to be enable in Driver domain and dom0 is
    performing only control functions.
    
    The EL3 SCMI firmware (TF-A) with a single SCMI OSPM agent support is
    pretty generic case for the default vendors SDK and new platforms.
    
    This patch enables passthrough of SCMI SMC single agent interface to the
    one guest domain serving as Driver domain.
    
    Configure Dom0 to enable SCMI passthrough:
    
     - dom0: add scmi-smc-passthrough to the Xen Command Line
    
    Enabled SCMI passthrough for guest using toolstack in the following way:
    
     - domD: xl.cfg add "arm_sci" option as below
    
       arm_sci = "type=scmi_smc"
    
     - domD: xl.cfg enable access to the "arm,scmi-shmem"
    
    iomem = [
        "47ff0,1@22001",
    ]
    
     - domD: add SCMI nodes to the Driver domain partial device tree as in the
     below example:
    
    passthrough {
       scmi_shm_0: sram@22001000 {
           compatible = "arm,scmi-shmem";
           reg = <0x0 0x22001000 0x0 0x1000>;
       };
    
       firmware {
            compatible = "simple-bus";
                scmi: scmi {
                    compatible = "arm,scmi-smc";
                    shmem = <&scmi_shm_0>;
                    ...
                }
        }
    }
    
    dom0less case configuration:
    
    - add "xen,sci_type" property for required DomU ("xen,domain") node
    
       xen,sci_type="scmi_smc"
    
    - add scmi nodes to the Driver domain partial device tree the same way
    as above and enable access to the "arm,scmi-shmem" according to
    dom0less documentation. For example:
    
      scmi_shm_0: sram@22001000 {
            compatible = "arm,scmi-shmem";
            reg = <0x00 0x22001000 0x00 0x1000>;
    ->        xen,reg = <0x0 0x47ff0000 0x0 0x1000 0x0 0x22001000>;
    ->        xen,force-assign-without-iommu;
      };
    
    The SCMI SMC single agent interface can be enabled for one and only one
    domain. In general, the configuration is similar to any other HW
    passthrough, except explicitly enabling SCMI with "arm_sci" xl.cfg option.
    
    Note that "arm,scmi-smc" and "arm,scmi-shmem" nodes will be removed from
    dom0/hwdom DT when "scmi-smc-passthrough" cmdline parameter was provided.
    
    Signed-off-by: Grygorii Strashko <grygorii_strashko@epam.com>
    Signed-off-by: Oleksii Moisieiev <oleksii_moisieiev@epam.com>
    Acked-by: Anthony PERARD <anthony.perard@vates.tech> # tools
---
 docs/man/xl.cfg.5.pod.in              |  34 ++++++++++
 docs/misc/arm/device-tree/booting.txt |  15 +++++
 docs/misc/xen-command-line.pandoc     |   9 +++
 tools/golang/xenlight/helpers.gen.go  |  35 +++++++++++
 tools/golang/xenlight/types.gen.go    |  11 ++++
 tools/include/libxl.h                 |   5 ++
 tools/libs/light/libxl_arm.c          |  14 +++++
 tools/libs/light/libxl_types.idl      |  10 +++
 tools/xl/xl_parse.c                   |  36 +++++++++++
 xen/arch/arm/dom0less-build.c         |  34 +++++++++-
 xen/arch/arm/firmware/Kconfig         |   4 +-
 xen/arch/arm/firmware/scmi-smc.c      | 115 +++++++++++++++++++++++++++++++++-
 12 files changed, 317 insertions(+), 5 deletions(-)

diff --git a/docs/man/xl.cfg.5.pod.in b/docs/man/xl.cfg.5.pod.in
index acff45d308..3b18bcc095 100644
--- a/docs/man/xl.cfg.5.pod.in
+++ b/docs/man/xl.cfg.5.pod.in
@@ -3123,6 +3123,40 @@ writes will be ignored.
 
 This option is only implemented for Arm where the default is enabled.
 
+=item B<arm_sci="ARM_SCI_STRING">
+
+Set ARM_SCI specific options for the guest. ARM SCI is System
+Control Protocol allows domain to manage various functions that are provided
+by HW platform firmware.
+
+B<ARM_SCI_STRING> is a comma separated list of C<KEY=VALUE> settings,
+from the following list:
+
+=over 4
+
+=item B<type=STRING>
+
+Specifies an ARM SCI type for the guest.
+
+=over 4
+
+=item B<none>
+
+Don't allow guest to use ARM SCI if present on the platform. This is the
+default value.
+
+=item B<scmi_smc>
+
+Enables ARM SCMI SMC support for the guest by enabling SCMI over SMC calls
+forwarding from domain to the EL3 firmware (like Trusted Firmware-A) with a
+single SCMI OSPM agent support.
+Should be used together with B<scmi-smc-passthrough> Xen command line
+option.
+
+=back
+
+=back
+
 =back
 
 =head3 x86
diff --git a/docs/misc/arm/device-tree/booting.txt b/docs/misc/arm/device-tree/booting.txt
index 07acc7ba64..977b428608 100644
--- a/docs/misc/arm/device-tree/booting.txt
+++ b/docs/misc/arm/device-tree/booting.txt
@@ -307,6 +307,21 @@ with the following properties:
     passed through. This option is the default if this property is missing
     and the user does not provide the device partial device tree for the domain.
 
+- xen,sci_type
+
+    A string property specifying an ARM SCI type for the guest.
+
+    - "none"
+    Don't allow guest to use ARM SCI if present on the platform. This is the
+    default value.
+
+    - "scmi_smc"
+    Enables ARM SCMI SMC support for the guest by enabling SCMI over SMC calls
+    forwarding from domain to the EL3 firmware (like Trusted Firmware-A) with a
+    single SCMI OSPM agent support.
+    Should be used together with scmi-smc-passthrough Xen command line
+    option.
+
 Under the "xen,domain" compatible node, one or more sub-nodes are present
 for the DomU kernel and ramdisk.
 
diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index 4adcd7e762..518e42d965 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -2382,6 +2382,15 @@ sockets, &c.  This will reduce performance somewhat, particularly on
 systems with hyperthreading enabled, but should reduce power by
 enabling more sockets and cores to go into deeper sleep states.
 
+### scmi-smc-passthrough (ARM)
+> `= <boolean>`
+
+The option is available when `CONFIG_SCMI_SMC` is compiled in, and allows to
+enable SCMI SMC single agent interface for any, but only one guest domain,
+which serves as Driver domain. The SCMI will be disabled for Dom0/hwdom and
+SCMI nodes removed from Dom0/hwdom device tree.
+(for example, thin Dom0 with Driver domain use-case).
+
 ### scrub-domheap
 > `= <boolean>`
 
diff --git a/tools/golang/xenlight/helpers.gen.go b/tools/golang/xenlight/helpers.gen.go
index 667030cbd7..8909fe8a1b 100644
--- a/tools/golang/xenlight/helpers.gen.go
+++ b/tools/golang/xenlight/helpers.gen.go
@@ -938,6 +938,35 @@ return fmt.Errorf("converting field Vcpus: %v", err)
  return nil
  }
 
+// NewArmSci returns an instance of ArmSci initialized with defaults.
+func NewArmSci() (*ArmSci, error) {
+var (
+x ArmSci
+xc C.libxl_arm_sci)
+
+C.libxl_arm_sci_init(&xc)
+defer C.libxl_arm_sci_dispose(&xc)
+
+if err := x.fromC(&xc); err != nil {
+return nil, err }
+
+return &x, nil}
+
+func (x *ArmSci) fromC(xc *C.libxl_arm_sci) error {
+ x.Type = ArmSciType(xc._type)
+
+ return nil}
+
+func (x *ArmSci) toC(xc *C.libxl_arm_sci) (err error){defer func(){
+if err != nil{
+C.libxl_arm_sci_dispose(xc)}
+}()
+
+xc._type = C.libxl_arm_sci_type(x.Type)
+
+ return nil
+ }
+
 // NewRdmReserve returns an instance of RdmReserve initialized with defaults.
 func NewRdmReserve() (*RdmReserve, error) {
 var (
@@ -1163,6 +1192,9 @@ x.ArchArm.GicVersion = GicVersion(xc.arch_arm.gic_version)
 x.ArchArm.Vuart = VuartType(xc.arch_arm.vuart)
 x.ArchArm.SveVl = SveType(xc.arch_arm.sve_vl)
 x.ArchArm.NrSpis = uint32(xc.arch_arm.nr_spis)
+if err := x.ArchArm.ArmSci.fromC(&xc.arch_arm.arm_sci);err != nil {
+return fmt.Errorf("converting field ArchArm.ArmSci: %v", err)
+}
 if err := x.ArchX86.MsrRelaxed.fromC(&xc.arch_x86.msr_relaxed);err != nil {
 return fmt.Errorf("converting field ArchX86.MsrRelaxed: %v", err)
 }
@@ -1699,6 +1731,9 @@ xc.arch_arm.gic_version = C.libxl_gic_version(x.ArchArm.GicVersion)
 xc.arch_arm.vuart = C.libxl_vuart_type(x.ArchArm.Vuart)
 xc.arch_arm.sve_vl = C.libxl_sve_type(x.ArchArm.SveVl)
 xc.arch_arm.nr_spis = C.uint32_t(x.ArchArm.NrSpis)
+if err := x.ArchArm.ArmSci.toC(&xc.arch_arm.arm_sci); err != nil {
+return fmt.Errorf("converting field ArchArm.ArmSci: %v", err)
+}
 if err := x.ArchX86.MsrRelaxed.toC(&xc.arch_x86.msr_relaxed); err != nil {
 return fmt.Errorf("converting field ArchX86.MsrRelaxed: %v", err)
 }
diff --git a/tools/golang/xenlight/types.gen.go b/tools/golang/xenlight/types.gen.go
index e26b3cdfc7..ab9d4ca7b4 100644
--- a/tools/golang/xenlight/types.gen.go
+++ b/tools/golang/xenlight/types.gen.go
@@ -520,6 +520,16 @@ SveType1920 SveType = 1920
 SveType2048 SveType = 2048
 )
 
+type ArmSciType int
+const(
+ArmSciTypeNone ArmSciType = 0
+ArmSciTypeScmiSmc ArmSciType = 1
+)
+
+type ArmSci struct {
+Type ArmSciType
+}
+
 type RdmReserve struct {
 Strategy RdmReserveStrategy
 Policy RdmReservePolicy
@@ -599,6 +609,7 @@ GicVersion GicVersion
 Vuart VuartType
 SveVl SveType
 NrSpis uint32
+ArmSci ArmSci
 }
 ArchX86 struct {
 MsrRelaxed Defbool
diff --git a/tools/include/libxl.h b/tools/include/libxl.h
index 185f74d8a8..bc35e412da 100644
--- a/tools/include/libxl.h
+++ b/tools/include/libxl.h
@@ -313,6 +313,11 @@
  */
 #define LIBXL_HAVE_BUILDINFO_ARCH_NR_SPIS 1
 
+/*
+ * libxl_domain_build_info has the arch_arm.sci* fields.
+ */
+#define LIBXL_HAVE_BUILDINFO_ARCH_ARM_SCI 1
+
 /*
  * LIBXL_HAVE_SOFT_RESET indicates that libxl supports performing
  * 'soft reset' for domains and there is 'soft_reset' shutdown reason
diff --git a/tools/libs/light/libxl_arm.c b/tools/libs/light/libxl_arm.c
index 4a19a8d22b..7e9f8a1bc3 100644
--- a/tools/libs/light/libxl_arm.c
+++ b/tools/libs/light/libxl_arm.c
@@ -233,6 +233,20 @@ int libxl__arch_domain_prepare_config(libxl__gc *gc,
         config->arch.sve_vl = d_config->b_info.arch_arm.sve_vl / 128U;
     }
 
+    switch (d_config->b_info.arch_arm.arm_sci.type) {
+    case LIBXL_ARM_SCI_TYPE_NONE:
+        config->arch.arm_sci_type = XEN_DOMCTL_CONFIG_ARM_SCI_NONE;
+        break;
+    case LIBXL_ARM_SCI_TYPE_SCMI_SMC:
+        config->arch.arm_sci_type = XEN_DOMCTL_CONFIG_ARM_SCI_SCMI_SMC;
+        break;
+    default:
+        LOG(ERROR, "Unknown ARM_SCI type %d",
+            d_config->b_info.arch_arm.arm_sci.type);
+        return ERROR_FAIL;
+    }
+    LOG(DEBUG, " - SCI type=%u", config->arch.arm_sci_type);
+
     return 0;
 }
 
diff --git a/tools/libs/light/libxl_types.idl b/tools/libs/light/libxl_types.idl
index a6030a2dbd..b53e013a44 100644
--- a/tools/libs/light/libxl_types.idl
+++ b/tools/libs/light/libxl_types.idl
@@ -551,6 +551,15 @@ libxl_sve_type = Enumeration("sve_type", [
     (2048, "2048")
     ], init_val = "LIBXL_SVE_TYPE_DISABLED")
 
+libxl_arm_sci_type = Enumeration("arm_sci_type", [
+    (0, "none"),
+    (1, "scmi_smc")
+    ], init_val = "LIBXL_ARM_SCI_TYPE_NONE")
+
+libxl_arm_sci = Struct("arm_sci", [
+    ("type", libxl_arm_sci_type),
+    ])
+
 libxl_rdm_reserve = Struct("rdm_reserve", [
     ("strategy",    libxl_rdm_reserve_strategy),
     ("policy",      libxl_rdm_reserve_policy),
@@ -725,6 +734,7 @@ libxl_domain_build_info = Struct("domain_build_info",[
                                ("vuart", libxl_vuart_type),
                                ("sve_vl", libxl_sve_type),
                                ("nr_spis", uint32, {'init_val': 'LIBXL_NR_SPIS_DEFAULT'}),
+                               ("arm_sci", libxl_arm_sci),
                               ])),
     ("arch_x86", Struct(None, [("msr_relaxed", libxl_defbool),
                               ])),
diff --git a/tools/xl/xl_parse.c b/tools/xl/xl_parse.c
index 90c9386f5b..af86d3186d 100644
--- a/tools/xl/xl_parse.c
+++ b/tools/xl/xl_parse.c
@@ -1284,6 +1284,36 @@ out:
     if (rc) exit(EXIT_FAILURE);
 }
 
+static int parse_arm_sci_config(XLU_Config *cfg, libxl_arm_sci *arm_sci,
+                                const char *str)
+{
+    int ret = 0;
+    char *buf2, *ptr;
+    char *oparg;
+
+    if (NULL == (buf2 = ptr = strdup(str)))
+        return ERROR_NOMEM;
+
+    ptr = strtok(buf2, ",");
+    while (ptr != NULL)
+    {
+        if (MATCH_OPTION("type", ptr, oparg)) {
+            ret = libxl_arm_sci_type_from_string(oparg, &arm_sci->type);
+            if (ret) {
+                fprintf(stderr, "Unknown ARM_SCI type: %s\n", oparg);
+                ret = ERROR_INVAL;
+                goto out;
+            }
+        }
+
+        ptr = strtok(NULL, ",");
+    }
+
+out:
+    free(buf2);
+    return ret;
+}
+
 void parse_config_data(const char *config_source,
                        const char *config_data,
                        int config_len,
@@ -2989,6 +3019,12 @@ skip_usbdev:
     xlu_cfg_get_defbool(config, "trap_unmapped_accesses",
                         &b_info->trap_unmapped_accesses, 0);
 
+    if (!xlu_cfg_get_string(config, "arm_sci", &buf, 1)) {
+        if (parse_arm_sci_config(config, &b_info->arch_arm.arm_sci, buf)) {
+            exit(EXIT_FAILURE);
+        }
+    }
+
     parse_vkb_list(config, d_config);
 
     d_config->virtios = NULL;
diff --git a/xen/arch/arm/dom0less-build.c b/xen/arch/arm/dom0less-build.c
index 0094cf9e40..f00912a1ca 100644
--- a/xen/arch/arm/dom0less-build.c
+++ b/xen/arch/arm/dom0less-build.c
@@ -279,6 +279,36 @@ int __init arch_handle_passthrough_prop(struct kernel_info *kinfo,
     return sci_assign_dt_device(kinfo->bd.d, node);
 }
 
+static int __init domu_dt_sci_parse(struct dt_device_node *node,
+                                    struct xen_domctl_createdomain *d_cfg)
+{
+    const char *sci_type;
+    int ret;
+
+    d_cfg->arch.arm_sci_type = XEN_DOMCTL_CONFIG_ARM_SCI_NONE;
+
+    if ( !IS_ENABLED(CONFIG_ARM_SCI) ||
+         !dt_property_read_bool(node, "xen,sci_type") )
+        return 0;
+
+    ret = dt_property_read_string(node, "xen,sci_type", &sci_type);
+    if ( ret )
+        return ret;
+
+    if ( !strcmp(sci_type, "none") )
+        d_cfg->arch.arm_sci_type = XEN_DOMCTL_CONFIG_ARM_SCI_NONE;
+    else if ( !strcmp(sci_type, "scmi_smc") )
+        d_cfg->arch.arm_sci_type = XEN_DOMCTL_CONFIG_ARM_SCI_SCMI_SMC;
+    else
+    {
+        printk(XENLOG_ERR "xen,sci_type in not valid (%s) for domain %s\n",
+               sci_type, dt_node_name(node));
+        return -EINVAL;
+    }
+
+    return 0;
+}
+
 int __init arch_parse_dom0less_node(struct dt_device_node *node,
                                     struct boot_domain *bd)
 {
@@ -288,7 +318,9 @@ int __init arch_parse_dom0less_node(struct dt_device_node *node,
 
     d_cfg->arch.gic_version = XEN_DOMCTL_CONFIG_GIC_NATIVE;
     d_cfg->flags |= XEN_DOMCTL_CDF_hvm | XEN_DOMCTL_CDF_hap;
-    d_cfg->arch.arm_sci_type = XEN_DOMCTL_CONFIG_ARM_SCI_NONE;
+
+    if ( domu_dt_sci_parse(node, d_cfg) )
+        panic("Error getting SCI configuration\n");
 
     if ( !dt_property_read_u32(node, "nr_spis", &d_cfg->arch.nr_spis) )
     {
diff --git a/xen/arch/arm/firmware/Kconfig b/xen/arch/arm/firmware/Kconfig
index bbf88fbb9a..5c5f0880c4 100644
--- a/xen/arch/arm/firmware/Kconfig
+++ b/xen/arch/arm/firmware/Kconfig
@@ -25,7 +25,9 @@ config SCMI_SMC
 	  doorbell mechanism and Shared Memory for transport ("arm,scmi-smc"
 	  compatible only). The value of "arm,smc-id" DT property from SCMI
 	  firmware node is used to trap and forward corresponding SCMI SMCs
-	  to firmware running at EL3, for calls coming from the hardware domain.
+	  to firmware running at EL3, for calls coming from the hardware domain or
+	  driver domain.
+	  Use with EL3 firmware which supports only single SCMI OSPM agent.
 
 endchoice
 
diff --git a/xen/arch/arm/firmware/scmi-smc.c b/xen/arch/arm/firmware/scmi-smc.c
index 4c5df714c2..0835ddeeec 100644
--- a/xen/arch/arm/firmware/scmi-smc.c
+++ b/xen/arch/arm/firmware/scmi-smc.c
@@ -13,6 +13,8 @@
 #include <xen/device_tree.h>
 #include <xen/errno.h>
 #include <xen/init.h>
+#include <xen/iocap.h>
+#include <xen/param.h>
 #include <xen/sched.h>
 #include <xen/types.h>
 
@@ -22,7 +24,11 @@
 
 #define SCMI_SMC_ID_PROP   "arm,smc-id"
 
+static bool __ro_after_init opt_scmi_smc_passthrough;
+boolean_param("scmi-smc-passthrough", opt_scmi_smc_passthrough);
+
 static uint32_t __ro_after_init scmi_smc_id;
+static struct domain __read_mostly *scmi_dom;
 
 /*
  * Check if provided SMC Function Identifier matches the one known by the SCMI
@@ -50,7 +56,7 @@ static bool scmi_handle_smc(struct cpu_user_regs *regs)
         return false;
 
     /* Only the hardware domain should use SCMI calls */
-    if ( !is_hardware_domain(current->domain) )
+    if ( scmi_dom != current->domain )
     {
         gdprintk(XENLOG_WARNING, "SCMI: Unprivileged access attempt\n");
         return false;
@@ -75,12 +81,45 @@ static bool scmi_handle_smc(struct cpu_user_regs *regs)
     return true;
 }
 
+static int
+scmi_smc_domain_sanitise_config(struct xen_domctl_createdomain *config)
+{
+    if ( config->arch.arm_sci_type != XEN_DOMCTL_CONFIG_ARM_SCI_NONE &&
+         config->arch.arm_sci_type != XEN_DOMCTL_CONFIG_ARM_SCI_SCMI_SMC )
+        return -EINVAL;
+
+    return 0;
+}
+
 static int scmi_smc_domain_init(struct domain *d,
                                 struct xen_domctl_createdomain *config)
 {
-    if ( !is_hardware_domain(d) )
+    /*
+     * scmi_passthrough is not enabled:
+     * - proceed only for hw_domain
+     * - fail if guest domain has SCMI enabled.
+     */
+    if ( !opt_scmi_smc_passthrough && !is_hardware_domain(d) )
+    {
+        if ( config->arch.arm_sci_type == XEN_DOMCTL_CONFIG_ARM_SCI_SCMI_SMC )
+            return -EINVAL;
+        else
+            return 0;
+    }
+    /*
+     * scmi_passthrough is enabled:
+     * - ignore hw_domain
+     * - proceed only for domain with SCMI enabled.
+     */
+    if ( opt_scmi_smc_passthrough &&
+         (config->arch.arm_sci_type == XEN_DOMCTL_CONFIG_ARM_SCI_NONE ||
+          is_hardware_domain(d)) )
         return 0;
 
+    if ( scmi_dom )
+        return -EEXIST;
+
+    scmi_dom = d;
     d->arch.sci_enabled = true;
     printk(XENLOG_DEBUG "SCMI: %pd init\n", d);
     return 0;
@@ -88,12 +127,80 @@ static int scmi_smc_domain_init(struct domain *d,
 
 static void scmi_smc_domain_destroy(struct domain *d)
 {
-    if ( !is_hardware_domain(d) )
+    if ( scmi_dom && scmi_dom != d )
         return;
 
+    scmi_dom = NULL;
+    d->arch.sci_enabled = false;
     printk(XENLOG_DEBUG "SCMI: %pd destroy\n", d);
 }
 
+/*
+ * Handle Dom0 SCMI SMC specific DT nodes
+ *
+ * if scmi_smc_passthrough=false:
+ * - Copy SCMI nodes into Dom0 device tree.
+ * if scmi_smc_passthrough=true:
+ * - skip SCMI nodes from Dom0 DT
+ * - give dom0 control access to SCMI shmem MMIO, so SCMI can be passed
+ *   through to guest.
+ */
+static bool scmi_smc_dt_handle_node(struct domain *d,
+                                    struct dt_device_node *node)
+{
+    static const struct dt_device_match shmem_matches[] __initconst = {
+        DT_MATCH_COMPATIBLE("arm,scmi-shmem"),
+        { /* sentinel */ },
+    };
+    static const struct dt_device_match scmi_matches[] __initconst = {
+        DT_MATCH_PATH("/firmware/scmi"),
+        { /* sentinel */ },
+    };
+
+    /* skip scmi shmem node for dom0 if scmi not enabled */
+    if ( dt_match_node(shmem_matches, node) && !sci_domain_is_enabled(d) )
+    {
+        dt_dprintk("Skip scmi shmem node\n");
+        return true;
+    }
+
+    /*
+     * skip scmi node for dom0 if scmi not enabled, but give dom0 control
+     * access to SCMI shmem
+     */
+    if ( dt_match_node(scmi_matches, node) && !sci_domain_is_enabled(d) )
+    {
+        struct dt_device_node *shmem_node;
+        const __be32 *prop;
+        uint64_t paddr, size;
+        int ret;
+
+        /* give dom0 control access to SCMI shmem */
+        prop = dt_get_property(node, "shmem", NULL);
+        if ( !prop )
+            return true;
+
+        shmem_node = dt_find_node_by_phandle(be32_to_cpu(*prop));
+        if ( !shmem_node )
+            return true;
+
+        ret = dt_device_get_address(shmem_node, 0, &paddr, &size);
+        if ( ret )
+            return true;
+
+        ret = iomem_permit_access(d, paddr_to_pfn(paddr),
+                                  paddr_to_pfn(paddr + size - 1));
+        if ( ret )
+            printk(XENLOG_WARNING
+                     "SCMI: Failed to give access to SCMI shmem with code: %d\n", ret);
+
+        dt_dprintk("Skip scmi node\n");
+        return true;
+    }
+
+    return false;
+}
+
 static int __init scmi_check_smccc_ver(void)
 {
     if ( smccc_ver < ARM_SMCCC_VERSION_1_1 )
@@ -108,8 +215,10 @@ static int __init scmi_check_smccc_ver(void)
 
 static const struct sci_mediator_ops scmi_smc_ops = {
     .handle_call = scmi_handle_smc,
+    .domain_sanitise_config = scmi_smc_domain_sanitise_config,
     .domain_init = scmi_smc_domain_init,
     .domain_destroy = scmi_smc_domain_destroy,
+    .dom0_dt_handle_node = scmi_smc_dt_handle_node,
 };
 
 /* Initialize the SCMI layer based on SMCs and Device-tree */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Sep 04 20:44:33 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Sep 2025 20:44:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1110926.1459924 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uuGor-0003eL-D8; Thu, 04 Sep 2025 20:44:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1110926.1459924; Thu, 04 Sep 2025 20: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 1uuGor-0003eD-9e; Thu, 04 Sep 2025 20:44:33 +0000
Received: by outflank-mailman (input) for mailman id 1110926;
 Thu, 04 Sep 2025 20: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 1uuGoq-0003e5-Jk
 for xen-changelog@lists.xenproject.org; Thu, 04 Sep 2025 20: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 1uuGoq-006QUg-1C
 for xen-changelog@lists.xenproject.org;
 Thu, 04 Sep 2025 20:44:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uuGoq-00G84C-1l
 for xen-changelog@lists.xenproject.org;
 Thu, 04 Sep 2025 20: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=0kr/7quXWLcHtB22+UC/bN6cgUbXqqzpK/GeCMASVx0=; b=PFoqwCovqg6+VgFLKZdIXVSicq
	Ypf/4WfEMuakmjJQ8eP/1MRLR2ceaFQ8ZurK29SW8VzvFdm6fWIdvF8Omx4HTSzZEfVhtASpOlPh+
	xIfMG9JxFqz9txwP4xaEXZMyKHTPVisHyhI6qjl3VyHWGrBRRHZwBtF3uobzjPVSFAEU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] docs: arm: add docs for SCMI over SMC calls forwarding driver
Message-Id: <E1uuGoq-00G84C-1l@xenbits.xenproject.org>
Date: Thu, 04 Sep 2025 20:44:32 +0000

commit b63699ee98caed47f6b3fb99fcfc87462066795a
Author:     Grygorii Strashko <grygorii_strashko@epam.com>
AuthorDate: Mon Sep 1 13:52:11 2025 +0000
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Thu Sep 4 12:12:37 2025 -0700

    docs: arm: add docs for SCMI over SMC calls forwarding driver
    
    Add documentation section for Simple Arm SCMI over SMC calls forwarding
    driver (EL3).
    
    Signed-off-by: Grygorii Strashko <grygorii_strashko@epam.com>
    Signed-off-by: Oleksii Moisieiev <oleksii_moisieiev@epam.com>
    [stefano: code style, 80 chars limit per line]
    Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 docs/hypervisor-guide/arm/firmware/arm-scmi.rst | 191 ++++++++++++++++++++++++
 docs/hypervisor-guide/arm/index.rst             |   9 ++
 docs/hypervisor-guide/index.rst                 |   1 +
 3 files changed, 201 insertions(+)

diff --git a/docs/hypervisor-guide/arm/firmware/arm-scmi.rst b/docs/hypervisor-guide/arm/firmware/arm-scmi.rst
new file mode 100644
index 0000000000..d9698f4e4b
--- /dev/null
+++ b/docs/hypervisor-guide/arm/firmware/arm-scmi.rst
@@ -0,0 +1,191 @@
+.. SPDX-License-Identifier: CC-BY-4.0
+
+ARM System Control and Management Interface (SCMI)
+==================================================
+
+The System Control and Management Interface (SCMI) [1], which is a set
+of operating system-independent software interfaces that are used in
+system management. SCMI currently
+provides interfaces for:
+
+- Discovery and self-description of the interfaces it supports
+- Power domain management
+- Clock management
+- Reset domain management
+- Voltage domain management
+- Sensor management
+- Performance management
+- Power capping and monitoring
+- Pin control protocol.
+
+The SCMI compliant firmware could run:
+
+- as part of EL3 secure world software (like Trusted Firmware-A) with
+  ARM SMC shared-memory transport;
+- on dedicated System Control Processor (SCP) with HW mailbox
+  shared-memory transport
+
+The major purpose of enabling SCMI support in Xen is to enable guest
+domains access to the SCMI interfaces for performing management actions
+on passed-through devices (such as clocks/resets etc) without accessing
+directly to the System control HW (like clock controllers) which in most
+cases can't be shared/split between domains. Or, at minimum, allow SCMI
+access for dom0/hwdom (or guest domain serving as Driver domain).
+
+The below sections describe SCMI support options available for Xen.
+
+| [1] `Arm SCMI <https://developer.arm.com/documentation/den0056/latest/>`_
+| [2] `System Control and Management Interface (SCMI) bindings <https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/firmware/arm,scmi.yaml>`_
+
+Simple SCMI over SMC calls forwarding driver (EL3)
+------------------------------------------------------
+
+The EL3 SCMI firmware (TF-A) with a single SCMI OSPM agent support is
+pretty generic case for the default vendors SDK and new platforms with
+SCMI support. Such EL3 SCMI firmware supports only single SCMI OSPM
+transport (agent) with Shared memory based transport and SMC calls as
+doorbell.
+
+The SCMI over SMC calls forwarding driver solves major problem for this
+case by allowing SMC calls to be forwarded from guest to the EL3 SCMI
+firmware.
+
+By default, the SCMI over SMC calls forwarding is enabled for
+Dom0/hwdom.
+
+::
+
+    +--------------------------+
+    |                          |
+    | EL3 SCMI FW (TF-A)       |
+    ++-------+--^--------------+
+     |shmem  |  | smc-id
+     +----^--+  |
+          |     |
+     +----|-+---+---+----------+
+     |    | |  FWD  |      Xen |
+     |    | +---^---+          |
+     +----|-----|--------------+
+          |     | smc-id
+     +----v-----+--+ +---------+
+     |             | |         |
+     | Dom0/hwdom  | | DomU    |
+     |             | |         |
+     |             | |         |
+     +-------------+ +---------+
+
+
+The SCMI messages are passed directly through SCMI shared-memory
+(zero-copy) and driver only forwards SMC calls.
+
+Compiling
+^^^^^^^^^
+
+To build with the SCMI over SMC calls forwarding enabled support, enable
+Kconfig option
+
+::
+
+    SCMI_SMC
+
+The ``CONFIG_SCMI_SMC`` is enabled by default.
+
+Pass-through SCMI SMC to domain which serves as Driver domain
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+This section describes how to configure the SCMI over SMC calls
+forwarding driver to handle use case "thin Dom0 with guest domain, which
+serves as Driver domain". In this case HW need to be enabled in Driver
+domain and dom0 is performing only control functions (without accessing
+FW) and so, the SCMI need to be enabled in Driver domain.
+
+::
+
+     +--------------------------+
+     |EL3 SCMI FW (TF-A)        |
+     |                          |
+     +-------------^--+-------+-+
+             smc-id|  |shmem0 |
+                   |  +----^--+
+    +-------------++------+|----+
+    |Xen          |  FWD  ||    |
+    |             +--^----+|    |
+    +----------------|-----|----+
+              smc-id |     |
+    +-----------+ +--+-----v-----+
+    |           | |              |
+    | Dom0      | |    Driver    |
+    | Control   | |    domain    |
+    |           | |              |
+    +-----------+ +--------------+
+
+The SCMI can be enabled for one and only one guest domain.
+
+First, configure Dom0 to enable SCMI pass-through using Xen Command Line
+**"scmi-smc-passthrough"** option. This will disable SCMI for Dom0/hwdom
+and SCMI nodes will be removed from Dom0/hwdom device tree.
+
+**Configure SCMI pass-through for guest domain with toolstack**
+
+* In domain's xl.cfg file add **"arm_sci"** option as below
+
+::
+
+    arm_sci = "type=scmi_smc"
+
+* In domain's xl.cfg file enable access to the "arm,scmi-shmem"
+
+::
+
+    iomem = [
+        "47ff0,1@22001",
+    ]
+
+.. note:: It's up to the user to select guest IPA for mapping SCMI shared-memory.
+
+* Add SCMI nodes to the Driver domain partial device tree as in the
+  below example:
+
+.. code::
+
+    passthrough {
+       scmi_shm_0: sram@22001000 {
+           compatible = "arm,scmi-shmem";
+           reg = <0x0 0x22001000 0x0 0x1000>;
+       };
+
+       firmware {
+            compatible = "simple-bus";
+                scmi: scmi {
+                    compatible = "arm,scmi-smc";
+                    shmem = <&scmi_shm_0>;
+                    ...
+                }
+        }
+    }
+
+Please refer to [2] for details of SCMI DT bindings.
+
+In general, the configuration is similar to any other HW pass-through,
+except explicitly enabling SCMI with "arm_sci" xl.cfg option.
+
+**Configure SCMI pass-through for predefined domain (dom0less)**
+
+* add "xen,sci_type" property for required DomU ("xen,domain") node
+
+::
+
+       xen,sci_type="scmi_smc"
+
+* add scmi nodes to the Driver domain partial device tree the same way
+  as above and enable access to the "arm,scmi-shmem" according to
+  dom0less documentation. For example:
+
+.. code::
+
+      scmi_shm_0: sram@22001000 {
+            compatible = "arm,scmi-shmem";
+            reg = <0x00 0x22001000 0x00 0x1000>;
+    ->        xen,reg = <0x0 0x47ff0000 0x0 0x1000 0x0 0x22001000>;
+    ->        xen,force-assign-without-iommu;
+      };
diff --git a/docs/hypervisor-guide/arm/index.rst b/docs/hypervisor-guide/arm/index.rst
new file mode 100644
index 0000000000..7aae4a0a03
--- /dev/null
+++ b/docs/hypervisor-guide/arm/index.rst
@@ -0,0 +1,9 @@
+.. SPDX-License-Identifier: CC-BY-4.0
+
+ARM
+===
+
+.. toctree::
+   :maxdepth: 2
+
+   firmware/arm-scmi
diff --git a/docs/hypervisor-guide/index.rst b/docs/hypervisor-guide/index.rst
index e4393b0697..520fe01554 100644
--- a/docs/hypervisor-guide/index.rst
+++ b/docs/hypervisor-guide/index.rst
@@ -9,3 +9,4 @@ Hypervisor documentation
    code-coverage
 
    x86/index
+   arm/index
\ No newline at end of file
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Sep 04 22:22:05 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Sep 2025 22:22:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1111045.1459976 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uuILD-0000yP-1S; Thu, 04 Sep 2025 22:22:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1111045.1459976; Thu, 04 Sep 2025 22: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 1uuILC-0000yI-V8; Thu, 04 Sep 2025 22:22:02 +0000
Received: by outflank-mailman (input) for mailman id 1111045;
 Thu, 04 Sep 2025 22: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 1uuILB-0000yC-PJ
 for xen-changelog@lists.xenproject.org; Thu, 04 Sep 2025 22: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 1uuILB-006SOk-1C
 for xen-changelog@lists.xenproject.org;
 Thu, 04 Sep 2025 22:22:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uuILB-00GDPF-1l
 for xen-changelog@lists.xenproject.org;
 Thu, 04 Sep 2025 22: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=ISHfdHjUH/nQwbRqrRw/Kp5g3NKyYxiVogOszqXHk3Q=; b=dyuyfFeEK/a2mHrGMbCix3riT7
	ZbMxiWJ7o1TyK8k4WgIOgyr1lnknk1pXiFNMEBHXZFvASugmX76ezdDZwpcjpUhR2SQLylsqGO5/3
	INqzcz/WNXyq1+SzWpngpXi4wHVYmjTVDAuXImzITsugnCUM6uzZcHvGZdAHDXLssbys=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/domain: unify domain ID allocation
Message-Id: <E1uuILB-00GDPF-1l@xenbits.xenproject.org>
Date: Thu, 04 Sep 2025 22:22:01 +0000

commit 2d506506071036cfb29bcbc60ef4d748aba60363
Author:     Denis Mukhin <dmukhin@ford.com>
AuthorDate: Fri Aug 29 16:21:29 2025 -0700
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Thu Sep 4 13:36:17 2025 -0700

    xen/domain: unify domain ID allocation
    
    Currently, there are two different domain ID allocation implementations:
    
      1) Sequential IDs allocation in dom0less Arm code based on max_init_domid;
    
      2) Sequential IDs allocation in XEN_DOMCTL_createdomain; does not use
         max_init_domid (both Arm and x86).
    
    The domain ID allocation covers dom0 or late hwdom, predefined domains,
    post-boot domains, excluding Xen system domains (domid >=
    DOMID_FIRST_RESERVED).
    
    It makes sense to have a common helper code for such task across architectures
    (Arm and x86) and between dom0less / toolstack domU allocation.
    
    Note, fixing dependency on max_init_domid is out of scope of this patch.
    
    Wrap the domain ID allocation as an arch-independent function domid_alloc() in
    new common/domid.c based on the bitmap.
    
    Allocation algorithm:
    - If an explicit domain ID is provided, verify its availability and use it if
      ID is not used;
    - If DOMID_INVALID is provided, search the range [1..DOMID_FIRST_RESERVED-1],
      starting from the last used ID.
      Implementation guarantees that two consecutive calls will never return the
      same ID. ID#0 is reserved for the first boot domain (currently, dom0) and
      excluded from the allocation range.
    
    Remove is_free_domid() helper as it is not needed now.
    
    No functional change intended.
    
    Signed-off-by: Denis Mukhin <dmukhin@ford.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Alejandro Vallejo <alejandro.garciavallejo@amd.com>
---
 xen/arch/arm/domain_build.c             |  7 ++-
 xen/arch/x86/setup.c                    |  7 ++-
 xen/common/Makefile                     |  1 +
 xen/common/device-tree/dom0less-build.c | 15 +++---
 xen/common/domain.c                     |  2 +
 xen/common/domctl.c                     | 43 +++------------
 xen/common/domid.c                      | 95 +++++++++++++++++++++++++++++++++
 xen/include/xen/domain.h                |  3 ++
 8 files changed, 126 insertions(+), 47 deletions(-)

diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index 039aa71439..373d4b516f 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -2058,6 +2058,7 @@ void __init create_dom0(void)
         .grant_opts = XEN_DOMCTL_GRANT_version(opt_gnttab_max_version),
     };
     unsigned int flags = CDF_privileged | CDF_hardware;
+    domid_t domid;
     int rc;
 
     /* The vGIC for DOM0 is exactly emulating the hardware GIC */
@@ -2082,7 +2083,11 @@ void __init create_dom0(void)
     if ( !llc_coloring_enabled )
         flags |= CDF_directmap;
 
-    dom0 = domain_create(0, &dom0_cfg, flags);
+    domid = domid_alloc(0);
+    if ( domid == DOMID_INVALID )
+        panic("Error allocating domain ID 0\n");
+
+    dom0 = domain_create(domid, &dom0_cfg, flags);
     if ( IS_ERR(dom0) )
         panic("Error creating domain 0 (rc = %ld)\n", PTR_ERR(dom0));
 
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index a810bdf6d3..6afe39399b 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -1036,8 +1036,11 @@ static struct domain *__init create_dom0(struct boot_info *bi)
     if ( iommu_enabled )
         dom0_cfg.flags |= XEN_DOMCTL_CDF_iommu;
 
-    /* Create initial domain.  Not d0 for pvshim. */
-    bd->domid = get_initial_domain_id();
+    /* Allocate initial domain ID.  Not d0 for pvshim. */
+    bd->domid = domid_alloc(get_initial_domain_id());
+    if ( bd->domid == DOMID_INVALID )
+        panic("Error allocating domain ID %u\n", get_initial_domain_id());
+
     d = domain_create(bd->domid, &dom0_cfg,
                       pv_shim ? 0 : CDF_privileged | CDF_hardware);
     if ( IS_ERR(d) )
diff --git a/xen/common/Makefile b/xen/common/Makefile
index c316957fcb..0c7d0f5d46 100644
--- a/xen/common/Makefile
+++ b/xen/common/Makefile
@@ -11,6 +11,7 @@ obj-$(filter-out $(CONFIG_X86),$(CONFIG_ACPI)) += device.o
 obj-$(CONFIG_DEVICE_TREE_PARSE) += device-tree/
 obj-$(CONFIG_IOREQ_SERVER) += dm.o
 obj-y += domain.o
+obj-y += domid.o
 obj-y += event_2l.o
 obj-y += event_channel.o
 obj-$(CONFIG_EVTCHN_FIFO) += event_fifo.o
diff --git a/xen/common/device-tree/dom0less-build.c b/xen/common/device-tree/dom0less-build.c
index aaa5e9b22c..9fd004c42a 100644
--- a/xen/common/device-tree/dom0less-build.c
+++ b/xen/common/device-tree/dom0less-build.c
@@ -838,6 +838,7 @@ void __init create_domUs(void)
     {
         struct kernel_info ki = KERNEL_INFO_INIT;
         int rc = parse_dom0less_node(node, &ki.bd);
+        domid_t domid;
 
         if ( rc == -ENOENT )
             continue;
@@ -847,13 +848,13 @@ void __init create_domUs(void)
         if ( (max_init_domid + 1) >= DOMID_FIRST_RESERVED )
             panic("No more domain IDs available\n");
 
-        /*
-         * The variable max_init_domid is initialized with zero, so here it's
-         * very important to use the pre-increment operator to call
-         * domain_create() with a domid > 0. (domid == 0 is reserved for Dom0)
-         */
-        ki.bd.d = domain_create(++max_init_domid,
-                                &ki.bd.create_cfg, ki.bd.create_flags);
+        domid = domid_alloc(DOMID_INVALID);
+        if ( domid == DOMID_INVALID )
+            panic("Error allocating ID for domain %s\n", dt_node_name(node));
+
+        max_init_domid = max(max_init_domid, domid);
+
+        ki.bd.d = domain_create(domid, &ki.bd.create_cfg, ki.bd.create_flags);
         if ( IS_ERR(ki.bd.d) )
             panic("Error creating domain %s (rc = %ld)\n",
                   dt_node_name(node), PTR_ERR(ki.bd.d));
diff --git a/xen/common/domain.c b/xen/common/domain.c
index 104e917f07..775c339285 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -692,6 +692,8 @@ static void _domain_destroy(struct domain *d)
 
     lock_profile_deregister_struct(LOCKPROF_TYPE_PERDOM, d);
 
+    domid_free(d->domain_id);
+
     free_domain_struct(d);
 }
 
diff --git a/xen/common/domctl.c b/xen/common/domctl.c
index f2a7caaf85..71e712c1f3 100644
--- a/xen/common/domctl.c
+++ b/xen/common/domctl.c
@@ -51,20 +51,6 @@ static int xenctl_bitmap_to_nodemask(nodemask_t *nodemask,
                                    MAX_NUMNODES);
 }
 
-static inline int is_free_domid(domid_t dom)
-{
-    struct domain *d;
-
-    if ( dom >= DOMID_FIRST_RESERVED )
-        return 0;
-
-    if ( (d = rcu_lock_domain_by_id(dom)) == NULL )
-        return 1;
-
-    rcu_unlock_domain(d);
-    return 0;
-}
-
 void getdomaininfo(struct domain *d, struct xen_domctl_getdomaininfo *info)
 {
     struct vcpu *v;
@@ -423,36 +409,19 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl)
 
     case XEN_DOMCTL_createdomain:
     {
-        domid_t        dom;
-        static domid_t rover = 0;
+        /* NB: ID#0 is reserved, find the first suitable ID instead. */
+        domid_t domid = domid_alloc(op->domain ?: DOMID_INVALID);
 
-        dom = op->domain;
-        if ( (dom > 0) && (dom < DOMID_FIRST_RESERVED) )
+        if ( domid == DOMID_INVALID )
         {
             ret = -EEXIST;
-            if ( !is_free_domid(dom) )
-                break;
-        }
-        else
-        {
-            for ( dom = rover + 1; dom != rover; dom++ )
-            {
-                if ( dom == DOMID_FIRST_RESERVED )
-                    dom = 1;
-                if ( is_free_domid(dom) )
-                    break;
-            }
-
-            ret = -ENOMEM;
-            if ( dom == rover )
-                break;
-
-            rover = dom;
+            break;
         }
 
-        d = domain_create(dom, &op->u.createdomain, false);
+        d = domain_create(domid, &op->u.createdomain, false);
         if ( IS_ERR(d) )
         {
+            domid_free(domid);
             ret = PTR_ERR(d);
             d = NULL;
             break;
diff --git a/xen/common/domid.c b/xen/common/domid.c
new file mode 100644
index 0000000000..2387ddb083
--- /dev/null
+++ b/xen/common/domid.c
@@ -0,0 +1,95 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Domain ID allocator.
+ *
+ * Covers dom0 or late hwdom, predefined domains, post-boot domains.
+ * Excludes system domains (ID >= DOMID_FIRST_RESERVED).
+ *
+ * Copyright 2025 Ford Motor Company
+ */
+
+#include <xen/domain.h>
+
+static DEFINE_SPINLOCK(domid_lock);
+static DECLARE_BITMAP(domid_bitmap, DOMID_FIRST_RESERVED);
+
+/*
+ * Allocate domain ID.
+ *
+ * @param domid Domain ID hint:
+ * - If an explicit domain ID is provided, verify its availability and use it
+ *   if ID is not used;
+ * - If DOMID_INVALID is provided, search [1..DOMID_FIRST_RESERVED-1] range,
+ *   starting from the last used ID. Implementation guarantees that two
+ *   consecutive calls will never return the same ID. ID#0 is reserved for
+ *   the first boot domain (currently, dom0) and excluded from the allocation
+ *   range.
+ * @return Valid domain ID in case of successful allocation,
+ *         DOMID_INVALID - otherwise.
+ */
+domid_t domid_alloc(domid_t domid)
+{
+    static domid_t domid_last;
+
+    spin_lock(&domid_lock);
+
+    /* Exact match. */
+    if ( domid < DOMID_FIRST_RESERVED )
+    {
+        if ( __test_and_set_bit(domid, domid_bitmap) )
+            domid = DOMID_INVALID;
+    }
+    /*
+     * Exhaustive search.
+     *
+     * Domain ID#0 is reserved for the first boot domain (e.g. control domain)
+     * and excluded from allocation.
+     */
+    else
+    {
+        domid_t bound = DOMID_FIRST_RESERVED;
+
+        domid = find_next_zero_bit(domid_bitmap, bound, domid_last + 1);
+        if ( domid >= bound && domid_last != 0 )
+        {
+            bound = domid_last + 1;
+            domid = find_next_zero_bit(domid_bitmap, bound, 1);
+        }
+
+        ASSERT(domid <= DOMID_FIRST_RESERVED);
+        if ( domid < bound )
+        {
+            __set_bit(domid, domid_bitmap);
+            domid_last = domid;
+        }
+        else
+            domid = DOMID_INVALID;
+    }
+
+    spin_unlock(&domid_lock);
+
+    return domid;
+}
+
+void domid_free(domid_t domid)
+{
+    int rc;
+
+    ASSERT(domid <= DOMID_FIRST_RESERVED);
+
+    spin_lock(&domid_lock);
+    rc = __test_and_clear_bit(domid, domid_bitmap);
+    spin_unlock(&domid_lock);
+
+    ASSERT(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/include/xen/domain.h b/xen/include/xen/domain.h
index e10baf2615..8aab05ae93 100644
--- a/xen/include/xen/domain.h
+++ b/xen/include/xen/domain.h
@@ -38,6 +38,9 @@ void arch_get_domain_info(const struct domain *d,
 
 domid_t get_initial_domain_id(void);
 
+domid_t domid_alloc(domid_t domid);
+void domid_free(domid_t domid);
+
 /* CDF_* constant. Internal flags for domain creation. */
 /* Is this a privileged domain? */
 #define CDF_privileged           (1U << 0)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Sep 04 22:22:12 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Sep 2025 22:22:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1111046.1459981 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uuILM-000104-30; Thu, 04 Sep 2025 22:22:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1111046.1459981; Thu, 04 Sep 2025 22: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 1uuILM-0000zx-0P; Thu, 04 Sep 2025 22:22:12 +0000
Received: by outflank-mailman (input) for mailman id 1111046;
 Thu, 04 Sep 2025 22: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 1uuILL-0000zr-NH
 for xen-changelog@lists.xenproject.org; Thu, 04 Sep 2025 22: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 1uuILL-006SOo-1Y
 for xen-changelog@lists.xenproject.org;
 Thu, 04 Sep 2025 22:22:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uuILL-00GDPg-24
 for xen-changelog@lists.xenproject.org;
 Thu, 04 Sep 2025 22: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=EIBn2cd/CPoyVwbIr51w2p3IjcfIhPBrtevtlE676Gs=; b=LHl0lWahOr4lHfjPeDYiR3GVlH
	KtkukQ4euzImDTm9V9wE/R8a/zOJ6qxAETMwGy9RUgzznXEBRhH17rsk6UWCNMc6xMrUa3w+HUDjb
	wPyZE3X3lXT+OQrFvm+RBo3LZ9jeU1oDWOoZbKOH48yf8rePyn66ANo/jemRhkDGhSAw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/tests: introduce unit tests for domain ID allocator
Message-Id: <E1uuILL-00GDPg-24@xenbits.xenproject.org>
Date: Thu, 04 Sep 2025 22:22:11 +0000

commit b3d31533a0474b860d118e872c7ccdabacc2f194
Author:     Denis Mukhin <dmukhin@ford.com>
AuthorDate: Fri Aug 29 16:21:31 2025 -0700
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Thu Sep 4 13:37:18 2025 -0700

    tools/tests: introduce unit tests for domain ID allocator
    
    Introduce some basic infrastructure for doing domain ID allocation unit tests,
    and add a few tests that ensure correctness of the domain ID allocator.
    
    Use <xen-tools/bitops.h> and xen/lib/find-next-bit.c in test hardness code.
    
    Adjust find-next-bit.c to be compiled with __XEN_TOOLS__.
    
    Signed-off-by: Denis Mukhin <dmukhin@ford.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
---
 tools/include/xen-tools/bitops.h | 10 +++++
 tools/tests/Makefile             |  1 +
 tools/tests/domid/.gitignore     |  2 +
 tools/tests/domid/Makefile       | 88 +++++++++++++++++++++++++++++++++++++
 tools/tests/domid/harness.h      | 54 +++++++++++++++++++++++
 tools/tests/domid/test-domid.c   | 95 ++++++++++++++++++++++++++++++++++++++++
 xen/lib/find-next-bit.c          |  5 +++
 7 files changed, 255 insertions(+)

diff --git a/tools/include/xen-tools/bitops.h b/tools/include/xen-tools/bitops.h
index 681482f675..3b98fba6d7 100644
--- a/tools/include/xen-tools/bitops.h
+++ b/tools/include/xen-tools/bitops.h
@@ -12,6 +12,16 @@
 #define BITS_PER_LONG 32
 #endif
 
+#define ffsl(x)       __builtin_ffsl(x)
+
+#define BIT_WORD(nr)  ((nr) / BITS_PER_LONG)
+
+#define BITS_TO_LONGS(bits) \
+    (((bits) + BITS_PER_LONG - 1) / BITS_PER_LONG)
+
+#define DECLARE_BITMAP(name, bits) \
+    unsigned long name[BITS_TO_LONGS(bits)]
+
 #define BITMAP_ENTRY(_nr,_bmap) ((_bmap))[(_nr) / 8]
 #define BITMAP_SHIFT(_nr) ((_nr) % 8)
 
diff --git a/tools/tests/Makefile b/tools/tests/Makefile
index 97ba2a1389..ac57373646 100644
--- a/tools/tests/Makefile
+++ b/tools/tests/Makefile
@@ -2,6 +2,7 @@ XEN_ROOT = $(CURDIR)/../..
 include $(XEN_ROOT)/tools/Rules.mk
 
 SUBDIRS-y :=
+SUBDIRS-y += domid
 SUBDIRS-y += resource
 SUBDIRS-$(CONFIG_X86) += cpu-policy
 SUBDIRS-$(CONFIG_X86) += tsx
diff --git a/tools/tests/domid/.gitignore b/tools/tests/domid/.gitignore
new file mode 100644
index 0000000000..37d773103b
--- /dev/null
+++ b/tools/tests/domid/.gitignore
@@ -0,0 +1,2 @@
+generated
+test-domid
diff --git a/tools/tests/domid/Makefile b/tools/tests/domid/Makefile
new file mode 100644
index 0000000000..22f1f15d11
--- /dev/null
+++ b/tools/tests/domid/Makefile
@@ -0,0 +1,88 @@
+# SPDX-License-Identifier: GPL-2.0-only
+#
+# Unit tests for domain ID allocator.
+#
+# Copyright 2025 Ford Motor Company
+
+XEN_ROOT=$(CURDIR)/../../..
+include $(XEN_ROOT)/tools/Rules.mk
+
+TESTS := test-domid
+
+define list-c-headers
+$(shell sed -n -E \
+    's/^[ \t]*# *include[ \t]*[<"]([^">]+)[">].*/\1/p' $(1) 2>/dev/null)
+endef
+
+# NB: $1 cannot be a list
+define emit-harness-nested-rule
+$(1): $(CURDIR)/harness.h
+	mkdir -p $$(@D);
+	ln -sf $$< $$@;
+
+endef
+
+define emit-harness-rules
+$(foreach x,$(2),$(call emit-harness-nested-rule,$(CURDIR)/generated/$(x)))
+$(1:.c=.o): $(addprefix $(CURDIR)/generated/,$(2))
+endef
+
+define emit-harness-deps
+$(if $(strip $(2)),$(call emit-harness-rules,$1,$2),)
+endef
+
+define vpath-with-harness-deps
+vpath $(1) $(2)
+$(call emit-harness-deps,$(1),$(call list-c-headers,$(2)$(1)))
+endef
+
+.PHONY: all
+all: $(TESTS)
+
+.PHONY: run
+run: $(TESTS)
+	set -e; $(foreach t,$(TESTS),./$(t);)
+
+.PHONY: clean
+clean:
+	$(RM) -r generated
+	$(RM) -- *.o $(TESTS) $(DEPS_RM)
+
+.PHONY: distclean
+distclean: clean
+	$(RM) -- *~
+
+.PHONY: install
+install: all
+	$(INSTALL_DIR) $(DESTDIR)$(LIBEXEC)/tests
+	$(INSTALL_PROG) test-domid $(DESTDIR)$(LIBEXEC)/tests
+
+.PHONY: uninstall
+uninstall:
+	$(RM) -- $(DESTDIR)$(LIBEXEC)/tests/test-domid
+
+CFLAGS += -D__XEN_TOOLS__
+# find-next-bit.c
+CFLAGS += '-DEXPORT_SYMBOL(x)=' \
+          -Dfind_first_bit \
+          -Dfind_first_zero_bit \
+          -Dfind_next_bit \
+          -Dfind_next_bit_le \
+          -Dfind_next_zero_bit_le
+CFLAGS += $(APPEND_CFLAGS)
+CFLAGS += $(CFLAGS_xeninclude)
+CFLAGS += -I./generated/
+
+LDFLAGS += $(APPEND_LDFLAGS)
+
+vpath find-next-bit.c $(XEN_ROOT)/xen/lib/
+
+# Point to the hypervisor code and generate test harness dependencies
+# on the fly, making it possible to compile parts of the hypervisor
+# within a mocked environment.
+$(eval $(call vpath-with-harness-deps,domid.c,$(XEN_ROOT)/xen/common/))
+
+test-domid: domid.o find-next-bit.o test-domid.o
+	$(CC) $^ -o $@ $(LDFLAGS)
+
+-include $(DEPS_INCLUDE)
diff --git a/tools/tests/domid/harness.h b/tools/tests/domid/harness.h
new file mode 100644
index 0000000000..17eb22a9a8
--- /dev/null
+++ b/tools/tests/domid/harness.h
@@ -0,0 +1,54 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Unit test harness for domain ID allocator.
+ *
+ * Copyright 2025 Ford Motor Company
+ */
+
+#ifndef _TEST_HARNESS_
+#define _TEST_HARNESS_
+
+#include <assert.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdio.h>
+
+#include <xen-tools/common-macros.h>
+#include <xen-tools/bitops.h>
+
+typedef bool spinlock_t;
+typedef uint16_t domid_t;
+
+extern domid_t domid_alloc(domid_t domid);
+extern void domid_free(domid_t domid);
+
+extern unsigned long find_next_zero_bit(const unsigned long *addr,
+                                        unsigned long size,
+                                        unsigned long offset);
+
+#define __test_and_set_bit(nr, addr)    test_and_set_bit(nr, addr)
+#define __test_and_clear_bit(nr, addr)  test_and_clear_bit(nr, addr)
+#define __set_bit(nr, addr)             set_bit(nr, addr)
+
+#define BUG_ON(x)                       assert(!(x))
+#define ASSERT(x)                       assert(x)
+
+#define DEFINE_SPINLOCK(l)              spinlock_t l
+#define spin_lock(l)                    (assert(!*(l)), *(l) = true)
+#define spin_unlock(l)                  (assert(*(l)), *(l) = false)
+
+#define printk                          printf
+
+#define DOMID_FIRST_RESERVED            (100)
+#define DOMID_INVALID                   (101)
+
+#endif /* _TEST_HARNESS_ */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff --git a/tools/tests/domid/test-domid.c b/tools/tests/domid/test-domid.c
new file mode 100644
index 0000000000..5915c4699a
--- /dev/null
+++ b/tools/tests/domid/test-domid.c
@@ -0,0 +1,95 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Unit tests for domain ID allocator.
+ *
+ * Copyright 2025 Ford Motor Company
+ */
+
+#include <sysexits.h>
+
+#include "harness.h"
+
+#define verify(exp, fmt, args...) \
+while (!(exp)) { \
+    printf(fmt, ## args); \
+    exit(EX_SOFTWARE); \
+}
+
+/*
+ * Fail on the first error, since tests are dependent on each other.
+ */
+int main(int argc, char **argv)
+{
+    domid_t expected, allocated;
+
+    /* Test ID cannot be allocated twice. */
+    for ( expected = 0; expected < DOMID_FIRST_RESERVED; expected++ )
+    {
+        allocated = domid_alloc(expected);
+        verify(allocated == expected,
+               "TEST 1: expected %u allocated %u\n", expected, allocated);
+    }
+    for ( expected = 0; expected < DOMID_FIRST_RESERVED; expected++ )
+    {
+        allocated = domid_alloc(expected);
+        verify(allocated == DOMID_INVALID,
+               "TEST 2: expected %u allocated %u\n", DOMID_INVALID, allocated);
+    }
+
+    /* Ensure all IDs, including ID#0 are not allocated. */
+    for ( expected = 0; expected < DOMID_FIRST_RESERVED; expected++ )
+        domid_free(expected);
+
+    /*
+     * Test that that two consecutive calls of domid_alloc(DOMID_INVALID)
+     * will never return the same ID.
+     * NB: ID#0 is reserved and shall not be allocated by
+     * domid_alloc(DOMID_INVALID).
+     */
+    for ( expected = 1; expected < DOMID_FIRST_RESERVED; expected++ )
+    {
+        allocated = domid_alloc(DOMID_INVALID);
+        verify(allocated == expected,
+               "TEST 3: expected %u allocated %u\n", expected, allocated);
+    }
+    for ( expected = 1; expected < DOMID_FIRST_RESERVED; expected++ )
+    {
+        allocated = domid_alloc(DOMID_INVALID);
+        verify(allocated == DOMID_INVALID,
+               "TEST 4: expected %u allocated %u\n", DOMID_INVALID, allocated);
+    }
+
+    /* Re-allocate first ID from [1..DOMID_FIRST_RESERVED/2]. */
+    for ( expected = 1; expected < DOMID_FIRST_RESERVED / 2; expected++ )
+        domid_free(expected);
+    for ( expected = 1; expected < DOMID_FIRST_RESERVED / 2; expected++ )
+    {
+        allocated = domid_alloc(DOMID_INVALID);
+        verify(allocated == expected,
+               "TEST 5: expected %u allocated %u\n", expected, allocated);
+    }
+
+    /* Re-allocate last ID from [1..DOMID_FIRST_RESERVED - 1]. */
+    expected = DOMID_FIRST_RESERVED - 1;
+    domid_free(DOMID_FIRST_RESERVED - 1);
+    allocated = domid_alloc(DOMID_INVALID);
+    verify(allocated == expected,
+           "TEST 6: expected %u allocated %u\n", expected, allocated);
+
+    /* Allocate an invalid ID. */
+    expected = DOMID_INVALID;
+    allocated = domid_alloc(DOMID_FIRST_RESERVED);
+    verify(allocated == expected,
+           "TEST 7: expected %u allocated %u\n", expected, allocated);
+
+    return 0;
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff --git a/xen/lib/find-next-bit.c b/xen/lib/find-next-bit.c
index 9b8d7814f2..539c7f2022 100644
--- a/xen/lib/find-next-bit.c
+++ b/xen/lib/find-next-bit.c
@@ -8,8 +8,13 @@
  * as published by the Free Software Foundation; either version
  * 2 of the License, or (at your option) any later version.
  */
+
+#ifdef __XEN_TOOLS__
+#include <xen-tools/bitops.h>
+#else
 #include <xen/bitops.h>
 #include <xen/byteorder.h>
+#endif
 
 #define __ffs(x) (ffsl(x) - 1)
 #define ffz(x) __ffs(~(x))
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Sep 04 22:22:23 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Sep 2025 22:22:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1111048.1459985 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uuILX-000135-62; Thu, 04 Sep 2025 22:22:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1111048.1459985; Thu, 04 Sep 2025 22: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 1uuILX-00012x-3L; Thu, 04 Sep 2025 22:22:23 +0000
Received: by outflank-mailman (input) for mailman id 1111048;
 Thu, 04 Sep 2025 22: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 1uuILV-00012o-QH
 for xen-changelog@lists.xenproject.org; Thu, 04 Sep 2025 22: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 1uuILV-006SOs-1r
 for xen-changelog@lists.xenproject.org;
 Thu, 04 Sep 2025 22:22:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uuILV-00GDQ9-2Q
 for xen-changelog@lists.xenproject.org;
 Thu, 04 Sep 2025 22: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=bbBQnUhFU2gjhQyLPmkI7JMp9rECzb+Z+WYoAPZ/XLY=; b=L/LH1/oNYevjGWpC0fUOMqkUoG
	CoMt4SwpJaJJ6PD79Kh/aZMIUVw6b9tfITD9gfQUXqpKuIJXicPpJyeCogU7hbewSJXCWZaBc+SeH
	ZFG3zuAqeHgOn+/PijwQlrSYdSsQXnSA8WnDSA/0XH4bMQcGVrhQLKQB0O8/FZq+PwPs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/domain: update create_dom0() messages
Message-Id: <E1uuILV-00GDQ9-2Q@xenbits.xenproject.org>
Date: Thu, 04 Sep 2025 22:22:21 +0000

commit 5104e05904b0c123ec58125ee8a85fadbb78cc9f
Author:     Denis Mukhin <dmukhin@ford.com>
AuthorDate: Fri Aug 29 16:21:32 2025 -0700
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Thu Sep 4 13:37:21 2025 -0700

    xen/domain: update create_dom0() messages
    
    Use %pd for domain identification in error/panic messages in create_dom0().
    
    No functional change.
    
    Signed-off-by: Denis Mukhin <dmukhin@ford.com>
    Reviewed-by: Alejandro Vallejo <alejandro.garciavallejo@amd.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/domain_build.c | 6 +++---
 xen/arch/x86/setup.c        | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index 373d4b516f..89448fb475 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -2092,14 +2092,14 @@ void __init create_dom0(void)
         panic("Error creating domain 0 (rc = %ld)\n", PTR_ERR(dom0));
 
     if ( llc_coloring_enabled && (rc = dom0_set_llc_colors(dom0)) )
-        panic("Error initializing LLC coloring for domain 0 (rc = %d)\n", rc);
+        panic("Error initializing LLC coloring for %pd (rc = %d)\n", dom0, rc);
 
     if ( vcpu_create(dom0, 0) == NULL )
-        panic("Error creating domain 0 vcpu0\n");
+        panic("Error creating %pdv0\n", dom0);
 
     rc = construct_dom0(dom0);
     if ( rc )
-        panic("Could not set up DOM0 guest OS (rc = %d)\n", rc);
+        panic("Could not set up %pd guest OS (rc = %d)\n", dom0, rc);
 
     set_xs_domain(dom0);
 }
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 6afe39399b..872a8c63f9 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -1073,7 +1073,7 @@ static struct domain *__init create_dom0(struct boot_info *bi)
 
         if ( (strlen(acpi_param) == 0) && acpi_disabled )
         {
-            printk("ACPI is disabled, notifying Domain 0 (acpi=off)\n");
+            printk("ACPI is disabled, notifying %pd (acpi=off)\n", d);
             safe_strcpy(acpi_param, "off");
         }
 
@@ -1088,7 +1088,7 @@ static struct domain *__init create_dom0(struct boot_info *bi)
 
     bd->d = d;
     if ( construct_dom0(bd) != 0 )
-        panic("Could not construct domain 0\n");
+        panic("Could not construct %pd\n", d);
 
     bd->cmdline = NULL;
     xfree(cmdline);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Sep 05 05:55:07 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 05 Sep 2025 05:55:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1111265.1460019 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uuPPb-0001lE-5p; Fri, 05 Sep 2025 05:55:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1111265.1460019; Fri, 05 Sep 2025 05: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 1uuPPb-0001l5-2z; Fri, 05 Sep 2025 05:55:03 +0000
Received: by outflank-mailman (input) for mailman id 1111265;
 Fri, 05 Sep 2025 05: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 1uuPPa-0001kz-51
 for xen-changelog@lists.xenproject.org; Fri, 05 Sep 2025 05: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 1uuPPZ-007nTI-2a
 for xen-changelog@lists.xenproject.org;
 Fri, 05 Sep 2025 05:55:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uuPPZ-00Gbml-36
 for xen-changelog@lists.xenproject.org;
 Fri, 05 Sep 2025 05: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=JrEOySTa0mSCjzqYXKG3s555ddkgadFjb/4vC6J2A2Y=; b=P1P756gLb1erKc64x+8LAlSeJ8
	ulHa3spuRu1g5zdv89qwlOw5m5pCkh2PcqktyDNyDh62/IR1dJ/MkbDLTgyYRdpUUh0mAxC4KpWh3
	61Kf2vJ3h7FNHlKVUp0uK3PhvihPfRLLA8PsDwEU+XPbTzSj3SqvdmRsrZ5iT9Gty7eg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] docs/sending-patches: document "Amends:" tag
Message-Id: <E1uuPPZ-00Gbml-36@xenbits.xenproject.org>
Date: Fri, 05 Sep 2025 05:55:01 +0000

commit c08845e230f160d8b25347a4df68c2195dd03e4b
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Sep 4 16:54:47 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Sep 4 16:54:47 2025 +0200

    docs/sending-patches: document "Amends:" tag
    
    On rare occasions Fixes: isn't quite appropriate to use, yet another
    commit still wants making a connection to in a formalized way. Such could
    e.g. happen if a pretty obvious optimization was left out (which isn't a
    bug, but still a shortcoming). Formalize Amends: as a tage to use in such
    a situation.
    
    Requested-by: Roger Pau Monné <roger.pau@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Michal Orzel <michal.orzel@amd.com>
---
 docs/process/sending-patches.pandoc | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/docs/process/sending-patches.pandoc b/docs/process/sending-patches.pandoc
index 1991932b68..798ecceb39 100644
--- a/docs/process/sending-patches.pandoc
+++ b/docs/process/sending-patches.pandoc
@@ -42,7 +42,7 @@ should be mentioned.
 
 When referencing other patches (e.g. `similar to patch xy ...`) those
 patches should be referenced via their commit id (at least 12 digits)
-and the patch subject, if the very same patch isn't referenced by the
+and the patch subject, if the very same patch isn't referenced by e.g. a
 `Fixes:` tag, too:
 
     Similar to commit 67d01cdb5518 ("x86: infrastructure to allow converting
@@ -106,6 +106,12 @@ If git was configured as explained earlier, this can be retrieved using
 ``git log --pretty=fixes`` otherwise ``git log --abbrev=12 --oneline`` will
 give the proper tag and commit-id.
 
+### Amends:
+
+If your patch doesn't quite fix a bug, but still amends a specific commit,
+e.g. because an omission was found, please consider using an `Amends:` tag.
+See the `Fixes:` tag description above for how to use it.
+
 ### Resolves:
 
 If your patch addresses an issue logged in a GitLab ticket, use the `Resolves:`
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Sep 05 05:55:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 05 Sep 2025 05:55:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1111267.1460025 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uuPPl-0001nQ-8h; Fri, 05 Sep 2025 05:55:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1111267.1460025; Fri, 05 Sep 2025 05: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 1uuPPl-0001nI-4T; Fri, 05 Sep 2025 05:55:13 +0000
Received: by outflank-mailman (input) for mailman id 1111267;
 Fri, 05 Sep 2025 05: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 1uuPPk-0001n5-7i
 for xen-changelog@lists.xenproject.org; Fri, 05 Sep 2025 05: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 1uuPPj-007nTO-39
 for xen-changelog@lists.xenproject.org;
 Fri, 05 Sep 2025 05:55:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uuPPk-00Gbn9-0G
 for xen-changelog@lists.xenproject.org;
 Fri, 05 Sep 2025 05: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=rWxuoqywIs9D8Wc1wHNplu5gdI6J6dCHe9b9NUj8KXY=; b=DKCtbNA4euNpY46TaU5cXCUa09
	4W+iO/j7Xk5l3zL/7F0RN1o8j24R2yMLamn8/t/e/HLKTwi5O9bUOpQh0xzH5iRfkMeYHgRA/XGLU
	CdIODqGdUtoQ8O6+AxXHsqoycGrnlxR8EW/cBpHTDslY3x5qAVOX4dDtRNSA661IR7UI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: add generic SCI subsystem
Message-Id: <E1uuPPk-00Gbn9-0G@xenbits.xenproject.org>
Date: Fri, 05 Sep 2025 05:55:12 +0000

commit e2cc10867b633b10b4ac65ddebca37421eec6882
Author:     Oleksii Moisieiev <Oleksii_Moisieiev@epam.com>
AuthorDate: Thu Sep 4 14:21:27 2025 +0000
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Thu Sep 4 12:11:43 2025 -0700

    xen/arm: add generic SCI subsystem
    
    This patch adds the basic framework for ARM SCI mediator. SCI is System
    Control Interface, which is designed to redirect requests from the Domains
    to ARM specific Firmware (for example SCMI). This will allow the devices,
    passed-through to the different Domains, to access to the System resources
    (such as clocks/resets etc) by sending requests to the firmware.
    
    ARM SCI subsystem allows to implement different SCI drivers to handle
    specific ARM firmware interfaces (like ARM SCMI) and mediate requests
    -between the Domains and the Firmware. Also it allows SCI drivers to perform
    proper action during Domain creation/destruction which is vital for
    handling use cases like Domain reboot.
    
    This patch introduces new DEVICE_FIRMWARE device subclass for probing SCI
    drivers basing on device tree, SCI drivers register itself with
    DT_DEVICE_START/END macro. On init - the SCI drivers should register its
    SCI ops with sci_register(). Only one SCI driver can be supported.
    
    At run-time, the following SCI API calls are introduced:
    
    - sci_domain_sanitise_config() called from arch_sanitise_domain_config()
    - sci_domain_init() called from arch_domain_create()
    - sci_relinquish_resources() called from domain_relinquish_resources()
    - sci_domain_destroy() called from arch_domain_destroy()
    - sci_handle_call() called from vsmccc_handle_call()
    - sci_dt_handle_node()
    - sci_dt_finalize() called from handle_node() (Dom0 DT)
    
    Signed-off-by: Oleksii Moisieiev <oleksii_moisieiev@epam.com>
    Signed-off-by: Grygorii Strashko <grygorii_strashko@epam.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 MAINTAINERS                             |   6 +
 xen/arch/arm/device.c                   |   5 +
 xen/arch/arm/dom0less-build.c           |   8 ++
 xen/arch/arm/domain.c                   |  12 +-
 xen/arch/arm/domain_build.c             |   8 ++
 xen/arch/arm/firmware/Kconfig           |   8 ++
 xen/arch/arm/firmware/Makefile          |   1 +
 xen/arch/arm/firmware/sci.c             | 154 ++++++++++++++++++++++++
 xen/arch/arm/include/asm/domain.h       |   5 +
 xen/arch/arm/include/asm/firmware/sci.h | 200 ++++++++++++++++++++++++++++++++
 xen/arch/arm/vsmc.c                     |   3 +-
 xen/common/device-tree/dom0less-build.c |   4 +
 xen/include/asm-generic/device.h        |   1 +
 xen/include/public/arch-arm.h           |   4 +
 xen/include/xen/dom0less-build.h        |   3 +
 15 files changed, 420 insertions(+), 2 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index c4886c1159..31dbba54bb 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -509,6 +509,12 @@ R:	George Dunlap <gwd@xenproject.org>
 S:	Supported
 F:	xen/common/sched/
 
+SCI MEDIATORS
+R:	Oleksii Moisieiev <oleksii_moisieiev@epam.com>
+S:	Supported
+F:	xen/arch/arm/firmware/sci.c
+F:	xen/arch/arm/include/asm/firmware/sci.h
+
 SEABIOS UPSTREAM
 M:	Wei Liu <wl@xen.org>
 S:	Supported
diff --git a/xen/arch/arm/device.c b/xen/arch/arm/device.c
index 11523750ae..74b54cad34 100644
--- a/xen/arch/arm/device.c
+++ b/xen/arch/arm/device.c
@@ -13,6 +13,7 @@
 #include <xen/iocap.h>
 #include <xen/lib.h>
 
+#include <asm/firmware/sci.h>
 #include <asm/setup.h>
 
 int map_irq_to_domain(struct domain *d, unsigned int irq,
@@ -303,6 +304,10 @@ int handle_device(struct domain *d, struct dt_device_node *dev, p2m_type_t p2mt,
                 return res;
             }
         }
+
+        res = sci_assign_dt_device(d, dev);
+        if ( res )
+            return res;
     }
 
     res = map_device_irqs_to_domain(d, dev, own_device, irq_ranges);
diff --git a/xen/arch/arm/dom0less-build.c b/xen/arch/arm/dom0less-build.c
index c8d07213e2..0094cf9e40 100644
--- a/xen/arch/arm/dom0less-build.c
+++ b/xen/arch/arm/dom0less-build.c
@@ -22,6 +22,7 @@
 
 #include <asm/arm64/sve.h>
 #include <asm/domain_build.h>
+#include <asm/firmware/sci.h>
 #include <asm/grant_table.h>
 #include <asm/setup.h>
 
@@ -272,6 +273,12 @@ int __init init_vuart(struct domain *d, struct kernel_info *kinfo,
     return rc;
 }
 
+int __init arch_handle_passthrough_prop(struct kernel_info *kinfo,
+                                        struct dt_device_node *node)
+{
+    return sci_assign_dt_device(kinfo->bd.d, node);
+}
+
 int __init arch_parse_dom0less_node(struct dt_device_node *node,
                                     struct boot_domain *bd)
 {
@@ -281,6 +288,7 @@ int __init arch_parse_dom0less_node(struct dt_device_node *node,
 
     d_cfg->arch.gic_version = XEN_DOMCTL_CONFIG_GIC_NATIVE;
     d_cfg->flags |= XEN_DOMCTL_CDF_hvm | XEN_DOMCTL_CDF_hap;
+    d_cfg->arch.arm_sci_type = XEN_DOMCTL_CONFIG_ARM_SCI_NONE;
 
     if ( !dt_property_read_u32(node, "nr_spis", &d_cfg->arch.nr_spis) )
     {
diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c
index 863ae18157..1a8585d02b 100644
--- a/xen/arch/arm/domain.c
+++ b/xen/arch/arm/domain.c
@@ -24,6 +24,7 @@
 #include <asm/platform.h>
 #include <asm/procinfo.h>
 #include <asm/regs.h>
+#include <asm/firmware/sci.h>
 #include <asm/tee/tee.h>
 #include <asm/vfp.h>
 #include <asm/vgic.h>
@@ -699,7 +700,7 @@ int arch_sanitise_domain_config(struct xen_domctl_createdomain *config)
         return -EINVAL;
     }
 
-    return 0;
+    return sci_domain_sanitise_config(config);
 }
 
 int arch_domain_create(struct domain *d,
@@ -791,6 +792,9 @@ int arch_domain_create(struct domain *d,
     d->arch.sve_vl = config->arch.sve_vl;
 #endif
 
+    if ( (rc = sci_domain_init(d, config)) != 0 )
+        goto fail;
+
     return 0;
 
 fail:
@@ -851,6 +855,7 @@ void arch_domain_destroy(struct domain *d)
     domain_vgic_free(d);
     domain_vuart_free(d);
     free_xenheap_page(d->shared_info);
+    sci_domain_destroy(d);
 #ifdef CONFIG_ACPI
     free_xenheap_pages(d->arch.efi_acpi_table,
                        get_order_from_bytes(d->arch.efi_acpi_len));
@@ -1044,6 +1049,7 @@ enum {
     PROG_p2m_root,
     PROG_p2m,
     PROG_p2m_pool,
+    PROG_sci,
     PROG_done,
 };
 
@@ -1103,6 +1109,10 @@ int domain_relinquish_resources(struct domain *d)
         ret = relinquish_p2m_mapping(d);
         if ( ret )
             return ret;
+    PROGRESS(sci):
+        ret = sci_relinquish_resources(d);
+        if ( ret )
+            return ret;
 
     PROGRESS(p2m_root):
         /*
diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index a9e4153e3c..039aa71439 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -28,6 +28,7 @@
 #include <asm/setup.h>
 #include <asm/tee/tee.h>
 #include <asm/pci.h>
+#include <asm/firmware/sci.h>
 #include <asm/platform.h>
 #include <asm/psci.h>
 #include <asm/setup.h>
@@ -1640,6 +1641,9 @@ static int __init handle_node(struct domain *d, struct kernel_info *kinfo,
         return 0;
     }
 
+    if ( sci_dt_handle_node(d, node) )
+        return 0;
+
     /*
      * The vGIC does not support routing hardware PPIs to guest. So
      * we need to skip any node using PPIs.
@@ -1740,6 +1744,10 @@ static int __init handle_node(struct domain *d, struct kernel_info *kinfo,
         if ( res )
             return res;
 
+        res = sci_dt_finalize(d, kinfo->fdt);
+        if ( res )
+            return res;
+
         /*
          * Create a second memory node to store the ranges covering
          * reserved-memory regions.
diff --git a/xen/arch/arm/firmware/Kconfig b/xen/arch/arm/firmware/Kconfig
index 817da745fd..fc7918c7fc 100644
--- a/xen/arch/arm/firmware/Kconfig
+++ b/xen/arch/arm/firmware/Kconfig
@@ -1,3 +1,11 @@
+config ARM_SCI
+	bool
+	depends on ARM
+	help
+	  This option enables generic Arm SCI (System Control Interface) mediators
+	  support. It allows domains to control system resources via one of
+	  Arm SCI mediators drivers implemented in XEN, like SCMI.
+
 menu "Firmware Drivers"
 
 config SCMI_SMC
diff --git a/xen/arch/arm/firmware/Makefile b/xen/arch/arm/firmware/Makefile
index a5e4542666..71bdefc24a 100644
--- a/xen/arch/arm/firmware/Makefile
+++ b/xen/arch/arm/firmware/Makefile
@@ -1 +1,2 @@
+obj-$(CONFIG_ARM_SCI) += sci.o
 obj-$(CONFIG_SCMI_SMC) += scmi-smc.o
diff --git a/xen/arch/arm/firmware/sci.c b/xen/arch/arm/firmware/sci.c
new file mode 100644
index 0000000000..aa93cda7f0
--- /dev/null
+++ b/xen/arch/arm/firmware/sci.c
@@ -0,0 +1,154 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Generic part of the SCI (System Control Interface) subsystem.
+ *
+ * Oleksii Moisieiev <oleksii_moisieiev@epam.com>
+ * Copyright (c) 2025 EPAM Systems
+ */
+
+#include <xen/acpi.h>
+#include <xen/errno.h>
+#include <xen/init.h>
+#include <xen/sched.h>
+#include <xen/types.h>
+
+#include <asm/firmware/sci.h>
+
+static const struct sci_mediator_ops __read_mostly *cur_mediator;
+
+int sci_register(const struct sci_mediator_ops *ops)
+{
+    if ( cur_mediator )
+        return -EEXIST;
+
+    if ( !ops->domain_init || !ops->domain_destroy || !ops->handle_call )
+        return -EINVAL;
+
+    cur_mediator = ops;
+
+    return 0;
+};
+
+bool sci_handle_call(struct cpu_user_regs *regs)
+{
+    if ( unlikely(!cur_mediator) )
+        return false;
+
+    return cur_mediator->handle_call(regs);
+}
+
+int sci_domain_init(struct domain *d, struct xen_domctl_createdomain *config)
+{
+    if ( !cur_mediator )
+        return 0;
+
+    return cur_mediator->domain_init(d, config);
+}
+
+int sci_domain_sanitise_config(struct xen_domctl_createdomain *config)
+{
+    if ( !cur_mediator )
+        return 0;
+
+    if ( !cur_mediator->domain_sanitise_config )
+        return 0;
+
+    return cur_mediator->domain_sanitise_config(config);
+}
+
+void sci_domain_destroy(struct domain *d)
+{
+    if ( !cur_mediator )
+        return;
+
+    cur_mediator->domain_destroy(d);
+}
+
+int sci_relinquish_resources(struct domain *d)
+{
+    if ( !cur_mediator )
+        return 0;
+
+    if ( !cur_mediator->relinquish_resources )
+        return 0;
+
+    return cur_mediator->relinquish_resources(d);
+}
+
+bool sci_dt_handle_node(struct domain *d, struct dt_device_node *node)
+{
+    if ( !cur_mediator )
+        return 0;
+
+    if ( !cur_mediator->dom0_dt_handle_node )
+        return 0;
+
+    return cur_mediator->dom0_dt_handle_node(d, node);
+}
+
+int sci_dt_finalize(struct domain *d, void *fdt)
+{
+    if ( !cur_mediator )
+        return 0;
+
+    if ( !cur_mediator->dom0_dt_finalize )
+        return 0;
+
+    return cur_mediator->dom0_dt_finalize(d, fdt);
+}
+
+int sci_assign_dt_device(struct domain *d, struct dt_device_node *dev)
+{
+    struct dt_phandle_args ac_spec;
+    int index = 0;
+    int ret;
+
+    if ( !cur_mediator )
+        return 0;
+
+    if ( !cur_mediator->assign_dt_device )
+        return 0;
+
+    while ( !dt_parse_phandle_with_args(dev, "access-controllers",
+                                        "#access-controller-cells", index,
+                                        &ac_spec) )
+    {
+        printk(XENLOG_DEBUG "sci: assign device %s to %pd\n",
+               dt_node_full_name(dev), d);
+
+        ret = cur_mediator->assign_dt_device(d, &ac_spec);
+        if ( ret )
+            return ret;
+
+        index++;
+    }
+
+    return 0;
+}
+
+static int __init sci_init(void)
+{
+    struct dt_device_node *np;
+    unsigned int num_sci = 0;
+    int rc;
+
+    dt_for_each_device_node(dt_host, np)
+    {
+        rc = device_init(np, DEVICE_FIRMWARE, NULL);
+        if ( !rc && num_sci )
+        {
+            printk(XENLOG_ERR
+                   "SCMI: Only one SCI controller is supported. found second %s\n",
+                   np->name);
+            return -EOPNOTSUPP;
+        }
+        else if ( !rc )
+            num_sci++;
+        else if ( rc != -EBADF && rc != -ENODEV )
+            return rc;
+    }
+
+    return 0;
+}
+
+__initcall(sci_init);
diff --git a/xen/arch/arm/include/asm/domain.h b/xen/arch/arm/include/asm/domain.h
index a3487ca713..af3e168374 100644
--- a/xen/arch/arm/include/asm/domain.h
+++ b/xen/arch/arm/include/asm/domain.h
@@ -120,6 +120,11 @@ struct arch_domain
 #ifdef CONFIG_TEE
     void *tee;
 #endif
+#ifdef CONFIG_ARM_SCI
+    bool sci_enabled;
+    /* ARM SCI driver's specific data */
+    void *sci_data;
+#endif
 
 }  __cacheline_aligned;
 
diff --git a/xen/arch/arm/include/asm/firmware/sci.h b/xen/arch/arm/include/asm/firmware/sci.h
new file mode 100644
index 0000000000..3500216bc2
--- /dev/null
+++ b/xen/arch/arm/include/asm/firmware/sci.h
@@ -0,0 +1,200 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Generic ARM SCI (System Control Interface) subsystem.
+ *
+ * Oleksii Moisieiev <oleksii_moisieiev@epam.com>
+ * Copyright (c) 2025 EPAM Systems
+ */
+
+#ifndef __ASM_ARM_SCI_H
+#define __ASM_ARM_SCI_H
+
+#include <xen/device_tree.h>
+#include <xen/errno.h>
+#include <xen/lib.h>
+#include <xen/sched.h>
+#include <xen/types.h>
+
+#ifdef CONFIG_ARM_SCI
+
+struct sci_mediator_ops {
+    /*
+     * Called during domain construction. If it is requested to enable
+     * SCI support, so SCI driver can create own structures for the new domain
+     * and inform firmware about new domain (if required).
+     * Mandatory.
+     */
+    int (*domain_init)(struct domain *d,
+                       struct xen_domctl_createdomain *config);
+
+    /*
+     * Called during domain construction. The SCI driver uses
+     * it to sanitize domain SCI configuration parameters.
+     * Optional.
+     */
+    int (*domain_sanitise_config)(struct xen_domctl_createdomain *config);
+
+    /*
+     * Called during domain destruction, releases all resources, that
+     * were allocated for domain.
+     * Mandatory.
+     */
+    void (*domain_destroy)(struct domain *d);
+
+    /*
+     * Called during domain destruction to relinquish resources used
+     * by SCI driver itself and request resources releasing from firmware.
+     * Optional.
+     */
+    int (*relinquish_resources)(struct domain *d);
+
+    /* SMC/HVC Handle callback */
+    bool (*handle_call)(struct cpu_user_regs *regs);
+
+    /*
+     * Dom0 DT nodes handling callback so SCI driver can detect DT nodes it
+     * need to handle and decide if those nodes need to be provided to Dom0.
+     * Optional.
+     */
+    bool (*dom0_dt_handle_node)(struct domain *d, struct dt_device_node *node);
+
+    /*
+     * SCI driver callback called at the end of Dom0 DT generation, so
+     * it can perform steps to modify DT to enable/disable SCI
+     * functionality for Dom0.
+     */
+    int (*dom0_dt_finalize)(struct domain *d, void *fdt);
+
+    /*
+     * SCI driver callback called when DT device is passed through to guest,
+     * so SCI driver can enable device access to the domain if SCI FW provides
+     * Device specific access control functionality.
+     * Optional.
+     */
+    int (*assign_dt_device)(struct domain *d, struct dt_phandle_args *ac_spec);
+};
+
+
+static inline bool sci_domain_is_enabled(struct domain *d)
+{
+    return d->arch.sci_enabled;
+}
+
+/*
+ * Register SCI subsystem ops.
+ *
+ * Register SCI drivers operation and so enable SCI functionality.
+ * Only one SCI driver is supported.
+ */
+int sci_register(const struct sci_mediator_ops *ops);
+
+/*
+ * Initialize SCI functionality for domain if configured.
+ *
+ * Initialization routine to enable SCI functionality for the domain.
+ * The SCI configuration data and decision about enabling SCI functionality
+ * for the domain is SCI driver specific.
+ */
+int sci_domain_init(struct domain *d, struct xen_domctl_createdomain *config);
+
+/*
+ * Sanitise domain configuration parameters.
+ *
+ */
+int sci_domain_sanitise_config(struct xen_domctl_createdomain *config);
+
+/*
+ * Destroy SCI domain instance.
+ */
+void sci_domain_destroy(struct domain *d);
+
+/*
+ * Free resources assigned to the certain domain.
+ */
+int sci_relinquish_resources(struct domain *d);
+
+/*
+ * SMC/HVC Handle callback.
+ *
+ * SCI driver acts as SMC/HVC server for the registered domains and
+ * does redirection of the domain calls to the SCI firmware,
+ * such as ARM TF-A or similar.
+ */
+bool sci_handle_call(struct cpu_user_regs *regs);
+
+/*
+ * Dom0 DT nodes handling function.
+ *
+ * Allows SCI driver to detect DT nodes it need to handle and decide if
+ * those nodes need to be provided to Dom0.
+ */
+bool sci_dt_handle_node(struct domain *d, struct dt_device_node *node);
+
+/*
+ * Dom0 DT generation finalize.
+ *
+ * Called at the end of Dom0 DT generation, so SCI driver can perform steps
+ * to modify DT to enable/disable SCI functionality for Dom0.
+ */
+int sci_dt_finalize(struct domain *d, void *fdt);
+
+/*
+ * Assign DT device to domain.
+ *
+ * Called when DT device is passed through to guest, so SCI driver can enable
+ * device access to the domain if SCI FW provides "Device specific access
+ * control" functionality.
+ */
+int sci_assign_dt_device(struct domain *d, struct dt_device_node *dev);
+#else
+
+static inline bool sci_domain_is_enabled(struct domain *d)
+{
+    return false;
+}
+
+static inline int sci_domain_init(struct domain *d,
+                                  struct xen_domctl_createdomain *config)
+{
+    return 0;
+}
+
+static inline int
+sci_domain_sanitise_config(struct xen_domctl_createdomain *config)
+{
+    return 0;
+}
+
+static inline void sci_domain_destroy(struct domain *d)
+{}
+
+static inline int sci_relinquish_resources(struct domain *d)
+{
+    return 0;
+}
+
+static inline bool sci_handle_call(struct cpu_user_regs *regs)
+{
+    return false;
+}
+
+static inline bool sci_dt_handle_node(struct domain *d,
+                                      struct dt_device_node *node)
+{
+    return false;
+}
+
+static inline int sci_dt_finalize(struct domain *d, void *fdt)
+{
+    return 0;
+}
+
+static inline int sci_assign_dt_device(struct domain *d,
+                                       struct dt_device_node *dev)
+{
+    return 0;
+}
+
+#endif /* CONFIG_ARM_SCI */
+
+#endif /* __ASM_ARM_SCI_H */
diff --git a/xen/arch/arm/vsmc.c b/xen/arch/arm/vsmc.c
index 6081f14ed0..4095171533 100644
--- a/xen/arch/arm/vsmc.c
+++ b/xen/arch/arm/vsmc.c
@@ -12,6 +12,7 @@
 #include <public/arch-arm/smccc.h>
 #include <asm/cpuerrata.h>
 #include <asm/cpufeature.h>
+#include <asm/firmware/sci.h>
 #include <asm/monitor.h>
 #include <asm/regs.h>
 #include <asm/smccc.h>
@@ -232,7 +233,7 @@ static bool handle_sip(struct cpu_user_regs *regs)
     if ( platform_smc(regs) )
         return true;
 
-    return scmi_handle_smc(regs);
+    return (scmi_handle_smc(regs)) ? true : sci_handle_call(regs);
 }
 
 /*
diff --git a/xen/common/device-tree/dom0less-build.c b/xen/common/device-tree/dom0less-build.c
index badc227031..aaa5e9b22c 100644
--- a/xen/common/device-tree/dom0less-build.c
+++ b/xen/common/device-tree/dom0less-build.c
@@ -228,6 +228,10 @@ static int __init handle_passthrough_prop(struct kernel_info *kinfo,
     if ( res < 0 )
         return res;
 
+    res = arch_handle_passthrough_prop(kinfo, node);
+    if ( res )
+        return res;
+
     /* If xen_force, we allow assignment of devices without IOMMU protection. */
     if ( xen_force && !dt_device_is_protected(node) )
         return 0;
diff --git a/xen/include/asm-generic/device.h b/xen/include/asm-generic/device.h
index 3bd97e33c5..cb13f7faea 100644
--- a/xen/include/asm-generic/device.h
+++ b/xen/include/asm-generic/device.h
@@ -18,6 +18,7 @@ enum device_class
     DEVICE_IOMMU,
     DEVICE_INTERRUPT_CONTROLLER,
     DEVICE_PCI_HOSTBRIDGE,
+    DEVICE_FIRMWARE,
     /* Use for error */
     DEVICE_UNKNOWN,
 };
diff --git a/xen/include/public/arch-arm.h b/xen/include/public/arch-arm.h
index e2412a1747..e7a17ede3e 100644
--- a/xen/include/public/arch-arm.h
+++ b/xen/include/public/arch-arm.h
@@ -327,6 +327,8 @@ DEFINE_XEN_GUEST_HANDLE(vcpu_guest_context_t);
 #define XEN_DOMCTL_CONFIG_TEE_OPTEE     1
 #define XEN_DOMCTL_CONFIG_TEE_FFA       2
 
+#define XEN_DOMCTL_CONFIG_ARM_SCI_NONE      0
+
 struct xen_arch_domainconfig {
     /* IN/OUT */
     uint8_t gic_version;
@@ -350,6 +352,8 @@ struct xen_arch_domainconfig {
      *
      */
     uint32_t clock_frequency;
+    /* IN */
+    uint8_t arm_sci_type;
 };
 #endif /* __XEN__ || __XEN_TOOLS__ */
 
diff --git a/xen/include/xen/dom0less-build.h b/xen/include/xen/dom0less-build.h
index 408859e325..faaf660424 100644
--- a/xen/include/xen/dom0less-build.h
+++ b/xen/include/xen/dom0less-build.h
@@ -62,6 +62,9 @@ void set_domain_type(struct domain *d, struct kernel_info *kinfo);
 int init_intc_phandle(struct kernel_info *kinfo, const char *name,
                       const int node_next, const void *pfdt);
 
+int arch_handle_passthrough_prop(struct kernel_info *kinfo,
+                                 struct dt_device_node *node);
+
 #else /* !CONFIG_DOM0LESS_BOOT */
 
 static inline void create_domUs(void) {}
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Sep 05 05:55:24 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 05 Sep 2025 05:55:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1111272.1460027 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uuPPw-0001qd-At; Fri, 05 Sep 2025 05:55:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1111272.1460027; Fri, 05 Sep 2025 05: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 1uuPPw-0001qV-8G; Fri, 05 Sep 2025 05:55:24 +0000
Received: by outflank-mailman (input) for mailman id 1111272;
 Fri, 05 Sep 2025 05: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 1uuPPu-0001qH-A0
 for xen-changelog@lists.xenproject.org; Fri, 05 Sep 2025 05: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 1uuPPu-007nTS-0D
 for xen-changelog@lists.xenproject.org;
 Fri, 05 Sep 2025 05:55:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uuPPu-00Gbnq-0m
 for xen-changelog@lists.xenproject.org;
 Fri, 05 Sep 2025 05: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=Sgss7wK4vobQLtDxr19b5syxESVDMGABBSABL4C6lTI=; b=uRAT7U7Svuo+G2sBvG1udFF6Um
	sbXxEbc8ETTH+JUybgbbEYKxZHJprmiRTaHchb64RxIkMLxLgpAat0oNNCU1eYKVe2vbWnKF4bDa3
	AeWx4v+2nTxdyLcQ83FbajTlA5rX12fPpcka3yZOFK/aa+RVsDYFopJtE33mX+VFEM6M=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: scmi-smc: update to be used under sci subsystem
Message-Id: <E1uuPPu-00Gbnq-0m@xenbits.xenproject.org>
Date: Fri, 05 Sep 2025 05:55:22 +0000

commit 8e284f5ea30a6446cd39f0e7ef8de037b536563f
Author:     Grygorii Strashko <grygorii_strashko@epam.com>
AuthorDate: Thu Sep 4 14:21:27 2025 +0000
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Thu Sep 4 12:11:43 2025 -0700

    xen/arm: scmi-smc: update to be used under sci subsystem
    
    The introduced SCI (System Control Interface) subsystem provides unified
    interface to integrate in Xen SCI drivers which adds support for ARM
    firmware (EL3, SCP) based software interfaces (like SCMI) that are used in
    system management. The SCI subsystem allows to add drivers for different FW
    interfaces or have different drivers for the same FW interface (for example,
    SCMI with different transports).
    
    This patch updates SCMI over SMC calls handling layer, introduced by
    commit 3e322bef8bc0 ("xen/arm: firmware: Add SCMI over SMC calls handling
    layer"), to be SCI driver:
    - convert to DT device;
    - convert to SCI Xen interface.
    
    There are no functional changes in general, the driver is just adopted
    to the SCI interface.
    
    Signed-off-by: Grygorii Strashko <grygorii_strashko@epam.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/arch/arm/firmware/Kconfig                | 13 +++-
 xen/arch/arm/firmware/scmi-smc.c             | 93 +++++++++++++++-------------
 xen/arch/arm/include/asm/firmware/scmi-smc.h | 41 ------------
 xen/arch/arm/vsmc.c                          |  3 +-
 xen/include/public/arch-arm.h                |  1 +
 5 files changed, 64 insertions(+), 87 deletions(-)

diff --git a/xen/arch/arm/firmware/Kconfig b/xen/arch/arm/firmware/Kconfig
index fc7918c7fc..bbf88fbb9a 100644
--- a/xen/arch/arm/firmware/Kconfig
+++ b/xen/arch/arm/firmware/Kconfig
@@ -8,9 +8,18 @@ config ARM_SCI
 
 menu "Firmware Drivers"
 
+choice
+	prompt "ARM SCI driver type"
+	default SCMI_SMC
+	help
+	Choose which ARM SCI driver to enable.
+
+config ARM_SCI_NONE
+	bool "none"
+
 config SCMI_SMC
 	bool "Forward SCMI over SMC calls from hwdom to EL3 firmware"
-	default y
+	select ARM_SCI
 	help
 	  This option enables basic awareness for SCMI calls using SMC as
 	  doorbell mechanism and Shared Memory for transport ("arm,scmi-smc"
@@ -18,4 +27,6 @@ config SCMI_SMC
 	  firmware node is used to trap and forward corresponding SCMI SMCs
 	  to firmware running at EL3, for calls coming from the hardware domain.
 
+endchoice
+
 endmenu
diff --git a/xen/arch/arm/firmware/scmi-smc.c b/xen/arch/arm/firmware/scmi-smc.c
index 33473c04b1..4c5df714c2 100644
--- a/xen/arch/arm/firmware/scmi-smc.c
+++ b/xen/arch/arm/firmware/scmi-smc.c
@@ -16,12 +16,12 @@
 #include <xen/sched.h>
 #include <xen/types.h>
 
+#include <asm/device.h>
+#include <asm/firmware/sci.h>
 #include <asm/smccc.h>
-#include <asm/firmware/scmi-smc.h>
 
 #define SCMI_SMC_ID_PROP   "arm,smc-id"
 
-static bool __ro_after_init scmi_enabled;
 static uint32_t __ro_after_init scmi_smc_id;
 
 /*
@@ -41,14 +41,11 @@ static bool scmi_is_valid_smc_id(uint32_t fid)
  *
  * Returns true if SMC was handled (regardless of response), false otherwise.
  */
-bool scmi_handle_smc(struct cpu_user_regs *regs)
+static bool scmi_handle_smc(struct cpu_user_regs *regs)
 {
     uint32_t fid = (uint32_t)get_user_reg(regs, 0);
     struct arm_smccc_res res;
 
-    if ( !scmi_enabled )
-        return false;
-
     if ( !scmi_is_valid_smc_id(fid) )
         return false;
 
@@ -78,49 +75,45 @@ bool scmi_handle_smc(struct cpu_user_regs *regs)
     return true;
 }
 
-static int __init scmi_check_smccc_ver(void)
+static int scmi_smc_domain_init(struct domain *d,
+                                struct xen_domctl_createdomain *config)
 {
-    if ( smccc_ver < ARM_SMCCC_VERSION_1_1 )
-    {
-        printk(XENLOG_WARNING
-               "SCMI: No SMCCC 1.1 support, SCMI calls forwarding disabled\n");
-        return -ENOSYS;
-    }
+    if ( !is_hardware_domain(d) )
+        return 0;
 
+    d->arch.sci_enabled = true;
+    printk(XENLOG_DEBUG "SCMI: %pd init\n", d);
     return 0;
 }
 
-static int __init scmi_dt_init_smccc(void)
+static void scmi_smc_domain_destroy(struct domain *d)
 {
-    static const struct dt_device_match scmi_ids[] __initconst =
-    {
-        /* We only support "arm,scmi-smc" binding for now */
-        DT_MATCH_COMPATIBLE("arm,scmi-smc"),
-        { /* sentinel */ },
-    };
-    const struct dt_device_node *scmi_node;
-    int ret;
+    if ( !is_hardware_domain(d) )
+        return;
 
-    /* If no SCMI firmware node found, fail silently as it's not mandatory */
-    scmi_node = dt_find_matching_node(NULL, scmi_ids);
-    if ( !scmi_node )
-        return -EOPNOTSUPP;
+    printk(XENLOG_DEBUG "SCMI: %pd destroy\n", d);
+}
 
-    ret = dt_property_read_u32(scmi_node, SCMI_SMC_ID_PROP, &scmi_smc_id);
-    if ( !ret )
+static int __init scmi_check_smccc_ver(void)
+{
+    if ( smccc_ver < ARM_SMCCC_VERSION_1_1 )
     {
-        printk(XENLOG_ERR "SCMI: No valid \"%s\" property in \"%s\" DT node\n",
-               SCMI_SMC_ID_PROP, scmi_node->full_name);
-        return -ENOENT;
+        printk(XENLOG_WARNING
+               "SCMI: No SMCCC 1.1 support, SCMI calls forwarding disabled\n");
+        return -ENOSYS;
     }
 
-    scmi_enabled = true;
-
     return 0;
 }
 
+static const struct sci_mediator_ops scmi_smc_ops = {
+    .handle_call = scmi_handle_smc,
+    .domain_init = scmi_smc_domain_init,
+    .domain_destroy = scmi_smc_domain_destroy,
+};
+
 /* Initialize the SCMI layer based on SMCs and Device-tree */
-static int __init scmi_init(void)
+static int __init scmi_dom0_init(struct dt_device_node *dev, const void *data)
 {
     int ret;
 
@@ -134,22 +127,36 @@ static int __init scmi_init(void)
     if ( ret )
         return ret;
 
-    ret = scmi_dt_init_smccc();
-    if ( ret == -EOPNOTSUPP )
-        return ret;
+    ret = dt_property_read_u32(dev, SCMI_SMC_ID_PROP, &scmi_smc_id);
+    if ( !ret )
+    {
+        printk(XENLOG_ERR "SCMI: No valid \"%s\" property in \"%s\" DT node\n",
+               SCMI_SMC_ID_PROP, dt_node_full_name(dev));
+        return -ENOENT;
+    }
+
+    ret = sci_register(&scmi_smc_ops);
     if ( ret )
-        goto err;
+    {
+        printk(XENLOG_ERR "SCMI: mediator already registered (ret = %d)\n",
+               ret);
+        return ret;
+    }
 
     printk(XENLOG_INFO "Using SCMI with SMC ID: 0x%x\n", scmi_smc_id);
 
     return 0;
-
- err:
-    printk(XENLOG_ERR "SCMI: Initialization failed (ret = %d)\n", ret);
-    return ret;
 }
 
-__initcall(scmi_init);
+static const struct dt_device_match scmi_smc_match[] __initconst = {
+    DT_MATCH_COMPATIBLE("arm,scmi-smc"),
+    { /* sentinel */ },
+};
+
+DT_DEVICE_START(scmi_smc, "SCMI SMC DOM0", DEVICE_FIRMWARE)
+    .dt_match = scmi_smc_match,
+    .init = scmi_dom0_init,
+DT_DEVICE_END
 
 /*
  * Local variables:
diff --git a/xen/arch/arm/include/asm/firmware/scmi-smc.h b/xen/arch/arm/include/asm/firmware/scmi-smc.h
deleted file mode 100644
index 6b1a164a40..0000000000
--- a/xen/arch/arm/include/asm/firmware/scmi-smc.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-/*
- * xen/arch/arm/include/asm/firmware/scmi-smc.h
- *
- * ARM System Control and Management Interface (SCMI) over SMC
- * Generic handling layer
- *
- * Andrei Cherechesu <andrei.cherechesu@nxp.com>
- * Copyright 2024 NXP
- */
-
-#ifndef __ASM_SCMI_SMC_H__
-#define __ASM_SCMI_SMC_H__
-
-#include <xen/types.h>
-
-struct cpu_user_regs;
-
-#ifdef CONFIG_SCMI_SMC
-
-bool scmi_handle_smc(struct cpu_user_regs *regs);
-
-#else
-
-static inline bool scmi_handle_smc(struct cpu_user_regs *regs)
-{
-    return false;
-}
-
-#endif /* CONFIG_SCMI_SMC */
-
-#endif /* __ASM_SCMI_H__ */
-
-/*
- * Local variables:
- * mode: C
- * c-file-style: "BSD"
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- */
diff --git a/xen/arch/arm/vsmc.c b/xen/arch/arm/vsmc.c
index 4095171533..78d5bdf56f 100644
--- a/xen/arch/arm/vsmc.c
+++ b/xen/arch/arm/vsmc.c
@@ -21,7 +21,6 @@
 #include <asm/traps.h>
 #include <asm/vpsci.h>
 #include <asm/platform.h>
-#include <asm/firmware/scmi-smc.h>
 
 /* Number of functions currently supported by Hypervisor Service. */
 #define XEN_SMCCC_FUNCTION_COUNT 3
@@ -233,7 +232,7 @@ static bool handle_sip(struct cpu_user_regs *regs)
     if ( platform_smc(regs) )
         return true;
 
-    return (scmi_handle_smc(regs)) ? true : sci_handle_call(regs);
+    return sci_handle_call(regs);
 }
 
 /*
diff --git a/xen/include/public/arch-arm.h b/xen/include/public/arch-arm.h
index e7a17ede3e..b31324f8d4 100644
--- a/xen/include/public/arch-arm.h
+++ b/xen/include/public/arch-arm.h
@@ -328,6 +328,7 @@ DEFINE_XEN_GUEST_HANDLE(vcpu_guest_context_t);
 #define XEN_DOMCTL_CONFIG_TEE_FFA       2
 
 #define XEN_DOMCTL_CONFIG_ARM_SCI_NONE      0
+#define XEN_DOMCTL_CONFIG_ARM_SCI_SCMI_SMC  1
 
 struct xen_arch_domainconfig {
     /* IN/OUT */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Sep 05 05:55:34 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 05 Sep 2025 05:55:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1111273.1460031 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uuPQ6-0001t7-Cr; Fri, 05 Sep 2025 05:55:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1111273.1460031; Fri, 05 Sep 2025 05: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 1uuPQ6-0001t0-9i; Fri, 05 Sep 2025 05:55:34 +0000
Received: by outflank-mailman (input) for mailman id 1111273;
 Fri, 05 Sep 2025 05: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 1uuPQ4-0001sq-En
 for xen-changelog@lists.xenproject.org; Fri, 05 Sep 2025 05: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 1uuPQ4-007nTY-0h
 for xen-changelog@lists.xenproject.org;
 Fri, 05 Sep 2025 05:55:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uuPQ4-00GboU-1A
 for xen-changelog@lists.xenproject.org;
 Fri, 05 Sep 2025 05: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=TLkkju8xWq7ZWdXccq4ld+j2mRhfPEXelHUGnx71ClU=; b=DDzoSyocwBKPgIdL4wLjZ4+Jh4
	TQW6rnD/nPrVvEy4UO7+8X1YE4p3vZhsOdVoSddd3mk0DepUdKSlQDC9BfyEhdnYnkH4LlvNX04Vn
	TSbdSllaX9Ka2dqSKtAjN052LOd07v2gz32KGhkYmhFRGUC3shpNMqqk7ckYZEkZJfDg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: scmi-smc: passthrough SCMI SMC to domain, single agent
Message-Id: <E1uuPQ4-00GboU-1A@xenbits.xenproject.org>
Date: Fri, 05 Sep 2025 05:55:32 +0000

commit 10e7473d6024b436d5caf0f88d447dabf5bfb07c
Author:     Grygorii Strashko <grygorii_strashko@epam.com>
AuthorDate: Thu Sep 4 14:21:27 2025 +0000
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Thu Sep 4 12:11:44 2025 -0700

    xen/arm: scmi-smc: passthrough SCMI SMC to domain, single agent
    
    The commit 3e322bef8bc0 ("xen/arm: firmware: Add SCMI over SMC calls
    handling layer") introduces simple driver which forwards SCMI over SMC
    calls from hwdom/dom0 to EL3 firmware (TF-A) with a single SCMI OSPM agent
    support. While it is working gracefully for hwdom/dom0 use case it doesn't
    cover "thin Dom0 with guest domain, which serves as Driver domain"
    use-case. In this case HW need to be enable in Driver domain and dom0 is
    performing only control functions.
    
    The EL3 SCMI firmware (TF-A) with a single SCMI OSPM agent support is
    pretty generic case for the default vendors SDK and new platforms.
    
    This patch enables passthrough of SCMI SMC single agent interface to the
    one guest domain serving as Driver domain.
    
    Configure Dom0 to enable SCMI passthrough:
    
     - dom0: add scmi-smc-passthrough to the Xen Command Line
    
    Enabled SCMI passthrough for guest using toolstack in the following way:
    
     - domD: xl.cfg add "arm_sci" option as below
    
       arm_sci = "type=scmi_smc"
    
     - domD: xl.cfg enable access to the "arm,scmi-shmem"
    
    iomem = [
        "47ff0,1@22001",
    ]
    
     - domD: add SCMI nodes to the Driver domain partial device tree as in the
     below example:
    
    passthrough {
       scmi_shm_0: sram@22001000 {
           compatible = "arm,scmi-shmem";
           reg = <0x0 0x22001000 0x0 0x1000>;
       };
    
       firmware {
            compatible = "simple-bus";
                scmi: scmi {
                    compatible = "arm,scmi-smc";
                    shmem = <&scmi_shm_0>;
                    ...
                }
        }
    }
    
    dom0less case configuration:
    
    - add "xen,sci_type" property for required DomU ("xen,domain") node
    
       xen,sci_type="scmi_smc"
    
    - add scmi nodes to the Driver domain partial device tree the same way
    as above and enable access to the "arm,scmi-shmem" according to
    dom0less documentation. For example:
    
      scmi_shm_0: sram@22001000 {
            compatible = "arm,scmi-shmem";
            reg = <0x00 0x22001000 0x00 0x1000>;
    ->        xen,reg = <0x0 0x47ff0000 0x0 0x1000 0x0 0x22001000>;
    ->        xen,force-assign-without-iommu;
      };
    
    The SCMI SMC single agent interface can be enabled for one and only one
    domain. In general, the configuration is similar to any other HW
    passthrough, except explicitly enabling SCMI with "arm_sci" xl.cfg option.
    
    Note that "arm,scmi-smc" and "arm,scmi-shmem" nodes will be removed from
    dom0/hwdom DT when "scmi-smc-passthrough" cmdline parameter was provided.
    
    Signed-off-by: Grygorii Strashko <grygorii_strashko@epam.com>
    Signed-off-by: Oleksii Moisieiev <oleksii_moisieiev@epam.com>
    Acked-by: Anthony PERARD <anthony.perard@vates.tech> # tools
---
 docs/man/xl.cfg.5.pod.in              |  34 ++++++++++
 docs/misc/arm/device-tree/booting.txt |  15 +++++
 docs/misc/xen-command-line.pandoc     |   9 +++
 tools/golang/xenlight/helpers.gen.go  |  35 +++++++++++
 tools/golang/xenlight/types.gen.go    |  11 ++++
 tools/include/libxl.h                 |   5 ++
 tools/libs/light/libxl_arm.c          |  14 +++++
 tools/libs/light/libxl_types.idl      |  10 +++
 tools/xl/xl_parse.c                   |  36 +++++++++++
 xen/arch/arm/dom0less-build.c         |  34 +++++++++-
 xen/arch/arm/firmware/Kconfig         |   4 +-
 xen/arch/arm/firmware/scmi-smc.c      | 115 +++++++++++++++++++++++++++++++++-
 12 files changed, 317 insertions(+), 5 deletions(-)

diff --git a/docs/man/xl.cfg.5.pod.in b/docs/man/xl.cfg.5.pod.in
index acff45d308..3b18bcc095 100644
--- a/docs/man/xl.cfg.5.pod.in
+++ b/docs/man/xl.cfg.5.pod.in
@@ -3123,6 +3123,40 @@ writes will be ignored.
 
 This option is only implemented for Arm where the default is enabled.
 
+=item B<arm_sci="ARM_SCI_STRING">
+
+Set ARM_SCI specific options for the guest. ARM SCI is System
+Control Protocol allows domain to manage various functions that are provided
+by HW platform firmware.
+
+B<ARM_SCI_STRING> is a comma separated list of C<KEY=VALUE> settings,
+from the following list:
+
+=over 4
+
+=item B<type=STRING>
+
+Specifies an ARM SCI type for the guest.
+
+=over 4
+
+=item B<none>
+
+Don't allow guest to use ARM SCI if present on the platform. This is the
+default value.
+
+=item B<scmi_smc>
+
+Enables ARM SCMI SMC support for the guest by enabling SCMI over SMC calls
+forwarding from domain to the EL3 firmware (like Trusted Firmware-A) with a
+single SCMI OSPM agent support.
+Should be used together with B<scmi-smc-passthrough> Xen command line
+option.
+
+=back
+
+=back
+
 =back
 
 =head3 x86
diff --git a/docs/misc/arm/device-tree/booting.txt b/docs/misc/arm/device-tree/booting.txt
index 07acc7ba64..977b428608 100644
--- a/docs/misc/arm/device-tree/booting.txt
+++ b/docs/misc/arm/device-tree/booting.txt
@@ -307,6 +307,21 @@ with the following properties:
     passed through. This option is the default if this property is missing
     and the user does not provide the device partial device tree for the domain.
 
+- xen,sci_type
+
+    A string property specifying an ARM SCI type for the guest.
+
+    - "none"
+    Don't allow guest to use ARM SCI if present on the platform. This is the
+    default value.
+
+    - "scmi_smc"
+    Enables ARM SCMI SMC support for the guest by enabling SCMI over SMC calls
+    forwarding from domain to the EL3 firmware (like Trusted Firmware-A) with a
+    single SCMI OSPM agent support.
+    Should be used together with scmi-smc-passthrough Xen command line
+    option.
+
 Under the "xen,domain" compatible node, one or more sub-nodes are present
 for the DomU kernel and ramdisk.
 
diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index 4adcd7e762..518e42d965 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -2382,6 +2382,15 @@ sockets, &c.  This will reduce performance somewhat, particularly on
 systems with hyperthreading enabled, but should reduce power by
 enabling more sockets and cores to go into deeper sleep states.
 
+### scmi-smc-passthrough (ARM)
+> `= <boolean>`
+
+The option is available when `CONFIG_SCMI_SMC` is compiled in, and allows to
+enable SCMI SMC single agent interface for any, but only one guest domain,
+which serves as Driver domain. The SCMI will be disabled for Dom0/hwdom and
+SCMI nodes removed from Dom0/hwdom device tree.
+(for example, thin Dom0 with Driver domain use-case).
+
 ### scrub-domheap
 > `= <boolean>`
 
diff --git a/tools/golang/xenlight/helpers.gen.go b/tools/golang/xenlight/helpers.gen.go
index 667030cbd7..8909fe8a1b 100644
--- a/tools/golang/xenlight/helpers.gen.go
+++ b/tools/golang/xenlight/helpers.gen.go
@@ -938,6 +938,35 @@ return fmt.Errorf("converting field Vcpus: %v", err)
  return nil
  }
 
+// NewArmSci returns an instance of ArmSci initialized with defaults.
+func NewArmSci() (*ArmSci, error) {
+var (
+x ArmSci
+xc C.libxl_arm_sci)
+
+C.libxl_arm_sci_init(&xc)
+defer C.libxl_arm_sci_dispose(&xc)
+
+if err := x.fromC(&xc); err != nil {
+return nil, err }
+
+return &x, nil}
+
+func (x *ArmSci) fromC(xc *C.libxl_arm_sci) error {
+ x.Type = ArmSciType(xc._type)
+
+ return nil}
+
+func (x *ArmSci) toC(xc *C.libxl_arm_sci) (err error){defer func(){
+if err != nil{
+C.libxl_arm_sci_dispose(xc)}
+}()
+
+xc._type = C.libxl_arm_sci_type(x.Type)
+
+ return nil
+ }
+
 // NewRdmReserve returns an instance of RdmReserve initialized with defaults.
 func NewRdmReserve() (*RdmReserve, error) {
 var (
@@ -1163,6 +1192,9 @@ x.ArchArm.GicVersion = GicVersion(xc.arch_arm.gic_version)
 x.ArchArm.Vuart = VuartType(xc.arch_arm.vuart)
 x.ArchArm.SveVl = SveType(xc.arch_arm.sve_vl)
 x.ArchArm.NrSpis = uint32(xc.arch_arm.nr_spis)
+if err := x.ArchArm.ArmSci.fromC(&xc.arch_arm.arm_sci);err != nil {
+return fmt.Errorf("converting field ArchArm.ArmSci: %v", err)
+}
 if err := x.ArchX86.MsrRelaxed.fromC(&xc.arch_x86.msr_relaxed);err != nil {
 return fmt.Errorf("converting field ArchX86.MsrRelaxed: %v", err)
 }
@@ -1699,6 +1731,9 @@ xc.arch_arm.gic_version = C.libxl_gic_version(x.ArchArm.GicVersion)
 xc.arch_arm.vuart = C.libxl_vuart_type(x.ArchArm.Vuart)
 xc.arch_arm.sve_vl = C.libxl_sve_type(x.ArchArm.SveVl)
 xc.arch_arm.nr_spis = C.uint32_t(x.ArchArm.NrSpis)
+if err := x.ArchArm.ArmSci.toC(&xc.arch_arm.arm_sci); err != nil {
+return fmt.Errorf("converting field ArchArm.ArmSci: %v", err)
+}
 if err := x.ArchX86.MsrRelaxed.toC(&xc.arch_x86.msr_relaxed); err != nil {
 return fmt.Errorf("converting field ArchX86.MsrRelaxed: %v", err)
 }
diff --git a/tools/golang/xenlight/types.gen.go b/tools/golang/xenlight/types.gen.go
index e26b3cdfc7..ab9d4ca7b4 100644
--- a/tools/golang/xenlight/types.gen.go
+++ b/tools/golang/xenlight/types.gen.go
@@ -520,6 +520,16 @@ SveType1920 SveType = 1920
 SveType2048 SveType = 2048
 )
 
+type ArmSciType int
+const(
+ArmSciTypeNone ArmSciType = 0
+ArmSciTypeScmiSmc ArmSciType = 1
+)
+
+type ArmSci struct {
+Type ArmSciType
+}
+
 type RdmReserve struct {
 Strategy RdmReserveStrategy
 Policy RdmReservePolicy
@@ -599,6 +609,7 @@ GicVersion GicVersion
 Vuart VuartType
 SveVl SveType
 NrSpis uint32
+ArmSci ArmSci
 }
 ArchX86 struct {
 MsrRelaxed Defbool
diff --git a/tools/include/libxl.h b/tools/include/libxl.h
index 185f74d8a8..bc35e412da 100644
--- a/tools/include/libxl.h
+++ b/tools/include/libxl.h
@@ -313,6 +313,11 @@
  */
 #define LIBXL_HAVE_BUILDINFO_ARCH_NR_SPIS 1
 
+/*
+ * libxl_domain_build_info has the arch_arm.sci* fields.
+ */
+#define LIBXL_HAVE_BUILDINFO_ARCH_ARM_SCI 1
+
 /*
  * LIBXL_HAVE_SOFT_RESET indicates that libxl supports performing
  * 'soft reset' for domains and there is 'soft_reset' shutdown reason
diff --git a/tools/libs/light/libxl_arm.c b/tools/libs/light/libxl_arm.c
index 4a19a8d22b..7e9f8a1bc3 100644
--- a/tools/libs/light/libxl_arm.c
+++ b/tools/libs/light/libxl_arm.c
@@ -233,6 +233,20 @@ int libxl__arch_domain_prepare_config(libxl__gc *gc,
         config->arch.sve_vl = d_config->b_info.arch_arm.sve_vl / 128U;
     }
 
+    switch (d_config->b_info.arch_arm.arm_sci.type) {
+    case LIBXL_ARM_SCI_TYPE_NONE:
+        config->arch.arm_sci_type = XEN_DOMCTL_CONFIG_ARM_SCI_NONE;
+        break;
+    case LIBXL_ARM_SCI_TYPE_SCMI_SMC:
+        config->arch.arm_sci_type = XEN_DOMCTL_CONFIG_ARM_SCI_SCMI_SMC;
+        break;
+    default:
+        LOG(ERROR, "Unknown ARM_SCI type %d",
+            d_config->b_info.arch_arm.arm_sci.type);
+        return ERROR_FAIL;
+    }
+    LOG(DEBUG, " - SCI type=%u", config->arch.arm_sci_type);
+
     return 0;
 }
 
diff --git a/tools/libs/light/libxl_types.idl b/tools/libs/light/libxl_types.idl
index a6030a2dbd..b53e013a44 100644
--- a/tools/libs/light/libxl_types.idl
+++ b/tools/libs/light/libxl_types.idl
@@ -551,6 +551,15 @@ libxl_sve_type = Enumeration("sve_type", [
     (2048, "2048")
     ], init_val = "LIBXL_SVE_TYPE_DISABLED")
 
+libxl_arm_sci_type = Enumeration("arm_sci_type", [
+    (0, "none"),
+    (1, "scmi_smc")
+    ], init_val = "LIBXL_ARM_SCI_TYPE_NONE")
+
+libxl_arm_sci = Struct("arm_sci", [
+    ("type", libxl_arm_sci_type),
+    ])
+
 libxl_rdm_reserve = Struct("rdm_reserve", [
     ("strategy",    libxl_rdm_reserve_strategy),
     ("policy",      libxl_rdm_reserve_policy),
@@ -725,6 +734,7 @@ libxl_domain_build_info = Struct("domain_build_info",[
                                ("vuart", libxl_vuart_type),
                                ("sve_vl", libxl_sve_type),
                                ("nr_spis", uint32, {'init_val': 'LIBXL_NR_SPIS_DEFAULT'}),
+                               ("arm_sci", libxl_arm_sci),
                               ])),
     ("arch_x86", Struct(None, [("msr_relaxed", libxl_defbool),
                               ])),
diff --git a/tools/xl/xl_parse.c b/tools/xl/xl_parse.c
index 90c9386f5b..af86d3186d 100644
--- a/tools/xl/xl_parse.c
+++ b/tools/xl/xl_parse.c
@@ -1284,6 +1284,36 @@ out:
     if (rc) exit(EXIT_FAILURE);
 }
 
+static int parse_arm_sci_config(XLU_Config *cfg, libxl_arm_sci *arm_sci,
+                                const char *str)
+{
+    int ret = 0;
+    char *buf2, *ptr;
+    char *oparg;
+
+    if (NULL == (buf2 = ptr = strdup(str)))
+        return ERROR_NOMEM;
+
+    ptr = strtok(buf2, ",");
+    while (ptr != NULL)
+    {
+        if (MATCH_OPTION("type", ptr, oparg)) {
+            ret = libxl_arm_sci_type_from_string(oparg, &arm_sci->type);
+            if (ret) {
+                fprintf(stderr, "Unknown ARM_SCI type: %s\n", oparg);
+                ret = ERROR_INVAL;
+                goto out;
+            }
+        }
+
+        ptr = strtok(NULL, ",");
+    }
+
+out:
+    free(buf2);
+    return ret;
+}
+
 void parse_config_data(const char *config_source,
                        const char *config_data,
                        int config_len,
@@ -2989,6 +3019,12 @@ skip_usbdev:
     xlu_cfg_get_defbool(config, "trap_unmapped_accesses",
                         &b_info->trap_unmapped_accesses, 0);
 
+    if (!xlu_cfg_get_string(config, "arm_sci", &buf, 1)) {
+        if (parse_arm_sci_config(config, &b_info->arch_arm.arm_sci, buf)) {
+            exit(EXIT_FAILURE);
+        }
+    }
+
     parse_vkb_list(config, d_config);
 
     d_config->virtios = NULL;
diff --git a/xen/arch/arm/dom0less-build.c b/xen/arch/arm/dom0less-build.c
index 0094cf9e40..f00912a1ca 100644
--- a/xen/arch/arm/dom0less-build.c
+++ b/xen/arch/arm/dom0less-build.c
@@ -279,6 +279,36 @@ int __init arch_handle_passthrough_prop(struct kernel_info *kinfo,
     return sci_assign_dt_device(kinfo->bd.d, node);
 }
 
+static int __init domu_dt_sci_parse(struct dt_device_node *node,
+                                    struct xen_domctl_createdomain *d_cfg)
+{
+    const char *sci_type;
+    int ret;
+
+    d_cfg->arch.arm_sci_type = XEN_DOMCTL_CONFIG_ARM_SCI_NONE;
+
+    if ( !IS_ENABLED(CONFIG_ARM_SCI) ||
+         !dt_property_read_bool(node, "xen,sci_type") )
+        return 0;
+
+    ret = dt_property_read_string(node, "xen,sci_type", &sci_type);
+    if ( ret )
+        return ret;
+
+    if ( !strcmp(sci_type, "none") )
+        d_cfg->arch.arm_sci_type = XEN_DOMCTL_CONFIG_ARM_SCI_NONE;
+    else if ( !strcmp(sci_type, "scmi_smc") )
+        d_cfg->arch.arm_sci_type = XEN_DOMCTL_CONFIG_ARM_SCI_SCMI_SMC;
+    else
+    {
+        printk(XENLOG_ERR "xen,sci_type in not valid (%s) for domain %s\n",
+               sci_type, dt_node_name(node));
+        return -EINVAL;
+    }
+
+    return 0;
+}
+
 int __init arch_parse_dom0less_node(struct dt_device_node *node,
                                     struct boot_domain *bd)
 {
@@ -288,7 +318,9 @@ int __init arch_parse_dom0less_node(struct dt_device_node *node,
 
     d_cfg->arch.gic_version = XEN_DOMCTL_CONFIG_GIC_NATIVE;
     d_cfg->flags |= XEN_DOMCTL_CDF_hvm | XEN_DOMCTL_CDF_hap;
-    d_cfg->arch.arm_sci_type = XEN_DOMCTL_CONFIG_ARM_SCI_NONE;
+
+    if ( domu_dt_sci_parse(node, d_cfg) )
+        panic("Error getting SCI configuration\n");
 
     if ( !dt_property_read_u32(node, "nr_spis", &d_cfg->arch.nr_spis) )
     {
diff --git a/xen/arch/arm/firmware/Kconfig b/xen/arch/arm/firmware/Kconfig
index bbf88fbb9a..5c5f0880c4 100644
--- a/xen/arch/arm/firmware/Kconfig
+++ b/xen/arch/arm/firmware/Kconfig
@@ -25,7 +25,9 @@ config SCMI_SMC
 	  doorbell mechanism and Shared Memory for transport ("arm,scmi-smc"
 	  compatible only). The value of "arm,smc-id" DT property from SCMI
 	  firmware node is used to trap and forward corresponding SCMI SMCs
-	  to firmware running at EL3, for calls coming from the hardware domain.
+	  to firmware running at EL3, for calls coming from the hardware domain or
+	  driver domain.
+	  Use with EL3 firmware which supports only single SCMI OSPM agent.
 
 endchoice
 
diff --git a/xen/arch/arm/firmware/scmi-smc.c b/xen/arch/arm/firmware/scmi-smc.c
index 4c5df714c2..0835ddeeec 100644
--- a/xen/arch/arm/firmware/scmi-smc.c
+++ b/xen/arch/arm/firmware/scmi-smc.c
@@ -13,6 +13,8 @@
 #include <xen/device_tree.h>
 #include <xen/errno.h>
 #include <xen/init.h>
+#include <xen/iocap.h>
+#include <xen/param.h>
 #include <xen/sched.h>
 #include <xen/types.h>
 
@@ -22,7 +24,11 @@
 
 #define SCMI_SMC_ID_PROP   "arm,smc-id"
 
+static bool __ro_after_init opt_scmi_smc_passthrough;
+boolean_param("scmi-smc-passthrough", opt_scmi_smc_passthrough);
+
 static uint32_t __ro_after_init scmi_smc_id;
+static struct domain __read_mostly *scmi_dom;
 
 /*
  * Check if provided SMC Function Identifier matches the one known by the SCMI
@@ -50,7 +56,7 @@ static bool scmi_handle_smc(struct cpu_user_regs *regs)
         return false;
 
     /* Only the hardware domain should use SCMI calls */
-    if ( !is_hardware_domain(current->domain) )
+    if ( scmi_dom != current->domain )
     {
         gdprintk(XENLOG_WARNING, "SCMI: Unprivileged access attempt\n");
         return false;
@@ -75,12 +81,45 @@ static bool scmi_handle_smc(struct cpu_user_regs *regs)
     return true;
 }
 
+static int
+scmi_smc_domain_sanitise_config(struct xen_domctl_createdomain *config)
+{
+    if ( config->arch.arm_sci_type != XEN_DOMCTL_CONFIG_ARM_SCI_NONE &&
+         config->arch.arm_sci_type != XEN_DOMCTL_CONFIG_ARM_SCI_SCMI_SMC )
+        return -EINVAL;
+
+    return 0;
+}
+
 static int scmi_smc_domain_init(struct domain *d,
                                 struct xen_domctl_createdomain *config)
 {
-    if ( !is_hardware_domain(d) )
+    /*
+     * scmi_passthrough is not enabled:
+     * - proceed only for hw_domain
+     * - fail if guest domain has SCMI enabled.
+     */
+    if ( !opt_scmi_smc_passthrough && !is_hardware_domain(d) )
+    {
+        if ( config->arch.arm_sci_type == XEN_DOMCTL_CONFIG_ARM_SCI_SCMI_SMC )
+            return -EINVAL;
+        else
+            return 0;
+    }
+    /*
+     * scmi_passthrough is enabled:
+     * - ignore hw_domain
+     * - proceed only for domain with SCMI enabled.
+     */
+    if ( opt_scmi_smc_passthrough &&
+         (config->arch.arm_sci_type == XEN_DOMCTL_CONFIG_ARM_SCI_NONE ||
+          is_hardware_domain(d)) )
         return 0;
 
+    if ( scmi_dom )
+        return -EEXIST;
+
+    scmi_dom = d;
     d->arch.sci_enabled = true;
     printk(XENLOG_DEBUG "SCMI: %pd init\n", d);
     return 0;
@@ -88,12 +127,80 @@ static int scmi_smc_domain_init(struct domain *d,
 
 static void scmi_smc_domain_destroy(struct domain *d)
 {
-    if ( !is_hardware_domain(d) )
+    if ( scmi_dom && scmi_dom != d )
         return;
 
+    scmi_dom = NULL;
+    d->arch.sci_enabled = false;
     printk(XENLOG_DEBUG "SCMI: %pd destroy\n", d);
 }
 
+/*
+ * Handle Dom0 SCMI SMC specific DT nodes
+ *
+ * if scmi_smc_passthrough=false:
+ * - Copy SCMI nodes into Dom0 device tree.
+ * if scmi_smc_passthrough=true:
+ * - skip SCMI nodes from Dom0 DT
+ * - give dom0 control access to SCMI shmem MMIO, so SCMI can be passed
+ *   through to guest.
+ */
+static bool scmi_smc_dt_handle_node(struct domain *d,
+                                    struct dt_device_node *node)
+{
+    static const struct dt_device_match shmem_matches[] __initconst = {
+        DT_MATCH_COMPATIBLE("arm,scmi-shmem"),
+        { /* sentinel */ },
+    };
+    static const struct dt_device_match scmi_matches[] __initconst = {
+        DT_MATCH_PATH("/firmware/scmi"),
+        { /* sentinel */ },
+    };
+
+    /* skip scmi shmem node for dom0 if scmi not enabled */
+    if ( dt_match_node(shmem_matches, node) && !sci_domain_is_enabled(d) )
+    {
+        dt_dprintk("Skip scmi shmem node\n");
+        return true;
+    }
+
+    /*
+     * skip scmi node for dom0 if scmi not enabled, but give dom0 control
+     * access to SCMI shmem
+     */
+    if ( dt_match_node(scmi_matches, node) && !sci_domain_is_enabled(d) )
+    {
+        struct dt_device_node *shmem_node;
+        const __be32 *prop;
+        uint64_t paddr, size;
+        int ret;
+
+        /* give dom0 control access to SCMI shmem */
+        prop = dt_get_property(node, "shmem", NULL);
+        if ( !prop )
+            return true;
+
+        shmem_node = dt_find_node_by_phandle(be32_to_cpu(*prop));
+        if ( !shmem_node )
+            return true;
+
+        ret = dt_device_get_address(shmem_node, 0, &paddr, &size);
+        if ( ret )
+            return true;
+
+        ret = iomem_permit_access(d, paddr_to_pfn(paddr),
+                                  paddr_to_pfn(paddr + size - 1));
+        if ( ret )
+            printk(XENLOG_WARNING
+                     "SCMI: Failed to give access to SCMI shmem with code: %d\n", ret);
+
+        dt_dprintk("Skip scmi node\n");
+        return true;
+    }
+
+    return false;
+}
+
 static int __init scmi_check_smccc_ver(void)
 {
     if ( smccc_ver < ARM_SMCCC_VERSION_1_1 )
@@ -108,8 +215,10 @@ static int __init scmi_check_smccc_ver(void)
 
 static const struct sci_mediator_ops scmi_smc_ops = {
     .handle_call = scmi_handle_smc,
+    .domain_sanitise_config = scmi_smc_domain_sanitise_config,
     .domain_init = scmi_smc_domain_init,
     .domain_destroy = scmi_smc_domain_destroy,
+    .dom0_dt_handle_node = scmi_smc_dt_handle_node,
 };
 
 /* Initialize the SCMI layer based on SMCs and Device-tree */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Sep 05 05:55:44 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 05 Sep 2025 05:55:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1111275.1460037 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uuPQG-0001vu-GO; Fri, 05 Sep 2025 05:55:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1111275.1460037; Fri, 05 Sep 2025 05: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 1uuPQG-0001vk-Cv; Fri, 05 Sep 2025 05:55:44 +0000
Received: by outflank-mailman (input) for mailman id 1111275;
 Fri, 05 Sep 2025 05: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 1uuPQE-0001vc-Hm
 for xen-changelog@lists.xenproject.org; Fri, 05 Sep 2025 05: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 1uuPQE-007nTv-0y
 for xen-changelog@lists.xenproject.org;
 Fri, 05 Sep 2025 05:55:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uuPQE-00Gbqm-1Y
 for xen-changelog@lists.xenproject.org;
 Fri, 05 Sep 2025 05: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=A3PxT1fm5mVflNGpc5D5N7l6ElRUKwiXGamiHqDWFZI=; b=kMd9NpinRBVczsWzdhGpZTkib2
	jLCng6qlx8BIHP/SVLGuBiry33sJYs+V195INuYL3lqJher7TypFWf6vmSMp2alH5hFn8xIz7B0lX
	ccI1C9wtZn+V93dzFwP6+o8NtIyzrBWs62kqK1oUoYPh/y5OHW8SEPhcNR/coHRvyHoM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] docs: arm: add docs for SCMI over SMC calls forwarding driver
Message-Id: <E1uuPQE-00Gbqm-1Y@xenbits.xenproject.org>
Date: Fri, 05 Sep 2025 05:55:42 +0000

commit b63699ee98caed47f6b3fb99fcfc87462066795a
Author:     Grygorii Strashko <grygorii_strashko@epam.com>
AuthorDate: Mon Sep 1 13:52:11 2025 +0000
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Thu Sep 4 12:12:37 2025 -0700

    docs: arm: add docs for SCMI over SMC calls forwarding driver
    
    Add documentation section for Simple Arm SCMI over SMC calls forwarding
    driver (EL3).
    
    Signed-off-by: Grygorii Strashko <grygorii_strashko@epam.com>
    Signed-off-by: Oleksii Moisieiev <oleksii_moisieiev@epam.com>
    [stefano: code style, 80 chars limit per line]
    Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 docs/hypervisor-guide/arm/firmware/arm-scmi.rst | 191 ++++++++++++++++++++++++
 docs/hypervisor-guide/arm/index.rst             |   9 ++
 docs/hypervisor-guide/index.rst                 |   1 +
 3 files changed, 201 insertions(+)

diff --git a/docs/hypervisor-guide/arm/firmware/arm-scmi.rst b/docs/hypervisor-guide/arm/firmware/arm-scmi.rst
new file mode 100644
index 0000000000..d9698f4e4b
--- /dev/null
+++ b/docs/hypervisor-guide/arm/firmware/arm-scmi.rst
@@ -0,0 +1,191 @@
+.. SPDX-License-Identifier: CC-BY-4.0
+
+ARM System Control and Management Interface (SCMI)
+==================================================
+
+The System Control and Management Interface (SCMI) [1], which is a set
+of operating system-independent software interfaces that are used in
+system management. SCMI currently
+provides interfaces for:
+
+- Discovery and self-description of the interfaces it supports
+- Power domain management
+- Clock management
+- Reset domain management
+- Voltage domain management
+- Sensor management
+- Performance management
+- Power capping and monitoring
+- Pin control protocol.
+
+The SCMI compliant firmware could run:
+
+- as part of EL3 secure world software (like Trusted Firmware-A) with
+  ARM SMC shared-memory transport;
+- on dedicated System Control Processor (SCP) with HW mailbox
+  shared-memory transport
+
+The major purpose of enabling SCMI support in Xen is to enable guest
+domains access to the SCMI interfaces for performing management actions
+on passed-through devices (such as clocks/resets etc) without accessing
+directly to the System control HW (like clock controllers) which in most
+cases can't be shared/split between domains. Or, at minimum, allow SCMI
+access for dom0/hwdom (or guest domain serving as Driver domain).
+
+The below sections describe SCMI support options available for Xen.
+
+| [1] `Arm SCMI <https://developer.arm.com/documentation/den0056/latest/>`_
+| [2] `System Control and Management Interface (SCMI) bindings <https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/firmware/arm,scmi.yaml>`_
+
+Simple SCMI over SMC calls forwarding driver (EL3)
+------------------------------------------------------
+
+The EL3 SCMI firmware (TF-A) with a single SCMI OSPM agent support is
+pretty generic case for the default vendors SDK and new platforms with
+SCMI support. Such EL3 SCMI firmware supports only single SCMI OSPM
+transport (agent) with Shared memory based transport and SMC calls as
+doorbell.
+
+The SCMI over SMC calls forwarding driver solves major problem for this
+case by allowing SMC calls to be forwarded from guest to the EL3 SCMI
+firmware.
+
+By default, the SCMI over SMC calls forwarding is enabled for
+Dom0/hwdom.
+
+::
+
+    +--------------------------+
+    |                          |
+    | EL3 SCMI FW (TF-A)       |
+    ++-------+--^--------------+
+     |shmem  |  | smc-id
+     +----^--+  |
+          |     |
+     +----|-+---+---+----------+
+     |    | |  FWD  |      Xen |
+     |    | +---^---+          |
+     +----|-----|--------------+
+          |     | smc-id
+     +----v-----+--+ +---------+
+     |             | |         |
+     | Dom0/hwdom  | | DomU    |
+     |             | |         |
+     |             | |         |
+     +-------------+ +---------+
+
+
+The SCMI messages are passed directly through SCMI shared-memory
+(zero-copy) and driver only forwards SMC calls.
+
+Compiling
+^^^^^^^^^
+
+To build with the SCMI over SMC calls forwarding enabled support, enable
+Kconfig option
+
+::
+
+    SCMI_SMC
+
+The ``CONFIG_SCMI_SMC`` is enabled by default.
+
+Pass-through SCMI SMC to domain which serves as Driver domain
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+This section describes how to configure the SCMI over SMC calls
+forwarding driver to handle use case "thin Dom0 with guest domain, which
+serves as Driver domain". In this case HW need to be enabled in Driver
+domain and dom0 is performing only control functions (without accessing
+FW) and so, the SCMI need to be enabled in Driver domain.
+
+::
+
+     +--------------------------+
+     |EL3 SCMI FW (TF-A)        |
+     |                          |
+     +-------------^--+-------+-+
+             smc-id|  |shmem0 |
+                   |  +----^--+
+    +-------------++------+|----+
+    |Xen          |  FWD  ||    |
+    |             +--^----+|    |
+    +----------------|-----|----+
+              smc-id |     |
+    +-----------+ +--+-----v-----+
+    |           | |              |
+    | Dom0      | |    Driver    |
+    | Control   | |    domain    |
+    |           | |              |
+    +-----------+ +--------------+
+
+The SCMI can be enabled for one and only one guest domain.
+
+First, configure Dom0 to enable SCMI pass-through using Xen Command Line
+**"scmi-smc-passthrough"** option. This will disable SCMI for Dom0/hwdom
+and SCMI nodes will be removed from Dom0/hwdom device tree.
+
+**Configure SCMI pass-through for guest domain with toolstack**
+
+* In domain's xl.cfg file add **"arm_sci"** option as below
+
+::
+
+    arm_sci = "type=scmi_smc"
+
+* In domain's xl.cfg file enable access to the "arm,scmi-shmem"
+
+::
+
+    iomem = [
+        "47ff0,1@22001",
+    ]
+
+.. note:: It's up to the user to select guest IPA for mapping SCMI shared-memory.
+
+* Add SCMI nodes to the Driver domain partial device tree as in the
+  below example:
+
+.. code::
+
+    passthrough {
+       scmi_shm_0: sram@22001000 {
+           compatible = "arm,scmi-shmem";
+           reg = <0x0 0x22001000 0x0 0x1000>;
+       };
+
+       firmware {
+            compatible = "simple-bus";
+                scmi: scmi {
+                    compatible = "arm,scmi-smc";
+                    shmem = <&scmi_shm_0>;
+                    ...
+                }
+        }
+    }
+
+Please refer to [2] for details of SCMI DT bindings.
+
+In general, the configuration is similar to any other HW pass-through,
+except explicitly enabling SCMI with "arm_sci" xl.cfg option.
+
+**Configure SCMI pass-through for predefined domain (dom0less)**
+
+* add "xen,sci_type" property for required DomU ("xen,domain") node
+
+::
+
+       xen,sci_type="scmi_smc"
+
+* add scmi nodes to the Driver domain partial device tree the same way
+  as above and enable access to the "arm,scmi-shmem" according to
+  dom0less documentation. For example:
+
+.. code::
+
+      scmi_shm_0: sram@22001000 {
+            compatible = "arm,scmi-shmem";
+            reg = <0x00 0x22001000 0x00 0x1000>;
+    ->        xen,reg = <0x0 0x47ff0000 0x0 0x1000 0x0 0x22001000>;
+    ->        xen,force-assign-without-iommu;
+      };
diff --git a/docs/hypervisor-guide/arm/index.rst b/docs/hypervisor-guide/arm/index.rst
new file mode 100644
index 0000000000..7aae4a0a03
--- /dev/null
+++ b/docs/hypervisor-guide/arm/index.rst
@@ -0,0 +1,9 @@
+.. SPDX-License-Identifier: CC-BY-4.0
+
+ARM
+===
+
+.. toctree::
+   :maxdepth: 2
+
+   firmware/arm-scmi
diff --git a/docs/hypervisor-guide/index.rst b/docs/hypervisor-guide/index.rst
index e4393b0697..520fe01554 100644
--- a/docs/hypervisor-guide/index.rst
+++ b/docs/hypervisor-guide/index.rst
@@ -9,3 +9,4 @@ Hypervisor documentation
    code-coverage
 
    x86/index
+   arm/index
\ No newline at end of file
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Sep 05 22:55:07 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 05 Sep 2025 22:55:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1112581.1460785 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uufKh-0004Zd-HC; Fri, 05 Sep 2025 22:55:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1112581.1460785; Fri, 05 Sep 2025 22: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 1uufKh-0004ZV-EV; Fri, 05 Sep 2025 22:55:03 +0000
Received: by outflank-mailman (input) for mailman id 1112581;
 Fri, 05 Sep 2025 22: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 1uufKg-0004ZP-8i
 for xen-changelog@lists.xenproject.org; Fri, 05 Sep 2025 22: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 1uufKg-0089Vy-06
 for xen-changelog@lists.xenproject.org;
 Fri, 05 Sep 2025 22:55:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uufKg-0003rL-0d
 for xen-changelog@lists.xenproject.org;
 Fri, 05 Sep 2025 22: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=sgddib/BMUdj7VmvDrrjuk26vDb4Kvswj4H4OlkiFMA=; b=5kVV420lDodkJHrcZuhEEfQdM/
	EGfXCEdubJeUayMmi0sZMqwH0pMpGKaoR3tNU9lOLmDLaVHFlKmgb+DfYOCHLaA52xaWUJJjXWLrp
	iwY0p/Zq1XD8nE86ysX+z4dbjJUDI5x0wsSqa3m87ZidYBQlCLqkdsGRVSwVMSd14VAU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] efi: Add a function to check if Secure Boot mode is enabled
Message-Id: <E1uufKg-0003rL-0d@xenbits.xenproject.org>
Date: Fri, 05 Sep 2025 22:55:02 +0000

commit cb41b4ce14a94fb23eca548912a9f4c6499dd434
Author:     Ross Lagerwall <ross.lagerwall@citrix.com>
AuthorDate: Fri Sep 5 12:10:17 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Sep 5 23:45:38 2025 +0100

    efi: Add a function to check if Secure Boot mode is enabled
    
    Also cache it to avoid needing to repeatedly ask the firmware.
    
    Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
    Signed-off-by: Gerald Elder-Vass <gerald.elder-vass@cloud.com>
    Acked-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/common/efi/boot.c    | 24 ++++++++++++++++++++++++
 xen/common/efi/runtime.c |  1 +
 xen/include/xen/efi.h    |  2 ++
 3 files changed, 27 insertions(+)

diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c
index e12fa1a7ec..ccbfc401f7 100644
--- a/xen/common/efi/boot.c
+++ b/xen/common/efi/boot.c
@@ -901,6 +901,28 @@ static void __init pre_parse(const struct file *file)
                    " last line will be ignored.\r\n");
 }
 
+static void __init init_secure_boot_mode(void)
+{
+    static EFI_GUID __initdata gv_uuid = EFI_GLOBAL_VARIABLE;
+    static CHAR16 __initdata str_SecureBoot[] = L"SecureBoot";
+    EFI_STATUS status;
+    uint8_t data = 0;
+    UINTN size = sizeof(data);
+    UINT32 attr = 0;
+
+    status = efi_rs->GetVariable(str_SecureBoot, &gv_uuid, &attr, &size, &data);
+
+    if ( status == EFI_NOT_FOUND ||
+         (status == EFI_SUCCESS &&
+          attr == (EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS) &&
+          size == 1 && data == 0) )
+        /* Platform does not support Secure Boot or it's disabled. */
+        efi_secure_boot = false;
+    else
+        /* Everything else play it safe and assume enabled. */
+        efi_secure_boot = true;
+}
+
 static void __init efi_init(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable)
 {
     efi_ih = ImageHandle;
@@ -915,6 +937,8 @@ static void __init efi_init(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTabl
 
     StdOut = SystemTable->ConOut;
     StdErr = SystemTable->StdErr ?: StdOut;
+
+    init_secure_boot_mode();
 }
 
 static void __init efi_console_set_mode(void)
diff --git a/xen/common/efi/runtime.c b/xen/common/efi/runtime.c
index 42386c6bde..30d649ca5c 100644
--- a/xen/common/efi/runtime.c
+++ b/xen/common/efi/runtime.c
@@ -41,6 +41,7 @@ void efi_rs_leave(struct efi_rs_state *state);
 unsigned int __read_mostly efi_num_ct;
 const EFI_CONFIGURATION_TABLE *__read_mostly efi_ct;
 
+bool __ro_after_init efi_secure_boot;
 unsigned int __read_mostly efi_version;
 unsigned int __read_mostly efi_fw_revision;
 const CHAR16 *__read_mostly efi_fw_vendor;
diff --git a/xen/include/xen/efi.h b/xen/include/xen/efi.h
index 623ed2ccdf..723cb80852 100644
--- a/xen/include/xen/efi.h
+++ b/xen/include/xen/efi.h
@@ -36,6 +36,8 @@ static inline bool efi_enabled(unsigned int feature)
 }
 #endif
 
+extern bool efi_secure_boot;
+
 void efi_init_memory(void);
 bool efi_boot_mem_unused(unsigned long *start, unsigned long *end);
 bool efi_rs_using_pgtables(void);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Sep 05 22:55:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 05 Sep 2025 22:55:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1112582.1460789 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uufKr-0004bo-J1; Fri, 05 Sep 2025 22:55:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1112582.1460789; Fri, 05 Sep 2025 22: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 1uufKr-0004bi-Fs; Fri, 05 Sep 2025 22:55:13 +0000
Received: by outflank-mailman (input) for mailman id 1112582;
 Fri, 05 Sep 2025 22: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 1uufKq-0004bV-BM
 for xen-changelog@lists.xenproject.org; Fri, 05 Sep 2025 22: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 1uufKq-0089W4-0N
 for xen-changelog@lists.xenproject.org;
 Fri, 05 Sep 2025 22:55:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uufKq-0003rp-0x
 for xen-changelog@lists.xenproject.org;
 Fri, 05 Sep 2025 22: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=6OyxVhdo4rODuynqq5tIjL1NnDtJMbGOi8Sx8bYjtbY=; b=anB86PbRSdMy7GufB02Adn8Lns
	53lCJjJf1H5SxjDpzj/cWUeH7c9zmPT2qAAOy6Nn/geQk16ezSuvl8YuSWoRIDh5b9cb2+HkJaV1x
	kyihPoErTHem3+Szoz1f9uWAQHwAzil2lQ74OpUIr1hhbDHuXhOlzDpFa/K3+CbTnRo4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] efi: Support using Shim's LoadImage protocol
Message-Id: <E1uufKq-0003rp-0x@xenbits.xenproject.org>
Date: Fri, 05 Sep 2025 22:55:12 +0000

commit 59a1d6d3ea1ea147c9bcd1a9b0b94378ce67ce6f
Author:     Gerald Elder-Vass <gerald.elder-vass@cloud.com>
AuthorDate: Fri Sep 5 12:10:18 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Sep 5 23:45:38 2025 +0100

    efi: Support using Shim's LoadImage protocol
    
    The existing Verify functionality of the Shim lock protocol is
    deprecated and will be removed, the alternative it to use the LoadImage
    interface to perform the verification.
    
    When the loading is successful we won't be using the newly loaded image
    (as of yet) so we must then immediately unload the image to clean up.
    
    If the LoadImage protocol isn't available then fall back to the Shim
    Lock (Verify) interface.
    
    Log when the kernel is not verified and fail if this occurs
    when secure boot mode is enabled.
    
    Signed-off-by: Gerald Elder-Vass <gerald.elder-vass@cloud.com>
    Acked-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/common/efi/boot.c | 63 ++++++++++++++++++++++++++++++++++++++++++++-------
 1 file changed, 55 insertions(+), 8 deletions(-)

diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c
index ccbfc401f7..b86c83d334 100644
--- a/xen/common/efi/boot.c
+++ b/xen/common/efi/boot.c
@@ -38,6 +38,8 @@
   { 0xf2fd1544U, 0x9794, 0x4a2c, {0x99, 0x2e, 0xe5, 0xbb, 0xcf, 0x20, 0xe3, 0x94} }
 #define SHIM_LOCK_PROTOCOL_GUID \
   { 0x605dab50U, 0xe046, 0x4300, {0xab, 0xb6, 0x3d, 0xd8, 0x10, 0xdd, 0x8b, 0x23} }
+#define SHIM_IMAGE_LOADER_GUID \
+  { 0x1f492041U, 0xfadb, 0x4e59, {0x9e, 0x57, 0x7c, 0xaf, 0xe7, 0x3a, 0x55, 0xab} }
 #define APPLE_PROPERTIES_PROTOCOL_GUID \
   { 0x91bd12feU, 0xf6c3, 0x44fb, {0xa5, 0xb7, 0x51, 0x22, 0xab, 0x30, 0x3a, 0xe0} }
 #define EFI_SYSTEM_RESOURCE_TABLE_GUID    \
@@ -70,6 +72,13 @@ typedef struct {
     EFI_SHIM_LOCK_VERIFY Verify;
 } EFI_SHIM_LOCK_PROTOCOL;
 
+typedef struct _SHIM_IMAGE_LOADER {
+    EFI_IMAGE_LOAD LoadImage;
+    EFI_IMAGE_START StartImage;
+    EFI_EXIT Exit;
+    EFI_IMAGE_UNLOAD UnloadImage;
+} SHIM_IMAGE_LOADER;
+
 struct _EFI_APPLE_PROPERTIES;
 
 typedef EFI_STATUS
@@ -1047,6 +1056,50 @@ static UINTN __init efi_find_gop_mode(EFI_GRAPHICS_OUTPUT_PROTOCOL *gop,
     return gop_mode;
 }
 
+static void __init efi_verify_kernel(EFI_HANDLE ImageHandle)
+{
+    static EFI_GUID __initdata shim_image_guid = SHIM_IMAGE_LOADER_GUID;
+    static EFI_GUID __initdata shim_lock_guid = SHIM_LOCK_PROTOCOL_GUID;
+    SHIM_IMAGE_LOADER *shim_loader;
+    EFI_HANDLE loaded_kernel;
+    EFI_SHIM_LOCK_PROTOCOL *shim_lock;
+    EFI_STATUS status;
+    bool verified = false;
+
+    /* Look for SHIM_IMAGE_LOADER first. */
+    if ( !EFI_ERROR(efi_bs->LocateProtocol(&shim_image_guid, NULL,
+                                           (void **)&shim_loader)) )
+    {
+        status = shim_loader->LoadImage(false, ImageHandle, NULL,
+                                        (void *)kernel.ptr, kernel.size,
+                                        &loaded_kernel);
+        if ( !EFI_ERROR(status) )
+            verified = true;
+
+        /*
+         * Always unload the image.  We only needed LoadImage() to perform
+         * verification anyway, and in the case of a failure there may still
+         * be cleanup needing to be performed.
+         */
+        shim_loader->UnloadImage(loaded_kernel);
+    }
+
+    /* Otherwise, fall back to SHIM_LOCK. */
+    if ( !verified &&
+         !EFI_ERROR(efi_bs->LocateProtocol(&shim_lock_guid, NULL,
+                                           (void **)&shim_lock)) &&
+         !EFI_ERROR(shim_lock->Verify(kernel.ptr, kernel.size)) )
+        verified = true;
+
+    if ( !verified )
+    {
+        PrintStr(L"Kernel was not verified\n");
+
+        if ( efi_secure_boot )
+            blexit(L"Refusing to boot unverified kernel with UEFI SecureBoot enabled");
+    }
+}
+
 static void __init efi_tables(void)
 {
     unsigned int i;
@@ -1334,13 +1387,11 @@ void EFIAPI __init noreturn efi_start(EFI_HANDLE ImageHandle,
                                       EFI_SYSTEM_TABLE *SystemTable)
 {
     static EFI_GUID __initdata loaded_image_guid = LOADED_IMAGE_PROTOCOL;
-    static EFI_GUID __initdata shim_lock_guid = SHIM_LOCK_PROTOCOL_GUID;
     EFI_LOADED_IMAGE *loaded_image;
     EFI_STATUS status;
     unsigned int i;
     CHAR16 *file_name, *cfg_file_name = NULL, *options = NULL;
     UINTN gop_mode = ~0;
-    EFI_SHIM_LOCK_PROTOCOL *shim_lock;
     EFI_GRAPHICS_OUTPUT_PROTOCOL *gop = NULL;
     union string section = { NULL }, name;
     bool base_video = false;
@@ -1591,12 +1642,8 @@ void EFIAPI __init noreturn efi_start(EFI_HANDLE ImageHandle,
      * device tree through the efi_check_dt_boot function, in this stage
      * verify it.
      */
-    if ( kernel.ptr &&
-         !kernel_verified &&
-         !EFI_ERROR(efi_bs->LocateProtocol(&shim_lock_guid, NULL,
-                                           (void **)&shim_lock)) &&
-         (status = shim_lock->Verify(kernel.ptr, kernel.size)) != EFI_SUCCESS )
-        PrintErrMesg(L"Dom0 kernel image could not be verified", status);
+    if ( kernel.ptr && !kernel_verified )
+        efi_verify_kernel(ImageHandle);
 
     efi_arch_edd();
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Sat Sep 06 10:33:07 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 06 Sep 2025 10:33:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1113273.1461193 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uuqEB-0007vn-QP; Sat, 06 Sep 2025 10:33:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1113273.1461193; Sat, 06 Sep 2025 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 1uuqEB-0007vf-NO; Sat, 06 Sep 2025 10:33:03 +0000
Received: by outflank-mailman (input) for mailman id 1113273;
 Sat, 06 Sep 2025 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 1uuqEA-0007vZ-MV
 for xen-changelog@lists.xenproject.org; Sat, 06 Sep 2025 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 1uuqEA-009Zxv-0S
 for xen-changelog@lists.xenproject.org;
 Sat, 06 Sep 2025 10:33:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uuqEA-000cin-0z
 for xen-changelog@lists.xenproject.org;
 Sat, 06 Sep 2025 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=scCPob7fOWCYaP14924LR4+o/CktBeSdz7vmj0MGT28=; b=CnC+cFQgNr110WLbgSOyooHo4+
	m0V0/4GkJDmM0Ag+dHwU22Tc7SxJTQSi/2heBPRm6q77Oahbhv0bEeEmPp46lfrvPdN2niYmTknI3
	bW7m+wchRT6j7fdOVtHGeDYWW2SegGl6qj/ccObUxLDZlPEOGjwfcdAlsaNRM1IcYzTc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/domain: unify domain ID allocation
Message-Id: <E1uuqEA-000cin-0z@xenbits.xenproject.org>
Date: Sat, 06 Sep 2025 10:33:02 +0000

commit 2d506506071036cfb29bcbc60ef4d748aba60363
Author:     Denis Mukhin <dmukhin@ford.com>
AuthorDate: Fri Aug 29 16:21:29 2025 -0700
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Thu Sep 4 13:36:17 2025 -0700

    xen/domain: unify domain ID allocation
    
    Currently, there are two different domain ID allocation implementations:
    
      1) Sequential IDs allocation in dom0less Arm code based on max_init_domid;
    
      2) Sequential IDs allocation in XEN_DOMCTL_createdomain; does not use
         max_init_domid (both Arm and x86).
    
    The domain ID allocation covers dom0 or late hwdom, predefined domains,
    post-boot domains, excluding Xen system domains (domid >=
    DOMID_FIRST_RESERVED).
    
    It makes sense to have a common helper code for such task across architectures
    (Arm and x86) and between dom0less / toolstack domU allocation.
    
    Note, fixing dependency on max_init_domid is out of scope of this patch.
    
    Wrap the domain ID allocation as an arch-independent function domid_alloc() in
    new common/domid.c based on the bitmap.
    
    Allocation algorithm:
    - If an explicit domain ID is provided, verify its availability and use it if
      ID is not used;
    - If DOMID_INVALID is provided, search the range [1..DOMID_FIRST_RESERVED-1],
      starting from the last used ID.
      Implementation guarantees that two consecutive calls will never return the
      same ID. ID#0 is reserved for the first boot domain (currently, dom0) and
      excluded from the allocation range.
    
    Remove is_free_domid() helper as it is not needed now.
    
    No functional change intended.
    
    Signed-off-by: Denis Mukhin <dmukhin@ford.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Alejandro Vallejo <alejandro.garciavallejo@amd.com>
---
 xen/arch/arm/domain_build.c             |  7 ++-
 xen/arch/x86/setup.c                    |  7 ++-
 xen/common/Makefile                     |  1 +
 xen/common/device-tree/dom0less-build.c | 15 +++---
 xen/common/domain.c                     |  2 +
 xen/common/domctl.c                     | 43 +++------------
 xen/common/domid.c                      | 95 +++++++++++++++++++++++++++++++++
 xen/include/xen/domain.h                |  3 ++
 8 files changed, 126 insertions(+), 47 deletions(-)

diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index 039aa71439..373d4b516f 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -2058,6 +2058,7 @@ void __init create_dom0(void)
         .grant_opts = XEN_DOMCTL_GRANT_version(opt_gnttab_max_version),
     };
     unsigned int flags = CDF_privileged | CDF_hardware;
+    domid_t domid;
     int rc;
 
     /* The vGIC for DOM0 is exactly emulating the hardware GIC */
@@ -2082,7 +2083,11 @@ void __init create_dom0(void)
     if ( !llc_coloring_enabled )
         flags |= CDF_directmap;
 
-    dom0 = domain_create(0, &dom0_cfg, flags);
+    domid = domid_alloc(0);
+    if ( domid == DOMID_INVALID )
+        panic("Error allocating domain ID 0\n");
+
+    dom0 = domain_create(domid, &dom0_cfg, flags);
     if ( IS_ERR(dom0) )
         panic("Error creating domain 0 (rc = %ld)\n", PTR_ERR(dom0));
 
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index a810bdf6d3..6afe39399b 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -1036,8 +1036,11 @@ static struct domain *__init create_dom0(struct boot_info *bi)
     if ( iommu_enabled )
         dom0_cfg.flags |= XEN_DOMCTL_CDF_iommu;
 
-    /* Create initial domain.  Not d0 for pvshim. */
-    bd->domid = get_initial_domain_id();
+    /* Allocate initial domain ID.  Not d0 for pvshim. */
+    bd->domid = domid_alloc(get_initial_domain_id());
+    if ( bd->domid == DOMID_INVALID )
+        panic("Error allocating domain ID %u\n", get_initial_domain_id());
+
     d = domain_create(bd->domid, &dom0_cfg,
                       pv_shim ? 0 : CDF_privileged | CDF_hardware);
     if ( IS_ERR(d) )
diff --git a/xen/common/Makefile b/xen/common/Makefile
index c316957fcb..0c7d0f5d46 100644
--- a/xen/common/Makefile
+++ b/xen/common/Makefile
@@ -11,6 +11,7 @@ obj-$(filter-out $(CONFIG_X86),$(CONFIG_ACPI)) += device.o
 obj-$(CONFIG_DEVICE_TREE_PARSE) += device-tree/
 obj-$(CONFIG_IOREQ_SERVER) += dm.o
 obj-y += domain.o
+obj-y += domid.o
 obj-y += event_2l.o
 obj-y += event_channel.o
 obj-$(CONFIG_EVTCHN_FIFO) += event_fifo.o
diff --git a/xen/common/device-tree/dom0less-build.c b/xen/common/device-tree/dom0less-build.c
index aaa5e9b22c..9fd004c42a 100644
--- a/xen/common/device-tree/dom0less-build.c
+++ b/xen/common/device-tree/dom0less-build.c
@@ -838,6 +838,7 @@ void __init create_domUs(void)
     {
         struct kernel_info ki = KERNEL_INFO_INIT;
         int rc = parse_dom0less_node(node, &ki.bd);
+        domid_t domid;
 
         if ( rc == -ENOENT )
             continue;
@@ -847,13 +848,13 @@ void __init create_domUs(void)
         if ( (max_init_domid + 1) >= DOMID_FIRST_RESERVED )
             panic("No more domain IDs available\n");
 
-        /*
-         * The variable max_init_domid is initialized with zero, so here it's
-         * very important to use the pre-increment operator to call
-         * domain_create() with a domid > 0. (domid == 0 is reserved for Dom0)
-         */
-        ki.bd.d = domain_create(++max_init_domid,
-                                &ki.bd.create_cfg, ki.bd.create_flags);
+        domid = domid_alloc(DOMID_INVALID);
+        if ( domid == DOMID_INVALID )
+            panic("Error allocating ID for domain %s\n", dt_node_name(node));
+
+        max_init_domid = max(max_init_domid, domid);
+
+        ki.bd.d = domain_create(domid, &ki.bd.create_cfg, ki.bd.create_flags);
         if ( IS_ERR(ki.bd.d) )
             panic("Error creating domain %s (rc = %ld)\n",
                   dt_node_name(node), PTR_ERR(ki.bd.d));
diff --git a/xen/common/domain.c b/xen/common/domain.c
index 104e917f07..775c339285 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -692,6 +692,8 @@ static void _domain_destroy(struct domain *d)
 
     lock_profile_deregister_struct(LOCKPROF_TYPE_PERDOM, d);
 
+    domid_free(d->domain_id);
+
     free_domain_struct(d);
 }
 
diff --git a/xen/common/domctl.c b/xen/common/domctl.c
index f2a7caaf85..71e712c1f3 100644
--- a/xen/common/domctl.c
+++ b/xen/common/domctl.c
@@ -51,20 +51,6 @@ static int xenctl_bitmap_to_nodemask(nodemask_t *nodemask,
                                    MAX_NUMNODES);
 }
 
-static inline int is_free_domid(domid_t dom)
-{
-    struct domain *d;
-
-    if ( dom >= DOMID_FIRST_RESERVED )
-        return 0;
-
-    if ( (d = rcu_lock_domain_by_id(dom)) == NULL )
-        return 1;
-
-    rcu_unlock_domain(d);
-    return 0;
-}
-
 void getdomaininfo(struct domain *d, struct xen_domctl_getdomaininfo *info)
 {
     struct vcpu *v;
@@ -423,36 +409,19 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl)
 
     case XEN_DOMCTL_createdomain:
     {
-        domid_t        dom;
-        static domid_t rover = 0;
+        /* NB: ID#0 is reserved, find the first suitable ID instead. */
+        domid_t domid = domid_alloc(op->domain ?: DOMID_INVALID);
 
-        dom = op->domain;
-        if ( (dom > 0) && (dom < DOMID_FIRST_RESERVED) )
+        if ( domid == DOMID_INVALID )
         {
             ret = -EEXIST;
-            if ( !is_free_domid(dom) )
-                break;
-        }
-        else
-        {
-            for ( dom = rover + 1; dom != rover; dom++ )
-            {
-                if ( dom == DOMID_FIRST_RESERVED )
-                    dom = 1;
-                if ( is_free_domid(dom) )
-                    break;
-            }
-
-            ret = -ENOMEM;
-            if ( dom == rover )
-                break;
-
-            rover = dom;
+            break;
         }
 
-        d = domain_create(dom, &op->u.createdomain, false);
+        d = domain_create(domid, &op->u.createdomain, false);
         if ( IS_ERR(d) )
         {
+            domid_free(domid);
             ret = PTR_ERR(d);
             d = NULL;
             break;
diff --git a/xen/common/domid.c b/xen/common/domid.c
new file mode 100644
index 0000000000..2387ddb083
--- /dev/null
+++ b/xen/common/domid.c
@@ -0,0 +1,95 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Domain ID allocator.
+ *
+ * Covers dom0 or late hwdom, predefined domains, post-boot domains.
+ * Excludes system domains (ID >= DOMID_FIRST_RESERVED).
+ *
+ * Copyright 2025 Ford Motor Company
+ */
+
+#include <xen/domain.h>
+
+static DEFINE_SPINLOCK(domid_lock);
+static DECLARE_BITMAP(domid_bitmap, DOMID_FIRST_RESERVED);
+
+/*
+ * Allocate domain ID.
+ *
+ * @param domid Domain ID hint:
+ * - If an explicit domain ID is provided, verify its availability and use it
+ *   if ID is not used;
+ * - If DOMID_INVALID is provided, search [1..DOMID_FIRST_RESERVED-1] range,
+ *   starting from the last used ID. Implementation guarantees that two
+ *   consecutive calls will never return the same ID. ID#0 is reserved for
+ *   the first boot domain (currently, dom0) and excluded from the allocation
+ *   range.
+ * @return Valid domain ID in case of successful allocation,
+ *         DOMID_INVALID - otherwise.
+ */
+domid_t domid_alloc(domid_t domid)
+{
+    static domid_t domid_last;
+
+    spin_lock(&domid_lock);
+
+    /* Exact match. */
+    if ( domid < DOMID_FIRST_RESERVED )
+    {
+        if ( __test_and_set_bit(domid, domid_bitmap) )
+            domid = DOMID_INVALID;
+    }
+    /*
+     * Exhaustive search.
+     *
+     * Domain ID#0 is reserved for the first boot domain (e.g. control domain)
+     * and excluded from allocation.
+     */
+    else
+    {
+        domid_t bound = DOMID_FIRST_RESERVED;
+
+        domid = find_next_zero_bit(domid_bitmap, bound, domid_last + 1);
+        if ( domid >= bound && domid_last != 0 )
+        {
+            bound = domid_last + 1;
+            domid = find_next_zero_bit(domid_bitmap, bound, 1);
+        }
+
+        ASSERT(domid <= DOMID_FIRST_RESERVED);
+        if ( domid < bound )
+        {
+            __set_bit(domid, domid_bitmap);
+            domid_last = domid;
+        }
+        else
+            domid = DOMID_INVALID;
+    }
+
+    spin_unlock(&domid_lock);
+
+    return domid;
+}
+
+void domid_free(domid_t domid)
+{
+    int rc;
+
+    ASSERT(domid <= DOMID_FIRST_RESERVED);
+
+    spin_lock(&domid_lock);
+    rc = __test_and_clear_bit(domid, domid_bitmap);
+    spin_unlock(&domid_lock);
+
+    ASSERT(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/include/xen/domain.h b/xen/include/xen/domain.h
index e10baf2615..8aab05ae93 100644
--- a/xen/include/xen/domain.h
+++ b/xen/include/xen/domain.h
@@ -38,6 +38,9 @@ void arch_get_domain_info(const struct domain *d,
 
 domid_t get_initial_domain_id(void);
 
+domid_t domid_alloc(domid_t domid);
+void domid_free(domid_t domid);
+
 /* CDF_* constant. Internal flags for domain creation. */
 /* Is this a privileged domain? */
 #define CDF_privileged           (1U << 0)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Sep 06 10:33:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 06 Sep 2025 10:33:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1113274.1461197 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uuqEL-0007xO-SJ; Sat, 06 Sep 2025 10:33:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1113274.1461197; Sat, 06 Sep 2025 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 1uuqEL-0007xG-PD; Sat, 06 Sep 2025 10:33:13 +0000
Received: by outflank-mailman (input) for mailman id 1113274;
 Sat, 06 Sep 2025 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 1uuqEK-0007x6-FO
 for xen-changelog@lists.xenproject.org; Sat, 06 Sep 2025 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 1uuqEK-009ZyL-0l
 for xen-changelog@lists.xenproject.org;
 Sat, 06 Sep 2025 10:33:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uuqEK-000cj9-1J
 for xen-changelog@lists.xenproject.org;
 Sat, 06 Sep 2025 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=TszDFcaeUWKNhX8TzFoHUPDZh5PqrQg0mTBmMsbGZmE=; b=lIxtPrCTcx5P3GsPH7cX6UGBWk
	ODtU1C2gJVC8MIWk4/POjOJOROWwC1V9Sqix3Hf+bfZolcNCU95O4e+6ophKLz7YVbety2xzzUDgj
	V95iOsMKNJMpG1dzxaX2qRHMHsgDw2p7r6bbffEYOhu+Rwk9PyIQhJnrC9BDdLwvTO4g=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/tests: introduce unit tests for domain ID allocator
Message-Id: <E1uuqEK-000cj9-1J@xenbits.xenproject.org>
Date: Sat, 06 Sep 2025 10:33:12 +0000

commit b3d31533a0474b860d118e872c7ccdabacc2f194
Author:     Denis Mukhin <dmukhin@ford.com>
AuthorDate: Fri Aug 29 16:21:31 2025 -0700
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Thu Sep 4 13:37:18 2025 -0700

    tools/tests: introduce unit tests for domain ID allocator
    
    Introduce some basic infrastructure for doing domain ID allocation unit tests,
    and add a few tests that ensure correctness of the domain ID allocator.
    
    Use <xen-tools/bitops.h> and xen/lib/find-next-bit.c in test hardness code.
    
    Adjust find-next-bit.c to be compiled with __XEN_TOOLS__.
    
    Signed-off-by: Denis Mukhin <dmukhin@ford.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
---
 tools/include/xen-tools/bitops.h | 10 +++++
 tools/tests/Makefile             |  1 +
 tools/tests/domid/.gitignore     |  2 +
 tools/tests/domid/Makefile       | 88 +++++++++++++++++++++++++++++++++++++
 tools/tests/domid/harness.h      | 54 +++++++++++++++++++++++
 tools/tests/domid/test-domid.c   | 95 ++++++++++++++++++++++++++++++++++++++++
 xen/lib/find-next-bit.c          |  5 +++
 7 files changed, 255 insertions(+)

diff --git a/tools/include/xen-tools/bitops.h b/tools/include/xen-tools/bitops.h
index 681482f675..3b98fba6d7 100644
--- a/tools/include/xen-tools/bitops.h
+++ b/tools/include/xen-tools/bitops.h
@@ -12,6 +12,16 @@
 #define BITS_PER_LONG 32
 #endif
 
+#define ffsl(x)       __builtin_ffsl(x)
+
+#define BIT_WORD(nr)  ((nr) / BITS_PER_LONG)
+
+#define BITS_TO_LONGS(bits) \
+    (((bits) + BITS_PER_LONG - 1) / BITS_PER_LONG)
+
+#define DECLARE_BITMAP(name, bits) \
+    unsigned long name[BITS_TO_LONGS(bits)]
+
 #define BITMAP_ENTRY(_nr,_bmap) ((_bmap))[(_nr) / 8]
 #define BITMAP_SHIFT(_nr) ((_nr) % 8)
 
diff --git a/tools/tests/Makefile b/tools/tests/Makefile
index 97ba2a1389..ac57373646 100644
--- a/tools/tests/Makefile
+++ b/tools/tests/Makefile
@@ -2,6 +2,7 @@ XEN_ROOT = $(CURDIR)/../..
 include $(XEN_ROOT)/tools/Rules.mk
 
 SUBDIRS-y :=
+SUBDIRS-y += domid
 SUBDIRS-y += resource
 SUBDIRS-$(CONFIG_X86) += cpu-policy
 SUBDIRS-$(CONFIG_X86) += tsx
diff --git a/tools/tests/domid/.gitignore b/tools/tests/domid/.gitignore
new file mode 100644
index 0000000000..37d773103b
--- /dev/null
+++ b/tools/tests/domid/.gitignore
@@ -0,0 +1,2 @@
+generated
+test-domid
diff --git a/tools/tests/domid/Makefile b/tools/tests/domid/Makefile
new file mode 100644
index 0000000000..22f1f15d11
--- /dev/null
+++ b/tools/tests/domid/Makefile
@@ -0,0 +1,88 @@
+# SPDX-License-Identifier: GPL-2.0-only
+#
+# Unit tests for domain ID allocator.
+#
+# Copyright 2025 Ford Motor Company
+
+XEN_ROOT=$(CURDIR)/../../..
+include $(XEN_ROOT)/tools/Rules.mk
+
+TESTS := test-domid
+
+define list-c-headers
+$(shell sed -n -E \
+    's/^[ \t]*# *include[ \t]*[<"]([^">]+)[">].*/\1/p' $(1) 2>/dev/null)
+endef
+
+# NB: $1 cannot be a list
+define emit-harness-nested-rule
+$(1): $(CURDIR)/harness.h
+	mkdir -p $$(@D);
+	ln -sf $$< $$@;
+
+endef
+
+define emit-harness-rules
+$(foreach x,$(2),$(call emit-harness-nested-rule,$(CURDIR)/generated/$(x)))
+$(1:.c=.o): $(addprefix $(CURDIR)/generated/,$(2))
+endef
+
+define emit-harness-deps
+$(if $(strip $(2)),$(call emit-harness-rules,$1,$2),)
+endef
+
+define vpath-with-harness-deps
+vpath $(1) $(2)
+$(call emit-harness-deps,$(1),$(call list-c-headers,$(2)$(1)))
+endef
+
+.PHONY: all
+all: $(TESTS)
+
+.PHONY: run
+run: $(TESTS)
+	set -e; $(foreach t,$(TESTS),./$(t);)
+
+.PHONY: clean
+clean:
+	$(RM) -r generated
+	$(RM) -- *.o $(TESTS) $(DEPS_RM)
+
+.PHONY: distclean
+distclean: clean
+	$(RM) -- *~
+
+.PHONY: install
+install: all
+	$(INSTALL_DIR) $(DESTDIR)$(LIBEXEC)/tests
+	$(INSTALL_PROG) test-domid $(DESTDIR)$(LIBEXEC)/tests
+
+.PHONY: uninstall
+uninstall:
+	$(RM) -- $(DESTDIR)$(LIBEXEC)/tests/test-domid
+
+CFLAGS += -D__XEN_TOOLS__
+# find-next-bit.c
+CFLAGS += '-DEXPORT_SYMBOL(x)=' \
+          -Dfind_first_bit \
+          -Dfind_first_zero_bit \
+          -Dfind_next_bit \
+          -Dfind_next_bit_le \
+          -Dfind_next_zero_bit_le
+CFLAGS += $(APPEND_CFLAGS)
+CFLAGS += $(CFLAGS_xeninclude)
+CFLAGS += -I./generated/
+
+LDFLAGS += $(APPEND_LDFLAGS)
+
+vpath find-next-bit.c $(XEN_ROOT)/xen/lib/
+
+# Point to the hypervisor code and generate test harness dependencies
+# on the fly, making it possible to compile parts of the hypervisor
+# within a mocked environment.
+$(eval $(call vpath-with-harness-deps,domid.c,$(XEN_ROOT)/xen/common/))
+
+test-domid: domid.o find-next-bit.o test-domid.o
+	$(CC) $^ -o $@ $(LDFLAGS)
+
+-include $(DEPS_INCLUDE)
diff --git a/tools/tests/domid/harness.h b/tools/tests/domid/harness.h
new file mode 100644
index 0000000000..17eb22a9a8
--- /dev/null
+++ b/tools/tests/domid/harness.h
@@ -0,0 +1,54 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Unit test harness for domain ID allocator.
+ *
+ * Copyright 2025 Ford Motor Company
+ */
+
+#ifndef _TEST_HARNESS_
+#define _TEST_HARNESS_
+
+#include <assert.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdio.h>
+
+#include <xen-tools/common-macros.h>
+#include <xen-tools/bitops.h>
+
+typedef bool spinlock_t;
+typedef uint16_t domid_t;
+
+extern domid_t domid_alloc(domid_t domid);
+extern void domid_free(domid_t domid);
+
+extern unsigned long find_next_zero_bit(const unsigned long *addr,
+                                        unsigned long size,
+                                        unsigned long offset);
+
+#define __test_and_set_bit(nr, addr)    test_and_set_bit(nr, addr)
+#define __test_and_clear_bit(nr, addr)  test_and_clear_bit(nr, addr)
+#define __set_bit(nr, addr)             set_bit(nr, addr)
+
+#define BUG_ON(x)                       assert(!(x))
+#define ASSERT(x)                       assert(x)
+
+#define DEFINE_SPINLOCK(l)              spinlock_t l
+#define spin_lock(l)                    (assert(!*(l)), *(l) = true)
+#define spin_unlock(l)                  (assert(*(l)), *(l) = false)
+
+#define printk                          printf
+
+#define DOMID_FIRST_RESERVED            (100)
+#define DOMID_INVALID                   (101)
+
+#endif /* _TEST_HARNESS_ */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff --git a/tools/tests/domid/test-domid.c b/tools/tests/domid/test-domid.c
new file mode 100644
index 0000000000..5915c4699a
--- /dev/null
+++ b/tools/tests/domid/test-domid.c
@@ -0,0 +1,95 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Unit tests for domain ID allocator.
+ *
+ * Copyright 2025 Ford Motor Company
+ */
+
+#include <sysexits.h>
+
+#include "harness.h"
+
+#define verify(exp, fmt, args...) \
+while (!(exp)) { \
+    printf(fmt, ## args); \
+    exit(EX_SOFTWARE); \
+}
+
+/*
+ * Fail on the first error, since tests are dependent on each other.
+ */
+int main(int argc, char **argv)
+{
+    domid_t expected, allocated;
+
+    /* Test ID cannot be allocated twice. */
+    for ( expected = 0; expected < DOMID_FIRST_RESERVED; expected++ )
+    {
+        allocated = domid_alloc(expected);
+        verify(allocated == expected,
+               "TEST 1: expected %u allocated %u\n", expected, allocated);
+    }
+    for ( expected = 0; expected < DOMID_FIRST_RESERVED; expected++ )
+    {
+        allocated = domid_alloc(expected);
+        verify(allocated == DOMID_INVALID,
+               "TEST 2: expected %u allocated %u\n", DOMID_INVALID, allocated);
+    }
+
+    /* Ensure all IDs, including ID#0 are not allocated. */
+    for ( expected = 0; expected < DOMID_FIRST_RESERVED; expected++ )
+        domid_free(expected);
+
+    /*
+     * Test that that two consecutive calls of domid_alloc(DOMID_INVALID)
+     * will never return the same ID.
+     * NB: ID#0 is reserved and shall not be allocated by
+     * domid_alloc(DOMID_INVALID).
+     */
+    for ( expected = 1; expected < DOMID_FIRST_RESERVED; expected++ )
+    {
+        allocated = domid_alloc(DOMID_INVALID);
+        verify(allocated == expected,
+               "TEST 3: expected %u allocated %u\n", expected, allocated);
+    }
+    for ( expected = 1; expected < DOMID_FIRST_RESERVED; expected++ )
+    {
+        allocated = domid_alloc(DOMID_INVALID);
+        verify(allocated == DOMID_INVALID,
+               "TEST 4: expected %u allocated %u\n", DOMID_INVALID, allocated);
+    }
+
+    /* Re-allocate first ID from [1..DOMID_FIRST_RESERVED/2]. */
+    for ( expected = 1; expected < DOMID_FIRST_RESERVED / 2; expected++ )
+        domid_free(expected);
+    for ( expected = 1; expected < DOMID_FIRST_RESERVED / 2; expected++ )
+    {
+        allocated = domid_alloc(DOMID_INVALID);
+        verify(allocated == expected,
+               "TEST 5: expected %u allocated %u\n", expected, allocated);
+    }
+
+    /* Re-allocate last ID from [1..DOMID_FIRST_RESERVED - 1]. */
+    expected = DOMID_FIRST_RESERVED - 1;
+    domid_free(DOMID_FIRST_RESERVED - 1);
+    allocated = domid_alloc(DOMID_INVALID);
+    verify(allocated == expected,
+           "TEST 6: expected %u allocated %u\n", expected, allocated);
+
+    /* Allocate an invalid ID. */
+    expected = DOMID_INVALID;
+    allocated = domid_alloc(DOMID_FIRST_RESERVED);
+    verify(allocated == expected,
+           "TEST 7: expected %u allocated %u\n", expected, allocated);
+
+    return 0;
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff --git a/xen/lib/find-next-bit.c b/xen/lib/find-next-bit.c
index 9b8d7814f2..539c7f2022 100644
--- a/xen/lib/find-next-bit.c
+++ b/xen/lib/find-next-bit.c
@@ -8,8 +8,13 @@
  * as published by the Free Software Foundation; either version
  * 2 of the License, or (at your option) any later version.
  */
+
+#ifdef __XEN_TOOLS__
+#include <xen-tools/bitops.h>
+#else
 #include <xen/bitops.h>
 #include <xen/byteorder.h>
+#endif
 
 #define __ffs(x) (ffsl(x) - 1)
 #define ffz(x) __ffs(~(x))
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Sep 06 10:33:24 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 06 Sep 2025 10:33:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1113278.1461201 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uuqEW-00080W-0f; Sat, 06 Sep 2025 10:33:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1113278.1461201; Sat, 06 Sep 2025 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 1uuqEV-00080O-Tt; Sat, 06 Sep 2025 10:33:23 +0000
Received: by outflank-mailman (input) for mailman id 1113278;
 Sat, 06 Sep 2025 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 1uuqEU-00080E-IQ
 for xen-changelog@lists.xenproject.org; Sat, 06 Sep 2025 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 1uuqEU-009ZyP-14
 for xen-changelog@lists.xenproject.org;
 Sat, 06 Sep 2025 10:33:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uuqEU-000clL-1d
 for xen-changelog@lists.xenproject.org;
 Sat, 06 Sep 2025 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=D4NqP8nUJQMu4gojNOsEM9NV6xljo+tyWLuDET6BwaM=; b=Cb4ybVfd4r7akQiDmTOnwbBNZI
	NpHHBoVNaIe/vuWfWLzaeKgnu2b14dvwuwLI+F4dRcDPVO3aTCx3NGlnhZ64o44PCCEsxlfSIO+aK
	ym+qOWg1o+yS/bpEANrL1AtK0VGAzIMhCer3KRWS2+Ivx6+WFEnLJ1LTaU8UqQgSDEDk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/domain: update create_dom0() messages
Message-Id: <E1uuqEU-000clL-1d@xenbits.xenproject.org>
Date: Sat, 06 Sep 2025 10:33:22 +0000

commit 5104e05904b0c123ec58125ee8a85fadbb78cc9f
Author:     Denis Mukhin <dmukhin@ford.com>
AuthorDate: Fri Aug 29 16:21:32 2025 -0700
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Thu Sep 4 13:37:21 2025 -0700

    xen/domain: update create_dom0() messages
    
    Use %pd for domain identification in error/panic messages in create_dom0().
    
    No functional change.
    
    Signed-off-by: Denis Mukhin <dmukhin@ford.com>
    Reviewed-by: Alejandro Vallejo <alejandro.garciavallejo@amd.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/domain_build.c | 6 +++---
 xen/arch/x86/setup.c        | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index 373d4b516f..89448fb475 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -2092,14 +2092,14 @@ void __init create_dom0(void)
         panic("Error creating domain 0 (rc = %ld)\n", PTR_ERR(dom0));
 
     if ( llc_coloring_enabled && (rc = dom0_set_llc_colors(dom0)) )
-        panic("Error initializing LLC coloring for domain 0 (rc = %d)\n", rc);
+        panic("Error initializing LLC coloring for %pd (rc = %d)\n", dom0, rc);
 
     if ( vcpu_create(dom0, 0) == NULL )
-        panic("Error creating domain 0 vcpu0\n");
+        panic("Error creating %pdv0\n", dom0);
 
     rc = construct_dom0(dom0);
     if ( rc )
-        panic("Could not set up DOM0 guest OS (rc = %d)\n", rc);
+        panic("Could not set up %pd guest OS (rc = %d)\n", dom0, rc);
 
     set_xs_domain(dom0);
 }
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 6afe39399b..872a8c63f9 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -1073,7 +1073,7 @@ static struct domain *__init create_dom0(struct boot_info *bi)
 
         if ( (strlen(acpi_param) == 0) && acpi_disabled )
         {
-            printk("ACPI is disabled, notifying Domain 0 (acpi=off)\n");
+            printk("ACPI is disabled, notifying %pd (acpi=off)\n", d);
             safe_strcpy(acpi_param, "off");
         }
 
@@ -1088,7 +1088,7 @@ static struct domain *__init create_dom0(struct boot_info *bi)
 
     bd->d = d;
     if ( construct_dom0(bd) != 0 )
-        panic("Could not construct domain 0\n");
+        panic("Could not construct %pd\n", d);
 
     bd->cmdline = NULL;
     xfree(cmdline);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Sep 06 10:33:34 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 06 Sep 2025 10:33:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1113279.1461205 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uuqEg-00082W-28; Sat, 06 Sep 2025 10:33:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1113279.1461205; Sat, 06 Sep 2025 10: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 1uuqEf-00082P-VN; Sat, 06 Sep 2025 10:33:33 +0000
Received: by outflank-mailman (input) for mailman id 1113279;
 Sat, 06 Sep 2025 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 1uuqEe-00082F-La
 for xen-changelog@lists.xenproject.org; Sat, 06 Sep 2025 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 1uuqEe-009ZyY-1N
 for xen-changelog@lists.xenproject.org;
 Sat, 06 Sep 2025 10:33:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uuqEe-000clk-1w
 for xen-changelog@lists.xenproject.org;
 Sat, 06 Sep 2025 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=ReivJqflROo9/YDXjvojQFIE4JSoExNEmhX0MecUhxc=; b=3drp4E9G7nERqcplnXDt2DJLne
	N4p1MSPdFZT8kntR9mL7A/LNcRJw5NccFKVlMRj7NMO00LHVgh6HvHPtIxXSiCndst7Qb/O+gjgPu
	BId16QN1vb/nB73in5dz5uboevpcvojTsPJuq171jSNO/4jVugs0nje+a040gTzbTmh8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] efi: Add a function to check if Secure Boot mode is enabled
Message-Id: <E1uuqEe-000clk-1w@xenbits.xenproject.org>
Date: Sat, 06 Sep 2025 10:33:32 +0000

commit cb41b4ce14a94fb23eca548912a9f4c6499dd434
Author:     Ross Lagerwall <ross.lagerwall@citrix.com>
AuthorDate: Fri Sep 5 12:10:17 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Sep 5 23:45:38 2025 +0100

    efi: Add a function to check if Secure Boot mode is enabled
    
    Also cache it to avoid needing to repeatedly ask the firmware.
    
    Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
    Signed-off-by: Gerald Elder-Vass <gerald.elder-vass@cloud.com>
    Acked-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/common/efi/boot.c    | 24 ++++++++++++++++++++++++
 xen/common/efi/runtime.c |  1 +
 xen/include/xen/efi.h    |  2 ++
 3 files changed, 27 insertions(+)

diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c
index e12fa1a7ec..ccbfc401f7 100644
--- a/xen/common/efi/boot.c
+++ b/xen/common/efi/boot.c
@@ -901,6 +901,28 @@ static void __init pre_parse(const struct file *file)
                    " last line will be ignored.\r\n");
 }
 
+static void __init init_secure_boot_mode(void)
+{
+    static EFI_GUID __initdata gv_uuid = EFI_GLOBAL_VARIABLE;
+    static CHAR16 __initdata str_SecureBoot[] = L"SecureBoot";
+    EFI_STATUS status;
+    uint8_t data = 0;
+    UINTN size = sizeof(data);
+    UINT32 attr = 0;
+
+    status = efi_rs->GetVariable(str_SecureBoot, &gv_uuid, &attr, &size, &data);
+
+    if ( status == EFI_NOT_FOUND ||
+         (status == EFI_SUCCESS &&
+          attr == (EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS) &&
+          size == 1 && data == 0) )
+        /* Platform does not support Secure Boot or it's disabled. */
+        efi_secure_boot = false;
+    else
+        /* Everything else play it safe and assume enabled. */
+        efi_secure_boot = true;
+}
+
 static void __init efi_init(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable)
 {
     efi_ih = ImageHandle;
@@ -915,6 +937,8 @@ static void __init efi_init(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTabl
 
     StdOut = SystemTable->ConOut;
     StdErr = SystemTable->StdErr ?: StdOut;
+
+    init_secure_boot_mode();
 }
 
 static void __init efi_console_set_mode(void)
diff --git a/xen/common/efi/runtime.c b/xen/common/efi/runtime.c
index 42386c6bde..30d649ca5c 100644
--- a/xen/common/efi/runtime.c
+++ b/xen/common/efi/runtime.c
@@ -41,6 +41,7 @@ void efi_rs_leave(struct efi_rs_state *state);
 unsigned int __read_mostly efi_num_ct;
 const EFI_CONFIGURATION_TABLE *__read_mostly efi_ct;
 
+bool __ro_after_init efi_secure_boot;
 unsigned int __read_mostly efi_version;
 unsigned int __read_mostly efi_fw_revision;
 const CHAR16 *__read_mostly efi_fw_vendor;
diff --git a/xen/include/xen/efi.h b/xen/include/xen/efi.h
index 623ed2ccdf..723cb80852 100644
--- a/xen/include/xen/efi.h
+++ b/xen/include/xen/efi.h
@@ -36,6 +36,8 @@ static inline bool efi_enabled(unsigned int feature)
 }
 #endif
 
+extern bool efi_secure_boot;
+
 void efi_init_memory(void);
 bool efi_boot_mem_unused(unsigned long *start, unsigned long *end);
 bool efi_rs_using_pgtables(void);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Sep 06 10:33:44 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 06 Sep 2025 10:33:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1113280.1461209 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uuqEq-00085R-3b; Sat, 06 Sep 2025 10:33:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1113280.1461209; Sat, 06 Sep 2025 10: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 1uuqEq-00085K-0p; Sat, 06 Sep 2025 10:33:44 +0000
Received: by outflank-mailman (input) for mailman id 1113280;
 Sat, 06 Sep 2025 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 1uuqEo-00084p-OW
 for xen-changelog@lists.xenproject.org; Sat, 06 Sep 2025 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 1uuqEo-009Zyg-1e
 for xen-changelog@lists.xenproject.org;
 Sat, 06 Sep 2025 10:33:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uuqEo-000cm7-2D
 for xen-changelog@lists.xenproject.org;
 Sat, 06 Sep 2025 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=9OX4F5yPy5kQVk7jd9OzHvXHaOxdsjQ+c69b3FTQLOk=; b=OaiT5rixJQPlGYUKqqtxLIf6m2
	U7omGfNRjm1dHf/nq0HxsxuSW1k1WliJKDVv63Hl6UeISbcOSoW9MVMMIb5Wh81RAwRarNwtvwYi6
	WZy/7J81kjuAVtMpEyazmYo5F/ufMJ2wHHtBuujIm6tUM0GDatLT6EEJLN/86YX7QZqc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] efi: Support using Shim's LoadImage protocol
Message-Id: <E1uuqEo-000cm7-2D@xenbits.xenproject.org>
Date: Sat, 06 Sep 2025 10:33:42 +0000

commit 59a1d6d3ea1ea147c9bcd1a9b0b94378ce67ce6f
Author:     Gerald Elder-Vass <gerald.elder-vass@cloud.com>
AuthorDate: Fri Sep 5 12:10:18 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Sep 5 23:45:38 2025 +0100

    efi: Support using Shim's LoadImage protocol
    
    The existing Verify functionality of the Shim lock protocol is
    deprecated and will be removed, the alternative it to use the LoadImage
    interface to perform the verification.
    
    When the loading is successful we won't be using the newly loaded image
    (as of yet) so we must then immediately unload the image to clean up.
    
    If the LoadImage protocol isn't available then fall back to the Shim
    Lock (Verify) interface.
    
    Log when the kernel is not verified and fail if this occurs
    when secure boot mode is enabled.
    
    Signed-off-by: Gerald Elder-Vass <gerald.elder-vass@cloud.com>
    Acked-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/common/efi/boot.c | 63 ++++++++++++++++++++++++++++++++++++++++++++-------
 1 file changed, 55 insertions(+), 8 deletions(-)

diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c
index ccbfc401f7..b86c83d334 100644
--- a/xen/common/efi/boot.c
+++ b/xen/common/efi/boot.c
@@ -38,6 +38,8 @@
   { 0xf2fd1544U, 0x9794, 0x4a2c, {0x99, 0x2e, 0xe5, 0xbb, 0xcf, 0x20, 0xe3, 0x94} }
 #define SHIM_LOCK_PROTOCOL_GUID \
   { 0x605dab50U, 0xe046, 0x4300, {0xab, 0xb6, 0x3d, 0xd8, 0x10, 0xdd, 0x8b, 0x23} }
+#define SHIM_IMAGE_LOADER_GUID \
+  { 0x1f492041U, 0xfadb, 0x4e59, {0x9e, 0x57, 0x7c, 0xaf, 0xe7, 0x3a, 0x55, 0xab} }
 #define APPLE_PROPERTIES_PROTOCOL_GUID \
   { 0x91bd12feU, 0xf6c3, 0x44fb, {0xa5, 0xb7, 0x51, 0x22, 0xab, 0x30, 0x3a, 0xe0} }
 #define EFI_SYSTEM_RESOURCE_TABLE_GUID    \
@@ -70,6 +72,13 @@ typedef struct {
     EFI_SHIM_LOCK_VERIFY Verify;
 } EFI_SHIM_LOCK_PROTOCOL;
 
+typedef struct _SHIM_IMAGE_LOADER {
+    EFI_IMAGE_LOAD LoadImage;
+    EFI_IMAGE_START StartImage;
+    EFI_EXIT Exit;
+    EFI_IMAGE_UNLOAD UnloadImage;
+} SHIM_IMAGE_LOADER;
+
 struct _EFI_APPLE_PROPERTIES;
 
 typedef EFI_STATUS
@@ -1047,6 +1056,50 @@ static UINTN __init efi_find_gop_mode(EFI_GRAPHICS_OUTPUT_PROTOCOL *gop,
     return gop_mode;
 }
 
+static void __init efi_verify_kernel(EFI_HANDLE ImageHandle)
+{
+    static EFI_GUID __initdata shim_image_guid = SHIM_IMAGE_LOADER_GUID;
+    static EFI_GUID __initdata shim_lock_guid = SHIM_LOCK_PROTOCOL_GUID;
+    SHIM_IMAGE_LOADER *shim_loader;
+    EFI_HANDLE loaded_kernel;
+    EFI_SHIM_LOCK_PROTOCOL *shim_lock;
+    EFI_STATUS status;
+    bool verified = false;
+
+    /* Look for SHIM_IMAGE_LOADER first. */
+    if ( !EFI_ERROR(efi_bs->LocateProtocol(&shim_image_guid, NULL,
+                                           (void **)&shim_loader)) )
+    {
+        status = shim_loader->LoadImage(false, ImageHandle, NULL,
+                                        (void *)kernel.ptr, kernel.size,
+                                        &loaded_kernel);
+        if ( !EFI_ERROR(status) )
+            verified = true;
+
+        /*
+         * Always unload the image.  We only needed LoadImage() to perform
+         * verification anyway, and in the case of a failure there may still
+         * be cleanup needing to be performed.
+         */
+        shim_loader->UnloadImage(loaded_kernel);
+    }
+
+    /* Otherwise, fall back to SHIM_LOCK. */
+    if ( !verified &&
+         !EFI_ERROR(efi_bs->LocateProtocol(&shim_lock_guid, NULL,
+                                           (void **)&shim_lock)) &&
+         !EFI_ERROR(shim_lock->Verify(kernel.ptr, kernel.size)) )
+        verified = true;
+
+    if ( !verified )
+    {
+        PrintStr(L"Kernel was not verified\n");
+
+        if ( efi_secure_boot )
+            blexit(L"Refusing to boot unverified kernel with UEFI SecureBoot enabled");
+    }
+}
+
 static void __init efi_tables(void)
 {
     unsigned int i;
@@ -1334,13 +1387,11 @@ void EFIAPI __init noreturn efi_start(EFI_HANDLE ImageHandle,
                                       EFI_SYSTEM_TABLE *SystemTable)
 {
     static EFI_GUID __initdata loaded_image_guid = LOADED_IMAGE_PROTOCOL;
-    static EFI_GUID __initdata shim_lock_guid = SHIM_LOCK_PROTOCOL_GUID;
     EFI_LOADED_IMAGE *loaded_image;
     EFI_STATUS status;
     unsigned int i;
     CHAR16 *file_name, *cfg_file_name = NULL, *options = NULL;
     UINTN gop_mode = ~0;
-    EFI_SHIM_LOCK_PROTOCOL *shim_lock;
     EFI_GRAPHICS_OUTPUT_PROTOCOL *gop = NULL;
     union string section = { NULL }, name;
     bool base_video = false;
@@ -1591,12 +1642,8 @@ void EFIAPI __init noreturn efi_start(EFI_HANDLE ImageHandle,
      * device tree through the efi_check_dt_boot function, in this stage
      * verify it.
      */
-    if ( kernel.ptr &&
-         !kernel_verified &&
-         !EFI_ERROR(efi_bs->LocateProtocol(&shim_lock_guid, NULL,
-                                           (void **)&shim_lock)) &&
-         (status = shim_lock->Verify(kernel.ptr, kernel.size)) != EFI_SUCCESS )
-        PrintErrMesg(L"Dom0 kernel image could not be verified", status);
+    if ( kernel.ptr && !kernel_verified )
+        efi_verify_kernel(ImageHandle);
 
     efi_arch_edd();
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Sep 08 11:44:06 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 08 Sep 2025 11:44:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1115165.1461881 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uvaHz-0007H1-9Y; Mon, 08 Sep 2025 11:44:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1115165.1461881; Mon, 08 Sep 2025 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 1uvaHz-0007Gt-73; Mon, 08 Sep 2025 11:44:03 +0000
Received: by outflank-mailman (input) for mailman id 1115165;
 Mon, 08 Sep 2025 11: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 1uvaHy-0007Gn-F2
 for xen-changelog@lists.xenproject.org; Mon, 08 Sep 2025 11: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 1uvaHy-0003J5-1A
 for xen-changelog@lists.xenproject.org;
 Mon, 08 Sep 2025 11:44:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uvaHy-0007rh-10
 for xen-changelog@lists.xenproject.org;
 Mon, 08 Sep 2025 11: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=XdaE4XfG3qTuB76p2u1FTSRnXvOBnem5ImXKBVwjRCM=; b=SzOzFwDdpkHkcp4TgGgKb3BcjY
	jXmfuHN+c3XWYZAGaewD/8g7qGCrPJcfzteJuVEmJOwfT89Xu3HGba1yLk5F5qgUmX8D61Y+r8y/8
	RnOcszXfQ2LuA+Je3E71zB5wNav9vID4mHDLfgymw4CTCkLZW6S0NFsvRpFjeAgQRcqQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] symbols: fix xensyms_read() hitting the final "end" symbol
Message-Id: <E1uvaHy-0007rh-10@xenbits.xenproject.org>
Date: Mon, 08 Sep 2025 11:44:02 +0000

commit d301d718a4de64b393a29604fe76a75b8441e316
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Sep 8 13:32:00 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Sep 8 13:32:00 2025 +0200

    symbols: fix xensyms_read() hitting the final "end" symbol
    
    A new "no (more) symbol" path there was lacking a necessary unlock.
    
    Fixes: d3b637fba31b ("symbols: arrange to know where functions end")
    Coverity ID: 1665212
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Mykola Kvach <mykola_kvach@epam.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/common/symbols.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/xen/common/symbols.c b/xen/common/symbols.c
index 0d8cc25ab0..2260539800 100644
--- a/xen/common/symbols.c
+++ b/xen/common/symbols.c
@@ -202,7 +202,10 @@ int xensyms_read(uint32_t *symnum, char *type,
     {
         ++next_offset;
         if ( ++*symnum == symbols_num_addrs )
+        {
+            spin_unlock(&symbols_mutex);
             goto no_symbol;
+        }
     }
 
     *type = symbols_get_symbol_type(next_offset);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Sep 08 12:33:05 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 08 Sep 2025 12:33:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1115196.1461898 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uvb3O-00051W-SV; Mon, 08 Sep 2025 12:33:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1115196.1461898; Mon, 08 Sep 2025 12: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 1uvb3O-00051P-Px; Mon, 08 Sep 2025 12:33:02 +0000
Received: by outflank-mailman (input) for mailman id 1115196;
 Mon, 08 Sep 2025 12: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 1uvb3N-00051J-I4
 for xen-changelog@lists.xenproject.org; Mon, 08 Sep 2025 12: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 1uvb3N-0004Hj-1g
 for xen-changelog@lists.xenproject.org;
 Mon, 08 Sep 2025 12:33:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uvb3N-000AIm-1Y
 for xen-changelog@lists.xenproject.org;
 Mon, 08 Sep 2025 12: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=d1n9urw9ZAylgoj//LAjvBH0Tv++FWaEdHgBq/ogCCU=; b=694xSbKKS+wnGNHGmiIRHvTP0S
	zgO9axByOOIYSF8bA6J3fUUzXWrVSZv8JS/KgjevYcuXhLvftTEz6qqg/2VqTThh30pVzj9n/JhQN
	Q4cSLqcnXOBEFPqoEu42c7so2jXcF7hfkwXCvxdklMZBnf/D/XZpUIHqHbthsgeiuUI4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] symbols: fix xensyms_read() hitting the final "end" symbol
Message-Id: <E1uvb3N-000AIm-1Y@xenbits.xenproject.org>
Date: Mon, 08 Sep 2025 12:33:01 +0000

commit d301d718a4de64b393a29604fe76a75b8441e316
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Sep 8 13:32:00 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Sep 8 13:32:00 2025 +0200

    symbols: fix xensyms_read() hitting the final "end" symbol
    
    A new "no (more) symbol" path there was lacking a necessary unlock.
    
    Fixes: d3b637fba31b ("symbols: arrange to know where functions end")
    Coverity ID: 1665212
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Mykola Kvach <mykola_kvach@epam.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/common/symbols.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/xen/common/symbols.c b/xen/common/symbols.c
index 0d8cc25ab0..2260539800 100644
--- a/xen/common/symbols.c
+++ b/xen/common/symbols.c
@@ -202,7 +202,10 @@ int xensyms_read(uint32_t *symnum, char *type,
     {
         ++next_offset;
         if ( ++*symnum == symbols_num_addrs )
+        {
+            spin_unlock(&symbols_mutex);
             goto no_symbol;
+        }
     }
 
     *type = symbols_get_symbol_type(next_offset);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Sep 09 08:55:07 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Sep 2025 08:55:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1115911.1462346 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uvu7z-0006ue-Nc; Tue, 09 Sep 2025 08:55:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1115911.1462346; Tue, 09 Sep 2025 08: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 1uvu7z-0006uW-Kp; Tue, 09 Sep 2025 08:55:03 +0000
Received: by outflank-mailman (input) for mailman id 1115911;
 Tue, 09 Sep 2025 08: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 1uvu7y-0006uQ-5G
 for xen-changelog@lists.xenproject.org; Tue, 09 Sep 2025 08: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 1uvu7y-001bRh-06
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 08:55:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uvu7x-001IGJ-3A
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 08: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=Yidpm55ywL/B7OqRurxUkNohxkLUXGimxJa9Tu887Os=; b=ysPWnyypW+JQlbMIHVU/vQdHWG
	IOelE+FgB3kAXwNsAR/Wej22QNkixCVpEy1gZlMgwVM22TqIcdAByka0sEiipjMAbxof+ReOWPsox
	UnurORshNWFXuhbeJveO0GxQtqf66d4pBlWSFYVXOw1W7pH2PMrZtkh6ZEnD3NuTdJUo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] libxl: except Dom0 from setting PoD target
Message-Id: <E1uvu7x-001IGJ-3A@xenbits.xenproject.org>
Date: Tue, 09 Sep 2025 08:55:01 +0000

commit 489a7c50c08a280ea12195468ab50c3e56635245
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Sep 9 08:16:19 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 9 08:16:19 2025 +0200

    libxl: except Dom0 from setting PoD target
    
    Dom0 is never started in PoD mode, and hence it can at "best" do harm if
    we try to set a PoD target for it.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
    Acked-by: Anthony PERARD <anthony.perard@vates.tech>
---
 tools/libs/light/libxl_mem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/libs/light/libxl_mem.c b/tools/libs/light/libxl_mem.c
index 44e554adba..30d65e174b 100644
--- a/tools/libs/light/libxl_mem.c
+++ b/tools/libs/light/libxl_mem.c
@@ -306,7 +306,7 @@ retry_transaction:
         }
     }
 
-    if (d_config.c_info.type != LIBXL_DOMAIN_TYPE_PV) {
+    if (domid && d_config.c_info.type != LIBXL_DOMAIN_TYPE_PV) {
         r = xc_domain_set_pod_target(ctx->xch, domid,
                 (new_target_memkb + size) / 4, NULL, NULL, NULL);
         if (r != 0) {
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Sep 09 08:55:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Sep 2025 08:55:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1115912.1462350 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uvu89-0006wW-Oi; Tue, 09 Sep 2025 08:55:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1115912.1462350; Tue, 09 Sep 2025 08: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 1uvu89-0006wO-MC; Tue, 09 Sep 2025 08:55:13 +0000
Received: by outflank-mailman (input) for mailman id 1115912;
 Tue, 09 Sep 2025 08: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 1uvu88-0006vn-7E
 for xen-changelog@lists.xenproject.org; Tue, 09 Sep 2025 08: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 1uvu88-001bRm-0S
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 08:55:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uvu88-001IH4-0I
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 08: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=M+/2uuZqVfDhAt6L0WSWWTD8Qa43XQvhi+iHshtv0zA=; b=O1azB0TGPh21zfOEcbemUySoLH
	4TCIwGvpmZGB6i5DuZ2BGNm5njp+KSTX3RQxDMPruFB+lnTmWbao3Sf4Tc0ihlxMHr6SvyHIOCrD6
	5sLPm0JRlSYXz5bHpC8tJcxjKwBw6QbOWEHW/vFzQNwnrcfx05Z6ixUyLOHkgrkA+LEU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] libxl: respect unset video_memkb for Dom0
Message-Id: <E1uvu88-001IH4-0I@xenbits.xenproject.org>
Date: Tue, 09 Sep 2025 08:55:12 +0000

commit 35a68ba3b2ad888f4c302d4cf5de8ab42f64236e
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Sep 9 08:17:09 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 9 08:17:09 2025 +0200

    libxl: respect unset video_memkb for Dom0
    
    Without this, Dom0 will have have a curiously off-by-1 target_memkb
    value displayed by "xl list -l".
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
    Acked-by: Anthony PERARD <anthony.perard@vates.tech>
---
 tools/libs/light/libxl_internal.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tools/libs/light/libxl_internal.h b/tools/libs/light/libxl_internal.h
index 4b6587a27a..062123eed4 100644
--- a/tools/libs/light/libxl_internal.h
+++ b/tools/libs/light/libxl_internal.h
@@ -4683,7 +4683,10 @@ uint64_t libxl__get_targetmem_fudge(libxl__gc *gc,
                                 info->max_memkb > info->target_memkb)
                                 ? LIBXL_MAXMEM_CONSTANT : 0;
 
-    return info->video_memkb + mem_target_fudge;
+    if (info->video_memkb != LIBXL_MEMKB_DEFAULT)
+        mem_target_fudge += info->video_memkb;
+
+    return mem_target_fudge;
 }
 
 int libxl__get_memory_target(libxl__gc *gc, uint32_t domid,
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Sep 09 08:55:23 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Sep 2025 08:55:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1115913.1462354 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uvu8J-0006yh-QH; Tue, 09 Sep 2025 08:55:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1115913.1462354; Tue, 09 Sep 2025 08: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 1uvu8J-0006yZ-Nd; Tue, 09 Sep 2025 08:55:23 +0000
Received: by outflank-mailman (input) for mailman id 1115913;
 Tue, 09 Sep 2025 08: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 1uvu8I-0006yO-CE
 for xen-changelog@lists.xenproject.org; Tue, 09 Sep 2025 08: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 1uvu8I-001bRq-0x
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 08:55:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uvu8I-001IHd-0c
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 08: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=S9kg6t50jAck6CvZEJ3u9j+qfikLE+7UiYz1sI511Ao=; b=Oatb2OjR+kgrSw1rV2TDi4MdGj
	DUlsCOR5e2bYvLZcMY/eH3IWLnsan5VpV99dsQeWMJSrOTc0WumPcD8p5QkVw0kAfnjUiXc2e6poq
	LX/7IPvbTFt8dnVRu6oF47ubcZh91LUGpowK1qBrONeW8Ww2vNWObOaZzu5EfOEm1NzQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] libxl: preserve errno in libxl__xcinfo2xlinfo()
Message-Id: <E1uvu8I-001IHd-0c@xenbits.xenproject.org>
Date: Tue, 09 Sep 2025 08:55:22 +0000

commit abd324a24770a9a0deb669cbc917c270a297166e
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Sep 9 08:17:28 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 9 08:17:28 2025 +0200

    libxl: preserve errno in libxl__xcinfo2xlinfo()
    
    Callers observing errors elsewhere may be confused by the ENOSYS that
    the Flask operation would yield on a Flask-disabled hypervisor.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
    Acked-by: Anthony PERARD <anthony.perard@vates.tech>
---
 tools/libs/light/libxl_domain.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/libs/light/libxl_domain.c b/tools/libs/light/libxl_domain.c
index dd2e5e9a19..5be47f687f 100644
--- a/tools/libs/light/libxl_domain.c
+++ b/tools/libs/light/libxl_domain.c
@@ -277,6 +277,7 @@ void libxl__xcinfo2xlinfo(libxl_ctx *ctx,
                           libxl_dominfo *xlinfo)
 {
     size_t size;
+    int saved_errno = errno;
 
     memcpy(&(xlinfo->uuid), xcinfo->handle, sizeof(xen_domain_handle_t));
     xlinfo->domid = xcinfo->domain;
@@ -284,6 +285,7 @@ void libxl__xcinfo2xlinfo(libxl_ctx *ctx,
     if (libxl_flask_sid_to_context(ctx, xlinfo->ssidref,
                                    &xlinfo->ssid_label, &size) < 0)
         xlinfo->ssid_label = NULL;
+    errno = saved_errno;
 
     xlinfo->dying      = !!(xcinfo->flags&XEN_DOMINF_dying);
     xlinfo->shutdown   = !!(xcinfo->flags&XEN_DOMINF_shutdown);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Sep 09 08:55:33 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Sep 2025 08:55:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1115914.1462358 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uvu8T-000713-RZ; Tue, 09 Sep 2025 08:55:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1115914.1462358; Tue, 09 Sep 2025 08: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 1uvu8T-00070v-Oz; Tue, 09 Sep 2025 08:55:33 +0000
Received: by outflank-mailman (input) for mailman id 1115914;
 Tue, 09 Sep 2025 08: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 1uvu8S-00070f-DS
 for xen-changelog@lists.xenproject.org; Tue, 09 Sep 2025 08: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 1uvu8S-001bRx-1F
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 08:55:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uvu8S-001IHz-18
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 08: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=wNkHmuNsjl82ftFo0NeqC/0RuLTfWRURfgC7yBSxtaI=; b=AscZw666udkLz0la0VlYdzpd3L
	i/flTvpusSju5zDNx3a8kB7rGFP6mmoUhkx4kIfQILJsm1Ws2IvFyhyCbuvms75Zazt7XKLJM5Sxr
	8CMTAIh0Kl40Z/Ja/nxCNGghemSjtUNrJiV79td+VEv4jMNIsgXW+CFunkoVzCxKeY/o=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/mcheck: fix mca_allbanks updating
Message-Id: <E1uvu8S-001IHz-18@xenbits.xenproject.org>
Date: Tue, 09 Sep 2025 08:55:32 +0000

commit 532988dccc197bc4fe700ebceffad95f2f4c7541
Author:     Soham Dandapat <soham.dandapat@amd.com>
AuthorDate: Tue Sep 9 08:18:11 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 9 08:18:11 2025 +0200

    x86/mcheck: fix mca_allbanks updating
    
    In mca_cap_init function,the mcabanks_alloc allocates and
    initializes an mca_banks structure for managing MCA banks,
    setting up a bank map and storing the specified or default number
    of banks.
    
    After this we will call mcabanks_set(i, mca_allbanks);
    The mcabanks_set function sets a specific bit in the bank_map of
    an mca_banks structure, provided the structure, its bank_map, and
    the bit index are valid.
    
    At the end, we will call
    mcabanks_free(xchg(&mca_allbanks, all));
    This function is thread safe and does below:
       1. Atomically exchanges the value of "mca_allbanks" with "all"
       2. Returns the old value that was previously in "mca_allbanks"
    So, when we will call mcabanks_free , that will free the memory.
    
    The problem is that mcabanks_set(i, mca_allbanks) function is updating
    mca_allbanks which will be freed via mcabanks_free later. This means
    new mca_allbanks instance("all") will never get chance to update
    it's bank_map.
    
    Due to this when we will collect log from mcheck_mca_logout function ,
    the condition "if ( !mcabanks_test(i, bankmask) )" will always fails
    and MCA logs will not be collected for any bank.
    
    The fix is to solve this problem.
    
    Fixes: 560cf418c845 ("x86/mcheck: allow varying bank counts per CPU")
    Signed-off-by: Soham Dandapat <soham.dandapat@amd.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/cpu/mcheck/mce.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/cpu/mcheck/mce.c b/xen/arch/x86/cpu/mcheck/mce.c
index bbc0d24732..9277781bff 100644
--- a/xen/arch/x86/cpu/mcheck/mce.c
+++ b/xen/arch/x86/cpu/mcheck/mce.c
@@ -664,7 +664,7 @@ static int mca_cap_init(bool bsp)
         if ( !all )
             return -ENOMEM;
         for ( i = 0; i < nr; i++ )
-            mcabanks_set(i, mca_allbanks);
+            mcabanks_set(i, all);
         mcabanks_free(xchg(&mca_allbanks, all));
     }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Sep 09 12:22:05 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Sep 2025 12:22:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1116721.1462875 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uvxMJ-0005lx-E5; Tue, 09 Sep 2025 12:22:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1116721.1462875; Tue, 09 Sep 2025 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 1uvxMJ-0005lp-BN; Tue, 09 Sep 2025 12:22:03 +0000
Received: by outflank-mailman (input) for mailman id 1116721;
 Tue, 09 Sep 2025 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 1uvxMH-0005lj-Tq
 for xen-changelog@lists.xenproject.org; Tue, 09 Sep 2025 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 1uvxMH-001fNu-2k
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 12:22:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uvxMH-001Tdf-2Q
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 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=aR8TGZn0iq/zEt6rF7bVn6Dj/hy1xnhmZSO3uQRcmUg=; b=6PYV340GdMvhPpc5KxamJDt8DM
	/H4vGjHiHhuzrVRATQmqcoW/n7swJLHG+bLuNMIrXyjDZSKLWWme2Ey2fIhNTpYdAcZDVcV9GWodm
	Cz0Fb0945DZl2XjQUVIhYUvw7cuyqeqRX5TBcTrnOW0TjnVLZ/4azvz+pnOZUblaseAo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/viridian: avoid NULL pointer dereference in update_reference_tsc()
Message-Id: <E1uvxMH-001Tdf-2Q@xenbits.xenproject.org>
Date: Tue, 09 Sep 2025 12:22:01 +0000

commit 5776a2e9db0155cfd76388c8197ca7788bb4b361
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Thu Jul 10 15:51:40 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 9 14:11:09 2025 +0200

    x86/viridian: avoid NULL pointer dereference in update_reference_tsc()
    
    The function is only called when the MSR has the enabled bit set, but even
    then the page might not be mapped because the guest provided gfn is not
    suitable.
    
    Prevent a NULL pointer dereference in update_reference_tsc() by checking
    whether the page is mapped.
    
    This is CVE-2025-27466 / part of XSA-472.
    
    Fixes: 386b3365221d ('viridian: use viridian_map/unmap_guest_page() for reference tsc page')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/viridian/time.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/xen/arch/x86/hvm/viridian/time.c b/xen/arch/x86/hvm/viridian/time.c
index 137577384f..ca6d526f46 100644
--- a/xen/arch/x86/hvm/viridian/time.c
+++ b/xen/arch/x86/hvm/viridian/time.c
@@ -26,6 +26,10 @@ static void update_reference_tsc(const struct domain *d, bool initialize)
     HV_REFERENCE_TSC_PAGE *p = rt->ptr;
     uint32_t seq;
 
+    /* Reference TSC page might not be mapped even if the MSR is enabled. */
+    if ( !p )
+        return;
+
     if ( initialize )
         clear_page(p);
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Sep 09 12:22:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Sep 2025 12:22:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1116722.1462879 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uvxMT-0005pD-FD; Tue, 09 Sep 2025 12:22:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1116722.1462879; Tue, 09 Sep 2025 12: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 1uvxMT-0005p5-Cf; Tue, 09 Sep 2025 12:22:13 +0000
Received: by outflank-mailman (input) for mailman id 1116722;
 Tue, 09 Sep 2025 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 1uvxMS-0005oT-0i
 for xen-changelog@lists.xenproject.org; Tue, 09 Sep 2025 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 1uvxMR-001fO3-3C
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 12:22:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uvxMR-001TeQ-2v
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 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=FPBdeW1k1W9Rg3a3SOBLWhHy4XH1gTF/yrJ74for75Y=; b=AROrBmVcit5aLyvnmIHPzeAMx0
	33HUGn6VB62RcxZMcf2Gb0ExmiPtYu+Wv4V9ZjPa60wDpmJJxKHiVjTHXKgDpEVfsOIn8UaFoItLB
	QLlopzKMPpI1mAwWthoqP0AurbHQqpZjblQYc1+ylzd0SbuC/Mky5WXnKaOPf3AOunCo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/viridian: avoid NULL pointer dereference in viridian_synic_deliver_timer_msg()
Message-Id: <E1uvxMR-001TeQ-2v@xenbits.xenproject.org>
Date: Tue, 09 Sep 2025 12:22:11 +0000

commit 3a7b4f2897a352cff287be97d27150b290a5d1ee
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Thu Jul 10 15:58:51 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 9 14:11:34 2025 +0200

    x86/viridian: avoid NULL pointer dereference in viridian_synic_deliver_timer_msg()
    
    The function is called unconditionally, regardless of whether the SIM page
    is mapped.  Avoid a NULL pointer dereference in
    viridian_synic_deliver_timer_msg() by checking whether the SIM page is
    mapped.
    
    This is CVE-2025-58142 / part of XSA-472.
    
    Fixes: 26fba3c85571 ('viridian: add implementation of synthetic timers')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/viridian/synic.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/xen/arch/x86/hvm/viridian/synic.c b/xen/arch/x86/hvm/viridian/synic.c
index c3dc573b00..e6cba7548f 100644
--- a/xen/arch/x86/hvm/viridian/synic.c
+++ b/xen/arch/x86/hvm/viridian/synic.c
@@ -338,6 +338,10 @@ bool viridian_synic_deliver_timer_msg(struct vcpu *v, unsigned int sintx,
         .DeliveryTime = delivery,
     };
 
+    /* Don't assume SIM page to be mapped. */
+    if ( !msg )
+        return false;
+
     /*
      * To avoid using an atomic test-and-set, and barrier before calling
      * vlapic_set_irq(), this function must be called in context of the
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Sep 09 12:22:23 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Sep 2025 12:22:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1116723.1462883 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uvxMd-0005rs-Gf; Tue, 09 Sep 2025 12:22:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1116723.1462883; Tue, 09 Sep 2025 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 1uvxMd-0005rk-E0; Tue, 09 Sep 2025 12:22:23 +0000
Received: by outflank-mailman (input) for mailman id 1116723;
 Tue, 09 Sep 2025 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 1uvxMc-0005rW-3T
 for xen-changelog@lists.xenproject.org; Tue, 09 Sep 2025 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 1uvxMc-001fO8-0G
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 12:22:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uvxMc-001Tfn-09
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 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=hfKE02HjTYKKpRM0jouVnpXu8iJ4Q+WwzsxA17WZxg8=; b=g8ed08Ua2A/Pz9Ax4r6V+EcAOz
	uomuWEeicqMc6VW6odX6KrIILoq8pP9JWz0cT/DTFUQA63XJGrQlvgyLBqtfnm+/6oQn0mDwxAxA1
	4BRfAbGB2uNP/qwcukw2FOuNoSAZ/e0h+tnt+B7CSwsV2xAI76oOr02dKJ8qcmwUvxOI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/viridian: protect concurrent modification of the reference TSC page
Message-Id: <E1uvxMc-001Tfn-09@xenbits.xenproject.org>
Date: Tue, 09 Sep 2025 12:22:22 +0000

commit 45729a510a352e1a973e4023bd0067cddb1bcaf8
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Thu Jul 3 13:09:03 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 9 14:12:00 2025 +0200

    x86/viridian: protect concurrent modification of the reference TSC page
    
    The reference TSC page is shared between all vCPUs, and the data stored in
    the domain struct.  However the handlers to set and clear it are not safe
    against concurrent accesses.  It's possible for two (or more) vCPUs to call
    HV_X64_MSR_REFERENCE_TSC at the same time and cause the in-use reference
    TSC page to be freed, while still being on the p2m.  This creates a use-
    after-free bug, where the page can end up mapped in another domain or used
    by Xen while still being part of the original domain's p2m.
    
    It's also possible to underflow the reference counter, as multiple
    concurrent writes to HV_X64_MSR_REFERENCE_TSC can create an imbalance on
    the number of put_page_and_type() calls.
    
    Introduce a lock to protect the reference TSC domain field, thus
    serializing concurrent vCPU accesses.
    
    This is CVE-2025-58143 / part of XSA-472.
    
    Fixes: 386b3365221d ('viridian: use viridian_map/unmap_guest_page() for reference tsc page')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/viridian/time.c        | 4 ++++
 xen/arch/x86/hvm/viridian/viridian.c    | 2 ++
 xen/arch/x86/include/asm/hvm/viridian.h | 1 +
 3 files changed, 7 insertions(+)

diff --git a/xen/arch/x86/hvm/viridian/time.c b/xen/arch/x86/hvm/viridian/time.c
index ca6d526f46..9311858d63 100644
--- a/xen/arch/x86/hvm/viridian/time.c
+++ b/xen/arch/x86/hvm/viridian/time.c
@@ -108,8 +108,10 @@ static void time_ref_count_thaw(const struct domain *d)
 
     trc->off = (int64_t)trc->val - trc_val(d, 0);
 
+    spin_lock(&vd->lock);
     if ( vd->reference_tsc.msr.enabled )
         update_reference_tsc(d, false);
+    spin_unlock(&vd->lock);
 }
 
 static uint64_t time_ref_count(const struct domain *d)
@@ -331,6 +333,7 @@ int viridian_time_wrmsr(struct vcpu *v, uint32_t idx, uint64_t val)
         if ( !(viridian_feature_mask(d) & HVMPV_reference_tsc) )
             return X86EMUL_EXCEPTION;
 
+        spin_lock(&vd->lock);
         viridian_unmap_guest_page(&vd->reference_tsc);
         vd->reference_tsc.msr.raw = val;
         viridian_dump_guest_page(v, "REFERENCE_TSC", &vd->reference_tsc);
@@ -339,6 +342,7 @@ int viridian_time_wrmsr(struct vcpu *v, uint32_t idx, uint64_t val)
             viridian_map_guest_page(d, &vd->reference_tsc);
             update_reference_tsc(d, true);
         }
+        spin_unlock(&vd->lock);
         break;
 
     case HV_X64_MSR_TIME_REF_COUNT:
diff --git a/xen/arch/x86/hvm/viridian/viridian.c b/xen/arch/x86/hvm/viridian/viridian.c
index 7ea6c90168..c0be24bd22 100644
--- a/xen/arch/x86/hvm/viridian/viridian.c
+++ b/xen/arch/x86/hvm/viridian/viridian.c
@@ -494,6 +494,8 @@ int viridian_domain_init(struct domain *d)
     if ( !d->arch.hvm.viridian )
         return -ENOMEM;
 
+    spin_lock_init(&d->arch.hvm.viridian->lock);
+
     rc = viridian_synic_domain_init(d);
     if ( rc )
         goto fail;
diff --git a/xen/arch/x86/include/asm/hvm/viridian.h b/xen/arch/x86/include/asm/hvm/viridian.h
index 4c8ff6e80b..47c9d13841 100644
--- a/xen/arch/x86/include/asm/hvm/viridian.h
+++ b/xen/arch/x86/include/asm/hvm/viridian.h
@@ -71,6 +71,7 @@ struct viridian_domain
     DECLARE_BITMAP(hypercall_flags, _HCALL_nr);
     struct viridian_time_ref_count time_ref_count;
     struct viridian_page reference_tsc;
+    spinlock_t lock;
 };
 
 void cpuid_viridian_leaves(const struct vcpu *v, uint32_t leaf,
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Sep 09 12:22:33 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Sep 2025 12:22:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1116728.1462903 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uvxMn-00060k-Mp; Tue, 09 Sep 2025 12:22:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1116728.1462903; Tue, 09 Sep 2025 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 1uvxMn-00060c-K7; Tue, 09 Sep 2025 12:22:33 +0000
Received: by outflank-mailman (input) for mailman id 1116728;
 Tue, 09 Sep 2025 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 1uvxMm-000602-6c
 for xen-changelog@lists.xenproject.org; Tue, 09 Sep 2025 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 1uvxMm-001fOF-0Z
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 12:22:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uvxMm-001Tgd-0R
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 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=0MLn+gJtZvWWo9NGUV/dymMByn0wLsSyurh23Wqlzqk=; b=rECDxwi5m0b5TsiJcgeI4S29FX
	R9g2DB4YIbu7Be/w+uRVbdKNGHYhX+6B8ARkJwYxnEZurki/kbw8xANgNNcnELZOivgBzMDRgEe9G
	nhIfVScgDy8lJEaspOrNK3H/dWZxUcTT9RanhESGWYYlIQ8lTu1TvrdE5ne4Oqg9xx+c=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] Arm: foreign page handling in p2m_get_page_from_gfn()
Message-Id: <E1uvxMm-001Tgd-0R@xenbits.xenproject.org>
Date: Tue, 09 Sep 2025 12:22:32 +0000

commit c5a6dd68508c998c95ca87f59e9ecb6da93ca6ab
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Sep 9 14:12:13 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 9 14:12:13 2025 +0200

    Arm: foreign page handling in p2m_get_page_from_gfn()
    
    I can't see what would make the 1st of the assertions safe: For example,
    the P2M lock not being held, the foreign page may disappear before we
    get to call page_get_owner_and_reference(), which hence may return NULL.
    
    Even the 2nd, which appears to be safe safe, is lacking proper release
    build fallbacks.
    
    Drop the former in favor of an if(), and convert the latter to the
    equivalent of what x86 uses: ASSERT_UNREACHABLE() plus putting of the
    obtained page.
    
    This is CVE-2025-58144 / part of XSA-473.
    
    Fixes: 9486a8d07ba8 ("xen/arm: Handle remove foreign mapping")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/p2m.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
index ef8bd4b6ab..667ea595f4 100644
--- a/xen/arch/arm/p2m.c
+++ b/xen/arch/arm/p2m.c
@@ -74,10 +74,16 @@ struct page_info *p2m_get_page_from_gfn(struct domain *d, gfn_t gfn,
      */
     if ( p2m_is_foreign(p2mt) )
     {
-        struct domain *fdom = page_get_owner_and_reference(page);
-        ASSERT(fdom != NULL);
-        ASSERT(fdom != d);
-        return page;
+        const struct domain *fdom = page_get_owner_and_reference(page);
+
+        if ( fdom )
+        {
+            if ( fdom != d )
+                return page;
+            ASSERT_UNREACHABLE();
+            put_page(page);
+        }
+        return NULL;
     }
 
     return get_page(page, d) ? page : NULL;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Sep 09 12:22:43 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Sep 2025 12:22:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1116729.1462906 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uvxMx-00066U-OD; Tue, 09 Sep 2025 12:22:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1116729.1462906; Tue, 09 Sep 2025 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 1uvxMx-00066M-Lb; Tue, 09 Sep 2025 12:22:43 +0000
Received: by outflank-mailman (input) for mailman id 1116729;
 Tue, 09 Sep 2025 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 1uvxMw-000663-Az
 for xen-changelog@lists.xenproject.org; Tue, 09 Sep 2025 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 1uvxMw-001fQV-10
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 12:22:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uvxMw-001ThW-0j
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 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=mGcm/vKYz8tm/Ky5kMGmdCpVtCfm5P8LP4HRwUP7u7Q=; b=hy6PN21uFSm3cAH4ZmutXt4Xqh
	1Tgtj06CO3e5uswzbW253WdXp7YYSW+TaTr1GfOBTM2f10Mm+6DFtAiqG16Fc0Zwq8binmwM/H0GE
	s1ZZFtKLTUnGdww2XCyiunKh5rjYSZdlj6h5dtf/HnxdNYjs8wYb0HZIfjiBVVfNUbJs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] Arm: adjust locking in p2m_get_page_from_gfn()
Message-Id: <E1uvxMw-001ThW-0j@xenbits.xenproject.org>
Date: Tue, 09 Sep 2025 12:22:42 +0000

commit 2275bf83a1db579661b27fc4b310a7d92594dbc0
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Sep 9 14:12:57 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 9 14:12:57 2025 +0200

    Arm: adjust locking in p2m_get_page_from_gfn()
    
    In order to safely acquire a reference for a foreign page mapping, the
    P2M lock needs to be held until we have the reference in hand (or
    getting one failed). Otherwise the page can change P2M type and
    ownership in between.
    
    This is CVE-2025-58145 / part of XSA-473.
    
    Fixes: 9486a8d07ba8 ("xen/arm: Handle remove foreign mapping")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/p2m.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
index 667ea595f4..fb03978a19 100644
--- a/xen/arch/arm/p2m.c
+++ b/xen/arch/arm/p2m.c
@@ -53,18 +53,22 @@ mfn_t p2m_lookup(struct domain *d, gfn_t gfn, p2m_type_t *t)
 struct page_info *p2m_get_page_from_gfn(struct domain *d, gfn_t gfn,
                                         p2m_type_t *t)
 {
+    struct p2m_domain *p2m = p2m_get_hostp2m(d);
     struct page_info *page;
     p2m_type_t p2mt;
-    mfn_t mfn = p2m_lookup(d, gfn, &p2mt);
+    mfn_t mfn;
+
+    p2m_read_lock(p2m);
+    mfn = p2m_get_entry(p2m, gfn, &p2mt, NULL, NULL, NULL);
 
     if ( t )
         *t = p2mt;
 
-    if ( !p2m_is_any_ram(p2mt) )
-        return NULL;
-
-    if ( !mfn_valid(mfn) )
+    if ( !p2m_is_any_ram(p2mt) || !mfn_valid(mfn) )
+    {
+        p2m_read_unlock(p2m);
         return NULL;
+    }
 
     page = mfn_to_page(mfn);
 
@@ -76,6 +80,8 @@ struct page_info *p2m_get_page_from_gfn(struct domain *d, gfn_t gfn,
     {
         const struct domain *fdom = page_get_owner_and_reference(page);
 
+        p2m_read_unlock(p2m);
+
         if ( fdom )
         {
             if ( fdom != d )
@@ -86,6 +92,8 @@ struct page_info *p2m_get_page_from_gfn(struct domain *d, gfn_t gfn,
         return NULL;
     }
 
+    p2m_read_unlock(p2m);
+
     return get_page(page, d) ? page : NULL;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Sep 09 12:33:06 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Sep 2025 12:33:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1116732.1462913 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uvxWx-0007JW-Fl; Tue, 09 Sep 2025 12:33:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1116732.1462913; Tue, 09 Sep 2025 12: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 1uvxWx-0007JO-Ca; Tue, 09 Sep 2025 12:33:03 +0000
Received: by outflank-mailman (input) for mailman id 1116732;
 Tue, 09 Sep 2025 12: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 1uvxWw-0007JF-8d
 for xen-changelog@lists.xenproject.org; Tue, 09 Sep 2025 12: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 1uvxWw-001feL-0S
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 12:33:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uvxWw-001UQq-0A
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 12: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=QuzT1ddGkBGvirX6xbogBnZO+hvYVlD5qdaY9rMSKBQ=; b=vvlBpiRLPtn4aIV5XT6ZnSCq/E
	CVUGWiUiMOjjLwKx99zE6kPhLyCtxT4pRN3xHjMd3MFobvUP05tDRYSpXXgDZk50vuzL3/2yqezOj
	9dyaRmRfXSV3VA8O23HWcRZifMkm5nF5E5iWt7uISInzn2dIuQU9vPv+mMuE1qqmvzBk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.20] x86/viridian: avoid NULL pointer dereference in update_reference_tsc()
Message-Id: <E1uvxWw-001UQq-0A@xenbits.xenproject.org>
Date: Tue, 09 Sep 2025 12:33:02 +0000

commit 5f83f721fb62bc59505f07150af23a12ad90a711
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Tue Sep 9 14:20:46 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 9 14:20:46 2025 +0200

    x86/viridian: avoid NULL pointer dereference in update_reference_tsc()
    
    The function is only called when the MSR has the enabled bit set, but even
    then the page might not be mapped because the guest provided gfn is not
    suitable.
    
    Prevent a NULL pointer dereference in update_reference_tsc() by checking
    whether the page is mapped.
    
    This is CVE-2025-27466 / part of XSA-472.
    
    Fixes: 386b3365221d ('viridian: use viridian_map/unmap_guest_page() for reference tsc page')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 5776a2e9db0155cfd76388c8197ca7788bb4b361
    master date: 2025-09-09 14:11:09 +0200
---
 xen/arch/x86/hvm/viridian/time.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/xen/arch/x86/hvm/viridian/time.c b/xen/arch/x86/hvm/viridian/time.c
index 137577384f..ca6d526f46 100644
--- a/xen/arch/x86/hvm/viridian/time.c
+++ b/xen/arch/x86/hvm/viridian/time.c
@@ -26,6 +26,10 @@ static void update_reference_tsc(const struct domain *d, bool initialize)
     HV_REFERENCE_TSC_PAGE *p = rt->ptr;
     uint32_t seq;
 
+    /* Reference TSC page might not be mapped even if the MSR is enabled. */
+    if ( !p )
+        return;
+
     if ( initialize )
         clear_page(p);
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.20


From xen-changelog-bounces@lists.xenproject.org Tue Sep 09 12:33:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Sep 2025 12:33:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1116733.1462915 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uvxX7-0007LJ-Gd; Tue, 09 Sep 2025 12:33:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1116733.1462915; Tue, 09 Sep 2025 12: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 1uvxX7-0007L9-Dv; Tue, 09 Sep 2025 12:33:13 +0000
Received: by outflank-mailman (input) for mailman id 1116733;
 Tue, 09 Sep 2025 12: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 1uvxX6-0007Ky-A3
 for xen-changelog@lists.xenproject.org; Tue, 09 Sep 2025 12: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 1uvxX6-001feX-0j
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 12:33:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uvxX6-001URS-0c
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 12: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=WH8cRa3kM0DOVJKqTuoldNSGd2Cg6Mjco0N+V5AEicY=; b=xdKsjpAoUCtgdCrHeMmndQ5zAs
	s8t+uSJXcS0WyQanEpiAMVvcpmuX5WXL5hQcOkjgarAJRcd+tz4YRzn7V3T7d1ullgaJANKKtDgQ5
	XIx07C/YMdylKLkMg5i5gq9+3rBobu34mcYzmuDLCEGPOz78tzUDSQtypb4imi3igSps=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.20] x86/viridian: avoid NULL pointer dereference in viridian_synic_deliver_timer_msg()
Message-Id: <E1uvxX6-001URS-0c@xenbits.xenproject.org>
Date: Tue, 09 Sep 2025 12:33:12 +0000

commit c5ecaf0200b36e7f13c837dad4e4a801a8674ebe
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Tue Sep 9 14:21:22 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 9 14:21:22 2025 +0200

    x86/viridian: avoid NULL pointer dereference in viridian_synic_deliver_timer_msg()
    
    The function is called unconditionally, regardless of whether the SIM page
    is mapped.  Avoid a NULL pointer dereference in
    viridian_synic_deliver_timer_msg() by checking whether the SIM page is
    mapped.
    
    This is CVE-2025-58142 / part of XSA-472.
    
    Fixes: 26fba3c85571 ('viridian: add implementation of synthetic timers')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 3a7b4f2897a352cff287be97d27150b290a5d1ee
    master date: 2025-09-09 14:11:34 +0200
---
 xen/arch/x86/hvm/viridian/synic.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/xen/arch/x86/hvm/viridian/synic.c b/xen/arch/x86/hvm/viridian/synic.c
index c3dc573b00..e6cba7548f 100644
--- a/xen/arch/x86/hvm/viridian/synic.c
+++ b/xen/arch/x86/hvm/viridian/synic.c
@@ -338,6 +338,10 @@ bool viridian_synic_deliver_timer_msg(struct vcpu *v, unsigned int sintx,
         .DeliveryTime = delivery,
     };
 
+    /* Don't assume SIM page to be mapped. */
+    if ( !msg )
+        return false;
+
     /*
      * To avoid using an atomic test-and-set, and barrier before calling
      * vlapic_set_irq(), this function must be called in context of the
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.20


From xen-changelog-bounces@lists.xenproject.org Tue Sep 09 12:33:23 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Sep 2025 12:33:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1116734.1462919 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uvxXH-0007Nt-IE; Tue, 09 Sep 2025 12:33:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1116734.1462919; Tue, 09 Sep 2025 12: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 1uvxXH-0007Nl-FH; Tue, 09 Sep 2025 12:33:23 +0000
Received: by outflank-mailman (input) for mailman id 1116734;
 Tue, 09 Sep 2025 12: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 1uvxXG-0007Nf-Cq
 for xen-changelog@lists.xenproject.org; Tue, 09 Sep 2025 12: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 1uvxXG-001fed-11
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 12:33:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uvxXG-001US5-0u
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 12: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=RRcADngSNry2k21V9bMxPNaQ1gLeq1iJcK08o9rsxtU=; b=wVXnHJLCjRtaKz1oaoOiRzDMYo
	ND4hpPGoBNwOBVDwPwyuL3zMkdrTqcDulhY06UL96ZAJEQRQZg069/z4U0L/IzziiexRf/CwIPQFO
	1sXnxztWL5HRbSy5lPylqKVonvY31IJ6tWxAbrkx/e7XEQra7/ojWH9myh6oCd02tg60=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.20] x86/viridian: protect concurrent modification of the reference TSC page
Message-Id: <E1uvxXG-001US5-0u@xenbits.xenproject.org>
Date: Tue, 09 Sep 2025 12:33:22 +0000

commit 665a641471efbcf97a6bea6a7543bbd7b475dc54
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Tue Sep 9 14:21:36 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 9 14:21:36 2025 +0200

    x86/viridian: protect concurrent modification of the reference TSC page
    
    The reference TSC page is shared between all vCPUs, and the data stored in
    the domain struct.  However the handlers to set and clear it are not safe
    against concurrent accesses.  It's possible for two (or more) vCPUs to call
    HV_X64_MSR_REFERENCE_TSC at the same time and cause the in-use reference
    TSC page to be freed, while still being on the p2m.  This creates a use-
    after-free bug, where the page can end up mapped in another domain or used
    by Xen while still being part of the original domain's p2m.
    
    It's also possible to underflow the reference counter, as multiple
    concurrent writes to HV_X64_MSR_REFERENCE_TSC can create an imbalance on
    the number of put_page_and_type() calls.
    
    Introduce a lock to protect the reference TSC domain field, thus
    serializing concurrent vCPU accesses.
    
    This is CVE-2025-58143 / part of XSA-472.
    
    Fixes: 386b3365221d ('viridian: use viridian_map/unmap_guest_page() for reference tsc page')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 45729a510a352e1a973e4023bd0067cddb1bcaf8
    master date: 2025-09-09 14:12:00 +0200
---
 xen/arch/x86/hvm/viridian/time.c        | 4 ++++
 xen/arch/x86/hvm/viridian/viridian.c    | 2 ++
 xen/arch/x86/include/asm/hvm/viridian.h | 1 +
 3 files changed, 7 insertions(+)

diff --git a/xen/arch/x86/hvm/viridian/time.c b/xen/arch/x86/hvm/viridian/time.c
index ca6d526f46..9311858d63 100644
--- a/xen/arch/x86/hvm/viridian/time.c
+++ b/xen/arch/x86/hvm/viridian/time.c
@@ -108,8 +108,10 @@ static void time_ref_count_thaw(const struct domain *d)
 
     trc->off = (int64_t)trc->val - trc_val(d, 0);
 
+    spin_lock(&vd->lock);
     if ( vd->reference_tsc.msr.enabled )
         update_reference_tsc(d, false);
+    spin_unlock(&vd->lock);
 }
 
 static uint64_t time_ref_count(const struct domain *d)
@@ -331,6 +333,7 @@ int viridian_time_wrmsr(struct vcpu *v, uint32_t idx, uint64_t val)
         if ( !(viridian_feature_mask(d) & HVMPV_reference_tsc) )
             return X86EMUL_EXCEPTION;
 
+        spin_lock(&vd->lock);
         viridian_unmap_guest_page(&vd->reference_tsc);
         vd->reference_tsc.msr.raw = val;
         viridian_dump_guest_page(v, "REFERENCE_TSC", &vd->reference_tsc);
@@ -339,6 +342,7 @@ int viridian_time_wrmsr(struct vcpu *v, uint32_t idx, uint64_t val)
             viridian_map_guest_page(d, &vd->reference_tsc);
             update_reference_tsc(d, true);
         }
+        spin_unlock(&vd->lock);
         break;
 
     case HV_X64_MSR_TIME_REF_COUNT:
diff --git a/xen/arch/x86/hvm/viridian/viridian.c b/xen/arch/x86/hvm/viridian/viridian.c
index 33d54e587e..8ff19a00fe 100644
--- a/xen/arch/x86/hvm/viridian/viridian.c
+++ b/xen/arch/x86/hvm/viridian/viridian.c
@@ -494,6 +494,8 @@ int viridian_domain_init(struct domain *d)
     if ( !d->arch.hvm.viridian )
         return -ENOMEM;
 
+    spin_lock_init(&d->arch.hvm.viridian->lock);
+
     rc = viridian_synic_domain_init(d);
     if ( rc )
         goto fail;
diff --git a/xen/arch/x86/include/asm/hvm/viridian.h b/xen/arch/x86/include/asm/hvm/viridian.h
index 4c8ff6e80b..47c9d13841 100644
--- a/xen/arch/x86/include/asm/hvm/viridian.h
+++ b/xen/arch/x86/include/asm/hvm/viridian.h
@@ -71,6 +71,7 @@ struct viridian_domain
     DECLARE_BITMAP(hypercall_flags, _HCALL_nr);
     struct viridian_time_ref_count time_ref_count;
     struct viridian_page reference_tsc;
+    spinlock_t lock;
 };
 
 void cpuid_viridian_leaves(const struct vcpu *v, uint32_t leaf,
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.20


From xen-changelog-bounces@lists.xenproject.org Tue Sep 09 12:33:33 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Sep 2025 12:33:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1116735.1462923 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uvxXR-0007S5-Kg; Tue, 09 Sep 2025 12:33:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1116735.1462923; Tue, 09 Sep 2025 12: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 1uvxXR-0007Rx-I5; Tue, 09 Sep 2025 12:33:33 +0000
Received: by outflank-mailman (input) for mailman id 1116735;
 Tue, 09 Sep 2025 12: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 1uvxXQ-0007Rk-Dw
 for xen-changelog@lists.xenproject.org; Tue, 09 Sep 2025 12: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 1uvxXQ-001feh-1J
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 12:33:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uvxXQ-001USi-1C
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 12: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=qEb30hr3JzROS+pC1wijn5buvtfrbSdyOq34exbz7l8=; b=Oy9fc9OAXK1oHROnbnesBdopzy
	9kmAfUpr2uS92LFm8Po4OKKT/ElPBJ/Dq+ayKEZMZOLQQyCsIDKV0Gi9vvYXVfvU0gTl0Fh+ZAXZi
	KWDc9/AE/lfCEz784GF77IXAJ1OxJg+MZF0qalJUEL6c4KCzXxnJjXXQgd1zv5Mu2tTM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.20] Arm: foreign page handling in p2m_get_page_from_gfn()
Message-Id: <E1uvxXQ-001USi-1C@xenbits.xenproject.org>
Date: Tue, 09 Sep 2025 12:33:32 +0000

commit 1230b94f1c9eab96a2c6f4e0de8a511b6247c289
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Sep 9 14:21:51 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 9 14:21:51 2025 +0200

    Arm: foreign page handling in p2m_get_page_from_gfn()
    
    I can't see what would make the 1st of the assertions safe: For example,
    the P2M lock not being held, the foreign page may disappear before we
    get to call page_get_owner_and_reference(), which hence may return NULL.
    
    Even the 2nd, which appears to be safe safe, is lacking proper release
    build fallbacks.
    
    Drop the former in favor of an if(), and convert the latter to the
    equivalent of what x86 uses: ASSERT_UNREACHABLE() plus putting of the
    obtained page.
    
    This is CVE-2025-58144 / part of XSA-473.
    
    Fixes: 9486a8d07ba8 ("xen/arm: Handle remove foreign mapping")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
    master commit: c5a6dd68508c998c95ca87f59e9ecb6da93ca6ab
    master date: 2025-09-09 14:12:13 +0200
---
 xen/arch/arm/p2m.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
index 65b70955e3..b4573ddf32 100644
--- a/xen/arch/arm/p2m.c
+++ b/xen/arch/arm/p2m.c
@@ -74,10 +74,16 @@ struct page_info *p2m_get_page_from_gfn(struct domain *d, gfn_t gfn,
      */
     if ( p2m_is_foreign(p2mt) )
     {
-        struct domain *fdom = page_get_owner_and_reference(page);
-        ASSERT(fdom != NULL);
-        ASSERT(fdom != d);
-        return page;
+        const struct domain *fdom = page_get_owner_and_reference(page);
+
+        if ( fdom )
+        {
+            if ( fdom != d )
+                return page;
+            ASSERT_UNREACHABLE();
+            put_page(page);
+        }
+        return NULL;
     }
 
     return get_page(page, d) ? page : NULL;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.20


From xen-changelog-bounces@lists.xenproject.org Tue Sep 09 12:33:43 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Sep 2025 12:33:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1116736.1462926 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uvxXb-0007UU-M1; Tue, 09 Sep 2025 12:33:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1116736.1462926; Tue, 09 Sep 2025 12: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 1uvxXb-0007UM-JQ; Tue, 09 Sep 2025 12:33:43 +0000
Received: by outflank-mailman (input) for mailman id 1116736;
 Tue, 09 Sep 2025 12: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 1uvxXa-0007U9-Ic
 for xen-changelog@lists.xenproject.org; Tue, 09 Sep 2025 12: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 1uvxXa-001few-1a
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 12:33:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uvxXa-001UTW-1T
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 12: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=XeZ5GoEOTEk9C8PDndlkGr6ykE3AydwCWBJHqiGuKEw=; b=Oxl3OusbC2tl7TGG8DXISMfmF9
	nhzZEco3gCtfPiMpxO6iVJv7SkAA9qcS4G4DPTINIy0O7d4fayXk7pnYaaxRvCgV/KT9PJUI9bI43
	7oyxzGRrhrPlsgX/fSLI+lUUtyS9A0MdUNGbiMQ0LlMbPmwdSq8NDPcvQHl9c6jCHFYk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.20] Arm: adjust locking in p2m_get_page_from_gfn()
Message-Id: <E1uvxXa-001UTW-1T@xenbits.xenproject.org>
Date: Tue, 09 Sep 2025 12:33:42 +0000

commit d7e55a41399ef1355e3df66270db7e682e7e1150
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Sep 9 14:22:01 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 9 14:22:01 2025 +0200

    Arm: adjust locking in p2m_get_page_from_gfn()
    
    In order to safely acquire a reference for a foreign page mapping, the
    P2M lock needs to be held until we have the reference in hand (or
    getting one failed). Otherwise the page can change P2M type and
    ownership in between.
    
    This is CVE-2025-58145 / part of XSA-473.
    
    Fixes: 9486a8d07ba8 ("xen/arm: Handle remove foreign mapping")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
    master commit: 2275bf83a1db579661b27fc4b310a7d92594dbc0
    master date: 2025-09-09 14:12:57 +0200
---
 xen/arch/arm/p2m.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
index b4573ddf32..584701e64f 100644
--- a/xen/arch/arm/p2m.c
+++ b/xen/arch/arm/p2m.c
@@ -53,18 +53,22 @@ mfn_t p2m_lookup(struct domain *d, gfn_t gfn, p2m_type_t *t)
 struct page_info *p2m_get_page_from_gfn(struct domain *d, gfn_t gfn,
                                         p2m_type_t *t)
 {
+    struct p2m_domain *p2m = p2m_get_hostp2m(d);
     struct page_info *page;
     p2m_type_t p2mt;
-    mfn_t mfn = p2m_lookup(d, gfn, &p2mt);
+    mfn_t mfn;
+
+    p2m_read_lock(p2m);
+    mfn = p2m_get_entry(p2m, gfn, &p2mt, NULL, NULL, NULL);
 
     if ( t )
         *t = p2mt;
 
-    if ( !p2m_is_any_ram(p2mt) )
-        return NULL;
-
-    if ( !mfn_valid(mfn) )
+    if ( !p2m_is_any_ram(p2mt) || !mfn_valid(mfn) )
+    {
+        p2m_read_unlock(p2m);
         return NULL;
+    }
 
     page = mfn_to_page(mfn);
 
@@ -76,6 +80,8 @@ struct page_info *p2m_get_page_from_gfn(struct domain *d, gfn_t gfn,
     {
         const struct domain *fdom = page_get_owner_and_reference(page);
 
+        p2m_read_unlock(p2m);
+
         if ( fdom )
         {
             if ( fdom != d )
@@ -86,6 +92,8 @@ struct page_info *p2m_get_page_from_gfn(struct domain *d, gfn_t gfn,
         return NULL;
     }
 
+    p2m_read_unlock(p2m);
+
     return get_page(page, d) ? page : NULL;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.20


From xen-changelog-bounces@lists.xenproject.org Tue Sep 09 12:33:54 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Sep 2025 12:33:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1116737.1462931 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uvxXm-0007Wq-NN; Tue, 09 Sep 2025 12:33:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1116737.1462931; Tue, 09 Sep 2025 12: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 1uvxXm-0007Wi-Kn; Tue, 09 Sep 2025 12:33:54 +0000
Received: by outflank-mailman (input) for mailman id 1116737;
 Tue, 09 Sep 2025 12: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 1uvxXk-0007WX-Ug
 for xen-changelog@lists.xenproject.org; Tue, 09 Sep 2025 12: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 1uvxXk-001ffT-2y
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 12:33:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uvxXk-001UUz-2s
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 12: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=KbRV8rwuvn3ZYcImY1p9HA5aGtUJL6AKEZZYpz+R8z8=; b=ZsPRdJIJaJJwD30iaDNmh/R4nd
	y4vPc5XbIP/rM2I7Ctw3dYq9+mDePUY2Nstim9mPsjmsC/M6bKgaJ27A7AV0todekGvCodzg1VMlj
	ZBikQiyi7JhOWUXO7mFlLqn3dk/nfY8DurWlTJclQL0Sm7Bwv/YUyt1GlCil1blqRsvU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] x86/viridian: avoid NULL pointer dereference in update_reference_tsc()
Message-Id: <E1uvxXk-001UUz-2s@xenbits.xenproject.org>
Date: Tue, 09 Sep 2025 12:33:52 +0000

commit 8924243e5ffa9836f7484aecf5875a72389a8ab2
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Tue Sep 9 14:22:36 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 9 14:22:36 2025 +0200

    x86/viridian: avoid NULL pointer dereference in update_reference_tsc()
    
    The function is only called when the MSR has the enabled bit set, but even
    then the page might not be mapped because the guest provided gfn is not
    suitable.
    
    Prevent a NULL pointer dereference in update_reference_tsc() by checking
    whether the page is mapped.
    
    This is CVE-2025-27466 / part of XSA-472.
    
    Fixes: 386b3365221d ('viridian: use viridian_map/unmap_guest_page() for reference tsc page')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 5776a2e9db0155cfd76388c8197ca7788bb4b361
    master date: 2025-09-09 14:11:09 +0200
---
 xen/arch/x86/hvm/viridian/time.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/xen/arch/x86/hvm/viridian/time.c b/xen/arch/x86/hvm/viridian/time.c
index 137577384f..ca6d526f46 100644
--- a/xen/arch/x86/hvm/viridian/time.c
+++ b/xen/arch/x86/hvm/viridian/time.c
@@ -26,6 +26,10 @@ static void update_reference_tsc(const struct domain *d, bool initialize)
     HV_REFERENCE_TSC_PAGE *p = rt->ptr;
     uint32_t seq;
 
+    /* Reference TSC page might not be mapped even if the MSR is enabled. */
+    if ( !p )
+        return;
+
     if ( initialize )
         clear_page(p);
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Tue Sep 09 12:34:04 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Sep 2025 12:34:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1116738.1462935 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uvxXw-0007Yt-P0; Tue, 09 Sep 2025 12:34:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1116738.1462935; Tue, 09 Sep 2025 12:34: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 1uvxXw-0007Yl-MI; Tue, 09 Sep 2025 12:34:04 +0000
Received: by outflank-mailman (input) for mailman id 1116738;
 Tue, 09 Sep 2025 12:34: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 1uvxXv-0007YW-3D
 for xen-changelog@lists.xenproject.org; Tue, 09 Sep 2025 12:34: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 1uvxXv-001ffm-0C
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 12:34:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uvxXu-001UWZ-39
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 12: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=5ez+pzkSu/N9cdRcj3ZT/sefb4117+3PUPTL+jG5N38=; b=5pJzChxEgER11xXXJRRAmWstUy
	eTYIU1NkAVhChzNwDeAjgXR9H3E5Ha7TFKHQvm13HKSZUeXzHAY2h235UUW3b+aZyPbFlK8NGuW2L
	rTSWNfcswPPmiB8butGgbAvLfMh4gY4UUQtu9y8RHf+aWt32yRKf0t/262huwRf3bhao=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] x86/viridian: avoid NULL pointer dereference in viridian_synic_deliver_timer_msg()
Message-Id: <E1uvxXu-001UWZ-39@xenbits.xenproject.org>
Date: Tue, 09 Sep 2025 12:34:02 +0000

commit 7fa5a9d64ff9e65f4b3253fbe4b4b1366071de80
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Tue Sep 9 14:22:58 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 9 14:22:58 2025 +0200

    x86/viridian: avoid NULL pointer dereference in viridian_synic_deliver_timer_msg()
    
    The function is called unconditionally, regardless of whether the SIM page
    is mapped.  Avoid a NULL pointer dereference in
    viridian_synic_deliver_timer_msg() by checking whether the SIM page is
    mapped.
    
    This is CVE-2025-58142 / part of XSA-472.
    
    Fixes: 26fba3c85571 ('viridian: add implementation of synthetic timers')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 3a7b4f2897a352cff287be97d27150b290a5d1ee
    master date: 2025-09-09 14:11:34 +0200
---
 xen/arch/x86/hvm/viridian/synic.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/xen/arch/x86/hvm/viridian/synic.c b/xen/arch/x86/hvm/viridian/synic.c
index c3dc573b00..e6cba7548f 100644
--- a/xen/arch/x86/hvm/viridian/synic.c
+++ b/xen/arch/x86/hvm/viridian/synic.c
@@ -338,6 +338,10 @@ bool viridian_synic_deliver_timer_msg(struct vcpu *v, unsigned int sintx,
         .DeliveryTime = delivery,
     };
 
+    /* Don't assume SIM page to be mapped. */
+    if ( !msg )
+        return false;
+
     /*
      * To avoid using an atomic test-and-set, and barrier before calling
      * vlapic_set_irq(), this function must be called in context of the
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Tue Sep 09 12:34:14 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Sep 2025 12:34:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1116739.1462939 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uvxY6-0007b2-Q9; Tue, 09 Sep 2025 12:34:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1116739.1462939; Tue, 09 Sep 2025 12:34: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 1uvxY6-0007au-Nc; Tue, 09 Sep 2025 12:34:14 +0000
Received: by outflank-mailman (input) for mailman id 1116739;
 Tue, 09 Sep 2025 12:34: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 1uvxY5-0007ai-62
 for xen-changelog@lists.xenproject.org; Tue, 09 Sep 2025 12:34: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 1uvxY5-001ffy-0V
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 12:34:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uvxY5-001UXL-0O
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 12:34: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=KsNAq+B/0XrgMGuo9iVVri/DxuXzX6Mlt5tgwQEdibs=; b=hjV23a7RKvG63MnA/ah550ads2
	dcSVGkxMBtu3c0VzXk536rthiBa2H9/q++WPzuSasAZOuf0rVNRlOAUw4CFpZx8IkbYv2RiiPN571
	t0hNSrVQMbDPAMmGvzZSoFdOA91XxJz5XHSGdRZ+7K7LevXQAcmVs5H1/s/zEW/rlPFA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] x86/viridian: protect concurrent modification of the reference TSC page
Message-Id: <E1uvxY5-001UXL-0O@xenbits.xenproject.org>
Date: Tue, 09 Sep 2025 12:34:13 +0000

commit c7f0d12c8a0b3b54263b5f79ffc9c02f094c0e2d
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Tue Sep 9 14:23:10 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 9 14:23:10 2025 +0200

    x86/viridian: protect concurrent modification of the reference TSC page
    
    The reference TSC page is shared between all vCPUs, and the data stored in
    the domain struct.  However the handlers to set and clear it are not safe
    against concurrent accesses.  It's possible for two (or more) vCPUs to call
    HV_X64_MSR_REFERENCE_TSC at the same time and cause the in-use reference
    TSC page to be freed, while still being on the p2m.  This creates a use-
    after-free bug, where the page can end up mapped in another domain or used
    by Xen while still being part of the original domain's p2m.
    
    It's also possible to underflow the reference counter, as multiple
    concurrent writes to HV_X64_MSR_REFERENCE_TSC can create an imbalance on
    the number of put_page_and_type() calls.
    
    Introduce a lock to protect the reference TSC domain field, thus
    serializing concurrent vCPU accesses.
    
    This is CVE-2025-58143 / part of XSA-472.
    
    Fixes: 386b3365221d ('viridian: use viridian_map/unmap_guest_page() for reference tsc page')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 45729a510a352e1a973e4023bd0067cddb1bcaf8
    master date: 2025-09-09 14:12:00 +0200
---
 xen/arch/x86/hvm/viridian/time.c        | 4 ++++
 xen/arch/x86/hvm/viridian/viridian.c    | 2 ++
 xen/arch/x86/include/asm/hvm/viridian.h | 1 +
 3 files changed, 7 insertions(+)

diff --git a/xen/arch/x86/hvm/viridian/time.c b/xen/arch/x86/hvm/viridian/time.c
index ca6d526f46..9311858d63 100644
--- a/xen/arch/x86/hvm/viridian/time.c
+++ b/xen/arch/x86/hvm/viridian/time.c
@@ -108,8 +108,10 @@ static void time_ref_count_thaw(const struct domain *d)
 
     trc->off = (int64_t)trc->val - trc_val(d, 0);
 
+    spin_lock(&vd->lock);
     if ( vd->reference_tsc.msr.enabled )
         update_reference_tsc(d, false);
+    spin_unlock(&vd->lock);
 }
 
 static uint64_t time_ref_count(const struct domain *d)
@@ -331,6 +333,7 @@ int viridian_time_wrmsr(struct vcpu *v, uint32_t idx, uint64_t val)
         if ( !(viridian_feature_mask(d) & HVMPV_reference_tsc) )
             return X86EMUL_EXCEPTION;
 
+        spin_lock(&vd->lock);
         viridian_unmap_guest_page(&vd->reference_tsc);
         vd->reference_tsc.msr.raw = val;
         viridian_dump_guest_page(v, "REFERENCE_TSC", &vd->reference_tsc);
@@ -339,6 +342,7 @@ int viridian_time_wrmsr(struct vcpu *v, uint32_t idx, uint64_t val)
             viridian_map_guest_page(d, &vd->reference_tsc);
             update_reference_tsc(d, true);
         }
+        spin_unlock(&vd->lock);
         break;
 
     case HV_X64_MSR_TIME_REF_COUNT:
diff --git a/xen/arch/x86/hvm/viridian/viridian.c b/xen/arch/x86/hvm/viridian/viridian.c
index 21480d9ee7..a41a70e37a 100644
--- a/xen/arch/x86/hvm/viridian/viridian.c
+++ b/xen/arch/x86/hvm/viridian/viridian.c
@@ -494,6 +494,8 @@ int viridian_domain_init(struct domain *d)
     if ( !d->arch.hvm.viridian )
         return -ENOMEM;
 
+    spin_lock_init(&d->arch.hvm.viridian->lock);
+
     rc = viridian_synic_domain_init(d);
     if ( rc )
         goto fail;
diff --git a/xen/arch/x86/include/asm/hvm/viridian.h b/xen/arch/x86/include/asm/hvm/viridian.h
index 4c8ff6e80b..47c9d13841 100644
--- a/xen/arch/x86/include/asm/hvm/viridian.h
+++ b/xen/arch/x86/include/asm/hvm/viridian.h
@@ -71,6 +71,7 @@ struct viridian_domain
     DECLARE_BITMAP(hypercall_flags, _HCALL_nr);
     struct viridian_time_ref_count time_ref_count;
     struct viridian_page reference_tsc;
+    spinlock_t lock;
 };
 
 void cpuid_viridian_leaves(const struct vcpu *v, uint32_t leaf,
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Tue Sep 09 12:34:24 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Sep 2025 12:34:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1116740.1462943 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uvxYG-0007dQ-RX; Tue, 09 Sep 2025 12:34:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1116740.1462943; Tue, 09 Sep 2025 12:34: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 1uvxYG-0007dI-Ox; Tue, 09 Sep 2025 12:34:24 +0000
Received: by outflank-mailman (input) for mailman id 1116740;
 Tue, 09 Sep 2025 12:34: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 1uvxYF-0007d8-8g
 for xen-changelog@lists.xenproject.org; Tue, 09 Sep 2025 12:34: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 1uvxYF-001fgA-0m
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 12:34:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uvxYF-001UXh-0g
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 12:34: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=F7cFYyAbdknXXC4mA+NcxDp46YsbqcXq8rqPrBSO45Q=; b=MUikihWWn733DYZFijAoMum9l5
	hFm6VJxWWOvLEuhCTe5j+YCh9LaaR3es7dnsGXwN5AqnJ7yFZAT8udAExHqaejDds9z7szdwL6Q0I
	TqXwWuvXwTjG/CDxQxSl56HyzdyorBuXSKJKrquFduph5JoG4SoqJmkx/6vrkey2wRpg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] Arm: foreign page handling in p2m_get_page_from_gfn()
Message-Id: <E1uvxYF-001UXh-0g@xenbits.xenproject.org>
Date: Tue, 09 Sep 2025 12:34:23 +0000

commit 8634f3ef0625cb7eee43dc972c75b427fd08c548
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Sep 9 14:23:23 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 9 14:23:23 2025 +0200

    Arm: foreign page handling in p2m_get_page_from_gfn()
    
    I can't see what would make the 1st of the assertions safe: For example,
    the P2M lock not being held, the foreign page may disappear before we
    get to call page_get_owner_and_reference(), which hence may return NULL.
    
    Even the 2nd, which appears to be safe safe, is lacking proper release
    build fallbacks.
    
    Drop the former in favor of an if(), and convert the latter to the
    equivalent of what x86 uses: ASSERT_UNREACHABLE() plus putting of the
    obtained page.
    
    This is CVE-2025-58144 / part of XSA-473.
    
    Fixes: 9486a8d07ba8 ("xen/arm: Handle remove foreign mapping")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
    master commit: c5a6dd68508c998c95ca87f59e9ecb6da93ca6ab
    master date: 2025-09-09 14:12:13 +0200
---
 xen/arch/arm/p2m.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
index 2465c266e9..824d4a4115 100644
--- a/xen/arch/arm/p2m.c
+++ b/xen/arch/arm/p2m.c
@@ -74,10 +74,16 @@ struct page_info *p2m_get_page_from_gfn(struct domain *d, gfn_t gfn,
      */
     if ( p2m_is_foreign(p2mt) )
     {
-        struct domain *fdom = page_get_owner_and_reference(page);
-        ASSERT(fdom != NULL);
-        ASSERT(fdom != d);
-        return page;
+        const struct domain *fdom = page_get_owner_and_reference(page);
+
+        if ( fdom )
+        {
+            if ( fdom != d )
+                return page;
+            ASSERT_UNREACHABLE();
+            put_page(page);
+        }
+        return NULL;
     }
 
     return get_page(page, d) ? page : NULL;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Tue Sep 09 12:34:34 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Sep 2025 12:34:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1116741.1462947 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uvxYQ-0007fm-TF; Tue, 09 Sep 2025 12:34:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1116741.1462947; Tue, 09 Sep 2025 12:34: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 1uvxYQ-0007fe-QL; Tue, 09 Sep 2025 12:34:34 +0000
Received: by outflank-mailman (input) for mailman id 1116741;
 Tue, 09 Sep 2025 12:34: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 1uvxYP-0007fP-Cy
 for xen-changelog@lists.xenproject.org; Tue, 09 Sep 2025 12:34: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 1uvxYP-001fgK-1D
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 12:34:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uvxYP-001UYS-0x
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 12:34: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=/FKLVVP0dHqqzQRE4ArY8QDaWzgpwdOke+/EUwhl2XE=; b=kOl9bTLbTUfqDsK207gjKJsDHS
	ZpOQtV7q7gMwTcL6jwTOZnuTm+7kxFj82gnXBE8THQ2biwaABSdGZ0txWEeYEIEWbOVioIqytuujv
	42rrwGy7utaz2pGR7MhJ81PQ2U+C7DtgTXEAFx+18vSOQW9qy078sfOohJAYADulc178=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] Arm: adjust locking in p2m_get_page_from_gfn()
Message-Id: <E1uvxYP-001UYS-0x@xenbits.xenproject.org>
Date: Tue, 09 Sep 2025 12:34:33 +0000

commit e9e054a161fb448172f29e2d08ad9a94cb13e787
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Sep 9 14:23:32 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 9 14:23:32 2025 +0200

    Arm: adjust locking in p2m_get_page_from_gfn()
    
    In order to safely acquire a reference for a foreign page mapping, the
    P2M lock needs to be held until we have the reference in hand (or
    getting one failed). Otherwise the page can change P2M type and
    ownership in between.
    
    This is CVE-2025-58145 / part of XSA-473.
    
    Fixes: 9486a8d07ba8 ("xen/arm: Handle remove foreign mapping")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
    master commit: 2275bf83a1db579661b27fc4b310a7d92594dbc0
    master date: 2025-09-09 14:12:57 +0200
---
 xen/arch/arm/p2m.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
index 824d4a4115..2efec8f493 100644
--- a/xen/arch/arm/p2m.c
+++ b/xen/arch/arm/p2m.c
@@ -53,18 +53,22 @@ mfn_t p2m_lookup(struct domain *d, gfn_t gfn, p2m_type_t *t)
 struct page_info *p2m_get_page_from_gfn(struct domain *d, gfn_t gfn,
                                         p2m_type_t *t)
 {
+    struct p2m_domain *p2m = p2m_get_hostp2m(d);
     struct page_info *page;
     p2m_type_t p2mt;
-    mfn_t mfn = p2m_lookup(d, gfn, &p2mt);
+    mfn_t mfn;
+
+    p2m_read_lock(p2m);
+    mfn = p2m_get_entry(p2m, gfn, &p2mt, NULL, NULL, NULL);
 
     if ( t )
         *t = p2mt;
 
-    if ( !p2m_is_any_ram(p2mt) )
-        return NULL;
-
-    if ( !mfn_valid(mfn) )
+    if ( !p2m_is_any_ram(p2mt) || !mfn_valid(mfn) )
+    {
+        p2m_read_unlock(p2m);
         return NULL;
+    }
 
     page = mfn_to_page(mfn);
 
@@ -76,6 +80,8 @@ struct page_info *p2m_get_page_from_gfn(struct domain *d, gfn_t gfn,
     {
         const struct domain *fdom = page_get_owner_and_reference(page);
 
+        p2m_read_unlock(p2m);
+
         if ( fdom )
         {
             if ( fdom != d )
@@ -86,6 +92,8 @@ struct page_info *p2m_get_page_from_gfn(struct domain *d, gfn_t gfn,
         return NULL;
     }
 
+    p2m_read_unlock(p2m);
+
     return get_page(page, d) ? page : NULL;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Tue Sep 09 12:34:44 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Sep 2025 12:34:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1116742.1462951 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uvxYa-0007iS-Vc; Tue, 09 Sep 2025 12:34:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1116742.1462951; Tue, 09 Sep 2025 12: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 1uvxYa-0007iI-T0; Tue, 09 Sep 2025 12:34:44 +0000
Received: by outflank-mailman (input) for mailman id 1116742;
 Tue, 09 Sep 2025 12: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 1uvxYZ-0007i5-Qo
 for xen-changelog@lists.xenproject.org; Tue, 09 Sep 2025 12: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 1uvxYZ-001fgg-2b
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 12:34:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uvxYZ-001UZl-2U
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 12:34: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=n+UMd02tM/Ivpn6wx6/P/04dUqFzo0i2PHAD3HmVpGM=; b=5qBg+qkTwmKjlF8Oi999GRCANb
	WnFabLbU/HtU4Ayy9m1/b+QiSa71YQPhc1B6rpYnjGVFkWqD/8+LOIU3j4ZnioBkrWfCTdHpbdSrm
	bBVs8VLWzSIH25bxEwpZ97iXSZTcAdsdjtahbLuYaO3dFFh8+zfuiGGyrzAp1YKXdOf0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] x86/viridian: avoid NULL pointer dereference in update_reference_tsc()
Message-Id: <E1uvxYZ-001UZl-2U@xenbits.xenproject.org>
Date: Tue, 09 Sep 2025 12:34:43 +0000

commit aba830fc0d20c25594bcfaa2febc8dc077f68172
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Tue Sep 9 14:25:01 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 9 14:25:01 2025 +0200

    x86/viridian: avoid NULL pointer dereference in update_reference_tsc()
    
    The function is only called when the MSR has the enabled bit set, but even
    then the page might not be mapped because the guest provided gfn is not
    suitable.
    
    Prevent a NULL pointer dereference in update_reference_tsc() by checking
    whether the page is mapped.
    
    This is CVE-2025-27466 / part of XSA-472.
    
    Fixes: 386b3365221d ('viridian: use viridian_map/unmap_guest_page() for reference tsc page')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 5776a2e9db0155cfd76388c8197ca7788bb4b361
    master date: 2025-09-09 14:11:09 +0200
---
 xen/arch/x86/hvm/viridian/time.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/xen/arch/x86/hvm/viridian/time.c b/xen/arch/x86/hvm/viridian/time.c
index 137577384f..ca6d526f46 100644
--- a/xen/arch/x86/hvm/viridian/time.c
+++ b/xen/arch/x86/hvm/viridian/time.c
@@ -26,6 +26,10 @@ static void update_reference_tsc(const struct domain *d, bool initialize)
     HV_REFERENCE_TSC_PAGE *p = rt->ptr;
     uint32_t seq;
 
+    /* Reference TSC page might not be mapped even if the MSR is enabled. */
+    if ( !p )
+        return;
+
     if ( initialize )
         clear_page(p);
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Tue Sep 09 12:34:56 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Sep 2025 12:34:56 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1116743.1462954 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uvxYm-0007km-0j; Tue, 09 Sep 2025 12:34:56 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1116743.1462954; Tue, 09 Sep 2025 12:34: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 1uvxYl-0007kd-UP; Tue, 09 Sep 2025 12:34:55 +0000
Received: by outflank-mailman (input) for mailman id 1116743;
 Tue, 09 Sep 2025 12: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 1uvxYj-0007kN-TQ
 for xen-changelog@lists.xenproject.org; Tue, 09 Sep 2025 12: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 1uvxYj-001fgm-2r
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 12:34:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uvxYj-001UaS-2l
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 12:34: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=BqmO+vZMGCnyDxM2OKMl00976onWhYMcKtRye8HnydU=; b=rZxoeosjd+pGqkY3LGTTqzQ1c1
	GR/mn4Bty7w0rmGR/Lrtq7yFDtf71iGXUYmvlyhcenV3+256tWl2rQUC+PER/J6LJRgbHUjx4NDAR
	N5Gdv7qhBDS6LeC9nxKK1D/4ptBGJcgUcpjn6bY0YaexAuwfQ/gze2i6iRAttFarxUmk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] x86/viridian: avoid NULL pointer dereference in viridian_synic_deliver_timer_msg()
Message-Id: <E1uvxYj-001UaS-2l@xenbits.xenproject.org>
Date: Tue, 09 Sep 2025 12:34:53 +0000

commit de89b16d24104578a9a8e79898e81ac4b3aa3601
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Tue Sep 9 14:25:23 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 9 14:25:23 2025 +0200

    x86/viridian: avoid NULL pointer dereference in viridian_synic_deliver_timer_msg()
    
    The function is called unconditionally, regardless of whether the SIM page
    is mapped.  Avoid a NULL pointer dereference in
    viridian_synic_deliver_timer_msg() by checking whether the SIM page is
    mapped.
    
    This is CVE-2025-58142 / part of XSA-472.
    
    Fixes: 26fba3c85571 ('viridian: add implementation of synthetic timers')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 3a7b4f2897a352cff287be97d27150b290a5d1ee
    master date: 2025-09-09 14:11:34 +0200
---
 xen/arch/x86/hvm/viridian/synic.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/xen/arch/x86/hvm/viridian/synic.c b/xen/arch/x86/hvm/viridian/synic.c
index 09474fe2eb..ca57ba8bf1 100644
--- a/xen/arch/x86/hvm/viridian/synic.c
+++ b/xen/arch/x86/hvm/viridian/synic.c
@@ -338,6 +338,10 @@ bool viridian_synic_deliver_timer_msg(struct vcpu *v, unsigned int sintx,
         .DeliveryTime = delivery,
     };
 
+    /* Don't assume SIM page to be mapped. */
+    if ( !msg )
+        return false;
+
     /*
      * To avoid using an atomic test-and-set, and barrier before calling
      * vlapic_set_irq(), this function must be called in context of the
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Tue Sep 09 12:35:06 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Sep 2025 12:35:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1116744.1462958 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uvxYw-0007mh-25; Tue, 09 Sep 2025 12:35:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1116744.1462958; Tue, 09 Sep 2025 12:35: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 1uvxYv-0007mZ-Vr; Tue, 09 Sep 2025 12:35:05 +0000
Received: by outflank-mailman (input) for mailman id 1116744;
 Tue, 09 Sep 2025 12:35: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 1uvxYu-0007mM-1l
 for xen-changelog@lists.xenproject.org; Tue, 09 Sep 2025 12:35: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 1uvxYu-001fh9-05
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 12:35:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uvxYt-001UbK-32
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 12:35: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=wkWx7LP6ud+xVKk1TxjuIyWjH3WBZtxHIvIgQSQotVc=; b=ZACEbmJ5Sq1m+FFe2H/IiAOReJ
	Bk4em4Q8FCKAqi/VgbzLe4LagMCgbbtoMspv4/cDV9EQmppkp+gF5WqlLuuTrto8Vt7aajxsZpcFk
	R+DYknVoOnSl4ElF21zLb/G89VRQeuhsDzlikrXjR5OnNhrfTI72Qn2StWlUwtN3A5ZU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] x86/viridian: protect concurrent modification of the reference TSC page
Message-Id: <E1uvxYt-001UbK-32@xenbits.xenproject.org>
Date: Tue, 09 Sep 2025 12:35:03 +0000

commit 2102093e081f0d57e0b92881970d07c6542c969a
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Tue Sep 9 14:25:36 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 9 14:25:36 2025 +0200

    x86/viridian: protect concurrent modification of the reference TSC page
    
    The reference TSC page is shared between all vCPUs, and the data stored in
    the domain struct.  However the handlers to set and clear it are not safe
    against concurrent accesses.  It's possible for two (or more) vCPUs to call
    HV_X64_MSR_REFERENCE_TSC at the same time and cause the in-use reference
    TSC page to be freed, while still being on the p2m.  This creates a use-
    after-free bug, where the page can end up mapped in another domain or used
    by Xen while still being part of the original domain's p2m.
    
    It's also possible to underflow the reference counter, as multiple
    concurrent writes to HV_X64_MSR_REFERENCE_TSC can create an imbalance on
    the number of put_page_and_type() calls.
    
    Introduce a lock to protect the reference TSC domain field, thus
    serializing concurrent vCPU accesses.
    
    This is CVE-2025-58143 / part of XSA-472.
    
    Fixes: 386b3365221d ('viridian: use viridian_map/unmap_guest_page() for reference tsc page')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 45729a510a352e1a973e4023bd0067cddb1bcaf8
    master date: 2025-09-09 14:12:00 +0200
---
 xen/arch/x86/hvm/viridian/time.c        | 4 ++++
 xen/arch/x86/hvm/viridian/viridian.c    | 2 ++
 xen/arch/x86/include/asm/hvm/viridian.h | 1 +
 3 files changed, 7 insertions(+)

diff --git a/xen/arch/x86/hvm/viridian/time.c b/xen/arch/x86/hvm/viridian/time.c
index ca6d526f46..9311858d63 100644
--- a/xen/arch/x86/hvm/viridian/time.c
+++ b/xen/arch/x86/hvm/viridian/time.c
@@ -108,8 +108,10 @@ static void time_ref_count_thaw(const struct domain *d)
 
     trc->off = (int64_t)trc->val - trc_val(d, 0);
 
+    spin_lock(&vd->lock);
     if ( vd->reference_tsc.msr.enabled )
         update_reference_tsc(d, false);
+    spin_unlock(&vd->lock);
 }
 
 static uint64_t time_ref_count(const struct domain *d)
@@ -331,6 +333,7 @@ int viridian_time_wrmsr(struct vcpu *v, uint32_t idx, uint64_t val)
         if ( !(viridian_feature_mask(d) & HVMPV_reference_tsc) )
             return X86EMUL_EXCEPTION;
 
+        spin_lock(&vd->lock);
         viridian_unmap_guest_page(&vd->reference_tsc);
         vd->reference_tsc.msr.raw = val;
         viridian_dump_guest_page(v, "REFERENCE_TSC", &vd->reference_tsc);
@@ -339,6 +342,7 @@ int viridian_time_wrmsr(struct vcpu *v, uint32_t idx, uint64_t val)
             viridian_map_guest_page(d, &vd->reference_tsc);
             update_reference_tsc(d, true);
         }
+        spin_unlock(&vd->lock);
         break;
 
     case HV_X64_MSR_TIME_REF_COUNT:
diff --git a/xen/arch/x86/hvm/viridian/viridian.c b/xen/arch/x86/hvm/viridian/viridian.c
index 25ed454852..a15fe0e9f8 100644
--- a/xen/arch/x86/hvm/viridian/viridian.c
+++ b/xen/arch/x86/hvm/viridian/viridian.c
@@ -494,6 +494,8 @@ int viridian_domain_init(struct domain *d)
     if ( !d->arch.hvm.viridian )
         return -ENOMEM;
 
+    spin_lock_init(&d->arch.hvm.viridian->lock);
+
     rc = viridian_synic_domain_init(d);
     if ( rc )
         goto fail;
diff --git a/xen/arch/x86/include/asm/hvm/viridian.h b/xen/arch/x86/include/asm/hvm/viridian.h
index 4c8ff6e80b..47c9d13841 100644
--- a/xen/arch/x86/include/asm/hvm/viridian.h
+++ b/xen/arch/x86/include/asm/hvm/viridian.h
@@ -71,6 +71,7 @@ struct viridian_domain
     DECLARE_BITMAP(hypercall_flags, _HCALL_nr);
     struct viridian_time_ref_count time_ref_count;
     struct viridian_page reference_tsc;
+    spinlock_t lock;
 };
 
 void cpuid_viridian_leaves(const struct vcpu *v, uint32_t leaf,
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Tue Sep 09 12:35:16 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Sep 2025 12:35:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1116745.1462965 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uvxZ6-0007pP-4i; Tue, 09 Sep 2025 12:35:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1116745.1462965; Tue, 09 Sep 2025 12:35: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 1uvxZ6-0007pH-11; Tue, 09 Sep 2025 12:35:16 +0000
Received: by outflank-mailman (input) for mailman id 1116745;
 Tue, 09 Sep 2025 12:35: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 1uvxZ4-0007ol-4S
 for xen-changelog@lists.xenproject.org; Tue, 09 Sep 2025 12:35: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 1uvxZ4-001fhG-0L
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 12:35:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uvxZ4-001Ubk-0G
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 12:35: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=EdYgrYxAYtx+Q/PdykLFBLFFwKhzutdny6JF4meQ/FY=; b=PsC+PTb4BgqmgWTPnL5MOQLEIq
	8NbQh51T8Wj9bKx3cRhiiVQexfparqjSEabYdRdE+y+eKvrXHby0GruGYrva6a+WT9URV/MCyIBah
	ShQKPZia9JkkW8YIFc3c/nY8he5isamYGdlwl6FsFBAQlPvTgqpoehIclftn3R3QzidM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] Arm: foreign page handling in p2m_get_page_from_gfn()
Message-Id: <E1uvxZ4-001Ubk-0G@xenbits.xenproject.org>
Date: Tue, 09 Sep 2025 12:35:14 +0000

commit 46c0b23f17e3fecacd0a9f156c2d1ca440a6b471
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Sep 9 14:25:48 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 9 14:25:48 2025 +0200

    Arm: foreign page handling in p2m_get_page_from_gfn()
    
    I can't see what would make the 1st of the assertions safe: For example,
    the P2M lock not being held, the foreign page may disappear before we
    get to call page_get_owner_and_reference(), which hence may return NULL.
    
    Even the 2nd, which appears to be safe safe, is lacking proper release
    build fallbacks.
    
    Drop the former in favor of an if(), and convert the latter to the
    equivalent of what x86 uses: ASSERT_UNREACHABLE() plus putting of the
    obtained page.
    
    This is CVE-2025-58144 / part of XSA-473.
    
    Fixes: 9486a8d07ba8 ("xen/arm: Handle remove foreign mapping")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
    master commit: c5a6dd68508c998c95ca87f59e9ecb6da93ca6ab
    master date: 2025-09-09 14:12:13 +0200
---
 xen/arch/arm/p2m.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
index de32a2d638..4038377834 100644
--- a/xen/arch/arm/p2m.c
+++ b/xen/arch/arm/p2m.c
@@ -612,10 +612,16 @@ struct page_info *p2m_get_page_from_gfn(struct domain *d, gfn_t gfn,
      */
     if ( p2m_is_foreign(p2mt) )
     {
-        struct domain *fdom = page_get_owner_and_reference(page);
-        ASSERT(fdom != NULL);
-        ASSERT(fdom != d);
-        return page;
+        const struct domain *fdom = page_get_owner_and_reference(page);
+
+        if ( fdom )
+        {
+            if ( fdom != d )
+                return page;
+            ASSERT_UNREACHABLE();
+            put_page(page);
+        }
+        return NULL;
     }
 
     return get_page(page, d) ? page : NULL;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Tue Sep 09 12:35:26 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Sep 2025 12:35:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1116746.1462969 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uvxZG-0007rc-5l; Tue, 09 Sep 2025 12:35:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1116746.1462969; Tue, 09 Sep 2025 12:35: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 1uvxZG-0007rQ-2L; Tue, 09 Sep 2025 12:35:26 +0000
Received: by outflank-mailman (input) for mailman id 1116746;
 Tue, 09 Sep 2025 12:35: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 1uvxZE-0007r9-6r
 for xen-changelog@lists.xenproject.org; Tue, 09 Sep 2025 12:35: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 1uvxZE-001fhS-0b
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 12:35:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uvxZE-001Ucg-0W
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 12:35: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=nsWrAlDY/sFfuwoRnz0kHPx0hwRVb69l70kaqiiN+Kk=; b=jRShfFqPOK2LXJCpn12jEXuWtH
	TMu2vGjwUCtgAtLgG7z+FTCOHzhBsyxsJ9u/gX2cfXERyZyqPRHnXk8WV9s/XDPXbv+jFaa7b9YZd
	mXSpckcg1YpEKMY/CCGJuODIJwgpB6lMPyjywfTouIgc9BAsEmXd/l+l7Ule/yQw7fhA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] Arm: adjust locking in p2m_get_page_from_gfn()
Message-Id: <E1uvxZE-001Ucg-0W@xenbits.xenproject.org>
Date: Tue, 09 Sep 2025 12:35:24 +0000

commit c90cec6dfd8ed04577376efd2b929930451e78e9
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Sep 9 14:25:58 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 9 14:25:58 2025 +0200

    Arm: adjust locking in p2m_get_page_from_gfn()
    
    In order to safely acquire a reference for a foreign page mapping, the
    P2M lock needs to be held until we have the reference in hand (or
    getting one failed). Otherwise the page can change P2M type and
    ownership in between.
    
    This is CVE-2025-58145 / part of XSA-473.
    
    Fixes: 9486a8d07ba8 ("xen/arm: Handle remove foreign mapping")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
    master commit: 2275bf83a1db579661b27fc4b310a7d92594dbc0
    master date: 2025-09-09 14:12:57 +0200
---
 xen/arch/arm/p2m.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
index 4038377834..3f3b2ad0ae 100644
--- a/xen/arch/arm/p2m.c
+++ b/xen/arch/arm/p2m.c
@@ -591,18 +591,22 @@ mfn_t p2m_lookup(struct domain *d, gfn_t gfn, p2m_type_t *t)
 struct page_info *p2m_get_page_from_gfn(struct domain *d, gfn_t gfn,
                                         p2m_type_t *t)
 {
+    struct p2m_domain *p2m = p2m_get_hostp2m(d);
     struct page_info *page;
     p2m_type_t p2mt;
-    mfn_t mfn = p2m_lookup(d, gfn, &p2mt);
+    mfn_t mfn;
+
+    p2m_read_lock(p2m);
+    mfn = p2m_get_entry(p2m, gfn, &p2mt, NULL, NULL, NULL);
 
     if ( t )
         *t = p2mt;
 
-    if ( !p2m_is_any_ram(p2mt) )
-        return NULL;
-
-    if ( !mfn_valid(mfn) )
+    if ( !p2m_is_any_ram(p2mt) || !mfn_valid(mfn) )
+    {
+        p2m_read_unlock(p2m);
         return NULL;
+    }
 
     page = mfn_to_page(mfn);
 
@@ -614,6 +618,8 @@ struct page_info *p2m_get_page_from_gfn(struct domain *d, gfn_t gfn,
     {
         const struct domain *fdom = page_get_owner_and_reference(page);
 
+        p2m_read_unlock(p2m);
+
         if ( fdom )
         {
             if ( fdom != d )
@@ -624,6 +630,8 @@ struct page_info *p2m_get_page_from_gfn(struct domain *d, gfn_t gfn,
         return NULL;
     }
 
+    p2m_read_unlock(p2m);
+
     return get_page(page, d) ? page : NULL;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Tue Sep 09 12:35:35 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Sep 2025 12:35:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1116748.1462971 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uvxZP-0007tf-6M; Tue, 09 Sep 2025 12:35:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1116748.1462971; Tue, 09 Sep 2025 12:35: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 1uvxZP-0007tX-3h; Tue, 09 Sep 2025 12:35:35 +0000
Received: by outflank-mailman (input) for mailman id 1116748;
 Tue, 09 Sep 2025 12:35: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 1uvxZO-0007tR-Kn
 for xen-changelog@lists.xenproject.org; Tue, 09 Sep 2025 12:35: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 1uvxZO-001fhi-20
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 12:35:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uvxZO-001Udn-1u
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 12:35: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=uYvBe8Qi7cQ4e3C7Vg2oXsQugk0Hhv0SyE3bzRK6H2M=; b=gBse45B8Cd+71qHkMtTG2UVfAg
	N4T+mFdJ3sW2mR043M1gZd6nJHWT6iMBoN2zhsXEZkJlWT/ls1XhK5E3ua71wB+pQBuAb8WDewgdB
	XcMJPzWpRIJwk0pVMYeXM/CnTPDuFl0n8ugU0BwC84ntTwuBAuF0AdhdPZIOwU1O7AJk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.17] x86/viridian: avoid NULL pointer dereference in update_reference_tsc()
Message-Id: <E1uvxZO-001Udn-1u@xenbits.xenproject.org>
Date: Tue, 09 Sep 2025 12:35:34 +0000

commit 600db442cbb8d9292e6c0877caa1a63b7a3c1303
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Tue Sep 9 14:26:31 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 9 14:26:31 2025 +0200

    x86/viridian: avoid NULL pointer dereference in update_reference_tsc()
    
    The function is only called when the MSR has the enabled bit set, but even
    then the page might not be mapped because the guest provided gfn is not
    suitable.
    
    Prevent a NULL pointer dereference in update_reference_tsc() by checking
    whether the page is mapped.
    
    This is CVE-2025-27466 / part of XSA-472.
    
    Fixes: 386b3365221d ('viridian: use viridian_map/unmap_guest_page() for reference tsc page')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 5776a2e9db0155cfd76388c8197ca7788bb4b361
    master date: 2025-09-09 14:11:09 +0200
---
 xen/arch/x86/hvm/viridian/time.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/xen/arch/x86/hvm/viridian/time.c b/xen/arch/x86/hvm/viridian/time.c
index b56fd67662..97caf0b08b 100644
--- a/xen/arch/x86/hvm/viridian/time.c
+++ b/xen/arch/x86/hvm/viridian/time.c
@@ -27,6 +27,10 @@ static void update_reference_tsc(const struct domain *d, bool initialize)
     HV_REFERENCE_TSC_PAGE *p = rt->ptr;
     uint32_t seq;
 
+    /* Reference TSC page might not be mapped even if the MSR is enabled. */
+    if ( !p )
+        return;
+
     if ( initialize )
         clear_page(p);
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.17


From xen-changelog-bounces@lists.xenproject.org Tue Sep 09 12:35:45 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Sep 2025 12:35:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1116749.1462974 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uvxZZ-0007vf-7n; Tue, 09 Sep 2025 12:35:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1116749.1462974; Tue, 09 Sep 2025 12:35: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 1uvxZZ-0007vX-5J; Tue, 09 Sep 2025 12:35:45 +0000
Received: by outflank-mailman (input) for mailman id 1116749;
 Tue, 09 Sep 2025 12:35: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 1uvxZY-0007vP-NO
 for xen-changelog@lists.xenproject.org; Tue, 09 Sep 2025 12:35: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 1uvxZY-001fi7-2G
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 12:35:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uvxZY-001Ueq-2A
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 12:35: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=WbTqQkyFKSj/SUxLPAXFVkfFjYTITzPwmPZ5wJmA7ZI=; b=phFOz4F5/912VWYFywZsE0m7Ty
	4YcZox0srYKMFna1ng9YOgSxctfZtyuXHWd6fsG7Hl51vCW8YwOR7eio8nWBc7KLW5rl/shwVjGvc
	Hr8VQuhx1T52v2xF+PHv58zLH1YFSdsoyxqe+oZ0q/O9UllwOqdFugyjW1ZHog265LVg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.17] x86/viridian: avoid NULL pointer dereference in viridian_synic_deliver_timer_msg()
Message-Id: <E1uvxZY-001Ueq-2A@xenbits.xenproject.org>
Date: Tue, 09 Sep 2025 12:35:44 +0000

commit f20f97564437698243f010b1ccba0d77cf5b133f
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Tue Sep 9 14:27:00 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 9 14:27:00 2025 +0200

    x86/viridian: avoid NULL pointer dereference in viridian_synic_deliver_timer_msg()
    
    The function is called unconditionally, regardless of whether the SIM page
    is mapped.  Avoid a NULL pointer dereference in
    viridian_synic_deliver_timer_msg() by checking whether the SIM page is
    mapped.
    
    This is CVE-2025-58142 / part of XSA-472.
    
    Fixes: 26fba3c85571 ('viridian: add implementation of synthetic timers')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 3a7b4f2897a352cff287be97d27150b290a5d1ee
    master date: 2025-09-09 14:11:34 +0200
---
 xen/arch/x86/hvm/viridian/synic.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/xen/arch/x86/hvm/viridian/synic.c b/xen/arch/x86/hvm/viridian/synic.c
index 856bb898b8..c5bab2d6fd 100644
--- a/xen/arch/x86/hvm/viridian/synic.c
+++ b/xen/arch/x86/hvm/viridian/synic.c
@@ -339,6 +339,10 @@ bool viridian_synic_deliver_timer_msg(struct vcpu *v, unsigned int sintx,
         .DeliveryTime = delivery,
     };
 
+    /* Don't assume SIM page to be mapped. */
+    if ( !msg )
+        return false;
+
     /*
      * To avoid using an atomic test-and-set, and barrier before calling
      * vlapic_set_irq(), this function must be called in context of the
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.17


From xen-changelog-bounces@lists.xenproject.org Tue Sep 09 12:35:55 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Sep 2025 12:35:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1116750.1462979 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uvxZj-0007xd-9N; Tue, 09 Sep 2025 12:35:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1116750.1462979; Tue, 09 Sep 2025 12:35: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 1uvxZj-0007xV-6j; Tue, 09 Sep 2025 12:35:55 +0000
Received: by outflank-mailman (input) for mailman id 1116750;
 Tue, 09 Sep 2025 12:35: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 1uvxZi-0007xP-Pw
 for xen-changelog@lists.xenproject.org; Tue, 09 Sep 2025 12:35: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 1uvxZi-001fiD-2W
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 12:35:54 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uvxZi-001UfE-2R
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 12:35: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=R4/hPrU9xbcHzj658eQzP7FrYbaw5SXniVNwF1qlCrs=; b=YOnfJmMGJvS6r2iHju32amvxgh
	BhEWDug31DmhD44jXPAvfGjkai2Sjip7IFtROo8F49RYdkUmqJwfP4LiAdtqioWAC1sMlfn0u5GcS
	ZQ5t3rcidACg1Z2N8Evbib5DH3mKswpwjPV+nJST3B3+3+kOgiZIKtNu+loxWeo37kGE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.17] x86/viridian: protect concurrent modification of the reference TSC page
Message-Id: <E1uvxZi-001UfE-2R@xenbits.xenproject.org>
Date: Tue, 09 Sep 2025 12:35:54 +0000

commit af733b706de569614b499bbd615085225fda1c6a
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Tue Sep 9 14:27:22 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 9 14:27:22 2025 +0200

    x86/viridian: protect concurrent modification of the reference TSC page
    
    The reference TSC page is shared between all vCPUs, and the data stored in
    the domain struct.  However the handlers to set and clear it are not safe
    against concurrent accesses.  It's possible for two (or more) vCPUs to call
    HV_X64_MSR_REFERENCE_TSC at the same time and cause the in-use reference
    TSC page to be freed, while still being on the p2m.  This creates a use-
    after-free bug, where the page can end up mapped in another domain or used
    by Xen while still being part of the original domain's p2m.
    
    It's also possible to underflow the reference counter, as multiple
    concurrent writes to HV_X64_MSR_REFERENCE_TSC can create an imbalance on
    the number of put_page_and_type() calls.
    
    Introduce a lock to protect the reference TSC domain field, thus
    serializing concurrent vCPU accesses.
    
    This is CVE-2025-58143 / part of XSA-472.
    
    Fixes: 386b3365221d ('viridian: use viridian_map/unmap_guest_page() for reference tsc page')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 45729a510a352e1a973e4023bd0067cddb1bcaf8
    master date: 2025-09-09 14:12:00 +0200
---
 xen/arch/x86/hvm/viridian/time.c        | 4 ++++
 xen/arch/x86/hvm/viridian/viridian.c    | 2 ++
 xen/arch/x86/include/asm/hvm/viridian.h | 1 +
 3 files changed, 7 insertions(+)

diff --git a/xen/arch/x86/hvm/viridian/time.c b/xen/arch/x86/hvm/viridian/time.c
index 97caf0b08b..3c94fb0814 100644
--- a/xen/arch/x86/hvm/viridian/time.c
+++ b/xen/arch/x86/hvm/viridian/time.c
@@ -109,8 +109,10 @@ static void time_ref_count_thaw(const struct domain *d)
 
     trc->off = (int64_t)trc->val - trc_val(d, 0);
 
+    spin_lock(&vd->lock);
     if ( vd->reference_tsc.msr.enabled )
         update_reference_tsc(d, false);
+    spin_unlock(&vd->lock);
 }
 
 static uint64_t time_ref_count(const struct domain *d)
@@ -332,6 +334,7 @@ int viridian_time_wrmsr(struct vcpu *v, uint32_t idx, uint64_t val)
         if ( !(viridian_feature_mask(d) & HVMPV_reference_tsc) )
             return X86EMUL_EXCEPTION;
 
+        spin_lock(&vd->lock);
         viridian_unmap_guest_page(&vd->reference_tsc);
         vd->reference_tsc.msr.raw = val;
         viridian_dump_guest_page(v, "REFERENCE_TSC", &vd->reference_tsc);
@@ -340,6 +343,7 @@ int viridian_time_wrmsr(struct vcpu *v, uint32_t idx, uint64_t val)
             viridian_map_guest_page(d, &vd->reference_tsc);
             update_reference_tsc(d, true);
         }
+        spin_unlock(&vd->lock);
         break;
 
     case HV_X64_MSR_TIME_REF_COUNT:
diff --git a/xen/arch/x86/hvm/viridian/viridian.c b/xen/arch/x86/hvm/viridian/viridian.c
index 2937ddd3a8..372a749ab9 100644
--- a/xen/arch/x86/hvm/viridian/viridian.c
+++ b/xen/arch/x86/hvm/viridian/viridian.c
@@ -494,6 +494,8 @@ int viridian_domain_init(struct domain *d)
     if ( !d->arch.hvm.viridian )
         return -ENOMEM;
 
+    spin_lock_init(&d->arch.hvm.viridian->lock);
+
     rc = viridian_synic_domain_init(d);
     if ( rc )
         goto fail;
diff --git a/xen/arch/x86/include/asm/hvm/viridian.h b/xen/arch/x86/include/asm/hvm/viridian.h
index 4c8ff6e80b..47c9d13841 100644
--- a/xen/arch/x86/include/asm/hvm/viridian.h
+++ b/xen/arch/x86/include/asm/hvm/viridian.h
@@ -71,6 +71,7 @@ struct viridian_domain
     DECLARE_BITMAP(hypercall_flags, _HCALL_nr);
     struct viridian_time_ref_count time_ref_count;
     struct viridian_page reference_tsc;
+    spinlock_t lock;
 };
 
 void cpuid_viridian_leaves(const struct vcpu *v, uint32_t leaf,
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.17


From xen-changelog-bounces@lists.xenproject.org Tue Sep 09 12:36:05 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Sep 2025 12:36:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1116751.1462983 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uvxZt-00080F-C9; Tue, 09 Sep 2025 12:36:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1116751.1462983; Tue, 09 Sep 2025 12:36: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 1uvxZt-000808-9R; Tue, 09 Sep 2025 12:36:05 +0000
Received: by outflank-mailman (input) for mailman id 1116751;
 Tue, 09 Sep 2025 12:36: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 1uvxZs-0007zy-Sa
 for xen-changelog@lists.xenproject.org; Tue, 09 Sep 2025 12:36: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 1uvxZs-001fiW-2l
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 12:36:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uvxZs-001Ugv-2g
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 12:36: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=mrtvfHIhyKaWAbpORb4Ub1QvjswP0yONDF6nPar2cJo=; b=emLC3tV+kRQb7SYBYZsV8uCc6E
	FeQDHkgw3FPpDtuTbtvNg8ASz/fFfslBOuniXR34ZcrgEm7B9QaTr4mYgNQzY2celUAJJwaBhoz0M
	KwkqJMnKMgclPA91oTSR+FXf6WUZGxlQ6YO9ZdGX/R99rwBW5iDP+d1mMxB6nbDJNdqo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.17] Arm: foreign page handling in p2m_get_page_from_gfn()
Message-Id: <E1uvxZs-001Ugv-2g@xenbits.xenproject.org>
Date: Tue, 09 Sep 2025 12:36:04 +0000

commit 0b39ff2964219f3321ece7abbfd87f98e8cfa5c7
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Sep 9 14:27:50 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 9 14:27:50 2025 +0200

    Arm: foreign page handling in p2m_get_page_from_gfn()
    
    I can't see what would make the 1st of the assertions safe: For example,
    the P2M lock not being held, the foreign page may disappear before we
    get to call page_get_owner_and_reference(), which hence may return NULL.
    
    Even the 2nd, which appears to be safe safe, is lacking proper release
    build fallbacks.
    
    Drop the former in favor of an if(), and convert the latter to the
    equivalent of what x86 uses: ASSERT_UNREACHABLE() plus putting of the
    obtained page.
    
    This is CVE-2025-58144 / part of XSA-473.
    
    Fixes: 9486a8d07ba8 ("xen/arm: Handle remove foreign mapping")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
    master commit: c5a6dd68508c998c95ca87f59e9ecb6da93ca6ab
    master date: 2025-09-09 14:12:13 +0200
---
 xen/arch/arm/p2m.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
index 9bc5443d9e..3738fdf1a4 100644
--- a/xen/arch/arm/p2m.c
+++ b/xen/arch/arm/p2m.c
@@ -618,10 +618,16 @@ struct page_info *p2m_get_page_from_gfn(struct domain *d, gfn_t gfn,
      */
     if ( p2m_is_foreign(p2mt) )
     {
-        struct domain *fdom = page_get_owner_and_reference(page);
-        ASSERT(fdom != NULL);
-        ASSERT(fdom != d);
-        return page;
+        const struct domain *fdom = page_get_owner_and_reference(page);
+
+        if ( fdom )
+        {
+            if ( fdom != d )
+                return page;
+            ASSERT_UNREACHABLE();
+            put_page(page);
+        }
+        return NULL;
     }
 
     return get_page(page, d) ? page : NULL;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.17


From xen-changelog-bounces@lists.xenproject.org Tue Sep 09 12:36:15 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Sep 2025 12:36:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1116752.1462987 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uvxa3-00082c-Dc; Tue, 09 Sep 2025 12:36:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1116752.1462987; Tue, 09 Sep 2025 12:36: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 1uvxa3-00082U-B4; Tue, 09 Sep 2025 12:36:15 +0000
Received: by outflank-mailman (input) for mailman id 1116752;
 Tue, 09 Sep 2025 12:36:15 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1uvxa2-00082B-V7
 for xen-changelog@lists.xenproject.org; Tue, 09 Sep 2025 12:36: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 1uvxa2-001fic-31
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 12:36:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uvxa2-001Ui9-2w
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 12:36: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=awyDNzJwBBwpO+mFHoQAtt2NC2GcIbtseIsI0fBV1hk=; b=Fm/ahomgQ9nAvE/8YlPmF+jmHS
	2jtdl28OLaVPeu8/N5lfePhXxrBSsn61AJw/XRoDe+NtrVCO3EPbJeUBr18/e0IuPRaYup9b32/5c
	2cNOjo5jiSHJxjLC+a/3YIPmzYqLY7Hq/MEwg9j13RjPSe2MCK5lJCrAd9tjYCp7o3eE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.17] Arm: adjust locking in p2m_get_page_from_gfn()
Message-Id: <E1uvxa2-001Ui9-2w@xenbits.xenproject.org>
Date: Tue, 09 Sep 2025 12:36:14 +0000

commit 267fdd429fc3b0a71aaac3f3651ef9382a5a58f5
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Sep 9 14:28:03 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 9 14:28:03 2025 +0200

    Arm: adjust locking in p2m_get_page_from_gfn()
    
    In order to safely acquire a reference for a foreign page mapping, the
    P2M lock needs to be held until we have the reference in hand (or
    getting one failed). Otherwise the page can change P2M type and
    ownership in between.
    
    This is CVE-2025-58145 / part of XSA-473.
    
    Fixes: 9486a8d07ba8 ("xen/arm: Handle remove foreign mapping")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
    master commit: 2275bf83a1db579661b27fc4b310a7d92594dbc0
    master date: 2025-09-09 14:12:57 +0200
---
 xen/arch/arm/p2m.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
index 3738fdf1a4..1e66da3eb8 100644
--- a/xen/arch/arm/p2m.c
+++ b/xen/arch/arm/p2m.c
@@ -597,18 +597,22 @@ mfn_t p2m_lookup(struct domain *d, gfn_t gfn, p2m_type_t *t)
 struct page_info *p2m_get_page_from_gfn(struct domain *d, gfn_t gfn,
                                         p2m_type_t *t)
 {
+    struct p2m_domain *p2m = p2m_get_hostp2m(d);
     struct page_info *page;
     p2m_type_t p2mt;
-    mfn_t mfn = p2m_lookup(d, gfn, &p2mt);
+    mfn_t mfn;
+
+    p2m_read_lock(p2m);
+    mfn = p2m_get_entry(p2m, gfn, &p2mt, NULL, NULL, NULL);
 
     if ( t )
         *t = p2mt;
 
-    if ( !p2m_is_any_ram(p2mt) )
-        return NULL;
-
-    if ( !mfn_valid(mfn) )
+    if ( !p2m_is_any_ram(p2mt) || !mfn_valid(mfn) )
+    {
+        p2m_read_unlock(p2m);
         return NULL;
+    }
 
     page = mfn_to_page(mfn);
 
@@ -620,6 +624,8 @@ struct page_info *p2m_get_page_from_gfn(struct domain *d, gfn_t gfn,
     {
         const struct domain *fdom = page_get_owner_and_reference(page);
 
+        p2m_read_unlock(p2m);
+
         if ( fdom )
         {
             if ( fdom != d )
@@ -630,6 +636,8 @@ struct page_info *p2m_get_page_from_gfn(struct domain *d, gfn_t gfn,
         return NULL;
     }
 
+    p2m_read_unlock(p2m);
+
     return get_page(page, d) ? page : NULL;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.17


From xen-changelog-bounces@lists.xenproject.org Tue Sep 09 12:44:04 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Sep 2025 12:44:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1116755.1462991 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uvxhb-0000vj-02; Tue, 09 Sep 2025 12:44:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1116755.1462991; Tue, 09 Sep 2025 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 1uvxha-0000vb-T7; Tue, 09 Sep 2025 12:44:02 +0000
Received: by outflank-mailman (input) for mailman id 1116755;
 Tue, 09 Sep 2025 12: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 1uvxhZ-0000vT-PG
 for xen-changelog@lists.xenproject.org; Tue, 09 Sep 2025 12: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 1uvxhZ-001fuF-2K
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 12:44:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uvxhZ-001VlM-2C
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 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=FLrZ8CwByZL2+5breSsHJIa+y0kX0PTWZt+odB1tJrw=; b=v8RNEA/unH498rOr73tzWQchHR
	/S0cMEwf/WwE7nzdUt7gTO8TnOxk/uaay9hJ5Ag3gpWT76292A7ZR/95ImEj27rS5VXSK2NsFD0Dw
	EjvBYyUpaDiQTgYwAEBB7CfrVoQrcfK5hQXgjxtPvAoMd6OJjtU4lnMBmG5mSW9mHYts=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] libxl: except Dom0 from setting PoD target
Message-Id: <E1uvxhZ-001VlM-2C@xenbits.xenproject.org>
Date: Tue, 09 Sep 2025 12:44:01 +0000

commit 489a7c50c08a280ea12195468ab50c3e56635245
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Sep 9 08:16:19 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 9 08:16:19 2025 +0200

    libxl: except Dom0 from setting PoD target
    
    Dom0 is never started in PoD mode, and hence it can at "best" do harm if
    we try to set a PoD target for it.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
    Acked-by: Anthony PERARD <anthony.perard@vates.tech>
---
 tools/libs/light/libxl_mem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/libs/light/libxl_mem.c b/tools/libs/light/libxl_mem.c
index 44e554adba..30d65e174b 100644
--- a/tools/libs/light/libxl_mem.c
+++ b/tools/libs/light/libxl_mem.c
@@ -306,7 +306,7 @@ retry_transaction:
         }
     }
 
-    if (d_config.c_info.type != LIBXL_DOMAIN_TYPE_PV) {
+    if (domid && d_config.c_info.type != LIBXL_DOMAIN_TYPE_PV) {
         r = xc_domain_set_pod_target(ctx->xch, domid,
                 (new_target_memkb + size) / 4, NULL, NULL, NULL);
         if (r != 0) {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Sep 09 12:44:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Sep 2025 12:44:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1116756.1462995 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uvxhl-0000zF-0q; Tue, 09 Sep 2025 12:44:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1116756.1462995; Tue, 09 Sep 2025 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 1uvxhk-0000z7-UV; Tue, 09 Sep 2025 12:44:12 +0000
Received: by outflank-mailman (input) for mailman id 1116756;
 Tue, 09 Sep 2025 12: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 1uvxhj-0000yw-S0
 for xen-changelog@lists.xenproject.org; Tue, 09 Sep 2025 12: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 1uvxhj-001fuU-2f
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 12:44:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uvxhj-001Vmd-2V
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 12: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=t8aV66bvBCF551bx0qsgChq+bpniAvtCQn9eZo76njE=; b=0IptTUaUNDdpgRV/9K42Epj1T3
	5MNGJfbiM9eTTgkS1nGTEn3hyT8/ZpojNusf9YvzPKL2OL/xn/+tQchyRK+Un+bjxzFUEk5+Ce3cP
	tNsmNI82+QMv9CQ1pPjClV/shrRn0tt++kZrZO+4VTtV4xLEgAmaTAB5DMGm4UFpligs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] libxl: respect unset video_memkb for Dom0
Message-Id: <E1uvxhj-001Vmd-2V@xenbits.xenproject.org>
Date: Tue, 09 Sep 2025 12:44:11 +0000

commit 35a68ba3b2ad888f4c302d4cf5de8ab42f64236e
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Sep 9 08:17:09 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 9 08:17:09 2025 +0200

    libxl: respect unset video_memkb for Dom0
    
    Without this, Dom0 will have have a curiously off-by-1 target_memkb
    value displayed by "xl list -l".
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
    Acked-by: Anthony PERARD <anthony.perard@vates.tech>
---
 tools/libs/light/libxl_internal.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tools/libs/light/libxl_internal.h b/tools/libs/light/libxl_internal.h
index 4b6587a27a..062123eed4 100644
--- a/tools/libs/light/libxl_internal.h
+++ b/tools/libs/light/libxl_internal.h
@@ -4683,7 +4683,10 @@ uint64_t libxl__get_targetmem_fudge(libxl__gc *gc,
                                 info->max_memkb > info->target_memkb)
                                 ? LIBXL_MAXMEM_CONSTANT : 0;
 
-    return info->video_memkb + mem_target_fudge;
+    if (info->video_memkb != LIBXL_MEMKB_DEFAULT)
+        mem_target_fudge += info->video_memkb;
+
+    return mem_target_fudge;
 }
 
 int libxl__get_memory_target(libxl__gc *gc, uint32_t domid,
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Sep 09 12:44:23 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Sep 2025 12:44:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1116757.1462999 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uvxhv-00012H-2F; Tue, 09 Sep 2025 12:44:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1116757.1462999; Tue, 09 Sep 2025 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 1uvxhu-000129-Vt; Tue, 09 Sep 2025 12:44:22 +0000
Received: by outflank-mailman (input) for mailman id 1116757;
 Tue, 09 Sep 2025 12: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 1uvxht-00011w-UM
 for xen-changelog@lists.xenproject.org; Tue, 09 Sep 2025 12: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 1uvxht-001fuY-2w
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 12:44:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uvxht-001Vog-2q
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 12: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=+UszlyQ1eEIuojLAIp9hs5e+5B3sszaZlEGCxUx1XfQ=; b=U4A6uErqDsSkS1mJGuQ5SE2u3s
	UaMcdnGubjaGSK67v4mBAjyJUG6/qCzJgkK2stpVKKAnzf96WEbDIHiFDxt0yAPxBoMpabdvH+KKN
	QNO9t1dvk38CBpsw1ZMAyL8l7Ig9e8l21HHU4nfz4+wblP1GF86o9OZ40zEeMu2xPEUo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] libxl: preserve errno in libxl__xcinfo2xlinfo()
Message-Id: <E1uvxht-001Vog-2q@xenbits.xenproject.org>
Date: Tue, 09 Sep 2025 12:44:21 +0000

commit abd324a24770a9a0deb669cbc917c270a297166e
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Sep 9 08:17:28 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 9 08:17:28 2025 +0200

    libxl: preserve errno in libxl__xcinfo2xlinfo()
    
    Callers observing errors elsewhere may be confused by the ENOSYS that
    the Flask operation would yield on a Flask-disabled hypervisor.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
    Acked-by: Anthony PERARD <anthony.perard@vates.tech>
---
 tools/libs/light/libxl_domain.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/libs/light/libxl_domain.c b/tools/libs/light/libxl_domain.c
index dd2e5e9a19..5be47f687f 100644
--- a/tools/libs/light/libxl_domain.c
+++ b/tools/libs/light/libxl_domain.c
@@ -277,6 +277,7 @@ void libxl__xcinfo2xlinfo(libxl_ctx *ctx,
                           libxl_dominfo *xlinfo)
 {
     size_t size;
+    int saved_errno = errno;
 
     memcpy(&(xlinfo->uuid), xcinfo->handle, sizeof(xen_domain_handle_t));
     xlinfo->domid = xcinfo->domain;
@@ -284,6 +285,7 @@ void libxl__xcinfo2xlinfo(libxl_ctx *ctx,
     if (libxl_flask_sid_to_context(ctx, xlinfo->ssidref,
                                    &xlinfo->ssid_label, &size) < 0)
         xlinfo->ssid_label = NULL;
+    errno = saved_errno;
 
     xlinfo->dying      = !!(xcinfo->flags&XEN_DOMINF_dying);
     xlinfo->shutdown   = !!(xcinfo->flags&XEN_DOMINF_shutdown);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Sep 09 12:44:33 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Sep 2025 12:44:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1116758.1463003 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uvxi5-00014b-3t; Tue, 09 Sep 2025 12:44:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1116758.1463003; Tue, 09 Sep 2025 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 1uvxi5-00014R-1E; Tue, 09 Sep 2025 12:44:33 +0000
Received: by outflank-mailman (input) for mailman id 1116758;
 Tue, 09 Sep 2025 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 1uvxi4-00014E-0r
 for xen-changelog@lists.xenproject.org; Tue, 09 Sep 2025 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 1uvxi3-001fuc-3D
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 12:44:31 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uvxi3-001VpO-37
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 12: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=j9s76diOVh58TFIXKOBT557KbBfEJyKaFvjWAqHHqlA=; b=jMaYrauvSKNHr3eq3YrmYChMBt
	87mwFv4T4X+ge2sXO5QNJR5evDIeAMsPNIJllRYWVgRBk3XombRi971qLjqjmAkwGlFCX93vtkBbG
	027ErctYxQ0vmA26sE/gGQBT1YU4JU/Sa8jIa15GoEZD9uMPYbD4GOeiCkH7tlIKG/vg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/mcheck: fix mca_allbanks updating
Message-Id: <E1uvxi3-001VpO-37@xenbits.xenproject.org>
Date: Tue, 09 Sep 2025 12:44:31 +0000

commit 532988dccc197bc4fe700ebceffad95f2f4c7541
Author:     Soham Dandapat <soham.dandapat@amd.com>
AuthorDate: Tue Sep 9 08:18:11 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 9 08:18:11 2025 +0200

    x86/mcheck: fix mca_allbanks updating
    
    In mca_cap_init function,the mcabanks_alloc allocates and
    initializes an mca_banks structure for managing MCA banks,
    setting up a bank map and storing the specified or default number
    of banks.
    
    After this we will call mcabanks_set(i, mca_allbanks);
    The mcabanks_set function sets a specific bit in the bank_map of
    an mca_banks structure, provided the structure, its bank_map, and
    the bit index are valid.
    
    At the end, we will call
    mcabanks_free(xchg(&mca_allbanks, all));
    This function is thread safe and does below:
       1. Atomically exchanges the value of "mca_allbanks" with "all"
       2. Returns the old value that was previously in "mca_allbanks"
    So, when we will call mcabanks_free , that will free the memory.
    
    The problem is that mcabanks_set(i, mca_allbanks) function is updating
    mca_allbanks which will be freed via mcabanks_free later. This means
    new mca_allbanks instance("all") will never get chance to update
    it's bank_map.
    
    Due to this when we will collect log from mcheck_mca_logout function ,
    the condition "if ( !mcabanks_test(i, bankmask) )" will always fails
    and MCA logs will not be collected for any bank.
    
    The fix is to solve this problem.
    
    Fixes: 560cf418c845 ("x86/mcheck: allow varying bank counts per CPU")
    Signed-off-by: Soham Dandapat <soham.dandapat@amd.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/cpu/mcheck/mce.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/cpu/mcheck/mce.c b/xen/arch/x86/cpu/mcheck/mce.c
index bbc0d24732..9277781bff 100644
--- a/xen/arch/x86/cpu/mcheck/mce.c
+++ b/xen/arch/x86/cpu/mcheck/mce.c
@@ -664,7 +664,7 @@ static int mca_cap_init(bool bsp)
         if ( !all )
             return -ENOMEM;
         for ( i = 0; i < nr; i++ )
-            mcabanks_set(i, mca_allbanks);
+            mcabanks_set(i, all);
         mcabanks_free(xchg(&mca_allbanks, all));
     }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Sep 09 13:55:07 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Sep 2025 13:55:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1117002.1463211 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uvyoK-0004M9-Ab; Tue, 09 Sep 2025 13:55:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1117002.1463211; Tue, 09 Sep 2025 13: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 1uvyoK-0004M1-82; Tue, 09 Sep 2025 13:55:04 +0000
Received: by outflank-mailman (input) for mailman id 1117002;
 Tue, 09 Sep 2025 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 1uvyoI-0004Lv-Eh
 for xen-changelog@lists.xenproject.org; Tue, 09 Sep 2025 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 1uvyoI-001hJA-18
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 13:55:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uvyoI-001amq-11
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 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=l4qWlTWQye96lQMi+4oeWzq7BJIA6K7f1fj4shT+wiY=; b=I9tDYSABfDJHjuKhrzOlFPaYxd
	0hac3RqFk2a8ufs0R/BcaW4vRaWC8t/j1q3DfNqM9HTEKtPmPnqCywaE6gZyvLm6LX9jLEKcrHnBp
	mQ3l+qvZopU2K0eAqTZafF+MHtvfbTheNtVx6uasYdc9cNF9ShGB4EMiAHSHpzdeRKZw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.20] x86/viridian: avoid NULL pointer dereference in update_reference_tsc()
Message-Id: <E1uvyoI-001amq-11@xenbits.xenproject.org>
Date: Tue, 09 Sep 2025 13:55:02 +0000

commit 5f83f721fb62bc59505f07150af23a12ad90a711
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Tue Sep 9 14:20:46 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 9 14:20:46 2025 +0200

    x86/viridian: avoid NULL pointer dereference in update_reference_tsc()
    
    The function is only called when the MSR has the enabled bit set, but even
    then the page might not be mapped because the guest provided gfn is not
    suitable.
    
    Prevent a NULL pointer dereference in update_reference_tsc() by checking
    whether the page is mapped.
    
    This is CVE-2025-27466 / part of XSA-472.
    
    Fixes: 386b3365221d ('viridian: use viridian_map/unmap_guest_page() for reference tsc page')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 5776a2e9db0155cfd76388c8197ca7788bb4b361
    master date: 2025-09-09 14:11:09 +0200
---
 xen/arch/x86/hvm/viridian/time.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/xen/arch/x86/hvm/viridian/time.c b/xen/arch/x86/hvm/viridian/time.c
index 137577384f..ca6d526f46 100644
--- a/xen/arch/x86/hvm/viridian/time.c
+++ b/xen/arch/x86/hvm/viridian/time.c
@@ -26,6 +26,10 @@ static void update_reference_tsc(const struct domain *d, bool initialize)
     HV_REFERENCE_TSC_PAGE *p = rt->ptr;
     uint32_t seq;
 
+    /* Reference TSC page might not be mapped even if the MSR is enabled. */
+    if ( !p )
+        return;
+
     if ( initialize )
         clear_page(p);
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.20


From xen-changelog-bounces@lists.xenproject.org Tue Sep 09 13:55:14 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Sep 2025 13:55:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1117003.1463215 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uvyoU-0004O7-CF; Tue, 09 Sep 2025 13:55:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1117003.1463215; Tue, 09 Sep 2025 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 1uvyoU-0004Nz-9P; Tue, 09 Sep 2025 13:55:14 +0000
Received: by outflank-mailman (input) for mailman id 1117003;
 Tue, 09 Sep 2025 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 1uvyoS-0004Ni-FC
 for xen-changelog@lists.xenproject.org; Tue, 09 Sep 2025 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 1uvyoS-001hJI-1P
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 13:55:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uvyoS-001anG-1J
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 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=ISkV0so2fJGIYcxk3d1lopcNdGjt0M06XWUR2ccClCY=; b=5ff9WCz26nmhumkJTU0Wzi9NGq
	W/YAoPH7tijQXPgHzFGed5MCsQIEzErw//w6j29O+41O0WAqYecEuttHnyhurOL8kKHL+Q7JRMLYf
	nsv1SqVARuDEMIoTiazxGRTaDMey0D+sGQca5X/ej7juAWGDPDHKwMBUkeiiesmieM8A=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.20] x86/viridian: avoid NULL pointer dereference in viridian_synic_deliver_timer_msg()
Message-Id: <E1uvyoS-001anG-1J@xenbits.xenproject.org>
Date: Tue, 09 Sep 2025 13:55:12 +0000

commit c5ecaf0200b36e7f13c837dad4e4a801a8674ebe
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Tue Sep 9 14:21:22 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 9 14:21:22 2025 +0200

    x86/viridian: avoid NULL pointer dereference in viridian_synic_deliver_timer_msg()
    
    The function is called unconditionally, regardless of whether the SIM page
    is mapped.  Avoid a NULL pointer dereference in
    viridian_synic_deliver_timer_msg() by checking whether the SIM page is
    mapped.
    
    This is CVE-2025-58142 / part of XSA-472.
    
    Fixes: 26fba3c85571 ('viridian: add implementation of synthetic timers')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 3a7b4f2897a352cff287be97d27150b290a5d1ee
    master date: 2025-09-09 14:11:34 +0200
---
 xen/arch/x86/hvm/viridian/synic.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/xen/arch/x86/hvm/viridian/synic.c b/xen/arch/x86/hvm/viridian/synic.c
index c3dc573b00..e6cba7548f 100644
--- a/xen/arch/x86/hvm/viridian/synic.c
+++ b/xen/arch/x86/hvm/viridian/synic.c
@@ -338,6 +338,10 @@ bool viridian_synic_deliver_timer_msg(struct vcpu *v, unsigned int sintx,
         .DeliveryTime = delivery,
     };
 
+    /* Don't assume SIM page to be mapped. */
+    if ( !msg )
+        return false;
+
     /*
      * To avoid using an atomic test-and-set, and barrier before calling
      * vlapic_set_irq(), this function must be called in context of the
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.20


From xen-changelog-bounces@lists.xenproject.org Tue Sep 09 13:55:24 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Sep 2025 13:55:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1117004.1463219 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uvyoe-0004Qt-FJ; Tue, 09 Sep 2025 13:55:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1117004.1463219; Tue, 09 Sep 2025 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 1uvyoe-0004Ql-CW; Tue, 09 Sep 2025 13:55:24 +0000
Received: by outflank-mailman (input) for mailman id 1117004;
 Tue, 09 Sep 2025 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 1uvyoc-0004Qb-K5
 for xen-changelog@lists.xenproject.org; Tue, 09 Sep 2025 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 1uvyoc-001hJO-1s
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 13:55:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uvyoc-001aoA-1a
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 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=/gmLoi5k26A7GTWxWUCJXjU7khIQGlf3XRkf0Gl3F5M=; b=yIfbEThnlPIBG8jmkkWGb9iDls
	6xQruS14xXmbAMMQ4HSVPPwCkNm6DMuzqJWd7BOJSbbvf2NWobUxEsdCDDMgWTsiyehhRjLranvQ+
	SD2ml8Sf73ZRmOTQEVnOuHFcta0t37t7S2LJjgYNoS5UfUfeG1iYUnoc5pxzH1Z+aTLM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.20] x86/viridian: protect concurrent modification of the reference TSC page
Message-Id: <E1uvyoc-001aoA-1a@xenbits.xenproject.org>
Date: Tue, 09 Sep 2025 13:55:22 +0000

commit 665a641471efbcf97a6bea6a7543bbd7b475dc54
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Tue Sep 9 14:21:36 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 9 14:21:36 2025 +0200

    x86/viridian: protect concurrent modification of the reference TSC page
    
    The reference TSC page is shared between all vCPUs, and the data stored in
    the domain struct.  However the handlers to set and clear it are not safe
    against concurrent accesses.  It's possible for two (or more) vCPUs to call
    HV_X64_MSR_REFERENCE_TSC at the same time and cause the in-use reference
    TSC page to be freed, while still being on the p2m.  This creates a use-
    after-free bug, where the page can end up mapped in another domain or used
    by Xen while still being part of the original domain's p2m.
    
    It's also possible to underflow the reference counter, as multiple
    concurrent writes to HV_X64_MSR_REFERENCE_TSC can create an imbalance on
    the number of put_page_and_type() calls.
    
    Introduce a lock to protect the reference TSC domain field, thus
    serializing concurrent vCPU accesses.
    
    This is CVE-2025-58143 / part of XSA-472.
    
    Fixes: 386b3365221d ('viridian: use viridian_map/unmap_guest_page() for reference tsc page')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 45729a510a352e1a973e4023bd0067cddb1bcaf8
    master date: 2025-09-09 14:12:00 +0200
---
 xen/arch/x86/hvm/viridian/time.c        | 4 ++++
 xen/arch/x86/hvm/viridian/viridian.c    | 2 ++
 xen/arch/x86/include/asm/hvm/viridian.h | 1 +
 3 files changed, 7 insertions(+)

diff --git a/xen/arch/x86/hvm/viridian/time.c b/xen/arch/x86/hvm/viridian/time.c
index ca6d526f46..9311858d63 100644
--- a/xen/arch/x86/hvm/viridian/time.c
+++ b/xen/arch/x86/hvm/viridian/time.c
@@ -108,8 +108,10 @@ static void time_ref_count_thaw(const struct domain *d)
 
     trc->off = (int64_t)trc->val - trc_val(d, 0);
 
+    spin_lock(&vd->lock);
     if ( vd->reference_tsc.msr.enabled )
         update_reference_tsc(d, false);
+    spin_unlock(&vd->lock);
 }
 
 static uint64_t time_ref_count(const struct domain *d)
@@ -331,6 +333,7 @@ int viridian_time_wrmsr(struct vcpu *v, uint32_t idx, uint64_t val)
         if ( !(viridian_feature_mask(d) & HVMPV_reference_tsc) )
             return X86EMUL_EXCEPTION;
 
+        spin_lock(&vd->lock);
         viridian_unmap_guest_page(&vd->reference_tsc);
         vd->reference_tsc.msr.raw = val;
         viridian_dump_guest_page(v, "REFERENCE_TSC", &vd->reference_tsc);
@@ -339,6 +342,7 @@ int viridian_time_wrmsr(struct vcpu *v, uint32_t idx, uint64_t val)
             viridian_map_guest_page(d, &vd->reference_tsc);
             update_reference_tsc(d, true);
         }
+        spin_unlock(&vd->lock);
         break;
 
     case HV_X64_MSR_TIME_REF_COUNT:
diff --git a/xen/arch/x86/hvm/viridian/viridian.c b/xen/arch/x86/hvm/viridian/viridian.c
index 33d54e587e..8ff19a00fe 100644
--- a/xen/arch/x86/hvm/viridian/viridian.c
+++ b/xen/arch/x86/hvm/viridian/viridian.c
@@ -494,6 +494,8 @@ int viridian_domain_init(struct domain *d)
     if ( !d->arch.hvm.viridian )
         return -ENOMEM;
 
+    spin_lock_init(&d->arch.hvm.viridian->lock);
+
     rc = viridian_synic_domain_init(d);
     if ( rc )
         goto fail;
diff --git a/xen/arch/x86/include/asm/hvm/viridian.h b/xen/arch/x86/include/asm/hvm/viridian.h
index 4c8ff6e80b..47c9d13841 100644
--- a/xen/arch/x86/include/asm/hvm/viridian.h
+++ b/xen/arch/x86/include/asm/hvm/viridian.h
@@ -71,6 +71,7 @@ struct viridian_domain
     DECLARE_BITMAP(hypercall_flags, _HCALL_nr);
     struct viridian_time_ref_count time_ref_count;
     struct viridian_page reference_tsc;
+    spinlock_t lock;
 };
 
 void cpuid_viridian_leaves(const struct vcpu *v, uint32_t leaf,
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.20


From xen-changelog-bounces@lists.xenproject.org Tue Sep 09 13:55:34 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Sep 2025 13:55:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1117006.1463223 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uvyoo-0004T0-Gj; Tue, 09 Sep 2025 13:55:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1117006.1463223; Tue, 09 Sep 2025 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 1uvyoo-0004Ss-Du; Tue, 09 Sep 2025 13:55:34 +0000
Received: by outflank-mailman (input) for mailman id 1117006;
 Tue, 09 Sep 2025 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 1uvyom-0004Sg-MO
 for xen-changelog@lists.xenproject.org; Tue, 09 Sep 2025 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 1uvyom-001hJV-29
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 13:55:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uvyom-001aoi-22
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 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=8B9v2mT+N0rVCxhCrZjfUZn6IMFKG2LIDppCfDnVclU=; b=ms74Jmw53f2IHYv7dt8kJZcCBI
	VaaNKrMXBbxAHy4KGzXppKz0OI9ckIlPefNWsqxbzzX9l/neDx8HiCSC01ZGlVM7TEgkjAgR0/X1x
	Hckiw65akQTyHUMNonAzPkHVwdmoK3IEeEKWjtHDABqOpdIAjrlhL1mfqcu+0lmNlpo8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.20] Arm: foreign page handling in p2m_get_page_from_gfn()
Message-Id: <E1uvyom-001aoi-22@xenbits.xenproject.org>
Date: Tue, 09 Sep 2025 13:55:32 +0000

commit 1230b94f1c9eab96a2c6f4e0de8a511b6247c289
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Sep 9 14:21:51 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 9 14:21:51 2025 +0200

    Arm: foreign page handling in p2m_get_page_from_gfn()
    
    I can't see what would make the 1st of the assertions safe: For example,
    the P2M lock not being held, the foreign page may disappear before we
    get to call page_get_owner_and_reference(), which hence may return NULL.
    
    Even the 2nd, which appears to be safe safe, is lacking proper release
    build fallbacks.
    
    Drop the former in favor of an if(), and convert the latter to the
    equivalent of what x86 uses: ASSERT_UNREACHABLE() plus putting of the
    obtained page.
    
    This is CVE-2025-58144 / part of XSA-473.
    
    Fixes: 9486a8d07ba8 ("xen/arm: Handle remove foreign mapping")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
    master commit: c5a6dd68508c998c95ca87f59e9ecb6da93ca6ab
    master date: 2025-09-09 14:12:13 +0200
---
 xen/arch/arm/p2m.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
index 65b70955e3..b4573ddf32 100644
--- a/xen/arch/arm/p2m.c
+++ b/xen/arch/arm/p2m.c
@@ -74,10 +74,16 @@ struct page_info *p2m_get_page_from_gfn(struct domain *d, gfn_t gfn,
      */
     if ( p2m_is_foreign(p2mt) )
     {
-        struct domain *fdom = page_get_owner_and_reference(page);
-        ASSERT(fdom != NULL);
-        ASSERT(fdom != d);
-        return page;
+        const struct domain *fdom = page_get_owner_and_reference(page);
+
+        if ( fdom )
+        {
+            if ( fdom != d )
+                return page;
+            ASSERT_UNREACHABLE();
+            put_page(page);
+        }
+        return NULL;
     }
 
     return get_page(page, d) ? page : NULL;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.20


From xen-changelog-bounces@lists.xenproject.org Tue Sep 09 13:55:43 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Sep 2025 13:55:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1117009.1463227 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uvyox-0004VG-Hn; Tue, 09 Sep 2025 13:55:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1117009.1463227; Tue, 09 Sep 2025 13: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 1uvyox-0004V8-FF; Tue, 09 Sep 2025 13:55:43 +0000
Received: by outflank-mailman (input) for mailman id 1117009;
 Tue, 09 Sep 2025 13: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 1uvyow-0004Uw-Pc
 for xen-changelog@lists.xenproject.org; Tue, 09 Sep 2025 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 1uvyow-001hJj-2S
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 13:55:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uvyow-001apP-2I
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 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=0rU5CZqen9SIu2OTyykwjy4f1b7Q1XHDJxdPWC4Ibzo=; b=wfeb70nS54bG/zwD/oaCHAH67+
	UDF1JyKC5n5q6Ny9R4ga58FPlgmtGaIM8ooWsNYC7IZcYaDu7lHxin2JP9i3ZO7NYkect1NivgOPa
	oXILO007pKAN/X0By+dhpFWdhKPONMAIu4QNdGqw9AcwHgTM1/74VRVijBh0UJ/eTDxA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.20] Arm: adjust locking in p2m_get_page_from_gfn()
Message-Id: <E1uvyow-001apP-2I@xenbits.xenproject.org>
Date: Tue, 09 Sep 2025 13:55:42 +0000

commit d7e55a41399ef1355e3df66270db7e682e7e1150
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Sep 9 14:22:01 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 9 14:22:01 2025 +0200

    Arm: adjust locking in p2m_get_page_from_gfn()
    
    In order to safely acquire a reference for a foreign page mapping, the
    P2M lock needs to be held until we have the reference in hand (or
    getting one failed). Otherwise the page can change P2M type and
    ownership in between.
    
    This is CVE-2025-58145 / part of XSA-473.
    
    Fixes: 9486a8d07ba8 ("xen/arm: Handle remove foreign mapping")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
    master commit: 2275bf83a1db579661b27fc4b310a7d92594dbc0
    master date: 2025-09-09 14:12:57 +0200
---
 xen/arch/arm/p2m.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
index b4573ddf32..584701e64f 100644
--- a/xen/arch/arm/p2m.c
+++ b/xen/arch/arm/p2m.c
@@ -53,18 +53,22 @@ mfn_t p2m_lookup(struct domain *d, gfn_t gfn, p2m_type_t *t)
 struct page_info *p2m_get_page_from_gfn(struct domain *d, gfn_t gfn,
                                         p2m_type_t *t)
 {
+    struct p2m_domain *p2m = p2m_get_hostp2m(d);
     struct page_info *page;
     p2m_type_t p2mt;
-    mfn_t mfn = p2m_lookup(d, gfn, &p2mt);
+    mfn_t mfn;
+
+    p2m_read_lock(p2m);
+    mfn = p2m_get_entry(p2m, gfn, &p2mt, NULL, NULL, NULL);
 
     if ( t )
         *t = p2mt;
 
-    if ( !p2m_is_any_ram(p2mt) )
-        return NULL;
-
-    if ( !mfn_valid(mfn) )
+    if ( !p2m_is_any_ram(p2mt) || !mfn_valid(mfn) )
+    {
+        p2m_read_unlock(p2m);
         return NULL;
+    }
 
     page = mfn_to_page(mfn);
 
@@ -76,6 +80,8 @@ struct page_info *p2m_get_page_from_gfn(struct domain *d, gfn_t gfn,
     {
         const struct domain *fdom = page_get_owner_and_reference(page);
 
+        p2m_read_unlock(p2m);
+
         if ( fdom )
         {
             if ( fdom != d )
@@ -86,6 +92,8 @@ struct page_info *p2m_get_page_from_gfn(struct domain *d, gfn_t gfn,
         return NULL;
     }
 
+    p2m_read_unlock(p2m);
+
     return get_page(page, d) ? page : NULL;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.20


From xen-changelog-bounces@lists.xenproject.org Tue Sep 09 13:55:53 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Sep 2025 13:55:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1117010.1463231 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uvyp7-0004Xw-JJ; Tue, 09 Sep 2025 13:55:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1117010.1463231; Tue, 09 Sep 2025 13: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 1uvyp7-0004Xn-Gb; Tue, 09 Sep 2025 13:55:53 +0000
Received: by outflank-mailman (input) for mailman id 1117010;
 Tue, 09 Sep 2025 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 1uvyp7-0004Xh-7k
 for xen-changelog@lists.xenproject.org; Tue, 09 Sep 2025 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 1uvyp7-001hKM-0f
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 13:55:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uvyp7-001aqr-0Y
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 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=o3zMb55SnI2KkC+PrFO1AQ+JM39uWSg7FqJEU5KnMwU=; b=y/dmNe+/4aMZrlgOyVNQp/yIhW
	M4hfLjvY9kDBUZtusa6gI2VTDr8s6QPi6vKXaotyKOyH42Fz7GJ4NL5+bp5RwgHBfbsx5OGUjtw7c
	zn9IhEw8D1qYcD4SXOyx5ojomw/PtnIdrplDMdS3OLt+fDD88FdmUiIfYq+YvoNXuoPE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] x86/viridian: avoid NULL pointer dereference in update_reference_tsc()
Message-Id: <E1uvyp7-001aqr-0Y@xenbits.xenproject.org>
Date: Tue, 09 Sep 2025 13:55:53 +0000

commit 600db442cbb8d9292e6c0877caa1a63b7a3c1303
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Tue Sep 9 14:26:31 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 9 14:26:31 2025 +0200

    x86/viridian: avoid NULL pointer dereference in update_reference_tsc()
    
    The function is only called when the MSR has the enabled bit set, but even
    then the page might not be mapped because the guest provided gfn is not
    suitable.
    
    Prevent a NULL pointer dereference in update_reference_tsc() by checking
    whether the page is mapped.
    
    This is CVE-2025-27466 / part of XSA-472.
    
    Fixes: 386b3365221d ('viridian: use viridian_map/unmap_guest_page() for reference tsc page')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 5776a2e9db0155cfd76388c8197ca7788bb4b361
    master date: 2025-09-09 14:11:09 +0200
---
 xen/arch/x86/hvm/viridian/time.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/xen/arch/x86/hvm/viridian/time.c b/xen/arch/x86/hvm/viridian/time.c
index b56fd67662..97caf0b08b 100644
--- a/xen/arch/x86/hvm/viridian/time.c
+++ b/xen/arch/x86/hvm/viridian/time.c
@@ -27,6 +27,10 @@ static void update_reference_tsc(const struct domain *d, bool initialize)
     HV_REFERENCE_TSC_PAGE *p = rt->ptr;
     uint32_t seq;
 
+    /* Reference TSC page might not be mapped even if the MSR is enabled. */
+    if ( !p )
+        return;
+
     if ( initialize )
         clear_page(p);
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Tue Sep 09 13:56:04 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Sep 2025 13:56:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1117011.1463235 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uvypI-0004aA-Ka; Tue, 09 Sep 2025 13:56:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1117011.1463235; Tue, 09 Sep 2025 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 1uvypI-0004a2-I2; Tue, 09 Sep 2025 13:56:04 +0000
Received: by outflank-mailman (input) for mailman id 1117011;
 Tue, 09 Sep 2025 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 1uvypH-0004Zu-BH
 for xen-changelog@lists.xenproject.org; Tue, 09 Sep 2025 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 1uvypH-001hKn-12
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 13:56:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uvypH-001ars-0q
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 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=IEsJsl2DKe8V0BaNoFa2QXCnRkNqs7NF+nKbKKzV5gE=; b=iwWQm7jObmx4Ya6EsJlraL1VQb
	zFNxtNGPh4zEr6wCCBi3PwoqLU8e2V+b1nw9UGpy11JonsjcTq+aMl6ed/mf6uJtrKqWspoQHWJa0
	XD0MhSeugegxrm19dB4y3sNnZgO5L/1pquIL56d2BOJZpEaBCPQoBZD6gumvGVX+w3U0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] x86/viridian: avoid NULL pointer dereference in viridian_synic_deliver_timer_msg()
Message-Id: <E1uvypH-001ars-0q@xenbits.xenproject.org>
Date: Tue, 09 Sep 2025 13:56:03 +0000

commit f20f97564437698243f010b1ccba0d77cf5b133f
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Tue Sep 9 14:27:00 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 9 14:27:00 2025 +0200

    x86/viridian: avoid NULL pointer dereference in viridian_synic_deliver_timer_msg()
    
    The function is called unconditionally, regardless of whether the SIM page
    is mapped.  Avoid a NULL pointer dereference in
    viridian_synic_deliver_timer_msg() by checking whether the SIM page is
    mapped.
    
    This is CVE-2025-58142 / part of XSA-472.
    
    Fixes: 26fba3c85571 ('viridian: add implementation of synthetic timers')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 3a7b4f2897a352cff287be97d27150b290a5d1ee
    master date: 2025-09-09 14:11:34 +0200
---
 xen/arch/x86/hvm/viridian/synic.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/xen/arch/x86/hvm/viridian/synic.c b/xen/arch/x86/hvm/viridian/synic.c
index 856bb898b8..c5bab2d6fd 100644
--- a/xen/arch/x86/hvm/viridian/synic.c
+++ b/xen/arch/x86/hvm/viridian/synic.c
@@ -339,6 +339,10 @@ bool viridian_synic_deliver_timer_msg(struct vcpu *v, unsigned int sintx,
         .DeliveryTime = delivery,
     };
 
+    /* Don't assume SIM page to be mapped. */
+    if ( !msg )
+        return false;
+
     /*
      * To avoid using an atomic test-and-set, and barrier before calling
      * vlapic_set_irq(), this function must be called in context of the
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Tue Sep 09 13:56:14 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Sep 2025 13:56:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1117013.1463239 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uvypS-0004mL-M6; Tue, 09 Sep 2025 13:56:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1117013.1463239; Tue, 09 Sep 2025 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 1uvypS-0004mD-JP; Tue, 09 Sep 2025 13:56:14 +0000
Received: by outflank-mailman (input) for mailman id 1117013;
 Tue, 09 Sep 2025 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 1uvypR-0004jX-E1
 for xen-changelog@lists.xenproject.org; Tue, 09 Sep 2025 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 1uvypR-001hL5-1J
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 13:56:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uvypR-001asM-1D
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 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=I8fyydAx3ghwgwA2IDr+7ZZ9eoWM5LqOoQX6CdKGuvc=; b=hSmHFbHLu1Z9Wn3w2P7b7LDOvD
	OLF0D0LS0jZC6ZdnaiVph/iCDsfcXTgFUIlSbOjJNMkrPBoMSSxUhkLxDeS4awQr5W4PwW6+5eCUw
	cp8rK5CaSWcmkUwslzkW6rMtlBIip9WRG33eB6KQj1PglpG3TAzRaPaDIoM253/VirmE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] x86/viridian: protect concurrent modification of the reference TSC page
Message-Id: <E1uvypR-001asM-1D@xenbits.xenproject.org>
Date: Tue, 09 Sep 2025 13:56:13 +0000

commit af733b706de569614b499bbd615085225fda1c6a
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Tue Sep 9 14:27:22 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 9 14:27:22 2025 +0200

    x86/viridian: protect concurrent modification of the reference TSC page
    
    The reference TSC page is shared between all vCPUs, and the data stored in
    the domain struct.  However the handlers to set and clear it are not safe
    against concurrent accesses.  It's possible for two (or more) vCPUs to call
    HV_X64_MSR_REFERENCE_TSC at the same time and cause the in-use reference
    TSC page to be freed, while still being on the p2m.  This creates a use-
    after-free bug, where the page can end up mapped in another domain or used
    by Xen while still being part of the original domain's p2m.
    
    It's also possible to underflow the reference counter, as multiple
    concurrent writes to HV_X64_MSR_REFERENCE_TSC can create an imbalance on
    the number of put_page_and_type() calls.
    
    Introduce a lock to protect the reference TSC domain field, thus
    serializing concurrent vCPU accesses.
    
    This is CVE-2025-58143 / part of XSA-472.
    
    Fixes: 386b3365221d ('viridian: use viridian_map/unmap_guest_page() for reference tsc page')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 45729a510a352e1a973e4023bd0067cddb1bcaf8
    master date: 2025-09-09 14:12:00 +0200
---
 xen/arch/x86/hvm/viridian/time.c        | 4 ++++
 xen/arch/x86/hvm/viridian/viridian.c    | 2 ++
 xen/arch/x86/include/asm/hvm/viridian.h | 1 +
 3 files changed, 7 insertions(+)

diff --git a/xen/arch/x86/hvm/viridian/time.c b/xen/arch/x86/hvm/viridian/time.c
index 97caf0b08b..3c94fb0814 100644
--- a/xen/arch/x86/hvm/viridian/time.c
+++ b/xen/arch/x86/hvm/viridian/time.c
@@ -109,8 +109,10 @@ static void time_ref_count_thaw(const struct domain *d)
 
     trc->off = (int64_t)trc->val - trc_val(d, 0);
 
+    spin_lock(&vd->lock);
     if ( vd->reference_tsc.msr.enabled )
         update_reference_tsc(d, false);
+    spin_unlock(&vd->lock);
 }
 
 static uint64_t time_ref_count(const struct domain *d)
@@ -332,6 +334,7 @@ int viridian_time_wrmsr(struct vcpu *v, uint32_t idx, uint64_t val)
         if ( !(viridian_feature_mask(d) & HVMPV_reference_tsc) )
             return X86EMUL_EXCEPTION;
 
+        spin_lock(&vd->lock);
         viridian_unmap_guest_page(&vd->reference_tsc);
         vd->reference_tsc.msr.raw = val;
         viridian_dump_guest_page(v, "REFERENCE_TSC", &vd->reference_tsc);
@@ -340,6 +343,7 @@ int viridian_time_wrmsr(struct vcpu *v, uint32_t idx, uint64_t val)
             viridian_map_guest_page(d, &vd->reference_tsc);
             update_reference_tsc(d, true);
         }
+        spin_unlock(&vd->lock);
         break;
 
     case HV_X64_MSR_TIME_REF_COUNT:
diff --git a/xen/arch/x86/hvm/viridian/viridian.c b/xen/arch/x86/hvm/viridian/viridian.c
index 2937ddd3a8..372a749ab9 100644
--- a/xen/arch/x86/hvm/viridian/viridian.c
+++ b/xen/arch/x86/hvm/viridian/viridian.c
@@ -494,6 +494,8 @@ int viridian_domain_init(struct domain *d)
     if ( !d->arch.hvm.viridian )
         return -ENOMEM;
 
+    spin_lock_init(&d->arch.hvm.viridian->lock);
+
     rc = viridian_synic_domain_init(d);
     if ( rc )
         goto fail;
diff --git a/xen/arch/x86/include/asm/hvm/viridian.h b/xen/arch/x86/include/asm/hvm/viridian.h
index 4c8ff6e80b..47c9d13841 100644
--- a/xen/arch/x86/include/asm/hvm/viridian.h
+++ b/xen/arch/x86/include/asm/hvm/viridian.h
@@ -71,6 +71,7 @@ struct viridian_domain
     DECLARE_BITMAP(hypercall_flags, _HCALL_nr);
     struct viridian_time_ref_count time_ref_count;
     struct viridian_page reference_tsc;
+    spinlock_t lock;
 };
 
 void cpuid_viridian_leaves(const struct vcpu *v, uint32_t leaf,
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Tue Sep 09 13:56:24 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Sep 2025 13:56:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1117015.1463242 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uvypc-0004s2-NO; Tue, 09 Sep 2025 13:56:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1117015.1463242; Tue, 09 Sep 2025 13:56: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 1uvypc-0004rv-Kw; Tue, 09 Sep 2025 13:56:24 +0000
Received: by outflank-mailman (input) for mailman id 1117015;
 Tue, 09 Sep 2025 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 1uvypb-0004rl-HR
 for xen-changelog@lists.xenproject.org; Tue, 09 Sep 2025 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 1uvypb-001hLJ-1e
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 13:56:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uvypb-001atY-1U
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 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=bsyA8iWvPV+P5K8ZHbg4DHLzcQ3Cn6g2Kkr1Et6pSNM=; b=FN+0js27BaDpBJJItryxUf2DA5
	spgrpGAKVJe24CqQU31P9TKgXlMf5lzC0BNy4qjxVc+NSK8NX9bfwN84vIXJAoJzsDhGjwbzevqYY
	60+xQqSj+eOWxl1q/tiwklIK36J60nuKwAS0DnSsg2+4ZN8B8K97Iv+kSof873q3Zldc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] Arm: foreign page handling in p2m_get_page_from_gfn()
Message-Id: <E1uvypb-001atY-1U@xenbits.xenproject.org>
Date: Tue, 09 Sep 2025 13:56:23 +0000

commit 0b39ff2964219f3321ece7abbfd87f98e8cfa5c7
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Sep 9 14:27:50 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 9 14:27:50 2025 +0200

    Arm: foreign page handling in p2m_get_page_from_gfn()
    
    I can't see what would make the 1st of the assertions safe: For example,
    the P2M lock not being held, the foreign page may disappear before we
    get to call page_get_owner_and_reference(), which hence may return NULL.
    
    Even the 2nd, which appears to be safe safe, is lacking proper release
    build fallbacks.
    
    Drop the former in favor of an if(), and convert the latter to the
    equivalent of what x86 uses: ASSERT_UNREACHABLE() plus putting of the
    obtained page.
    
    This is CVE-2025-58144 / part of XSA-473.
    
    Fixes: 9486a8d07ba8 ("xen/arm: Handle remove foreign mapping")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
    master commit: c5a6dd68508c998c95ca87f59e9ecb6da93ca6ab
    master date: 2025-09-09 14:12:13 +0200
---
 xen/arch/arm/p2m.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
index 9bc5443d9e..3738fdf1a4 100644
--- a/xen/arch/arm/p2m.c
+++ b/xen/arch/arm/p2m.c
@@ -618,10 +618,16 @@ struct page_info *p2m_get_page_from_gfn(struct domain *d, gfn_t gfn,
      */
     if ( p2m_is_foreign(p2mt) )
     {
-        struct domain *fdom = page_get_owner_and_reference(page);
-        ASSERT(fdom != NULL);
-        ASSERT(fdom != d);
-        return page;
+        const struct domain *fdom = page_get_owner_and_reference(page);
+
+        if ( fdom )
+        {
+            if ( fdom != d )
+                return page;
+            ASSERT_UNREACHABLE();
+            put_page(page);
+        }
+        return NULL;
     }
 
     return get_page(page, d) ? page : NULL;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Tue Sep 09 13:56:34 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Sep 2025 13:56:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1117016.1463247 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uvypm-0004zv-QT; Tue, 09 Sep 2025 13:56:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1117016.1463247; Tue, 09 Sep 2025 13: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 1uvypm-0004zn-Nj; Tue, 09 Sep 2025 13:56:34 +0000
Received: by outflank-mailman (input) for mailman id 1117016;
 Tue, 09 Sep 2025 13: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 1uvypl-0004yX-Jw
 for xen-changelog@lists.xenproject.org; Tue, 09 Sep 2025 13:56: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 1uvypl-001hLT-1u
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 13:56:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uvypl-001auR-1o
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 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=avDaRTIYxpAr3dzXEfwwQvnh+Op43glNagmxHaznIKs=; b=TUAaOI6qhSWahAUrBK+PS/Jao+
	8/EeIQBkW0L8t5GznP3d03eNEe0HGhTxZ40s+/r4OBuP9CbRKzVxfAb4APYC5I4d5F6rkD/qYVc2G
	qXnuohStHmHH+DyTrH1KY25oGZmGXsVklnXkyPZRjYpuiJfzgI01oIS+CLfcmSjlN7wo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] Arm: adjust locking in p2m_get_page_from_gfn()
Message-Id: <E1uvypl-001auR-1o@xenbits.xenproject.org>
Date: Tue, 09 Sep 2025 13:56:33 +0000

commit 267fdd429fc3b0a71aaac3f3651ef9382a5a58f5
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Sep 9 14:28:03 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 9 14:28:03 2025 +0200

    Arm: adjust locking in p2m_get_page_from_gfn()
    
    In order to safely acquire a reference for a foreign page mapping, the
    P2M lock needs to be held until we have the reference in hand (or
    getting one failed). Otherwise the page can change P2M type and
    ownership in between.
    
    This is CVE-2025-58145 / part of XSA-473.
    
    Fixes: 9486a8d07ba8 ("xen/arm: Handle remove foreign mapping")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
    master commit: 2275bf83a1db579661b27fc4b310a7d92594dbc0
    master date: 2025-09-09 14:12:57 +0200
---
 xen/arch/arm/p2m.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
index 3738fdf1a4..1e66da3eb8 100644
--- a/xen/arch/arm/p2m.c
+++ b/xen/arch/arm/p2m.c
@@ -597,18 +597,22 @@ mfn_t p2m_lookup(struct domain *d, gfn_t gfn, p2m_type_t *t)
 struct page_info *p2m_get_page_from_gfn(struct domain *d, gfn_t gfn,
                                         p2m_type_t *t)
 {
+    struct p2m_domain *p2m = p2m_get_hostp2m(d);
     struct page_info *page;
     p2m_type_t p2mt;
-    mfn_t mfn = p2m_lookup(d, gfn, &p2mt);
+    mfn_t mfn;
+
+    p2m_read_lock(p2m);
+    mfn = p2m_get_entry(p2m, gfn, &p2mt, NULL, NULL, NULL);
 
     if ( t )
         *t = p2mt;
 
-    if ( !p2m_is_any_ram(p2mt) )
-        return NULL;
-
-    if ( !mfn_valid(mfn) )
+    if ( !p2m_is_any_ram(p2mt) || !mfn_valid(mfn) )
+    {
+        p2m_read_unlock(p2m);
         return NULL;
+    }
 
     page = mfn_to_page(mfn);
 
@@ -620,6 +624,8 @@ struct page_info *p2m_get_page_from_gfn(struct domain *d, gfn_t gfn,
     {
         const struct domain *fdom = page_get_owner_and_reference(page);
 
+        p2m_read_unlock(p2m);
+
         if ( fdom )
         {
             if ( fdom != d )
@@ -630,6 +636,8 @@ struct page_info *p2m_get_page_from_gfn(struct domain *d, gfn_t gfn,
         return NULL;
     }
 
+    p2m_read_unlock(p2m);
+
     return get_page(page, d) ? page : NULL;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Tue Sep 09 15:22:07 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Sep 2025 15:22:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1117169.1463361 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uw0AV-0001Ez-1p; Tue, 09 Sep 2025 15:22:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1117169.1463361; Tue, 09 Sep 2025 15: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 1uw0AU-0001Er-Uk; Tue, 09 Sep 2025 15:22:02 +0000
Received: by outflank-mailman (input) for mailman id 1117169;
 Tue, 09 Sep 2025 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 1uw0AT-0001El-W5
 for xen-changelog@lists.xenproject.org; Tue, 09 Sep 2025 15: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 1uw0AT-001j7X-2l
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 15:22:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uw0AT-001fsc-2d
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 15: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=+Vh/P3RLFZeDdv12lcVA18eewbSusTd71CzoQCP0PjI=; b=NRJYEx6wkLIv/UU2pzI8LTJaRk
	iXGr0/T+jMhGGbTJsSh1agmtnJXDbWEX3hXG0tskpWX4IKPEhAOLe1TGZzQRE+pvqAx5Uy+f3KSZg
	h3i/K/FsiZCweG+aNnXu8cTlC701y80shoJSWgddnB0mYcikj2ol1jkinkDQPpte/Ppk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/viridian: avoid NULL pointer dereference in update_reference_tsc()
Message-Id: <E1uw0AT-001fsc-2d@xenbits.xenproject.org>
Date: Tue, 09 Sep 2025 15:22:01 +0000

commit 5776a2e9db0155cfd76388c8197ca7788bb4b361
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Thu Jul 10 15:51:40 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 9 14:11:09 2025 +0200

    x86/viridian: avoid NULL pointer dereference in update_reference_tsc()
    
    The function is only called when the MSR has the enabled bit set, but even
    then the page might not be mapped because the guest provided gfn is not
    suitable.
    
    Prevent a NULL pointer dereference in update_reference_tsc() by checking
    whether the page is mapped.
    
    This is CVE-2025-27466 / part of XSA-472.
    
    Fixes: 386b3365221d ('viridian: use viridian_map/unmap_guest_page() for reference tsc page')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/viridian/time.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/xen/arch/x86/hvm/viridian/time.c b/xen/arch/x86/hvm/viridian/time.c
index 137577384f..ca6d526f46 100644
--- a/xen/arch/x86/hvm/viridian/time.c
+++ b/xen/arch/x86/hvm/viridian/time.c
@@ -26,6 +26,10 @@ static void update_reference_tsc(const struct domain *d, bool initialize)
     HV_REFERENCE_TSC_PAGE *p = rt->ptr;
     uint32_t seq;
 
+    /* Reference TSC page might not be mapped even if the MSR is enabled. */
+    if ( !p )
+        return;
+
     if ( initialize )
         clear_page(p);
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Sep 09 15:22:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Sep 2025 15:22:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1117170.1463363 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uw0Af-0001IQ-2Q; Tue, 09 Sep 2025 15:22:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1117170.1463363; Tue, 09 Sep 2025 15: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 1uw0Ae-0001II-W8; Tue, 09 Sep 2025 15:22:12 +0000
Received: by outflank-mailman (input) for mailman id 1117170;
 Tue, 09 Sep 2025 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 1uw0Ad-0001Hc-W3
 for xen-changelog@lists.xenproject.org; Tue, 09 Sep 2025 15: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 1uw0Ad-001j7s-34
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 15:22:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uw0Ad-001ftM-2v
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 15: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=shAqYTbrCkM+4azLkCO8u+U3tg60e9DZocvOLmOp9ws=; b=ijIo00vDPsgliQtia9a5lqNb29
	D2DY5u7oUqVRXPG30Cmxo8d3YthCVqPzfuimr7yp5Ny2lngnO8ejlNOsV4nAwP8GOO5rv2ECga3sS
	snG8ZQ0dM77J7rmkpfQn0mslWYYjWJHRm0lU2OBeGzp5od17eywJmm3J93xRnn79NeLw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/viridian: avoid NULL pointer dereference in viridian_synic_deliver_timer_msg()
Message-Id: <E1uw0Ad-001ftM-2v@xenbits.xenproject.org>
Date: Tue, 09 Sep 2025 15:22:11 +0000

commit 3a7b4f2897a352cff287be97d27150b290a5d1ee
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Thu Jul 10 15:58:51 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 9 14:11:34 2025 +0200

    x86/viridian: avoid NULL pointer dereference in viridian_synic_deliver_timer_msg()
    
    The function is called unconditionally, regardless of whether the SIM page
    is mapped.  Avoid a NULL pointer dereference in
    viridian_synic_deliver_timer_msg() by checking whether the SIM page is
    mapped.
    
    This is CVE-2025-58142 / part of XSA-472.
    
    Fixes: 26fba3c85571 ('viridian: add implementation of synthetic timers')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/viridian/synic.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/xen/arch/x86/hvm/viridian/synic.c b/xen/arch/x86/hvm/viridian/synic.c
index c3dc573b00..e6cba7548f 100644
--- a/xen/arch/x86/hvm/viridian/synic.c
+++ b/xen/arch/x86/hvm/viridian/synic.c
@@ -338,6 +338,10 @@ bool viridian_synic_deliver_timer_msg(struct vcpu *v, unsigned int sintx,
         .DeliveryTime = delivery,
     };
 
+    /* Don't assume SIM page to be mapped. */
+    if ( !msg )
+        return false;
+
     /*
      * To avoid using an atomic test-and-set, and barrier before calling
      * vlapic_set_irq(), this function must be called in context of the
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Sep 09 15:22:23 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Sep 2025 15:22:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1117171.1463366 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uw0Ap-0001L7-3r; Tue, 09 Sep 2025 15:22:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1117171.1463366; Tue, 09 Sep 2025 15: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 1uw0Ap-0001Kz-1C; Tue, 09 Sep 2025 15:22:23 +0000
Received: by outflank-mailman (input) for mailman id 1117171;
 Tue, 09 Sep 2025 15: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 1uw0Ao-0001Km-2L
 for xen-changelog@lists.xenproject.org; Tue, 09 Sep 2025 15: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 1uw0Ao-001j7x-08
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 15:22:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uw0Ao-001ftt-01
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 15: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=T7MmHLU8zrx5GoEgDOZl9QrR8QpIRAK176EpSh2vvzo=; b=vTVqLpnIrUKEgNBGaPIqtwrRbt
	CnJTtz1zoeB+wrjW2XoN+01Ue4fNKmDoEEalraAIJKYDzRI1U60tZq5VXAkFnU3jz2OHF+dDUXO4L
	u0MoO1LlFNyDYqg6E32IIOWrl47DPG4w0qApcH3z+nkRZmZxzp17rkr25f0DzyF99Y2A=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/viridian: protect concurrent modification of the reference TSC page
Message-Id: <E1uw0Ao-001ftt-01@xenbits.xenproject.org>
Date: Tue, 09 Sep 2025 15:22:22 +0000

commit 45729a510a352e1a973e4023bd0067cddb1bcaf8
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Thu Jul 3 13:09:03 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 9 14:12:00 2025 +0200

    x86/viridian: protect concurrent modification of the reference TSC page
    
    The reference TSC page is shared between all vCPUs, and the data stored in
    the domain struct.  However the handlers to set and clear it are not safe
    against concurrent accesses.  It's possible for two (or more) vCPUs to call
    HV_X64_MSR_REFERENCE_TSC at the same time and cause the in-use reference
    TSC page to be freed, while still being on the p2m.  This creates a use-
    after-free bug, where the page can end up mapped in another domain or used
    by Xen while still being part of the original domain's p2m.
    
    It's also possible to underflow the reference counter, as multiple
    concurrent writes to HV_X64_MSR_REFERENCE_TSC can create an imbalance on
    the number of put_page_and_type() calls.
    
    Introduce a lock to protect the reference TSC domain field, thus
    serializing concurrent vCPU accesses.
    
    This is CVE-2025-58143 / part of XSA-472.
    
    Fixes: 386b3365221d ('viridian: use viridian_map/unmap_guest_page() for reference tsc page')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/viridian/time.c        | 4 ++++
 xen/arch/x86/hvm/viridian/viridian.c    | 2 ++
 xen/arch/x86/include/asm/hvm/viridian.h | 1 +
 3 files changed, 7 insertions(+)

diff --git a/xen/arch/x86/hvm/viridian/time.c b/xen/arch/x86/hvm/viridian/time.c
index ca6d526f46..9311858d63 100644
--- a/xen/arch/x86/hvm/viridian/time.c
+++ b/xen/arch/x86/hvm/viridian/time.c
@@ -108,8 +108,10 @@ static void time_ref_count_thaw(const struct domain *d)
 
     trc->off = (int64_t)trc->val - trc_val(d, 0);
 
+    spin_lock(&vd->lock);
     if ( vd->reference_tsc.msr.enabled )
         update_reference_tsc(d, false);
+    spin_unlock(&vd->lock);
 }
 
 static uint64_t time_ref_count(const struct domain *d)
@@ -331,6 +333,7 @@ int viridian_time_wrmsr(struct vcpu *v, uint32_t idx, uint64_t val)
         if ( !(viridian_feature_mask(d) & HVMPV_reference_tsc) )
             return X86EMUL_EXCEPTION;
 
+        spin_lock(&vd->lock);
         viridian_unmap_guest_page(&vd->reference_tsc);
         vd->reference_tsc.msr.raw = val;
         viridian_dump_guest_page(v, "REFERENCE_TSC", &vd->reference_tsc);
@@ -339,6 +342,7 @@ int viridian_time_wrmsr(struct vcpu *v, uint32_t idx, uint64_t val)
             viridian_map_guest_page(d, &vd->reference_tsc);
             update_reference_tsc(d, true);
         }
+        spin_unlock(&vd->lock);
         break;
 
     case HV_X64_MSR_TIME_REF_COUNT:
diff --git a/xen/arch/x86/hvm/viridian/viridian.c b/xen/arch/x86/hvm/viridian/viridian.c
index 7ea6c90168..c0be24bd22 100644
--- a/xen/arch/x86/hvm/viridian/viridian.c
+++ b/xen/arch/x86/hvm/viridian/viridian.c
@@ -494,6 +494,8 @@ int viridian_domain_init(struct domain *d)
     if ( !d->arch.hvm.viridian )
         return -ENOMEM;
 
+    spin_lock_init(&d->arch.hvm.viridian->lock);
+
     rc = viridian_synic_domain_init(d);
     if ( rc )
         goto fail;
diff --git a/xen/arch/x86/include/asm/hvm/viridian.h b/xen/arch/x86/include/asm/hvm/viridian.h
index 4c8ff6e80b..47c9d13841 100644
--- a/xen/arch/x86/include/asm/hvm/viridian.h
+++ b/xen/arch/x86/include/asm/hvm/viridian.h
@@ -71,6 +71,7 @@ struct viridian_domain
     DECLARE_BITMAP(hypercall_flags, _HCALL_nr);
     struct viridian_time_ref_count time_ref_count;
     struct viridian_page reference_tsc;
+    spinlock_t lock;
 };
 
 void cpuid_viridian_leaves(const struct vcpu *v, uint32_t leaf,
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Sep 09 15:22:33 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Sep 2025 15:22:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1117172.1463371 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uw0Az-0001NC-5I; Tue, 09 Sep 2025 15:22:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1117172.1463371; Tue, 09 Sep 2025 15: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 1uw0Az-0001N3-2W; Tue, 09 Sep 2025 15:22:33 +0000
Received: by outflank-mailman (input) for mailman id 1117172;
 Tue, 09 Sep 2025 15: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 1uw0Ay-0001Mv-4t
 for xen-changelog@lists.xenproject.org; Tue, 09 Sep 2025 15: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 1uw0Ay-001j82-0O
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 15:22:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uw0Ay-001fuF-0J
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 15: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=v875di7GTY5wOFQlyjUccmOODrSTHFsU1ygn/oOKXfM=; b=n/k6VCbHHs2dbcCwtK1dG8O0St
	ACaey6GGOCvV90S9zTPFDoxoFQlXboOAwRZjHYb/TjD5ZtYYMrLvuEyZYopTu7Ad2G04jsfkBE+go
	IoEKl4Qmq5odnNVw6TCPZN8MQfWag10ZjzdyEioQdLF1rU07nzpjMwDxY+BcVmPnlUlY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] Arm: foreign page handling in p2m_get_page_from_gfn()
Message-Id: <E1uw0Ay-001fuF-0J@xenbits.xenproject.org>
Date: Tue, 09 Sep 2025 15:22:32 +0000

commit c5a6dd68508c998c95ca87f59e9ecb6da93ca6ab
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Sep 9 14:12:13 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 9 14:12:13 2025 +0200

    Arm: foreign page handling in p2m_get_page_from_gfn()
    
    I can't see what would make the 1st of the assertions safe: For example,
    the P2M lock not being held, the foreign page may disappear before we
    get to call page_get_owner_and_reference(), which hence may return NULL.
    
    Even the 2nd, which appears to be safe safe, is lacking proper release
    build fallbacks.
    
    Drop the former in favor of an if(), and convert the latter to the
    equivalent of what x86 uses: ASSERT_UNREACHABLE() plus putting of the
    obtained page.
    
    This is CVE-2025-58144 / part of XSA-473.
    
    Fixes: 9486a8d07ba8 ("xen/arm: Handle remove foreign mapping")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/p2m.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
index ef8bd4b6ab..667ea595f4 100644
--- a/xen/arch/arm/p2m.c
+++ b/xen/arch/arm/p2m.c
@@ -74,10 +74,16 @@ struct page_info *p2m_get_page_from_gfn(struct domain *d, gfn_t gfn,
      */
     if ( p2m_is_foreign(p2mt) )
     {
-        struct domain *fdom = page_get_owner_and_reference(page);
-        ASSERT(fdom != NULL);
-        ASSERT(fdom != d);
-        return page;
+        const struct domain *fdom = page_get_owner_and_reference(page);
+
+        if ( fdom )
+        {
+            if ( fdom != d )
+                return page;
+            ASSERT_UNREACHABLE();
+            put_page(page);
+        }
+        return NULL;
     }
 
     return get_page(page, d) ? page : NULL;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Sep 09 15:22:43 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Sep 2025 15:22:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1117173.1463374 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uw0B9-0001PU-6M; Tue, 09 Sep 2025 15:22:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1117173.1463374; Tue, 09 Sep 2025 15: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 1uw0B9-0001PN-3q; Tue, 09 Sep 2025 15:22:43 +0000
Received: by outflank-mailman (input) for mailman id 1117173;
 Tue, 09 Sep 2025 15: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 1uw0B8-0001PB-8K
 for xen-changelog@lists.xenproject.org; Tue, 09 Sep 2025 15: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 1uw0B8-001jA8-0h
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 15:22:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uw0B8-001fux-0Z
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 15: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=wD4A7vR29ft4pNyg46vQ4q2jbMJpfSCLLXXBfUYYCig=; b=PDfSM/+sW6blNbP5igZVXx8MzA
	IqguujX1zlfl+Di8xTX+6L7QGcC1ERsYkttzNw40OszZUgDbIK8G35XoMyf2rz8J2WOAzmH32WAcv
	lVHtRcOFXICC4gIfdn8AHVXYkwDG1TSgYkG6Cg/KNwPr1PS+CWTz8+Si1od0LqGsfYR0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] Arm: adjust locking in p2m_get_page_from_gfn()
Message-Id: <E1uw0B8-001fux-0Z@xenbits.xenproject.org>
Date: Tue, 09 Sep 2025 15:22:42 +0000

commit 2275bf83a1db579661b27fc4b310a7d92594dbc0
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Sep 9 14:12:57 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 9 14:12:57 2025 +0200

    Arm: adjust locking in p2m_get_page_from_gfn()
    
    In order to safely acquire a reference for a foreign page mapping, the
    P2M lock needs to be held until we have the reference in hand (or
    getting one failed). Otherwise the page can change P2M type and
    ownership in between.
    
    This is CVE-2025-58145 / part of XSA-473.
    
    Fixes: 9486a8d07ba8 ("xen/arm: Handle remove foreign mapping")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/p2m.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
index 667ea595f4..fb03978a19 100644
--- a/xen/arch/arm/p2m.c
+++ b/xen/arch/arm/p2m.c
@@ -53,18 +53,22 @@ mfn_t p2m_lookup(struct domain *d, gfn_t gfn, p2m_type_t *t)
 struct page_info *p2m_get_page_from_gfn(struct domain *d, gfn_t gfn,
                                         p2m_type_t *t)
 {
+    struct p2m_domain *p2m = p2m_get_hostp2m(d);
     struct page_info *page;
     p2m_type_t p2mt;
-    mfn_t mfn = p2m_lookup(d, gfn, &p2mt);
+    mfn_t mfn;
+
+    p2m_read_lock(p2m);
+    mfn = p2m_get_entry(p2m, gfn, &p2mt, NULL, NULL, NULL);
 
     if ( t )
         *t = p2mt;
 
-    if ( !p2m_is_any_ram(p2mt) )
-        return NULL;
-
-    if ( !mfn_valid(mfn) )
+    if ( !p2m_is_any_ram(p2mt) || !mfn_valid(mfn) )
+    {
+        p2m_read_unlock(p2m);
         return NULL;
+    }
 
     page = mfn_to_page(mfn);
 
@@ -76,6 +80,8 @@ struct page_info *p2m_get_page_from_gfn(struct domain *d, gfn_t gfn,
     {
         const struct domain *fdom = page_get_owner_and_reference(page);
 
+        p2m_read_unlock(p2m);
+
         if ( fdom )
         {
             if ( fdom != d )
@@ -86,6 +92,8 @@ struct page_info *p2m_get_page_from_gfn(struct domain *d, gfn_t gfn,
         return NULL;
     }
 
+    p2m_read_unlock(p2m);
+
     return get_page(page, d) ? page : NULL;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Sep 09 15:22:54 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Sep 2025 15:22:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1117174.1463378 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uw0BK-0001Rl-7t; Tue, 09 Sep 2025 15:22:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1117174.1463378; Tue, 09 Sep 2025 15: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 1uw0BK-0001Rd-5M; Tue, 09 Sep 2025 15:22:54 +0000
Received: by outflank-mailman (input) for mailman id 1117174;
 Tue, 09 Sep 2025 15: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 1uw0BI-0001RL-N3
 for xen-changelog@lists.xenproject.org; Tue, 09 Sep 2025 15: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 1uw0BI-001jAS-2C
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 15:22:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uw0BI-001fwF-24
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 15: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=2X/rS1FJqRcUrJcn9re8TodSq9HFbbRwYSm70U91gs8=; b=LaKIE8HufqxhqoJZ+up9CVMvDe
	18Gx8+SZcKJl7fXdg3xwigHWhSfIBR65LwT+RsS6273cenAU55cgB5+U66MORw9LmT+KyCYkhMncM
	KqTXEuw29CaAFnfc8g6jz1hwVnlDRQjdHhHeHDnfPRyWlqMfjLVbcSD1R58BJ83Qtjok=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] x86/viridian: avoid NULL pointer dereference in update_reference_tsc()
Message-Id: <E1uw0BI-001fwF-24@xenbits.xenproject.org>
Date: Tue, 09 Sep 2025 15:22:52 +0000

commit aba830fc0d20c25594bcfaa2febc8dc077f68172
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Tue Sep 9 14:25:01 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 9 14:25:01 2025 +0200

    x86/viridian: avoid NULL pointer dereference in update_reference_tsc()
    
    The function is only called when the MSR has the enabled bit set, but even
    then the page might not be mapped because the guest provided gfn is not
    suitable.
    
    Prevent a NULL pointer dereference in update_reference_tsc() by checking
    whether the page is mapped.
    
    This is CVE-2025-27466 / part of XSA-472.
    
    Fixes: 386b3365221d ('viridian: use viridian_map/unmap_guest_page() for reference tsc page')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 5776a2e9db0155cfd76388c8197ca7788bb4b361
    master date: 2025-09-09 14:11:09 +0200
---
 xen/arch/x86/hvm/viridian/time.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/xen/arch/x86/hvm/viridian/time.c b/xen/arch/x86/hvm/viridian/time.c
index 137577384f..ca6d526f46 100644
--- a/xen/arch/x86/hvm/viridian/time.c
+++ b/xen/arch/x86/hvm/viridian/time.c
@@ -26,6 +26,10 @@ static void update_reference_tsc(const struct domain *d, bool initialize)
     HV_REFERENCE_TSC_PAGE *p = rt->ptr;
     uint32_t seq;
 
+    /* Reference TSC page might not be mapped even if the MSR is enabled. */
+    if ( !p )
+        return;
+
     if ( initialize )
         clear_page(p);
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Tue Sep 09 15:23:04 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Sep 2025 15:23:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1117175.1463383 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uw0BU-0001Tq-9Q; Tue, 09 Sep 2025 15:23:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1117175.1463383; Tue, 09 Sep 2025 15: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 1uw0BU-0001Ti-6l; Tue, 09 Sep 2025 15:23:04 +0000
Received: by outflank-mailman (input) for mailman id 1117175;
 Tue, 09 Sep 2025 15: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 1uw0BS-0001TU-Pm
 for xen-changelog@lists.xenproject.org; Tue, 09 Sep 2025 15: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 1uw0BS-001jAk-2U
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 15:23:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uw0BS-001fya-2M
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 15: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=yVC85o7XxQIQgKa4SakAg3qq+n7iLvtUusaBy+CXc9I=; b=jqFKHqPCUsHFekdDl3q0dPosEG
	EIiXGpLuKQR/mKs7qb1kQHXO5LaRqqbu4GVL4CVcFEcAjYRjc0YHeDcviYWyEgYlLYfTJ1mufVZcP
	mXeCvTRXmJVpX65sqiGM7FE3hX/eyMXwrB4qy8eZSdquQOb0HR19dE5q6u9X1HkOvyeo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] x86/viridian: avoid NULL pointer dereference in viridian_synic_deliver_timer_msg()
Message-Id: <E1uw0BS-001fya-2M@xenbits.xenproject.org>
Date: Tue, 09 Sep 2025 15:23:02 +0000

commit de89b16d24104578a9a8e79898e81ac4b3aa3601
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Tue Sep 9 14:25:23 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 9 14:25:23 2025 +0200

    x86/viridian: avoid NULL pointer dereference in viridian_synic_deliver_timer_msg()
    
    The function is called unconditionally, regardless of whether the SIM page
    is mapped.  Avoid a NULL pointer dereference in
    viridian_synic_deliver_timer_msg() by checking whether the SIM page is
    mapped.
    
    This is CVE-2025-58142 / part of XSA-472.
    
    Fixes: 26fba3c85571 ('viridian: add implementation of synthetic timers')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 3a7b4f2897a352cff287be97d27150b290a5d1ee
    master date: 2025-09-09 14:11:34 +0200
---
 xen/arch/x86/hvm/viridian/synic.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/xen/arch/x86/hvm/viridian/synic.c b/xen/arch/x86/hvm/viridian/synic.c
index 09474fe2eb..ca57ba8bf1 100644
--- a/xen/arch/x86/hvm/viridian/synic.c
+++ b/xen/arch/x86/hvm/viridian/synic.c
@@ -338,6 +338,10 @@ bool viridian_synic_deliver_timer_msg(struct vcpu *v, unsigned int sintx,
         .DeliveryTime = delivery,
     };
 
+    /* Don't assume SIM page to be mapped. */
+    if ( !msg )
+        return false;
+
     /*
      * To avoid using an atomic test-and-set, and barrier before calling
      * vlapic_set_irq(), this function must be called in context of the
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Tue Sep 09 15:23:14 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Sep 2025 15:23:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1117176.1463386 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uw0Be-0001Wb-C7; Tue, 09 Sep 2025 15:23:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1117176.1463386; Tue, 09 Sep 2025 15: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 1uw0Be-0001WT-9U; Tue, 09 Sep 2025 15:23:14 +0000
Received: by outflank-mailman (input) for mailman id 1117176;
 Tue, 09 Sep 2025 15: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 1uw0Bc-0001WG-SP
 for xen-changelog@lists.xenproject.org; Tue, 09 Sep 2025 15: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 1uw0Bc-001jAq-2l
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 15:23:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uw0Bc-001fz2-2e
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 15: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=bwWE3QK61vFDoqDwwyzXsJCoybb+Frwc9iYsvR0ZjMo=; b=5uUIhG3+ei8ymQ+z0lHERyHTWw
	ny5ir9Duv2uOV4BpVL1Y7l4I5m9A5DiKI/rVGdcftiI7vai5+OhjkGPW8lzQtping/TpnHw/XHv2t
	jh2zVeVuIUtyQiNaAi6ykmOSyiIBvj9CA1CQlzd8aSQ3vPocTQArdzZxWQVL/+unzcG8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] x86/viridian: protect concurrent modification of the reference TSC page
Message-Id: <E1uw0Bc-001fz2-2e@xenbits.xenproject.org>
Date: Tue, 09 Sep 2025 15:23:12 +0000

commit 2102093e081f0d57e0b92881970d07c6542c969a
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Tue Sep 9 14:25:36 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 9 14:25:36 2025 +0200

    x86/viridian: protect concurrent modification of the reference TSC page
    
    The reference TSC page is shared between all vCPUs, and the data stored in
    the domain struct.  However the handlers to set and clear it are not safe
    against concurrent accesses.  It's possible for two (or more) vCPUs to call
    HV_X64_MSR_REFERENCE_TSC at the same time and cause the in-use reference
    TSC page to be freed, while still being on the p2m.  This creates a use-
    after-free bug, where the page can end up mapped in another domain or used
    by Xen while still being part of the original domain's p2m.
    
    It's also possible to underflow the reference counter, as multiple
    concurrent writes to HV_X64_MSR_REFERENCE_TSC can create an imbalance on
    the number of put_page_and_type() calls.
    
    Introduce a lock to protect the reference TSC domain field, thus
    serializing concurrent vCPU accesses.
    
    This is CVE-2025-58143 / part of XSA-472.
    
    Fixes: 386b3365221d ('viridian: use viridian_map/unmap_guest_page() for reference tsc page')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 45729a510a352e1a973e4023bd0067cddb1bcaf8
    master date: 2025-09-09 14:12:00 +0200
---
 xen/arch/x86/hvm/viridian/time.c        | 4 ++++
 xen/arch/x86/hvm/viridian/viridian.c    | 2 ++
 xen/arch/x86/include/asm/hvm/viridian.h | 1 +
 3 files changed, 7 insertions(+)

diff --git a/xen/arch/x86/hvm/viridian/time.c b/xen/arch/x86/hvm/viridian/time.c
index ca6d526f46..9311858d63 100644
--- a/xen/arch/x86/hvm/viridian/time.c
+++ b/xen/arch/x86/hvm/viridian/time.c
@@ -108,8 +108,10 @@ static void time_ref_count_thaw(const struct domain *d)
 
     trc->off = (int64_t)trc->val - trc_val(d, 0);
 
+    spin_lock(&vd->lock);
     if ( vd->reference_tsc.msr.enabled )
         update_reference_tsc(d, false);
+    spin_unlock(&vd->lock);
 }
 
 static uint64_t time_ref_count(const struct domain *d)
@@ -331,6 +333,7 @@ int viridian_time_wrmsr(struct vcpu *v, uint32_t idx, uint64_t val)
         if ( !(viridian_feature_mask(d) & HVMPV_reference_tsc) )
             return X86EMUL_EXCEPTION;
 
+        spin_lock(&vd->lock);
         viridian_unmap_guest_page(&vd->reference_tsc);
         vd->reference_tsc.msr.raw = val;
         viridian_dump_guest_page(v, "REFERENCE_TSC", &vd->reference_tsc);
@@ -339,6 +342,7 @@ int viridian_time_wrmsr(struct vcpu *v, uint32_t idx, uint64_t val)
             viridian_map_guest_page(d, &vd->reference_tsc);
             update_reference_tsc(d, true);
         }
+        spin_unlock(&vd->lock);
         break;
 
     case HV_X64_MSR_TIME_REF_COUNT:
diff --git a/xen/arch/x86/hvm/viridian/viridian.c b/xen/arch/x86/hvm/viridian/viridian.c
index 25ed454852..a15fe0e9f8 100644
--- a/xen/arch/x86/hvm/viridian/viridian.c
+++ b/xen/arch/x86/hvm/viridian/viridian.c
@@ -494,6 +494,8 @@ int viridian_domain_init(struct domain *d)
     if ( !d->arch.hvm.viridian )
         return -ENOMEM;
 
+    spin_lock_init(&d->arch.hvm.viridian->lock);
+
     rc = viridian_synic_domain_init(d);
     if ( rc )
         goto fail;
diff --git a/xen/arch/x86/include/asm/hvm/viridian.h b/xen/arch/x86/include/asm/hvm/viridian.h
index 4c8ff6e80b..47c9d13841 100644
--- a/xen/arch/x86/include/asm/hvm/viridian.h
+++ b/xen/arch/x86/include/asm/hvm/viridian.h
@@ -71,6 +71,7 @@ struct viridian_domain
     DECLARE_BITMAP(hypercall_flags, _HCALL_nr);
     struct viridian_time_ref_count time_ref_count;
     struct viridian_page reference_tsc;
+    spinlock_t lock;
 };
 
 void cpuid_viridian_leaves(const struct vcpu *v, uint32_t leaf,
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Tue Sep 09 15:23:24 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Sep 2025 15:23:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1117177.1463391 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uw0Bo-0001Z3-Dk; Tue, 09 Sep 2025 15:23:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1117177.1463391; Tue, 09 Sep 2025 15: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 1uw0Bo-0001Yv-Av; Tue, 09 Sep 2025 15:23:24 +0000
Received: by outflank-mailman (input) for mailman id 1117177;
 Tue, 09 Sep 2025 15: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 1uw0Bm-0001Yi-VH
 for xen-changelog@lists.xenproject.org; Tue, 09 Sep 2025 15: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 1uw0Bm-001jAu-33
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 15:23:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uw0Bm-001fzX-2w
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 15: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=ZfGOljfHulCIvVzHUvRYwlaKU8MEwXUhj0sG0R+ylxk=; b=MXznkwe1JRkMx5QMsfBsaEXCw+
	5rhzo7DdO2DQNLhZ+tzkTcTwlc2OTGh+pJ8ddSmoDDJL40pXMFFsuHRLEHP/i+f1PAz4C8tHl5Tgo
	BZ4CJ2QFvG/1Uxgzt3uQ+ksC81L3F2JiZxRszrsDT/7CLJMrDPiCF3kCIzl//9A+kn14=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] Arm: foreign page handling in p2m_get_page_from_gfn()
Message-Id: <E1uw0Bm-001fzX-2w@xenbits.xenproject.org>
Date: Tue, 09 Sep 2025 15:23:22 +0000

commit 46c0b23f17e3fecacd0a9f156c2d1ca440a6b471
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Sep 9 14:25:48 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 9 14:25:48 2025 +0200

    Arm: foreign page handling in p2m_get_page_from_gfn()
    
    I can't see what would make the 1st of the assertions safe: For example,
    the P2M lock not being held, the foreign page may disappear before we
    get to call page_get_owner_and_reference(), which hence may return NULL.
    
    Even the 2nd, which appears to be safe safe, is lacking proper release
    build fallbacks.
    
    Drop the former in favor of an if(), and convert the latter to the
    equivalent of what x86 uses: ASSERT_UNREACHABLE() plus putting of the
    obtained page.
    
    This is CVE-2025-58144 / part of XSA-473.
    
    Fixes: 9486a8d07ba8 ("xen/arm: Handle remove foreign mapping")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
    master commit: c5a6dd68508c998c95ca87f59e9ecb6da93ca6ab
    master date: 2025-09-09 14:12:13 +0200
---
 xen/arch/arm/p2m.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
index de32a2d638..4038377834 100644
--- a/xen/arch/arm/p2m.c
+++ b/xen/arch/arm/p2m.c
@@ -612,10 +612,16 @@ struct page_info *p2m_get_page_from_gfn(struct domain *d, gfn_t gfn,
      */
     if ( p2m_is_foreign(p2mt) )
     {
-        struct domain *fdom = page_get_owner_and_reference(page);
-        ASSERT(fdom != NULL);
-        ASSERT(fdom != d);
-        return page;
+        const struct domain *fdom = page_get_owner_and_reference(page);
+
+        if ( fdom )
+        {
+            if ( fdom != d )
+                return page;
+            ASSERT_UNREACHABLE();
+            put_page(page);
+        }
+        return NULL;
     }
 
     return get_page(page, d) ? page : NULL;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Tue Sep 09 15:23:34 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Sep 2025 15:23:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1117178.1463395 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uw0By-0001b7-Er; Tue, 09 Sep 2025 15:23:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1117178.1463395; Tue, 09 Sep 2025 15: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 1uw0By-0001az-CP; Tue, 09 Sep 2025 15:23:34 +0000
Received: by outflank-mailman (input) for mailman id 1117178;
 Tue, 09 Sep 2025 15: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 1uw0Bx-0001at-2P
 for xen-changelog@lists.xenproject.org; Tue, 09 Sep 2025 15: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 1uw0Bx-001jB0-09
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 15:23:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uw0Bx-001fzy-00
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 15: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=wqxxhkI56OojNzPggreSsW/JiNDwU+lpSgfOA5y1ny8=; b=r35rb74MQLzVW4jiE2+af8nwM6
	uOwKe7zouBPc3mwjJDY3CJ+UYiIOO4C37tinA8e53mba3tSqApEWbFZoG9VPOr7G605jwn+Jjylcq
	7UIaFOq3YHmOdZebOSzfXKqnIYtLHW+1Twp19JRg5ZATulT3wJvUp4qFuFv47oZ7WoxE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] Arm: adjust locking in p2m_get_page_from_gfn()
Message-Id: <E1uw0Bx-001fzy-00@xenbits.xenproject.org>
Date: Tue, 09 Sep 2025 15:23:33 +0000

commit c90cec6dfd8ed04577376efd2b929930451e78e9
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Sep 9 14:25:58 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 9 14:25:58 2025 +0200

    Arm: adjust locking in p2m_get_page_from_gfn()
    
    In order to safely acquire a reference for a foreign page mapping, the
    P2M lock needs to be held until we have the reference in hand (or
    getting one failed). Otherwise the page can change P2M type and
    ownership in between.
    
    This is CVE-2025-58145 / part of XSA-473.
    
    Fixes: 9486a8d07ba8 ("xen/arm: Handle remove foreign mapping")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
    master commit: 2275bf83a1db579661b27fc4b310a7d92594dbc0
    master date: 2025-09-09 14:12:57 +0200
---
 xen/arch/arm/p2m.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
index 4038377834..3f3b2ad0ae 100644
--- a/xen/arch/arm/p2m.c
+++ b/xen/arch/arm/p2m.c
@@ -591,18 +591,22 @@ mfn_t p2m_lookup(struct domain *d, gfn_t gfn, p2m_type_t *t)
 struct page_info *p2m_get_page_from_gfn(struct domain *d, gfn_t gfn,
                                         p2m_type_t *t)
 {
+    struct p2m_domain *p2m = p2m_get_hostp2m(d);
     struct page_info *page;
     p2m_type_t p2mt;
-    mfn_t mfn = p2m_lookup(d, gfn, &p2mt);
+    mfn_t mfn;
+
+    p2m_read_lock(p2m);
+    mfn = p2m_get_entry(p2m, gfn, &p2mt, NULL, NULL, NULL);
 
     if ( t )
         *t = p2mt;
 
-    if ( !p2m_is_any_ram(p2mt) )
-        return NULL;
-
-    if ( !mfn_valid(mfn) )
+    if ( !p2m_is_any_ram(p2mt) || !mfn_valid(mfn) )
+    {
+        p2m_read_unlock(p2m);
         return NULL;
+    }
 
     page = mfn_to_page(mfn);
 
@@ -614,6 +618,8 @@ struct page_info *p2m_get_page_from_gfn(struct domain *d, gfn_t gfn,
     {
         const struct domain *fdom = page_get_owner_and_reference(page);
 
+        p2m_read_unlock(p2m);
+
         if ( fdom )
         {
             if ( fdom != d )
@@ -624,6 +630,8 @@ struct page_info *p2m_get_page_from_gfn(struct domain *d, gfn_t gfn,
         return NULL;
     }
 
+    p2m_read_unlock(p2m);
+
     return get_page(page, d) ? page : NULL;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Tue Sep 09 23:44:08 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Sep 2025 23:44:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1117448.1463538 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uw80J-0001bd-PL; Tue, 09 Sep 2025 23:44:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1117448.1463538; Tue, 09 Sep 2025 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 1uw80J-0001bV-Mg; Tue, 09 Sep 2025 23:44:03 +0000
Received: by outflank-mailman (input) for mailman id 1117448;
 Tue, 09 Sep 2025 23: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 1uw80H-0001bP-Ue
 for xen-changelog@lists.xenproject.org; Tue, 09 Sep 2025 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 1uw80H-001t5h-2Z
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 23:44:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uw80H-002CLH-2G
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 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=rn4E4SVe2rYXmmnHGWZJQ3AEE2HlZClv9Y7f5vEbPFY=; b=vC2tkCz75xcpJq6vaNy0+yTNt+
	N7N40aXEs8O5mcmnNVDXr8XthN7+YyBzwFq+/nOZLH/OC/MXLScN82LbNJW5esITLI+1/ZV8kjSd2
	UTk3X0kZU3n8NuYbjNNJC1jGmOVtTXvMG4dP7+kDCdw7P3egXQbNGl3HTep78tIm9+kE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: gicv3: refactor obtaining GIC addresses for common operations
Message-Id: <E1uw80H-002CLH-2G@xenbits.xenproject.org>
Date: Tue, 09 Sep 2025 23:44:01 +0000

commit 93e9cd4c76b31077de1125b2f2c07b694181dacb
Author:     Leonid Komarianskyi <Leonid_Komarianskyi@epam.com>
AuthorDate: Tue Sep 9 10:08:55 2025 +0000
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Tue Sep 9 16:31:49 2025 -0700

    xen/arm: gicv3: refactor obtaining GIC addresses for common operations
    
    Currently, many common functions perform the same operations to calculate
    GIC register addresses. This patch consolidates the similar code into
    a separate helper function to improve maintainability and reduce duplication.
    This refactoring also simplifies the implementation of eSPI support in future
    changes.
    
    Signed-off-by: Leonid Komarianskyi <leonid_komarianskyi@epam.com>
    Reviewed-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
    Reviewed-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/gic-v3.c          | 126 +++++++++++++++++++++++++++++------------
 xen/arch/arm/include/asm/irq.h |   1 +
 2 files changed, 91 insertions(+), 36 deletions(-)

diff --git a/xen/arch/arm/gic-v3.c b/xen/arch/arm/gic-v3.c
index cd3e1acf79..2fdd96dbb1 100644
--- a/xen/arch/arm/gic-v3.c
+++ b/xen/arch/arm/gic-v3.c
@@ -445,17 +445,72 @@ static void gicv3_dump_state(const struct vcpu *v)
     }
 }
 
+static void __iomem *get_addr_by_offset(struct irq_desc *irqd, uint32_t offset)
+{
+    switch ( irqd->irq )
+    {
+    case 0 ... (NR_GIC_LOCAL_IRQS - 1):
+        switch ( offset )
+        {
+        case GICD_ISENABLER:
+        case GICD_ICENABLER:
+        case GICD_ISPENDR:
+        case GICD_ICPENDR:
+        case GICD_ISACTIVER:
+        case GICD_ICACTIVER:
+            return (GICD_RDIST_SGI_BASE + offset);
+        case GICD_ICFGR:
+            return (GICD_RDIST_SGI_BASE + GICR_ICFGR1);
+        case GICD_IPRIORITYR:
+            return (GICD_RDIST_SGI_BASE + GICR_IPRIORITYR0 + irqd->irq);
+        default:
+            /* Invalid register offset for local IRQs */
+            break;
+        }
+        break;
+    case NR_GIC_LOCAL_IRQS ... SPI_MAX_INTID:
+        switch ( offset )
+        {
+        case GICD_ISENABLER:
+        case GICD_ICENABLER:
+        case GICD_ISPENDR:
+        case GICD_ICPENDR:
+        case GICD_ISACTIVER:
+        case GICD_ICACTIVER:
+            return (GICD + offset + (irqd->irq / 32) * 4);
+        case GICD_ICFGR:
+            return (GICD + GICD_ICFGR + (irqd->irq / 16) * 4);
+        case GICD_IROUTER:
+            return (GICD + GICD_IROUTER + irqd->irq * 8);
+        case GICD_IPRIORITYR:
+            return (GICD + GICD_IPRIORITYR + irqd->irq);
+        default:
+            /* Invalid register offset for SPIs */
+            break;
+        }
+        break;
+    default:
+        /* Invalid INTID */
+        break;
+    }
+
+    /* Something went wrong, we shouldn't be able to reach here */
+    printk(XENLOG_WARNING "GICv3: WARNING: Invalid offset 0x%x for IRQ#%u",
+           offset, irqd->irq);
+    ASSERT_UNREACHABLE();
+
+    return NULL;
+}
+
 static void gicv3_poke_irq(struct irq_desc *irqd, u32 offset, bool wait_for_rwp)
 {
     u32 mask = 1U << (irqd->irq % 32);
-    void __iomem *base;
+    void __iomem *addr = get_addr_by_offset(irqd, offset);
 
-    if ( irqd->irq < NR_GIC_LOCAL_IRQS )
-        base = GICD_RDIST_SGI_BASE;
-    else
-        base = GICD;
+    if ( addr == NULL )
+        return;
 
-    writel_relaxed(mask, base + offset + (irqd->irq / 32) * 4);
+    writel_relaxed(mask, addr);
 
     if ( wait_for_rwp )
         gicv3_wait_for_rwp(irqd->irq);
@@ -463,15 +518,13 @@ static void gicv3_poke_irq(struct irq_desc *irqd, u32 offset, bool wait_for_rwp)
 
 static bool gicv3_peek_irq(struct irq_desc *irqd, u32 offset)
 {
-    void __iomem *base;
-    unsigned int irq = irqd->irq;
+    uint32_t mask = 1U << (irqd->irq % 32);
+    void __iomem *addr = get_addr_by_offset(irqd, offset);
 
-    if ( irq >= NR_GIC_LOCAL_IRQS)
-        base = GICD + (irq / 32) * 4;
-    else
-        base = GICD_RDIST_SGI_BASE;
+    if ( addr == NULL )
+        return false;
 
-    return !!(readl(base + offset) & (1U << (irq % 32)));
+    return !!(readl(addr) & mask);
 }
 
 static void gicv3_unmask_irq(struct irq_desc *irqd)
@@ -558,30 +611,28 @@ static inline uint64_t gicv3_mpidr_to_affinity(int cpu)
 static void gicv3_set_irq_type(struct irq_desc *desc, unsigned int type)
 {
     uint32_t cfg, actual, edgebit;
-    void __iomem *base;
-    unsigned int irq = desc->irq;
+    void __iomem *addr;
 
     /* SGI's are always edge-triggered not need to call GICD_ICFGR0 */
-    ASSERT(irq >= NR_GIC_SGI);
+    ASSERT(desc->irq >= NR_GIC_SGI);
 
-    spin_lock(&gicv3.lock);
+    addr = get_addr_by_offset(desc, GICD_ICFGR);
+    if ( addr == NULL )
+        return;
 
-    if ( irq >= NR_GIC_LOCAL_IRQS)
-        base = GICD + GICD_ICFGR + (irq / 16) * 4;
-    else
-        base = GICD_RDIST_SGI_BASE + GICR_ICFGR1;
+    spin_lock(&gicv3.lock);
 
-    cfg = readl_relaxed(base);
+    cfg = readl_relaxed(addr);
 
-    edgebit = 2u << (2 * (irq % 16));
+    edgebit = 2u << (2 * (desc->irq % 16));
     if ( type & IRQ_TYPE_LEVEL_MASK )
         cfg &= ~edgebit;
     else if ( type & IRQ_TYPE_EDGE_BOTH )
         cfg |= edgebit;
 
-    writel_relaxed(cfg, base);
+    writel_relaxed(cfg, addr);
 
-    actual = readl_relaxed(base);
+    actual = readl_relaxed(addr);
     if ( ( cfg & edgebit ) ^ ( actual & edgebit ) )
     {
         printk(XENLOG_WARNING "GICv3: WARNING: "
@@ -600,16 +651,13 @@ static void gicv3_set_irq_type(struct irq_desc *desc, unsigned int type)
 static void gicv3_set_irq_priority(struct irq_desc *desc,
                                    unsigned int priority)
 {
-    unsigned int irq = desc->irq;
-
-    spin_lock(&gicv3.lock);
+    void __iomem *addr = get_addr_by_offset(desc, GICD_IPRIORITYR);
 
-    /* Set priority */
-    if ( irq < NR_GIC_LOCAL_IRQS )
-        writeb_relaxed(priority, GICD_RDIST_SGI_BASE + GICR_IPRIORITYR0 + irq);
-    else
-        writeb_relaxed(priority, GICD + GICD_IPRIORITYR + irq);
+    if ( addr == NULL )
+        return;
 
+    spin_lock(&gicv3.lock);
+    writeb_relaxed(priority, addr);
     spin_unlock(&gicv3.lock);
 }
 
@@ -1273,6 +1321,14 @@ static void gicv3_irq_set_affinity(struct irq_desc *desc, const cpumask_t *mask)
 {
     unsigned int cpu;
     uint64_t affinity;
+    void __iomem *addr;
+
+    if ( desc->irq < NR_GIC_LOCAL_IRQS )
+        return;
+
+    addr = get_addr_by_offset(desc, GICD_IROUTER);
+    if ( addr == NULL )
+        return;
 
     ASSERT(!cpumask_empty(mask));
 
@@ -1282,9 +1338,7 @@ static void gicv3_irq_set_affinity(struct irq_desc *desc, const cpumask_t *mask)
     affinity = gicv3_mpidr_to_affinity(cpu);
     /* Make sure we don't broadcast the interrupt */
     affinity &= ~GICD_IROUTER_SPI_MODE_ANY;
-
-    if ( desc->irq >= NR_GIC_LOCAL_IRQS )
-        writeq_relaxed_non_atomic(affinity, (GICD + GICD_IROUTER + desc->irq * 8));
+    writeq_relaxed_non_atomic(affinity, addr);
 
     spin_unlock(&gicv3.lock);
 }
diff --git a/xen/arch/arm/include/asm/irq.h b/xen/arch/arm/include/asm/irq.h
index fce7e42a33..5bc6475eb4 100644
--- a/xen/arch/arm/include/asm/irq.h
+++ b/xen/arch/arm/include/asm/irq.h
@@ -29,6 +29,7 @@ struct arch_irq_desc {
  */
 #define NR_IRQS		1024
 
+#define SPI_MAX_INTID   1019
 #define LPI_OFFSET      8192
 
 /* LPIs are always numbered starting at 8192, so 0 is a good invalid case. */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Sep 09 23:44:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Sep 2025 23:44:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1117449.1463544 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uw80T-0001dN-R5; Tue, 09 Sep 2025 23:44:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1117449.1463544; Tue, 09 Sep 2025 23: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 1uw80T-0001dF-O6; Tue, 09 Sep 2025 23:44:13 +0000
Received: by outflank-mailman (input) for mailman id 1117449;
 Tue, 09 Sep 2025 23: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 1uw80R-0001cy-To
 for xen-changelog@lists.xenproject.org; Tue, 09 Sep 2025 23: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 1uw80R-001t5l-2t
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 23:44:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uw80R-002COF-2k
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 23: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=m7pstu3LafrfKcf+6k/rXOeqAQCf0NmzRQxPeWTbXJw=; b=PQUZwb/xp+MDYV8I8mtCkQ0jQf
	mmJgu8g9vupm+Eqrk4ZFihm47UF1EfwlqDa5u1Z1fikYz6FOMu+mCKqZoGViUlILTtTJYa0CNyOIG
	PgFZQh9FDG+q9bzawSUj5ULwodL4lr8pBbJZV6zr2j2vh3Qw2/+cmEB4XlLkqFq1ALe8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: gic: implement helper functions for INTID checks
Message-Id: <E1uw80R-002COF-2k@xenbits.xenproject.org>
Date: Tue, 09 Sep 2025 23:44:11 +0000

commit c2c23ee8db3a6ce4d4d4dfe9b2fd38f898342eea
Author:     Leonid Komarianskyi <Leonid_Komarianskyi@epam.com>
AuthorDate: Tue Sep 9 10:08:59 2025 +0000
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Tue Sep 9 16:31:51 2025 -0700

    xen/arm: gic: implement helper functions for INTID checks
    
    Introduced two new helper functions: gic_is_valid_line and
    gic_is_spi. The first function helps determine whether an IRQ
    number is less than the number of lines supported by hardware. The
    second function additionally checks if the IRQ number falls within the
    SPI range. Also, updated the appropriate checks to use these new helper
    functions.
    
    The current checks for the real GIC are very similar to those for the
    vGIC but serve a different purpose. For GIC-related code, the interrupt
    numbers should be validated based on whether the hardware can operate
    with such interrupts. On the other hand, for the vGIC, the indexes must
    also be verified to ensure they are available for a specific domain. The
    first reason for introducing these helper functions is to avoid
    potential confusion with vGIC-related checks. The second reason is to
    consolidate similar code into separate functions, which can be more
    easily extended by additional conditions, e.g., when implementing
    extended SPI interrupts.
    
    The changes, which replace open-coded checks with the use of the new
    helper functions, do not introduce any functional changes, as the helper
    functions follow the current IRQ index verification logic.
    
    Signed-off-by: Leonid Komarianskyi <leonid_komarianskyi@epam.com>
    Reviewed-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/gic.c             | 3 ++-
 xen/arch/arm/include/asm/gic.h | 9 +++++++++
 xen/arch/arm/irq.c             | 2 +-
 3 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c
index e80fe0ca24..4bb11960ee 100644
--- a/xen/arch/arm/gic.c
+++ b/xen/arch/arm/gic.c
@@ -111,7 +111,8 @@ static void gic_set_irq_priority(struct irq_desc *desc, unsigned int priority)
 void gic_route_irq_to_xen(struct irq_desc *desc, unsigned int priority)
 {
     ASSERT(priority <= 0xff);     /* Only 8 bits of priority */
-    ASSERT(desc->irq < gic_number_lines());/* Can't route interrupts that don't exist */
+    /* Can't route interrupts that don't exist */
+    ASSERT(gic_is_valid_line(desc->irq));
     ASSERT(test_bit(_IRQ_DISABLED, &desc->status));
     ASSERT(spin_is_locked(&desc->lock));
 
diff --git a/xen/arch/arm/include/asm/gic.h b/xen/arch/arm/include/asm/gic.h
index 541f0eeb80..3fcee42675 100644
--- a/xen/arch/arm/include/asm/gic.h
+++ b/xen/arch/arm/include/asm/gic.h
@@ -306,6 +306,15 @@ extern void gic_dump_vgic_info(struct vcpu *v);
 
 /* Number of interrupt lines */
 extern unsigned int gic_number_lines(void);
+static inline bool gic_is_valid_line(unsigned int irq)
+{
+    return irq < gic_number_lines();
+}
+
+static inline bool gic_is_spi(unsigned int irq)
+{
+    return irq >= NR_LOCAL_IRQS && gic_is_valid_line(irq);
+}
 
 /* IRQ translation function for the device tree */
 int gic_irq_xlate(const u32 *intspec, unsigned int intsize,
diff --git a/xen/arch/arm/irq.c b/xen/arch/arm/irq.c
index 02ca82c089..29524e5d53 100644
--- a/xen/arch/arm/irq.c
+++ b/xen/arch/arm/irq.c
@@ -418,7 +418,7 @@ err:
 bool is_assignable_irq(unsigned int irq)
 {
     /* For now, we can only route SPIs to the guest */
-    return (irq >= NR_LOCAL_IRQS) && (irq < gic_number_lines());
+    return gic_is_spi(irq);
 }
 
 /*
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Sep 09 23:44:23 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Sep 2025 23:44:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1117450.1463547 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uw80d-0001fx-Sb; Tue, 09 Sep 2025 23:44:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1117450.1463547; Tue, 09 Sep 2025 23: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 1uw80d-0001fp-PT; Tue, 09 Sep 2025 23:44:23 +0000
Received: by outflank-mailman (input) for mailman id 1117450;
 Tue, 09 Sep 2025 23: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 1uw80c-0001fM-0a
 for xen-changelog@lists.xenproject.org; Tue, 09 Sep 2025 23: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 1uw80b-001t5r-3B
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 23:44:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uw80b-002CPf-34
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 23: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=kw/8irmKZYyuxKHR5yIspWNgfXwdiHdcGTslK9UzJR0=; b=7BT2yE8owhVo2mNhQFWGUI6/sN
	t5XoORvsMv23l7HkK/Ylj+bXNDTKw22fARur3WeyJmHWCivb1jTwtrEzrGWu4uMuk2ljjZDxRVndv
	6x3LN+ZtCvl4Msq1Lkkmc3dZUSs/epGtCTU4FXNCzM3OxODbvg5ZOPhGJk3MN0h/NtYw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: vgic: implement helper functions for virq checks
Message-Id: <E1uw80b-002CPf-34@xenbits.xenproject.org>
Date: Tue, 09 Sep 2025 23:44:21 +0000

commit 2b8b93fa96cc2918ca407a7ad225f7252080d6c7
Author:     Leonid Komarianskyi <Leonid_Komarianskyi@epam.com>
AuthorDate: Tue Sep 9 10:09:04 2025 +0000
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Tue Sep 9 16:31:51 2025 -0700

    xen/arm: vgic: implement helper functions for virq checks
    
    Introduced two new helper functions for vGIC: vgic_is_valid_line and
    vgic_is_spi. The functions are similar to the newly introduced
    gic_is_valid_line and gic_is_spi, but they verify whether a vIRQ
    is available for a specific domain, while GIC-specific functions
    validate INTIDs for the real GIC hardware. For example, the GIC may
    support all 992 SPI lines, but the domain may use only some part of them
    (e.g., 640), depending on the highest IRQ number defined in the domain
    configuration. Therefore, for vGIC-related code and checks, the
    appropriate functions should be used. Also, updated the appropriate
    checks to use these new helper functions.
    
    The purpose of introducing new helper functions for vGIC is essentially
    the same as for GIC: to avoid potential confusion with GIC-related
    checks and to consolidate similar code into separate functions, which
    can be more easily extended by additional conditions, e.g., when
    implementing extended SPI interrupts.
    
    Only the validation change in vgic_inject_irq may affect existing
    functionality, as it currently checks whether the vIRQ is less than or
    equal to vgic_num_irqs. Since IRQ indexes start from 0 (where 32 is the
    first SPI), the check should behave consistently with similar logic in
    other places and should check if the vIRQ number is less than
    vgic_num_irqs. The remaining changes, which replace open-coded checks
    with the use of these new helper functions, do not introduce any
    functional changes, as the helper functions follow the current vIRQ
    index verification logic.
    
    Signed-off-by: Leonid Komarianskyi <leonid_komarianskyi@epam.com>
    Reviewed-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
    Reviewed-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/gic.c              |  3 +--
 xen/arch/arm/include/asm/vgic.h |  7 +++++++
 xen/arch/arm/irq.c              |  4 ++--
 xen/arch/arm/vgic.c             | 10 ++++++++--
 xen/arch/arm/vgic/vgic.c        |  5 +++++
 5 files changed, 23 insertions(+), 6 deletions(-)

diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c
index 4bb11960ee..9469c9d08c 100644
--- a/xen/arch/arm/gic.c
+++ b/xen/arch/arm/gic.c
@@ -134,8 +134,7 @@ int gic_route_irq_to_guest(struct domain *d, unsigned int virq,
 
     ASSERT(spin_is_locked(&desc->lock));
     /* Caller has already checked that the IRQ is an SPI */
-    ASSERT(virq >= 32);
-    ASSERT(virq < vgic_num_irqs(d));
+    ASSERT(vgic_is_spi(d, virq));
     ASSERT(!is_lpi(virq));
 
     ret = vgic_connect_hw_irq(d, NULL, virq, desc, true);
diff --git a/xen/arch/arm/include/asm/vgic.h b/xen/arch/arm/include/asm/vgic.h
index 35c0c6a8b0..3e7cbbb196 100644
--- a/xen/arch/arm/include/asm/vgic.h
+++ b/xen/arch/arm/include/asm/vgic.h
@@ -335,6 +335,13 @@ extern void vgic_check_inflight_irqs_pending(struct vcpu *v,
 /* Default number of vGIC SPIs. 32 are substracted to cover local IRQs. */
 #define VGIC_DEF_NR_SPIS (min(gic_number_lines(), VGIC_MAX_IRQS) - 32)
 
+extern bool vgic_is_valid_line(struct domain *d, unsigned int virq);
+
+static inline bool vgic_is_spi(struct domain *d, unsigned int virq)
+{
+    return virq >= NR_LOCAL_IRQS && vgic_is_valid_line(d, virq);
+}
+
 /*
  * Allocate a guest VIRQ
  *  - spi == 0 => allocate a PPI. It will be the same on every vCPU
diff --git a/xen/arch/arm/irq.c b/xen/arch/arm/irq.c
index 29524e5d53..0df1e0a7c1 100644
--- a/xen/arch/arm/irq.c
+++ b/xen/arch/arm/irq.c
@@ -445,7 +445,7 @@ int route_irq_to_guest(struct domain *d, unsigned int virq,
     unsigned long flags;
     int retval = 0;
 
-    if ( virq >= vgic_num_irqs(d) )
+    if ( !vgic_is_valid_line(d, virq) )
     {
         printk(XENLOG_G_ERR
                "the vIRQ number %u is too high for domain %u (max = %u)\n",
@@ -563,7 +563,7 @@ int release_guest_irq(struct domain *d, unsigned int virq)
     int ret;
 
     /* Only SPIs are supported */
-    if ( virq < NR_LOCAL_IRQS || virq >= vgic_num_irqs(d) )
+    if ( !vgic_is_spi(d, virq) )
         return -EINVAL;
 
     desc = vgic_get_hw_irq_desc(d, NULL, virq);
diff --git a/xen/arch/arm/vgic.c b/xen/arch/arm/vgic.c
index c563ba93af..2bbf4d99aa 100644
--- a/xen/arch/arm/vgic.c
+++ b/xen/arch/arm/vgic.c
@@ -24,6 +24,12 @@
 #include <asm/gic.h>
 #include <asm/vgic.h>
 
+
+bool vgic_is_valid_line(struct domain *d, unsigned int virq)
+{
+    return virq < vgic_num_irqs(d);
+}
+
 static inline struct vgic_irq_rank *vgic_get_rank(struct vcpu *v,
                                                   unsigned int rank)
 {
@@ -582,7 +588,7 @@ void vgic_inject_irq(struct domain *d, struct vcpu *v, unsigned int virq,
     if ( !v )
     {
         /* The IRQ needs to be an SPI if no vCPU is specified. */
-        ASSERT(virq >= 32 && virq <= vgic_num_irqs(d));
+        ASSERT(vgic_is_spi(d, virq));
 
         v = vgic_get_target_vcpu(d->vcpu[0], virq);
     };
@@ -659,7 +665,7 @@ bool vgic_emulate(struct cpu_user_regs *regs, union hsr hsr)
 
 bool vgic_reserve_virq(struct domain *d, unsigned int virq)
 {
-    if ( virq >= vgic_num_irqs(d) )
+    if ( !vgic_is_valid_line(d, virq) )
         return false;
 
     return !test_and_set_bit(virq, d->arch.vgic.allocated_irqs);
diff --git a/xen/arch/arm/vgic/vgic.c b/xen/arch/arm/vgic/vgic.c
index 6cabd0496d..b2c0e1873a 100644
--- a/xen/arch/arm/vgic/vgic.c
+++ b/xen/arch/arm/vgic/vgic.c
@@ -718,6 +718,11 @@ bool vgic_reserve_virq(struct domain *d, unsigned int virq)
     return !test_and_set_bit(virq, d->arch.vgic.allocated_irqs);
 }
 
+bool vgic_is_valid_line(struct domain *d, unsigned int virq)
+{
+    return virq < vgic_num_irqs(d);
+}
+
 int vgic_allocate_virq(struct domain *d, bool spi)
 {
     int first, end;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Sep 09 23:44:33 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Sep 2025 23:44:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1117451.1463550 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uw80n-0001il-VT; Tue, 09 Sep 2025 23:44:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1117451.1463550; Tue, 09 Sep 2025 23: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 1uw80n-0001id-Sw; Tue, 09 Sep 2025 23:44:33 +0000
Received: by outflank-mailman (input) for mailman id 1117451;
 Tue, 09 Sep 2025 23: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 1uw80m-0001iT-3X
 for xen-changelog@lists.xenproject.org; Tue, 09 Sep 2025 23: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 1uw80m-001t5v-0F
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 23:44:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uw80m-002CQR-08
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 23: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=5WsjU3lkT0vsgzcl7iJb4LfTAtKboZO2xOP5tdVpJug=; b=Eql4tFjdADEKeCGS+k7dsSS4Zg
	J1Dx2mdBEhJp/yoP4wSVCcexaGdr+5y9IbYxi/FUXYMyxsknZGA585loXEfZgsPqCC2XFf8RUBw7y
	6tTMkMwDocnQpca89pscuVPdqMslFSiOsIUAsa/plLP7nOrgxYTrXRp3MVdFAOV0JAq0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm/irq: add handling for IRQs in the eSPI range
Message-Id: <E1uw80m-002CQR-08@xenbits.xenproject.org>
Date: Tue, 09 Sep 2025 23:44:32 +0000

commit 98f7060b9ed5fe7cdde331809096ea6ca3984115
Author:     Leonid Komarianskyi <Leonid_Komarianskyi@epam.com>
AuthorDate: Tue Sep 9 10:09:11 2025 +0000
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Tue Sep 9 16:31:53 2025 -0700

    xen/arm/irq: add handling for IRQs in the eSPI range
    
    Currently, Xen does not support eSPI interrupts, leading
    to a data abort when such interrupts are defined in the DTS.
    
    This patch introduces a separate array to initialize up to
    1024 interrupt descriptors in the eSPI range and adds the
    necessary defines and helper function. These changes lay the
    groundwork for future implementation of full eSPI interrupt
    support. As this GICv3.1 feature is not required by all vendors,
    all changes are guarded by ifdefs, depending on the corresponding
    Kconfig option.
    
    Signed-off-by: Leonid Komarianskyi <leonid_komarianskyi@epam.com>
    Reviewed-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
    Reviewed-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/arch/arm/Kconfig           |  8 ++++++++
 xen/arch/arm/include/asm/irq.h | 37 +++++++++++++++++++++++++++++++++
 xen/arch/arm/irq.c             | 46 ++++++++++++++++++++++++++++++++++++++++--
 3 files changed, 89 insertions(+), 2 deletions(-)

diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig
index 5355534f3d..cf6af68299 100644
--- a/xen/arch/arm/Kconfig
+++ b/xen/arch/arm/Kconfig
@@ -134,6 +134,14 @@ config GICV3
 	  Driver for the ARM Generic Interrupt Controller v3.
 	  If unsure, use the default setting.
 
+config GICV3_ESPI
+	bool "Extended SPI range support"
+	depends on GICV3 && !NEW_VGIC
+	help
+	  Allow Xen and domains to use interrupt numbers from the extended SPI
+	  range, from 4096 to 5119. This feature is introduced in GICv3.1
+	  architecture.
+
 config HAS_ITS
         bool "GICv3 ITS MSI controller support (UNSUPPORTED)" if UNSUPPORTED
         depends on GICV3 && !NEW_VGIC && !ARM_32
diff --git a/xen/arch/arm/include/asm/irq.h b/xen/arch/arm/include/asm/irq.h
index 5bc6475eb4..09788dbfeb 100644
--- a/xen/arch/arm/include/asm/irq.h
+++ b/xen/arch/arm/include/asm/irq.h
@@ -32,6 +32,10 @@ struct arch_irq_desc {
 #define SPI_MAX_INTID   1019
 #define LPI_OFFSET      8192
 
+#define ESPI_BASE_INTID 4096
+#define ESPI_MAX_INTID  5119
+#define NR_ESPI_IRQS    1024
+
 /* LPIs are always numbered starting at 8192, so 0 is a good invalid case. */
 #define INVALID_LPI     0
 
@@ -39,7 +43,12 @@ struct arch_irq_desc {
 #define INVALID_IRQ     1023
 
 extern const unsigned int nr_irqs;
+#ifdef CONFIG_GICV3_ESPI
+/* This will cover the eSPI range, to allow assignment of eSPIs to domains. */
+#define nr_static_irqs (ESPI_MAX_INTID + 1)
+#else
 #define nr_static_irqs NR_IRQS
+#endif
 
 struct irq_desc;
 struct irqaction;
@@ -55,6 +64,34 @@ static inline bool is_lpi(unsigned int irq)
     return irq >= LPI_OFFSET;
 }
 
+static inline bool is_espi(unsigned int irq)
+{
+#ifdef CONFIG_GICV3_ESPI
+    return irq >= ESPI_BASE_INTID && irq <= ESPI_MAX_INTID;
+#else
+    /*
+     * The function should not be called for eSPIs when CONFIG_GICV3_ESPI is
+     * disabled. Returning false allows the compiler to optimize the code
+     * when the config is disabled, while the assert ensures that out-of-range
+     * array resources are not accessed.
+     */
+    ASSERT(!(irq >= ESPI_BASE_INTID && irq <= ESPI_MAX_INTID));
+    return false;
+#endif
+}
+
+static inline unsigned int espi_intid_to_idx(unsigned int intid)
+{
+    ASSERT(is_espi(intid));
+    return intid - ESPI_BASE_INTID;
+}
+
+static inline unsigned int espi_idx_to_intid(unsigned int idx)
+{
+    ASSERT(idx <= NR_ESPI_IRQS);
+    return idx + ESPI_BASE_INTID;
+}
+
 #define domain_pirq_to_irq(d, pirq) (pirq)
 
 bool is_assignable_irq(unsigned int irq);
diff --git a/xen/arch/arm/irq.c b/xen/arch/arm/irq.c
index 0df1e0a7c1..53f5f4612f 100644
--- a/xen/arch/arm/irq.c
+++ b/xen/arch/arm/irq.c
@@ -19,7 +19,9 @@
 #include <asm/gic.h>
 #include <asm/vgic.h>
 
-const unsigned int nr_irqs = NR_IRQS;
+const unsigned int nr_irqs = IS_ENABLED(CONFIG_GICV3_ESPI) ?
+                                        (ESPI_MAX_INTID + 1) :
+                                        NR_IRQS;
 
 static unsigned int local_irqs_type[NR_LOCAL_IRQS];
 static DEFINE_SPINLOCK(local_irqs_type_lock);
@@ -46,6 +48,41 @@ void irq_end_none(struct irq_desc *irq)
 }
 
 static irq_desc_t irq_desc[NR_IRQS - NR_LOCAL_IRQS];
+#ifdef CONFIG_GICV3_ESPI
+/* TODO: Consider allocating an array dynamically */
+static irq_desc_t espi_desc[NR_ESPI_IRQS];
+
+static struct irq_desc *espi_to_desc(unsigned int irq)
+{
+    return &espi_desc[espi_intid_to_idx(irq)];
+}
+
+static int __init init_espi_data(void)
+{
+    unsigned int irq;
+
+    for ( irq = ESPI_BASE_INTID; irq <= ESPI_MAX_INTID; irq++ )
+    {
+        struct irq_desc *desc = irq_to_desc(irq);
+        int rc = init_one_irq_desc(desc);
+
+        if ( rc )
+            return rc;
+
+        desc->irq = irq;
+        desc->action  = NULL;
+    }
+
+    return 0;
+}
+#else
+
+static int __init init_espi_data(void)
+{
+    return 0;
+}
+#endif
+
 static DEFINE_PER_CPU(irq_desc_t[NR_LOCAL_IRQS], local_irq_desc);
 
 struct irq_desc *__irq_to_desc(unsigned int irq)
@@ -53,6 +90,11 @@ struct irq_desc *__irq_to_desc(unsigned int irq)
     if ( irq < NR_LOCAL_IRQS )
         return &this_cpu(local_irq_desc)[irq];
 
+#ifdef CONFIG_GICV3_ESPI
+    if ( is_espi(irq) )
+        return espi_to_desc(irq);
+#endif
+
     return &irq_desc[irq-NR_LOCAL_IRQS];
 }
 
@@ -79,7 +121,7 @@ static int __init init_irq_data(void)
         desc->action  = NULL;
     }
 
-    return 0;
+    return init_espi_data();
 }
 
 static int init_local_irq_data(unsigned int cpu)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Sep 09 23:44:44 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Sep 2025 23:44:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1117452.1463554 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uw80y-0001kv-18; Tue, 09 Sep 2025 23:44:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1117452.1463554; Tue, 09 Sep 2025 23:44: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 1uw80x-0001kk-Ua; Tue, 09 Sep 2025 23:44:43 +0000
Received: by outflank-mailman (input) for mailman id 1117452;
 Tue, 09 Sep 2025 23: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 1uw80w-0001kZ-8A
 for xen-changelog@lists.xenproject.org; Tue, 09 Sep 2025 23: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 1uw80w-001t63-0Y
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 23:44:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uw80w-002CSg-0Q
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 23: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=z+rZrou7jhbD/F4qY9/2s34he14M2sy/6IlnuwK+5G8=; b=rBaRng0KOxwQ0uRpC1wOyPwMf/
	AA3R9c8i3mDMtBx9N0wL5wmmx6Izc3A6Yrqv3OKMHBqGkgu69NS3W6pSN8/c5acT+lgxkY+Fsns6n
	TWnG1UCD9sswXkAf/7GyUNRhLHpEBoXax18pEVlbroX0dq/C07mXf10BCpkeyVTpK92E=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: gicv3: implement handling of GICv3.1 eSPI
Message-Id: <E1uw80w-002CSg-0Q@xenbits.xenproject.org>
Date: Tue, 09 Sep 2025 23:44:42 +0000

commit 60c4e9442cebd71bed7ce5415cf8c93f47be9169
Author:     Leonid Komarianskyi <Leonid_Komarianskyi@epam.com>
AuthorDate: Tue Sep 9 10:09:16 2025 +0000
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Tue Sep 9 16:31:58 2025 -0700

    xen/arm: gicv3: implement handling of GICv3.1 eSPI
    
    Introduced appropriate register definitions, helper macros,
    and initialization of required GICv3.1 distributor registers
    to support eSPI. This type of interrupt is handled in the
    same way as regular SPI interrupts, with the following
    differences:
    
    1) eSPIs can have up to 1024 interrupts, starting from the
    beginning of the range, whereas regular SPIs use INTIDs from
    32 to 1019, totaling 988 interrupts;
    2) eSPIs start at INTID 4096, necessitating additional interrupt
    index conversion during register operations.
    
    In case if appropriate config is disabled, or GIC HW doesn't
    support eSPI, the existing functionality will remain the same.
    
    Signed-off-by: Leonid Komarianskyi <leonid_komarianskyi@epam.com>
    Reviewed-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/gic-v3.c                  | 85 ++++++++++++++++++++++++++++++++++
 xen/arch/arm/include/asm/gic.h         | 21 ++++++++-
 xen/arch/arm/include/asm/gic_v3_defs.h | 38 +++++++++++++++
 3 files changed, 143 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/gic-v3.c b/xen/arch/arm/gic-v3.c
index 2fdd96dbb1..bc07f97c16 100644
--- a/xen/arch/arm/gic-v3.c
+++ b/xen/arch/arm/gic-v3.c
@@ -489,6 +489,38 @@ static void __iomem *get_addr_by_offset(struct irq_desc *irqd, uint32_t offset)
             break;
         }
         break;
+#ifdef CONFIG_GICV3_ESPI
+    case ESPI_BASE_INTID ... ESPI_MAX_INTID:
+    {
+        uint32_t irq_index = espi_intid_to_idx(irqd->irq);
+
+        switch ( offset )
+        {
+        case GICD_ISENABLER:
+            return (GICD + GICD_ISENABLERnE + (irq_index / 32) * 4);
+        case GICD_ICENABLER:
+            return (GICD + GICD_ICENABLERnE + (irq_index / 32) * 4);
+        case GICD_ISPENDR:
+            return (GICD + GICD_ISPENDRnE + (irq_index / 32) * 4);
+        case GICD_ICPENDR:
+            return (GICD + GICD_ICPENDRnE + (irq_index / 32) * 4);
+        case GICD_ISACTIVER:
+            return (GICD + GICD_ISACTIVERnE + (irq_index / 32) * 4);
+        case GICD_ICACTIVER:
+            return (GICD + GICD_ICACTIVERnE + (irq_index / 32) * 4);
+        case GICD_ICFGR:
+            return (GICD + GICD_ICFGRnE + (irq_index / 16) * 4);
+        case GICD_IROUTER:
+            return (GICD + GICD_IROUTERnE + irq_index * 8);
+        case GICD_IPRIORITYR:
+            return (GICD + GICD_IPRIORITYRnE + irq_index);
+        default:
+            /* Invalid register offset for eSPIs */
+            break;
+        }
+        break;
+    }
+#endif
     default:
         /* Invalid INTID */
         break;
@@ -661,6 +693,55 @@ static void gicv3_set_irq_priority(struct irq_desc *desc,
     spin_unlock(&gicv3.lock);
 }
 
+#ifdef CONFIG_GICV3_ESPI
+unsigned int gic_number_espis(void)
+{
+    return gic_hw_ops->info->nr_espi;
+}
+
+static void __init gicv3_dist_espi_common_init(uint32_t type)
+{
+    unsigned int espi_nr, i;
+
+    espi_nr = min(1024U, GICD_TYPER_ESPIS_NUM(type));
+    gicv3_info.nr_espi = espi_nr;
+    /* The GIC HW doesn't support eSPI, so we can leave from here */
+    if ( gicv3_info.nr_espi == 0 )
+        return;
+
+    printk("GICv3: %u eSPI lines\n", gicv3_info.nr_espi);
+
+    /* The configuration for eSPIs is similar to that for regular SPIs */
+    for ( i = 0; i < espi_nr; i += 16 )
+        writel_relaxed(0, GICD + GICD_ICFGRnE + (i / 16) * 4);
+
+    for ( i = 0; i < espi_nr; i += 4 )
+        writel_relaxed(GIC_PRI_IRQ_ALL,
+                       GICD + GICD_IPRIORITYRnE + (i / 4) * 4);
+
+    for ( i = 0; i < espi_nr; i += 32 )
+    {
+        writel_relaxed(GENMASK(31, 0), GICD + GICD_ICENABLERnE + (i / 32) * 4);
+        writel_relaxed(GENMASK(31, 0), GICD + GICD_ICACTIVERnE + (i / 32) * 4);
+    }
+
+    for ( i = 0; i < espi_nr; i += 32 )
+        writel_relaxed(GENMASK(31, 0), GICD + GICD_IGROUPRnE + (i / 32) * 4);
+}
+
+static void __init gicv3_dist_espi_init_aff(uint64_t affinity)
+{
+    unsigned int i;
+
+    for ( i = 0; i < gicv3_info.nr_espi; i++ )
+        writeq_relaxed_non_atomic(affinity, GICD + GICD_IROUTERnE + i * 8);
+}
+#else
+static void __init gicv3_dist_espi_common_init(uint32_t type) { }
+
+static void __init gicv3_dist_espi_init_aff(uint64_t affinity) { }
+#endif
+
 static void __init gicv3_dist_init(void)
 {
     uint32_t type;
@@ -706,6 +787,8 @@ static void __init gicv3_dist_init(void)
     for ( i = NR_GIC_LOCAL_IRQS; i < nr_lines; i += 32 )
         writel_relaxed(GENMASK(31, 0), GICD + GICD_IGROUPR + (i / 32) * 4);
 
+    gicv3_dist_espi_common_init(type);
+
     gicv3_dist_wait_for_rwp();
 
     /* Turn on the distributor */
@@ -719,6 +802,8 @@ static void __init gicv3_dist_init(void)
 
     for ( i = NR_GIC_LOCAL_IRQS; i < nr_lines; i++ )
         writeq_relaxed_non_atomic(affinity, GICD + GICD_IROUTER + i * 8);
+
+    gicv3_dist_espi_init_aff(affinity);
 }
 
 static int gicv3_enable_redist(void)
diff --git a/xen/arch/arm/include/asm/gic.h b/xen/arch/arm/include/asm/gic.h
index 3fcee42675..3947c8634d 100644
--- a/xen/arch/arm/include/asm/gic.h
+++ b/xen/arch/arm/include/asm/gic.h
@@ -306,9 +306,24 @@ extern void gic_dump_vgic_info(struct vcpu *v);
 
 /* Number of interrupt lines */
 extern unsigned int gic_number_lines(void);
+#ifdef CONFIG_GICV3_ESPI
+extern unsigned int gic_number_espis(void);
+
+static inline bool gic_is_valid_espi(unsigned int irq)
+{
+    return irq >= ESPI_BASE_INTID &&
+           irq < espi_idx_to_intid(gic_number_espis());
+}
+#else
+static inline bool gic_is_valid_espi(unsigned int irq)
+{
+    return false;
+}
+#endif
+
 static inline bool gic_is_valid_line(unsigned int irq)
 {
-    return irq < gic_number_lines();
+    return irq < gic_number_lines() || gic_is_valid_espi(irq);
 }
 
 static inline bool gic_is_spi(unsigned int irq)
@@ -325,6 +340,10 @@ struct gic_info {
     enum gic_version hw_version;
     /* Number of GIC lines supported */
     unsigned int nr_lines;
+#ifdef CONFIG_GICV3_ESPI
+    /* Number of GIC eSPI supported */
+    unsigned int nr_espi;
+#endif
     /* Number of LR registers */
     uint8_t nr_lrs;
     /* Maintenance irq number */
diff --git a/xen/arch/arm/include/asm/gic_v3_defs.h b/xen/arch/arm/include/asm/gic_v3_defs.h
index 2af093e774..3370b4cd52 100644
--- a/xen/arch/arm/include/asm/gic_v3_defs.h
+++ b/xen/arch/arm/include/asm/gic_v3_defs.h
@@ -37,6 +37,44 @@
 #define GICD_IROUTER1019             (0x7FD8)
 #define GICD_PIDR2                   (0xFFE8)
 
+/* Additional registers for GICv3.1 */
+#define GICD_IGROUPRnE               (0x1000)
+#define GICD_IGROUPRnEN              (0x107C)
+#define GICD_ISENABLERnE             (0x1200)
+#define GICD_ISENABLERnEN            (0x127C)
+#define GICD_ICENABLERnE             (0x1400)
+#define GICD_ICENABLERnEN            (0x147C)
+#define GICD_ISPENDRnE               (0x1600)
+#define GICD_ISPENDRnEN              (0x167C)
+#define GICD_ICPENDRnE               (0x1800)
+#define GICD_ICPENDRnEN              (0x187C)
+#define GICD_ISACTIVERnE             (0x1A00)
+#define GICD_ISACTIVERnEN            (0x1A7C)
+#define GICD_ICACTIVERnE             (0x1C00)
+#define GICD_ICACTIVERnEN            (0x1C7C)
+#define GICD_IPRIORITYRnE            (0x2000)
+#define GICD_IPRIORITYRnEN           (0x23FC)
+#define GICD_ICFGRnE                 (0x3000)
+#define GICD_ICFGRnEN                (0x30FC)
+#define GICD_IGRPMODRnE              (0x3400)
+#define GICD_IGRPMODRnEN             (0x347C)
+#define GICD_NSACRnE                 (0x3600)
+#define GICD_NSACRnEN                (0x36FC)
+#define GICD_IROUTERnE               (0x8000)
+#define GICD_IROUTERnEN              (0x9FFC)
+
+#ifdef CONFIG_GICV3_ESPI
+#define GICD_TYPER_ESPI_SHIFT        8
+#define GICD_TYPER_ESPI_RANGE_SHIFT  27
+#define GICD_TYPER_ESPI_RANGE_MASK   (0x1F)
+#define GICD_TYPER_ESPI              (1U << GICD_TYPER_ESPI_SHIFT)
+#define GICD_TYPER_ESPI_RANGE(espi_range) ((((espi_range) & \
+        GICD_TYPER_ESPI_RANGE_MASK) + 1) * 32)
+#define GICD_TYPER_ESPIS_NUM(typer)    \
+        (((typer) & GICD_TYPER_ESPI) ? \
+        GICD_TYPER_ESPI_RANGE((typer) >> GICD_TYPER_ESPI_RANGE_SHIFT) : 0)
+#endif
+
 /* Common between GICD_PIDR2 and GICR_PIDR2 */
 #define GIC_PIDR2_ARCH_MASK         (0xf0)
 #define GIC_PIDR2_ARCH_GICv3        (0x30)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Sep 09 23:44:54 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Sep 2025 23:44:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1117453.1463559 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uw818-0001n8-2N; Tue, 09 Sep 2025 23:44:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1117453.1463559; Tue, 09 Sep 2025 23: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 1uw817-0001n0-W1; Tue, 09 Sep 2025 23:44:53 +0000
Received: by outflank-mailman (input) for mailman id 1117453;
 Tue, 09 Sep 2025 23: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 1uw816-0001mq-9A
 for xen-changelog@lists.xenproject.org; Tue, 09 Sep 2025 23: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 1uw816-001t67-0p
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 23:44:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uw816-002CT2-0i
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 23: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=2ErYgRsdh19ttlZnGf9BagnHWPQdqgagsQbp3G3XT78=; b=uUDTVFR4WzrvMu4Gu8rzeCSq4H
	Ip1ViUM+wdaw9Eb1GHNEnlebFazfYdYpZlurQKsDAlioUzXTuNiwJjGN1gFj0EDAXl0mYm1nzvcfG
	qKfMtQA0dT1XEjFVZz+viHk3mwKk0CDYZIbZZsmBuETjrWNd+WTGVlJwmDmPuTGJTeKI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm/irq: allow eSPI processing in the gic_interrupt function
Message-Id: <E1uw816-002CT2-0i@xenbits.xenproject.org>
Date: Tue, 09 Sep 2025 23:44:52 +0000

commit 54ba8a8d047a74609000d49bc676edc19bc1e5d6
Author:     Leonid Komarianskyi <Leonid_Komarianskyi@epam.com>
AuthorDate: Tue Sep 9 10:09:20 2025 +0000
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Tue Sep 9 16:32:00 2025 -0700

    xen/arm/irq: allow eSPI processing in the gic_interrupt function
    
    The gic_interrupt function is the main handler for processing IRQs.
    Currently, due to restrictive checks, it does not process interrupt
    numbers greater than 1019. This patch updates the condition to allow
    the handling of interrupts from the eSPI range.
    
    Signed-off-by: Leonid Komarianskyi <leonid_komarianskyi@epam.com>
    Reviewed-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/gic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c
index 9469c9d08c..260ee64cca 100644
--- a/xen/arch/arm/gic.c
+++ b/xen/arch/arm/gic.c
@@ -342,7 +342,7 @@ void gic_interrupt(struct cpu_user_regs *regs, int is_fiq)
         /* Reading IRQ will ACK it */
         irq = gic_hw_ops->read_irq();
 
-        if ( likely(irq >= GIC_SGI_STATIC_MAX && irq < 1020) )
+        if ( likely(irq >= GIC_SGI_STATIC_MAX && irq < 1020) || is_espi(irq) )
         {
             isb();
             do_IRQ(regs, irq, is_fiq);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Sep 09 23:45:04 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Sep 2025 23:45:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1117454.1463563 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uw81I-0001pI-3t; Tue, 09 Sep 2025 23:45:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1117454.1463563; Tue, 09 Sep 2025 23: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 1uw81I-0001pB-19; Tue, 09 Sep 2025 23:45:04 +0000
Received: by outflank-mailman (input) for mailman id 1117454;
 Tue, 09 Sep 2025 23: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 1uw81G-0001oz-CD
 for xen-changelog@lists.xenproject.org; Tue, 09 Sep 2025 23: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 1uw81G-001t6n-18
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 23:45:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uw81G-002CTs-0z
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 23: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=u2lBStIo0C3f6vdI+PTI/9hBpP3f/8+iJJFKJ6MsjYw=; b=nQgu/eZSFmS9TE3V2WyFdTOj2i
	FcyvVqNAch4eKLdjqbOeOoLVVXyatIbAowh56AVIMkFHo9qcu88NYXFgnr7Z4kXLaY+tkFDpj5bKO
	1Knj6K3k0vTY3d+JGn0SVg8PaLnLsP0W3rlnxWd/thF5fznIw5MJSbB7UVR4OWau750A=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: gicv3: modify ICH_LR_PHYSICAL_MASK to allow eSPI processing
Message-Id: <E1uw81G-002CTs-0z@xenbits.xenproject.org>
Date: Tue, 09 Sep 2025 23:45:02 +0000

commit 35b61d5f465d085a69772e5c769fc1a38984dd97
Author:     Leonid Komarianskyi <Leonid_Komarianskyi@epam.com>
AuthorDate: Tue Sep 9 10:09:23 2025 +0000
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Tue Sep 9 16:32:01 2025 -0700

    xen/arm: gicv3: modify ICH_LR_PHYSICAL_MASK to allow eSPI processing
    
    To properly deactivate physical eSPI routed to a domain and allow them to
    be retriggered after the initial trigger, the LR needs to be updated. The
    current implementation ignores interrupts outside the range specified by
    the mask 0x3FF, which only covers IRQ numbers up to 1023. To enable
    processing of eSPI interrupts, this patch updates the mask to 0x1FFF.
    
    Signed-off-by: Leonid Komarianskyi <leonid_komarianskyi@epam.com>
    Reviewed-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/include/asm/gic_v3_defs.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/arm/include/asm/gic_v3_defs.h b/xen/arch/arm/include/asm/gic_v3_defs.h
index 3370b4cd52..c373b94d19 100644
--- a/xen/arch/arm/include/asm/gic_v3_defs.h
+++ b/xen/arch/arm/include/asm/gic_v3_defs.h
@@ -211,7 +211,7 @@
 #define ICH_LR_VIRTUAL_SHIFT         0
 #define ICH_LR_CPUID_MASK            0x7
 #define ICH_LR_CPUID_SHIFT           10
-#define ICH_LR_PHYSICAL_MASK         0x3ff
+#define ICH_LR_PHYSICAL_MASK         0x1fff
 #define ICH_LR_PHYSICAL_SHIFT        32
 #define ICH_LR_STATE_MASK            0x3
 #define ICH_LR_STATE_SHIFT           62
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Sep 09 23:45:14 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Sep 2025 23:45:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1117455.1463568 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uw81S-0001rc-6V; Tue, 09 Sep 2025 23:45:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1117455.1463568; Tue, 09 Sep 2025 23: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 1uw81S-0001rS-2f; Tue, 09 Sep 2025 23:45:14 +0000
Received: by outflank-mailman (input) for mailman id 1117455;
 Tue, 09 Sep 2025 23: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 1uw81Q-0001rF-FK
 for xen-changelog@lists.xenproject.org; Tue, 09 Sep 2025 23: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 1uw81Q-001t6v-1R
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 23:45:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uw81Q-002CUG-1K
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 23: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=EmGWBD4S5TYEQnaXsw1IRI/haJ+L3TYDJBY6kkDpmG0=; b=pJqNC5EXymUaqf2XKELUljy2wP
	WmSBnAn5iowa2P6pGiRtI46Kvx6mEDYorhKyi/dGJrvRGODGfJxQNjGgwUWiH0/17NT3eVEun3Cud
	cmjbjlDJIgJbHx8mODMP4yE8k9tZFNU/6DPoooEn3ZHJp+3+T9mp1ZQ9VEUidVuTWowE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: vgic: add resource management for extended SPIs
Message-Id: <E1uw81Q-002CUG-1K@xenbits.xenproject.org>
Date: Tue, 09 Sep 2025 23:45:12 +0000

commit bdde400c6e1b4cce9d80688fa9239dcb267c4c6f
Author:     Leonid Komarianskyi <Leonid_Komarianskyi@epam.com>
AuthorDate: Tue Sep 9 10:09:26 2025 +0000
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Tue Sep 9 16:32:03 2025 -0700

    xen/arm: vgic: add resource management for extended SPIs
    
    This change introduces resource management in the VGIC to handle
    extended SPIs introduced in GICv3.1. The pending_irqs and
    allocated_irqs arrays are resized to support the required
    number of eSPIs, based on what is supported by the hardware and
    requested by the guest. A new field, ext_shared_irqs, is added
    to the VGIC structure to store information about eSPIs, similar
    to how shared_irqs is used for regular SPIs.
    
    Since the eSPI range starts at INTID 4096 and INTIDs between 1025
    and 4095 are reserved, helper macros are introduced to simplify the
    transformation of indices and to enable easier access to eSPI-specific
    resources. These changes prepare the VGIC for processing eSPIs as
    required by future functionality.
    
    The initialization and deinitialization paths for vgic have been updated
    to allocate and free these resources appropriately. Additionally,
    updated handling of INTIDs greater than 1024, passed from the toolstack
    during domain creation, and verification logic ensures only valid SPI or
    eSPI INTIDs are used.
    
    The existing SPI behavior remains unaffected when guests do not request
    eSPIs, GIC hardware does not support them, or the CONFIG_GICV3_ESPI
    option is disabled.
    
    Signed-off-by: Leonid Komarianskyi <leonid_komarianskyi@epam.com>
    Reviewed-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
    Reviewed-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/include/asm/vgic.h |  26 +++++-
 xen/arch/arm/irq.c              |   3 +-
 xen/arch/arm/vgic.c             | 190 +++++++++++++++++++++++++++++++++++++---
 3 files changed, 203 insertions(+), 16 deletions(-)

diff --git a/xen/arch/arm/include/asm/vgic.h b/xen/arch/arm/include/asm/vgic.h
index 3e7cbbb196..caffea092b 100644
--- a/xen/arch/arm/include/asm/vgic.h
+++ b/xen/arch/arm/include/asm/vgic.h
@@ -144,11 +144,25 @@ struct vgic_dist {
     spinlock_t lock;
     uint32_t ctlr;
     int nr_spis; /* Number of SPIs */
-    unsigned long *allocated_irqs; /* bitmap of IRQs allocated */
+    /*
+     * Bitmap of allocated IRQs with the following index mapping:
+     * Local IRQs [0..31]
+     * Regular SPIs [32..nr_spis + 31]
+     * Optional, if supported:
+     * Extended SPIs [nr_spis + 32..nr_spis + nr_espis + 31]
+     */
+    unsigned long *allocated_irqs;
     struct vgic_irq_rank *shared_irqs;
+#ifdef CONFIG_GICV3_ESPI
+    struct vgic_irq_rank *ext_shared_irqs;
+    unsigned int nr_espis; /* Number of extended SPIs */
+#endif
     /*
      * SPIs are domain global, SGIs and PPIs are per-VCPU and stored in
-     * struct arch_vcpu.
+     * struct arch_vcpu. The index mapping is as follows:
+     * Regular SPIs [0..nr_spis - 1]
+     * Optional, if supported:
+     * eSPIs [nr_spis..nr_spis + nr_espis - 1]
      */
     struct pending_irq *pending_irqs;
     /* Base address for guest GIC */
@@ -243,6 +257,14 @@ struct vgic_ops {
 /* Number of ranks of interrupt registers for a domain */
 #define DOMAIN_NR_RANKS(d) (((d)->arch.vgic.nr_spis+31)/32)
 
+#ifdef CONFIG_GICV3_ESPI
+#define DOMAIN_NR_EXT_RANKS(d) (((d)->arch.vgic.nr_espis + 31) / 32)
+#endif
+#define EXT_RANK_MIN (ESPI_BASE_INTID / 32)
+#define EXT_RANK_MAX ((ESPI_MAX_INTID + 31) / 32)
+#define EXT_RANK_NUM2IDX(num) ((num) - EXT_RANK_MIN)
+#define EXT_RANK_IDX2NUM(idx) ((idx) + EXT_RANK_MIN)
+
 #define vgic_lock(v)   spin_lock_irq(&(v)->domain->arch.vgic.lock)
 #define vgic_unlock(v) spin_unlock_irq(&(v)->domain->arch.vgic.lock)
 
diff --git a/xen/arch/arm/irq.c b/xen/arch/arm/irq.c
index 53f5f4612f..73e58a5108 100644
--- a/xen/arch/arm/irq.c
+++ b/xen/arch/arm/irq.c
@@ -490,8 +490,7 @@ int route_irq_to_guest(struct domain *d, unsigned int virq,
     if ( !vgic_is_valid_line(d, virq) )
     {
         printk(XENLOG_G_ERR
-               "the vIRQ number %u is too high for domain %u (max = %u)\n",
-               irq, d->domain_id, vgic_num_irqs(d));
+               "invalid vIRQ number %u for domain %pd\n", irq, d);
         return -EINVAL;
     }
 
diff --git a/xen/arch/arm/vgic.c b/xen/arch/arm/vgic.c
index 2bbf4d99aa..eb22de6aa6 100644
--- a/xen/arch/arm/vgic.c
+++ b/xen/arch/arm/vgic.c
@@ -25,11 +25,61 @@
 #include <asm/vgic.h>
 
 
+static inline unsigned int idx_to_virq(struct domain *d, unsigned int idx)
+{
+    if ( idx >= vgic_num_irqs(d) )
+        return espi_idx_to_intid(idx - vgic_num_irqs(d));
+
+    return idx;
+}
+
 bool vgic_is_valid_line(struct domain *d, unsigned int virq)
 {
+#ifdef CONFIG_GICV3_ESPI
+    if ( virq >= ESPI_BASE_INTID &&
+         virq < espi_idx_to_intid(d->arch.vgic.nr_espis) )
+        return true;
+#endif
+
     return virq < vgic_num_irqs(d);
 }
 
+#ifdef CONFIG_GICV3_ESPI
+/*
+ * Since eSPI indexes start from 4096 and numbers from 1024 to
+ * 4095 are forbidden, we need to check both lower and upper
+ * limits for ranks.
+ */
+static inline bool is_valid_espi_rank(struct domain *d, unsigned int rank)
+{
+    return rank >= EXT_RANK_MIN &&
+           EXT_RANK_NUM2IDX(rank) < DOMAIN_NR_EXT_RANKS(d);
+}
+
+static inline struct vgic_irq_rank *vgic_get_espi_rank(struct vcpu *v,
+                                                       unsigned int rank)
+{
+    return &v->domain->arch.vgic.ext_shared_irqs[EXT_RANK_NUM2IDX(rank)];
+}
+
+#else
+static inline bool is_valid_espi_rank(struct domain *d, unsigned int rank)
+{
+    return false;
+}
+
+/*
+ * This function is stub and will not be called if CONFIG_GICV3_ESPI=n,
+ * because in this case, is_valid_espi_rank will always return false.
+ */
+static inline struct vgic_irq_rank *vgic_get_espi_rank(struct vcpu *v,
+                                                       unsigned int rank)
+{
+    ASSERT_UNREACHABLE();
+    return NULL;
+}
+#endif
+
 static inline struct vgic_irq_rank *vgic_get_rank(struct vcpu *v,
                                                   unsigned int rank)
 {
@@ -37,6 +87,8 @@ static inline struct vgic_irq_rank *vgic_get_rank(struct vcpu *v,
         return v->arch.vgic.private_irqs;
     else if ( rank <= DOMAIN_NR_RANKS(v->domain) )
         return &v->domain->arch.vgic.shared_irqs[rank - 1];
+    else if ( is_valid_espi_rank(v->domain, rank) )
+        return vgic_get_espi_rank(v, rank);
     else
         return NULL;
 }
@@ -117,6 +169,54 @@ int domain_vgic_register(struct domain *d, unsigned int *mmio_count)
     return 0;
 }
 
+#ifdef CONFIG_GICV3_ESPI
+static unsigned int vgic_num_spi_lines(struct domain *d)
+{
+    return d->arch.vgic.nr_spis + d->arch.vgic.nr_espis;
+}
+
+static int init_vgic_espi(struct domain *d)
+{
+    unsigned int i, idx;
+
+    if ( d->arch.vgic.nr_espis == 0 )
+        return 0;
+
+    d->arch.vgic.ext_shared_irqs =
+        xzalloc_array(struct vgic_irq_rank, DOMAIN_NR_EXT_RANKS(d));
+    if ( d->arch.vgic.ext_shared_irqs == NULL )
+        return -ENOMEM;
+
+    for ( i = d->arch.vgic.nr_spis, idx = 0;
+          i < vgic_num_spi_lines(d); i++, idx++ )
+        vgic_init_pending_irq(&d->arch.vgic.pending_irqs[i],
+                              espi_idx_to_intid(idx));
+
+    for ( i = 0; i < DOMAIN_NR_EXT_RANKS(d); i++ )
+        vgic_rank_init(&d->arch.vgic.ext_shared_irqs[i],
+                       EXT_RANK_IDX2NUM(i), 0);
+
+    return 0;
+}
+
+#else
+static int init_vgic_espi(struct domain *d)
+{
+    return 0;
+}
+
+static unsigned int vgic_num_spi_lines(struct domain *d)
+{
+    return d->arch.vgic.nr_spis;
+}
+
+#endif
+
+static unsigned int vgic_num_alloc_irqs(struct domain *d)
+{
+    return vgic_num_spi_lines(d) + NR_LOCAL_IRQS;
+}
+
 int domain_vgic_init(struct domain *d, unsigned int nr_spis)
 {
     int i;
@@ -133,7 +233,39 @@ int domain_vgic_init(struct domain *d, unsigned int nr_spis)
 
     /* Limit the number of virtual SPIs supported to (1020 - 32) = 988  */
     if ( nr_spis > (1020 - NR_LOCAL_IRQS) )
+#ifndef CONFIG_GICV3_ESPI
         return -EINVAL;
+#else
+    {
+        /*
+         * During domain creation, the dom0less DomUs code or toolstack
+         * specifies the maximum INTID, which is defined in the domain
+         * config subtracted by 32 to cover the local IRQs (please see
+         * the comment to VGIC_DEF_NR_SPIS). To compute the actual number
+         * of eSPI that will be usable for, add back 32 (NR_LOCAL_IRQS).
+         */
+        nr_spis += NR_LOCAL_IRQS;
+        if ( nr_spis > espi_idx_to_intid(NR_ESPI_IRQS) )
+            return -EINVAL;
+
+        if ( nr_spis >= ESPI_BASE_INTID )
+        {
+            unsigned int nr_espis = min(nr_spis - ESPI_BASE_INTID, 1024U);
+
+            /* Verify if GIC HW can handle provided INTID */
+            if ( nr_espis > gic_number_espis() )
+                return -EINVAL;
+
+            d->arch.vgic.nr_espis = nr_espis;
+            /* Set the maximum available number for regular SPIs */
+            nr_spis = VGIC_DEF_NR_SPIS;
+        }
+        else
+        {
+            return -EINVAL;
+        }
+    }
+#endif
 
     d->arch.vgic.nr_spis = nr_spis;
 
@@ -145,7 +277,7 @@ int domain_vgic_init(struct domain *d, unsigned int nr_spis)
         return -ENOMEM;
 
     d->arch.vgic.pending_irqs =
-        xzalloc_array(struct pending_irq, d->arch.vgic.nr_spis);
+        xzalloc_array(struct pending_irq, vgic_num_spi_lines(d));
     if ( d->arch.vgic.pending_irqs == NULL )
         return -ENOMEM;
 
@@ -156,12 +288,16 @@ int domain_vgic_init(struct domain *d, unsigned int nr_spis)
     for ( i = 0; i < DOMAIN_NR_RANKS(d); i++ )
         vgic_rank_init(&d->arch.vgic.shared_irqs[i], i + 1, 0);
 
+    ret = init_vgic_espi(d);
+    if ( ret )
+        return ret;
+
     ret = d->arch.vgic.handler->domain_init(d);
     if ( ret )
         return ret;
 
     d->arch.vgic.allocated_irqs =
-        xzalloc_array(unsigned long, BITS_TO_LONGS(vgic_num_irqs(d)));
+        xzalloc_array(unsigned long, BITS_TO_LONGS(vgic_num_alloc_irqs(d)));
     if ( !d->arch.vgic.allocated_irqs )
         return -ENOMEM;
 
@@ -182,9 +318,12 @@ void domain_vgic_free(struct domain *d)
     int i;
     int ret;
 
-    for ( i = 0; i < (d->arch.vgic.nr_spis); i++ )
+    for ( i = NR_LOCAL_IRQS; i < vgic_num_alloc_irqs(d); i++ )
     {
-        struct pending_irq *p = spi_to_pending(d, i + 32);
+        struct pending_irq *p;
+        unsigned int virq = idx_to_virq(d, i);
+
+        p = spi_to_pending(d, virq);
 
         if ( p->desc )
         {
@@ -198,6 +337,9 @@ void domain_vgic_free(struct domain *d)
     if ( d->arch.vgic.handler )
         d->arch.vgic.handler->domain_free(d);
     xfree(d->arch.vgic.shared_irqs);
+#ifdef CONFIG_GICV3_ESPI
+    xfree(d->arch.vgic.ext_shared_irqs);
+#endif
     xfree(d->arch.vgic.pending_irqs);
     xfree(d->arch.vgic.allocated_irqs);
 }
@@ -323,10 +465,12 @@ void arch_move_irqs(struct vcpu *v)
      */
     ASSERT(!is_lpi(vgic_num_irqs(d) - 1));
 
-    for ( i = 32; i < vgic_num_irqs(d); i++ )
+    for ( i = NR_LOCAL_IRQS; i < vgic_num_alloc_irqs(d); i++ )
     {
-        v_target = vgic_get_target_vcpu(v, i);
-        p = irq_to_pending(v_target, i);
+        unsigned int virq = idx_to_virq(d, i);
+
+        v_target = vgic_get_target_vcpu(v, virq);
+        p = irq_to_pending(v_target, virq);
 
         if ( v_target == v && !test_bit(GIC_IRQ_GUEST_MIGRATING, &p->status) )
             irq_set_affinity(p->desc, cpu_mask);
@@ -539,15 +683,28 @@ struct pending_irq *irq_to_pending(struct vcpu *v, unsigned int irq)
     else if ( is_lpi(irq) )
         n = v->domain->arch.vgic.handler->lpi_to_pending(v->domain, irq);
     else
-        n = &v->domain->arch.vgic.pending_irqs[irq - 32];
+        n = spi_to_pending(v->domain, irq);
     return n;
 }
 
 struct pending_irq *spi_to_pending(struct domain *d, unsigned int irq)
 {
+    unsigned int idx;
+
     ASSERT(irq >= NR_LOCAL_IRQS);
 
-    return &d->arch.vgic.pending_irqs[irq - 32];
+    if ( is_espi(irq) )
+    {
+        unsigned int nr_spis = d->arch.vgic.nr_spis;
+
+        idx = espi_intid_to_idx(irq) + nr_spis;
+    }
+    else
+    {
+        idx = irq - NR_LOCAL_IRQS;
+    }
+
+    return &d->arch.vgic.pending_irqs[idx];
 }
 
 void vgic_clear_pending_irqs(struct vcpu *v)
@@ -665,10 +822,19 @@ bool vgic_emulate(struct cpu_user_regs *regs, union hsr hsr)
 
 bool vgic_reserve_virq(struct domain *d, unsigned int virq)
 {
+    unsigned int idx = virq;
+
     if ( !vgic_is_valid_line(d, virq) )
         return false;
 
-    return !test_and_set_bit(virq, d->arch.vgic.allocated_irqs);
+    if ( is_espi(virq) )
+    {
+        unsigned int num_regular_irqs = vgic_num_irqs(d);
+
+        idx = espi_intid_to_idx(virq) + num_regular_irqs;
+    }
+
+    return !test_and_set_bit(idx, d->arch.vgic.allocated_irqs);
 }
 
 int vgic_allocate_virq(struct domain *d, bool spi)
@@ -685,7 +851,7 @@ int vgic_allocate_virq(struct domain *d, bool spi)
     else
     {
         first = 32;
-        end = vgic_num_irqs(d);
+        end = vgic_num_alloc_irqs(d);
     }
 
     /*
@@ -700,7 +866,7 @@ int vgic_allocate_virq(struct domain *d, bool spi)
     }
     while ( test_and_set_bit(virq, d->arch.vgic.allocated_irqs) );
 
-    return virq;
+    return idx_to_virq(d, virq);
 }
 
 void vgic_free_virq(struct domain *d, unsigned int virq)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Sep 09 23:45:23 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Sep 2025 23:45:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1117456.1463571 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uw81b-0001uR-7y; Tue, 09 Sep 2025 23:45:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1117456.1463571; Tue, 09 Sep 2025 23: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 1uw81b-0001uJ-5U; Tue, 09 Sep 2025 23:45:23 +0000
Received: by outflank-mailman (input) for mailman id 1117456;
 Tue, 09 Sep 2025 23: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 1uw81a-0001tv-Ky
 for xen-changelog@lists.xenproject.org; Tue, 09 Sep 2025 23: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 1uw81a-001t70-1u
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 23:45:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uw81a-002CUi-1d
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 23: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=IApUBnp7QErwHuN9fo1WqclBjJPcZRF6T48x2WYiNgs=; b=lABfmAEvgpof/ChJZWwVa33wBi
	nXWzvz2ipoGqjOYcLnErG0sZeFUWbibT9xlSKFGi+zFvrn9i1a/eFSStgtNIaLT1ufb4pw1eSLDLe
	3QyPS64cDAoraFSu5rTUN8LkXXh6+og/SZaMnP/ngvO/cGvzT0pwLvQEn2nplYzdaJQE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: domain_build/dom0less-build: adjust domains config to support eSPIs
Message-Id: <E1uw81a-002CUi-1d@xenbits.xenproject.org>
Date: Tue, 09 Sep 2025 23:45:22 +0000

commit b5861cf1114692906db62c36dde5684a2d1ac3be
Author:     Leonid Komarianskyi <Leonid_Komarianskyi@epam.com>
AuthorDate: Tue Sep 9 10:09:29 2025 +0000
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Tue Sep 9 16:32:04 2025 -0700

    xen/arm: domain_build/dom0less-build: adjust domains config to support eSPIs
    
    The Dom0 and DomUs logic for the dom0less configuration in create_dom0()
    and arch_create_domUs() should account for extended SPIs when supported
    by the hardware and enabled with CONFIG_GICV3_ESPI. These changes ensure
    proper calculation of the maximum number of SPIs and eSPIs available to
    Dom0 and DomUs in dom0less setups.
    
    When eSPIs are supported by the hardware and CONFIG_GICV3_ESPI is enabled, the
    maximum number of eSPI interrupts is calculated using the ESPI_BASE_INTID
    offset (4096) and is limited to 1024, with 32 IRQs subtracted. To ensure
    compatibility with non-Dom0 domains, this adjustment is applied by the
    toolstack during domain creation, while for Dom0 or DomUs in Dom0, it is
    handled directly during VGIC initialization. If eSPIs are not supported, the
    calculation defaults to using the standard SPI range, with a maximum value of
    992 interrupt lines, as it works currently.
    
    Signed-off-by: Leonid Komarianskyi <leonid_komarianskyi@epam.com>
    Reviewed-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
    Reviewed-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/dom0less-build.c   |  2 +-
 xen/arch/arm/domain_build.c     |  2 +-
 xen/arch/arm/include/asm/vgic.h | 19 +++++++++++++++++++
 3 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/xen/arch/arm/dom0less-build.c b/xen/arch/arm/dom0less-build.c
index f00912a1ca..4181c10538 100644
--- a/xen/arch/arm/dom0less-build.c
+++ b/xen/arch/arm/dom0less-build.c
@@ -326,7 +326,7 @@ int __init arch_parse_dom0less_node(struct dt_device_node *node,
     {
         int vpl011_virq = GUEST_VPL011_SPI;
 
-        d_cfg->arch.nr_spis = VGIC_DEF_NR_SPIS;
+        d_cfg->arch.nr_spis = vgic_def_nr_spis();
 
         /*
          * The VPL011 virq is GUEST_VPL011_SPI, unless direct-map is
diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index 89448fb475..fb8fbb1650 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -2063,7 +2063,7 @@ void __init create_dom0(void)
 
     /* The vGIC for DOM0 is exactly emulating the hardware GIC */
     dom0_cfg.arch.gic_version = XEN_DOMCTL_CONFIG_GIC_NATIVE;
-    dom0_cfg.arch.nr_spis = VGIC_DEF_NR_SPIS;
+    dom0_cfg.arch.nr_spis = vgic_def_nr_spis();
     dom0_cfg.arch.tee_type = tee_get_type();
     dom0_cfg.max_vcpus = dom0_max_vcpus();
 
diff --git a/xen/arch/arm/include/asm/vgic.h b/xen/arch/arm/include/asm/vgic.h
index caffea092b..24a4a968c3 100644
--- a/xen/arch/arm/include/asm/vgic.h
+++ b/xen/arch/arm/include/asm/vgic.h
@@ -357,6 +357,25 @@ extern void vgic_check_inflight_irqs_pending(struct vcpu *v,
 /* Default number of vGIC SPIs. 32 are substracted to cover local IRQs. */
 #define VGIC_DEF_NR_SPIS (min(gic_number_lines(), VGIC_MAX_IRQS) - 32)
 
+static inline unsigned int vgic_def_nr_spis(void)
+{
+#ifdef CONFIG_GICV3_ESPI
+    /*
+     * Check if the hardware supports extended SPIs (even if the appropriate
+     * config is set). If not, the common SPI range will be used. Otherwise
+     * return the maximum eSPI INTID, supported by HW GIC, subtracted by 32.
+     * For Dom0 and started at boot time DomUs we will add back this value
+     * during VGIC initialization. This ensures consistent handling for Dom0
+     * and other domains. For the regular SPI range interrupts in this case,
+     * the maximum value of VGIC_DEF_NR_SPIS will be used.
+     */
+    if ( gic_number_espis() > 0 )
+        return ESPI_BASE_INTID + min(gic_number_espis(), 1024U) - 32;
+#endif
+
+    return VGIC_DEF_NR_SPIS;
+}
+
 extern bool vgic_is_valid_line(struct domain *d, unsigned int virq);
 
 static inline bool vgic_is_spi(struct domain *d, unsigned int virq)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Sep 09 23:45:33 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Sep 2025 23:45:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1117457.1463574 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uw81l-0001we-9Q; Tue, 09 Sep 2025 23:45:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1117457.1463574; Tue, 09 Sep 2025 23: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 1uw81l-0001wX-6v; Tue, 09 Sep 2025 23:45:33 +0000
Received: by outflank-mailman (input) for mailman id 1117457;
 Tue, 09 Sep 2025 23: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 1uw81k-0001wP-N9
 for xen-changelog@lists.xenproject.org; Tue, 09 Sep 2025 23: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 1uw81k-001t77-2D
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 23:45:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uw81k-002CVM-26
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 23: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=vTw+c7vZKc0sXIXR7DHFlJURugIkEh8z9ZSROrSC1ek=; b=4y6ab7SWAlmxXKV0TPgpIhd2zi
	dkaeMo6KuRl3yF+xSkv+dXQqdCxPhlCIi1gsYusLMtrv/3u7HubVvKMMh6KVxpx++ZXVF2ltuyw7H
	5pRNahVQL/4HJlfHiMxJ3pwx3LHf6BdUhjucBw/guVeELm6ZDQyy+Rs4kfttTGaeRNeg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: vgic-v3: add emulation of GICv3.1 eSPI registers
Message-Id: <E1uw81k-002CVM-26@xenbits.xenproject.org>
Date: Tue, 09 Sep 2025 23:45:32 +0000

commit 93eecb2c4b88ff79e20fa842a1e8799b0b801460
Author:     Leonid Komarianskyi <Leonid_Komarianskyi@epam.com>
AuthorDate: Tue Sep 9 10:09:31 2025 +0000
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Tue Sep 9 16:32:05 2025 -0700

    xen/arm: vgic-v3: add emulation of GICv3.1 eSPI registers
    
    Implemented support for GICv3.1 extended SPI registers for vGICv3,
    allowing the emulation of eSPI-specific behavior for guest domains.
    The implementation includes read and write emulation for eSPI-related
    registers (e.g., GICD_ISENABLERnE, GICD_IROUTERnE, and others),
    following a similar approach to the handling of regular SPIs.
    
    The eSPI registers, previously located in reserved address ranges,
    are now adjusted to support MMIO read and write operations correctly
    when CONFIG_GICV3_ESPI is enabled.
    
    The availability of eSPIs and the number of emulated extended SPIs
    for guest domains is reported by setting the appropriate bits in the
    GICD_TYPER register, based on the number of eSPIs requested by the
    domain and supported by the hardware. In cases where the configuration
    option is disabled, the hardware does not support eSPIs, or the domain
    does not request such interrupts, the functionality remains unchanged.
    
    Signed-off-by: Leonid Komarianskyi <leonid_komarianskyi@epam.com>
    Reviewed-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/include/asm/vgic.h |   4 +
 xen/arch/arm/vgic-v3.c          | 203 +++++++++++++++++++++++++++++++---------
 xen/arch/arm/vgic.c             |  22 +++++
 3 files changed, 185 insertions(+), 44 deletions(-)

diff --git a/xen/arch/arm/include/asm/vgic.h b/xen/arch/arm/include/asm/vgic.h
index 24a4a968c3..31b3d3e5ec 100644
--- a/xen/arch/arm/include/asm/vgic.h
+++ b/xen/arch/arm/include/asm/vgic.h
@@ -324,6 +324,10 @@ extern struct vgic_irq_rank *vgic_rank_offset(struct vcpu *v,
                                               unsigned int b,
                                               unsigned int n,
                                               unsigned int s);
+extern struct vgic_irq_rank *vgic_ext_rank_offset(struct vcpu *v,
+                                                  unsigned int b,
+                                                  unsigned int n,
+                                                  unsigned int s);
 extern struct vgic_irq_rank *vgic_rank_irq(struct vcpu *v, unsigned int irq);
 extern void vgic_disable_irqs(struct vcpu *v, uint32_t r, unsigned int n);
 extern void vgic_enable_irqs(struct vcpu *v, uint32_t r, unsigned int n);
diff --git a/xen/arch/arm/vgic-v3.c b/xen/arch/arm/vgic-v3.c
index 4369c55177..8b1c8eef80 100644
--- a/xen/arch/arm/vgic-v3.c
+++ b/xen/arch/arm/vgic-v3.c
@@ -107,17 +107,12 @@ static uint64_t vgic_fetch_irouter(struct vgic_irq_rank *rank,
 /*
  * Store an IROUTER register in a convenient way and migrate the vIRQ
  * if necessary. This function only deals with IROUTER32 and onwards.
- *
- * Note the offset will be aligned to the appropriate boundary.
  */
 static void vgic_store_irouter(struct domain *d, struct vgic_irq_rank *rank,
-                               unsigned int offset, uint64_t irouter)
+                               unsigned int virq, uint64_t irouter)
 {
     struct vcpu *new_vcpu, *old_vcpu;
-    unsigned int virq;
-
-    /* There is 1 vIRQ per IROUTER */
-    virq = offset / NR_BYTES_PER_IROUTER;
+    unsigned int offset;
 
     /*
      * The IROUTER0-31, used for SGIs/PPIs, are reserved and should
@@ -673,6 +668,36 @@ write_reserved:
     return 1;
 }
 
+/*
+ * The assumption is that offsets below espi_base are for
+ * regular SPI, while those at or above are for eSPI.
+ */
+static inline struct vgic_irq_rank *vgic_common_rank_offset(struct vcpu *v,
+                                                            unsigned int b,
+                                                            uint32_t reg,
+                                                            unsigned int s,
+                                                            uint32_t spi_base,
+                                                            uint32_t espi_base)
+{
+    ASSERT(spi_base < espi_base);
+
+    if ( reg < espi_base )
+        return vgic_rank_offset(v, b, reg - spi_base, s);
+    else
+        return vgic_ext_rank_offset(v, b, reg - espi_base, s);
+}
+
+static inline uint32_t vgic_get_reg_offset(uint32_t reg, uint32_t spi_base,
+                                           uint32_t espi_base)
+{
+    ASSERT(spi_base < espi_base);
+
+    if ( reg < espi_base )
+        return reg - spi_base;
+    else
+        return reg - espi_base;
+}
+
 static int __vgic_v3_distr_common_mmio_read(const char *name, struct vcpu *v,
                                             mmio_info_t *info, uint32_t reg,
                                             register_t *r)
@@ -685,13 +710,17 @@ static int __vgic_v3_distr_common_mmio_read(const char *name, struct vcpu *v,
     {
     case VRANGE32(GICD_IGROUPR, GICD_IGROUPRN):
     case VRANGE32(GICD_IGRPMODR, GICD_IGRPMODRN):
+    case VRANGE32(GICD_IGROUPRnE, GICD_IGROUPRnEN):
+    case VRANGE32(GICD_IGRPMODRnE, GICD_IGRPMODRnEN):
         /* We do not implement security extensions for guests, read zero */
         if ( dabt.size != DABT_WORD ) goto bad_width;
         goto read_as_zero;
 
     case VRANGE32(GICD_ISENABLER, GICD_ISENABLERN):
+    case VRANGE32(GICD_ISENABLERnE, GICD_ISENABLERnEN):
         if ( dabt.size != DABT_WORD ) goto bad_width;
-        rank = vgic_rank_offset(v, 1, reg - GICD_ISENABLER, DABT_WORD);
+        rank = vgic_common_rank_offset(v, 1, reg, DABT_WORD, GICD_ISENABLER,
+                                       GICD_ISENABLERnE);
         if ( rank == NULL ) goto read_as_zero;
         vgic_lock_rank(v, rank, flags);
         *r = vreg_reg32_extract(rank->ienable, info);
@@ -699,8 +728,10 @@ static int __vgic_v3_distr_common_mmio_read(const char *name, struct vcpu *v,
         return 1;
 
     case VRANGE32(GICD_ICENABLER, GICD_ICENABLERN):
+    case VRANGE32(GICD_ICENABLERnE, GICD_ICENABLERnEN):
         if ( dabt.size != DABT_WORD ) goto bad_width;
-        rank = vgic_rank_offset(v, 1, reg - GICD_ICENABLER, DABT_WORD);
+        rank = vgic_common_rank_offset(v, 1, reg, DABT_WORD, GICD_ICENABLER,
+                                       GICD_ICENABLERnE);
         if ( rank == NULL ) goto read_as_zero;
         vgic_lock_rank(v, rank, flags);
         *r = vreg_reg32_extract(rank->ienable, info);
@@ -710,22 +741,29 @@ static int __vgic_v3_distr_common_mmio_read(const char *name, struct vcpu *v,
     /* Read the pending status of an IRQ via GICD/GICR is not supported */
     case VRANGE32(GICD_ISPENDR, GICD_ISPENDRN):
     case VRANGE32(GICD_ICPENDR, GICD_ICPENDRN):
+    case VRANGE32(GICD_ISPENDRnE, GICD_ISPENDRnEN):
+    case VRANGE32(GICD_ICPENDRnE, GICD_ICPENDRnEN):
         goto read_as_zero;
 
     /* Read the active status of an IRQ via GICD/GICR is not supported */
     case VRANGE32(GICD_ISACTIVER, GICD_ISACTIVERN):
     case VRANGE32(GICD_ICACTIVER, GICD_ICACTIVERN):
+    case VRANGE32(GICD_ISACTIVERnE, GICD_ISACTIVERnEN):
+    case VRANGE32(GICD_ICACTIVERnE, GICD_ICACTIVERnEN):
         goto read_as_zero;
 
     case VRANGE32(GICD_IPRIORITYR, GICD_IPRIORITYRN):
+    case VRANGE32(GICD_IPRIORITYRnE, GICD_IPRIORITYRnEN):
     {
-        uint32_t ipriorityr;
+        uint32_t ipriorityr, offset;
         uint8_t rank_index;
 
         if ( dabt.size != DABT_BYTE && dabt.size != DABT_WORD ) goto bad_width;
-        rank = vgic_rank_offset(v, 8, reg - GICD_IPRIORITYR, DABT_WORD);
+        rank = vgic_common_rank_offset(v, 8, reg, DABT_WORD, GICD_IPRIORITYR,
+                                       GICD_IPRIORITYRnE);
         if ( rank == NULL ) goto read_as_zero;
-        rank_index = REG_RANK_INDEX(8, reg - GICD_IPRIORITYR, DABT_WORD);
+        offset = vgic_get_reg_offset(reg, GICD_IPRIORITYR, GICD_IPRIORITYRnE);
+        rank_index = REG_RANK_INDEX(8, offset, DABT_WORD);
 
         vgic_lock_rank(v, rank, flags);
         ipriorityr = ACCESS_ONCE(rank->ipriorityr[rank_index]);
@@ -737,14 +775,17 @@ static int __vgic_v3_distr_common_mmio_read(const char *name, struct vcpu *v,
     }
 
     case VRANGE32(GICD_ICFGR, GICD_ICFGRN):
+    case VRANGE32(GICD_ICFGRnE, GICD_ICFGRnEN):
     {
-        uint32_t icfgr;
+        uint32_t icfgr, offset;
 
         if ( dabt.size != DABT_WORD ) goto bad_width;
-        rank = vgic_rank_offset(v, 2, reg - GICD_ICFGR, DABT_WORD);
+        rank = vgic_common_rank_offset(v, 2, reg, DABT_WORD, GICD_ICFGR,
+                                       GICD_ICFGRnE);
         if ( rank == NULL ) goto read_as_zero;
+        offset = vgic_get_reg_offset(reg, GICD_ICFGR, GICD_ICFGRnE);
         vgic_lock_rank(v, rank, flags);
-        icfgr = rank->icfg[REG_RANK_INDEX(2, reg - GICD_ICFGR, DABT_WORD)];
+        icfgr = rank->icfg[REG_RANK_INDEX(2, offset, DABT_WORD)];
         vgic_unlock_rank(v, rank, flags);
 
         *r = vreg_reg32_extract(icfgr, info);
@@ -782,12 +823,16 @@ static int __vgic_v3_distr_common_mmio_write(const char *name, struct vcpu *v,
     {
     case VRANGE32(GICD_IGROUPR, GICD_IGROUPRN):
     case VRANGE32(GICD_IGRPMODR, GICD_IGRPMODRN):
+    case VRANGE32(GICD_IGROUPRnE, GICD_IGROUPRnEN):
+    case VRANGE32(GICD_IGRPMODRnE, GICD_IGRPMODRnEN):
         /* We do not implement security extensions for guests, write ignore */
         goto write_ignore_32;
 
     case VRANGE32(GICD_ISENABLER, GICD_ISENABLERN):
+    case VRANGE32(GICD_ISENABLERnE, GICD_ISENABLERnEN):
         if ( dabt.size != DABT_WORD ) goto bad_width;
-        rank = vgic_rank_offset(v, 1, reg - GICD_ISENABLER, DABT_WORD);
+        rank = vgic_common_rank_offset(v, 1, reg, DABT_WORD, GICD_ISENABLER,
+                                       GICD_ISENABLERnE);
         if ( rank == NULL ) goto write_ignore;
         vgic_lock_rank(v, rank, flags);
         tr = rank->ienable;
@@ -797,8 +842,10 @@ static int __vgic_v3_distr_common_mmio_write(const char *name, struct vcpu *v,
         return 1;
 
     case VRANGE32(GICD_ICENABLER, GICD_ICENABLERN):
+    case VRANGE32(GICD_ICENABLERnE, GICD_ICENABLERnEN):
         if ( dabt.size != DABT_WORD ) goto bad_width;
-        rank = vgic_rank_offset(v, 1, reg - GICD_ICENABLER, DABT_WORD);
+        rank = vgic_common_rank_offset(v, 1, reg, DABT_WORD, GICD_ICENABLER,
+                                       GICD_ICENABLERnE);
         if ( rank == NULL ) goto write_ignore;
         vgic_lock_rank(v, rank, flags);
         tr = rank->ienable;
@@ -808,8 +855,10 @@ static int __vgic_v3_distr_common_mmio_write(const char *name, struct vcpu *v,
         return 1;
 
     case VRANGE32(GICD_ISPENDR, GICD_ISPENDRN):
+    case VRANGE32(GICD_ISPENDRnE, GICD_ISPENDRnEN):
         if ( dabt.size != DABT_WORD ) goto bad_width;
-        rank = vgic_rank_offset(v, 1, reg - GICD_ISPENDR, DABT_WORD);
+        rank = vgic_common_rank_offset(v, 1, reg, DABT_WORD, GICD_ISPENDR,
+                                       GICD_ISPENDRnE);
         if ( rank == NULL ) goto write_ignore;
 
         vgic_set_irqs_pending(v, r, rank->index);
@@ -817,8 +866,10 @@ static int __vgic_v3_distr_common_mmio_write(const char *name, struct vcpu *v,
         return 1;
 
     case VRANGE32(GICD_ICPENDR, GICD_ICPENDRN):
+    case VRANGE32(GICD_ICPENDRnE, GICD_ICPENDRnEN):
         if ( dabt.size != DABT_WORD ) goto bad_width;
-        rank = vgic_rank_offset(v, 1, reg - GICD_ICPENDR, DABT_WORD);
+        rank = vgic_common_rank_offset(v, 1, reg, DABT_WORD, GICD_ICPENDR,
+                                       GICD_ICPENDRnE);
         if ( rank == NULL ) goto write_ignore;
 
         vgic_check_inflight_irqs_pending(v, rank->index, r);
@@ -826,28 +877,42 @@ static int __vgic_v3_distr_common_mmio_write(const char *name, struct vcpu *v,
         goto write_ignore;
 
     case VRANGE32(GICD_ISACTIVER, GICD_ISACTIVERN):
+    case VRANGE32(GICD_ISACTIVERnE, GICD_ISACTIVERnEN):
         if ( dabt.size != DABT_WORD ) goto bad_width;
-        printk(XENLOG_G_ERR
-               "%pv: %s: unhandled word write %#"PRIregister" to ISACTIVER%d\n",
-               v, name, r, reg - GICD_ISACTIVER);
+        if ( reg < GICD_ISACTIVERnE )
+            printk(XENLOG_G_ERR
+                   "%pv: %s: unhandled word write %#"PRIregister" to ISACTIVER%d\n",
+                   v, name, r, reg - GICD_ISACTIVER);
+        else
+            printk(XENLOG_G_ERR
+                   "%pv: %s: unhandled word write %#"PRIregister" to ISACTIVER%dE\n",
+                   v, name, r, reg - GICD_ISACTIVERnE);
         return 0;
 
     case VRANGE32(GICD_ICACTIVER, GICD_ICACTIVERN):
-        printk(XENLOG_G_ERR
-               "%pv: %s: unhandled word write %#"PRIregister" to ICACTIVER%d\n",
-               v, name, r, reg - GICD_ICACTIVER);
+    case VRANGE32(GICD_ICACTIVERnE, GICD_ICACTIVERnEN):
+        if ( reg < GICD_ICACTIVERnE )
+            printk(XENLOG_G_ERR
+                   "%pv: %s: unhandled word write %#"PRIregister" to ICACTIVER%d\n",
+                   v, name, r, reg - GICD_ICACTIVER);
+        else
+            printk(XENLOG_G_ERR
+                   "%pv: %s: unhandled word write %#"PRIregister" to ICACTIVER%dE\n",
+                   v, name, r, reg - GICD_ICACTIVERnE);
         goto write_ignore_32;
 
     case VRANGE32(GICD_IPRIORITYR, GICD_IPRIORITYRN):
+    case VRANGE32(GICD_IPRIORITYRnE, GICD_IPRIORITYRnEN):
     {
-        uint32_t *ipriorityr, priority;
+        uint32_t *ipriorityr, priority, offset;
 
         if ( dabt.size != DABT_BYTE && dabt.size != DABT_WORD ) goto bad_width;
-        rank = vgic_rank_offset(v, 8, reg - GICD_IPRIORITYR, DABT_WORD);
+        rank = vgic_common_rank_offset(v, 8, reg, DABT_WORD, GICD_IPRIORITYR,
+                                       GICD_IPRIORITYRnE);
         if ( rank == NULL ) goto write_ignore;
+        offset = vgic_get_reg_offset(reg, GICD_IPRIORITYR, GICD_IPRIORITYRnE);
         vgic_lock_rank(v, rank, flags);
-        ipriorityr = &rank->ipriorityr[REG_RANK_INDEX(8, reg - GICD_IPRIORITYR,
-                                                      DABT_WORD)];
+        ipriorityr = &rank->ipriorityr[REG_RANK_INDEX(8, offset, DABT_WORD)];
         priority = ACCESS_ONCE(*ipriorityr);
         vreg_reg32_update(&priority, r, info);
         ACCESS_ONCE(*ipriorityr) = priority;
@@ -859,17 +924,23 @@ static int __vgic_v3_distr_common_mmio_write(const char *name, struct vcpu *v,
         goto write_ignore_32;
 
     case VRANGE32(GICD_ICFGR + 4, GICD_ICFGRN): /* PPI + SPIs */
+    case VRANGE32(GICD_ICFGRnE, GICD_ICFGRnEN):
+    {
+        uint32_t offset;
+
         /* ICFGR1 for PPI's, which is implementation defined
            if ICFGR1 is programmable or not. We chose to program */
         if ( dabt.size != DABT_WORD ) goto bad_width;
-        rank = vgic_rank_offset(v, 2, reg - GICD_ICFGR, DABT_WORD);
+        rank = vgic_common_rank_offset(v, 2, reg, DABT_WORD, GICD_ICFGR,
+                                       GICD_ICFGRnE);
         if ( rank == NULL ) goto write_ignore;
+        offset = vgic_get_reg_offset(reg, GICD_ICFGR, GICD_ICFGRnE);
         vgic_lock_rank(v, rank, flags);
-        vreg_reg32_update(&rank->icfg[REG_RANK_INDEX(2, reg - GICD_ICFGR,
-                                                     DABT_WORD)],
+        vreg_reg32_update(&rank->icfg[REG_RANK_INDEX(2, offset, DABT_WORD)],
                           r, info);
         vgic_unlock_rank(v, rank, flags);
         return 1;
+    }
 
     default:
         printk(XENLOG_G_ERR
@@ -1129,6 +1200,16 @@ static int vgic_v3_distr_mmio_read(struct vcpu *v, mmio_info_t *info,
             typer |= GICD_TYPE_LPIS;
 
         typer |= (v->domain->arch.vgic.intid_bits - 1) << GICD_TYPE_ID_BITS_SHIFT;
+#ifdef CONFIG_GICV3_ESPI
+        if ( v->domain->arch.vgic.nr_espis > 0 )
+        {
+            /* Set eSPI support bit for the domain */
+            typer |= GICD_TYPER_ESPI;
+            /* Set ESPI range bits */
+            typer |= (DIV_ROUND_UP(v->domain->arch.vgic.nr_espis, 32) - 1)
+                       << GICD_TYPER_ESPI_RANGE_SHIFT;
+        }
+#endif
 
         *r = vreg_reg32_extract(typer, info);
 
@@ -1194,6 +1275,16 @@ static int vgic_v3_distr_mmio_read(struct vcpu *v, mmio_info_t *info,
     case VRANGE32(GICD_IPRIORITYR, GICD_IPRIORITYRN):
     case VRANGE32(GICD_ICFGR, GICD_ICFGRN):
     case VRANGE32(GICD_IGRPMODR, GICD_IGRPMODRN):
+    case VRANGE32(GICD_IGROUPRnE, GICD_IGROUPRnEN):
+    case VRANGE32(GICD_ISENABLERnE, GICD_ISENABLERnEN):
+    case VRANGE32(GICD_ICENABLERnE, GICD_ICENABLERnEN):
+    case VRANGE32(GICD_ISPENDRnE, GICD_ISPENDRnEN):
+    case VRANGE32(GICD_ICPENDRnE, GICD_ICPENDRnEN):
+    case VRANGE32(GICD_ISACTIVERnE, GICD_ISACTIVERnEN):
+    case VRANGE32(GICD_ICACTIVERnE, GICD_ICACTIVERnEN):
+    case VRANGE32(GICD_IPRIORITYRnE, GICD_IPRIORITYRnEN):
+    case VRANGE32(GICD_ICFGRnE, GICD_ICFGRnEN):
+    case VRANGE32(GICD_IGRPMODRnE, GICD_IGRPMODRnEN):
         /*
          * Above all register are common with GICR and GICD
          * Manage in common
@@ -1201,6 +1292,7 @@ static int vgic_v3_distr_mmio_read(struct vcpu *v, mmio_info_t *info,
         return __vgic_v3_distr_common_mmio_read("vGICD", v, info, gicd_reg, r);
 
     case VRANGE32(GICD_NSACR, GICD_NSACRN):
+    case VRANGE32(GICD_NSACRnE, GICD_NSACRnEN):
         /* We do not implement security extensions for guests, read zero */
         goto read_as_zero_32;
 
@@ -1216,27 +1308,30 @@ static int vgic_v3_distr_mmio_read(struct vcpu *v, mmio_info_t *info,
         /* Replaced with GICR_ISPENDR0. So ignore write */
         goto read_as_zero_32;
 
-    case VRANGE32(0x0F30, 0x60FC):
+    case VRANGE32(0x0F30, 0x0FFC):
         goto read_reserved;
 
     case VRANGE64(GICD_IROUTER32, GICD_IROUTER1019):
+    case VRANGE64(GICD_IROUTERnE, GICD_IROUTERnEN):
     {
         uint64_t irouter;
+        uint32_t offset;
 
         if ( !vgic_reg64_check_access(dabt) ) goto bad_width;
-        rank = vgic_rank_offset(v, 64, gicd_reg - GICD_IROUTER,
-                                DABT_DOUBLE_WORD);
+        rank = vgic_common_rank_offset(v, 64, gicd_reg, DABT_DOUBLE_WORD,
+                                       GICD_IROUTER, GICD_IROUTERnE);
         if ( rank == NULL ) goto read_as_zero;
+        offset = vgic_get_reg_offset(gicd_reg, GICD_IROUTER, GICD_IROUTERnE);
         vgic_lock_rank(v, rank, flags);
-        irouter = vgic_fetch_irouter(rank, gicd_reg - GICD_IROUTER);
+        irouter = vgic_fetch_irouter(rank, offset);
         vgic_unlock_rank(v, rank, flags);
 
         *r = vreg_reg64_extract(irouter, info);
 
         return 1;
     }
-
-    case VRANGE32(0x7FE0, 0xBFFC):
+    case VRANGE32(0x3700, 0x60FC):
+    case VRANGE32(0xA004, 0xBFFC):
         goto read_reserved;
 
     case VRANGE32(0xC000, 0xFFCC):
@@ -1382,12 +1477,23 @@ static int vgic_v3_distr_mmio_write(struct vcpu *v, mmio_info_t *info,
     case VRANGE32(GICD_IPRIORITYR, GICD_IPRIORITYRN):
     case VRANGE32(GICD_ICFGR, GICD_ICFGRN):
     case VRANGE32(GICD_IGRPMODR, GICD_IGRPMODRN):
+    case VRANGE32(GICD_IGROUPRnE, GICD_IGROUPRnEN):
+    case VRANGE32(GICD_ISENABLERnE, GICD_ISENABLERnEN):
+    case VRANGE32(GICD_ICENABLERnE, GICD_ICENABLERnEN):
+    case VRANGE32(GICD_ISPENDRnE, GICD_ISPENDRnEN):
+    case VRANGE32(GICD_ICPENDRnE, GICD_ICPENDRnEN):
+    case VRANGE32(GICD_ISACTIVERnE, GICD_ISACTIVERnEN):
+    case VRANGE32(GICD_ICACTIVERnE, GICD_ICACTIVERnEN):
+    case VRANGE32(GICD_IPRIORITYRnE, GICD_IPRIORITYRnEN):
+    case VRANGE32(GICD_ICFGRnE, GICD_ICFGRnEN):
+    case VRANGE32(GICD_IGRPMODRnE, GICD_IGRPMODRnEN):
         /* Above registers are common with GICR and GICD
          * Manage in common */
         return __vgic_v3_distr_common_mmio_write("vGICD", v, info,
                                                  gicd_reg, r);
 
     case VRANGE32(GICD_NSACR, GICD_NSACRN):
+    case VRANGE32(GICD_NSACRnE, GICD_NSACRnEN):
         /* We do not implement security extensions for guests, write ignore */
         goto write_ignore_32;
 
@@ -1405,26 +1511,35 @@ static int vgic_v3_distr_mmio_write(struct vcpu *v, mmio_info_t *info,
         if ( dabt.size != DABT_WORD ) goto bad_width;
         return 0;
 
-    case VRANGE32(0x0F30, 0x60FC):
+    case VRANGE32(0x0F30, 0x0FFC):
         goto write_reserved;
 
     case VRANGE64(GICD_IROUTER32, GICD_IROUTER1019):
+    case VRANGE64(GICD_IROUTERnE, GICD_IROUTERnEN):
     {
         uint64_t irouter;
+        unsigned int offset, virq;
 
         if ( !vgic_reg64_check_access(dabt) ) goto bad_width;
-        rank = vgic_rank_offset(v, 64, gicd_reg - GICD_IROUTER,
-                                DABT_DOUBLE_WORD);
+        rank = vgic_common_rank_offset(v, 64, gicd_reg, DABT_DOUBLE_WORD,
+                                       GICD_IROUTER, GICD_IROUTERnE);
         if ( rank == NULL ) goto write_ignore;
+        offset = vgic_get_reg_offset(gicd_reg, GICD_IROUTER, GICD_IROUTERnE);
         vgic_lock_rank(v, rank, flags);
-        irouter = vgic_fetch_irouter(rank, gicd_reg - GICD_IROUTER);
+        irouter = vgic_fetch_irouter(rank, offset);
         vreg_reg64_update(&irouter, r, info);
-        vgic_store_irouter(v->domain, rank, gicd_reg - GICD_IROUTER, irouter);
+        /* There is 1 vIRQ per IROUTER */
+        if ( gicd_reg < GICD_IROUTERnE )
+            virq = offset / NR_BYTES_PER_IROUTER;
+        else
+            virq = espi_idx_to_intid(offset / NR_BYTES_PER_IROUTER);
+        vgic_store_irouter(v->domain, rank, virq, irouter);
         vgic_unlock_rank(v, rank, flags);
         return 1;
     }
 
-    case VRANGE32(0x7FE0, 0xBFFC):
+    case VRANGE32(0x3700, 0x60FC):
+    case VRANGE32(0xA004, 0xBFFC):
         goto write_reserved;
 
     case VRANGE32(0xC000, 0xFFCC):
diff --git a/xen/arch/arm/vgic.c b/xen/arch/arm/vgic.c
index eb22de6aa6..3ebdf9953f 100644
--- a/xen/arch/arm/vgic.c
+++ b/xen/arch/arm/vgic.c
@@ -170,6 +170,18 @@ int domain_vgic_register(struct domain *d, unsigned int *mmio_count)
 }
 
 #ifdef CONFIG_GICV3_ESPI
+/*
+ * The function behavior is the same as for regular SPIs (vgic_rank_offset),
+ * but it operates with extended SPI ranks.
+ */
+struct vgic_irq_rank *vgic_ext_rank_offset(struct vcpu *v, unsigned int b,
+                                           unsigned int n, unsigned int s)
+{
+    unsigned int rank = REG_RANK_NR(b, (n >> s));
+
+    return vgic_get_rank(v, rank + EXT_RANK_MIN);
+}
+
 static unsigned int vgic_num_spi_lines(struct domain *d)
 {
     return d->arch.vgic.nr_spis + d->arch.vgic.nr_espis;
@@ -210,6 +222,16 @@ static unsigned int vgic_num_spi_lines(struct domain *d)
     return d->arch.vgic.nr_spis;
 }
 
+/*
+ * It is expected that, in the case of CONFIG_GICV3_ESPI=n, the function will
+ * return NULL. In this scenario, mmio_read/mmio_write will be treated as
+ * RAZ/WI, as expected.
+ */
+struct vgic_irq_rank *vgic_ext_rank_offset(struct vcpu *v, unsigned int b,
+                                           unsigned int n, unsigned int s)
+{
+    return NULL;
+}
 #endif
 
 static unsigned int vgic_num_alloc_irqs(struct domain *d)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Sep 09 23:45:43 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Sep 2025 23:45:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1117458.1463579 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uw81v-0001z7-CW; Tue, 09 Sep 2025 23:45:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1117458.1463579; Tue, 09 Sep 2025 23: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 1uw81v-0001z0-9v; Tue, 09 Sep 2025 23:45:43 +0000
Received: by outflank-mailman (input) for mailman id 1117458;
 Tue, 09 Sep 2025 23: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 1uw81u-0001yu-Q1
 for xen-changelog@lists.xenproject.org; Tue, 09 Sep 2025 23: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 1uw81u-001t7D-2V
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 23:45:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uw81u-002CVq-2P
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 23: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=fVuX9FNDthlFayXWqg9tlZdot06ioz5ewp8nYgroMvg=; b=mRy7s6P8LLsN67HBBrBDaYocu6
	a8gFJy2s2lliRSNf+VfRXIa+OInjxPoXX+A1NHTJJZvoa4ZaAaSxBW+yePB0dp1ryXpADoK9VKQif
	J+9wQvHJyGd2TSdjYi7gIn6tRoh8GyN3+Vbq2fCY3Sam2xaJnqbeobH7GnBauskGkm7o=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] doc/man: update description for nr_spis with eSPI
Message-Id: <E1uw81u-002CVq-2P@xenbits.xenproject.org>
Date: Tue, 09 Sep 2025 23:45:42 +0000

commit 34ebe8266839a7b9b6618924b11f9086fddf10e7
Author:     Leonid Komarianskyi <Leonid_Komarianskyi@epam.com>
AuthorDate: Tue Sep 9 10:09:35 2025 +0000
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Tue Sep 9 16:32:06 2025 -0700

    doc/man: update description for nr_spis with eSPI
    
    Since eSPI support has been introduced, update the documentation with
    the appropriate description.
    
    Signed-off-by: Leonid Komarianskyi <leonid_komarianskyi@epam.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 docs/man/xl.cfg.5.pod.in | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/docs/man/xl.cfg.5.pod.in b/docs/man/xl.cfg.5.pod.in
index 3b18bcc095..ad1553c5e9 100644
--- a/docs/man/xl.cfg.5.pod.in
+++ b/docs/man/xl.cfg.5.pod.in
@@ -3108,11 +3108,14 @@ interval of colors (such as "0-4").
 =item B<nr_spis="NR_SPIS">
 
 An optional integer parameter specifying the number of SPIs (Shared
-Peripheral Interrupts) to allocate for the domain. Max is 960 SPIs. If
-the `nr_spis` parameter is not specified, the value calculated by the toolstack
-will be used for the domain. Otherwise, the value specified by the `nr_spis`
-parameter will be used. The number of SPIs should match the highest interrupt
-ID that will be assigned to the domain.
+Peripheral Interrupts) to allocate for the domain. Max is 960 for regular SPIs
+or 5088 for eSPIs (Extended SPIs). The eSPIs includes an additional 1024 SPIs
+from the eSPI range (4096 to 5119) if the hardware supports extended SPIs
+(GICv3.1+) and CONFIG_GICV3_ESPI is enabled. If the `nr_spis` parameter is not
+specified, the value calculated by the toolstack will be used for the domain.
+Otherwise, the value specified by the `nr_spis` parameter will be used. The
+number of SPIs should match the highest interrupt ID that will be assigned to
+the domain.
 
 =item B<trap_unmapped_accesses=BOOLEAN>
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Sep 09 23:45:53 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Sep 2025 23:45:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1117459.1463583 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uw825-000218-Dx; Tue, 09 Sep 2025 23:45:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1117459.1463583; Tue, 09 Sep 2025 23: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 1uw825-000210-BN; Tue, 09 Sep 2025 23:45:53 +0000
Received: by outflank-mailman (input) for mailman id 1117459;
 Tue, 09 Sep 2025 23: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 1uw824-00020u-Ss
 for xen-changelog@lists.xenproject.org; Tue, 09 Sep 2025 23: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 1uw824-001t7a-2n
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 23:45:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uw824-002CWq-2g
 for xen-changelog@lists.xenproject.org;
 Tue, 09 Sep 2025 23: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=7sRD3fDDUYewaGD7qc1WFBJbFrk0+iKsaiHYptx7Xk0=; b=0Y/JdxewyTbcMX4mr2Thf7y+Yv
	mPaxHk2hOBdv5jtGcM9FC+ND1lH6Uzu85ks+VODkXXZOqkEIZKrguq46SVzhJde/vDVvvhrX7oFoB
	O2y7KdFjqnqzwDOFWEMV8D18Ts4Z3KfljCauslXdm509Lf0UZgdlQN70t95FgfoHDj18=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] CHANGELOG.md: add mention of GICv3.1 eSPI support
Message-Id: <E1uw824-002CWq-2g@xenbits.xenproject.org>
Date: Tue, 09 Sep 2025 23:45:52 +0000

commit 53c599cc33b61ae70d59572f3c1d843a3def84e2
Author:     Leonid Komarianskyi <Leonid_Komarianskyi@epam.com>
AuthorDate: Tue Sep 9 10:09:39 2025 +0000
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Tue Sep 9 16:32:08 2025 -0700

    CHANGELOG.md: add mention of GICv3.1 eSPI support
    
    The GICv3.1 eSPI (Extended Shared Peripheral Interrupts) range is
    already supported with CONFIG_GICV3_ESPI enabled, so this feature should
    be mentioned in CHANGELOG.md.
    
    Signed-off-by: Leonid Komarianskyi <leonid_komarianskyi@epam.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 cd34ea87b8..7bd96ac09d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -36,6 +36,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
 
  - On Arm:
     - Ability to enable stack protector
+    - GICv3.1 eSPI (Extended Shared Peripheral Interrupts) support for Xen
+      and guest domains.
 
 ### Removed
  - On x86:
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Sep 10 06:00:21 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 10 Sep 2025 06:00:21 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1117546.1463603 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uwDsQ-0003jN-Cu; Wed, 10 Sep 2025 06:00:18 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1117546.1463603; Wed, 10 Sep 2025 06:00:18 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uwDsQ-0003j2-7I; Wed, 10 Sep 2025 06:00:18 +0000
Received: by outflank-mailman (input) for mailman id 1117546;
 Wed, 10 Sep 2025 06: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 1uwDsK-0003ij-EG
 for xen-changelog@lists.xenproject.org; Wed, 10 Sep 2025 06: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 1uwDsK-0038mo-1K
 for xen-changelog@lists.xenproject.org;
 Wed, 10 Sep 2025 06:00:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uwDsK-002Tob-1C
 for xen-changelog@lists.xenproject.org;
 Wed, 10 Sep 2025 06: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=2pX4tOx6ImCjqV3T8lz69pHY/+2Rvc5RvY4YoqgK2io=; b=tFDgo1lSWGJiKmZBzl4zvinb0+
	6GMYGq17iqxI7EwRhmykoithc75voHLXEkLMdfrtvdEveasflram2FQm+RwMCd3XqZ7ZShfjeU2fz
	mzKriEPmwFvNoaxBRkAVXCf1sayjHBsYOh8CHM7cv8JhQJPr337X24h2WtGOhentkfrs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: gic: implement helper functions for INTID checks
Message-Id: <E1uwDsK-002Tob-1C@xenbits.xenproject.org>
Date: Wed, 10 Sep 2025 06:00:12 +0000

commit c2c23ee8db3a6ce4d4d4dfe9b2fd38f898342eea
Author:     Leonid Komarianskyi <Leonid_Komarianskyi@epam.com>
AuthorDate: Tue Sep 9 10:08:59 2025 +0000
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Tue Sep 9 16:31:51 2025 -0700

    xen/arm: gic: implement helper functions for INTID checks
    
    Introduced two new helper functions: gic_is_valid_line and
    gic_is_spi. The first function helps determine whether an IRQ
    number is less than the number of lines supported by hardware. The
    second function additionally checks if the IRQ number falls within the
    SPI range. Also, updated the appropriate checks to use these new helper
    functions.
    
    The current checks for the real GIC are very similar to those for the
    vGIC but serve a different purpose. For GIC-related code, the interrupt
    numbers should be validated based on whether the hardware can operate
    with such interrupts. On the other hand, for the vGIC, the indexes must
    also be verified to ensure they are available for a specific domain. The
    first reason for introducing these helper functions is to avoid
    potential confusion with vGIC-related checks. The second reason is to
    consolidate similar code into separate functions, which can be more
    easily extended by additional conditions, e.g., when implementing
    extended SPI interrupts.
    
    The changes, which replace open-coded checks with the use of the new
    helper functions, do not introduce any functional changes, as the helper
    functions follow the current IRQ index verification logic.
    
    Signed-off-by: Leonid Komarianskyi <leonid_komarianskyi@epam.com>
    Reviewed-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/gic.c             | 3 ++-
 xen/arch/arm/include/asm/gic.h | 9 +++++++++
 xen/arch/arm/irq.c             | 2 +-
 3 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c
index e80fe0ca24..4bb11960ee 100644
--- a/xen/arch/arm/gic.c
+++ b/xen/arch/arm/gic.c
@@ -111,7 +111,8 @@ static void gic_set_irq_priority(struct irq_desc *desc, unsigned int priority)
 void gic_route_irq_to_xen(struct irq_desc *desc, unsigned int priority)
 {
     ASSERT(priority <= 0xff);     /* Only 8 bits of priority */
-    ASSERT(desc->irq < gic_number_lines());/* Can't route interrupts that don't exist */
+    /* Can't route interrupts that don't exist */
+    ASSERT(gic_is_valid_line(desc->irq));
     ASSERT(test_bit(_IRQ_DISABLED, &desc->status));
     ASSERT(spin_is_locked(&desc->lock));
 
diff --git a/xen/arch/arm/include/asm/gic.h b/xen/arch/arm/include/asm/gic.h
index 541f0eeb80..3fcee42675 100644
--- a/xen/arch/arm/include/asm/gic.h
+++ b/xen/arch/arm/include/asm/gic.h
@@ -306,6 +306,15 @@ extern void gic_dump_vgic_info(struct vcpu *v);
 
 /* Number of interrupt lines */
 extern unsigned int gic_number_lines(void);
+static inline bool gic_is_valid_line(unsigned int irq)
+{
+    return irq < gic_number_lines();
+}
+
+static inline bool gic_is_spi(unsigned int irq)
+{
+    return irq >= NR_LOCAL_IRQS && gic_is_valid_line(irq);
+}
 
 /* IRQ translation function for the device tree */
 int gic_irq_xlate(const u32 *intspec, unsigned int intsize,
diff --git a/xen/arch/arm/irq.c b/xen/arch/arm/irq.c
index 02ca82c089..29524e5d53 100644
--- a/xen/arch/arm/irq.c
+++ b/xen/arch/arm/irq.c
@@ -418,7 +418,7 @@ err:
 bool is_assignable_irq(unsigned int irq)
 {
     /* For now, we can only route SPIs to the guest */
-    return (irq >= NR_LOCAL_IRQS) && (irq < gic_number_lines());
+    return gic_is_spi(irq);
 }
 
 /*
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Sep 10 06:00:21 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 10 Sep 2025 06:00:21 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1117547.1463597 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uwDsQ-0003j0-9s; Wed, 10 Sep 2025 06:00:18 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1117547.1463597; Wed, 10 Sep 2025 06:00:18 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uwDsQ-0003ir-6J; Wed, 10 Sep 2025 06:00:18 +0000
Received: by outflank-mailman (input) for mailman id 1117547;
 Wed, 10 Sep 2025 06: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 1uwDsA-0002xS-Dc
 for xen-changelog@lists.xenproject.org; Wed, 10 Sep 2025 06: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 1uwDsA-0038mQ-10
 for xen-changelog@lists.xenproject.org;
 Wed, 10 Sep 2025 06:00:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uwDsA-002TnU-0V
 for xen-changelog@lists.xenproject.org;
 Wed, 10 Sep 2025 06: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=35Pv0ShFwiCxA2X8I8H6W6Pw1Xog+eUjCqcy7TRjp04=; b=NywydL8QcaNVat/MCbvM0+wNR3
	KcBRNYhN4sdbZN8l5kO5DZtnA4eh+SzOZ7Hq7RM8kdWZHFtXjpNrzk49VebiZ3QVL/hWhDAVbUF9D
	v3MbjCJT/BBHT1JINIXn2ntCa/ZdpP2Aqw9D7zU9PXvreom3BQNTA1FYpG99PiMRttjo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: gicv3: refactor obtaining GIC addresses for common operations
Message-Id: <E1uwDsA-002TnU-0V@xenbits.xenproject.org>
Date: Wed, 10 Sep 2025 06:00:02 +0000

commit 93e9cd4c76b31077de1125b2f2c07b694181dacb
Author:     Leonid Komarianskyi <Leonid_Komarianskyi@epam.com>
AuthorDate: Tue Sep 9 10:08:55 2025 +0000
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Tue Sep 9 16:31:49 2025 -0700

    xen/arm: gicv3: refactor obtaining GIC addresses for common operations
    
    Currently, many common functions perform the same operations to calculate
    GIC register addresses. This patch consolidates the similar code into
    a separate helper function to improve maintainability and reduce duplication.
    This refactoring also simplifies the implementation of eSPI support in future
    changes.
    
    Signed-off-by: Leonid Komarianskyi <leonid_komarianskyi@epam.com>
    Reviewed-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
    Reviewed-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/gic-v3.c          | 126 +++++++++++++++++++++++++++++------------
 xen/arch/arm/include/asm/irq.h |   1 +
 2 files changed, 91 insertions(+), 36 deletions(-)

diff --git a/xen/arch/arm/gic-v3.c b/xen/arch/arm/gic-v3.c
index cd3e1acf79..2fdd96dbb1 100644
--- a/xen/arch/arm/gic-v3.c
+++ b/xen/arch/arm/gic-v3.c
@@ -445,17 +445,72 @@ static void gicv3_dump_state(const struct vcpu *v)
     }
 }
 
+static void __iomem *get_addr_by_offset(struct irq_desc *irqd, uint32_t offset)
+{
+    switch ( irqd->irq )
+    {
+    case 0 ... (NR_GIC_LOCAL_IRQS - 1):
+        switch ( offset )
+        {
+        case GICD_ISENABLER:
+        case GICD_ICENABLER:
+        case GICD_ISPENDR:
+        case GICD_ICPENDR:
+        case GICD_ISACTIVER:
+        case GICD_ICACTIVER:
+            return (GICD_RDIST_SGI_BASE + offset);
+        case GICD_ICFGR:
+            return (GICD_RDIST_SGI_BASE + GICR_ICFGR1);
+        case GICD_IPRIORITYR:
+            return (GICD_RDIST_SGI_BASE + GICR_IPRIORITYR0 + irqd->irq);
+        default:
+            /* Invalid register offset for local IRQs */
+            break;
+        }
+        break;
+    case NR_GIC_LOCAL_IRQS ... SPI_MAX_INTID:
+        switch ( offset )
+        {
+        case GICD_ISENABLER:
+        case GICD_ICENABLER:
+        case GICD_ISPENDR:
+        case GICD_ICPENDR:
+        case GICD_ISACTIVER:
+        case GICD_ICACTIVER:
+            return (GICD + offset + (irqd->irq / 32) * 4);
+        case GICD_ICFGR:
+            return (GICD + GICD_ICFGR + (irqd->irq / 16) * 4);
+        case GICD_IROUTER:
+            return (GICD + GICD_IROUTER + irqd->irq * 8);
+        case GICD_IPRIORITYR:
+            return (GICD + GICD_IPRIORITYR + irqd->irq);
+        default:
+            /* Invalid register offset for SPIs */
+            break;
+        }
+        break;
+    default:
+        /* Invalid INTID */
+        break;
+    }
+
+    /* Something went wrong, we shouldn't be able to reach here */
+    printk(XENLOG_WARNING "GICv3: WARNING: Invalid offset 0x%x for IRQ#%u",
+           offset, irqd->irq);
+    ASSERT_UNREACHABLE();
+
+    return NULL;
+}
+
 static void gicv3_poke_irq(struct irq_desc *irqd, u32 offset, bool wait_for_rwp)
 {
     u32 mask = 1U << (irqd->irq % 32);
-    void __iomem *base;
+    void __iomem *addr = get_addr_by_offset(irqd, offset);
 
-    if ( irqd->irq < NR_GIC_LOCAL_IRQS )
-        base = GICD_RDIST_SGI_BASE;
-    else
-        base = GICD;
+    if ( addr == NULL )
+        return;
 
-    writel_relaxed(mask, base + offset + (irqd->irq / 32) * 4);
+    writel_relaxed(mask, addr);
 
     if ( wait_for_rwp )
         gicv3_wait_for_rwp(irqd->irq);
@@ -463,15 +518,13 @@ static void gicv3_poke_irq(struct irq_desc *irqd, u32 offset, bool wait_for_rwp)
 
 static bool gicv3_peek_irq(struct irq_desc *irqd, u32 offset)
 {
-    void __iomem *base;
-    unsigned int irq = irqd->irq;
+    uint32_t mask = 1U << (irqd->irq % 32);
+    void __iomem *addr = get_addr_by_offset(irqd, offset);
 
-    if ( irq >= NR_GIC_LOCAL_IRQS)
-        base = GICD + (irq / 32) * 4;
-    else
-        base = GICD_RDIST_SGI_BASE;
+    if ( addr == NULL )
+        return false;
 
-    return !!(readl(base + offset) & (1U << (irq % 32)));
+    return !!(readl(addr) & mask);
 }
 
 static void gicv3_unmask_irq(struct irq_desc *irqd)
@@ -558,30 +611,28 @@ static inline uint64_t gicv3_mpidr_to_affinity(int cpu)
 static void gicv3_set_irq_type(struct irq_desc *desc, unsigned int type)
 {
     uint32_t cfg, actual, edgebit;
-    void __iomem *base;
-    unsigned int irq = desc->irq;
+    void __iomem *addr;
 
     /* SGI's are always edge-triggered not need to call GICD_ICFGR0 */
-    ASSERT(irq >= NR_GIC_SGI);
+    ASSERT(desc->irq >= NR_GIC_SGI);
 
-    spin_lock(&gicv3.lock);
+    addr = get_addr_by_offset(desc, GICD_ICFGR);
+    if ( addr == NULL )
+        return;
 
-    if ( irq >= NR_GIC_LOCAL_IRQS)
-        base = GICD + GICD_ICFGR + (irq / 16) * 4;
-    else
-        base = GICD_RDIST_SGI_BASE + GICR_ICFGR1;
+    spin_lock(&gicv3.lock);
 
-    cfg = readl_relaxed(base);
+    cfg = readl_relaxed(addr);
 
-    edgebit = 2u << (2 * (irq % 16));
+    edgebit = 2u << (2 * (desc->irq % 16));
     if ( type & IRQ_TYPE_LEVEL_MASK )
         cfg &= ~edgebit;
     else if ( type & IRQ_TYPE_EDGE_BOTH )
         cfg |= edgebit;
 
-    writel_relaxed(cfg, base);
+    writel_relaxed(cfg, addr);
 
-    actual = readl_relaxed(base);
+    actual = readl_relaxed(addr);
     if ( ( cfg & edgebit ) ^ ( actual & edgebit ) )
     {
         printk(XENLOG_WARNING "GICv3: WARNING: "
@@ -600,16 +651,13 @@ static void gicv3_set_irq_type(struct irq_desc *desc, unsigned int type)
 static void gicv3_set_irq_priority(struct irq_desc *desc,
                                    unsigned int priority)
 {
-    unsigned int irq = desc->irq;
-
-    spin_lock(&gicv3.lock);
+    void __iomem *addr = get_addr_by_offset(desc, GICD_IPRIORITYR);
 
-    /* Set priority */
-    if ( irq < NR_GIC_LOCAL_IRQS )
-        writeb_relaxed(priority, GICD_RDIST_SGI_BASE + GICR_IPRIORITYR0 + irq);
-    else
-        writeb_relaxed(priority, GICD + GICD_IPRIORITYR + irq);
+    if ( addr == NULL )
+        return;
 
+    spin_lock(&gicv3.lock);
+    writeb_relaxed(priority, addr);
     spin_unlock(&gicv3.lock);
 }
 
@@ -1273,6 +1321,14 @@ static void gicv3_irq_set_affinity(struct irq_desc *desc, const cpumask_t *mask)
 {
     unsigned int cpu;
     uint64_t affinity;
+    void __iomem *addr;
+
+    if ( desc->irq < NR_GIC_LOCAL_IRQS )
+        return;
+
+    addr = get_addr_by_offset(desc, GICD_IROUTER);
+    if ( addr == NULL )
+        return;
 
     ASSERT(!cpumask_empty(mask));
 
@@ -1282,9 +1338,7 @@ static void gicv3_irq_set_affinity(struct irq_desc *desc, const cpumask_t *mask)
     affinity = gicv3_mpidr_to_affinity(cpu);
     /* Make sure we don't broadcast the interrupt */
     affinity &= ~GICD_IROUTER_SPI_MODE_ANY;
-
-    if ( desc->irq >= NR_GIC_LOCAL_IRQS )
-        writeq_relaxed_non_atomic(affinity, (GICD + GICD_IROUTER + desc->irq * 8));
+    writeq_relaxed_non_atomic(affinity, addr);
 
     spin_unlock(&gicv3.lock);
 }
diff --git a/xen/arch/arm/include/asm/irq.h b/xen/arch/arm/include/asm/irq.h
index fce7e42a33..5bc6475eb4 100644
--- a/xen/arch/arm/include/asm/irq.h
+++ b/xen/arch/arm/include/asm/irq.h
@@ -29,6 +29,7 @@ struct arch_irq_desc {
  */
 #define NR_IRQS		1024
 
+#define SPI_MAX_INTID   1019
 #define LPI_OFFSET      8192
 
 /* LPIs are always numbered starting at 8192, so 0 is a good invalid case. */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Sep 10 06:00:23 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 10 Sep 2025 06:00:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1117548.1463605 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uwDsV-0003lP-B0; Wed, 10 Sep 2025 06:00:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1117548.1463605; Wed, 10 Sep 2025 06: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 1uwDsV-0003lI-8Q; Wed, 10 Sep 2025 06:00:23 +0000
Received: by outflank-mailman (input) for mailman id 1117548;
 Wed, 10 Sep 2025 06: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 1uwDsU-0003lA-Ia
 for xen-changelog@lists.xenproject.org; Wed, 10 Sep 2025 06: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 1uwDsU-0038nD-1h
 for xen-changelog@lists.xenproject.org;
 Wed, 10 Sep 2025 06:00:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uwDsU-002Tp9-1W
 for xen-changelog@lists.xenproject.org;
 Wed, 10 Sep 2025 06: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=SubXpUN8XjOzik0jRZpCUlLT2f7MAdKXc9BKL0QaixU=; b=gM9LqXoAEIw8hquD1SQcBZkIzs
	sd+xdfYbVfxGSCGnW9GrF+068L2yiaeGny+bETrWmwb/z475tuSSsaIcEl9l9yzIPYQcaFtaMh19+
	2sGX6I/+to1wpl+CuFHEQv40b5A7gfdQz3HafnWVkykMMD5k6AWi2LNBKJWqJ3M47KLo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: vgic: implement helper functions for virq checks
Message-Id: <E1uwDsU-002Tp9-1W@xenbits.xenproject.org>
Date: Wed, 10 Sep 2025 06:00:22 +0000

commit 2b8b93fa96cc2918ca407a7ad225f7252080d6c7
Author:     Leonid Komarianskyi <Leonid_Komarianskyi@epam.com>
AuthorDate: Tue Sep 9 10:09:04 2025 +0000
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Tue Sep 9 16:31:51 2025 -0700

    xen/arm: vgic: implement helper functions for virq checks
    
    Introduced two new helper functions for vGIC: vgic_is_valid_line and
    vgic_is_spi. The functions are similar to the newly introduced
    gic_is_valid_line and gic_is_spi, but they verify whether a vIRQ
    is available for a specific domain, while GIC-specific functions
    validate INTIDs for the real GIC hardware. For example, the GIC may
    support all 992 SPI lines, but the domain may use only some part of them
    (e.g., 640), depending on the highest IRQ number defined in the domain
    configuration. Therefore, for vGIC-related code and checks, the
    appropriate functions should be used. Also, updated the appropriate
    checks to use these new helper functions.
    
    The purpose of introducing new helper functions for vGIC is essentially
    the same as for GIC: to avoid potential confusion with GIC-related
    checks and to consolidate similar code into separate functions, which
    can be more easily extended by additional conditions, e.g., when
    implementing extended SPI interrupts.
    
    Only the validation change in vgic_inject_irq may affect existing
    functionality, as it currently checks whether the vIRQ is less than or
    equal to vgic_num_irqs. Since IRQ indexes start from 0 (where 32 is the
    first SPI), the check should behave consistently with similar logic in
    other places and should check if the vIRQ number is less than
    vgic_num_irqs. The remaining changes, which replace open-coded checks
    with the use of these new helper functions, do not introduce any
    functional changes, as the helper functions follow the current vIRQ
    index verification logic.
    
    Signed-off-by: Leonid Komarianskyi <leonid_komarianskyi@epam.com>
    Reviewed-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
    Reviewed-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/gic.c              |  3 +--
 xen/arch/arm/include/asm/vgic.h |  7 +++++++
 xen/arch/arm/irq.c              |  4 ++--
 xen/arch/arm/vgic.c             | 10 ++++++++--
 xen/arch/arm/vgic/vgic.c        |  5 +++++
 5 files changed, 23 insertions(+), 6 deletions(-)

diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c
index 4bb11960ee..9469c9d08c 100644
--- a/xen/arch/arm/gic.c
+++ b/xen/arch/arm/gic.c
@@ -134,8 +134,7 @@ int gic_route_irq_to_guest(struct domain *d, unsigned int virq,
 
     ASSERT(spin_is_locked(&desc->lock));
     /* Caller has already checked that the IRQ is an SPI */
-    ASSERT(virq >= 32);
-    ASSERT(virq < vgic_num_irqs(d));
+    ASSERT(vgic_is_spi(d, virq));
     ASSERT(!is_lpi(virq));
 
     ret = vgic_connect_hw_irq(d, NULL, virq, desc, true);
diff --git a/xen/arch/arm/include/asm/vgic.h b/xen/arch/arm/include/asm/vgic.h
index 35c0c6a8b0..3e7cbbb196 100644
--- a/xen/arch/arm/include/asm/vgic.h
+++ b/xen/arch/arm/include/asm/vgic.h
@@ -335,6 +335,13 @@ extern void vgic_check_inflight_irqs_pending(struct vcpu *v,
 /* Default number of vGIC SPIs. 32 are substracted to cover local IRQs. */
 #define VGIC_DEF_NR_SPIS (min(gic_number_lines(), VGIC_MAX_IRQS) - 32)
 
+extern bool vgic_is_valid_line(struct domain *d, unsigned int virq);
+
+static inline bool vgic_is_spi(struct domain *d, unsigned int virq)
+{
+    return virq >= NR_LOCAL_IRQS && vgic_is_valid_line(d, virq);
+}
+
 /*
  * Allocate a guest VIRQ
  *  - spi == 0 => allocate a PPI. It will be the same on every vCPU
diff --git a/xen/arch/arm/irq.c b/xen/arch/arm/irq.c
index 29524e5d53..0df1e0a7c1 100644
--- a/xen/arch/arm/irq.c
+++ b/xen/arch/arm/irq.c
@@ -445,7 +445,7 @@ int route_irq_to_guest(struct domain *d, unsigned int virq,
     unsigned long flags;
     int retval = 0;
 
-    if ( virq >= vgic_num_irqs(d) )
+    if ( !vgic_is_valid_line(d, virq) )
     {
         printk(XENLOG_G_ERR
                "the vIRQ number %u is too high for domain %u (max = %u)\n",
@@ -563,7 +563,7 @@ int release_guest_irq(struct domain *d, unsigned int virq)
     int ret;
 
     /* Only SPIs are supported */
-    if ( virq < NR_LOCAL_IRQS || virq >= vgic_num_irqs(d) )
+    if ( !vgic_is_spi(d, virq) )
         return -EINVAL;
 
     desc = vgic_get_hw_irq_desc(d, NULL, virq);
diff --git a/xen/arch/arm/vgic.c b/xen/arch/arm/vgic.c
index c563ba93af..2bbf4d99aa 100644
--- a/xen/arch/arm/vgic.c
+++ b/xen/arch/arm/vgic.c
@@ -24,6 +24,12 @@
 #include <asm/gic.h>
 #include <asm/vgic.h>
 
+
+bool vgic_is_valid_line(struct domain *d, unsigned int virq)
+{
+    return virq < vgic_num_irqs(d);
+}
+
 static inline struct vgic_irq_rank *vgic_get_rank(struct vcpu *v,
                                                   unsigned int rank)
 {
@@ -582,7 +588,7 @@ void vgic_inject_irq(struct domain *d, struct vcpu *v, unsigned int virq,
     if ( !v )
     {
         /* The IRQ needs to be an SPI if no vCPU is specified. */
-        ASSERT(virq >= 32 && virq <= vgic_num_irqs(d));
+        ASSERT(vgic_is_spi(d, virq));
 
         v = vgic_get_target_vcpu(d->vcpu[0], virq);
     };
@@ -659,7 +665,7 @@ bool vgic_emulate(struct cpu_user_regs *regs, union hsr hsr)
 
 bool vgic_reserve_virq(struct domain *d, unsigned int virq)
 {
-    if ( virq >= vgic_num_irqs(d) )
+    if ( !vgic_is_valid_line(d, virq) )
         return false;
 
     return !test_and_set_bit(virq, d->arch.vgic.allocated_irqs);
diff --git a/xen/arch/arm/vgic/vgic.c b/xen/arch/arm/vgic/vgic.c
index 6cabd0496d..b2c0e1873a 100644
--- a/xen/arch/arm/vgic/vgic.c
+++ b/xen/arch/arm/vgic/vgic.c
@@ -718,6 +718,11 @@ bool vgic_reserve_virq(struct domain *d, unsigned int virq)
     return !test_and_set_bit(virq, d->arch.vgic.allocated_irqs);
 }
 
+bool vgic_is_valid_line(struct domain *d, unsigned int virq)
+{
+    return virq < vgic_num_irqs(d);
+}
+
 int vgic_allocate_virq(struct domain *d, bool spi)
 {
     int first, end;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Sep 10 06:00:33 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 10 Sep 2025 06:00:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1117549.1463609 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uwDsf-0003pI-EH; Wed, 10 Sep 2025 06:00:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1117549.1463609; Wed, 10 Sep 2025 06: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 1uwDsf-0003p8-BR; Wed, 10 Sep 2025 06:00:33 +0000
Received: by outflank-mailman (input) for mailman id 1117549;
 Wed, 10 Sep 2025 06: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 1uwDse-0003os-L7
 for xen-changelog@lists.xenproject.org; Wed, 10 Sep 2025 06: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 1uwDse-0038ne-21
 for xen-changelog@lists.xenproject.org;
 Wed, 10 Sep 2025 06:00:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uwDse-002TpX-1t
 for xen-changelog@lists.xenproject.org;
 Wed, 10 Sep 2025 06: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=ItlrXWbCtEEBvHOFC5s0M2azeZGiv3TRLOcaMvMiDzQ=; b=26rC3bL9otFTJRxlajHlL9ZTKA
	TgC0aB9wwDwKpVsH6NI6P5GDIUAHx7STx+OdQRB744xTA8nGOiGI1vK3qkR7ln9eaCwDNN5IEsaAu
	byz5mPp8oVFa1ZQ4x8lrmY1XuYvGrEoRLZmWDSGbWYOkbBmvB4snnez4I6ixT1o++e5o=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm/irq: add handling for IRQs in the eSPI range
Message-Id: <E1uwDse-002TpX-1t@xenbits.xenproject.org>
Date: Wed, 10 Sep 2025 06:00:32 +0000

commit 98f7060b9ed5fe7cdde331809096ea6ca3984115
Author:     Leonid Komarianskyi <Leonid_Komarianskyi@epam.com>
AuthorDate: Tue Sep 9 10:09:11 2025 +0000
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Tue Sep 9 16:31:53 2025 -0700

    xen/arm/irq: add handling for IRQs in the eSPI range
    
    Currently, Xen does not support eSPI interrupts, leading
    to a data abort when such interrupts are defined in the DTS.
    
    This patch introduces a separate array to initialize up to
    1024 interrupt descriptors in the eSPI range and adds the
    necessary defines and helper function. These changes lay the
    groundwork for future implementation of full eSPI interrupt
    support. As this GICv3.1 feature is not required by all vendors,
    all changes are guarded by ifdefs, depending on the corresponding
    Kconfig option.
    
    Signed-off-by: Leonid Komarianskyi <leonid_komarianskyi@epam.com>
    Reviewed-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
    Reviewed-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/arch/arm/Kconfig           |  8 ++++++++
 xen/arch/arm/include/asm/irq.h | 37 +++++++++++++++++++++++++++++++++
 xen/arch/arm/irq.c             | 46 ++++++++++++++++++++++++++++++++++++++++--
 3 files changed, 89 insertions(+), 2 deletions(-)

diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig
index 5355534f3d..cf6af68299 100644
--- a/xen/arch/arm/Kconfig
+++ b/xen/arch/arm/Kconfig
@@ -134,6 +134,14 @@ config GICV3
 	  Driver for the ARM Generic Interrupt Controller v3.
 	  If unsure, use the default setting.
 
+config GICV3_ESPI
+	bool "Extended SPI range support"
+	depends on GICV3 && !NEW_VGIC
+	help
+	  Allow Xen and domains to use interrupt numbers from the extended SPI
+	  range, from 4096 to 5119. This feature is introduced in GICv3.1
+	  architecture.
+
 config HAS_ITS
         bool "GICv3 ITS MSI controller support (UNSUPPORTED)" if UNSUPPORTED
         depends on GICV3 && !NEW_VGIC && !ARM_32
diff --git a/xen/arch/arm/include/asm/irq.h b/xen/arch/arm/include/asm/irq.h
index 5bc6475eb4..09788dbfeb 100644
--- a/xen/arch/arm/include/asm/irq.h
+++ b/xen/arch/arm/include/asm/irq.h
@@ -32,6 +32,10 @@ struct arch_irq_desc {
 #define SPI_MAX_INTID   1019
 #define LPI_OFFSET      8192
 
+#define ESPI_BASE_INTID 4096
+#define ESPI_MAX_INTID  5119
+#define NR_ESPI_IRQS    1024
+
 /* LPIs are always numbered starting at 8192, so 0 is a good invalid case. */
 #define INVALID_LPI     0
 
@@ -39,7 +43,12 @@ struct arch_irq_desc {
 #define INVALID_IRQ     1023
 
 extern const unsigned int nr_irqs;
+#ifdef CONFIG_GICV3_ESPI
+/* This will cover the eSPI range, to allow assignment of eSPIs to domains. */
+#define nr_static_irqs (ESPI_MAX_INTID + 1)
+#else
 #define nr_static_irqs NR_IRQS
+#endif
 
 struct irq_desc;
 struct irqaction;
@@ -55,6 +64,34 @@ static inline bool is_lpi(unsigned int irq)
     return irq >= LPI_OFFSET;
 }
 
+static inline bool is_espi(unsigned int irq)
+{
+#ifdef CONFIG_GICV3_ESPI
+    return irq >= ESPI_BASE_INTID && irq <= ESPI_MAX_INTID;
+#else
+    /*
+     * The function should not be called for eSPIs when CONFIG_GICV3_ESPI is
+     * disabled. Returning false allows the compiler to optimize the code
+     * when the config is disabled, while the assert ensures that out-of-range
+     * array resources are not accessed.
+     */
+    ASSERT(!(irq >= ESPI_BASE_INTID && irq <= ESPI_MAX_INTID));
+    return false;
+#endif
+}
+
+static inline unsigned int espi_intid_to_idx(unsigned int intid)
+{
+    ASSERT(is_espi(intid));
+    return intid - ESPI_BASE_INTID;
+}
+
+static inline unsigned int espi_idx_to_intid(unsigned int idx)
+{
+    ASSERT(idx <= NR_ESPI_IRQS);
+    return idx + ESPI_BASE_INTID;
+}
+
 #define domain_pirq_to_irq(d, pirq) (pirq)
 
 bool is_assignable_irq(unsigned int irq);
diff --git a/xen/arch/arm/irq.c b/xen/arch/arm/irq.c
index 0df1e0a7c1..53f5f4612f 100644
--- a/xen/arch/arm/irq.c
+++ b/xen/arch/arm/irq.c
@@ -19,7 +19,9 @@
 #include <asm/gic.h>
 #include <asm/vgic.h>
 
-const unsigned int nr_irqs = NR_IRQS;
+const unsigned int nr_irqs = IS_ENABLED(CONFIG_GICV3_ESPI) ?
+                                        (ESPI_MAX_INTID + 1) :
+                                        NR_IRQS;
 
 static unsigned int local_irqs_type[NR_LOCAL_IRQS];
 static DEFINE_SPINLOCK(local_irqs_type_lock);
@@ -46,6 +48,41 @@ void irq_end_none(struct irq_desc *irq)
 }
 
 static irq_desc_t irq_desc[NR_IRQS - NR_LOCAL_IRQS];
+#ifdef CONFIG_GICV3_ESPI
+/* TODO: Consider allocating an array dynamically */
+static irq_desc_t espi_desc[NR_ESPI_IRQS];
+
+static struct irq_desc *espi_to_desc(unsigned int irq)
+{
+    return &espi_desc[espi_intid_to_idx(irq)];
+}
+
+static int __init init_espi_data(void)
+{
+    unsigned int irq;
+
+    for ( irq = ESPI_BASE_INTID; irq <= ESPI_MAX_INTID; irq++ )
+    {
+        struct irq_desc *desc = irq_to_desc(irq);
+        int rc = init_one_irq_desc(desc);
+
+        if ( rc )
+            return rc;
+
+        desc->irq = irq;
+        desc->action  = NULL;
+    }
+
+    return 0;
+}
+#else
+
+static int __init init_espi_data(void)
+{
+    return 0;
+}
+#endif
+
 static DEFINE_PER_CPU(irq_desc_t[NR_LOCAL_IRQS], local_irq_desc);
 
 struct irq_desc *__irq_to_desc(unsigned int irq)
@@ -53,6 +90,11 @@ struct irq_desc *__irq_to_desc(unsigned int irq)
     if ( irq < NR_LOCAL_IRQS )
         return &this_cpu(local_irq_desc)[irq];
 
+#ifdef CONFIG_GICV3_ESPI
+    if ( is_espi(irq) )
+        return espi_to_desc(irq);
+#endif
+
     return &irq_desc[irq-NR_LOCAL_IRQS];
 }
 
@@ -79,7 +121,7 @@ static int __init init_irq_data(void)
         desc->action  = NULL;
     }
 
-    return 0;
+    return init_espi_data();
 }
 
 static int init_local_irq_data(unsigned int cpu)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Sep 10 06:00:43 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 10 Sep 2025 06:00:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1117550.1463613 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uwDsp-0003s1-Fi; Wed, 10 Sep 2025 06:00:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1117550.1463613; Wed, 10 Sep 2025 06: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 1uwDsp-0003rt-Cq; Wed, 10 Sep 2025 06:00:43 +0000
Received: by outflank-mailman (input) for mailman id 1117550;
 Wed, 10 Sep 2025 06: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 1uwDso-0003rm-OJ
 for xen-changelog@lists.xenproject.org; Wed, 10 Sep 2025 06: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 1uwDso-0038o0-2K
 for xen-changelog@lists.xenproject.org;
 Wed, 10 Sep 2025 06:00:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uwDso-002Tpz-2C
 for xen-changelog@lists.xenproject.org;
 Wed, 10 Sep 2025 06: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=y7QXl3gKdYgFc8PX3E9Vx9+eXdc9Xmw9LQLz9EHrdT8=; b=bpwV5YK41XeMNFBNAdy4MSnUtv
	NF4GS86OsIQVAoq3s8HHsvWstYaAHVUgwZUOuRREDSNlbWqKE4Vp2BvSAiTG4bbh++SslSc4yfxfM
	/cNSE122GWGGgnOVXqjSM6fRtfkiG5w0IhgKeVzzTEwkMe0tsTDAxorhcozLMBAeLMWw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: gicv3: implement handling of GICv3.1 eSPI
Message-Id: <E1uwDso-002Tpz-2C@xenbits.xenproject.org>
Date: Wed, 10 Sep 2025 06:00:42 +0000

commit 60c4e9442cebd71bed7ce5415cf8c93f47be9169
Author:     Leonid Komarianskyi <Leonid_Komarianskyi@epam.com>
AuthorDate: Tue Sep 9 10:09:16 2025 +0000
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Tue Sep 9 16:31:58 2025 -0700

    xen/arm: gicv3: implement handling of GICv3.1 eSPI
    
    Introduced appropriate register definitions, helper macros,
    and initialization of required GICv3.1 distributor registers
    to support eSPI. This type of interrupt is handled in the
    same way as regular SPI interrupts, with the following
    differences:
    
    1) eSPIs can have up to 1024 interrupts, starting from the
    beginning of the range, whereas regular SPIs use INTIDs from
    32 to 1019, totaling 988 interrupts;
    2) eSPIs start at INTID 4096, necessitating additional interrupt
    index conversion during register operations.
    
    In case if appropriate config is disabled, or GIC HW doesn't
    support eSPI, the existing functionality will remain the same.
    
    Signed-off-by: Leonid Komarianskyi <leonid_komarianskyi@epam.com>
    Reviewed-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/gic-v3.c                  | 85 ++++++++++++++++++++++++++++++++++
 xen/arch/arm/include/asm/gic.h         | 21 ++++++++-
 xen/arch/arm/include/asm/gic_v3_defs.h | 38 +++++++++++++++
 3 files changed, 143 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/gic-v3.c b/xen/arch/arm/gic-v3.c
index 2fdd96dbb1..bc07f97c16 100644
--- a/xen/arch/arm/gic-v3.c
+++ b/xen/arch/arm/gic-v3.c
@@ -489,6 +489,38 @@ static void __iomem *get_addr_by_offset(struct irq_desc *irqd, uint32_t offset)
             break;
         }
         break;
+#ifdef CONFIG_GICV3_ESPI
+    case ESPI_BASE_INTID ... ESPI_MAX_INTID:
+    {
+        uint32_t irq_index = espi_intid_to_idx(irqd->irq);
+
+        switch ( offset )
+        {
+        case GICD_ISENABLER:
+            return (GICD + GICD_ISENABLERnE + (irq_index / 32) * 4);
+        case GICD_ICENABLER:
+            return (GICD + GICD_ICENABLERnE + (irq_index / 32) * 4);
+        case GICD_ISPENDR:
+            return (GICD + GICD_ISPENDRnE + (irq_index / 32) * 4);
+        case GICD_ICPENDR:
+            return (GICD + GICD_ICPENDRnE + (irq_index / 32) * 4);
+        case GICD_ISACTIVER:
+            return (GICD + GICD_ISACTIVERnE + (irq_index / 32) * 4);
+        case GICD_ICACTIVER:
+            return (GICD + GICD_ICACTIVERnE + (irq_index / 32) * 4);
+        case GICD_ICFGR:
+            return (GICD + GICD_ICFGRnE + (irq_index / 16) * 4);
+        case GICD_IROUTER:
+            return (GICD + GICD_IROUTERnE + irq_index * 8);
+        case GICD_IPRIORITYR:
+            return (GICD + GICD_IPRIORITYRnE + irq_index);
+        default:
+            /* Invalid register offset for eSPIs */
+            break;
+        }
+        break;
+    }
+#endif
     default:
         /* Invalid INTID */
         break;
@@ -661,6 +693,55 @@ static void gicv3_set_irq_priority(struct irq_desc *desc,
     spin_unlock(&gicv3.lock);
 }
 
+#ifdef CONFIG_GICV3_ESPI
+unsigned int gic_number_espis(void)
+{
+    return gic_hw_ops->info->nr_espi;
+}
+
+static void __init gicv3_dist_espi_common_init(uint32_t type)
+{
+    unsigned int espi_nr, i;
+
+    espi_nr = min(1024U, GICD_TYPER_ESPIS_NUM(type));
+    gicv3_info.nr_espi = espi_nr;
+    /* The GIC HW doesn't support eSPI, so we can leave from here */
+    if ( gicv3_info.nr_espi == 0 )
+        return;
+
+    printk("GICv3: %u eSPI lines\n", gicv3_info.nr_espi);
+
+    /* The configuration for eSPIs is similar to that for regular SPIs */
+    for ( i = 0; i < espi_nr; i += 16 )
+        writel_relaxed(0, GICD + GICD_ICFGRnE + (i / 16) * 4);
+
+    for ( i = 0; i < espi_nr; i += 4 )
+        writel_relaxed(GIC_PRI_IRQ_ALL,
+                       GICD + GICD_IPRIORITYRnE + (i / 4) * 4);
+
+    for ( i = 0; i < espi_nr; i += 32 )
+    {
+        writel_relaxed(GENMASK(31, 0), GICD + GICD_ICENABLERnE + (i / 32) * 4);
+        writel_relaxed(GENMASK(31, 0), GICD + GICD_ICACTIVERnE + (i / 32) * 4);
+    }
+
+    for ( i = 0; i < espi_nr; i += 32 )
+        writel_relaxed(GENMASK(31, 0), GICD + GICD_IGROUPRnE + (i / 32) * 4);
+}
+
+static void __init gicv3_dist_espi_init_aff(uint64_t affinity)
+{
+    unsigned int i;
+
+    for ( i = 0; i < gicv3_info.nr_espi; i++ )
+        writeq_relaxed_non_atomic(affinity, GICD + GICD_IROUTERnE + i * 8);
+}
+#else
+static void __init gicv3_dist_espi_common_init(uint32_t type) { }
+
+static void __init gicv3_dist_espi_init_aff(uint64_t affinity) { }
+#endif
+
 static void __init gicv3_dist_init(void)
 {
     uint32_t type;
@@ -706,6 +787,8 @@ static void __init gicv3_dist_init(void)
     for ( i = NR_GIC_LOCAL_IRQS; i < nr_lines; i += 32 )
         writel_relaxed(GENMASK(31, 0), GICD + GICD_IGROUPR + (i / 32) * 4);
 
+    gicv3_dist_espi_common_init(type);
+
     gicv3_dist_wait_for_rwp();
 
     /* Turn on the distributor */
@@ -719,6 +802,8 @@ static void __init gicv3_dist_init(void)
 
     for ( i = NR_GIC_LOCAL_IRQS; i < nr_lines; i++ )
         writeq_relaxed_non_atomic(affinity, GICD + GICD_IROUTER + i * 8);
+
+    gicv3_dist_espi_init_aff(affinity);
 }
 
 static int gicv3_enable_redist(void)
diff --git a/xen/arch/arm/include/asm/gic.h b/xen/arch/arm/include/asm/gic.h
index 3fcee42675..3947c8634d 100644
--- a/xen/arch/arm/include/asm/gic.h
+++ b/xen/arch/arm/include/asm/gic.h
@@ -306,9 +306,24 @@ extern void gic_dump_vgic_info(struct vcpu *v);
 
 /* Number of interrupt lines */
 extern unsigned int gic_number_lines(void);
+#ifdef CONFIG_GICV3_ESPI
+extern unsigned int gic_number_espis(void);
+
+static inline bool gic_is_valid_espi(unsigned int irq)
+{
+    return irq >= ESPI_BASE_INTID &&
+           irq < espi_idx_to_intid(gic_number_espis());
+}
+#else
+static inline bool gic_is_valid_espi(unsigned int irq)
+{
+    return false;
+}
+#endif
+
 static inline bool gic_is_valid_line(unsigned int irq)
 {
-    return irq < gic_number_lines();
+    return irq < gic_number_lines() || gic_is_valid_espi(irq);
 }
 
 static inline bool gic_is_spi(unsigned int irq)
@@ -325,6 +340,10 @@ struct gic_info {
     enum gic_version hw_version;
     /* Number of GIC lines supported */
     unsigned int nr_lines;
+#ifdef CONFIG_GICV3_ESPI
+    /* Number of GIC eSPI supported */
+    unsigned int nr_espi;
+#endif
     /* Number of LR registers */
     uint8_t nr_lrs;
     /* Maintenance irq number */
diff --git a/xen/arch/arm/include/asm/gic_v3_defs.h b/xen/arch/arm/include/asm/gic_v3_defs.h
index 2af093e774..3370b4cd52 100644
--- a/xen/arch/arm/include/asm/gic_v3_defs.h
+++ b/xen/arch/arm/include/asm/gic_v3_defs.h
@@ -37,6 +37,44 @@
 #define GICD_IROUTER1019             (0x7FD8)
 #define GICD_PIDR2                   (0xFFE8)
 
+/* Additional registers for GICv3.1 */
+#define GICD_IGROUPRnE               (0x1000)
+#define GICD_IGROUPRnEN              (0x107C)
+#define GICD_ISENABLERnE             (0x1200)
+#define GICD_ISENABLERnEN            (0x127C)
+#define GICD_ICENABLERnE             (0x1400)
+#define GICD_ICENABLERnEN            (0x147C)
+#define GICD_ISPENDRnE               (0x1600)
+#define GICD_ISPENDRnEN              (0x167C)
+#define GICD_ICPENDRnE               (0x1800)
+#define GICD_ICPENDRnEN              (0x187C)
+#define GICD_ISACTIVERnE             (0x1A00)
+#define GICD_ISACTIVERnEN            (0x1A7C)
+#define GICD_ICACTIVERnE             (0x1C00)
+#define GICD_ICACTIVERnEN            (0x1C7C)
+#define GICD_IPRIORITYRnE            (0x2000)
+#define GICD_IPRIORITYRnEN           (0x23FC)
+#define GICD_ICFGRnE                 (0x3000)
+#define GICD_ICFGRnEN                (0x30FC)
+#define GICD_IGRPMODRnE              (0x3400)
+#define GICD_IGRPMODRnEN             (0x347C)
+#define GICD_NSACRnE                 (0x3600)
+#define GICD_NSACRnEN                (0x36FC)
+#define GICD_IROUTERnE               (0x8000)
+#define GICD_IROUTERnEN              (0x9FFC)
+
+#ifdef CONFIG_GICV3_ESPI
+#define GICD_TYPER_ESPI_SHIFT        8
+#define GICD_TYPER_ESPI_RANGE_SHIFT  27
+#define GICD_TYPER_ESPI_RANGE_MASK   (0x1F)
+#define GICD_TYPER_ESPI              (1U << GICD_TYPER_ESPI_SHIFT)
+#define GICD_TYPER_ESPI_RANGE(espi_range) ((((espi_range) & \
+        GICD_TYPER_ESPI_RANGE_MASK) + 1) * 32)
+#define GICD_TYPER_ESPIS_NUM(typer)    \
+        (((typer) & GICD_TYPER_ESPI) ? \
+        GICD_TYPER_ESPI_RANGE((typer) >> GICD_TYPER_ESPI_RANGE_SHIFT) : 0)
+#endif
+
 /* Common between GICD_PIDR2 and GICR_PIDR2 */
 #define GIC_PIDR2_ARCH_MASK         (0xf0)
 #define GIC_PIDR2_ARCH_GICv3        (0x30)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Sep 10 06:00:54 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 10 Sep 2025 06:00:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1117551.1463617 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uwDt0-0003uN-H1; Wed, 10 Sep 2025 06:00:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1117551.1463617; Wed, 10 Sep 2025 06: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 1uwDt0-0003uF-EE; Wed, 10 Sep 2025 06:00:54 +0000
Received: by outflank-mailman (input) for mailman id 1117551;
 Wed, 10 Sep 2025 06: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 1uwDsy-0003u4-Rv
 for xen-changelog@lists.xenproject.org; Wed, 10 Sep 2025 06: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 1uwDsy-0038oQ-2h
 for xen-changelog@lists.xenproject.org;
 Wed, 10 Sep 2025 06:00:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uwDsy-002TqO-2V
 for xen-changelog@lists.xenproject.org;
 Wed, 10 Sep 2025 06: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=sOUASJDCoO1GbM2eGwfG53hE4FBpAU+74kzZWnOniD8=; b=PdWkh5oGZc9onj8hqXoDLV8P94
	gxZgDzD0x31O8QwBrwOL0MfPgMQZCGh4aeMG2NjLJT+TbnrwP5h6AwI24iKUe6KNhR/4YNh8pf6Po
	6aZFsQ63NNH0S9w2yFmnbO3nyuGuc8zND9TOytQQpUmTRmRlZwSHhu84GUCLwvk8AR8Q=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm/irq: allow eSPI processing in the gic_interrupt function
Message-Id: <E1uwDsy-002TqO-2V@xenbits.xenproject.org>
Date: Wed, 10 Sep 2025 06:00:52 +0000

commit 54ba8a8d047a74609000d49bc676edc19bc1e5d6
Author:     Leonid Komarianskyi <Leonid_Komarianskyi@epam.com>
AuthorDate: Tue Sep 9 10:09:20 2025 +0000
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Tue Sep 9 16:32:00 2025 -0700

    xen/arm/irq: allow eSPI processing in the gic_interrupt function
    
    The gic_interrupt function is the main handler for processing IRQs.
    Currently, due to restrictive checks, it does not process interrupt
    numbers greater than 1019. This patch updates the condition to allow
    the handling of interrupts from the eSPI range.
    
    Signed-off-by: Leonid Komarianskyi <leonid_komarianskyi@epam.com>
    Reviewed-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/gic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c
index 9469c9d08c..260ee64cca 100644
--- a/xen/arch/arm/gic.c
+++ b/xen/arch/arm/gic.c
@@ -342,7 +342,7 @@ void gic_interrupt(struct cpu_user_regs *regs, int is_fiq)
         /* Reading IRQ will ACK it */
         irq = gic_hw_ops->read_irq();
 
-        if ( likely(irq >= GIC_SGI_STATIC_MAX && irq < 1020) )
+        if ( likely(irq >= GIC_SGI_STATIC_MAX && irq < 1020) || is_espi(irq) )
         {
             isb();
             do_IRQ(regs, irq, is_fiq);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Sep 10 06:01:04 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 10 Sep 2025 06:01:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1117552.1463621 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uwDtA-0003wM-IN; Wed, 10 Sep 2025 06:01:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1117552.1463621; Wed, 10 Sep 2025 06: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 1uwDtA-0003wE-Fb; Wed, 10 Sep 2025 06:01:04 +0000
Received: by outflank-mailman (input) for mailman id 1117552;
 Wed, 10 Sep 2025 06: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 1uwDt8-0003w8-Ut
 for xen-changelog@lists.xenproject.org; Wed, 10 Sep 2025 06: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 1uwDt8-0038pI-2x
 for xen-changelog@lists.xenproject.org;
 Wed, 10 Sep 2025 06:01:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uwDt8-002Tr8-2s
 for xen-changelog@lists.xenproject.org;
 Wed, 10 Sep 2025 06: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=lYSFDGsSUgvFWi4cUY9D4F3YIh87H31TIYstoRNpvOk=; b=MbmzRoLpE0YRTYXVKZzVeiVNUf
	ub2yu7yeniTHdVf4QJN95w+2zf7uVUhzWBCXOeUf/Jk5PHoArGbpmS7IYexc/9e4R6C6wehYrxM++
	CtLSp3OdLauAWdct4IWZuRXwCBvX3vQqh3PISTSJyGh1Ww2gySeb7WqER7q15OejLhbw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: gicv3: modify ICH_LR_PHYSICAL_MASK to allow eSPI processing
Message-Id: <E1uwDt8-002Tr8-2s@xenbits.xenproject.org>
Date: Wed, 10 Sep 2025 06:01:02 +0000

commit 35b61d5f465d085a69772e5c769fc1a38984dd97
Author:     Leonid Komarianskyi <Leonid_Komarianskyi@epam.com>
AuthorDate: Tue Sep 9 10:09:23 2025 +0000
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Tue Sep 9 16:32:01 2025 -0700

    xen/arm: gicv3: modify ICH_LR_PHYSICAL_MASK to allow eSPI processing
    
    To properly deactivate physical eSPI routed to a domain and allow them to
    be retriggered after the initial trigger, the LR needs to be updated. The
    current implementation ignores interrupts outside the range specified by
    the mask 0x3FF, which only covers IRQ numbers up to 1023. To enable
    processing of eSPI interrupts, this patch updates the mask to 0x1FFF.
    
    Signed-off-by: Leonid Komarianskyi <leonid_komarianskyi@epam.com>
    Reviewed-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/include/asm/gic_v3_defs.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/arm/include/asm/gic_v3_defs.h b/xen/arch/arm/include/asm/gic_v3_defs.h
index 3370b4cd52..c373b94d19 100644
--- a/xen/arch/arm/include/asm/gic_v3_defs.h
+++ b/xen/arch/arm/include/asm/gic_v3_defs.h
@@ -211,7 +211,7 @@
 #define ICH_LR_VIRTUAL_SHIFT         0
 #define ICH_LR_CPUID_MASK            0x7
 #define ICH_LR_CPUID_SHIFT           10
-#define ICH_LR_PHYSICAL_MASK         0x3ff
+#define ICH_LR_PHYSICAL_MASK         0x1fff
 #define ICH_LR_PHYSICAL_SHIFT        32
 #define ICH_LR_STATE_MASK            0x3
 #define ICH_LR_STATE_SHIFT           62
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Sep 10 06:01:14 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 10 Sep 2025 06:01:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1117553.1463625 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uwDtK-0003yd-Je; Wed, 10 Sep 2025 06:01:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1117553.1463625; Wed, 10 Sep 2025 06: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 1uwDtK-0003yU-H1; Wed, 10 Sep 2025 06:01:14 +0000
Received: by outflank-mailman (input) for mailman id 1117553;
 Wed, 10 Sep 2025 06: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 1uwDtJ-0003yJ-1K
 for xen-changelog@lists.xenproject.org; Wed, 10 Sep 2025 06: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 1uwDtJ-0038pV-01
 for xen-changelog@lists.xenproject.org;
 Wed, 10 Sep 2025 06:01:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uwDtI-002Trk-39
 for xen-changelog@lists.xenproject.org;
 Wed, 10 Sep 2025 06: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=1dXiOwzco4ElLdq9VY25V86ynWhAsFvDzrJQZ61zr0I=; b=5WESwy6Y/DXV3NnXOfn1oCxDku
	MNRfoYcaWw4ZEcF8XqKrLPhGshumI04Ch0hvqOjnK5DAUA1U73f/61dBDFI7IQvg74XB7WkMWVV5r
	zvY9z/7ike40I+Sxm9OEmvA3q39t+Z/9lzjIV27SGy9/jE9S6WWXnfz69lgcafnrUG8U=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: vgic: add resource management for extended SPIs
Message-Id: <E1uwDtI-002Trk-39@xenbits.xenproject.org>
Date: Wed, 10 Sep 2025 06:01:12 +0000

commit bdde400c6e1b4cce9d80688fa9239dcb267c4c6f
Author:     Leonid Komarianskyi <Leonid_Komarianskyi@epam.com>
AuthorDate: Tue Sep 9 10:09:26 2025 +0000
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Tue Sep 9 16:32:03 2025 -0700

    xen/arm: vgic: add resource management for extended SPIs
    
    This change introduces resource management in the VGIC to handle
    extended SPIs introduced in GICv3.1. The pending_irqs and
    allocated_irqs arrays are resized to support the required
    number of eSPIs, based on what is supported by the hardware and
    requested by the guest. A new field, ext_shared_irqs, is added
    to the VGIC structure to store information about eSPIs, similar
    to how shared_irqs is used for regular SPIs.
    
    Since the eSPI range starts at INTID 4096 and INTIDs between 1025
    and 4095 are reserved, helper macros are introduced to simplify the
    transformation of indices and to enable easier access to eSPI-specific
    resources. These changes prepare the VGIC for processing eSPIs as
    required by future functionality.
    
    The initialization and deinitialization paths for vgic have been updated
    to allocate and free these resources appropriately. Additionally,
    updated handling of INTIDs greater than 1024, passed from the toolstack
    during domain creation, and verification logic ensures only valid SPI or
    eSPI INTIDs are used.
    
    The existing SPI behavior remains unaffected when guests do not request
    eSPIs, GIC hardware does not support them, or the CONFIG_GICV3_ESPI
    option is disabled.
    
    Signed-off-by: Leonid Komarianskyi <leonid_komarianskyi@epam.com>
    Reviewed-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
    Reviewed-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/include/asm/vgic.h |  26 +++++-
 xen/arch/arm/irq.c              |   3 +-
 xen/arch/arm/vgic.c             | 190 +++++++++++++++++++++++++++++++++++++---
 3 files changed, 203 insertions(+), 16 deletions(-)

diff --git a/xen/arch/arm/include/asm/vgic.h b/xen/arch/arm/include/asm/vgic.h
index 3e7cbbb196..caffea092b 100644
--- a/xen/arch/arm/include/asm/vgic.h
+++ b/xen/arch/arm/include/asm/vgic.h
@@ -144,11 +144,25 @@ struct vgic_dist {
     spinlock_t lock;
     uint32_t ctlr;
     int nr_spis; /* Number of SPIs */
-    unsigned long *allocated_irqs; /* bitmap of IRQs allocated */
+    /*
+     * Bitmap of allocated IRQs with the following index mapping:
+     * Local IRQs [0..31]
+     * Regular SPIs [32..nr_spis + 31]
+     * Optional, if supported:
+     * Extended SPIs [nr_spis + 32..nr_spis + nr_espis + 31]
+     */
+    unsigned long *allocated_irqs;
     struct vgic_irq_rank *shared_irqs;
+#ifdef CONFIG_GICV3_ESPI
+    struct vgic_irq_rank *ext_shared_irqs;
+    unsigned int nr_espis; /* Number of extended SPIs */
+#endif
     /*
      * SPIs are domain global, SGIs and PPIs are per-VCPU and stored in
-     * struct arch_vcpu.
+     * struct arch_vcpu. The index mapping is as follows:
+     * Regular SPIs [0..nr_spis - 1]
+     * Optional, if supported:
+     * eSPIs [nr_spis..nr_spis + nr_espis - 1]
      */
     struct pending_irq *pending_irqs;
     /* Base address for guest GIC */
@@ -243,6 +257,14 @@ struct vgic_ops {
 /* Number of ranks of interrupt registers for a domain */
 #define DOMAIN_NR_RANKS(d) (((d)->arch.vgic.nr_spis+31)/32)
 
+#ifdef CONFIG_GICV3_ESPI
+#define DOMAIN_NR_EXT_RANKS(d) (((d)->arch.vgic.nr_espis + 31) / 32)
+#endif
+#define EXT_RANK_MIN (ESPI_BASE_INTID / 32)
+#define EXT_RANK_MAX ((ESPI_MAX_INTID + 31) / 32)
+#define EXT_RANK_NUM2IDX(num) ((num) - EXT_RANK_MIN)
+#define EXT_RANK_IDX2NUM(idx) ((idx) + EXT_RANK_MIN)
+
 #define vgic_lock(v)   spin_lock_irq(&(v)->domain->arch.vgic.lock)
 #define vgic_unlock(v) spin_unlock_irq(&(v)->domain->arch.vgic.lock)
 
diff --git a/xen/arch/arm/irq.c b/xen/arch/arm/irq.c
index 53f5f4612f..73e58a5108 100644
--- a/xen/arch/arm/irq.c
+++ b/xen/arch/arm/irq.c
@@ -490,8 +490,7 @@ int route_irq_to_guest(struct domain *d, unsigned int virq,
     if ( !vgic_is_valid_line(d, virq) )
     {
         printk(XENLOG_G_ERR
-               "the vIRQ number %u is too high for domain %u (max = %u)\n",
-               irq, d->domain_id, vgic_num_irqs(d));
+               "invalid vIRQ number %u for domain %pd\n", irq, d);
         return -EINVAL;
     }
 
diff --git a/xen/arch/arm/vgic.c b/xen/arch/arm/vgic.c
index 2bbf4d99aa..eb22de6aa6 100644
--- a/xen/arch/arm/vgic.c
+++ b/xen/arch/arm/vgic.c
@@ -25,11 +25,61 @@
 #include <asm/vgic.h>
 
 
+static inline unsigned int idx_to_virq(struct domain *d, unsigned int idx)
+{
+    if ( idx >= vgic_num_irqs(d) )
+        return espi_idx_to_intid(idx - vgic_num_irqs(d));
+
+    return idx;
+}
+
 bool vgic_is_valid_line(struct domain *d, unsigned int virq)
 {
+#ifdef CONFIG_GICV3_ESPI
+    if ( virq >= ESPI_BASE_INTID &&
+         virq < espi_idx_to_intid(d->arch.vgic.nr_espis) )
+        return true;
+#endif
+
     return virq < vgic_num_irqs(d);
 }
 
+#ifdef CONFIG_GICV3_ESPI
+/*
+ * Since eSPI indexes start from 4096 and numbers from 1024 to
+ * 4095 are forbidden, we need to check both lower and upper
+ * limits for ranks.
+ */
+static inline bool is_valid_espi_rank(struct domain *d, unsigned int rank)
+{
+    return rank >= EXT_RANK_MIN &&
+           EXT_RANK_NUM2IDX(rank) < DOMAIN_NR_EXT_RANKS(d);
+}
+
+static inline struct vgic_irq_rank *vgic_get_espi_rank(struct vcpu *v,
+                                                       unsigned int rank)
+{
+    return &v->domain->arch.vgic.ext_shared_irqs[EXT_RANK_NUM2IDX(rank)];
+}
+
+#else
+static inline bool is_valid_espi_rank(struct domain *d, unsigned int rank)
+{
+    return false;
+}
+
+/*
+ * This function is stub and will not be called if CONFIG_GICV3_ESPI=n,
+ * because in this case, is_valid_espi_rank will always return false.
+ */
+static inline struct vgic_irq_rank *vgic_get_espi_rank(struct vcpu *v,
+                                                       unsigned int rank)
+{
+    ASSERT_UNREACHABLE();
+    return NULL;
+}
+#endif
+
 static inline struct vgic_irq_rank *vgic_get_rank(struct vcpu *v,
                                                   unsigned int rank)
 {
@@ -37,6 +87,8 @@ static inline struct vgic_irq_rank *vgic_get_rank(struct vcpu *v,
         return v->arch.vgic.private_irqs;
     else if ( rank <= DOMAIN_NR_RANKS(v->domain) )
         return &v->domain->arch.vgic.shared_irqs[rank - 1];
+    else if ( is_valid_espi_rank(v->domain, rank) )
+        return vgic_get_espi_rank(v, rank);
     else
         return NULL;
 }
@@ -117,6 +169,54 @@ int domain_vgic_register(struct domain *d, unsigned int *mmio_count)
     return 0;
 }
 
+#ifdef CONFIG_GICV3_ESPI
+static unsigned int vgic_num_spi_lines(struct domain *d)
+{
+    return d->arch.vgic.nr_spis + d->arch.vgic.nr_espis;
+}
+
+static int init_vgic_espi(struct domain *d)
+{
+    unsigned int i, idx;
+
+    if ( d->arch.vgic.nr_espis == 0 )
+        return 0;
+
+    d->arch.vgic.ext_shared_irqs =
+        xzalloc_array(struct vgic_irq_rank, DOMAIN_NR_EXT_RANKS(d));
+    if ( d->arch.vgic.ext_shared_irqs == NULL )
+        return -ENOMEM;
+
+    for ( i = d->arch.vgic.nr_spis, idx = 0;
+          i < vgic_num_spi_lines(d); i++, idx++ )
+        vgic_init_pending_irq(&d->arch.vgic.pending_irqs[i],
+                              espi_idx_to_intid(idx));
+
+    for ( i = 0; i < DOMAIN_NR_EXT_RANKS(d); i++ )
+        vgic_rank_init(&d->arch.vgic.ext_shared_irqs[i],
+                       EXT_RANK_IDX2NUM(i), 0);
+
+    return 0;
+}
+
+#else
+static int init_vgic_espi(struct domain *d)
+{
+    return 0;
+}
+
+static unsigned int vgic_num_spi_lines(struct domain *d)
+{
+    return d->arch.vgic.nr_spis;
+}
+
+#endif
+
+static unsigned int vgic_num_alloc_irqs(struct domain *d)
+{
+    return vgic_num_spi_lines(d) + NR_LOCAL_IRQS;
+}
+
 int domain_vgic_init(struct domain *d, unsigned int nr_spis)
 {
     int i;
@@ -133,7 +233,39 @@ int domain_vgic_init(struct domain *d, unsigned int nr_spis)
 
     /* Limit the number of virtual SPIs supported to (1020 - 32) = 988  */
     if ( nr_spis > (1020 - NR_LOCAL_IRQS) )
+#ifndef CONFIG_GICV3_ESPI
         return -EINVAL;
+#else
+    {
+        /*
+         * During domain creation, the dom0less DomUs code or toolstack
+         * specifies the maximum INTID, which is defined in the domain
+         * config subtracted by 32 to cover the local IRQs (please see
+         * the comment to VGIC_DEF_NR_SPIS). To compute the actual number
+         * of eSPI that will be usable for, add back 32 (NR_LOCAL_IRQS).
+         */
+        nr_spis += NR_LOCAL_IRQS;
+        if ( nr_spis > espi_idx_to_intid(NR_ESPI_IRQS) )
+            return -EINVAL;
+
+        if ( nr_spis >= ESPI_BASE_INTID )
+        {
+            unsigned int nr_espis = min(nr_spis - ESPI_BASE_INTID, 1024U);
+
+            /* Verify if GIC HW can handle provided INTID */
+            if ( nr_espis > gic_number_espis() )
+                return -EINVAL;
+
+            d->arch.vgic.nr_espis = nr_espis;
+            /* Set the maximum available number for regular SPIs */
+            nr_spis = VGIC_DEF_NR_SPIS;
+        }
+        else
+        {
+            return -EINVAL;
+        }
+    }
+#endif
 
     d->arch.vgic.nr_spis = nr_spis;
 
@@ -145,7 +277,7 @@ int domain_vgic_init(struct domain *d, unsigned int nr_spis)
         return -ENOMEM;
 
     d->arch.vgic.pending_irqs =
-        xzalloc_array(struct pending_irq, d->arch.vgic.nr_spis);
+        xzalloc_array(struct pending_irq, vgic_num_spi_lines(d));
     if ( d->arch.vgic.pending_irqs == NULL )
         return -ENOMEM;
 
@@ -156,12 +288,16 @@ int domain_vgic_init(struct domain *d, unsigned int nr_spis)
     for ( i = 0; i < DOMAIN_NR_RANKS(d); i++ )
         vgic_rank_init(&d->arch.vgic.shared_irqs[i], i + 1, 0);
 
+    ret = init_vgic_espi(d);
+    if ( ret )
+        return ret;
+
     ret = d->arch.vgic.handler->domain_init(d);
     if ( ret )
         return ret;
 
     d->arch.vgic.allocated_irqs =
-        xzalloc_array(unsigned long, BITS_TO_LONGS(vgic_num_irqs(d)));
+        xzalloc_array(unsigned long, BITS_TO_LONGS(vgic_num_alloc_irqs(d)));
     if ( !d->arch.vgic.allocated_irqs )
         return -ENOMEM;
 
@@ -182,9 +318,12 @@ void domain_vgic_free(struct domain *d)
     int i;
     int ret;
 
-    for ( i = 0; i < (d->arch.vgic.nr_spis); i++ )
+    for ( i = NR_LOCAL_IRQS; i < vgic_num_alloc_irqs(d); i++ )
     {
-        struct pending_irq *p = spi_to_pending(d, i + 32);
+        struct pending_irq *p;
+        unsigned int virq = idx_to_virq(d, i);
+
+        p = spi_to_pending(d, virq);
 
         if ( p->desc )
         {
@@ -198,6 +337,9 @@ void domain_vgic_free(struct domain *d)
     if ( d->arch.vgic.handler )
         d->arch.vgic.handler->domain_free(d);
     xfree(d->arch.vgic.shared_irqs);
+#ifdef CONFIG_GICV3_ESPI
+    xfree(d->arch.vgic.ext_shared_irqs);
+#endif
     xfree(d->arch.vgic.pending_irqs);
     xfree(d->arch.vgic.allocated_irqs);
 }
@@ -323,10 +465,12 @@ void arch_move_irqs(struct vcpu *v)
      */
     ASSERT(!is_lpi(vgic_num_irqs(d) - 1));
 
-    for ( i = 32; i < vgic_num_irqs(d); i++ )
+    for ( i = NR_LOCAL_IRQS; i < vgic_num_alloc_irqs(d); i++ )
     {
-        v_target = vgic_get_target_vcpu(v, i);
-        p = irq_to_pending(v_target, i);
+        unsigned int virq = idx_to_virq(d, i);
+
+        v_target = vgic_get_target_vcpu(v, virq);
+        p = irq_to_pending(v_target, virq);
 
         if ( v_target == v && !test_bit(GIC_IRQ_GUEST_MIGRATING, &p->status) )
             irq_set_affinity(p->desc, cpu_mask);
@@ -539,15 +683,28 @@ struct pending_irq *irq_to_pending(struct vcpu *v, unsigned int irq)
     else if ( is_lpi(irq) )
         n = v->domain->arch.vgic.handler->lpi_to_pending(v->domain, irq);
     else
-        n = &v->domain->arch.vgic.pending_irqs[irq - 32];
+        n = spi_to_pending(v->domain, irq);
     return n;
 }
 
 struct pending_irq *spi_to_pending(struct domain *d, unsigned int irq)
 {
+    unsigned int idx;
+
     ASSERT(irq >= NR_LOCAL_IRQS);
 
-    return &d->arch.vgic.pending_irqs[irq - 32];
+    if ( is_espi(irq) )
+    {
+        unsigned int nr_spis = d->arch.vgic.nr_spis;
+
+        idx = espi_intid_to_idx(irq) + nr_spis;
+    }
+    else
+    {
+        idx = irq - NR_LOCAL_IRQS;
+    }
+
+    return &d->arch.vgic.pending_irqs[idx];
 }
 
 void vgic_clear_pending_irqs(struct vcpu *v)
@@ -665,10 +822,19 @@ bool vgic_emulate(struct cpu_user_regs *regs, union hsr hsr)
 
 bool vgic_reserve_virq(struct domain *d, unsigned int virq)
 {
+    unsigned int idx = virq;
+
     if ( !vgic_is_valid_line(d, virq) )
         return false;
 
-    return !test_and_set_bit(virq, d->arch.vgic.allocated_irqs);
+    if ( is_espi(virq) )
+    {
+        unsigned int num_regular_irqs = vgic_num_irqs(d);
+
+        idx = espi_intid_to_idx(virq) + num_regular_irqs;
+    }
+
+    return !test_and_set_bit(idx, d->arch.vgic.allocated_irqs);
 }
 
 int vgic_allocate_virq(struct domain *d, bool spi)
@@ -685,7 +851,7 @@ int vgic_allocate_virq(struct domain *d, bool spi)
     else
     {
         first = 32;
-        end = vgic_num_irqs(d);
+        end = vgic_num_alloc_irqs(d);
     }
 
     /*
@@ -700,7 +866,7 @@ int vgic_allocate_virq(struct domain *d, bool spi)
     }
     while ( test_and_set_bit(virq, d->arch.vgic.allocated_irqs) );
 
-    return virq;
+    return idx_to_virq(d, virq);
 }
 
 void vgic_free_virq(struct domain *d, unsigned int virq)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Sep 10 06:01:24 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 10 Sep 2025 06:01:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1117554.1463629 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uwDtU-00041C-MS; Wed, 10 Sep 2025 06:01:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1117554.1463629; Wed, 10 Sep 2025 06: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 1uwDtU-000414-Jq; Wed, 10 Sep 2025 06:01:24 +0000
Received: by outflank-mailman (input) for mailman id 1117554;
 Wed, 10 Sep 2025 06: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 1uwDtT-00040w-4E
 for xen-changelog@lists.xenproject.org; Wed, 10 Sep 2025 06: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 1uwDtT-0038pf-0K
 for xen-changelog@lists.xenproject.org;
 Wed, 10 Sep 2025 06:01:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uwDtT-002Tsx-0D
 for xen-changelog@lists.xenproject.org;
 Wed, 10 Sep 2025 06: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=1sKqIyzrB8I0MGMUjJD1xZzenvTtw+2ZAY0nQaKfNv8=; b=Rbpod7eOQXIrMdiG5wtc3Y40eK
	2bYhfFUUlZZiZakH49IOCBDbXTSpqqFWQj+MxA+LyOzNIdY0h8w3NHDnwUMRQ9vTFtG94CPzXXoam
	rampJ2P+hOgLGCQ/75eUqCeXGduIhHxp2I5Zyhuco9/pQ8Xn7zjEFXtZsN/505HMvjPk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: domain_build/dom0less-build: adjust domains config to support eSPIs
Message-Id: <E1uwDtT-002Tsx-0D@xenbits.xenproject.org>
Date: Wed, 10 Sep 2025 06:01:23 +0000

commit b5861cf1114692906db62c36dde5684a2d1ac3be
Author:     Leonid Komarianskyi <Leonid_Komarianskyi@epam.com>
AuthorDate: Tue Sep 9 10:09:29 2025 +0000
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Tue Sep 9 16:32:04 2025 -0700

    xen/arm: domain_build/dom0less-build: adjust domains config to support eSPIs
    
    The Dom0 and DomUs logic for the dom0less configuration in create_dom0()
    and arch_create_domUs() should account for extended SPIs when supported
    by the hardware and enabled with CONFIG_GICV3_ESPI. These changes ensure
    proper calculation of the maximum number of SPIs and eSPIs available to
    Dom0 and DomUs in dom0less setups.
    
    When eSPIs are supported by the hardware and CONFIG_GICV3_ESPI is enabled, the
    maximum number of eSPI interrupts is calculated using the ESPI_BASE_INTID
    offset (4096) and is limited to 1024, with 32 IRQs subtracted. To ensure
    compatibility with non-Dom0 domains, this adjustment is applied by the
    toolstack during domain creation, while for Dom0 or DomUs in Dom0, it is
    handled directly during VGIC initialization. If eSPIs are not supported, the
    calculation defaults to using the standard SPI range, with a maximum value of
    992 interrupt lines, as it works currently.
    
    Signed-off-by: Leonid Komarianskyi <leonid_komarianskyi@epam.com>
    Reviewed-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
    Reviewed-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/dom0less-build.c   |  2 +-
 xen/arch/arm/domain_build.c     |  2 +-
 xen/arch/arm/include/asm/vgic.h | 19 +++++++++++++++++++
 3 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/xen/arch/arm/dom0less-build.c b/xen/arch/arm/dom0less-build.c
index f00912a1ca..4181c10538 100644
--- a/xen/arch/arm/dom0less-build.c
+++ b/xen/arch/arm/dom0less-build.c
@@ -326,7 +326,7 @@ int __init arch_parse_dom0less_node(struct dt_device_node *node,
     {
         int vpl011_virq = GUEST_VPL011_SPI;
 
-        d_cfg->arch.nr_spis = VGIC_DEF_NR_SPIS;
+        d_cfg->arch.nr_spis = vgic_def_nr_spis();
 
         /*
          * The VPL011 virq is GUEST_VPL011_SPI, unless direct-map is
diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index 89448fb475..fb8fbb1650 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -2063,7 +2063,7 @@ void __init create_dom0(void)
 
     /* The vGIC for DOM0 is exactly emulating the hardware GIC */
     dom0_cfg.arch.gic_version = XEN_DOMCTL_CONFIG_GIC_NATIVE;
-    dom0_cfg.arch.nr_spis = VGIC_DEF_NR_SPIS;
+    dom0_cfg.arch.nr_spis = vgic_def_nr_spis();
     dom0_cfg.arch.tee_type = tee_get_type();
     dom0_cfg.max_vcpus = dom0_max_vcpus();
 
diff --git a/xen/arch/arm/include/asm/vgic.h b/xen/arch/arm/include/asm/vgic.h
index caffea092b..24a4a968c3 100644
--- a/xen/arch/arm/include/asm/vgic.h
+++ b/xen/arch/arm/include/asm/vgic.h
@@ -357,6 +357,25 @@ extern void vgic_check_inflight_irqs_pending(struct vcpu *v,
 /* Default number of vGIC SPIs. 32 are substracted to cover local IRQs. */
 #define VGIC_DEF_NR_SPIS (min(gic_number_lines(), VGIC_MAX_IRQS) - 32)
 
+static inline unsigned int vgic_def_nr_spis(void)
+{
+#ifdef CONFIG_GICV3_ESPI
+    /*
+     * Check if the hardware supports extended SPIs (even if the appropriate
+     * config is set). If not, the common SPI range will be used. Otherwise
+     * return the maximum eSPI INTID, supported by HW GIC, subtracted by 32.
+     * For Dom0 and started at boot time DomUs we will add back this value
+     * during VGIC initialization. This ensures consistent handling for Dom0
+     * and other domains. For the regular SPI range interrupts in this case,
+     * the maximum value of VGIC_DEF_NR_SPIS will be used.
+     */
+    if ( gic_number_espis() > 0 )
+        return ESPI_BASE_INTID + min(gic_number_espis(), 1024U) - 32;
+#endif
+
+    return VGIC_DEF_NR_SPIS;
+}
+
 extern bool vgic_is_valid_line(struct domain *d, unsigned int virq);
 
 static inline bool vgic_is_spi(struct domain *d, unsigned int virq)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Sep 10 06:01:34 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 10 Sep 2025 06:01:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1117555.1463633 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uwDte-00043e-O5; Wed, 10 Sep 2025 06:01:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1117555.1463633; Wed, 10 Sep 2025 06: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 1uwDte-00043W-LE; Wed, 10 Sep 2025 06:01:34 +0000
Received: by outflank-mailman (input) for mailman id 1117555;
 Wed, 10 Sep 2025 06: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 1uwDtd-00043P-6u
 for xen-changelog@lists.xenproject.org; Wed, 10 Sep 2025 06: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 1uwDtd-0038pm-0b
 for xen-changelog@lists.xenproject.org;
 Wed, 10 Sep 2025 06:01:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uwDtd-002TtJ-0V
 for xen-changelog@lists.xenproject.org;
 Wed, 10 Sep 2025 06: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=c/RzOCa030YZm1rc8YTMvgAr6e1bxc2W9eIbUIpUdsE=; b=3EqSeiSdvAeTgnbdRcTdjSjQka
	ZPSgIXeQP6ltxef1RFu31ShnQ6j1Bbhdm+9GR2GFQ3cNFA2qPZzGpuXhoiLk13kTh0mKT1fTe5EKX
	WZY+7YwfAkjd9UAj7CesgeqJo/hjSByWmsXLXdzCai+KnW7RFKGLwyPUWlRkU8DvJYKM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: vgic-v3: add emulation of GICv3.1 eSPI registers
Message-Id: <E1uwDtd-002TtJ-0V@xenbits.xenproject.org>
Date: Wed, 10 Sep 2025 06:01:33 +0000

commit 93eecb2c4b88ff79e20fa842a1e8799b0b801460
Author:     Leonid Komarianskyi <Leonid_Komarianskyi@epam.com>
AuthorDate: Tue Sep 9 10:09:31 2025 +0000
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Tue Sep 9 16:32:05 2025 -0700

    xen/arm: vgic-v3: add emulation of GICv3.1 eSPI registers
    
    Implemented support for GICv3.1 extended SPI registers for vGICv3,
    allowing the emulation of eSPI-specific behavior for guest domains.
    The implementation includes read and write emulation for eSPI-related
    registers (e.g., GICD_ISENABLERnE, GICD_IROUTERnE, and others),
    following a similar approach to the handling of regular SPIs.
    
    The eSPI registers, previously located in reserved address ranges,
    are now adjusted to support MMIO read and write operations correctly
    when CONFIG_GICV3_ESPI is enabled.
    
    The availability of eSPIs and the number of emulated extended SPIs
    for guest domains is reported by setting the appropriate bits in the
    GICD_TYPER register, based on the number of eSPIs requested by the
    domain and supported by the hardware. In cases where the configuration
    option is disabled, the hardware does not support eSPIs, or the domain
    does not request such interrupts, the functionality remains unchanged.
    
    Signed-off-by: Leonid Komarianskyi <leonid_komarianskyi@epam.com>
    Reviewed-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/include/asm/vgic.h |   4 +
 xen/arch/arm/vgic-v3.c          | 203 +++++++++++++++++++++++++++++++---------
 xen/arch/arm/vgic.c             |  22 +++++
 3 files changed, 185 insertions(+), 44 deletions(-)

diff --git a/xen/arch/arm/include/asm/vgic.h b/xen/arch/arm/include/asm/vgic.h
index 24a4a968c3..31b3d3e5ec 100644
--- a/xen/arch/arm/include/asm/vgic.h
+++ b/xen/arch/arm/include/asm/vgic.h
@@ -324,6 +324,10 @@ extern struct vgic_irq_rank *vgic_rank_offset(struct vcpu *v,
                                               unsigned int b,
                                               unsigned int n,
                                               unsigned int s);
+extern struct vgic_irq_rank *vgic_ext_rank_offset(struct vcpu *v,
+                                                  unsigned int b,
+                                                  unsigned int n,
+                                                  unsigned int s);
 extern struct vgic_irq_rank *vgic_rank_irq(struct vcpu *v, unsigned int irq);
 extern void vgic_disable_irqs(struct vcpu *v, uint32_t r, unsigned int n);
 extern void vgic_enable_irqs(struct vcpu *v, uint32_t r, unsigned int n);
diff --git a/xen/arch/arm/vgic-v3.c b/xen/arch/arm/vgic-v3.c
index 4369c55177..8b1c8eef80 100644
--- a/xen/arch/arm/vgic-v3.c
+++ b/xen/arch/arm/vgic-v3.c
@@ -107,17 +107,12 @@ static uint64_t vgic_fetch_irouter(struct vgic_irq_rank *rank,
 /*
  * Store an IROUTER register in a convenient way and migrate the vIRQ
  * if necessary. This function only deals with IROUTER32 and onwards.
- *
- * Note the offset will be aligned to the appropriate boundary.
  */
 static void vgic_store_irouter(struct domain *d, struct vgic_irq_rank *rank,
-                               unsigned int offset, uint64_t irouter)
+                               unsigned int virq, uint64_t irouter)
 {
     struct vcpu *new_vcpu, *old_vcpu;
-    unsigned int virq;
-
-    /* There is 1 vIRQ per IROUTER */
-    virq = offset / NR_BYTES_PER_IROUTER;
+    unsigned int offset;
 
     /*
      * The IROUTER0-31, used for SGIs/PPIs, are reserved and should
@@ -673,6 +668,36 @@ write_reserved:
     return 1;
 }
 
+/*
+ * The assumption is that offsets below espi_base are for
+ * regular SPI, while those at or above are for eSPI.
+ */
+static inline struct vgic_irq_rank *vgic_common_rank_offset(struct vcpu *v,
+                                                            unsigned int b,
+                                                            uint32_t reg,
+                                                            unsigned int s,
+                                                            uint32_t spi_base,
+                                                            uint32_t espi_base)
+{
+    ASSERT(spi_base < espi_base);
+
+    if ( reg < espi_base )
+        return vgic_rank_offset(v, b, reg - spi_base, s);
+    else
+        return vgic_ext_rank_offset(v, b, reg - espi_base, s);
+}
+
+static inline uint32_t vgic_get_reg_offset(uint32_t reg, uint32_t spi_base,
+                                           uint32_t espi_base)
+{
+    ASSERT(spi_base < espi_base);
+
+    if ( reg < espi_base )
+        return reg - spi_base;
+    else
+        return reg - espi_base;
+}
+
 static int __vgic_v3_distr_common_mmio_read(const char *name, struct vcpu *v,
                                             mmio_info_t *info, uint32_t reg,
                                             register_t *r)
@@ -685,13 +710,17 @@ static int __vgic_v3_distr_common_mmio_read(const char *name, struct vcpu *v,
     {
     case VRANGE32(GICD_IGROUPR, GICD_IGROUPRN):
     case VRANGE32(GICD_IGRPMODR, GICD_IGRPMODRN):
+    case VRANGE32(GICD_IGROUPRnE, GICD_IGROUPRnEN):
+    case VRANGE32(GICD_IGRPMODRnE, GICD_IGRPMODRnEN):
         /* We do not implement security extensions for guests, read zero */
         if ( dabt.size != DABT_WORD ) goto bad_width;
         goto read_as_zero;
 
     case VRANGE32(GICD_ISENABLER, GICD_ISENABLERN):
+    case VRANGE32(GICD_ISENABLERnE, GICD_ISENABLERnEN):
         if ( dabt.size != DABT_WORD ) goto bad_width;
-        rank = vgic_rank_offset(v, 1, reg - GICD_ISENABLER, DABT_WORD);
+        rank = vgic_common_rank_offset(v, 1, reg, DABT_WORD, GICD_ISENABLER,
+                                       GICD_ISENABLERnE);
         if ( rank == NULL ) goto read_as_zero;
         vgic_lock_rank(v, rank, flags);
         *r = vreg_reg32_extract(rank->ienable, info);
@@ -699,8 +728,10 @@ static int __vgic_v3_distr_common_mmio_read(const char *name, struct vcpu *v,
         return 1;
 
     case VRANGE32(GICD_ICENABLER, GICD_ICENABLERN):
+    case VRANGE32(GICD_ICENABLERnE, GICD_ICENABLERnEN):
         if ( dabt.size != DABT_WORD ) goto bad_width;
-        rank = vgic_rank_offset(v, 1, reg - GICD_ICENABLER, DABT_WORD);
+        rank = vgic_common_rank_offset(v, 1, reg, DABT_WORD, GICD_ICENABLER,
+                                       GICD_ICENABLERnE);
         if ( rank == NULL ) goto read_as_zero;
         vgic_lock_rank(v, rank, flags);
         *r = vreg_reg32_extract(rank->ienable, info);
@@ -710,22 +741,29 @@ static int __vgic_v3_distr_common_mmio_read(const char *name, struct vcpu *v,
     /* Read the pending status of an IRQ via GICD/GICR is not supported */
     case VRANGE32(GICD_ISPENDR, GICD_ISPENDRN):
     case VRANGE32(GICD_ICPENDR, GICD_ICPENDRN):
+    case VRANGE32(GICD_ISPENDRnE, GICD_ISPENDRnEN):
+    case VRANGE32(GICD_ICPENDRnE, GICD_ICPENDRnEN):
         goto read_as_zero;
 
     /* Read the active status of an IRQ via GICD/GICR is not supported */
     case VRANGE32(GICD_ISACTIVER, GICD_ISACTIVERN):
     case VRANGE32(GICD_ICACTIVER, GICD_ICACTIVERN):
+    case VRANGE32(GICD_ISACTIVERnE, GICD_ISACTIVERnEN):
+    case VRANGE32(GICD_ICACTIVERnE, GICD_ICACTIVERnEN):
         goto read_as_zero;
 
     case VRANGE32(GICD_IPRIORITYR, GICD_IPRIORITYRN):
+    case VRANGE32(GICD_IPRIORITYRnE, GICD_IPRIORITYRnEN):
     {
-        uint32_t ipriorityr;
+        uint32_t ipriorityr, offset;
         uint8_t rank_index;
 
         if ( dabt.size != DABT_BYTE && dabt.size != DABT_WORD ) goto bad_width;
-        rank = vgic_rank_offset(v, 8, reg - GICD_IPRIORITYR, DABT_WORD);
+        rank = vgic_common_rank_offset(v, 8, reg, DABT_WORD, GICD_IPRIORITYR,
+                                       GICD_IPRIORITYRnE);
         if ( rank == NULL ) goto read_as_zero;
-        rank_index = REG_RANK_INDEX(8, reg - GICD_IPRIORITYR, DABT_WORD);
+        offset = vgic_get_reg_offset(reg, GICD_IPRIORITYR, GICD_IPRIORITYRnE);
+        rank_index = REG_RANK_INDEX(8, offset, DABT_WORD);
 
         vgic_lock_rank(v, rank, flags);
         ipriorityr = ACCESS_ONCE(rank->ipriorityr[rank_index]);
@@ -737,14 +775,17 @@ static int __vgic_v3_distr_common_mmio_read(const char *name, struct vcpu *v,
     }
 
     case VRANGE32(GICD_ICFGR, GICD_ICFGRN):
+    case VRANGE32(GICD_ICFGRnE, GICD_ICFGRnEN):
     {
-        uint32_t icfgr;
+        uint32_t icfgr, offset;
 
         if ( dabt.size != DABT_WORD ) goto bad_width;
-        rank = vgic_rank_offset(v, 2, reg - GICD_ICFGR, DABT_WORD);
+        rank = vgic_common_rank_offset(v, 2, reg, DABT_WORD, GICD_ICFGR,
+                                       GICD_ICFGRnE);
         if ( rank == NULL ) goto read_as_zero;
+        offset = vgic_get_reg_offset(reg, GICD_ICFGR, GICD_ICFGRnE);
         vgic_lock_rank(v, rank, flags);
-        icfgr = rank->icfg[REG_RANK_INDEX(2, reg - GICD_ICFGR, DABT_WORD)];
+        icfgr = rank->icfg[REG_RANK_INDEX(2, offset, DABT_WORD)];
         vgic_unlock_rank(v, rank, flags);
 
         *r = vreg_reg32_extract(icfgr, info);
@@ -782,12 +823,16 @@ static int __vgic_v3_distr_common_mmio_write(const char *name, struct vcpu *v,
     {
     case VRANGE32(GICD_IGROUPR, GICD_IGROUPRN):
     case VRANGE32(GICD_IGRPMODR, GICD_IGRPMODRN):
+    case VRANGE32(GICD_IGROUPRnE, GICD_IGROUPRnEN):
+    case VRANGE32(GICD_IGRPMODRnE, GICD_IGRPMODRnEN):
         /* We do not implement security extensions for guests, write ignore */
         goto write_ignore_32;
 
     case VRANGE32(GICD_ISENABLER, GICD_ISENABLERN):
+    case VRANGE32(GICD_ISENABLERnE, GICD_ISENABLERnEN):
         if ( dabt.size != DABT_WORD ) goto bad_width;
-        rank = vgic_rank_offset(v, 1, reg - GICD_ISENABLER, DABT_WORD);
+        rank = vgic_common_rank_offset(v, 1, reg, DABT_WORD, GICD_ISENABLER,
+                                       GICD_ISENABLERnE);
         if ( rank == NULL ) goto write_ignore;
         vgic_lock_rank(v, rank, flags);
         tr = rank->ienable;
@@ -797,8 +842,10 @@ static int __vgic_v3_distr_common_mmio_write(const char *name, struct vcpu *v,
         return 1;
 
     case VRANGE32(GICD_ICENABLER, GICD_ICENABLERN):
+    case VRANGE32(GICD_ICENABLERnE, GICD_ICENABLERnEN):
         if ( dabt.size != DABT_WORD ) goto bad_width;
-        rank = vgic_rank_offset(v, 1, reg - GICD_ICENABLER, DABT_WORD);
+        rank = vgic_common_rank_offset(v, 1, reg, DABT_WORD, GICD_ICENABLER,
+                                       GICD_ICENABLERnE);
         if ( rank == NULL ) goto write_ignore;
         vgic_lock_rank(v, rank, flags);
         tr = rank->ienable;
@@ -808,8 +855,10 @@ static int __vgic_v3_distr_common_mmio_write(const char *name, struct vcpu *v,
         return 1;
 
     case VRANGE32(GICD_ISPENDR, GICD_ISPENDRN):
+    case VRANGE32(GICD_ISPENDRnE, GICD_ISPENDRnEN):
         if ( dabt.size != DABT_WORD ) goto bad_width;
-        rank = vgic_rank_offset(v, 1, reg - GICD_ISPENDR, DABT_WORD);
+        rank = vgic_common_rank_offset(v, 1, reg, DABT_WORD, GICD_ISPENDR,
+                                       GICD_ISPENDRnE);
         if ( rank == NULL ) goto write_ignore;
 
         vgic_set_irqs_pending(v, r, rank->index);
@@ -817,8 +866,10 @@ static int __vgic_v3_distr_common_mmio_write(const char *name, struct vcpu *v,
         return 1;
 
     case VRANGE32(GICD_ICPENDR, GICD_ICPENDRN):
+    case VRANGE32(GICD_ICPENDRnE, GICD_ICPENDRnEN):
         if ( dabt.size != DABT_WORD ) goto bad_width;
-        rank = vgic_rank_offset(v, 1, reg - GICD_ICPENDR, DABT_WORD);
+        rank = vgic_common_rank_offset(v, 1, reg, DABT_WORD, GICD_ICPENDR,
+                                       GICD_ICPENDRnE);
         if ( rank == NULL ) goto write_ignore;
 
         vgic_check_inflight_irqs_pending(v, rank->index, r);
@@ -826,28 +877,42 @@ static int __vgic_v3_distr_common_mmio_write(const char *name, struct vcpu *v,
         goto write_ignore;
 
     case VRANGE32(GICD_ISACTIVER, GICD_ISACTIVERN):
+    case VRANGE32(GICD_ISACTIVERnE, GICD_ISACTIVERnEN):
         if ( dabt.size != DABT_WORD ) goto bad_width;
-        printk(XENLOG_G_ERR
-               "%pv: %s: unhandled word write %#"PRIregister" to ISACTIVER%d\n",
-               v, name, r, reg - GICD_ISACTIVER);
+        if ( reg < GICD_ISACTIVERnE )
+            printk(XENLOG_G_ERR
+                   "%pv: %s: unhandled word write %#"PRIregister" to ISACTIVER%d\n",
+                   v, name, r, reg - GICD_ISACTIVER);
+        else
+            printk(XENLOG_G_ERR
+                   "%pv: %s: unhandled word write %#"PRIregister" to ISACTIVER%dE\n",
+                   v, name, r, reg - GICD_ISACTIVERnE);
         return 0;
 
     case VRANGE32(GICD_ICACTIVER, GICD_ICACTIVERN):
-        printk(XENLOG_G_ERR
-               "%pv: %s: unhandled word write %#"PRIregister" to ICACTIVER%d\n",
-               v, name, r, reg - GICD_ICACTIVER);
+    case VRANGE32(GICD_ICACTIVERnE, GICD_ICACTIVERnEN):
+        if ( reg < GICD_ICACTIVERnE )
+            printk(XENLOG_G_ERR
+                   "%pv: %s: unhandled word write %#"PRIregister" to ICACTIVER%d\n",
+                   v, name, r, reg - GICD_ICACTIVER);
+        else
+            printk(XENLOG_G_ERR
+                   "%pv: %s: unhandled word write %#"PRIregister" to ICACTIVER%dE\n",
+                   v, name, r, reg - GICD_ICACTIVERnE);
         goto write_ignore_32;
 
     case VRANGE32(GICD_IPRIORITYR, GICD_IPRIORITYRN):
+    case VRANGE32(GICD_IPRIORITYRnE, GICD_IPRIORITYRnEN):
     {
-        uint32_t *ipriorityr, priority;
+        uint32_t *ipriorityr, priority, offset;
 
         if ( dabt.size != DABT_BYTE && dabt.size != DABT_WORD ) goto bad_width;
-        rank = vgic_rank_offset(v, 8, reg - GICD_IPRIORITYR, DABT_WORD);
+        rank = vgic_common_rank_offset(v, 8, reg, DABT_WORD, GICD_IPRIORITYR,
+                                       GICD_IPRIORITYRnE);
         if ( rank == NULL ) goto write_ignore;
+        offset = vgic_get_reg_offset(reg, GICD_IPRIORITYR, GICD_IPRIORITYRnE);
         vgic_lock_rank(v, rank, flags);
-        ipriorityr = &rank->ipriorityr[REG_RANK_INDEX(8, reg - GICD_IPRIORITYR,
-                                                      DABT_WORD)];
+        ipriorityr = &rank->ipriorityr[REG_RANK_INDEX(8, offset, DABT_WORD)];
         priority = ACCESS_ONCE(*ipriorityr);
         vreg_reg32_update(&priority, r, info);
         ACCESS_ONCE(*ipriorityr) = priority;
@@ -859,17 +924,23 @@ static int __vgic_v3_distr_common_mmio_write(const char *name, struct vcpu *v,
         goto write_ignore_32;
 
     case VRANGE32(GICD_ICFGR + 4, GICD_ICFGRN): /* PPI + SPIs */
+    case VRANGE32(GICD_ICFGRnE, GICD_ICFGRnEN):
+    {
+        uint32_t offset;
+
         /* ICFGR1 for PPI's, which is implementation defined
            if ICFGR1 is programmable or not. We chose to program */
         if ( dabt.size != DABT_WORD ) goto bad_width;
-        rank = vgic_rank_offset(v, 2, reg - GICD_ICFGR, DABT_WORD);
+        rank = vgic_common_rank_offset(v, 2, reg, DABT_WORD, GICD_ICFGR,
+                                       GICD_ICFGRnE);
         if ( rank == NULL ) goto write_ignore;
+        offset = vgic_get_reg_offset(reg, GICD_ICFGR, GICD_ICFGRnE);
         vgic_lock_rank(v, rank, flags);
-        vreg_reg32_update(&rank->icfg[REG_RANK_INDEX(2, reg - GICD_ICFGR,
-                                                     DABT_WORD)],
+        vreg_reg32_update(&rank->icfg[REG_RANK_INDEX(2, offset, DABT_WORD)],
                           r, info);
         vgic_unlock_rank(v, rank, flags);
         return 1;
+    }
 
     default:
         printk(XENLOG_G_ERR
@@ -1129,6 +1200,16 @@ static int vgic_v3_distr_mmio_read(struct vcpu *v, mmio_info_t *info,
             typer |= GICD_TYPE_LPIS;
 
         typer |= (v->domain->arch.vgic.intid_bits - 1) << GICD_TYPE_ID_BITS_SHIFT;
+#ifdef CONFIG_GICV3_ESPI
+        if ( v->domain->arch.vgic.nr_espis > 0 )
+        {
+            /* Set eSPI support bit for the domain */
+            typer |= GICD_TYPER_ESPI;
+            /* Set ESPI range bits */
+            typer |= (DIV_ROUND_UP(v->domain->arch.vgic.nr_espis, 32) - 1)
+                       << GICD_TYPER_ESPI_RANGE_SHIFT;
+        }
+#endif
 
         *r = vreg_reg32_extract(typer, info);
 
@@ -1194,6 +1275,16 @@ static int vgic_v3_distr_mmio_read(struct vcpu *v, mmio_info_t *info,
     case VRANGE32(GICD_IPRIORITYR, GICD_IPRIORITYRN):
     case VRANGE32(GICD_ICFGR, GICD_ICFGRN):
     case VRANGE32(GICD_IGRPMODR, GICD_IGRPMODRN):
+    case VRANGE32(GICD_IGROUPRnE, GICD_IGROUPRnEN):
+    case VRANGE32(GICD_ISENABLERnE, GICD_ISENABLERnEN):
+    case VRANGE32(GICD_ICENABLERnE, GICD_ICENABLERnEN):
+    case VRANGE32(GICD_ISPENDRnE, GICD_ISPENDRnEN):
+    case VRANGE32(GICD_ICPENDRnE, GICD_ICPENDRnEN):
+    case VRANGE32(GICD_ISACTIVERnE, GICD_ISACTIVERnEN):
+    case VRANGE32(GICD_ICACTIVERnE, GICD_ICACTIVERnEN):
+    case VRANGE32(GICD_IPRIORITYRnE, GICD_IPRIORITYRnEN):
+    case VRANGE32(GICD_ICFGRnE, GICD_ICFGRnEN):
+    case VRANGE32(GICD_IGRPMODRnE, GICD_IGRPMODRnEN):
         /*
          * Above all register are common with GICR and GICD
          * Manage in common
@@ -1201,6 +1292,7 @@ static int vgic_v3_distr_mmio_read(struct vcpu *v, mmio_info_t *info,
         return __vgic_v3_distr_common_mmio_read("vGICD", v, info, gicd_reg, r);
 
     case VRANGE32(GICD_NSACR, GICD_NSACRN):
+    case VRANGE32(GICD_NSACRnE, GICD_NSACRnEN):
         /* We do not implement security extensions for guests, read zero */
         goto read_as_zero_32;
 
@@ -1216,27 +1308,30 @@ static int vgic_v3_distr_mmio_read(struct vcpu *v, mmio_info_t *info,
         /* Replaced with GICR_ISPENDR0. So ignore write */
         goto read_as_zero_32;
 
-    case VRANGE32(0x0F30, 0x60FC):
+    case VRANGE32(0x0F30, 0x0FFC):
         goto read_reserved;
 
     case VRANGE64(GICD_IROUTER32, GICD_IROUTER1019):
+    case VRANGE64(GICD_IROUTERnE, GICD_IROUTERnEN):
     {
         uint64_t irouter;
+        uint32_t offset;
 
         if ( !vgic_reg64_check_access(dabt) ) goto bad_width;
-        rank = vgic_rank_offset(v, 64, gicd_reg - GICD_IROUTER,
-                                DABT_DOUBLE_WORD);
+        rank = vgic_common_rank_offset(v, 64, gicd_reg, DABT_DOUBLE_WORD,
+                                       GICD_IROUTER, GICD_IROUTERnE);
         if ( rank == NULL ) goto read_as_zero;
+        offset = vgic_get_reg_offset(gicd_reg, GICD_IROUTER, GICD_IROUTERnE);
         vgic_lock_rank(v, rank, flags);
-        irouter = vgic_fetch_irouter(rank, gicd_reg - GICD_IROUTER);
+        irouter = vgic_fetch_irouter(rank, offset);
         vgic_unlock_rank(v, rank, flags);
 
         *r = vreg_reg64_extract(irouter, info);
 
         return 1;
     }
-
-    case VRANGE32(0x7FE0, 0xBFFC):
+    case VRANGE32(0x3700, 0x60FC):
+    case VRANGE32(0xA004, 0xBFFC):
         goto read_reserved;
 
     case VRANGE32(0xC000, 0xFFCC):
@@ -1382,12 +1477,23 @@ static int vgic_v3_distr_mmio_write(struct vcpu *v, mmio_info_t *info,
     case VRANGE32(GICD_IPRIORITYR, GICD_IPRIORITYRN):
     case VRANGE32(GICD_ICFGR, GICD_ICFGRN):
     case VRANGE32(GICD_IGRPMODR, GICD_IGRPMODRN):
+    case VRANGE32(GICD_IGROUPRnE, GICD_IGROUPRnEN):
+    case VRANGE32(GICD_ISENABLERnE, GICD_ISENABLERnEN):
+    case VRANGE32(GICD_ICENABLERnE, GICD_ICENABLERnEN):
+    case VRANGE32(GICD_ISPENDRnE, GICD_ISPENDRnEN):
+    case VRANGE32(GICD_ICPENDRnE, GICD_ICPENDRnEN):
+    case VRANGE32(GICD_ISACTIVERnE, GICD_ISACTIVERnEN):
+    case VRANGE32(GICD_ICACTIVERnE, GICD_ICACTIVERnEN):
+    case VRANGE32(GICD_IPRIORITYRnE, GICD_IPRIORITYRnEN):
+    case VRANGE32(GICD_ICFGRnE, GICD_ICFGRnEN):
+    case VRANGE32(GICD_IGRPMODRnE, GICD_IGRPMODRnEN):
         /* Above registers are common with GICR and GICD
          * Manage in common */
         return __vgic_v3_distr_common_mmio_write("vGICD", v, info,
                                                  gicd_reg, r);
 
     case VRANGE32(GICD_NSACR, GICD_NSACRN):
+    case VRANGE32(GICD_NSACRnE, GICD_NSACRnEN):
         /* We do not implement security extensions for guests, write ignore */
         goto write_ignore_32;
 
@@ -1405,26 +1511,35 @@ static int vgic_v3_distr_mmio_write(struct vcpu *v, mmio_info_t *info,
         if ( dabt.size != DABT_WORD ) goto bad_width;
         return 0;
 
-    case VRANGE32(0x0F30, 0x60FC):
+    case VRANGE32(0x0F30, 0x0FFC):
         goto write_reserved;
 
     case VRANGE64(GICD_IROUTER32, GICD_IROUTER1019):
+    case VRANGE64(GICD_IROUTERnE, GICD_IROUTERnEN):
     {
         uint64_t irouter;
+        unsigned int offset, virq;
 
         if ( !vgic_reg64_check_access(dabt) ) goto bad_width;
-        rank = vgic_rank_offset(v, 64, gicd_reg - GICD_IROUTER,
-                                DABT_DOUBLE_WORD);
+        rank = vgic_common_rank_offset(v, 64, gicd_reg, DABT_DOUBLE_WORD,
+                                       GICD_IROUTER, GICD_IROUTERnE);
         if ( rank == NULL ) goto write_ignore;
+        offset = vgic_get_reg_offset(gicd_reg, GICD_IROUTER, GICD_IROUTERnE);
         vgic_lock_rank(v, rank, flags);
-        irouter = vgic_fetch_irouter(rank, gicd_reg - GICD_IROUTER);
+        irouter = vgic_fetch_irouter(rank, offset);
         vreg_reg64_update(&irouter, r, info);
-        vgic_store_irouter(v->domain, rank, gicd_reg - GICD_IROUTER, irouter);
+        /* There is 1 vIRQ per IROUTER */
+        if ( gicd_reg < GICD_IROUTERnE )
+            virq = offset / NR_BYTES_PER_IROUTER;
+        else
+            virq = espi_idx_to_intid(offset / NR_BYTES_PER_IROUTER);
+        vgic_store_irouter(v->domain, rank, virq, irouter);
         vgic_unlock_rank(v, rank, flags);
         return 1;
     }
 
-    case VRANGE32(0x7FE0, 0xBFFC):
+    case VRANGE32(0x3700, 0x60FC):
+    case VRANGE32(0xA004, 0xBFFC):
         goto write_reserved;
 
     case VRANGE32(0xC000, 0xFFCC):
diff --git a/xen/arch/arm/vgic.c b/xen/arch/arm/vgic.c
index eb22de6aa6..3ebdf9953f 100644
--- a/xen/arch/arm/vgic.c
+++ b/xen/arch/arm/vgic.c
@@ -170,6 +170,18 @@ int domain_vgic_register(struct domain *d, unsigned int *mmio_count)
 }
 
 #ifdef CONFIG_GICV3_ESPI
+/*
+ * The function behavior is the same as for regular SPIs (vgic_rank_offset),
+ * but it operates with extended SPI ranks.
+ */
+struct vgic_irq_rank *vgic_ext_rank_offset(struct vcpu *v, unsigned int b,
+                                           unsigned int n, unsigned int s)
+{
+    unsigned int rank = REG_RANK_NR(b, (n >> s));
+
+    return vgic_get_rank(v, rank + EXT_RANK_MIN);
+}
+
 static unsigned int vgic_num_spi_lines(struct domain *d)
 {
     return d->arch.vgic.nr_spis + d->arch.vgic.nr_espis;
@@ -210,6 +222,16 @@ static unsigned int vgic_num_spi_lines(struct domain *d)
     return d->arch.vgic.nr_spis;
 }
 
+/*
+ * It is expected that, in the case of CONFIG_GICV3_ESPI=n, the function will
+ * return NULL. In this scenario, mmio_read/mmio_write will be treated as
+ * RAZ/WI, as expected.
+ */
+struct vgic_irq_rank *vgic_ext_rank_offset(struct vcpu *v, unsigned int b,
+                                           unsigned int n, unsigned int s)
+{
+    return NULL;
+}
 #endif
 
 static unsigned int vgic_num_alloc_irqs(struct domain *d)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Sep 10 06:01:44 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 10 Sep 2025 06:01:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1117556.1463638 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uwDto-00046N-Ql; Wed, 10 Sep 2025 06:01:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1117556.1463638; Wed, 10 Sep 2025 06: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 1uwDto-00046D-Ny; Wed, 10 Sep 2025 06:01:44 +0000
Received: by outflank-mailman (input) for mailman id 1117556;
 Wed, 10 Sep 2025 06: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 1uwDtn-000461-9e
 for xen-changelog@lists.xenproject.org; Wed, 10 Sep 2025 06: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 1uwDtn-0038pq-0r
 for xen-changelog@lists.xenproject.org;
 Wed, 10 Sep 2025 06:01:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uwDtn-002Ttj-0m
 for xen-changelog@lists.xenproject.org;
 Wed, 10 Sep 2025 06: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=01Yf6F+0PdJWDgIK0grMSr6jwE8bRzIWHMlDHrvSbbY=; b=DAqYCdklyMifHZSX87LzhZtthq
	Bk7xED3IARoG+D0JIqbNcHLHjTtpWEr49Vz9ht8eFISS2qlVVuvacqHR9RSdh3fvo0Va36wMOFxc2
	lBdbGVW3RoI0R8qmoksV1v2OKDYjAr8ckBQcMPH7j/D6V/smnnmhe6sOtFUO3z0abAKI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] doc/man: update description for nr_spis with eSPI
Message-Id: <E1uwDtn-002Ttj-0m@xenbits.xenproject.org>
Date: Wed, 10 Sep 2025 06:01:43 +0000

commit 34ebe8266839a7b9b6618924b11f9086fddf10e7
Author:     Leonid Komarianskyi <Leonid_Komarianskyi@epam.com>
AuthorDate: Tue Sep 9 10:09:35 2025 +0000
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Tue Sep 9 16:32:06 2025 -0700

    doc/man: update description for nr_spis with eSPI
    
    Since eSPI support has been introduced, update the documentation with
    the appropriate description.
    
    Signed-off-by: Leonid Komarianskyi <leonid_komarianskyi@epam.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 docs/man/xl.cfg.5.pod.in | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/docs/man/xl.cfg.5.pod.in b/docs/man/xl.cfg.5.pod.in
index 3b18bcc095..ad1553c5e9 100644
--- a/docs/man/xl.cfg.5.pod.in
+++ b/docs/man/xl.cfg.5.pod.in
@@ -3108,11 +3108,14 @@ interval of colors (such as "0-4").
 =item B<nr_spis="NR_SPIS">
 
 An optional integer parameter specifying the number of SPIs (Shared
-Peripheral Interrupts) to allocate for the domain. Max is 960 SPIs. If
-the `nr_spis` parameter is not specified, the value calculated by the toolstack
-will be used for the domain. Otherwise, the value specified by the `nr_spis`
-parameter will be used. The number of SPIs should match the highest interrupt
-ID that will be assigned to the domain.
+Peripheral Interrupts) to allocate for the domain. Max is 960 for regular SPIs
+or 5088 for eSPIs (Extended SPIs). The eSPIs includes an additional 1024 SPIs
+from the eSPI range (4096 to 5119) if the hardware supports extended SPIs
+(GICv3.1+) and CONFIG_GICV3_ESPI is enabled. If the `nr_spis` parameter is not
+specified, the value calculated by the toolstack will be used for the domain.
+Otherwise, the value specified by the `nr_spis` parameter will be used. The
+number of SPIs should match the highest interrupt ID that will be assigned to
+the domain.
 
 =item B<trap_unmapped_accesses=BOOLEAN>
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Sep 10 06:01:54 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 10 Sep 2025 06:01:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1117557.1463641 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uwDty-00048S-S9; Wed, 10 Sep 2025 06:01:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1117557.1463641; Wed, 10 Sep 2025 06: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 1uwDty-00048L-PK; Wed, 10 Sep 2025 06:01:54 +0000
Received: by outflank-mailman (input) for mailman id 1117557;
 Wed, 10 Sep 2025 06: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 1uwDtx-000489-C3
 for xen-changelog@lists.xenproject.org; Wed, 10 Sep 2025 06: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 1uwDtx-0038pw-17
 for xen-changelog@lists.xenproject.org;
 Wed, 10 Sep 2025 06:01:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uwDtx-002TuD-12
 for xen-changelog@lists.xenproject.org;
 Wed, 10 Sep 2025 06: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=esqw92VVe1UHQP9Vfh/TL0YxkVWmPo/H9z6GBpkMrr8=; b=w0Zk6QEERq08VQ36F/9Kx2pAEb
	g4aoELnDoSDRs9cxWrmcaPhNqpC8ntyJd/9A8YDZ5BXW1L37MVwUCvOTqR1MUMEYjucTLinV3+V4+
	l44rtOMJdosjXGGT4hC8RoObfeHCuIlchbE8WaGtCA0HecU0/c8BTYiIzFw2sSzoL9Nk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] CHANGELOG.md: add mention of GICv3.1 eSPI support
Message-Id: <E1uwDtx-002TuD-12@xenbits.xenproject.org>
Date: Wed, 10 Sep 2025 06:01:53 +0000

commit 53c599cc33b61ae70d59572f3c1d843a3def84e2
Author:     Leonid Komarianskyi <Leonid_Komarianskyi@epam.com>
AuthorDate: Tue Sep 9 10:09:39 2025 +0000
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Tue Sep 9 16:32:08 2025 -0700

    CHANGELOG.md: add mention of GICv3.1 eSPI support
    
    The GICv3.1 eSPI (Extended Shared Peripheral Interrupts) range is
    already supported with CONFIG_GICV3_ESPI enabled, so this feature should
    be mentioned in CHANGELOG.md.
    
    Signed-off-by: Leonid Komarianskyi <leonid_komarianskyi@epam.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 cd34ea87b8..7bd96ac09d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -36,6 +36,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
 
  - On Arm:
     - Ability to enable stack protector
+    - GICv3.1 eSPI (Extended Shared Peripheral Interrupts) support for Xen
+      and guest domains.
 
 ### Removed
  - On x86:
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Sep 10 14:22:07 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 10 Sep 2025 14:22:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1118362.1464167 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uwLhz-0007Mh-22; Wed, 10 Sep 2025 14:22:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1118362.1464167; Wed, 10 Sep 2025 14: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 1uwLhy-0007MZ-Vg; Wed, 10 Sep 2025 14:22:02 +0000
Received: by outflank-mailman (input) for mailman id 1118362;
 Wed, 10 Sep 2025 14: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 1uwLhx-0007MT-NE
 for xen-changelog@lists.xenproject.org; Wed, 10 Sep 2025 14: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 1uwLhx-003JDM-28
 for xen-changelog@lists.xenproject.org;
 Wed, 10 Sep 2025 14:22:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uwLhx-002y9Z-1y
 for xen-changelog@lists.xenproject.org;
 Wed, 10 Sep 2025 14: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=YDo3iOmYxLHV3urTxikzUPGCJIzWHdr/Xy6oP81J7KE=; b=IAV80uuPJVL9d54HkhgXl55i38
	SlWbHZ/wV6D/oJkwUc4YQQYC23DcckU7G354IMHnB5cvQC9NHlrqztgaoTBT+tWJQUmNAc8mdRBpt
	vhEsWLXBfljROqPw99a13ITYCBS9qzBwRLJS+Ut4OYmA1bzpy/WJg9I+BDXD9ze88OS8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] CI: Create initrd fragments explicitly as root
Message-Id: <E1uwLhx-002y9Z-1y@xenbits.xenproject.org>
Date: Wed, 10 Sep 2025 14:22:01 +0000

commit e3042c9fc28f2cbeaae6fd248eee7f63ac2ae494
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Sep 9 18:06:37 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Sep 10 10:19:25 2025 +0100

    CI: Create initrd fragments explicitly as root
    
    We have a mix of root and non-root containers, and are trying to become
    rootless.  This can cause the local CPIO fragements to end up being user:user
    in the test environment.
    
    Nothing seems to go wrong so far, but it's a trap waiting to happen.
    
    Make everything consistently root for the initrds, irrespective of the
    rootness of the container the test is running in.
    
    No practical change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Denis Mukhin <dmukhin@ford.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/scripts/build                          | 2 +-
 automation/scripts/qemu-alpine-x86_64.sh          | 4 ++--
 automation/scripts/qemu-smoke-dom0-arm32.sh       | 4 ++--
 automation/scripts/qemu-smoke-dom0-arm64.sh       | 4 ++--
 automation/scripts/qemu-smoke-dom0less-arm32.sh   | 2 +-
 automation/scripts/qemu-smoke-dom0less-arm64.sh   | 4 ++--
 automation/scripts/qubes-x86-64.sh                | 6 +++---
 automation/scripts/xilinx-smoke-dom0-x86_64.sh    | 6 +++---
 automation/scripts/xilinx-smoke-dom0less-arm64.sh | 4 ++--
 9 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/automation/scripts/build b/automation/scripts/build
index 0e7494ff6d..d0511843e7 100755
--- a/automation/scripts/build
+++ b/automation/scripts/build
@@ -108,6 +108,6 @@ else
     # Note: Some smoke tests depending on finding binaries/xen on a full build
     # even though dist/ contains everything, while some containers don't even
     # build Xen
-    (cd dist/install; find | cpio -o -H newc | gzip) > binaries/xen-tools.cpio.gz
+    (cd dist/install; find | cpio -R 0:0 -o -H newc | gzip) > binaries/xen-tools.cpio.gz
     collect_xen_artefacts
 fi
diff --git a/automation/scripts/qemu-alpine-x86_64.sh b/automation/scripts/qemu-alpine-x86_64.sh
index c4666b9507..242ffca693 100755
--- a/automation/scripts/qemu-alpine-x86_64.sh
+++ b/automation/scripts/qemu-alpine-x86_64.sh
@@ -25,7 +25,7 @@ mount -t devtmpfs devtmpfs /dev
 chmod +x initrd/init
 # DomU rootfs
 cd initrd
-find . | cpio -H newc -o | gzip > ../domU-rootfs.cpio.gz
+find . | cpio -R 0:0 -H newc -o | gzip > ../domU-rootfs.cpio.gz
 cd ..
 
 # Dom0 rootfs
@@ -57,7 +57,7 @@ xl -vvv create -c /root/domU.cfg
 
 " > etc/local.d/xen.start
 chmod +x etc/local.d/xen.start
-find . | cpio -H newc -o | gzip >> ../dom0-rootfs.cpio.gz
+find . | cpio -R 0:0 -H newc -o | gzip >> ../dom0-rootfs.cpio.gz
 cd ../..
 
 cat >> binaries/pxelinux.0 << EOF
diff --git a/automation/scripts/qemu-smoke-dom0-arm32.sh b/automation/scripts/qemu-smoke-dom0-arm32.sh
index 36c47daa42..58797f7d30 100755
--- a/automation/scripts/qemu-smoke-dom0-arm32.sh
+++ b/automation/scripts/qemu-smoke-dom0-arm32.sh
@@ -30,13 +30,13 @@ curl --fail --silent --show-error --location --output initrd.tar.gz https://dl-c
 mkdir rootfs
 cd rootfs
 tar xvzf ../initrd.tar.gz
-find . | cpio -H newc -o | gzip > ../root/initrd.cpio.gz
+find . | cpio -R 0:0 -H newc -o | gzip > ../root/initrd.cpio.gz
 cd ..
 rm -rf rootfs
 rm initrd.tar.gz
 
 cp ../zImage ./root
-find . | cpio -H newc -o | gzip > ../initrd.gz
+find . | cpio -R 0:0 -H newc -o | gzip > ../initrd.gz
 cd ..
 
 # XXX QEMU looks for "efi-virtio.rom" even if it is unneeded
diff --git a/automation/scripts/qemu-smoke-dom0-arm64.sh b/automation/scripts/qemu-smoke-dom0-arm64.sh
index ee682015a0..05962bdc02 100755
--- a/automation/scripts/qemu-smoke-dom0-arm64.sh
+++ b/automation/scripts/qemu-smoke-dom0-arm64.sh
@@ -24,7 +24,7 @@ mount -t devtmpfs devtmpfs /dev
 /bin/sh" > initrd/init
 chmod +x initrd/init
 cd initrd
-find . | cpio -H newc -o | gzip > ../domU-rootfs.cpio.gz
+find . | cpio -R 0:0 -H newc -o | gzip > ../domU-rootfs.cpio.gz
 cd ..
 
 # Dom0 rootfs
@@ -54,7 +54,7 @@ xl -vvv create -c /root/domU.cfg
 
 " > etc/local.d/xen.start
 chmod +x etc/local.d/xen.start
-find . | cpio -H newc -o | gzip >> ../dom0-rootfs.cpio.gz
+find . | cpio -R 0:0 -H newc -o | gzip >> ../dom0-rootfs.cpio.gz
 cd ../..
 
 # XXX QEMU looks for "efi-virtio.rom" even if it is unneeded
diff --git a/automation/scripts/qemu-smoke-dom0less-arm32.sh b/automation/scripts/qemu-smoke-dom0less-arm32.sh
index e27636dc9e..627d890a39 100755
--- a/automation/scripts/qemu-smoke-dom0less-arm32.sh
+++ b/automation/scripts/qemu-smoke-dom0less-arm32.sh
@@ -75,7 +75,7 @@ mount -t devtmpfs devtmpfs /dev
 ${domU_check}
 /bin/sh" > init
 chmod +x init
-find . | cpio -H newc -o | gzip > ../initrd.gz
+find . | cpio -R 0:0 -H newc -o | gzip > ../initrd.gz
 cd ..
 
 # XXX QEMU looks for "efi-virtio.rom" even if it is unneeded
diff --git a/automation/scripts/qemu-smoke-dom0less-arm64.sh b/automation/scripts/qemu-smoke-dom0less-arm64.sh
index e660485f3a..05c4a6acbb 100755
--- a/automation/scripts/qemu-smoke-dom0less-arm64.sh
+++ b/automation/scripts/qemu-smoke-dom0less-arm64.sh
@@ -111,7 +111,7 @@ ${domU_check}
 /bin/sh" > initrd/init
 chmod +x initrd/init
 cd initrd
-find . | cpio --create --format='newc' | gzip > ../binaries/initrd
+find . | cpio -R 0:0 -o -H newc | gzip > ../binaries/initrd
 cd ..
 
 # Dom0 rootfs
@@ -139,7 +139,7 @@ xl network-attach 1 type=vif
 ${dom0_check}
 " > etc/local.d/xen.start
 chmod +x etc/local.d/xen.start
-find . | cpio -H newc -o | gzip >> ../binaries/dom0-rootfs.cpio.gz
+find . | cpio -R 0:0 -H newc -o | gzip >> ../binaries/dom0-rootfs.cpio.gz
 cd ..
 
 # ImageBuilder
diff --git a/automation/scripts/qubes-x86-64.sh b/automation/scripts/qubes-x86-64.sh
index bd939dc948..7a59fa5f11 100755
--- a/automation/scripts/qubes-x86-64.sh
+++ b/automation/scripts/qubes-x86-64.sh
@@ -184,7 +184,7 @@ ${domU_check}
 Kernel \r on an \m (\l)
 
 " > etc/issue
-    find . | cpio -H newc -o | gzip >> ../binaries/domU-rootfs.cpio.gz
+    find . | cpio -R 0:0 -H newc -o | gzip >> ../binaries/domU-rootfs.cpio.gz
     cd ..
     rm -rf rootfs
 
@@ -193,7 +193,7 @@ Kernel \r on an \m (\l)
     cd rootfs
     cp ../binaries/bzImage boot/vmlinuz-domU
     cp ../binaries/domU-rootfs.cpio.gz boot/initrd-domU
-    find . | cpio -H newc -o > ../binaries/domU-in-dom0.cpio
+    find . | cpio -R 0:0 -H newc -o > ../binaries/domU-in-dom0.cpio
     cd ..
     rm -rf rootfs
 
@@ -252,7 +252,7 @@ mkdir -p etc/default
 echo "XENCONSOLED_TRACE=all" >> etc/default/xencommons
 echo "QEMU_XEN=/bin/false" >> etc/default/xencommons
 mkdir -p var/log/xen/console
-find . | cpio -H newc -o | gzip >> ../binaries/dom0-rootfs.cpio.gz
+find . | cpio -R 0:0 -H newc -o | gzip >> ../binaries/dom0-rootfs.cpio.gz
 cd ..
 
 
diff --git a/automation/scripts/xilinx-smoke-dom0-x86_64.sh b/automation/scripts/xilinx-smoke-dom0-x86_64.sh
index 96f534f3aa..5379738019 100755
--- a/automation/scripts/xilinx-smoke-dom0-x86_64.sh
+++ b/automation/scripts/xilinx-smoke-dom0-x86_64.sh
@@ -102,7 +102,7 @@ echo "domU Welcome to Alpine Linux
 Kernel \r on an \m (\l)
 
 " > etc/issue
-find . | cpio -H newc -o | gzip >> ../binaries/domU-rootfs.cpio.gz
+find . | cpio -R 0:0 -H newc -o | gzip >> ../binaries/domU-rootfs.cpio.gz
 cd ..
 rm -rf rootfs
 
@@ -111,7 +111,7 @@ mkdir -p rootfs/boot
 cd rootfs
 cp ../binaries/bzImage boot/vmlinuz-domU
 cp ../binaries/domU-rootfs.cpio.gz boot/initrd-domU
-find . | cpio -H newc -o > ../binaries/domU-in-dom0.cpio
+find . | cpio -R 0:0 -H newc -o > ../binaries/domU-in-dom0.cpio
 cd ..
 rm -rf rootfs
 
@@ -141,7 +141,7 @@ echo "${DOMU_CFG}${DOMU_CFG_EXTRA}" > etc/xen/domU.cfg
 echo "XENCONSOLED_TRACE=all" >> etc/default/xencommons
 echo "QEMU_XEN=/bin/false" >> etc/default/xencommons
 mkdir -p var/log/xen/console
-find . | cpio -H newc -o | gzip >> ../binaries/dom0-rootfs.cpio.gz
+find . | cpio -R 0:0 -H newc -o | gzip >> ../binaries/dom0-rootfs.cpio.gz
 cd ..
 
 # Load software into TFTP server directory.
diff --git a/automation/scripts/xilinx-smoke-dom0less-arm64.sh b/automation/scripts/xilinx-smoke-dom0less-arm64.sh
index a6da7a830c..61d6c686f7 100755
--- a/automation/scripts/xilinx-smoke-dom0less-arm64.sh
+++ b/automation/scripts/xilinx-smoke-dom0less-arm64.sh
@@ -50,7 +50,7 @@ echo "#!/bin/sh
 ${domU_check}
 /bin/sh" > etc/local.d/xen.start
 chmod +x etc/local.d/xen.start
-find . | cpio -H newc -o | gzip >> ../binaries/domU-rootfs.cpio.gz
+find . | cpio -R 0:0 -H newc -o | gzip >> ../binaries/domU-rootfs.cpio.gz
 cd ..
 rm -rf rootfs
 
@@ -71,7 +71,7 @@ bash /etc/init.d/xencommons start
 ${dom0_check}
 " > etc/local.d/xen.start
 chmod +x etc/local.d/xen.start
-find . | cpio -H newc -o | gzip >> ../binaries/dom0-rootfs.cpio.gz
+find . | cpio -R 0:0 -H newc -o | gzip >> ../binaries/dom0-rootfs.cpio.gz
 cd ..
 
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Sep 10 16:00:06 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 10 Sep 2025 16:00:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1118590.1464322 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uwNEp-0002z6-EJ; Wed, 10 Sep 2025 16:00:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1118590.1464322; Wed, 10 Sep 2025 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 1uwNEp-0002yb-Aq; Wed, 10 Sep 2025 16:00:03 +0000
Received: by outflank-mailman (input) for mailman id 1118590;
 Wed, 10 Sep 2025 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 1uwNEo-0002i8-8Y
 for xen-changelog@lists.xenproject.org; Wed, 10 Sep 2025 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 1uwNEo-003LLh-0Z
 for xen-changelog@lists.xenproject.org;
 Wed, 10 Sep 2025 16:00:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uwNEo-0033Y3-0R
 for xen-changelog@lists.xenproject.org;
 Wed, 10 Sep 2025 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=MOGascVAnakWbER3e4WdomRI+vy8/fopdoonETfo9ng=; b=E67h9dsfEW/zHqYjKTBxbwe7i2
	3x25Dl45ckhfno2cqd3PcS925wnlT/PWeRQ/8HfhZyqnAQewXP/xMcjrTX1yyM1nlzuieNEjb5rIh
	VYQ+lE89xYSBDqVdrXf4J1NRUA3E77yvv9mRaMyO1qucn0/M1QHdaBWAz9EiVxXe+k5E=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] CI: Create initrd fragments explicitly as root
Message-Id: <E1uwNEo-0033Y3-0R@xenbits.xenproject.org>
Date: Wed, 10 Sep 2025 16:00:02 +0000

commit e3042c9fc28f2cbeaae6fd248eee7f63ac2ae494
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Sep 9 18:06:37 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Sep 10 10:19:25 2025 +0100

    CI: Create initrd fragments explicitly as root
    
    We have a mix of root and non-root containers, and are trying to become
    rootless.  This can cause the local CPIO fragements to end up being user:user
    in the test environment.
    
    Nothing seems to go wrong so far, but it's a trap waiting to happen.
    
    Make everything consistently root for the initrds, irrespective of the
    rootness of the container the test is running in.
    
    No practical change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Denis Mukhin <dmukhin@ford.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/scripts/build                          | 2 +-
 automation/scripts/qemu-alpine-x86_64.sh          | 4 ++--
 automation/scripts/qemu-smoke-dom0-arm32.sh       | 4 ++--
 automation/scripts/qemu-smoke-dom0-arm64.sh       | 4 ++--
 automation/scripts/qemu-smoke-dom0less-arm32.sh   | 2 +-
 automation/scripts/qemu-smoke-dom0less-arm64.sh   | 4 ++--
 automation/scripts/qubes-x86-64.sh                | 6 +++---
 automation/scripts/xilinx-smoke-dom0-x86_64.sh    | 6 +++---
 automation/scripts/xilinx-smoke-dom0less-arm64.sh | 4 ++--
 9 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/automation/scripts/build b/automation/scripts/build
index 0e7494ff6d..d0511843e7 100755
--- a/automation/scripts/build
+++ b/automation/scripts/build
@@ -108,6 +108,6 @@ else
     # Note: Some smoke tests depending on finding binaries/xen on a full build
     # even though dist/ contains everything, while some containers don't even
     # build Xen
-    (cd dist/install; find | cpio -o -H newc | gzip) > binaries/xen-tools.cpio.gz
+    (cd dist/install; find | cpio -R 0:0 -o -H newc | gzip) > binaries/xen-tools.cpio.gz
     collect_xen_artefacts
 fi
diff --git a/automation/scripts/qemu-alpine-x86_64.sh b/automation/scripts/qemu-alpine-x86_64.sh
index c4666b9507..242ffca693 100755
--- a/automation/scripts/qemu-alpine-x86_64.sh
+++ b/automation/scripts/qemu-alpine-x86_64.sh
@@ -25,7 +25,7 @@ mount -t devtmpfs devtmpfs /dev
 chmod +x initrd/init
 # DomU rootfs
 cd initrd
-find . | cpio -H newc -o | gzip > ../domU-rootfs.cpio.gz
+find . | cpio -R 0:0 -H newc -o | gzip > ../domU-rootfs.cpio.gz
 cd ..
 
 # Dom0 rootfs
@@ -57,7 +57,7 @@ xl -vvv create -c /root/domU.cfg
 
 " > etc/local.d/xen.start
 chmod +x etc/local.d/xen.start
-find . | cpio -H newc -o | gzip >> ../dom0-rootfs.cpio.gz
+find . | cpio -R 0:0 -H newc -o | gzip >> ../dom0-rootfs.cpio.gz
 cd ../..
 
 cat >> binaries/pxelinux.0 << EOF
diff --git a/automation/scripts/qemu-smoke-dom0-arm32.sh b/automation/scripts/qemu-smoke-dom0-arm32.sh
index 36c47daa42..58797f7d30 100755
--- a/automation/scripts/qemu-smoke-dom0-arm32.sh
+++ b/automation/scripts/qemu-smoke-dom0-arm32.sh
@@ -30,13 +30,13 @@ curl --fail --silent --show-error --location --output initrd.tar.gz https://dl-c
 mkdir rootfs
 cd rootfs
 tar xvzf ../initrd.tar.gz
-find . | cpio -H newc -o | gzip > ../root/initrd.cpio.gz
+find . | cpio -R 0:0 -H newc -o | gzip > ../root/initrd.cpio.gz
 cd ..
 rm -rf rootfs
 rm initrd.tar.gz
 
 cp ../zImage ./root
-find . | cpio -H newc -o | gzip > ../initrd.gz
+find . | cpio -R 0:0 -H newc -o | gzip > ../initrd.gz
 cd ..
 
 # XXX QEMU looks for "efi-virtio.rom" even if it is unneeded
diff --git a/automation/scripts/qemu-smoke-dom0-arm64.sh b/automation/scripts/qemu-smoke-dom0-arm64.sh
index ee682015a0..05962bdc02 100755
--- a/automation/scripts/qemu-smoke-dom0-arm64.sh
+++ b/automation/scripts/qemu-smoke-dom0-arm64.sh
@@ -24,7 +24,7 @@ mount -t devtmpfs devtmpfs /dev
 /bin/sh" > initrd/init
 chmod +x initrd/init
 cd initrd
-find . | cpio -H newc -o | gzip > ../domU-rootfs.cpio.gz
+find . | cpio -R 0:0 -H newc -o | gzip > ../domU-rootfs.cpio.gz
 cd ..
 
 # Dom0 rootfs
@@ -54,7 +54,7 @@ xl -vvv create -c /root/domU.cfg
 
 " > etc/local.d/xen.start
 chmod +x etc/local.d/xen.start
-find . | cpio -H newc -o | gzip >> ../dom0-rootfs.cpio.gz
+find . | cpio -R 0:0 -H newc -o | gzip >> ../dom0-rootfs.cpio.gz
 cd ../..
 
 # XXX QEMU looks for "efi-virtio.rom" even if it is unneeded
diff --git a/automation/scripts/qemu-smoke-dom0less-arm32.sh b/automation/scripts/qemu-smoke-dom0less-arm32.sh
index e27636dc9e..627d890a39 100755
--- a/automation/scripts/qemu-smoke-dom0less-arm32.sh
+++ b/automation/scripts/qemu-smoke-dom0less-arm32.sh
@@ -75,7 +75,7 @@ mount -t devtmpfs devtmpfs /dev
 ${domU_check}
 /bin/sh" > init
 chmod +x init
-find . | cpio -H newc -o | gzip > ../initrd.gz
+find . | cpio -R 0:0 -H newc -o | gzip > ../initrd.gz
 cd ..
 
 # XXX QEMU looks for "efi-virtio.rom" even if it is unneeded
diff --git a/automation/scripts/qemu-smoke-dom0less-arm64.sh b/automation/scripts/qemu-smoke-dom0less-arm64.sh
index e660485f3a..05c4a6acbb 100755
--- a/automation/scripts/qemu-smoke-dom0less-arm64.sh
+++ b/automation/scripts/qemu-smoke-dom0less-arm64.sh
@@ -111,7 +111,7 @@ ${domU_check}
 /bin/sh" > initrd/init
 chmod +x initrd/init
 cd initrd
-find . | cpio --create --format='newc' | gzip > ../binaries/initrd
+find . | cpio -R 0:0 -o -H newc | gzip > ../binaries/initrd
 cd ..
 
 # Dom0 rootfs
@@ -139,7 +139,7 @@ xl network-attach 1 type=vif
 ${dom0_check}
 " > etc/local.d/xen.start
 chmod +x etc/local.d/xen.start
-find . | cpio -H newc -o | gzip >> ../binaries/dom0-rootfs.cpio.gz
+find . | cpio -R 0:0 -H newc -o | gzip >> ../binaries/dom0-rootfs.cpio.gz
 cd ..
 
 # ImageBuilder
diff --git a/automation/scripts/qubes-x86-64.sh b/automation/scripts/qubes-x86-64.sh
index bd939dc948..7a59fa5f11 100755
--- a/automation/scripts/qubes-x86-64.sh
+++ b/automation/scripts/qubes-x86-64.sh
@@ -184,7 +184,7 @@ ${domU_check}
 Kernel \r on an \m (\l)
 
 " > etc/issue
-    find . | cpio -H newc -o | gzip >> ../binaries/domU-rootfs.cpio.gz
+    find . | cpio -R 0:0 -H newc -o | gzip >> ../binaries/domU-rootfs.cpio.gz
     cd ..
     rm -rf rootfs
 
@@ -193,7 +193,7 @@ Kernel \r on an \m (\l)
     cd rootfs
     cp ../binaries/bzImage boot/vmlinuz-domU
     cp ../binaries/domU-rootfs.cpio.gz boot/initrd-domU
-    find . | cpio -H newc -o > ../binaries/domU-in-dom0.cpio
+    find . | cpio -R 0:0 -H newc -o > ../binaries/domU-in-dom0.cpio
     cd ..
     rm -rf rootfs
 
@@ -252,7 +252,7 @@ mkdir -p etc/default
 echo "XENCONSOLED_TRACE=all" >> etc/default/xencommons
 echo "QEMU_XEN=/bin/false" >> etc/default/xencommons
 mkdir -p var/log/xen/console
-find . | cpio -H newc -o | gzip >> ../binaries/dom0-rootfs.cpio.gz
+find . | cpio -R 0:0 -H newc -o | gzip >> ../binaries/dom0-rootfs.cpio.gz
 cd ..
 
 
diff --git a/automation/scripts/xilinx-smoke-dom0-x86_64.sh b/automation/scripts/xilinx-smoke-dom0-x86_64.sh
index 96f534f3aa..5379738019 100755
--- a/automation/scripts/xilinx-smoke-dom0-x86_64.sh
+++ b/automation/scripts/xilinx-smoke-dom0-x86_64.sh
@@ -102,7 +102,7 @@ echo "domU Welcome to Alpine Linux
 Kernel \r on an \m (\l)
 
 " > etc/issue
-find . | cpio -H newc -o | gzip >> ../binaries/domU-rootfs.cpio.gz
+find . | cpio -R 0:0 -H newc -o | gzip >> ../binaries/domU-rootfs.cpio.gz
 cd ..
 rm -rf rootfs
 
@@ -111,7 +111,7 @@ mkdir -p rootfs/boot
 cd rootfs
 cp ../binaries/bzImage boot/vmlinuz-domU
 cp ../binaries/domU-rootfs.cpio.gz boot/initrd-domU
-find . | cpio -H newc -o > ../binaries/domU-in-dom0.cpio
+find . | cpio -R 0:0 -H newc -o > ../binaries/domU-in-dom0.cpio
 cd ..
 rm -rf rootfs
 
@@ -141,7 +141,7 @@ echo "${DOMU_CFG}${DOMU_CFG_EXTRA}" > etc/xen/domU.cfg
 echo "XENCONSOLED_TRACE=all" >> etc/default/xencommons
 echo "QEMU_XEN=/bin/false" >> etc/default/xencommons
 mkdir -p var/log/xen/console
-find . | cpio -H newc -o | gzip >> ../binaries/dom0-rootfs.cpio.gz
+find . | cpio -R 0:0 -H newc -o | gzip >> ../binaries/dom0-rootfs.cpio.gz
 cd ..
 
 # Load software into TFTP server directory.
diff --git a/automation/scripts/xilinx-smoke-dom0less-arm64.sh b/automation/scripts/xilinx-smoke-dom0less-arm64.sh
index a6da7a830c..61d6c686f7 100755
--- a/automation/scripts/xilinx-smoke-dom0less-arm64.sh
+++ b/automation/scripts/xilinx-smoke-dom0less-arm64.sh
@@ -50,7 +50,7 @@ echo "#!/bin/sh
 ${domU_check}
 /bin/sh" > etc/local.d/xen.start
 chmod +x etc/local.d/xen.start
-find . | cpio -H newc -o | gzip >> ../binaries/domU-rootfs.cpio.gz
+find . | cpio -R 0:0 -H newc -o | gzip >> ../binaries/domU-rootfs.cpio.gz
 cd ..
 rm -rf rootfs
 
@@ -71,7 +71,7 @@ bash /etc/init.d/xencommons start
 ${dom0_check}
 " > etc/local.d/xen.start
 chmod +x etc/local.d/xen.start
-find . | cpio -H newc -o | gzip >> ../binaries/dom0-rootfs.cpio.gz
+find . | cpio -R 0:0 -H newc -o | gzip >> ../binaries/dom0-rootfs.cpio.gz
 cd ..
 
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Sep 10 17:55:06 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 10 Sep 2025 17:55:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1118688.1464358 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uwP26-0002M2-Tm; Wed, 10 Sep 2025 17:55:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1118688.1464358; Wed, 10 Sep 2025 17: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 1uwP26-0002Lv-RF; Wed, 10 Sep 2025 17:55:02 +0000
Received: by outflank-mailman (input) for mailman id 1118688;
 Wed, 10 Sep 2025 17: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 1uwP26-0002Lp-Gz
 for xen-changelog@lists.xenproject.org; Wed, 10 Sep 2025 17: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 1uwP26-003NvU-1Q
 for xen-changelog@lists.xenproject.org;
 Wed, 10 Sep 2025 17:55:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uwP26-003Fy7-1F
 for xen-changelog@lists.xenproject.org;
 Wed, 10 Sep 2025 17: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=bSIq0qlDiQJUcZSYVpYvTZPrk/cQDV8pv/5H6/lElgc=; b=3jqCPBmgqg/vaNwobJA/xNTyTj
	hEDt5EcZWmQrew/8eg3gVGOEzkiDSvkKCRfsUqdfcMdJy2kJaqCWag/PJqjnIrQLcy2mx7Es3JhQE
	sqk19LUMTTM/XaJTL2NGb/SICxAWoGbUj3r3/o+9S3tupMvaAI3XxZMiEkuiuggGhs/A=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] stubdom: Fix -Wimplicit-int in newlib
Message-Id: <E1uwP26-003Fy7-1F@xenbits.xenproject.org>
Date: Wed, 10 Sep 2025 17:55:02 +0000

commit dc39962c782ce516e988379969288c4e620cf66f
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Sat Aug 9 22:55:26 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Sep 10 17:30:22 2025 +0100

    stubdom: Fix -Wimplicit-int in newlib
    
    This is an error now Debian Trixie's gcc-14
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
---
 stubdom/Makefile               |  1 +
 stubdom/newlib-fix-etext.patch | 23 +++++++++++++++++++++++
 2 files changed, 24 insertions(+)

diff --git a/stubdom/Makefile b/stubdom/Makefile
index 666c3221dc..9aa0d3dee4 100644
--- a/stubdom/Makefile
+++ b/stubdom/Makefile
@@ -94,6 +94,7 @@ newlib-$(NEWLIB_VERSION): newlib-$(NEWLIB_VERSION).tar.gz
 	patch -d $@ -p1 < newlib-cygmon-gmon.patch
 	patch -d $@ -p1 < newlib-makedoc.patch
 	patch -d $@ -p1 < newlib-fix-copy_past_newline.patch
+	patch -d $@ -p1 < newlib-fix-etext.patch
 	find $@ -type f | xargs perl -i.bak \
 		-pe 's/\b_(tzname|daylight|timezone)\b/$$1/g'
 	touch $@
diff --git a/stubdom/newlib-fix-etext.patch b/stubdom/newlib-fix-etext.patch
new file mode 100644
index 0000000000..e7bd4bb0ce
--- /dev/null
+++ b/stubdom/newlib-fix-etext.patch
@@ -0,0 +1,23 @@
+GCC-14 in Debian Trixie i386 complains:
+
+../../../../newlib-1.16.0/libgloss/i386/cygmon-gmon.c: In function '_mcount':
+../../../../newlib-1.16.0/libgloss/i386/cygmon-gmon.c:227:14: error: type defaults to 'int' in declaration of '_etext' [-Wimplicit-int]
+  227 |       extern _etext();
+      |              ^~~~~~
+../../../../newlib-1.16.0/libgloss/i386/cygmon-gmon.c:228:14: error: type defaults to 'int' in declaration of '_ftext' [-Wimplicit-int]
+  228 |       extern _ftext();
+      |              ^~~~~~
+
+--- newlib-1.16.0/libgloss/i386/cygmon-gmon.c.orig	2025-08-09 22:48:09.864068481 +0100
++++ newlib-1.16.0/libgloss/i386/cygmon-gmon.c	2025-08-09 22:52:18.458393484 +0100
+@@ -224,8 +224,8 @@
+ 
+   if (! already_setup) 
+     {
+-      extern _etext();
+-      extern _ftext();
++      extern char _etext[];
++      extern char _ftext[];
+       already_setup = 1;
+       monstartup(_ftext, _etext);
+       atexit(_mcleanup);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Sep 10 17:55:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 10 Sep 2025 17:55:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1118689.1464362 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uwP2H-0002Ny-VF; Wed, 10 Sep 2025 17:55:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1118689.1464362; Wed, 10 Sep 2025 17: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 1uwP2H-0002Nq-Sj; Wed, 10 Sep 2025 17:55:13 +0000
Received: by outflank-mailman (input) for mailman id 1118689;
 Wed, 10 Sep 2025 17: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 1uwP2G-0002Nf-Kg
 for xen-changelog@lists.xenproject.org; Wed, 10 Sep 2025 17: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 1uwP2G-003Nvr-1y
 for xen-changelog@lists.xenproject.org;
 Wed, 10 Sep 2025 17:55:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uwP2G-003Fyq-1a
 for xen-changelog@lists.xenproject.org;
 Wed, 10 Sep 2025 17: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=S2Tr0xtEU1/4npxucF1UzT/uwL5NPhb1+Gj97YVjDrc=; b=RxU4eRV6PO+/GdclgGTszSUaaU
	iSCHzOls405yuhRW6M2GYphYEARB+pHyqEzcn67/iGvz/5aAOVONMZBSGq9/ZN8j/HbC0VcnzTG6y
	hrgq/BE8XssN2O0FoLF/urSGhKsCLR4ZyWD/A3bemAkb4uR4caj+0w/RbdBUdpOAYMcU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] CI: Update riscv64 to use Debian Trixie
Message-Id: <E1uwP2G-003Fyq-1a@xenbits.xenproject.org>
Date: Wed, 10 Sep 2025 17:55:12 +0000

commit aad6ebf0596f7eda6ea709f1c293ef5911ae8938
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Sat Aug 9 21:05:11 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Sep 10 17:30:22 2025 +0100

    CI: Update riscv64 to use Debian Trixie
    
    Everything works fine with Debian 13.  Provide two new build jobs, and update
    both the randconfig the test jobs.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
---
 automation/build/debian/13-riscv64.dockerfile | 37 +++++++++++++++++++++++++++
 automation/gitlab-ci/build.yaml               | 22 +++++++++++++---
 automation/gitlab-ci/test.yaml                |  2 +-
 automation/scripts/containerize               |  1 +
 4 files changed, 57 insertions(+), 5 deletions(-)

diff --git a/automation/build/debian/13-riscv64.dockerfile b/automation/build/debian/13-riscv64.dockerfile
new file mode 100644
index 0000000000..d2736c657d
--- /dev/null
+++ b/automation/build/debian/13-riscv64.dockerfile
@@ -0,0 +1,37 @@
+# syntax=docker/dockerfile:1
+FROM --platform=linux/amd64 debian:trixie-slim
+LABEL maintainer.name="The Xen Project"
+LABEL maintainer.email="xen-devel@lists.xenproject.org"
+
+ENV DEBIAN_FRONTEND=noninteractive
+ENV CROSS_COMPILE=riscv64-linux-gnu-
+ENV XEN_TARGET_ARCH=riscv64
+
+RUN <<EOF
+#!/bin/bash
+    set -e
+
+    useradd --create-home user
+
+    apt-get update
+
+    DEPS=(
+        # Xen
+        bison
+        build-essential
+        checkpolicy
+        flex
+        gcc-riscv64-linux-gnu
+        python3-minimal
+
+        # Qemu for test phase
+        qemu-system-riscv64
+        expect
+    )
+
+    apt-get -y --no-install-recommends install "${DEPS[@]}"
+    rm -rf /var/lib/apt/lists/*
+EOF
+
+USER user
+WORKDIR /build
diff --git a/automation/gitlab-ci/build.yaml b/automation/gitlab-ci/build.yaml
index ab5211f77e..c0728e58c4 100644
--- a/automation/gitlab-ci/build.yaml
+++ b/automation/gitlab-ci/build.yaml
@@ -329,10 +329,10 @@ debian-12-ppc64le-gcc-debug:
       CONFIG_UBSAN=y
       CONFIG_UBSAN_FATAL=y
 
-debian-12-riscv64-gcc-debug:
+debian-13-riscv64-gcc-debug:
   extends: .gcc-riscv64-cross-build-debug
   variables:
-    CONTAINER: debian:12-riscv64
+    CONTAINER: debian:13-riscv64
     KBUILD_DEFCONFIG: tiny64_defconfig
     HYPERVISOR_ONLY: y
     EXTRA_XEN_CONFIG: |
@@ -713,6 +713,20 @@ debian-12-riscv64-gcc:
     KBUILD_DEFCONFIG: tiny64_defconfig
     HYPERVISOR_ONLY: y
 
+debian-12-riscv64-gcc-debug:
+  extends: .gcc-riscv64-cross-build-debug
+  variables:
+    CONTAINER: debian:12-riscv64
+    KBUILD_DEFCONFIG: tiny64_defconfig
+    HYPERVISOR_ONLY: y
+
+debian-13-riscv64-gcc:
+  extends: .gcc-riscv64-cross-build
+  variables:
+    CONTAINER: debian:13-riscv64
+    KBUILD_DEFCONFIG: tiny64_defconfig
+    HYPERVISOR_ONLY: y
+
 .riscv-fixed-randconfig:
   variables: &riscv-fixed-randconfig
     EXTRA_FIXED_RANDCONFIG: |
@@ -725,10 +739,10 @@ debian-12-riscv64-gcc:
       CONFIG_VM_EVENT=n
       CONFIG_XSM=n
 
-debian-12-riscv64-gcc-randconfig:
+debian-13-riscv64-gcc-randconfig:
   extends: .gcc-riscv64-cross-build
   variables:
-    CONTAINER: debian:12-riscv64
+    CONTAINER: debian:13-riscv64
     KBUILD_DEFCONFIG: tiny64_defconfig
     RANDCONFIG: y
     <<: *riscv-fixed-randconfig
diff --git a/automation/gitlab-ci/test.yaml b/automation/gitlab-ci/test.yaml
index 1f0b27b237..95b883b32b 100644
--- a/automation/gitlab-ci/test.yaml
+++ b/automation/gitlab-ci/test.yaml
@@ -705,7 +705,7 @@ qemu-smoke-riscv64-gcc:
   script:
     - ./automation/scripts/qemu-smoke-riscv64.sh 2>&1 | tee ${LOGFILE}
   needs:
-    - debian-12-riscv64-gcc-debug
+    - debian-13-riscv64-gcc-debug
 
 qemu-smoke-ppc64le-powernv9-gcc:
   extends: .qemu-ppc64le
diff --git a/automation/scripts/containerize b/automation/scripts/containerize
index 0953e0728c..340b6caaab 100755
--- a/automation/scripts/containerize
+++ b/automation/scripts/containerize
@@ -32,6 +32,7 @@ case "_${CONTAINER}" in
     _bullseye-ppc64le) CONTAINER="${BASE}/debian:11-ppc64le" ;;
     _bookworm-ppc64le) CONTAINER="${BASE}/debian:12-ppc64le" ;;
     _bookworm-riscv64) CONTAINER="${BASE}/debian:12-riscv64" ;;
+    _trixie-riscv64) CONTAINER="${BASE}/debian:13-riscv64" ;;
     _bookworm-x86_64-gcc-ibt) CONTAINER="${BASE}/debian:12-x86_64-gcc-ibt" ;;
     _bookworm|_bookworm-x86_64|_) CONTAINER="${BASE}/debian:12-x86_64" ;;
     _bookworm-i386|_bookworm-x86_32) CONTAINER="${BASE}/debian:12-x86_32" ;;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Sep 10 17:55:24 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 10 Sep 2025 17:55:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1118690.1464367 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uwP2S-0002Qj-1v; Wed, 10 Sep 2025 17:55:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1118690.1464367; Wed, 10 Sep 2025 17: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 1uwP2R-0002Qb-VY; Wed, 10 Sep 2025 17:55:23 +0000
Received: by outflank-mailman (input) for mailman id 1118690;
 Wed, 10 Sep 2025 17:55: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 1uwP2Q-0002QT-Ur
 for xen-changelog@lists.xenproject.org; Wed, 10 Sep 2025 17: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 1uwP2Q-003Nvv-2o
 for xen-changelog@lists.xenproject.org;
 Wed, 10 Sep 2025 17:55:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uwP2Q-003Fzg-2h
 for xen-changelog@lists.xenproject.org;
 Wed, 10 Sep 2025 17: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=CnHQcte1jrW7hw50uMWGr/cJ5Kc5CFImJQaIeY7EewU=; b=G2i5ueaK2mPA/pXsPpfBBiaKlp
	Np/CshbjDs9wswUw+fEVgEmN9a9Zhg5bAUTc8hGXmRQFfLfOlw5XrZ/w4Ejc2yPxeVKw8rNkhtx5y
	hQDeg+RhAUNMDyMeQHZAI1177VtIJXoaLgMTJJBp+DmUI11S5eD9ow5Osig+u96HNZ04=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.20] CI: Create initrd fragments explicitly as root
Message-Id: <E1uwP2Q-003Fzg-2h@xenbits.xenproject.org>
Date: Wed, 10 Sep 2025 17:55:22 +0000

commit ae992e68d3ed7a177adea8b9afa4ec88c27254f0
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Sep 9 18:06:37 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Sep 10 17:19:50 2025 +0100

    CI: Create initrd fragments explicitly as root
    
    We have a mix of root and non-root containers, and are trying to become
    rootless.  This can cause the local CPIO fragements to end up being user:user
    in the test environment.
    
    Nothing seems to go wrong so far, but it's a trap waiting to happen.
    
    Make everything consistently root for the initrds, irrespective of the
    rootness of the container the test is running in.
    
    No practical change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Denis Mukhin <dmukhin@ford.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
    (cherry picked from commit e3042c9fc28f2cbeaae6fd248eee7f63ac2ae494)
---
 automation/scripts/build                          | 2 +-
 automation/scripts/qemu-alpine-x86_64.sh          | 4 ++--
 automation/scripts/qemu-smoke-dom0-arm32.sh       | 4 ++--
 automation/scripts/qemu-smoke-dom0-arm64.sh       | 4 ++--
 automation/scripts/qemu-smoke-dom0less-arm32.sh   | 2 +-
 automation/scripts/qemu-smoke-dom0less-arm64.sh   | 4 ++--
 automation/scripts/qubes-x86-64.sh                | 4 ++--
 automation/scripts/xilinx-smoke-dom0-x86_64.sh    | 4 ++--
 automation/scripts/xilinx-smoke-dom0less-arm64.sh | 4 ++--
 9 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/automation/scripts/build b/automation/scripts/build
index a348c781d1..fdf72ee735 100755
--- a/automation/scripts/build
+++ b/automation/scripts/build
@@ -108,7 +108,7 @@ else
     # Note: Some smoke tests depending on finding binaries/xen on a full build
     # even though dist/ contains everything, while some containers don't even
     # build Xen
-    (cd dist/install; find | cpio -o -H newc | gzip) > binaries/xen-tools.cpio.gz
+    (cd dist/install; find | cpio -R 0:0 -o -H newc | gzip) > binaries/xen-tools.cpio.gz
     cp -r tools/tests binaries/
     collect_xen_artefacts
 fi
diff --git a/automation/scripts/qemu-alpine-x86_64.sh b/automation/scripts/qemu-alpine-x86_64.sh
index 746e70483d..b95e63360b 100755
--- a/automation/scripts/qemu-alpine-x86_64.sh
+++ b/automation/scripts/qemu-alpine-x86_64.sh
@@ -25,7 +25,7 @@ mount -t devtmpfs devtmpfs /dev
 chmod +x initrd/init
 # DomU rootfs
 cd initrd
-find . | cpio -H newc -o | gzip > ../domU-rootfs.cpio.gz
+find . | cpio -R 0:0 -H newc -o | gzip > ../domU-rootfs.cpio.gz
 cd ..
 
 # Dom0 rootfs
@@ -57,7 +57,7 @@ xl -vvv create -c /root/domU.cfg
 
 " > etc/local.d/xen.start
 chmod +x etc/local.d/xen.start
-find . | cpio -H newc -o | gzip >> ../dom0-rootfs.cpio.gz
+find . | cpio -R 0:0 -H newc -o | gzip >> ../dom0-rootfs.cpio.gz
 cd ../..
 
 cat >> binaries/pxelinux.0 << EOF
diff --git a/automation/scripts/qemu-smoke-dom0-arm32.sh b/automation/scripts/qemu-smoke-dom0-arm32.sh
index 4f50eabdef..43bb4102e5 100755
--- a/automation/scripts/qemu-smoke-dom0-arm32.sh
+++ b/automation/scripts/qemu-smoke-dom0-arm32.sh
@@ -30,13 +30,13 @@ curl --fail --silent --show-error --location --output initrd.tar.gz https://dl-c
 mkdir rootfs
 cd rootfs
 tar xvzf ../initrd.tar.gz
-find . | cpio -H newc -o | gzip > ../root/initrd.cpio.gz
+find . | cpio -R 0:0 -H newc -o | gzip > ../root/initrd.cpio.gz
 cd ..
 rm -rf rootfs
 rm initrd.tar.gz
 
 cp ../zImage ./root
-find . | cpio -H newc -o | gzip > ../initrd.gz
+find . | cpio -R 0:0 -H newc -o | gzip > ../initrd.gz
 cd ..
 
 # XXX QEMU looks for "efi-virtio.rom" even if it is unneeded
diff --git a/automation/scripts/qemu-smoke-dom0-arm64.sh b/automation/scripts/qemu-smoke-dom0-arm64.sh
index d6f6b74880..6517437a5d 100755
--- a/automation/scripts/qemu-smoke-dom0-arm64.sh
+++ b/automation/scripts/qemu-smoke-dom0-arm64.sh
@@ -24,7 +24,7 @@ mount -t devtmpfs devtmpfs /dev
 /bin/sh" > initrd/init
 chmod +x initrd/init
 cd initrd
-find . | cpio -H newc -o | gzip > ../domU-rootfs.cpio.gz
+find . | cpio -R 0:0 -H newc -o | gzip > ../domU-rootfs.cpio.gz
 cd ..
 
 # Dom0 rootfs
@@ -54,7 +54,7 @@ xl -vvv create -c /root/domU.cfg
 
 " > etc/local.d/xen.start
 chmod +x etc/local.d/xen.start
-find . | cpio -H newc -o | gzip >> ../dom0-rootfs.cpio.gz
+find . | cpio -R 0:0 -H newc -o | gzip >> ../dom0-rootfs.cpio.gz
 cd ../..
 
 # XXX QEMU looks for "efi-virtio.rom" even if it is unneeded
diff --git a/automation/scripts/qemu-smoke-dom0less-arm32.sh b/automation/scripts/qemu-smoke-dom0less-arm32.sh
index 0e2c5496db..f100a9a9d2 100755
--- a/automation/scripts/qemu-smoke-dom0less-arm32.sh
+++ b/automation/scripts/qemu-smoke-dom0less-arm32.sh
@@ -75,7 +75,7 @@ mount -t devtmpfs devtmpfs /dev
 ${domU_check}
 /bin/sh" > init
 chmod +x init
-find . | cpio -H newc -o | gzip > ../initrd.gz
+find . | cpio -R 0:0 -H newc -o | gzip > ../initrd.gz
 cd ..
 
 # XXX QEMU looks for "efi-virtio.rom" even if it is unneeded
diff --git a/automation/scripts/qemu-smoke-dom0less-arm64.sh b/automation/scripts/qemu-smoke-dom0less-arm64.sh
index 18ea071c2a..4d08d2f4f5 100755
--- a/automation/scripts/qemu-smoke-dom0less-arm64.sh
+++ b/automation/scripts/qemu-smoke-dom0less-arm64.sh
@@ -108,7 +108,7 @@ ${domU_check}
 /bin/sh" > initrd/init
 chmod +x initrd/init
 cd initrd
-find . | cpio --create --format='newc' | gzip > ../binaries/initrd
+find . | cpio -R 0:0 -o -H newc | gzip > ../binaries/initrd
 cd ..
 
 # Dom0 rootfs
@@ -136,7 +136,7 @@ xl network-attach 1 type=vif
 ${dom0_check}
 " > etc/local.d/xen.start
 chmod +x etc/local.d/xen.start
-find . | cpio -H newc -o | gzip >> ../binaries/dom0-rootfs.cpio.gz
+find . | cpio -R 0:0 -H newc -o | gzip >> ../binaries/dom0-rootfs.cpio.gz
 cd ..
 
 # ImageBuilder
diff --git a/automation/scripts/qubes-x86-64.sh b/automation/scripts/qubes-x86-64.sh
index bfdd2ceb99..e20a38e4f3 100755
--- a/automation/scripts/qubes-x86-64.sh
+++ b/automation/scripts/qubes-x86-64.sh
@@ -182,7 +182,7 @@ ${domU_check}
 Kernel \r on an \m (\l)
 
 " > etc/issue
-    find . | cpio -H newc -o | gzip >> ../binaries/domU-rootfs.cpio.gz
+    find . | cpio -R 0:0 -H newc -o | gzip >> ../binaries/domU-rootfs.cpio.gz
     cd ..
     rm -rf rootfs
 fi
@@ -239,7 +239,7 @@ cp ../binaries/bzImage boot/vmlinuz
 if [ -n "$domU_check" ]; then
     cp ../binaries/domU-rootfs.cpio.gz boot/initrd-domU
 fi
-find . | cpio -H newc -o | gzip >> ../binaries/dom0-rootfs.cpio.gz
+find . | cpio -R 0:0 -H newc -o | gzip >> ../binaries/dom0-rootfs.cpio.gz
 cd ..
 
 
diff --git a/automation/scripts/xilinx-smoke-dom0-x86_64.sh b/automation/scripts/xilinx-smoke-dom0-x86_64.sh
index 8f02fa73bd..e68b0ce61f 100755
--- a/automation/scripts/xilinx-smoke-dom0-x86_64.sh
+++ b/automation/scripts/xilinx-smoke-dom0-x86_64.sh
@@ -99,7 +99,7 @@ echo "domU Welcome to Alpine Linux
 Kernel \r on an \m (\l)
 
 " > etc/issue
-find . | cpio -H newc -o | gzip >> ../binaries/domU-rootfs.cpio.gz
+find . | cpio -R 0:0 -H newc -o | gzip >> ../binaries/domU-rootfs.cpio.gz
 cd ..
 rm -rf rootfs
 
@@ -127,7 +127,7 @@ echo "QEMU_XEN=/bin/false" >> etc/default/xencommons
 mkdir -p var/log/xen/console
 cp ../binaries/bzImage boot/vmlinuz
 cp ../binaries/domU-rootfs.cpio.gz boot/initrd-domU
-find . | cpio -H newc -o | gzip >> ../binaries/dom0-rootfs.cpio.gz
+find . | cpio -R 0:0 -H newc -o | gzip >> ../binaries/dom0-rootfs.cpio.gz
 cd ..
 
 # Load software into TFTP server directory.
diff --git a/automation/scripts/xilinx-smoke-dom0less-arm64.sh b/automation/scripts/xilinx-smoke-dom0less-arm64.sh
index 293232eebf..3c89b8694a 100755
--- a/automation/scripts/xilinx-smoke-dom0less-arm64.sh
+++ b/automation/scripts/xilinx-smoke-dom0less-arm64.sh
@@ -50,7 +50,7 @@ echo "#!/bin/sh
 ${domU_check}
 /bin/sh" > etc/local.d/xen.start
 chmod +x etc/local.d/xen.start
-find . | cpio -H newc -o | gzip >> ../binaries/domU-rootfs.cpio.gz
+find . | cpio -R 0:0 -H newc -o | gzip >> ../binaries/domU-rootfs.cpio.gz
 cd ..
 rm -rf rootfs
 
@@ -71,7 +71,7 @@ bash /etc/init.d/xencommons start
 ${dom0_check}
 " > etc/local.d/xen.start
 chmod +x etc/local.d/xen.start
-find . | cpio -H newc -o | gzip >> ../binaries/dom0-rootfs.cpio.gz
+find . | cpio -R 0:0 -H newc -o | gzip >> ../binaries/dom0-rootfs.cpio.gz
 cd ..
 
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.20


From xen-changelog-bounces@lists.xenproject.org Wed Sep 10 17:55:34 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 10 Sep 2025 17:55:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1118691.1464372 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uwP2c-0002T2-3q; Wed, 10 Sep 2025 17:55:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1118691.1464372; Wed, 10 Sep 2025 17: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 1uwP2c-0002Sr-0j; Wed, 10 Sep 2025 17:55:34 +0000
Received: by outflank-mailman (input) for mailman id 1118691;
 Wed, 10 Sep 2025 17:55: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 1uwP2b-0002Sh-C6
 for xen-changelog@lists.xenproject.org; Wed, 10 Sep 2025 17:55: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 1uwP2b-003NwA-0w
 for xen-changelog@lists.xenproject.org;
 Wed, 10 Sep 2025 17:55:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uwP2b-003G2Q-0p
 for xen-changelog@lists.xenproject.org;
 Wed, 10 Sep 2025 17:55: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=d4REw3Ek72cjbmeQrnBwDpx/9oun4fS6C0fJd3X95EQ=; b=FwyQhh4WgdrcoMflaMSsSfEKgP
	+nUgl98E22qrJ1Hx9rs+EYc4FlopDYx2drFhAhQLNsSIeSaw1iSZxxdaNdlt1qmNAWYp0VbqD5yQ8
	d/k06mwiIFbPoXOX71Nof1RNmuZRgEV7NZLVK+UuEdkP8xPO4BeZTbq8dRqTtm6cqkFg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] CI: save toolstack artifact as cpio.gz
Message-Id: <E1uwP2b-003G2Q-0p@xenbits.xenproject.org>
Date: Wed, 10 Sep 2025 17:55:33 +0000

commit 0fe3453bcaafdd68833697831bc7462221c96d26
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Fri Apr 11 22:32:19 2025 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Sep 10 14:45:07 2025 +0100

    CI: save toolstack artifact as cpio.gz
    
    This avoids the need to re-compress it in every test job.  This saves minutes
    of wallclock time.
    
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
    (cherry picked from commit 4611ae6fb8f90d25601fcc0688799ef63a374304)
---
 automation/scripts/build                          | 2 +-
 automation/scripts/qemu-alpine-x86_64.sh          | 2 +-
 automation/scripts/qemu-smoke-dom0-arm64.sh       | 2 +-
 automation/scripts/qemu-smoke-dom0less-arm64.sh   | 2 +-
 automation/scripts/qubes-x86-64.sh                | 4 +++-
 automation/scripts/xilinx-smoke-dom0-x86_64.sh    | 4 ++--
 automation/scripts/xilinx-smoke-dom0less-arm64.sh | 3 +--
 7 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/automation/scripts/build b/automation/scripts/build
index 522efe774e..51effec81d 100755
--- a/automation/scripts/build
+++ b/automation/scripts/build
@@ -108,7 +108,7 @@ else
     # Note: Some smoke tests depending on finding binaries/xen on a full build
     # even though dist/ contains everything, while some containers don't even
     # build Xen
-    cp -r dist binaries/
+    (cd dist/install; find | cpio -o -H newc | gzip) > binaries/xen-tools.cpio.gz
     cp -r tools/tests binaries/
     collect_xen_artefacts
 fi
diff --git a/automation/scripts/qemu-alpine-x86_64.sh b/automation/scripts/qemu-alpine-x86_64.sh
index c7dd121978..fe86caa393 100755
--- a/automation/scripts/qemu-alpine-x86_64.sh
+++ b/automation/scripts/qemu-alpine-x86_64.sh
@@ -30,11 +30,11 @@ cd ..
 
 # Dom0 rootfs
 cp rootfs.cpio.gz dom0-rootfs.cpio.gz
+cat xen-tools.cpio.gz >> dom0-rootfs.cpio.gz
 
 # test-local configuration
 mkdir -p rootfs
 cd rootfs
-cp -ar ../dist/install/* .
 mkdir -p root etc/local.d
 mv ../domU-rootfs.cpio.gz ./root
 cp ../bzImage ./root
diff --git a/automation/scripts/qemu-smoke-dom0-arm64.sh b/automation/scripts/qemu-smoke-dom0-arm64.sh
index c0cf61ff8f..61dd24b9ab 100755
--- a/automation/scripts/qemu-smoke-dom0-arm64.sh
+++ b/automation/scripts/qemu-smoke-dom0-arm64.sh
@@ -29,11 +29,11 @@ cd ..
 
 # Dom0 rootfs
 cp rootfs.cpio.gz dom0-rootfs.cpio.gz
+cat xen-tools.cpio.gz >> dom0-rootfs.cpio.gz
 
 # test-local configuration
 mkdir -p rootfs
 cd rootfs
-cp -ar ../dist/install/* .
 mkdir -p etc/local.d root
 mv ../domU-rootfs.cpio.gz ./root
 cp ../Image ./root
diff --git a/automation/scripts/qemu-smoke-dom0less-arm64.sh b/automation/scripts/qemu-smoke-dom0less-arm64.sh
index 48c424922d..2c9a927c5c 100755
--- a/automation/scripts/qemu-smoke-dom0less-arm64.sh
+++ b/automation/scripts/qemu-smoke-dom0less-arm64.sh
@@ -113,11 +113,11 @@ cd ..
 
 # Dom0 rootfs
 cp binaries/rootfs.cpio.gz binaries/dom0-rootfs.cpio.gz
+cat binaries/xen-tools.cpio.gz >> binaries/dom0-rootfs.cpio.gz
 
 # test-local configuration
 mkdir -p rootfs
 cd rootfs
-cp -ar ../binaries/dist/install/* .
 mkdir -p etc/local.d
 
 echo "#!/bin/bash
diff --git a/automation/scripts/qubes-x86-64.sh b/automation/scripts/qubes-x86-64.sh
index e2376cb51c..3947027d6e 100755
--- a/automation/scripts/qubes-x86-64.sh
+++ b/automation/scripts/qubes-x86-64.sh
@@ -189,12 +189,12 @@ fi
 
 # Dom0 rootfs
 cp binaries/rootfs.cpio.gz binaries/dom0-rootfs.cpio.gz
+cat binaries/xen-tools.cpio.gz >> binaries/dom0-rootfs.cpio.gz
 
 # test-local configuration
 mkdir -p rootfs
 cd rootfs
 mkdir -p boot etc/local.d
-cp -ar ../binaries/dist/install/* .
 cp -ar ../binaries/tests .
 cp -a ../automation/scripts/run-tools-tests tests/
 
@@ -228,8 +228,10 @@ else
 fi
 
 chmod +x etc/local.d/xen.start
+mkdir -p etc/xen
 echo "$domU_config" > etc/xen/domU.cfg
 
+mkdir -p etc/default
 echo "XENCONSOLED_TRACE=all" >> etc/default/xencommons
 echo "QEMU_XEN=/bin/false" >> etc/default/xencommons
 mkdir -p var/log/xen/console
diff --git a/automation/scripts/xilinx-smoke-dom0-x86_64.sh b/automation/scripts/xilinx-smoke-dom0-x86_64.sh
index d823b57012..a63a525ff8 100755
--- a/automation/scripts/xilinx-smoke-dom0-x86_64.sh
+++ b/automation/scripts/xilinx-smoke-dom0-x86_64.sh
@@ -72,12 +72,12 @@ rm -rf rootfs
 
 # Dom0 rootfs
 cp binaries/rootfs.cpio.gz binaries/dom0-rootfs.cpio.gz
+cat binaries/xen-tools.cpio.gz >> binaries/dom0-rootfs.cpio.gz
 
 # test-local configuration
 mkdir -p rootfs
 cd rootfs
-mkdir -p boot etc/local.d
-cp -ar ../binaries/dist/install/* .
+mkdir -p boot etc/local.d etc/xen etc/default
 echo "#!/bin/bash
 
 export LD_LIBRARY_PATH=/usr/local/lib
diff --git a/automation/scripts/xilinx-smoke-dom0less-arm64.sh b/automation/scripts/xilinx-smoke-dom0less-arm64.sh
index a3031ecab0..59f3fe7edb 100755
--- a/automation/scripts/xilinx-smoke-dom0less-arm64.sh
+++ b/automation/scripts/xilinx-smoke-dom0less-arm64.sh
@@ -56,12 +56,11 @@ rm -rf rootfs
 
 # Dom0 rootfs
 cp binaries/rootfs.cpio.gz binaries/dom0-rootfs.cpio.gz
+cat binaries/xen-tools.cpio.gz >> binaries/dom0-rootfs.cpio.gz
 
 # test-local configuration
 mkdir -p rootfs
 cd rootfs
-cp -ar ../binaries/dist/install/* .
-
 mkdir -p etc/local.d
 echo "#!/bin/bash
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Sep 10 17:55:44 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 10 Sep 2025 17:55:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1118692.1464376 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uwP2m-0002Vf-57; Wed, 10 Sep 2025 17:55:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1118692.1464376; Wed, 10 Sep 2025 17: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 1uwP2m-0002VX-21; Wed, 10 Sep 2025 17:55:44 +0000
Received: by outflank-mailman (input) for mailman id 1118692;
 Wed, 10 Sep 2025 17: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 1uwP2l-0002VP-DT
 for xen-changelog@lists.xenproject.org; Wed, 10 Sep 2025 17:55: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 1uwP2l-003NwE-1F
 for xen-changelog@lists.xenproject.org;
 Wed, 10 Sep 2025 17:55:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uwP2l-003G3T-16
 for xen-changelog@lists.xenproject.org;
 Wed, 10 Sep 2025 17:55: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=aHZ5UxzhXtfXWmLtzRXZ1aRNyZgE3kdW3DRtgk/HpsE=; b=uQhrytNcABdc9R3ok476SzH3Kh
	9Bap+XjZcUXS2bgSlvyRllphOUpaaqwfo/ExnzenLwYGr8ZkzGcmvgWdji8YOGtTOJsP+6Ag+VCzQ
	fFtPIiAsnYY9T1Zki7vpGxp5fv0hyzW/KItJsb6UVTHrhR0vHQrpIFrPHM57lmHyx7Xs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] CI: Build with --prefix=/usr rather than setting LD_LIBRARY_PATH
Message-Id: <E1uwP2l-003G3T-16@xenbits.xenproject.org>
Date: Wed, 10 Sep 2025 17:55:43 +0000

commit 2c5076780ce0306cfeafc5082faec63e53d81cf5
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Apr 15 13:49:01 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Sep 10 14:45:07 2025 +0100

    CI: Build with --prefix=/usr rather than setting LD_LIBRARY_PATH
    
    This also moves executables too.
    
    I'm not sure why xilinx-smoke-dom0-x86_64.sh was overriding PATH too, as
    /usr/local is clearly in PATH given the other tests, but drop that too.
    
    No practical change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
    (cherry picked from commit 7f8c2dd829358406dc9e50d5e386e4d2b20b4303)
---
 automation/scripts/build                          | 2 +-
 automation/scripts/qemu-alpine-x86_64.sh          | 1 -
 automation/scripts/qemu-smoke-dom0-arm64.sh       | 1 -
 automation/scripts/qemu-smoke-dom0less-arm64.sh   | 3 +--
 automation/scripts/qubes-x86-64.sh                | 1 -
 automation/scripts/xilinx-smoke-dom0-x86_64.sh    | 1 -
 automation/scripts/xilinx-smoke-dom0less-arm64.sh | 3 +--
 7 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/automation/scripts/build b/automation/scripts/build
index 51effec81d..a348c781d1 100755
--- a/automation/scripts/build
+++ b/automation/scripts/build
@@ -67,7 +67,7 @@ elif [[ "${HYPERVISOR_ONLY}" == "y" ]]; then
     collect_xen_artefacts
 else
     # Full build.  Figure out our ./configure options
-    cfgargs=()
+    cfgargs=("--prefix=/usr")
     cfgargs+=("--enable-docs")
 
     # booleans for which compiler is in use
diff --git a/automation/scripts/qemu-alpine-x86_64.sh b/automation/scripts/qemu-alpine-x86_64.sh
index fe86caa393..746e70483d 100755
--- a/automation/scripts/qemu-alpine-x86_64.sh
+++ b/automation/scripts/qemu-alpine-x86_64.sh
@@ -49,7 +49,6 @@ echo "#!/bin/bash
 
 set -x
 
-export LD_LIBRARY_PATH=/usr/local/lib
 bash /etc/init.d/xencommons start
 
 xl list
diff --git a/automation/scripts/qemu-smoke-dom0-arm64.sh b/automation/scripts/qemu-smoke-dom0-arm64.sh
index 61dd24b9ab..d6f6b74880 100755
--- a/automation/scripts/qemu-smoke-dom0-arm64.sh
+++ b/automation/scripts/qemu-smoke-dom0-arm64.sh
@@ -46,7 +46,6 @@ extra=\"console=hvc0 root=/dev/ram0 rdinit=/bin/sh\"
 " > root/domU.cfg
 echo "#!/bin/bash
 
-export LD_LIBRARY_PATH=/usr/local/lib
 bash /etc/init.d/xencommons start
 
 xl list
diff --git a/automation/scripts/qemu-smoke-dom0less-arm64.sh b/automation/scripts/qemu-smoke-dom0less-arm64.sh
index 2c9a927c5c..18ea071c2a 100755
--- a/automation/scripts/qemu-smoke-dom0less-arm64.sh
+++ b/automation/scripts/qemu-smoke-dom0less-arm64.sh
@@ -122,10 +122,9 @@ mkdir -p etc/local.d
 
 echo "#!/bin/bash
 
-export LD_LIBRARY_PATH=/usr/local/lib
 bash /etc/init.d/xencommons start
 
-/usr/local/lib/xen/bin/init-dom0less
+/usr/lib/xen/bin/init-dom0less
 
 brctl addbr xenbr0
 brctl addif xenbr0 eth0
diff --git a/automation/scripts/qubes-x86-64.sh b/automation/scripts/qubes-x86-64.sh
index 3947027d6e..9a74f2116c 100755
--- a/automation/scripts/qubes-x86-64.sh
+++ b/automation/scripts/qubes-x86-64.sh
@@ -200,7 +200,6 @@ cp -a ../automation/scripts/run-tools-tests tests/
 
 echo "#!/bin/bash
 
-export LD_LIBRARY_PATH=/usr/local/lib
 bash /etc/init.d/xencommons start
 
 brctl addbr xenbr0
diff --git a/automation/scripts/xilinx-smoke-dom0-x86_64.sh b/automation/scripts/xilinx-smoke-dom0-x86_64.sh
index a63a525ff8..b1b0c2145b 100755
--- a/automation/scripts/xilinx-smoke-dom0-x86_64.sh
+++ b/automation/scripts/xilinx-smoke-dom0-x86_64.sh
@@ -80,7 +80,6 @@ cd rootfs
 mkdir -p boot etc/local.d etc/xen etc/default
 echo "#!/bin/bash
 
-export LD_LIBRARY_PATH=/usr/local/lib
 bash /etc/init.d/xencommons start
 
 brctl addbr xenbr0
diff --git a/automation/scripts/xilinx-smoke-dom0less-arm64.sh b/automation/scripts/xilinx-smoke-dom0less-arm64.sh
index 59f3fe7edb..293232eebf 100755
--- a/automation/scripts/xilinx-smoke-dom0less-arm64.sh
+++ b/automation/scripts/xilinx-smoke-dom0less-arm64.sh
@@ -64,10 +64,9 @@ cd rootfs
 mkdir -p etc/local.d
 echo "#!/bin/bash
 
-export LD_LIBRARY_PATH=/usr/local/lib
 bash /etc/init.d/xencommons start
 
-/usr/local/lib/xen/bin/init-dom0less
+/usr/lib/xen/bin/init-dom0less
 
 ${dom0_check}
 " > etc/local.d/xen.start
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Sep 10 17:55:54 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 10 Sep 2025 17:55:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1118693.1464379 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uwP2w-0002Xv-5p; Wed, 10 Sep 2025 17:55:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1118693.1464379; Wed, 10 Sep 2025 17: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 1uwP2w-0002Xn-3K; Wed, 10 Sep 2025 17:55:54 +0000
Received: by outflank-mailman (input) for mailman id 1118693;
 Wed, 10 Sep 2025 17: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 1uwP2v-0002Xe-I4
 for xen-changelog@lists.xenproject.org; Wed, 10 Sep 2025 17: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 1uwP2v-003NwI-1h
 for xen-changelog@lists.xenproject.org;
 Wed, 10 Sep 2025 17:55:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uwP2v-003G4N-1R
 for xen-changelog@lists.xenproject.org;
 Wed, 10 Sep 2025 17: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=7YZdZ3QnBaXtntclyNRwovGlzHEqnRa072UlTX0iKi0=; b=ehTRu+0xNEgYe8BweggRqh3B/t
	QhD4g8ylEn3pV9MzaZrDINxHvosYKDcvTw1P8B4xPtB4ROnjh2FZubMQWSp3KmvHWqAlRpjUAPDpJ
	v4vlFNy2pn8ws8iCteQMXQ1duExe+ha1kG4hcA7lAoM9FQ6cU/ey3sArSaya0NbUw/rM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] CI: Create initrd fragments explicitly as root
Message-Id: <E1uwP2v-003G4N-1R@xenbits.xenproject.org>
Date: Wed, 10 Sep 2025 17:55:53 +0000

commit c0a1a4ccba6cffd1ec34777ec477039447fc1a85
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Sep 9 18:06:37 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Sep 10 17:20:11 2025 +0100

    CI: Create initrd fragments explicitly as root
    
    We have a mix of root and non-root containers, and are trying to become
    rootless.  This can cause the local CPIO fragements to end up being user:user
    in the test environment.
    
    Nothing seems to go wrong so far, but it's a trap waiting to happen.
    
    Make everything consistently root for the initrds, irrespective of the
    rootness of the container the test is running in.
    
    No practical change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Denis Mukhin <dmukhin@ford.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
    (cherry picked from commit e3042c9fc28f2cbeaae6fd248eee7f63ac2ae494)
---
 automation/scripts/build                          | 2 +-
 automation/scripts/qemu-alpine-x86_64.sh          | 4 ++--
 automation/scripts/qemu-smoke-dom0-arm32.sh       | 4 ++--
 automation/scripts/qemu-smoke-dom0-arm64.sh       | 4 ++--
 automation/scripts/qemu-smoke-dom0less-arm32.sh   | 2 +-
 automation/scripts/qemu-smoke-dom0less-arm64.sh   | 4 ++--
 automation/scripts/qubes-x86-64.sh                | 4 ++--
 automation/scripts/xilinx-smoke-dom0-x86_64.sh    | 4 ++--
 automation/scripts/xilinx-smoke-dom0less-arm64.sh | 4 ++--
 9 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/automation/scripts/build b/automation/scripts/build
index a348c781d1..fdf72ee735 100755
--- a/automation/scripts/build
+++ b/automation/scripts/build
@@ -108,7 +108,7 @@ else
     # Note: Some smoke tests depending on finding binaries/xen on a full build
     # even though dist/ contains everything, while some containers don't even
     # build Xen
-    (cd dist/install; find | cpio -o -H newc | gzip) > binaries/xen-tools.cpio.gz
+    (cd dist/install; find | cpio -R 0:0 -o -H newc | gzip) > binaries/xen-tools.cpio.gz
     cp -r tools/tests binaries/
     collect_xen_artefacts
 fi
diff --git a/automation/scripts/qemu-alpine-x86_64.sh b/automation/scripts/qemu-alpine-x86_64.sh
index 746e70483d..b95e63360b 100755
--- a/automation/scripts/qemu-alpine-x86_64.sh
+++ b/automation/scripts/qemu-alpine-x86_64.sh
@@ -25,7 +25,7 @@ mount -t devtmpfs devtmpfs /dev
 chmod +x initrd/init
 # DomU rootfs
 cd initrd
-find . | cpio -H newc -o | gzip > ../domU-rootfs.cpio.gz
+find . | cpio -R 0:0 -H newc -o | gzip > ../domU-rootfs.cpio.gz
 cd ..
 
 # Dom0 rootfs
@@ -57,7 +57,7 @@ xl -vvv create -c /root/domU.cfg
 
 " > etc/local.d/xen.start
 chmod +x etc/local.d/xen.start
-find . | cpio -H newc -o | gzip >> ../dom0-rootfs.cpio.gz
+find . | cpio -R 0:0 -H newc -o | gzip >> ../dom0-rootfs.cpio.gz
 cd ../..
 
 cat >> binaries/pxelinux.0 << EOF
diff --git a/automation/scripts/qemu-smoke-dom0-arm32.sh b/automation/scripts/qemu-smoke-dom0-arm32.sh
index 97855d8ed2..ab38e222a9 100755
--- a/automation/scripts/qemu-smoke-dom0-arm32.sh
+++ b/automation/scripts/qemu-smoke-dom0-arm32.sh
@@ -30,13 +30,13 @@ curl --fail --silent --show-error --location --output initrd.tar.gz https://dl-c
 mkdir rootfs
 cd rootfs
 tar xvzf ../initrd.tar.gz
-find . | cpio -H newc -o | gzip > ../root/initrd.cpio.gz
+find . | cpio -R 0:0 -H newc -o | gzip > ../root/initrd.cpio.gz
 cd ..
 rm -rf rootfs
 rm initrd.tar.gz
 
 cp ../zImage ./root
-find . | cpio -H newc -o | gzip > ../initrd.gz
+find . | cpio -R 0:0 -H newc -o | gzip > ../initrd.gz
 cd ..
 
 # XXX QEMU looks for "efi-virtio.rom" even if it is unneeded
diff --git a/automation/scripts/qemu-smoke-dom0-arm64.sh b/automation/scripts/qemu-smoke-dom0-arm64.sh
index d6f6b74880..6517437a5d 100755
--- a/automation/scripts/qemu-smoke-dom0-arm64.sh
+++ b/automation/scripts/qemu-smoke-dom0-arm64.sh
@@ -24,7 +24,7 @@ mount -t devtmpfs devtmpfs /dev
 /bin/sh" > initrd/init
 chmod +x initrd/init
 cd initrd
-find . | cpio -H newc -o | gzip > ../domU-rootfs.cpio.gz
+find . | cpio -R 0:0 -H newc -o | gzip > ../domU-rootfs.cpio.gz
 cd ..
 
 # Dom0 rootfs
@@ -54,7 +54,7 @@ xl -vvv create -c /root/domU.cfg
 
 " > etc/local.d/xen.start
 chmod +x etc/local.d/xen.start
-find . | cpio -H newc -o | gzip >> ../dom0-rootfs.cpio.gz
+find . | cpio -R 0:0 -H newc -o | gzip >> ../dom0-rootfs.cpio.gz
 cd ../..
 
 # XXX QEMU looks for "efi-virtio.rom" even if it is unneeded
diff --git a/automation/scripts/qemu-smoke-dom0less-arm32.sh b/automation/scripts/qemu-smoke-dom0less-arm32.sh
index 0e2c5496db..f100a9a9d2 100755
--- a/automation/scripts/qemu-smoke-dom0less-arm32.sh
+++ b/automation/scripts/qemu-smoke-dom0less-arm32.sh
@@ -75,7 +75,7 @@ mount -t devtmpfs devtmpfs /dev
 ${domU_check}
 /bin/sh" > init
 chmod +x init
-find . | cpio -H newc -o | gzip > ../initrd.gz
+find . | cpio -R 0:0 -H newc -o | gzip > ../initrd.gz
 cd ..
 
 # XXX QEMU looks for "efi-virtio.rom" even if it is unneeded
diff --git a/automation/scripts/qemu-smoke-dom0less-arm64.sh b/automation/scripts/qemu-smoke-dom0less-arm64.sh
index 18ea071c2a..4d08d2f4f5 100755
--- a/automation/scripts/qemu-smoke-dom0less-arm64.sh
+++ b/automation/scripts/qemu-smoke-dom0less-arm64.sh
@@ -108,7 +108,7 @@ ${domU_check}
 /bin/sh" > initrd/init
 chmod +x initrd/init
 cd initrd
-find . | cpio --create --format='newc' | gzip > ../binaries/initrd
+find . | cpio -R 0:0 -o -H newc | gzip > ../binaries/initrd
 cd ..
 
 # Dom0 rootfs
@@ -136,7 +136,7 @@ xl network-attach 1 type=vif
 ${dom0_check}
 " > etc/local.d/xen.start
 chmod +x etc/local.d/xen.start
-find . | cpio -H newc -o | gzip >> ../binaries/dom0-rootfs.cpio.gz
+find . | cpio -R 0:0 -H newc -o | gzip >> ../binaries/dom0-rootfs.cpio.gz
 cd ..
 
 # ImageBuilder
diff --git a/automation/scripts/qubes-x86-64.sh b/automation/scripts/qubes-x86-64.sh
index 9a74f2116c..c586fa2d81 100755
--- a/automation/scripts/qubes-x86-64.sh
+++ b/automation/scripts/qubes-x86-64.sh
@@ -182,7 +182,7 @@ ${domU_check}
 Kernel \r on an \m (\l)
 
 " > etc/issue
-    find . | cpio -H newc -o | gzip >> ../binaries/domU-rootfs.cpio.gz
+    find . | cpio -R 0:0 -H newc -o | gzip >> ../binaries/domU-rootfs.cpio.gz
     cd ..
     rm -rf rootfs
 fi
@@ -238,7 +238,7 @@ cp ../binaries/bzImage boot/vmlinuz
 if [ -n "$domU_check" ]; then
     cp ../binaries/domU-rootfs.cpio.gz boot/initrd-domU
 fi
-find . | cpio -H newc -o | gzip >> ../binaries/dom0-rootfs.cpio.gz
+find . | cpio -R 0:0 -H newc -o | gzip >> ../binaries/dom0-rootfs.cpio.gz
 cd ..
 
 
diff --git a/automation/scripts/xilinx-smoke-dom0-x86_64.sh b/automation/scripts/xilinx-smoke-dom0-x86_64.sh
index b1b0c2145b..03213da3f1 100755
--- a/automation/scripts/xilinx-smoke-dom0-x86_64.sh
+++ b/automation/scripts/xilinx-smoke-dom0-x86_64.sh
@@ -66,7 +66,7 @@ echo "domU Welcome to Alpine Linux
 Kernel \r on an \m (\l)
 
 " > etc/issue
-find . | cpio -H newc -o | gzip >> ../binaries/domU-rootfs.cpio.gz
+find . | cpio -R 0:0 -H newc -o | gzip >> ../binaries/domU-rootfs.cpio.gz
 cd ..
 rm -rf rootfs
 
@@ -100,7 +100,7 @@ echo "QEMU_XEN=/bin/false" >> etc/default/xencommons
 mkdir -p var/log/xen/console
 cp ../binaries/bzImage boot/vmlinuz
 cp ../binaries/domU-rootfs.cpio.gz boot/initrd-domU
-find . | cpio -H newc -o | gzip >> ../binaries/dom0-rootfs.cpio.gz
+find . | cpio -R 0:0 -H newc -o | gzip >> ../binaries/dom0-rootfs.cpio.gz
 cd ..
 
 # Load software into TFTP server directory.
diff --git a/automation/scripts/xilinx-smoke-dom0less-arm64.sh b/automation/scripts/xilinx-smoke-dom0less-arm64.sh
index 293232eebf..3c89b8694a 100755
--- a/automation/scripts/xilinx-smoke-dom0less-arm64.sh
+++ b/automation/scripts/xilinx-smoke-dom0less-arm64.sh
@@ -50,7 +50,7 @@ echo "#!/bin/sh
 ${domU_check}
 /bin/sh" > etc/local.d/xen.start
 chmod +x etc/local.d/xen.start
-find . | cpio -H newc -o | gzip >> ../binaries/domU-rootfs.cpio.gz
+find . | cpio -R 0:0 -H newc -o | gzip >> ../binaries/domU-rootfs.cpio.gz
 cd ..
 rm -rf rootfs
 
@@ -71,7 +71,7 @@ bash /etc/init.d/xencommons start
 ${dom0_check}
 " > etc/local.d/xen.start
 chmod +x etc/local.d/xen.start
-find . | cpio -H newc -o | gzip >> ../binaries/dom0-rootfs.cpio.gz
+find . | cpio -R 0:0 -H newc -o | gzip >> ../binaries/dom0-rootfs.cpio.gz
 cd ..
 
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Sep 10 19:33:05 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 10 Sep 2025 19:33:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1118746.1464393 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uwQYw-00062c-PA; Wed, 10 Sep 2025 19:33:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1118746.1464393; Wed, 10 Sep 2025 19: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 1uwQYw-00062V-Me; Wed, 10 Sep 2025 19:33:02 +0000
Received: by outflank-mailman (input) for mailman id 1118746;
 Wed, 10 Sep 2025 19: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 1uwQYw-00062P-66
 for xen-changelog@lists.xenproject.org; Wed, 10 Sep 2025 19: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 1uwQYw-003Pn6-0L
 for xen-changelog@lists.xenproject.org;
 Wed, 10 Sep 2025 19:33:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uwQYw-003LSl-03
 for xen-changelog@lists.xenproject.org;
 Wed, 10 Sep 2025 19: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=svxGxmpPCV6qJHbgLB1igWvG+CvLOaXHyYl9jB+qys8=; b=65Rp0UrD8nRq73u77ryDeoll4G
	ZTCFwiVExoXJ3/rPxn12JrBZphoMOU8wVWwUp40UDrien4oOKK5pUAiMT1OvFyouaxd6WU9x0oI3+
	GTrZAsjVlE0iU31mF3Gm5/juEZT1tLEMK0hyTxABBbT02eDGWzzxUEGVrkrecm1gIV7w=;
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.4-pre
Message-Id: <E1uwQYw-003LSl-03@xenbits.xenproject.org>
Date: Wed, 10 Sep 2025 19:33:02 +0000

commit 7f149db6e8b71798e9502fd09a4a843b665748a8
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Sep 3 14:04:06 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 3 14:04:06 2025 +0200

    update Xen version to 4.19.4-pre
---
 xen/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/Makefile b/xen/Makefile
index df5319fdee..4201eb4d16 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 ?= .3$(XEN_VENDORVERSION)
+export XEN_EXTRAVERSION ?= .4-pre$(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 Wed Sep 10 19:33:12 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 10 Sep 2025 19:33:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1118747.1464396 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uwQZ6-00064M-Qh; Wed, 10 Sep 2025 19:33:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1118747.1464396; Wed, 10 Sep 2025 19: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 1uwQZ6-00064E-OA; Wed, 10 Sep 2025 19:33:12 +0000
Received: by outflank-mailman (input) for mailman id 1118747;
 Wed, 10 Sep 2025 19: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 1uwQZ6-000644-7O
 for xen-changelog@lists.xenproject.org; Wed, 10 Sep 2025 19: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 1uwQZ6-003PnQ-0d
 for xen-changelog@lists.xenproject.org;
 Wed, 10 Sep 2025 19:33:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uwQZ6-003LTm-0W
 for xen-changelog@lists.xenproject.org;
 Wed, 10 Sep 2025 19: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=wF4GXpbq5Z9XG713tkVcBlqL2fgP5D8CvzLccN0DOtA=; b=MdAEVJpsHcpPulcVsXbE6HKPrt
	SfLJvY4tTn4zg0nLuNNNatjgmgxYZ1WpXHJD/BUfzH2NqtcUzHyIYDFb46Knr4T5hmER6qcjjQoDX
	imix+ZKYmnoQ0GWSj402a4wzz6PZY7XI7x221rqrPe1PYbF3Z3jnvVauZLKj+c9pDq5Q=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] x86/hpet: do local APIC EOI after interrupt processing
Message-Id: <E1uwQZ6-003LTm-0W@xenbits.xenproject.org>
Date: Wed, 10 Sep 2025 19:33:12 +0000

commit 8b6383f53184156ea7dcdc53ed943bdfc5c1ec83
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Sep 3 14:04:29 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 3 14:04:29 2025 +0200

    x86/hpet: do local APIC EOI after interrupt processing
    
    The current logic in the HPET interrupt ->ack() hook will perform a local
    APIC EOI ahead of enabling interrupts, possibly leading to recursion in the
    interrupt handler.
    
    Fix this by doing the local APIC EOI strictly after the window with
    interrupt enabled, as that prevents the recursion, and would only allow for
    interrupts with higher priority to be serviced.
    
    Use the generic ack_nonmaskable_msi_irq() and end_nonmaskable_irq()
    functions, removing the need for hpet_msi_ack().
    
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Fixes: 3ba523ff957c ('CPUIDLE: enable MSI capable HPET for timer broadcast')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 1db7829e56578970c1037c4dd1c27f939be4c054
    master date: 2025-08-06 10:47:16 +0200
---
 xen/arch/x86/hpet.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/xen/arch/x86/hpet.c b/xen/arch/x86/hpet.c
index 84f820fef6..9727bcd163 100644
--- a/xen/arch/x86/hpet.c
+++ b/xen/arch/x86/hpet.c
@@ -298,13 +298,6 @@ static unsigned int cf_check hpet_msi_startup(struct irq_desc *desc)
 
 #define hpet_msi_shutdown hpet_msi_mask
 
-static void cf_check hpet_msi_ack(struct irq_desc *desc)
-{
-    irq_complete_move(desc);
-    move_native_irq(desc);
-    ack_APIC_irq();
-}
-
 static void cf_check hpet_msi_set_affinity(
     struct irq_desc *desc, const cpumask_t *mask)
 {
@@ -332,7 +325,8 @@ static hw_irq_controller hpet_msi_type = {
     .shutdown   = hpet_msi_shutdown,
     .enable	    = hpet_msi_unmask,
     .disable    = hpet_msi_mask,
-    .ack        = hpet_msi_ack,
+    .ack        = ack_nonmaskable_msi_irq,
+    .end        = end_nonmaskable_irq,
     .set_affinity   = hpet_msi_set_affinity,
 };
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Sep 10 19:33:23 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 10 Sep 2025 19:33:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1118748.1464402 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uwQZH-00066c-Si; Wed, 10 Sep 2025 19:33:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1118748.1464402; Wed, 10 Sep 2025 19: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 1uwQZH-00066S-Pg; Wed, 10 Sep 2025 19:33:23 +0000
Received: by outflank-mailman (input) for mailman id 1118748;
 Wed, 10 Sep 2025 19: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 1uwQZG-00066H-Bv
 for xen-changelog@lists.xenproject.org; Wed, 10 Sep 2025 19: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 1uwQZG-003PnU-16
 for xen-changelog@lists.xenproject.org;
 Wed, 10 Sep 2025 19:33:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uwQZG-003LUi-0p
 for xen-changelog@lists.xenproject.org;
 Wed, 10 Sep 2025 19: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=tC0LSDaHtTANmB/ScsEr+KZ2f7yOsAzuW3w45NUZVjE=; b=nnMzm35dQfyDb1x3vUR9O89g8g
	cbNHODHl8F3IVdj8AgYIu3oIfP0dT1ZSuETOj+SzYOLA3RH7P8KDWekrKue8peZM38Q/qNBWbfQPZ
	0XfJ9IfpN8fgT1JewE5JVQvRx5KmUjn5YSyrxpwQK1qgzwFuSXa89T3cAIpcVINmymrw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] efi: Call FreePages() only if needed
Message-Id: <E1uwQZG-003LUi-0p@xenbits.xenproject.org>
Date: Wed, 10 Sep 2025 19:33:22 +0000

commit 6aaca5200bac1a4536151dbaab5ec46b1729b3a1
Author:     Ross Lagerwall <ross.lagerwall@citrix.com>
AuthorDate: Wed Sep 3 14:04:57 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 3 14:04:57 2025 +0200

    efi: Call FreePages() only if needed
    
    If the config file is builtin, cfg.addr will be zero but Xen
    unconditionally calls FreePages() on the address.
    
    Xen may also call FreePages() with a zero address if blexit() is called
    after this point since cfg.need_to_free is not set to false.
    
    The UEFI specification does not say whether calling FreePages() with a
    zero address is allowed so let's be cautious and use cfg.need_to_free
    properly.
    
    Fixes: 8a71d50ed40b ("efi: Enable booting unified hypervisor/kernel/initrd images")
    Fixes: 04be2c3a0678 ("efi/boot.c: add file.need_to_free")
    Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by Daniel P. Smith <dpsmith@apertussolutions.com>
    master commit: 7fddedd530561797d8ce5fba78e83cc9cc6b58dd
    master date: 2025-08-12 11:40:28 +0200
---
 xen/common/efi/boot.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c
index efbec00af9..01062bb39f 100644
--- a/xen/common/efi/boot.c
+++ b/xen/common/efi/boot.c
@@ -1484,8 +1484,11 @@ void EFIAPI __init noreturn efi_start(EFI_HANDLE ImageHandle,
 
         efi_arch_cfg_file_late(loaded_image, dir_handle, section.s);
 
-        efi_bs->FreePages(cfg.addr, PFN_UP(cfg.size));
-        cfg.addr = 0;
+        if ( cfg.need_to_free )
+        {
+            efi_bs->FreePages(cfg.addr, PFN_UP(cfg.size));
+            cfg.need_to_free = false;
+        }
 
         dir_handle->Close(dir_handle);
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Sep 10 19:33:33 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 10 Sep 2025 19:33:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1118749.1464405 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uwQZR-000693-Te; Wed, 10 Sep 2025 19:33:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1118749.1464405; Wed, 10 Sep 2025 19: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 1uwQZR-00068v-R3; Wed, 10 Sep 2025 19:33:33 +0000
Received: by outflank-mailman (input) for mailman id 1118749;
 Wed, 10 Sep 2025 19: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 1uwQZQ-00068f-EZ
 for xen-changelog@lists.xenproject.org; Wed, 10 Sep 2025 19: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 1uwQZQ-003Pnc-1N
 for xen-changelog@lists.xenproject.org;
 Wed, 10 Sep 2025 19:33:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uwQZQ-003LX9-1H
 for xen-changelog@lists.xenproject.org;
 Wed, 10 Sep 2025 19: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=YdQk0l29bzHZ2edKte3A9BZTbrNUli0r6Z46N3UCix8=; b=veXYJoTd5OaQcpd48Tvjzim6H9
	f/cm7+SVMFFoq1wWg5rJ7ke0q4ta7lafwWiGNP9kriHCNBWWc0/LNLFjS56Z/Amf5lqrqi6G3g+3G
	OYW0Y3u8J/15SNHhEgjea2M/26uyKJ7oZIOWLPsQeImqM2WvQvZV4/5olEXiQRo1EiQE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] x86/mkelf32: pad load segment to 2Mb boundary
Message-Id: <E1uwQZQ-003LX9-1H@xenbits.xenproject.org>
Date: Wed, 10 Sep 2025 19:33:32 +0000

commit 9876248a545f356b44580d5b604188a63bc46ca5
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Sep 3 14:05:18 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 3 14:05:18 2025 +0200

    x86/mkelf32: pad load segment to 2Mb boundary
    
    In order to legitimately set up initial mappings past _end[], we need
    to make sure that the entire mapped range is inside a RAM region.
    Therefore we need to inform the bootloader (or alike) that our allocated
    size is larger than just the next SECTION_ALIGN-ed boundary past _end[].
    
    This allows dropping a command line option from the tool, which was
    introduced to work around a supposed linker bug, when the problem was
    really Xen's.
    
    While adjusting adjacent code, correct the argc check to also cover the
    case correctly when --notes was passed.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 4fb075201f54b16c0800af0107162461a93065fb
    master date: 2025-08-18 10:42:24 +0200
---
 xen/arch/x86/Makefile       |  3 +--
 xen/arch/x86/boot/mkelf32.c | 18 +++++++++++-------
 2 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile
index 27806a81ac..66bc43456b 100644
--- a/xen/arch/x86/Makefile
+++ b/xen/arch/x86/Makefile
@@ -125,8 +125,7 @@ orphan-handling-$(call ld-option,--orphan-handling=warn) += --orphan-handling=wa
 
 $(TARGET): TMP = $(dot-target).elf32
 $(TARGET): $(TARGET)-syms $(efi-y) $(obj)/boot/mkelf32
-	$(obj)/boot/mkelf32 $(notes_phdrs) $(TARGET)-syms $(TMP) $(XEN_IMG_OFFSET) \
-	               `$(NM) $(TARGET)-syms | sed -ne 's/^\([^ ]*\) . __2M_rwdata_end$$/0x\1/p'`
+	$(obj)/boot/mkelf32 $(notes_phdrs) $(TARGET)-syms $(TMP) $(XEN_IMG_OFFSET)
 	od -t x4 -N 8192 $(TMP)  | grep 1badb002 > /dev/null || \
 		{ echo "No Multiboot1 header found" >&2; false; }
 	od -t x4 -N 32768 $(TMP) | grep e85250d6 > /dev/null || \
diff --git a/xen/arch/x86/boot/mkelf32.c b/xen/arch/x86/boot/mkelf32.c
index 7b90338ca8..f9ca047efa 100644
--- a/xen/arch/x86/boot/mkelf32.c
+++ b/xen/arch/x86/boot/mkelf32.c
@@ -256,7 +256,6 @@ static void do_read(int fd, void *data, int len)
 
 int main(int argc, char **argv)
 {
-    u64        final_exec_addr;
     u32        loadbase, dat_siz, mem_siz, note_base, note_sz, offset;
     char      *inimage, *outimage;
     int        infd, outfd;
@@ -269,22 +268,24 @@ int main(int argc, char **argv)
     Elf64_Ehdr in64_ehdr;
     Elf64_Phdr in64_phdr;
 
-    if ( argc < 5 )
+    if ( argc < 4 )
     {
+    help:
         fprintf(stderr, "Usage: mkelf32 [--notes] <in-image> <out-image> "
-                "<load-base> <final-exec-addr>\n");
+                "<load-base>\n");
         return 1;
     }
 
     if ( !strcmp(argv[1], "--notes") )
     {
+        if ( argc < 5 )
+            goto help;
         i = 2;
         num_phdrs = 2;
     }
     inimage  = argv[i++];
     outimage = argv[i++];
     loadbase = strtoul(argv[i++], NULL, 16);
-    final_exec_addr = strtoull(argv[i++], NULL, 16);
 
     infd = open(inimage, O_RDONLY);
     if ( infd == -1 )
@@ -347,9 +348,12 @@ int main(int argc, char **argv)
     (void)lseek(infd, in64_phdr.p_offset, SEEK_SET);
     dat_siz = (u32)in64_phdr.p_filesz;
 
-    /* Do not use p_memsz: it does not include BSS alignment padding. */
-    /*mem_siz = (u32)in64_phdr.p_memsz;*/
-    mem_siz = (u32)(final_exec_addr - in64_phdr.p_vaddr);
+    /*
+     * We don't pad .bss in the linker script, but during early boot we map
+     * the Xen image using 2M pages.  To avoid running into adjacent non-RAM
+     * regions, pad the segment to the next 2M boundary.
+     */
+    mem_siz = ((uint32_t)in64_phdr.p_memsz + (1U << 20) - 1) & (-1U << 20);
 
     note_sz = note_base = offset = 0;
     if ( num_phdrs > 1 )
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Sep 10 19:33:43 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 10 Sep 2025 19:33:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1118750.1464409 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uwQZb-0006BR-VH; Wed, 10 Sep 2025 19:33:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1118750.1464409; Wed, 10 Sep 2025 19: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 1uwQZb-0006BJ-SU; Wed, 10 Sep 2025 19:33:43 +0000
Received: by outflank-mailman (input) for mailman id 1118750;
 Wed, 10 Sep 2025 19: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 1uwQZa-0006B7-HU
 for xen-changelog@lists.xenproject.org; Wed, 10 Sep 2025 19: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 1uwQZa-003Pni-1e
 for xen-changelog@lists.xenproject.org;
 Wed, 10 Sep 2025 19:33:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uwQZa-003LXr-1Y
 for xen-changelog@lists.xenproject.org;
 Wed, 10 Sep 2025 19: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=kL3tLXavtZg21+K8jl1kptgiN+U4fJAomfeQV8N49gA=; b=1xgQMKfrCthqg2n0JpH39sfqMK
	hlOlVdyHMQGAwyP8PKh7O5t8C3u18wXjHhPnCgu7RMgMFsPgRXTjkrcGW5YF6URLM4cWmhVpu7g9s
	C/BerRAc8TbUfQxuzUXFOU8kYv3bHn82pH6cIGUz/bXoWTRohr5TcFQNqYWyktTRE1ig=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] x86/hvm/ioreq: Fix condition in hvm_alloc_legacy_ioreq_gfn()
Message-Id: <E1uwQZa-003LXr-1Y@xenbits.xenproject.org>
Date: Wed, 10 Sep 2025 19:33:42 +0000

commit 0e0e09205d9a2ab94dc4bc4d40bc65d2ceb6fb95
Author:     Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
AuthorDate: Wed Sep 3 14:05:34 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 3 14:05:34 2025 +0200

    x86/hvm/ioreq: Fix condition in hvm_alloc_legacy_ioreq_gfn()
    
    Fix the incorrect condition that causes hvm_alloc_legacy_ioreq_gfn()
    to return INVALID_GFN even if the HVM param was installed properly by
    the toolstack.
    
    Fixes: 3486f398a3dd (' x86/hvm/ioreq: allow ioreq servers to use HVM_PARAM_[BUF]IOREQ_PFN')
    Signed-off-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 282ed258a59195698a81ab4408a17336eb6ea7ed
    master date: 2025-08-18 10:43:52 +0200
---
 xen/arch/x86/hvm/ioreq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/hvm/ioreq.c b/xen/arch/x86/hvm/ioreq.c
index 4eb7a70182..549e652657 100644
--- a/xen/arch/x86/hvm/ioreq.c
+++ b/xen/arch/x86/hvm/ioreq.c
@@ -61,7 +61,7 @@ static gfn_t hvm_alloc_legacy_ioreq_gfn(struct ioreq_server *s)
 
     for ( i = HVM_PARAM_IOREQ_PFN; i <= HVM_PARAM_BUFIOREQ_PFN; i++ )
     {
-        if ( !test_and_clear_bit(i, &d->arch.hvm.ioreq_gfn.legacy_mask) )
+        if ( test_and_clear_bit(i, &d->arch.hvm.ioreq_gfn.legacy_mask) )
             return _gfn(d->arch.hvm.params[i]);
     }
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Sep 10 19:33:54 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 10 Sep 2025 19:33:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1118751.1464412 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uwQZm-0006DV-0F; Wed, 10 Sep 2025 19:33:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1118751.1464412; Wed, 10 Sep 2025 19: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 1uwQZl-0006DN-Tu; Wed, 10 Sep 2025 19:33:53 +0000
Received: by outflank-mailman (input) for mailman id 1118751;
 Wed, 10 Sep 2025 19: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 1uwQZk-0006DD-KH
 for xen-changelog@lists.xenproject.org; Wed, 10 Sep 2025 19: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 1uwQZk-003Pny-1w
 for xen-changelog@lists.xenproject.org;
 Wed, 10 Sep 2025 19:33:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uwQZk-003LYb-1q
 for xen-changelog@lists.xenproject.org;
 Wed, 10 Sep 2025 19: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=YqjHX4Y0JpiDLmB+eUFEj99GSxxBlumfinPfmEXA43Q=; b=kYAHgTgCCDUXgZYgHts6Dxibhc
	IktyUW+x0aqeJX2n3AZPU2nFfLQp99UmV/4lYR5fY3PHq+wuV31/GfuYzARsW1P96klNDlPFSjnxa
	gZUkUYB1+Z7VpNiXYTLnONdFA6X4yNi4MidsacAAlBI9pQYyqBZlWtJhcmuIohWLlcaA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] x86/iommu: setup MMCFG ahead of IOMMU
Message-Id: <E1uwQZk-003LYb-1q@xenbits.xenproject.org>
Date: Wed, 10 Sep 2025 19:33:52 +0000

commit 3f250a375fc02b87f69328d3fa6120056232ef3e
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Sep 3 14:06:00 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 3 14:06:00 2025 +0200

    x86/iommu: setup MMCFG ahead of IOMMU
    
    Otherwise the PCI accesses to segments different than the first one done by
    the IOMMU initialization code would silently fail by returning all ones.
    
    Introduce a new helper, called pci_setup(), and move both the creation of
    PCI segment 0 internal data structures, plus the parsing of ACPI MMCFG
    table to it.  This moves acpi_mmcfg_init() slightly earlier from
    acpi_boot_init() into pci_setup().
    
    Note that further work will be needed to support systems where access
    methods to segments different than 0 is not discoverable by Xen.
    
    Fixes: 3950f2485bbc ('x86/x2APIC: defer probe until after IOMMU ACPI table parsing')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: c292772b4945d3a264a61c3c1920f1aebd17998b
    master date: 2025-08-21 11:57:25 +0200
---
 xen/arch/x86/acpi/boot.c              | 2 --
 xen/arch/x86/setup.c                  | 6 ++++++
 xen/arch/x86/x86_64/mmconfig-shared.c | 3 +++
 3 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/acpi/boot.c b/xen/arch/x86/acpi/boot.c
index 170f9783c5..aa9ab1a2e3 100644
--- a/xen/arch/x86/acpi/boot.c
+++ b/xen/arch/x86/acpi/boot.c
@@ -748,8 +748,6 @@ int __init acpi_boot_init(void)
 
 	acpi_table_parse(ACPI_SIG_HPET, acpi_parse_hpet);
 
-	acpi_mmcfg_init();
-
 	erst_init();
 
 	acpi_hest_init();
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 2148dde05f..a123f94e85 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -1802,6 +1802,12 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
      */
     setup_system_domains();
 
+    /*
+     * Initialize PCI (create segment 0, setup MMCFG access) ahead of IOMMU
+     * setup, as devices in segment > 0 must also be discoverable.
+     */
+    acpi_mmcfg_init();
+
     /*
      * IOMMU-related ACPI table parsing has to happen before APIC probing, for
      * check_x2apic_preenabled() to be able to observe respective findings, in
diff --git a/xen/arch/x86/x86_64/mmconfig-shared.c b/xen/arch/x86/x86_64/mmconfig-shared.c
index b3b2da7362..7818ae5c3f 100644
--- a/xen/arch/x86/x86_64/mmconfig-shared.c
+++ b/xen/arch/x86/x86_64/mmconfig-shared.c
@@ -403,6 +403,9 @@ void __init acpi_mmcfg_init(void)
 
     pci_segments_init();
 
+    if ( acpi_disabled )
+        return;
+
     /* MMCONFIG disabled */
     if ((pci_probe & PCI_PROBE_MMCONF) == 0)
         return;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Sep 10 19:34:04 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 10 Sep 2025 19:34:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1118752.1464416 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uwQZw-0006Fg-1j; Wed, 10 Sep 2025 19:34:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1118752.1464416; Wed, 10 Sep 2025 19:34: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 1uwQZv-0006FY-VK; Wed, 10 Sep 2025 19:34:03 +0000
Received: by outflank-mailman (input) for mailman id 1118752;
 Wed, 10 Sep 2025 19: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 1uwQZu-0006FJ-My
 for xen-changelog@lists.xenproject.org; Wed, 10 Sep 2025 19: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 1uwQZu-003PoF-2C
 for xen-changelog@lists.xenproject.org;
 Wed, 10 Sep 2025 19:34:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uwQZu-003LZk-27
 for xen-changelog@lists.xenproject.org;
 Wed, 10 Sep 2025 19: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=+yMPp3cCc6RywWauKGlf+d4DXfAz6qIcBiP5xCY0RRA=; b=T/bhL4dcCimlINvO1Etoo/UQ8R
	BTFZI4h6vdm2gS4I5wQnk6ZxCXzPQqC5BdtM0jWPoLZYc1Ep7NHO4JLhPim11ueJT700voiyBrQYD
	CF2Zeqz62niwIXplDdFqZ8u5rvuyGF+5XqAHv8/IsLUtUt7E4P9azqSJgUCxC8A+YUeU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] x86/mce: Adjustments to intel_init_ppin()
Message-Id: <E1uwQZu-003LZk-27@xenbits.xenproject.org>
Date: Wed, 10 Sep 2025 19:34:02 +0000

commit 880d61a783be958edcec8864920c549719292274
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Sep 3 14:06:20 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 3 14:06:20 2025 +0200

    x86/mce: Adjustments to intel_init_ppin()
    
    There's no family check gating intel_init_ppin(), making it incorrect to
    use on non Fam6 CPUs.
    
    Emerald Rapids is the final CPU to have PPIN but lack the architectural
    enumeration, so include it too.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 49e6eb744eba01f5d4b4cfce49154c0802d4f5c6
    master date: 2025-08-25 14:04:41 +0100
---
 xen/arch/x86/cpu/mcheck/mce_intel.c | 24 +++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/xen/arch/x86/cpu/mcheck/mce_intel.c b/xen/arch/x86/cpu/mcheck/mce_intel.c
index dd812f4b8a..76d6202809 100644
--- a/xen/arch/x86/cpu/mcheck/mce_intel.c
+++ b/xen/arch/x86/cpu/mcheck/mce_intel.c
@@ -10,6 +10,7 @@
 #include <xen/cpu.h>
 #include <asm/processor.h>
 #include <public/sysctl.h>
+#include <asm/intel-family.h>
 #include <asm/system.h>
 #include <asm/msr.h>
 #include <asm/p2m.h>
@@ -859,7 +860,7 @@ static void intel_init_ppin(const struct cpuinfo_x86 *c)
      * other purposes.  Despite the late addition of a CPUID bit (rendering
      * the MSR architectural), keep using the same detection logic there.
      */
-    switch ( c->x86_model )
+    switch ( c->x86 == 6 ? c->x86_model : 0 )
     {
         uint64_t val;
 
@@ -870,16 +871,17 @@ static void intel_init_ppin(const struct cpuinfo_x86 *c)
             return;
         }
         fallthrough;
-    case 0x3e: /* IvyBridge X */
-    case 0x3f: /* Haswell X */
-    case 0x4f: /* Broadwell X */
-    case 0x55: /* Skylake X */
-    case 0x56: /* Broadwell Xeon D */
-    case 0x57: /* Knights Landing */
-    case 0x6a: /* Icelake X */
-    case 0x6c: /* Icelake D */
-    case 0x85: /* Knights Mill */
-    case 0x8f: /* Sapphire Rapids X */
+    case INTEL_FAM6_IVYBRIDGE_X:
+    case INTEL_FAM6_HASWELL_X:
+    case INTEL_FAM6_BROADWELL_X:
+    case INTEL_FAM6_BROADWELL_D:
+    case INTEL_FAM6_SKYLAKE_X:
+    case INTEL_FAM6_XEON_PHI_KNL:
+    case INTEL_FAM6_XEON_PHI_KNM:
+    case INTEL_FAM6_ICELAKE_X:
+    case INTEL_FAM6_ICELAKE_D:
+    case INTEL_FAM6_SAPPHIRERAPIDS_X:
+    case INTEL_FAM6_EMERALDRAPIDS_X:
 
         if ( (c != &boot_cpu_data && !ppin_msr) ||
              rdmsr_safe(MSR_PPIN_CTL, val) )
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Sep 10 19:34:14 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 10 Sep 2025 19:34:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1118753.1464421 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uwQa6-0006Hk-3D; Wed, 10 Sep 2025 19:34:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1118753.1464421; Wed, 10 Sep 2025 19:34: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 1uwQa6-0006Hc-0R; Wed, 10 Sep 2025 19:34:14 +0000
Received: by outflank-mailman (input) for mailman id 1118753;
 Wed, 10 Sep 2025 19: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 1uwQa4-0006HT-RU
 for xen-changelog@lists.xenproject.org; Wed, 10 Sep 2025 19: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 1uwQa4-003Poe-2T
 for xen-changelog@lists.xenproject.org;
 Wed, 10 Sep 2025 19:34:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uwQa4-003LaB-2O
 for xen-changelog@lists.xenproject.org;
 Wed, 10 Sep 2025 19: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=xrOGKUNa24CqkLyfiXdBZLrhmGIqYEQEQgt69GJdFwU=; b=OvCQju07YUTJ9Vsm3fdzhvIGIV
	1mofIQvUhOWzoHVBsJEo/BykBthdYrR7lZgWYFT1IO7YK2x5TdZunfiDc+iPTZBZiWW/OruAZlumv
	vsAFs1h+rbeHrtEer5yRr+E9NcTGb00MsL1mNNmsmC1o40Och7M7nJ28BTg56CjLzBtY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] x86/suspend: unconditionally raise a timer softirq on resume
Message-Id: <E1uwQa4-003LaB-2O@xenbits.xenproject.org>
Date: Wed, 10 Sep 2025 19:34:12 +0000

commit c1a9db15d174ee82e945282b18f98c00bf9078bf
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Sep 3 14:06:38 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 3 14:06:38 2025 +0200

    x86/suspend: unconditionally raise a timer softirq on resume
    
    The current code to restore the timer state on resume is incomplete.  While
    the local APIC Initial Count Register is saved and restored across
    suspension (even if possibly no longer accurate since it's not adjusted to
    account for the time spent in suspension), the TSC deadline MSR is not
    saved and restored, hence hosts using the TSC deadline timer will likely
    get stuck when resuming from suspension.
    
    The lack of restoring of the TSC deadline MSR was mitigated by the raising
    of a timer softirq in mwait_idle_with_hints() if the timer had expired,
    previous to commit 3faf0866a33070b926ab78e6298290403f85e76c, which removed
    that logic.
    
    This patch fixes the usage of the TSC deadline timer with suspension, by
    unconditionally raising a timer softirq on resume, that will take care of
    rearming the hardware timer.  Given that a timer softirq will be
    unconditionally risen, there's no need to save and restore the APIC Initial
    Count Register anymore either.
    
    Note that secondary processors don't need this special treatment when
    resuming, since they are offlined before suspension and brought back up
    during resume, the first timer that gets setup will trigger a timer softirq
    unconditionally, for example from sched_migrate_timers() that gets called
    for each secondary processor.
    
    Link: https://github.com/QubesOS/qubes-issues/issues/10110
    Reported-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Fixes: fd1291a826e1 ('X86: Prefer TSC-deadline timer in Xen')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Tested-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    master commit: 757abedabbb64f18a28ae61a7bd67a927bb03130
    master date: 2025-08-27 09:33:12 +0200
---
 xen/arch/x86/acpi/power.c | 2 ++
 xen/arch/x86/apic.c       | 3 ---
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/acpi/power.c b/xen/arch/x86/acpi/power.c
index 01cdaf9052..f1d2ea614f 100644
--- a/xen/arch/x86/acpi/power.c
+++ b/xen/arch/x86/acpi/power.c
@@ -22,6 +22,7 @@
 #include <xen/domain.h>
 #include <xen/console.h>
 #include <xen/iommu.h>
+#include <xen/softirq.h>
 #include <xen/watchdog.h>
 #include <xen/cpu.h>
 #include <public/platform.h>
@@ -330,6 +331,7 @@ static int enter_state(u32 state)
     thaw_domains();
     system_state = SYS_STATE_active;
     spin_unlock(&pm_lock);
+    raise_softirq(TIMER_SOFTIRQ);
     return error;
 }
 
diff --git a/xen/arch/x86/apic.c b/xen/arch/x86/apic.c
index 6567af685a..16e03ebd91 100644
--- a/xen/arch/x86/apic.c
+++ b/xen/arch/x86/apic.c
@@ -63,7 +63,6 @@ static struct {
     unsigned int apic_lvt0;
     unsigned int apic_lvt1;
     unsigned int apic_lvterr;
-    unsigned int apic_tmict;
     unsigned int apic_tdcr;
     unsigned int apic_thmr;
 } apic_pm_state;
@@ -658,7 +657,6 @@ int lapic_suspend(void)
     apic_pm_state.apic_lvt0 = apic_read(APIC_LVT0);
     apic_pm_state.apic_lvt1 = apic_read(APIC_LVT1);
     apic_pm_state.apic_lvterr = apic_read(APIC_LVTERR);
-    apic_pm_state.apic_tmict = apic_read(APIC_TMICT);
     apic_pm_state.apic_tdcr = apic_read(APIC_TDCR);
     if (maxlvt >= 5)
         apic_pm_state.apic_thmr = apic_read(APIC_LVTTHMR);
@@ -718,7 +716,6 @@ int lapic_resume(void)
         apic_write(APIC_LVTPC, apic_pm_state.apic_lvtpc);
     apic_write(APIC_LVTT, apic_pm_state.apic_lvtt);
     apic_write(APIC_TDCR, apic_pm_state.apic_tdcr);
-    apic_write(APIC_TMICT, apic_pm_state.apic_tmict);
     apic_write(APIC_ESR, 0);
     apic_read(APIC_ESR);
     apic_write(APIC_LVTERR, apic_pm_state.apic_lvterr);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Sep 10 19:34:24 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 10 Sep 2025 19:34:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1118754.1464425 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uwQaG-0006KS-5t; Wed, 10 Sep 2025 19:34:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1118754.1464425; Wed, 10 Sep 2025 19:34: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 1uwQaG-0006KK-3C; Wed, 10 Sep 2025 19:34:24 +0000
Received: by outflank-mailman (input) for mailman id 1118754;
 Wed, 10 Sep 2025 19: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 1uwQaE-0006KA-SM
 for xen-changelog@lists.xenproject.org; Wed, 10 Sep 2025 19: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 1uwQaE-003Poi-2k
 for xen-changelog@lists.xenproject.org;
 Wed, 10 Sep 2025 19:34:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uwQaE-003LaX-2e
 for xen-changelog@lists.xenproject.org;
 Wed, 10 Sep 2025 19: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=JYDiITUj+6ld7kWpexGhnr88h4oDya8STqBvEB0tbok=; b=1VRzCJLfPLO0eGRZrKf1q3AxMd
	osAILIUJ27PD2x4B2ZuJVHt9sNR79t7lGJlevXIyF9ydHKsFxz/zxsOCPTbkBDD1paLuzhaot9sDo
	XVHNN8buAzBMZK/CkkisQ89wfez9zOSGTtjWcUpS8kIfxawASC8SpjGjGpXtNuR/sxt8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] tools: add sizeof_field and endof_field macros
Message-Id: <E1uwQaE-003LaX-2e@xenbits.xenproject.org>
Date: Wed, 10 Sep 2025 19:34:22 +0000

commit ba930c34b3361514de536fba97b154553ebff1d0
Author:     Petr Beneš <w1benny@gmail.com>
AuthorDate: Wed Sep 3 14:06:59 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 3 14:06:59 2025 +0200

    tools: add sizeof_field and endof_field macros
    
    * `sizeof_field` returns the size of a specific struct member
    * `endof_field` returns the offset to the end of the member within the struct
    
    It will be useful in upcoming layout checks of SMBIOS structs.
    
    Signed-off-by: Petr Beneš <w1benny@gmail.com>
    Acked-by: Anthony PERARD <anthony.perard@vates.tech>
    master commit: 17e66ca9188b423eee35e6b4bf878e62d3879a04
    master date: 2025-08-27 11:26:33 +0200
---
 tools/include/xen-tools/common-macros.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tools/include/xen-tools/common-macros.h b/tools/include/xen-tools/common-macros.h
index 0088208c2e..9838a108aa 100644
--- a/tools/include/xen-tools/common-macros.h
+++ b/tools/include/xen-tools/common-macros.h
@@ -83,6 +83,11 @@
 #define __packed __attribute__((__packed__))
 #endif
 
+#define sizeof_field(type, member) sizeof(((type *)NULL)->member)
+
+#define endof_field(type, member) \
+    (offsetof(type, member) + sizeof_field(type, member))
+
 #define container_of(ptr, type, member) ({              \
     typeof(((type *)0)->member) *mptr__ = (ptr);        \
     (type *)((char *)mptr__ - offsetof(type, member));  \
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Sep 10 19:34:34 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 10 Sep 2025 19:34:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1118755.1464429 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uwQaQ-0006MT-7N; Wed, 10 Sep 2025 19:34:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1118755.1464429; Wed, 10 Sep 2025 19:34: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 1uwQaQ-0006MM-4e; Wed, 10 Sep 2025 19:34:34 +0000
Received: by outflank-mailman (input) for mailman id 1118755;
 Wed, 10 Sep 2025 19:34: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 1uwQaO-0006MC-V1
 for xen-changelog@lists.xenproject.org; Wed, 10 Sep 2025 19: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 1uwQaO-003Pom-31
 for xen-changelog@lists.xenproject.org;
 Wed, 10 Sep 2025 19:34:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uwQaO-003Lb7-2v
 for xen-changelog@lists.xenproject.org;
 Wed, 10 Sep 2025 19: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=eWBI82ept90VfCbCrpB5Esx8Mi+9cpk7kavvQOF8wLU=; b=NCv+W9X/Ul22l5TaV9+eUL5Fmc
	MWxwUeiJ0j9zBEqnXSTD5yl8RVjZZnCaYoT61zU0KZd+Se6EFmdV0lSsJGuZj2G0tsE79BXPg+TAl
	uCoufQH0gEkTQZ+tIWv3JOwUm0CHVzI4uPEWkmxlJpIvnIG0P1PBoq/onYk3bRL7wD1I=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] hvmloader: fix SMBIOS table length checks
Message-Id: <E1uwQaO-003Lb7-2v@xenbits.xenproject.org>
Date: Wed, 10 Sep 2025 19:34:32 +0000

commit c275e90b3ce79ba371ba0a8fff7aeee84468359e
Author:     Petr Beneš <w1benny@gmail.com>
AuthorDate: Wed Sep 3 14:07:14 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 3 14:07:14 2025 +0200

    hvmloader: fix SMBIOS table length checks
    
    SMBIOS specification dictates that tables should have a minimal length.
    This commit introduces further validation for user-input SMBIOS tables.
    
    As per SMBIOS Reference Specification:
    * Type 0: For version 2.3 and later implementations, the length is at least 14h
    * Type 1: 1Bh for 2.4 and later
    * Type 2: at least 08h
    * Type 3: 0Dh for version 2.1 and later
    * Type 11: 5h (+ strings)
    * Type 22: 1Ah (+ strings)
    * Type 39: a minimum of 10h
    
    Notably, this also fixes previously incorrect check for chassis handle in
    smbios_type_2_init. Chassis handle is a WORD, therefore, the condition now
    correctly checks for >= 13 instead of > 13.
    
    hvmloader currently implements version 2.4
    
    Furthermore, this commit introduces smbios_pt_copy helper function to substitute
    previously repeating pattern of locating the struct in physical memory (via
    get_smbios_pt_struct), checking the length and copying it into SMBIOS region.
    
    Fixes: 4d23036e7096 ("HVM firmware passthrough SMBIOS processing")
    Signed-off-by: Petr Beneš <w1benny@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    master commit: 2f7d52f0165a5b62dbec1e507d0de427abe9b5d5
    master date: 2025-08-27 11:26:33 +0200
---
 tools/firmware/hvmloader/smbios.c       | 178 +++++++++++++++++++-------------
 tools/firmware/hvmloader/smbios_types.h |  32 +++---
 2 files changed, 123 insertions(+), 87 deletions(-)

diff --git a/tools/firmware/hvmloader/smbios.c b/tools/firmware/hvmloader/smbios.c
index 97a054e9e3..27b242a832 100644
--- a/tools/firmware/hvmloader/smbios.c
+++ b/tools/firmware/hvmloader/smbios.c
@@ -47,6 +47,8 @@ static void
 smbios_pt_init(void);
 static void*
 get_smbios_pt_struct(uint8_t type, uint32_t *length_out);
+static void *
+smbios_pt_copy(void *start, uint8_t type, uint16_t handle, size_t table_size);
 static void
 get_cpu_manufacturer(char *buf, int len);
 static int
@@ -154,6 +156,24 @@ get_smbios_pt_struct(uint8_t type, uint32_t *length_out)
     return NULL;
 }
 
+static void *
+smbios_pt_copy(void *start, uint8_t type, uint16_t handle, size_t min_size)
+{
+    struct smbios_structure_header *header = start;
+    void *pts;
+    uint32_t length;
+
+    pts = get_smbios_pt_struct(type, &length);
+    if ( pts != NULL && length >= min_size )
+    {
+        memcpy(start, pts, length);
+        header->handle = handle;
+        return start + length;
+    }
+
+    return start;
+}
+
 static void
 get_cpu_manufacturer(char *buf, int len)
 {
@@ -381,16 +401,17 @@ smbios_type_0_init(void *start, const char *xen_version,
     struct smbios_type_0 *p = (struct smbios_type_0 *)start;
     static const char *smbios_release_date = __SMBIOS_DATE__;
     const char *s;
-    void *pts;
-    uint32_t length;
+    void *next;
 
-    pts = get_smbios_pt_struct(0, &length);
-    if ( (pts != NULL)&&(length > 0) )
-    {
-        memcpy(start, pts, length);
-        p->header.handle = SMBIOS_HANDLE_TYPE0;
-        return (start + length);
-    }
+    /*
+     * Specification says Type 0 table has length of at least 18h for v2.4-3.0.
+     */
+
+    BUILD_BUG_ON(sizeof(*p) != 24);
+
+    next = smbios_pt_copy(start, 0, SMBIOS_HANDLE_TYPE0, sizeof(*p));
+    if ( next != start )
+        return next;
 
     memset(p, 0, sizeof(*p));
 
@@ -440,16 +461,14 @@ smbios_type_1_init(void *start, const char *xen_version,
     char uuid_str[37];
     struct smbios_type_1 *p = (struct smbios_type_1 *)start;
     const char *s;
-    void *pts;
-    uint32_t length;
+    void *next;
 
-    pts = get_smbios_pt_struct(1, &length);
-    if ( (pts != NULL)&&(length > 0) )
-    {
-        memcpy(start, pts, length);
-        p->header.handle = SMBIOS_HANDLE_TYPE1;
-        return (start + length);
-    }
+    /* Specification says Type 1 table has length of 1Bh for v2.4 and later. */
+    BUILD_BUG_ON(sizeof(*p) != 27);
+
+    next = smbios_pt_copy(start, 1, SMBIOS_HANDLE_TYPE1, sizeof(*p));
+    if ( next != start )
+        return next;
 
     memset(p, 0, sizeof(*p));
 
@@ -498,26 +517,29 @@ smbios_type_2_init(void *start)
 {
     struct smbios_type_2 *p = (struct smbios_type_2 *)start;
     const char *s;
-    uint8_t *ptr;
-    void *pts;
-    uint32_t length;
+    void *next;
     unsigned int counter = 0;
 
-    pts = get_smbios_pt_struct(2, &length);
-    if ( (pts != NULL)&&(length > 0) )
-    {
-        memcpy(start, pts, length);
-        p->header.handle = SMBIOS_HANDLE_TYPE2;
+    /*
+     * Specification says Type 2 table has length of at least 08h,
+     * which corresponds with the end of the "Serial Number" field.
+     */
 
+    BUILD_BUG_ON(endof_field(struct smbios_type_2, serial_number_str) != 8);
+
+    next = smbios_pt_copy(start, 2, SMBIOS_HANDLE_TYPE2,
+                          endof_field(struct smbios_type_2, serial_number_str));
+    if ( next != start )
+    {
         /* Set current chassis handle if present */
-        if ( p->header.length > 13 )
+        if ( p->header.length >= endof_field(struct smbios_type_2,
+                                             chassis_handle) )
         {
-            ptr = ((uint8_t*)start) + 11;            
-            if ( *((uint16_t*)ptr) != 0 )
-                *((uint16_t*)ptr) = SMBIOS_HANDLE_TYPE3;
+            if ( p->chassis_handle != 0 )
+                p->chassis_handle = SMBIOS_HANDLE_TYPE3;
         }
 
-        return (start + length);
+        return next;
     }
 
     memset(p, 0, sizeof(*p));
@@ -593,18 +615,21 @@ smbios_type_3_init(void *start)
 {
     struct smbios_type_3 *p = (struct smbios_type_3 *)start;
     const char *s;
-    void *pts;
-    uint32_t length;
+    void *next;
     uint32_t counter = 0;
 
-    pts = get_smbios_pt_struct(3, &length);
-    if ( (pts != NULL)&&(length > 0) )
-    {
-        memcpy(start, pts, length);
-        p->header.handle = SMBIOS_HANDLE_TYPE3;
-        return (start + length);
-    }
-    
+    /*
+     * Specification says Type 3 table has length of at least 0Dh (for v2.1+),
+     * which corresponds with the end of the "Security Status" field.
+     */
+
+    BUILD_BUG_ON(endof_field(struct smbios_type_3, security_status) != 13);
+
+    next = smbios_pt_copy(start, 3, SMBIOS_HANDLE_TYPE3,
+                          offsetof(struct smbios_type_3, security_status));
+    if ( next != start )
+        return next;
+
     memset(p, 0, sizeof(*p));
 
     p->header.type = 3;
@@ -656,6 +681,9 @@ smbios_type_4_init(
     struct smbios_type_4 *p = (struct smbios_type_4 *)start;
     uint32_t eax, ebx, ecx, edx;
 
+    /* Specification says Type 4 table has length of 23h for v2.3+. */
+    BUILD_BUG_ON(sizeof(*p) != 35);
+
     memset(p, 0, sizeof(*p));
 
     p->header.type = 4;
@@ -707,17 +735,15 @@ smbios_type_11_init(void *start)
     struct smbios_type_11 *p = (struct smbios_type_11 *)start;
     char path[20];
     const char *s;
+    void *next;
     int i;
-    void *pts;
-    uint32_t length;
 
-    pts = get_smbios_pt_struct(11, &length);
-    if ( (pts != NULL)&&(length > 0) )
-    {
-        memcpy(start, pts, length);
-        p->header.handle = SMBIOS_HANDLE_TYPE11;
-        return (start + length);
-    }
+    /* Specification says Type 11 table has length of 05h. */
+    BUILD_BUG_ON(sizeof(*p) != 5);
+    
+    next = smbios_pt_copy(start, 11, SMBIOS_HANDLE_TYPE11, sizeof(*p));
+    if ( next != start )
+        return next;
 
     p->header.type = 11;
     p->header.length = sizeof(struct smbios_type_11);
@@ -756,6 +782,9 @@ smbios_type_16_init(void *start, uint32_t memsize, int nr_mem_devs)
 {
     struct smbios_type_16 *p = (struct smbios_type_16*)start;
 
+    /* Specification says Type 16 table has length of 0Fh for v2.1-2.7. */
+    BUILD_BUG_ON(sizeof(*p) != 15);
+
     memset(p, 0, sizeof(*p));
 
     p->header.type = 16;
@@ -781,6 +810,9 @@ smbios_type_17_init(void *start, uint32_t memory_size_mb, int instance)
     char buf[16];
     struct smbios_type_17 *p = (struct smbios_type_17 *)start;
     
+    /* Specification says Type 17 table has length of 1Bh for v2.3-2.6. */
+    BUILD_BUG_ON(sizeof(*p) != 27);
+
     memset(p, 0, sizeof(*p));
 
     p->header.type = 17;
@@ -816,6 +848,9 @@ smbios_type_19_init(void *start, uint32_t memory_size_mb, int instance)
 {
     struct smbios_type_19 *p = (struct smbios_type_19 *)start;
     
+    /* Specification says Type 19 table has length of 0Fh for v2.1-2.7. */
+    BUILD_BUG_ON(sizeof(*p) != 15);
+
     memset(p, 0, sizeof(*p));
 
     p->header.type = 19;
@@ -838,6 +873,9 @@ smbios_type_20_init(void *start, uint32_t memory_size_mb, int instance)
 {
     struct smbios_type_20 *p = (struct smbios_type_20 *)start;
 
+    /* Specification says Type 20 table has length of 13h for v2.1-2.7. */
+    BUILD_BUG_ON(sizeof(*p) != 19);
+
     memset(p, 0, sizeof(*p));
 
     p->header.type = 20;
@@ -865,16 +903,14 @@ smbios_type_22_init(void *start)
     struct smbios_type_22 *p = (struct smbios_type_22 *)start;
     static const char *smbios_release_date = __SMBIOS_DATE__;
     const char *s;
-    void *pts;
-    uint32_t length;
+    void *next;
 
-    pts = get_smbios_pt_struct(22, &length);
-    if ( (pts != NULL)&&(length > 0) )
-    {
-        memcpy(start, pts, length);
-        p->header.handle = SMBIOS_HANDLE_TYPE22;
-        return (start + length);
-    }
+    /* Specification says Type 22 table has length of 1Ah. */
+    BUILD_BUG_ON(sizeof(*p) != 26);
+
+    next = smbios_pt_copy(start, 22, SMBIOS_HANDLE_TYPE22, sizeof(*p));
+    if ( next != start )
+        return next;
 
     s = xenstore_read(HVM_XS_SMBIOS_DEFAULT_BATTERY, "0");
     if ( strncmp(s, "1", 1) != 0 )
@@ -929,6 +965,9 @@ smbios_type_32_init(void *start)
 {
     struct smbios_type_32 *p = (struct smbios_type_32 *)start;
 
+    /* Specification says Type 32 table has length of at least 0Bh. */
+    BUILD_BUG_ON(sizeof(*p) != 11);
+
     memset(p, 0, sizeof(*p));
 
     p->header.type = 32;
@@ -946,20 +985,17 @@ smbios_type_32_init(void *start)
 static void *
 smbios_type_39_init(void *start)
 {
-    struct smbios_type_39 *p = (struct smbios_type_39 *)start;
-    void *pts;
-    uint32_t length;
+    /*
+     * Specification says Type 39 table has length of at least 10h,
+     * which corresponds with the end of the "Characteristics" field.
+     *
+     * Only present when passed in.
+     */
 
-    pts = get_smbios_pt_struct(39, &length);
-    if ( (pts != NULL)&&(length > 0) )
-    {
-        memcpy(start, pts, length);
-        p->header.handle = SMBIOS_HANDLE_TYPE39;
-        return (start + length);
-    }
+    BUILD_BUG_ON(endof_field(struct smbios_type_39, characteristics) != 16);
 
-    /* Only present when passed in */
-    return start;
+    return smbios_pt_copy(start, 39, SMBIOS_HANDLE_TYPE39,
+                          endof_field(struct smbios_type_39, characteristics));
 }
 
 static void *
diff --git a/tools/firmware/hvmloader/smbios_types.h b/tools/firmware/hvmloader/smbios_types.h
index 7c648ece71..a04d194975 100644
--- a/tools/firmware/hvmloader/smbios_types.h
+++ b/tools/firmware/hvmloader/smbios_types.h
@@ -90,13 +90,13 @@ struct smbios_type_2 {
     uint8_t product_name_str;
     uint8_t version_str;
     uint8_t serial_number_str;
-    uint8_t asset_tag_str;
-    uint8_t feature_flags;
-    uint8_t location_in_chassis_str;
-    uint16_t chassis_handle;
-    uint8_t board_type;
-    uint8_t contained_handle_count;
-    uint16_t contained_handles[];
+    uint8_t asset_tag_str;                  /* Optional */
+    uint8_t feature_flags;                  /* Optional */
+    uint8_t location_in_chassis_str;        /* Optional */
+    uint16_t chassis_handle;                /* Optional */
+    uint8_t board_type;                     /* Optional */
+    uint8_t contained_handle_count;         /* Optional */
+    uint16_t contained_handles[];           /* Optional */
 } __attribute__ ((packed));
 
 /* System Enclosure - Contained Elements */
@@ -118,12 +118,12 @@ struct smbios_type_3 {
     uint8_t power_supply_state;
     uint8_t thermal_state;
     uint8_t security_status;
-    uint32_t oem_specific;
-    uint8_t height;
-    uint8_t number_of_power_cords;
-    uint8_t contained_element_count;
-    uint8_t contained_element_length;
-    struct smbios_contained_element contained_elements[];
+    uint32_t oem_specific;                  /* Optional */
+    uint8_t height;                         /* Optional */
+    uint8_t number_of_power_cords;          /* Optional */
+    uint8_t contained_element_count;        /* Optional */
+    uint8_t contained_element_length;       /* Optional */
+    struct smbios_contained_element contained_elements[]; /* Optional */
 } __attribute__ ((packed));
 
 /* SMBIOS type 4 - Processor Information */
@@ -252,9 +252,9 @@ struct smbios_type_39 {
     uint8_t revision_level_str;
     uint16_t max_capacity;
     uint16_t characteristics;
-    uint16_t input_voltage_probe_handle;
-    uint16_t cooling_device_handle;
-    uint16_t input_current_probe_handle;
+    uint16_t input_voltage_probe_handle;    /* Optional */
+    uint16_t cooling_device_handle;         /* Optional */
+    uint16_t input_current_probe_handle;    /* Optional */
 } __attribute__ ((packed));
 
 /* SMBIOS type 127 -- End-of-table */
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Sep 10 19:34:44 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 10 Sep 2025 19:34:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1118756.1464433 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uwQaa-0006Or-9J; Wed, 10 Sep 2025 19:34:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1118756.1464433; Wed, 10 Sep 2025 19: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 1uwQaa-0006Oj-6D; Wed, 10 Sep 2025 19:34:44 +0000
Received: by outflank-mailman (input) for mailman id 1118756;
 Wed, 10 Sep 2025 19: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 1uwQaZ-0006Ob-1V
 for xen-changelog@lists.xenproject.org; Wed, 10 Sep 2025 19: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 1uwQaZ-003Pou-04
 for xen-changelog@lists.xenproject.org;
 Wed, 10 Sep 2025 19:34:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uwQaY-003Lbd-3C
 for xen-changelog@lists.xenproject.org;
 Wed, 10 Sep 2025 19: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=miWKW0iF99a5ype4c4XZzmTwxvz9KdmtBxFH9baIkGo=; b=UGmdSZk2yPLT3gycaSr+uSzP7i
	sT/QaQxCJdcc3vTQfSNsMdlVrKt/8sDzE2d3Zs5Ud0Mz6BJl5spn0PSlVPnurovCeLMKjbDzyb8TF
	kIOvB2PbrR8LuMaikdum+XckO5qrFoMPMlzl01SGJYjgyPg4AgF8vksQUuv1QrEpCjlM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] xen/efi: Fix crash with initial empty EFI options
Message-Id: <E1uwQaY-003Lbd-3C@xenbits.xenproject.org>
Date: Wed, 10 Sep 2025 19:34:42 +0000

commit dc04d4e8c767b5ef21b8b62a8bbc2eb07d21d5b5
Author:     Frediano Ziglio <frediano.ziglio@cloud.com>
AuthorDate: Wed Sep 3 14:07:33 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 3 14:07:33 2025 +0200

    xen/efi: Fix crash with initial empty EFI options
    
    EFI code path split options from EFI LoadOptions fields in 2
    pieces, first EFI options, second Xen options.
    "get_argv" function is called first to get the number of arguments
    in the LoadOptions, second, after allocating enough space, to
    fill some "argc"/"argv" variable. However the first parsing could
    be different from second as second is able to detect "--" argument
    separator. So it was possible that "argc" was bigger than the
    initialized portion of "argv" array, leading to potential
    uninitialized pointer dereference, in particular a string like
    "-- a b c" would lead to crashes.
    Using EFI shell is possible to pass any kind of string in
    LoadOptions.
    
    Fixes: bf6501a62e80 ("x86-64: EFI boot code")
    Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
    Reviewed-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    master commit: 375f0dd538072ae33b14c52465f94ecbd83625dc
    master date: 2025-09-01 13:07:01 +0200
---
 xen/common/efi/boot.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c
index 01062bb39f..04d4bbd801 100644
--- a/xen/common/efi/boot.c
+++ b/xen/common/efi/boot.c
@@ -327,10 +327,11 @@ static unsigned int __init get_argv(unsigned int argc, CHAR16 **argv,
 
     if ( argc )
     {
+        argc = 0;
         cmdline = data + *offset;
         /* EFI_LOAD_OPTION does not supply an image name as first component. */
         if ( *offset )
-            *argv++ = NULL;
+            argv[argc++] = NULL;
     }
     else if ( size > sizeof(*cmdline) && !(size % sizeof(*cmdline)) &&
               (wmemchr(data, 0, size / sizeof(*cmdline)) ==
@@ -391,14 +392,14 @@ static unsigned int __init get_argv(unsigned int argc, CHAR16 **argv,
                 ++argc;
             else if ( prev && wstrcmp(prev, L"--") == 0 )
             {
-                --argv;
+                --argc;
                 if ( options )
                     *options = cmdline;
                 break;
             }
             else
             {
-                *argv++ = prev = ptr;
+                argv[argc++] = prev = ptr;
                 *ptr = *cmdline;
                 *++ptr = 0;
             }
@@ -406,7 +407,7 @@ static unsigned int __init get_argv(unsigned int argc, CHAR16 **argv,
         prev_sep = cur_sep;
     }
     if ( argv )
-        *argv = NULL;
+        argv[argc] = NULL;
     return argc;
 }
 
@@ -1302,8 +1303,8 @@ void EFIAPI __init noreturn efi_start(EFI_HANDLE ImageHandle,
                                   (argc + 1) * sizeof(*argv) +
                                       loaded_image->LoadOptionsSize,
                                   (void **)&argv) == EFI_SUCCESS )
-            get_argv(argc, argv, loaded_image->LoadOptions,
-                     loaded_image->LoadOptionsSize, &offset, &options);
+            argc = get_argv(argc, argv, loaded_image->LoadOptions,
+                            loaded_image->LoadOptionsSize, &offset, &options);
         else
             argc = 0;
         for ( i = 1; i < argc; ++i )
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Sep 10 19:34:54 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 10 Sep 2025 19:34:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1118757.1464437 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uwQak-0006RE-AH; Wed, 10 Sep 2025 19:34:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1118757.1464437; Wed, 10 Sep 2025 19: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 1uwQak-0006R6-7b; Wed, 10 Sep 2025 19:34:54 +0000
Received: by outflank-mailman (input) for mailman id 1118757;
 Wed, 10 Sep 2025 19: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 1uwQaj-0006Qx-4D
 for xen-changelog@lists.xenproject.org; Wed, 10 Sep 2025 19: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 1uwQaj-003Pp2-0K
 for xen-changelog@lists.xenproject.org;
 Wed, 10 Sep 2025 19:34:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uwQaj-003LcD-0F
 for xen-changelog@lists.xenproject.org;
 Wed, 10 Sep 2025 19:34: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=K9UoMuxgMMWxRs/bJmbo23jR/lm5F9JDz4N0pUCEgk8=; b=Q300+dyfk9vYvJ4E5+l66WSVDa
	fcn1V5VLlct9BgZUW3zt4Iq6iVd0u6z666YG4fbTeFiYOB4YVx/h52SRPgGRzVU2JXu49YSdFmer/
	8p2+0K2hNBWALLmXDnLP8yV6SoIoWLE19C9dMNaLTJqKh+uDlURHAc2pbergkw4VSd0I=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] x86/gen-cpuid: correct cycle detection
Message-Id: <E1uwQaj-003LcD-0F@xenbits.xenproject.org>
Date: Wed, 10 Sep 2025 19:34:53 +0000

commit f41d24890fafc2cf8567f28066cb112bd5fb08b6
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Sep 3 14:07:50 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 3 14:07:50 2025 +0200

    x86/gen-cpuid: correct cycle detection
    
    With the processing done linearly (rather than recursively), checking
    whether any of the features was previously seen is wrong: That would
    e.g. trigger for this simple set of dependencies
    
        X: [A, B]
        A: [C]
        B: [C]
    
    (observed in reality when making AMX-AVX512 dependent upon both
    AMX-TILE and AVX512F, causing XSAVE to see AMX-AVX512 twice in its list
    of dependents). But checking the whole accumulated set also isn't
    necessary - just checking the feature we're processing dependents of is
    sufficient. We may detect a cycle later that way, but we still will
    detect it. What we need to avoid is adding a feature again when we've
    already seen it.
    
    As a result, seeding "seen[]" with "feat" isn't necessary anymore.
    
    Fixes: fe4408d180f4 ("xen/x86: Generate deep dependencies of features")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 3999ff0d307a9a901ad1b5ad56e0dde657fec558
    master date: 2025-09-01 13:07:53 +0200
---
 xen/tools/gen-cpuid.py | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/xen/tools/gen-cpuid.py b/xen/tools/gen-cpuid.py
index dc33ca3181..045965facb 100755
--- a/xen/tools/gen-cpuid.py
+++ b/xen/tools/gen-cpuid.py
@@ -345,7 +345,7 @@ def crunch_numbers(state):
 
     for feat in deep_features:
 
-        seen = [feat]
+        seen = []
         to_process = list(deps[feat])
 
         while len(to_process):
@@ -358,14 +358,17 @@ def crunch_numbers(state):
 
             f = to_process.pop(0)
 
+            if f == feat:
+                raise Fail("ERROR: Cycle found when processing %s" %
+                           (state.names[f], ))
+
             if f in seen:
-                raise Fail("ERROR: Cycle found with %s when processing %s"
-                           % (state.names[f], state.names[feat]))
+                continue
 
             seen.append(f)
             to_process = list(set(to_process + deps.get(f, [])))
 
-        state.deep_deps[feat] = seen[1:]
+        state.deep_deps[feat] = seen
 
     state.deep_features = deps.keys()
     state.nr_deep_deps = len(state.deep_deps.keys())
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Sep 10 19:35:04 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 10 Sep 2025 19:35:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1118758.1464440 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uwQau-0006TJ-Bb; Wed, 10 Sep 2025 19:35:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1118758.1464440; Wed, 10 Sep 2025 19: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 1uwQau-0006TB-90; Wed, 10 Sep 2025 19:35:04 +0000
Received: by outflank-mailman (input) for mailman id 1118758;
 Wed, 10 Sep 2025 19:35: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 1uwQat-0006T3-6z
 for xen-changelog@lists.xenproject.org; Wed, 10 Sep 2025 19:35: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 1uwQat-003PpO-0b
 for xen-changelog@lists.xenproject.org;
 Wed, 10 Sep 2025 19:35:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uwQat-003Ld4-0W
 for xen-changelog@lists.xenproject.org;
 Wed, 10 Sep 2025 19:35: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=V5VTplvo/kzdn8vFSYVJefRFwg7iz/oWD5YrvZqTVbQ=; b=AN4IOEKWCPOkjkoruT3vmyi/Mo
	ygMTWyl5vMKXOmKei6kGSaBQoaVegtfn28s0DZAdsB2ETgyXhdepVuz/vEz29PJGGJDCHCeNQMhZO
	Nlo9JnVmUv3an6zJ2IPtia9mfoPK81rTaQLUvzXu3ZbnyKGxZdZqr0RGB1ZSB59OZvUY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] x86/gen-cpuid: Fix debugging for cycle detection
Message-Id: <E1uwQat-003Ld4-0W@xenbits.xenproject.org>
Date: Wed, 10 Sep 2025 19:35:03 +0000

commit dabd719321b652286b9d0b0c23e29c8427eb7da5
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Sep 3 14:08:00 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 3 14:08:00 2025 +0200

    x86/gen-cpuid: Fix debugging for cycle detection
    
    Jan reports the following exception when using the cycle debugging:
    
      Feature IBRSB, seen [IBRSB, STIBP, INTEL_PSFD, EIBRS, IPRED_CTRL, RRSBA_CTRL, RRSBA, BHI_CTRL], to_process [SSBD]
      Traceback (most recent call last):
        File "/local/xen.git/xen/../xen/tools/gen-cpuid.py", line 594, in <module>
          sys.exit(main())
                   ^^^^^^
        File "/local/xen.git/xen/../xen/tools/gen-cpuid.py", line 588, in main
          crunch_numbers(state)
        File "/local/xen.git/xen/../xen/tools/gen-cpuid.py", line 366, in crunch_numbers
          (state.names[feat], repl(seen), repl(to_process)))
                                          ^^^^^^^^^^^^^^^^
        File "/local/xen.git/xen/../xen/tools/gen-cpuid.py", line 364, in repl
          return "[" + ", ".join((state.names[x] for x in l)) + "]"
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/local/xen.git/xen/../xen/tools/gen-cpuid.py", line 364, in <genexpr>
          return "[" + ", ".join((state.names[x] for x in l)) + "]"
                                  ~~~~~~~~~~~^^^
      KeyError: 534
      make[2]: *** [/local/xen.git/xen/include/xen/lib/x86/Makefile:9: cpuid-autogen.h] Error 1
    
    This is caused by commit ce8c930851a5 ("x86/cpu-policy: MSR_ARCH_CAPS feature
    names") being rather lazy and marking dependenices on unknown features.
    
    Introduce a helper to pick the known features in a range, and use it for
    ARCH_CAPS.
    
    Additionally, remove trailing whitespace and an unnecessary line continuation
    from the debug print.
    
    Reported-by: Jan Beulich <jbeulich@suse.com>
    Fixes: ce8c930851a5 ("x86/cpu-policy: MSR_ARCH_CAPS feature names")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    master commit: 5edb4ccff6a13ea10d1c1888942dff0c868c7844
    master date: 2025-09-01 19:54:21 +0100
---
 xen/tools/gen-cpuid.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/xen/tools/gen-cpuid.py b/xen/tools/gen-cpuid.py
index 045965facb..e31012fbd4 100755
--- a/xen/tools/gen-cpuid.py
+++ b/xen/tools/gen-cpuid.py
@@ -168,6 +168,10 @@ def crunch_numbers(state):
     state.hvm_shadow_max = state.pv_max         | state.raw['S'] | state.raw['s']
     state.hvm_hap_max =    state.hvm_shadow_max | state.raw['H'] | state.raw['h']
 
+    def feat_range(start, last):
+        """ Select all known features in the given range """
+        return [ x for x in state.names.keys() if start <= x <= last ]
+
     #
     # Feature dependency information.
     #
@@ -334,7 +338,7 @@ def crunch_numbers(state):
         PSFD: [EPSF],
 
         # The ARCH_CAPS CPUID bit enumerates the availability of the whole register.
-        ARCH_CAPS: list(range(RDCL_NO, RDCL_NO + 64)),
+        ARCH_CAPS: feat_range(RDCL_NO, RDCL_NO + 63),
 
         # The behaviour described by RRSBA depend on eIBRS being active.
         EIBRS: [RRSBA],
@@ -353,7 +357,7 @@ def crunch_numbers(state):
             # To debug, uncomment the following lines:
             # def repl(l):
             #     return "[" + ", ".join((state.names[x] for x in l)) + "]"
-            # sys.stderr.write("Feature %s, seen %s, to_process %s \n" % \
+            # sys.stderr.write("Feature %s, seen %s, to_process %s\n" %
             #     (state.names[feat], repl(seen), repl(to_process)))
 
             f = to_process.pop(0)
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Sep 10 19:35:14 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 10 Sep 2025 19:35:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1118759.1464445 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uwQb4-0006WA-En; Wed, 10 Sep 2025 19:35:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1118759.1464445; Wed, 10 Sep 2025 19: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 1uwQb4-0006W2-CD; Wed, 10 Sep 2025 19:35:14 +0000
Received: by outflank-mailman (input) for mailman id 1118759;
 Wed, 10 Sep 2025 19:35: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 1uwQb3-0006Vq-9T
 for xen-changelog@lists.xenproject.org; Wed, 10 Sep 2025 19:35: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 1uwQb3-003Ppm-0r
 for xen-changelog@lists.xenproject.org;
 Wed, 10 Sep 2025 19:35:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uwQb3-003Ldc-0l
 for xen-changelog@lists.xenproject.org;
 Wed, 10 Sep 2025 19:35: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=QBE/WyRFM1nh2df4hvTgxa81hoXRVSOkO7E6Mke+Frs=; b=AOTnvC1gtO104q8FmcEZSmVBke
	VA+tZWe8Pry6ZMVP14+CpGzhFPTalA9jSxaa4yzBzusog2a+epkB8UJXvz0jmi1fkpbW0WCCGlVzB
	KVsgFLyY9/Wfn6Wybn4fkmAwxCYkSTXf+/Zb8mYwFk0JNkApV2xmy2F4idUlN817g7sY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] x86/viridian: avoid NULL pointer dereference in update_reference_tsc()
Message-Id: <E1uwQb3-003Ldc-0l@xenbits.xenproject.org>
Date: Wed, 10 Sep 2025 19:35:13 +0000

commit 8924243e5ffa9836f7484aecf5875a72389a8ab2
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Tue Sep 9 14:22:36 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 9 14:22:36 2025 +0200

    x86/viridian: avoid NULL pointer dereference in update_reference_tsc()
    
    The function is only called when the MSR has the enabled bit set, but even
    then the page might not be mapped because the guest provided gfn is not
    suitable.
    
    Prevent a NULL pointer dereference in update_reference_tsc() by checking
    whether the page is mapped.
    
    This is CVE-2025-27466 / part of XSA-472.
    
    Fixes: 386b3365221d ('viridian: use viridian_map/unmap_guest_page() for reference tsc page')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 5776a2e9db0155cfd76388c8197ca7788bb4b361
    master date: 2025-09-09 14:11:09 +0200
---
 xen/arch/x86/hvm/viridian/time.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/xen/arch/x86/hvm/viridian/time.c b/xen/arch/x86/hvm/viridian/time.c
index 137577384f..ca6d526f46 100644
--- a/xen/arch/x86/hvm/viridian/time.c
+++ b/xen/arch/x86/hvm/viridian/time.c
@@ -26,6 +26,10 @@ static void update_reference_tsc(const struct domain *d, bool initialize)
     HV_REFERENCE_TSC_PAGE *p = rt->ptr;
     uint32_t seq;
 
+    /* Reference TSC page might not be mapped even if the MSR is enabled. */
+    if ( !p )
+        return;
+
     if ( initialize )
         clear_page(p);
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Sep 10 19:35:24 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 10 Sep 2025 19:35:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1118760.1464450 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uwQbE-0006YL-Gp; Wed, 10 Sep 2025 19:35:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1118760.1464450; Wed, 10 Sep 2025 19:35: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 1uwQbE-0006YC-DY; Wed, 10 Sep 2025 19:35:24 +0000
Received: by outflank-mailman (input) for mailman id 1118760;
 Wed, 10 Sep 2025 19: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 1uwQbD-0006Xz-C1
 for xen-changelog@lists.xenproject.org; Wed, 10 Sep 2025 19: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 1uwQbD-003Ppq-17
 for xen-changelog@lists.xenproject.org;
 Wed, 10 Sep 2025 19:35:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uwQbD-003Le3-12
 for xen-changelog@lists.xenproject.org;
 Wed, 10 Sep 2025 19:35: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=vxeN0BgDaq+6kNCj8yPpW3xkSUk3vcjJEg4/wTk6tx4=; b=VCYvRzQYEJrM5IIWtb29saub5R
	83OUP7rovWmCvPEazR0jZKh4ZpYIlmDEPTDTD2yiv9mOfsVoce042Gdf+HuTR+P2a0gTmUp00lQlb
	HEpTNGLTganPfTT4x1lKvUMWdvNy2tnT9I43OVbELuHpy1zzloVgXt3p6YLYpi8I1uFw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] x86/viridian: avoid NULL pointer dereference in viridian_synic_deliver_timer_msg()
Message-Id: <E1uwQbD-003Le3-12@xenbits.xenproject.org>
Date: Wed, 10 Sep 2025 19:35:23 +0000

commit 7fa5a9d64ff9e65f4b3253fbe4b4b1366071de80
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Tue Sep 9 14:22:58 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 9 14:22:58 2025 +0200

    x86/viridian: avoid NULL pointer dereference in viridian_synic_deliver_timer_msg()
    
    The function is called unconditionally, regardless of whether the SIM page
    is mapped.  Avoid a NULL pointer dereference in
    viridian_synic_deliver_timer_msg() by checking whether the SIM page is
    mapped.
    
    This is CVE-2025-58142 / part of XSA-472.
    
    Fixes: 26fba3c85571 ('viridian: add implementation of synthetic timers')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 3a7b4f2897a352cff287be97d27150b290a5d1ee
    master date: 2025-09-09 14:11:34 +0200
---
 xen/arch/x86/hvm/viridian/synic.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/xen/arch/x86/hvm/viridian/synic.c b/xen/arch/x86/hvm/viridian/synic.c
index c3dc573b00..e6cba7548f 100644
--- a/xen/arch/x86/hvm/viridian/synic.c
+++ b/xen/arch/x86/hvm/viridian/synic.c
@@ -338,6 +338,10 @@ bool viridian_synic_deliver_timer_msg(struct vcpu *v, unsigned int sintx,
         .DeliveryTime = delivery,
     };
 
+    /* Don't assume SIM page to be mapped. */
+    if ( !msg )
+        return false;
+
     /*
      * To avoid using an atomic test-and-set, and barrier before calling
      * vlapic_set_irq(), this function must be called in context of the
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Sep 10 19:35:34 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 10 Sep 2025 19:35:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1118761.1464454 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uwQbO-0006aX-I5; Wed, 10 Sep 2025 19:35:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1118761.1464454; Wed, 10 Sep 2025 19: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 1uwQbO-0006aP-Ev; Wed, 10 Sep 2025 19:35:34 +0000
Received: by outflank-mailman (input) for mailman id 1118761;
 Wed, 10 Sep 2025 19: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 1uwQbN-0006aD-Ej
 for xen-changelog@lists.xenproject.org; Wed, 10 Sep 2025 19: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 1uwQbN-003Ppx-1O
 for xen-changelog@lists.xenproject.org;
 Wed, 10 Sep 2025 19:35:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uwQbN-003LeQ-1I
 for xen-changelog@lists.xenproject.org;
 Wed, 10 Sep 2025 19: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=c/L3PxaWXC3LgBcWlElA7r4+7H2xehN60lkMlgnH5+8=; b=iM9xVGwxKfVRle21l0VfMkUgQD
	GURaWHAXA1XOb916Kwewx+Fuf2tk7zK50C6ybjnNnmS5lmWvU9Dxqp3GXP5ZXKRLKJhEBZrowx1sb
	lEqPeCca9UWudyzqQUwP0wG/JPyKWIlUf/SKJOO+dNR9FwBHCQ1iNeiOzt0mCcklPzAs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] x86/viridian: protect concurrent modification of the reference TSC page
Message-Id: <E1uwQbN-003LeQ-1I@xenbits.xenproject.org>
Date: Wed, 10 Sep 2025 19:35:33 +0000

commit c7f0d12c8a0b3b54263b5f79ffc9c02f094c0e2d
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Tue Sep 9 14:23:10 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 9 14:23:10 2025 +0200

    x86/viridian: protect concurrent modification of the reference TSC page
    
    The reference TSC page is shared between all vCPUs, and the data stored in
    the domain struct.  However the handlers to set and clear it are not safe
    against concurrent accesses.  It's possible for two (or more) vCPUs to call
    HV_X64_MSR_REFERENCE_TSC at the same time and cause the in-use reference
    TSC page to be freed, while still being on the p2m.  This creates a use-
    after-free bug, where the page can end up mapped in another domain or used
    by Xen while still being part of the original domain's p2m.
    
    It's also possible to underflow the reference counter, as multiple
    concurrent writes to HV_X64_MSR_REFERENCE_TSC can create an imbalance on
    the number of put_page_and_type() calls.
    
    Introduce a lock to protect the reference TSC domain field, thus
    serializing concurrent vCPU accesses.
    
    This is CVE-2025-58143 / part of XSA-472.
    
    Fixes: 386b3365221d ('viridian: use viridian_map/unmap_guest_page() for reference tsc page')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 45729a510a352e1a973e4023bd0067cddb1bcaf8
    master date: 2025-09-09 14:12:00 +0200
---
 xen/arch/x86/hvm/viridian/time.c        | 4 ++++
 xen/arch/x86/hvm/viridian/viridian.c    | 2 ++
 xen/arch/x86/include/asm/hvm/viridian.h | 1 +
 3 files changed, 7 insertions(+)

diff --git a/xen/arch/x86/hvm/viridian/time.c b/xen/arch/x86/hvm/viridian/time.c
index ca6d526f46..9311858d63 100644
--- a/xen/arch/x86/hvm/viridian/time.c
+++ b/xen/arch/x86/hvm/viridian/time.c
@@ -108,8 +108,10 @@ static void time_ref_count_thaw(const struct domain *d)
 
     trc->off = (int64_t)trc->val - trc_val(d, 0);
 
+    spin_lock(&vd->lock);
     if ( vd->reference_tsc.msr.enabled )
         update_reference_tsc(d, false);
+    spin_unlock(&vd->lock);
 }
 
 static uint64_t time_ref_count(const struct domain *d)
@@ -331,6 +333,7 @@ int viridian_time_wrmsr(struct vcpu *v, uint32_t idx, uint64_t val)
         if ( !(viridian_feature_mask(d) & HVMPV_reference_tsc) )
             return X86EMUL_EXCEPTION;
 
+        spin_lock(&vd->lock);
         viridian_unmap_guest_page(&vd->reference_tsc);
         vd->reference_tsc.msr.raw = val;
         viridian_dump_guest_page(v, "REFERENCE_TSC", &vd->reference_tsc);
@@ -339,6 +342,7 @@ int viridian_time_wrmsr(struct vcpu *v, uint32_t idx, uint64_t val)
             viridian_map_guest_page(d, &vd->reference_tsc);
             update_reference_tsc(d, true);
         }
+        spin_unlock(&vd->lock);
         break;
 
     case HV_X64_MSR_TIME_REF_COUNT:
diff --git a/xen/arch/x86/hvm/viridian/viridian.c b/xen/arch/x86/hvm/viridian/viridian.c
index 21480d9ee7..a41a70e37a 100644
--- a/xen/arch/x86/hvm/viridian/viridian.c
+++ b/xen/arch/x86/hvm/viridian/viridian.c
@@ -494,6 +494,8 @@ int viridian_domain_init(struct domain *d)
     if ( !d->arch.hvm.viridian )
         return -ENOMEM;
 
+    spin_lock_init(&d->arch.hvm.viridian->lock);
+
     rc = viridian_synic_domain_init(d);
     if ( rc )
         goto fail;
diff --git a/xen/arch/x86/include/asm/hvm/viridian.h b/xen/arch/x86/include/asm/hvm/viridian.h
index 4c8ff6e80b..47c9d13841 100644
--- a/xen/arch/x86/include/asm/hvm/viridian.h
+++ b/xen/arch/x86/include/asm/hvm/viridian.h
@@ -71,6 +71,7 @@ struct viridian_domain
     DECLARE_BITMAP(hypercall_flags, _HCALL_nr);
     struct viridian_time_ref_count time_ref_count;
     struct viridian_page reference_tsc;
+    spinlock_t lock;
 };
 
 void cpuid_viridian_leaves(const struct vcpu *v, uint32_t leaf,
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Sep 10 19:35:44 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 10 Sep 2025 19:35:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1118762.1464457 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uwQbY-0006cl-JL; Wed, 10 Sep 2025 19:35:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1118762.1464457; Wed, 10 Sep 2025 19:35: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 1uwQbY-0006cd-GS; Wed, 10 Sep 2025 19:35:44 +0000
Received: by outflank-mailman (input) for mailman id 1118762;
 Wed, 10 Sep 2025 19:35: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 1uwQbX-0006cV-I7
 for xen-changelog@lists.xenproject.org; Wed, 10 Sep 2025 19:35: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 1uwQbX-003Pq1-1j
 for xen-changelog@lists.xenproject.org;
 Wed, 10 Sep 2025 19:35:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uwQbX-003Leu-1Z
 for xen-changelog@lists.xenproject.org;
 Wed, 10 Sep 2025 19:35: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=BT7qXvIhDcPEQb7McFsm7l1mfL+ze0AAtNsuHljGyqk=; b=h+m+w9OI3ASvMJCRUuY+ebz3HX
	bixhrVWzX7pZMFdUdS4Ve7vjW8tug/VRUK1+v9Bshq29yTAWum/nvBDDr8DdPwudfvFQzfeT0FPkt
	vQu6OQoVwaOWGF/sJURcyb59SQpTmxgi0M0kQtrpjhblMJcw4CHih0EiddmcdYlmAWmI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] Arm: foreign page handling in p2m_get_page_from_gfn()
Message-Id: <E1uwQbX-003Leu-1Z@xenbits.xenproject.org>
Date: Wed, 10 Sep 2025 19:35:43 +0000

commit 8634f3ef0625cb7eee43dc972c75b427fd08c548
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Sep 9 14:23:23 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 9 14:23:23 2025 +0200

    Arm: foreign page handling in p2m_get_page_from_gfn()
    
    I can't see what would make the 1st of the assertions safe: For example,
    the P2M lock not being held, the foreign page may disappear before we
    get to call page_get_owner_and_reference(), which hence may return NULL.
    
    Even the 2nd, which appears to be safe safe, is lacking proper release
    build fallbacks.
    
    Drop the former in favor of an if(), and convert the latter to the
    equivalent of what x86 uses: ASSERT_UNREACHABLE() plus putting of the
    obtained page.
    
    This is CVE-2025-58144 / part of XSA-473.
    
    Fixes: 9486a8d07ba8 ("xen/arm: Handle remove foreign mapping")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
    master commit: c5a6dd68508c998c95ca87f59e9ecb6da93ca6ab
    master date: 2025-09-09 14:12:13 +0200
---
 xen/arch/arm/p2m.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
index 2465c266e9..824d4a4115 100644
--- a/xen/arch/arm/p2m.c
+++ b/xen/arch/arm/p2m.c
@@ -74,10 +74,16 @@ struct page_info *p2m_get_page_from_gfn(struct domain *d, gfn_t gfn,
      */
     if ( p2m_is_foreign(p2mt) )
     {
-        struct domain *fdom = page_get_owner_and_reference(page);
-        ASSERT(fdom != NULL);
-        ASSERT(fdom != d);
-        return page;
+        const struct domain *fdom = page_get_owner_and_reference(page);
+
+        if ( fdom )
+        {
+            if ( fdom != d )
+                return page;
+            ASSERT_UNREACHABLE();
+            put_page(page);
+        }
+        return NULL;
     }
 
     return get_page(page, d) ? page : NULL;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Sep 10 19:35:55 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 10 Sep 2025 19:35:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1118763.1464460 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uwQbj-0006er-KI; Wed, 10 Sep 2025 19:35:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1118763.1464460; Wed, 10 Sep 2025 19:35: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 1uwQbj-0006ej-Hq; Wed, 10 Sep 2025 19:35:55 +0000
Received: by outflank-mailman (input) for mailman id 1118763;
 Wed, 10 Sep 2025 19:35: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 1uwQbh-0006eb-Ki
 for xen-changelog@lists.xenproject.org; Wed, 10 Sep 2025 19:35: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 1uwQbh-003Pq5-1z
 for xen-changelog@lists.xenproject.org;
 Wed, 10 Sep 2025 19:35:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uwQbh-003LfG-1t
 for xen-changelog@lists.xenproject.org;
 Wed, 10 Sep 2025 19:35: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=+vHxltykgb/YS/kehz+838UofDKlgww7FQ9gbbo5OdQ=; b=kvxIIcF4cj+hNBkwdOQ4ZvIibS
	tMPJgslWStHpUlCcNdvwyHXTJXgg34jh7M7grAE7O+cBUTR4mcZ7oeA/d7nkdUBGXWSlfdhwWxfTA
	52nIOKfB+h4AG3BEp47gOv4/9s1kkjr0O9z8/viSiFods/ztMMFo/S8t9RC2ydc2DY+4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] Arm: adjust locking in p2m_get_page_from_gfn()
Message-Id: <E1uwQbh-003LfG-1t@xenbits.xenproject.org>
Date: Wed, 10 Sep 2025 19:35:53 +0000

commit e9e054a161fb448172f29e2d08ad9a94cb13e787
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Sep 9 14:23:32 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 9 14:23:32 2025 +0200

    Arm: adjust locking in p2m_get_page_from_gfn()
    
    In order to safely acquire a reference for a foreign page mapping, the
    P2M lock needs to be held until we have the reference in hand (or
    getting one failed). Otherwise the page can change P2M type and
    ownership in between.
    
    This is CVE-2025-58145 / part of XSA-473.
    
    Fixes: 9486a8d07ba8 ("xen/arm: Handle remove foreign mapping")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
    master commit: 2275bf83a1db579661b27fc4b310a7d92594dbc0
    master date: 2025-09-09 14:12:57 +0200
---
 xen/arch/arm/p2m.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
index 824d4a4115..2efec8f493 100644
--- a/xen/arch/arm/p2m.c
+++ b/xen/arch/arm/p2m.c
@@ -53,18 +53,22 @@ mfn_t p2m_lookup(struct domain *d, gfn_t gfn, p2m_type_t *t)
 struct page_info *p2m_get_page_from_gfn(struct domain *d, gfn_t gfn,
                                         p2m_type_t *t)
 {
+    struct p2m_domain *p2m = p2m_get_hostp2m(d);
     struct page_info *page;
     p2m_type_t p2mt;
-    mfn_t mfn = p2m_lookup(d, gfn, &p2mt);
+    mfn_t mfn;
+
+    p2m_read_lock(p2m);
+    mfn = p2m_get_entry(p2m, gfn, &p2mt, NULL, NULL, NULL);
 
     if ( t )
         *t = p2mt;
 
-    if ( !p2m_is_any_ram(p2mt) )
-        return NULL;
-
-    if ( !mfn_valid(mfn) )
+    if ( !p2m_is_any_ram(p2mt) || !mfn_valid(mfn) )
+    {
+        p2m_read_unlock(p2m);
         return NULL;
+    }
 
     page = mfn_to_page(mfn);
 
@@ -76,6 +80,8 @@ struct page_info *p2m_get_page_from_gfn(struct domain *d, gfn_t gfn,
     {
         const struct domain *fdom = page_get_owner_and_reference(page);
 
+        p2m_read_unlock(p2m);
+
         if ( fdom )
         {
             if ( fdom != d )
@@ -86,6 +92,8 @@ struct page_info *p2m_get_page_from_gfn(struct domain *d, gfn_t gfn,
         return NULL;
     }
 
+    p2m_read_unlock(p2m);
+
     return get_page(page, d) ? page : NULL;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Sep 10 19:36:05 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 10 Sep 2025 19:36:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1118764.1464465 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uwQbt-0006hS-M3; Wed, 10 Sep 2025 19:36:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1118764.1464465; Wed, 10 Sep 2025 19:36: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 1uwQbt-0006hK-J9; Wed, 10 Sep 2025 19:36:05 +0000
Received: by outflank-mailman (input) for mailman id 1118764;
 Wed, 10 Sep 2025 19:36: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 1uwQbr-0006h8-NK
 for xen-changelog@lists.xenproject.org; Wed, 10 Sep 2025 19:36: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 1uwQbr-003PqK-2F
 for xen-changelog@lists.xenproject.org;
 Wed, 10 Sep 2025 19:36:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uwQbr-003LgL-2A
 for xen-changelog@lists.xenproject.org;
 Wed, 10 Sep 2025 19:36: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=lkPhE3A+gG7Lg1Er4+Vd+fHFngp69KBrF9eb7RZ9lms=; b=EKeiS3ijvQwD0GPTyJs4RbYG34
	JqcSScqzhfSHagGNu1haR6xUbwlUXhYNNngO6ZrSSZKp1zMRBC/ULJqWjOORmr9bqVgnd9E1ejp3D
	TJMuUGrMBHJI4qvmr9BEpugcDcbFPhxZRs5A/kzUIYtq42TIQ3xYOInlAOPvy1PPJaNs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] CI: save toolstack artifact as cpio.gz
Message-Id: <E1uwQbr-003LgL-2A@xenbits.xenproject.org>
Date: Wed, 10 Sep 2025 19:36:03 +0000

commit 0fe3453bcaafdd68833697831bc7462221c96d26
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Fri Apr 11 22:32:19 2025 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Sep 10 14:45:07 2025 +0100

    CI: save toolstack artifact as cpio.gz
    
    This avoids the need to re-compress it in every test job.  This saves minutes
    of wallclock time.
    
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
    (cherry picked from commit 4611ae6fb8f90d25601fcc0688799ef63a374304)
---
 automation/scripts/build                          | 2 +-
 automation/scripts/qemu-alpine-x86_64.sh          | 2 +-
 automation/scripts/qemu-smoke-dom0-arm64.sh       | 2 +-
 automation/scripts/qemu-smoke-dom0less-arm64.sh   | 2 +-
 automation/scripts/qubes-x86-64.sh                | 4 +++-
 automation/scripts/xilinx-smoke-dom0-x86_64.sh    | 4 ++--
 automation/scripts/xilinx-smoke-dom0less-arm64.sh | 3 +--
 7 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/automation/scripts/build b/automation/scripts/build
index 522efe774e..51effec81d 100755
--- a/automation/scripts/build
+++ b/automation/scripts/build
@@ -108,7 +108,7 @@ else
     # Note: Some smoke tests depending on finding binaries/xen on a full build
     # even though dist/ contains everything, while some containers don't even
     # build Xen
-    cp -r dist binaries/
+    (cd dist/install; find | cpio -o -H newc | gzip) > binaries/xen-tools.cpio.gz
     cp -r tools/tests binaries/
     collect_xen_artefacts
 fi
diff --git a/automation/scripts/qemu-alpine-x86_64.sh b/automation/scripts/qemu-alpine-x86_64.sh
index c7dd121978..fe86caa393 100755
--- a/automation/scripts/qemu-alpine-x86_64.sh
+++ b/automation/scripts/qemu-alpine-x86_64.sh
@@ -30,11 +30,11 @@ cd ..
 
 # Dom0 rootfs
 cp rootfs.cpio.gz dom0-rootfs.cpio.gz
+cat xen-tools.cpio.gz >> dom0-rootfs.cpio.gz
 
 # test-local configuration
 mkdir -p rootfs
 cd rootfs
-cp -ar ../dist/install/* .
 mkdir -p root etc/local.d
 mv ../domU-rootfs.cpio.gz ./root
 cp ../bzImage ./root
diff --git a/automation/scripts/qemu-smoke-dom0-arm64.sh b/automation/scripts/qemu-smoke-dom0-arm64.sh
index c0cf61ff8f..61dd24b9ab 100755
--- a/automation/scripts/qemu-smoke-dom0-arm64.sh
+++ b/automation/scripts/qemu-smoke-dom0-arm64.sh
@@ -29,11 +29,11 @@ cd ..
 
 # Dom0 rootfs
 cp rootfs.cpio.gz dom0-rootfs.cpio.gz
+cat xen-tools.cpio.gz >> dom0-rootfs.cpio.gz
 
 # test-local configuration
 mkdir -p rootfs
 cd rootfs
-cp -ar ../dist/install/* .
 mkdir -p etc/local.d root
 mv ../domU-rootfs.cpio.gz ./root
 cp ../Image ./root
diff --git a/automation/scripts/qemu-smoke-dom0less-arm64.sh b/automation/scripts/qemu-smoke-dom0less-arm64.sh
index 48c424922d..2c9a927c5c 100755
--- a/automation/scripts/qemu-smoke-dom0less-arm64.sh
+++ b/automation/scripts/qemu-smoke-dom0less-arm64.sh
@@ -113,11 +113,11 @@ cd ..
 
 # Dom0 rootfs
 cp binaries/rootfs.cpio.gz binaries/dom0-rootfs.cpio.gz
+cat binaries/xen-tools.cpio.gz >> binaries/dom0-rootfs.cpio.gz
 
 # test-local configuration
 mkdir -p rootfs
 cd rootfs
-cp -ar ../binaries/dist/install/* .
 mkdir -p etc/local.d
 
 echo "#!/bin/bash
diff --git a/automation/scripts/qubes-x86-64.sh b/automation/scripts/qubes-x86-64.sh
index e2376cb51c..3947027d6e 100755
--- a/automation/scripts/qubes-x86-64.sh
+++ b/automation/scripts/qubes-x86-64.sh
@@ -189,12 +189,12 @@ fi
 
 # Dom0 rootfs
 cp binaries/rootfs.cpio.gz binaries/dom0-rootfs.cpio.gz
+cat binaries/xen-tools.cpio.gz >> binaries/dom0-rootfs.cpio.gz
 
 # test-local configuration
 mkdir -p rootfs
 cd rootfs
 mkdir -p boot etc/local.d
-cp -ar ../binaries/dist/install/* .
 cp -ar ../binaries/tests .
 cp -a ../automation/scripts/run-tools-tests tests/
 
@@ -228,8 +228,10 @@ else
 fi
 
 chmod +x etc/local.d/xen.start
+mkdir -p etc/xen
 echo "$domU_config" > etc/xen/domU.cfg
 
+mkdir -p etc/default
 echo "XENCONSOLED_TRACE=all" >> etc/default/xencommons
 echo "QEMU_XEN=/bin/false" >> etc/default/xencommons
 mkdir -p var/log/xen/console
diff --git a/automation/scripts/xilinx-smoke-dom0-x86_64.sh b/automation/scripts/xilinx-smoke-dom0-x86_64.sh
index d823b57012..a63a525ff8 100755
--- a/automation/scripts/xilinx-smoke-dom0-x86_64.sh
+++ b/automation/scripts/xilinx-smoke-dom0-x86_64.sh
@@ -72,12 +72,12 @@ rm -rf rootfs
 
 # Dom0 rootfs
 cp binaries/rootfs.cpio.gz binaries/dom0-rootfs.cpio.gz
+cat binaries/xen-tools.cpio.gz >> binaries/dom0-rootfs.cpio.gz
 
 # test-local configuration
 mkdir -p rootfs
 cd rootfs
-mkdir -p boot etc/local.d
-cp -ar ../binaries/dist/install/* .
+mkdir -p boot etc/local.d etc/xen etc/default
 echo "#!/bin/bash
 
 export LD_LIBRARY_PATH=/usr/local/lib
diff --git a/automation/scripts/xilinx-smoke-dom0less-arm64.sh b/automation/scripts/xilinx-smoke-dom0less-arm64.sh
index a3031ecab0..59f3fe7edb 100755
--- a/automation/scripts/xilinx-smoke-dom0less-arm64.sh
+++ b/automation/scripts/xilinx-smoke-dom0less-arm64.sh
@@ -56,12 +56,11 @@ rm -rf rootfs
 
 # Dom0 rootfs
 cp binaries/rootfs.cpio.gz binaries/dom0-rootfs.cpio.gz
+cat binaries/xen-tools.cpio.gz >> binaries/dom0-rootfs.cpio.gz
 
 # test-local configuration
 mkdir -p rootfs
 cd rootfs
-cp -ar ../binaries/dist/install/* .
-
 mkdir -p etc/local.d
 echo "#!/bin/bash
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Sep 10 19:36:15 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 10 Sep 2025 19:36:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1118765.1464470 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uwQc3-0006mh-OX; Wed, 10 Sep 2025 19:36:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1118765.1464470; Wed, 10 Sep 2025 19:36: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 1uwQc3-0006mZ-Kc; Wed, 10 Sep 2025 19:36:15 +0000
Received: by outflank-mailman (input) for mailman id 1118765;
 Wed, 10 Sep 2025 19:36: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 1uwQc1-0006mP-Pm
 for xen-changelog@lists.xenproject.org; Wed, 10 Sep 2025 19:36: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 1uwQc1-003Pqk-2U
 for xen-changelog@lists.xenproject.org;
 Wed, 10 Sep 2025 19:36:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uwQc1-003Lgp-2Q
 for xen-changelog@lists.xenproject.org;
 Wed, 10 Sep 2025 19:36: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=rhLlXn3CGiqIl4GcV9c9j1RzJrwtN/hcgDpJ+hdaICI=; b=yzH2gFz4nHByHPMIoWc5wJkDoV
	26HVqlYrvCzvruA5RYmyM7gI7EwRQL5pfyS1NNutRKIrWgipZqhYiCu5xUzX0oW+hcalGRiQkqPXC
	MO/7Cg6FFFowdLwDp9N+mOZ8w2AlWeuCMmrt6rv+BWulI1numZnwipGxCifPggNWw6x0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] CI: Build with --prefix=/usr rather than setting LD_LIBRARY_PATH
Message-Id: <E1uwQc1-003Lgp-2Q@xenbits.xenproject.org>
Date: Wed, 10 Sep 2025 19:36:13 +0000

commit 2c5076780ce0306cfeafc5082faec63e53d81cf5
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Apr 15 13:49:01 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Sep 10 14:45:07 2025 +0100

    CI: Build with --prefix=/usr rather than setting LD_LIBRARY_PATH
    
    This also moves executables too.
    
    I'm not sure why xilinx-smoke-dom0-x86_64.sh was overriding PATH too, as
    /usr/local is clearly in PATH given the other tests, but drop that too.
    
    No practical change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
    (cherry picked from commit 7f8c2dd829358406dc9e50d5e386e4d2b20b4303)
---
 automation/scripts/build                          | 2 +-
 automation/scripts/qemu-alpine-x86_64.sh          | 1 -
 automation/scripts/qemu-smoke-dom0-arm64.sh       | 1 -
 automation/scripts/qemu-smoke-dom0less-arm64.sh   | 3 +--
 automation/scripts/qubes-x86-64.sh                | 1 -
 automation/scripts/xilinx-smoke-dom0-x86_64.sh    | 1 -
 automation/scripts/xilinx-smoke-dom0less-arm64.sh | 3 +--
 7 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/automation/scripts/build b/automation/scripts/build
index 51effec81d..a348c781d1 100755
--- a/automation/scripts/build
+++ b/automation/scripts/build
@@ -67,7 +67,7 @@ elif [[ "${HYPERVISOR_ONLY}" == "y" ]]; then
     collect_xen_artefacts
 else
     # Full build.  Figure out our ./configure options
-    cfgargs=()
+    cfgargs=("--prefix=/usr")
     cfgargs+=("--enable-docs")
 
     # booleans for which compiler is in use
diff --git a/automation/scripts/qemu-alpine-x86_64.sh b/automation/scripts/qemu-alpine-x86_64.sh
index fe86caa393..746e70483d 100755
--- a/automation/scripts/qemu-alpine-x86_64.sh
+++ b/automation/scripts/qemu-alpine-x86_64.sh
@@ -49,7 +49,6 @@ echo "#!/bin/bash
 
 set -x
 
-export LD_LIBRARY_PATH=/usr/local/lib
 bash /etc/init.d/xencommons start
 
 xl list
diff --git a/automation/scripts/qemu-smoke-dom0-arm64.sh b/automation/scripts/qemu-smoke-dom0-arm64.sh
index 61dd24b9ab..d6f6b74880 100755
--- a/automation/scripts/qemu-smoke-dom0-arm64.sh
+++ b/automation/scripts/qemu-smoke-dom0-arm64.sh
@@ -46,7 +46,6 @@ extra=\"console=hvc0 root=/dev/ram0 rdinit=/bin/sh\"
 " > root/domU.cfg
 echo "#!/bin/bash
 
-export LD_LIBRARY_PATH=/usr/local/lib
 bash /etc/init.d/xencommons start
 
 xl list
diff --git a/automation/scripts/qemu-smoke-dom0less-arm64.sh b/automation/scripts/qemu-smoke-dom0less-arm64.sh
index 2c9a927c5c..18ea071c2a 100755
--- a/automation/scripts/qemu-smoke-dom0less-arm64.sh
+++ b/automation/scripts/qemu-smoke-dom0less-arm64.sh
@@ -122,10 +122,9 @@ mkdir -p etc/local.d
 
 echo "#!/bin/bash
 
-export LD_LIBRARY_PATH=/usr/local/lib
 bash /etc/init.d/xencommons start
 
-/usr/local/lib/xen/bin/init-dom0less
+/usr/lib/xen/bin/init-dom0less
 
 brctl addbr xenbr0
 brctl addif xenbr0 eth0
diff --git a/automation/scripts/qubes-x86-64.sh b/automation/scripts/qubes-x86-64.sh
index 3947027d6e..9a74f2116c 100755
--- a/automation/scripts/qubes-x86-64.sh
+++ b/automation/scripts/qubes-x86-64.sh
@@ -200,7 +200,6 @@ cp -a ../automation/scripts/run-tools-tests tests/
 
 echo "#!/bin/bash
 
-export LD_LIBRARY_PATH=/usr/local/lib
 bash /etc/init.d/xencommons start
 
 brctl addbr xenbr0
diff --git a/automation/scripts/xilinx-smoke-dom0-x86_64.sh b/automation/scripts/xilinx-smoke-dom0-x86_64.sh
index a63a525ff8..b1b0c2145b 100755
--- a/automation/scripts/xilinx-smoke-dom0-x86_64.sh
+++ b/automation/scripts/xilinx-smoke-dom0-x86_64.sh
@@ -80,7 +80,6 @@ cd rootfs
 mkdir -p boot etc/local.d etc/xen etc/default
 echo "#!/bin/bash
 
-export LD_LIBRARY_PATH=/usr/local/lib
 bash /etc/init.d/xencommons start
 
 brctl addbr xenbr0
diff --git a/automation/scripts/xilinx-smoke-dom0less-arm64.sh b/automation/scripts/xilinx-smoke-dom0less-arm64.sh
index 59f3fe7edb..293232eebf 100755
--- a/automation/scripts/xilinx-smoke-dom0less-arm64.sh
+++ b/automation/scripts/xilinx-smoke-dom0less-arm64.sh
@@ -64,10 +64,9 @@ cd rootfs
 mkdir -p etc/local.d
 echo "#!/bin/bash
 
-export LD_LIBRARY_PATH=/usr/local/lib
 bash /etc/init.d/xencommons start
 
-/usr/local/lib/xen/bin/init-dom0less
+/usr/lib/xen/bin/init-dom0less
 
 ${dom0_check}
 " > etc/local.d/xen.start
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Sep 10 19:36:25 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 10 Sep 2025 19:36:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1118766.1464474 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uwQcD-0006rO-RD; Wed, 10 Sep 2025 19:36:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1118766.1464474; Wed, 10 Sep 2025 19:36: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 1uwQcD-0006rG-Nb; Wed, 10 Sep 2025 19:36:25 +0000
Received: by outflank-mailman (input) for mailman id 1118766;
 Wed, 10 Sep 2025 19:36: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 1uwQcB-0006qz-SM
 for xen-changelog@lists.xenproject.org; Wed, 10 Sep 2025 19:36: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 1uwQcB-003Pqu-2l
 for xen-changelog@lists.xenproject.org;
 Wed, 10 Sep 2025 19:36:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uwQcB-003LiB-2g
 for xen-changelog@lists.xenproject.org;
 Wed, 10 Sep 2025 19:36: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=3fx8gJM58bAdHwducAzPcuc9xBHvtvpmjMi0yQI7d1k=; b=zwdX0AhzLM7lQ3uml1Pf2EUQF9
	TE01UVjYq5Gf5uyzOdVXsUZa+wTQLmWB02mUlBMDCulklzxQNys01h+1ziZ/6mNEz8se3ffX4U1xo
	kfe8fDVRiyqqsqoil0GbITSLVrUmSaeEcrmVd291nKPBaiCm3Kn48jQWFvX8zIIxl+c0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] CI: Create initrd fragments explicitly as root
Message-Id: <E1uwQcB-003LiB-2g@xenbits.xenproject.org>
Date: Wed, 10 Sep 2025 19:36:23 +0000

commit c0a1a4ccba6cffd1ec34777ec477039447fc1a85
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Sep 9 18:06:37 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Sep 10 17:20:11 2025 +0100

    CI: Create initrd fragments explicitly as root
    
    We have a mix of root and non-root containers, and are trying to become
    rootless.  This can cause the local CPIO fragements to end up being user:user
    in the test environment.
    
    Nothing seems to go wrong so far, but it's a trap waiting to happen.
    
    Make everything consistently root for the initrds, irrespective of the
    rootness of the container the test is running in.
    
    No practical change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Denis Mukhin <dmukhin@ford.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
    (cherry picked from commit e3042c9fc28f2cbeaae6fd248eee7f63ac2ae494)
---
 automation/scripts/build                          | 2 +-
 automation/scripts/qemu-alpine-x86_64.sh          | 4 ++--
 automation/scripts/qemu-smoke-dom0-arm32.sh       | 4 ++--
 automation/scripts/qemu-smoke-dom0-arm64.sh       | 4 ++--
 automation/scripts/qemu-smoke-dom0less-arm32.sh   | 2 +-
 automation/scripts/qemu-smoke-dom0less-arm64.sh   | 4 ++--
 automation/scripts/qubes-x86-64.sh                | 4 ++--
 automation/scripts/xilinx-smoke-dom0-x86_64.sh    | 4 ++--
 automation/scripts/xilinx-smoke-dom0less-arm64.sh | 4 ++--
 9 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/automation/scripts/build b/automation/scripts/build
index a348c781d1..fdf72ee735 100755
--- a/automation/scripts/build
+++ b/automation/scripts/build
@@ -108,7 +108,7 @@ else
     # Note: Some smoke tests depending on finding binaries/xen on a full build
     # even though dist/ contains everything, while some containers don't even
     # build Xen
-    (cd dist/install; find | cpio -o -H newc | gzip) > binaries/xen-tools.cpio.gz
+    (cd dist/install; find | cpio -R 0:0 -o -H newc | gzip) > binaries/xen-tools.cpio.gz
     cp -r tools/tests binaries/
     collect_xen_artefacts
 fi
diff --git a/automation/scripts/qemu-alpine-x86_64.sh b/automation/scripts/qemu-alpine-x86_64.sh
index 746e70483d..b95e63360b 100755
--- a/automation/scripts/qemu-alpine-x86_64.sh
+++ b/automation/scripts/qemu-alpine-x86_64.sh
@@ -25,7 +25,7 @@ mount -t devtmpfs devtmpfs /dev
 chmod +x initrd/init
 # DomU rootfs
 cd initrd
-find . | cpio -H newc -o | gzip > ../domU-rootfs.cpio.gz
+find . | cpio -R 0:0 -H newc -o | gzip > ../domU-rootfs.cpio.gz
 cd ..
 
 # Dom0 rootfs
@@ -57,7 +57,7 @@ xl -vvv create -c /root/domU.cfg
 
 " > etc/local.d/xen.start
 chmod +x etc/local.d/xen.start
-find . | cpio -H newc -o | gzip >> ../dom0-rootfs.cpio.gz
+find . | cpio -R 0:0 -H newc -o | gzip >> ../dom0-rootfs.cpio.gz
 cd ../..
 
 cat >> binaries/pxelinux.0 << EOF
diff --git a/automation/scripts/qemu-smoke-dom0-arm32.sh b/automation/scripts/qemu-smoke-dom0-arm32.sh
index 97855d8ed2..ab38e222a9 100755
--- a/automation/scripts/qemu-smoke-dom0-arm32.sh
+++ b/automation/scripts/qemu-smoke-dom0-arm32.sh
@@ -30,13 +30,13 @@ curl --fail --silent --show-error --location --output initrd.tar.gz https://dl-c
 mkdir rootfs
 cd rootfs
 tar xvzf ../initrd.tar.gz
-find . | cpio -H newc -o | gzip > ../root/initrd.cpio.gz
+find . | cpio -R 0:0 -H newc -o | gzip > ../root/initrd.cpio.gz
 cd ..
 rm -rf rootfs
 rm initrd.tar.gz
 
 cp ../zImage ./root
-find . | cpio -H newc -o | gzip > ../initrd.gz
+find . | cpio -R 0:0 -H newc -o | gzip > ../initrd.gz
 cd ..
 
 # XXX QEMU looks for "efi-virtio.rom" even if it is unneeded
diff --git a/automation/scripts/qemu-smoke-dom0-arm64.sh b/automation/scripts/qemu-smoke-dom0-arm64.sh
index d6f6b74880..6517437a5d 100755
--- a/automation/scripts/qemu-smoke-dom0-arm64.sh
+++ b/automation/scripts/qemu-smoke-dom0-arm64.sh
@@ -24,7 +24,7 @@ mount -t devtmpfs devtmpfs /dev
 /bin/sh" > initrd/init
 chmod +x initrd/init
 cd initrd
-find . | cpio -H newc -o | gzip > ../domU-rootfs.cpio.gz
+find . | cpio -R 0:0 -H newc -o | gzip > ../domU-rootfs.cpio.gz
 cd ..
 
 # Dom0 rootfs
@@ -54,7 +54,7 @@ xl -vvv create -c /root/domU.cfg
 
 " > etc/local.d/xen.start
 chmod +x etc/local.d/xen.start
-find . | cpio -H newc -o | gzip >> ../dom0-rootfs.cpio.gz
+find . | cpio -R 0:0 -H newc -o | gzip >> ../dom0-rootfs.cpio.gz
 cd ../..
 
 # XXX QEMU looks for "efi-virtio.rom" even if it is unneeded
diff --git a/automation/scripts/qemu-smoke-dom0less-arm32.sh b/automation/scripts/qemu-smoke-dom0less-arm32.sh
index 0e2c5496db..f100a9a9d2 100755
--- a/automation/scripts/qemu-smoke-dom0less-arm32.sh
+++ b/automation/scripts/qemu-smoke-dom0less-arm32.sh
@@ -75,7 +75,7 @@ mount -t devtmpfs devtmpfs /dev
 ${domU_check}
 /bin/sh" > init
 chmod +x init
-find . | cpio -H newc -o | gzip > ../initrd.gz
+find . | cpio -R 0:0 -H newc -o | gzip > ../initrd.gz
 cd ..
 
 # XXX QEMU looks for "efi-virtio.rom" even if it is unneeded
diff --git a/automation/scripts/qemu-smoke-dom0less-arm64.sh b/automation/scripts/qemu-smoke-dom0less-arm64.sh
index 18ea071c2a..4d08d2f4f5 100755
--- a/automation/scripts/qemu-smoke-dom0less-arm64.sh
+++ b/automation/scripts/qemu-smoke-dom0less-arm64.sh
@@ -108,7 +108,7 @@ ${domU_check}
 /bin/sh" > initrd/init
 chmod +x initrd/init
 cd initrd
-find . | cpio --create --format='newc' | gzip > ../binaries/initrd
+find . | cpio -R 0:0 -o -H newc | gzip > ../binaries/initrd
 cd ..
 
 # Dom0 rootfs
@@ -136,7 +136,7 @@ xl network-attach 1 type=vif
 ${dom0_check}
 " > etc/local.d/xen.start
 chmod +x etc/local.d/xen.start
-find . | cpio -H newc -o | gzip >> ../binaries/dom0-rootfs.cpio.gz
+find . | cpio -R 0:0 -H newc -o | gzip >> ../binaries/dom0-rootfs.cpio.gz
 cd ..
 
 # ImageBuilder
diff --git a/automation/scripts/qubes-x86-64.sh b/automation/scripts/qubes-x86-64.sh
index 9a74f2116c..c586fa2d81 100755
--- a/automation/scripts/qubes-x86-64.sh
+++ b/automation/scripts/qubes-x86-64.sh
@@ -182,7 +182,7 @@ ${domU_check}
 Kernel \r on an \m (\l)
 
 " > etc/issue
-    find . | cpio -H newc -o | gzip >> ../binaries/domU-rootfs.cpio.gz
+    find . | cpio -R 0:0 -H newc -o | gzip >> ../binaries/domU-rootfs.cpio.gz
     cd ..
     rm -rf rootfs
 fi
@@ -238,7 +238,7 @@ cp ../binaries/bzImage boot/vmlinuz
 if [ -n "$domU_check" ]; then
     cp ../binaries/domU-rootfs.cpio.gz boot/initrd-domU
 fi
-find . | cpio -H newc -o | gzip >> ../binaries/dom0-rootfs.cpio.gz
+find . | cpio -R 0:0 -H newc -o | gzip >> ../binaries/dom0-rootfs.cpio.gz
 cd ..
 
 
diff --git a/automation/scripts/xilinx-smoke-dom0-x86_64.sh b/automation/scripts/xilinx-smoke-dom0-x86_64.sh
index b1b0c2145b..03213da3f1 100755
--- a/automation/scripts/xilinx-smoke-dom0-x86_64.sh
+++ b/automation/scripts/xilinx-smoke-dom0-x86_64.sh
@@ -66,7 +66,7 @@ echo "domU Welcome to Alpine Linux
 Kernel \r on an \m (\l)
 
 " > etc/issue
-find . | cpio -H newc -o | gzip >> ../binaries/domU-rootfs.cpio.gz
+find . | cpio -R 0:0 -H newc -o | gzip >> ../binaries/domU-rootfs.cpio.gz
 cd ..
 rm -rf rootfs
 
@@ -100,7 +100,7 @@ echo "QEMU_XEN=/bin/false" >> etc/default/xencommons
 mkdir -p var/log/xen/console
 cp ../binaries/bzImage boot/vmlinuz
 cp ../binaries/domU-rootfs.cpio.gz boot/initrd-domU
-find . | cpio -H newc -o | gzip >> ../binaries/dom0-rootfs.cpio.gz
+find . | cpio -R 0:0 -H newc -o | gzip >> ../binaries/dom0-rootfs.cpio.gz
 cd ..
 
 # Load software into TFTP server directory.
diff --git a/automation/scripts/xilinx-smoke-dom0less-arm64.sh b/automation/scripts/xilinx-smoke-dom0less-arm64.sh
index 293232eebf..3c89b8694a 100755
--- a/automation/scripts/xilinx-smoke-dom0less-arm64.sh
+++ b/automation/scripts/xilinx-smoke-dom0less-arm64.sh
@@ -50,7 +50,7 @@ echo "#!/bin/sh
 ${domU_check}
 /bin/sh" > etc/local.d/xen.start
 chmod +x etc/local.d/xen.start
-find . | cpio -H newc -o | gzip >> ../binaries/domU-rootfs.cpio.gz
+find . | cpio -R 0:0 -H newc -o | gzip >> ../binaries/domU-rootfs.cpio.gz
 cd ..
 rm -rf rootfs
 
@@ -71,7 +71,7 @@ bash /etc/init.d/xencommons start
 ${dom0_check}
 " > etc/local.d/xen.start
 chmod +x etc/local.d/xen.start
-find . | cpio -H newc -o | gzip >> ../binaries/dom0-rootfs.cpio.gz
+find . | cpio -R 0:0 -H newc -o | gzip >> ../binaries/dom0-rootfs.cpio.gz
 cd ..
 
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Sep 10 20:11:07 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 10 Sep 2025 20:11:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1118785.1464476 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uwR9j-0002yN-51; Wed, 10 Sep 2025 20:11:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1118785.1464476; Wed, 10 Sep 2025 20: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 1uwR9j-0002yF-2O; Wed, 10 Sep 2025 20:11:03 +0000
Received: by outflank-mailman (input) for mailman id 1118785;
 Wed, 10 Sep 2025 20: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 1uwR9h-0002y9-Gw
 for xen-changelog@lists.xenproject.org; Wed, 10 Sep 2025 20: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 1uwR9h-003Qee-1C
 for xen-changelog@lists.xenproject.org;
 Wed, 10 Sep 2025 20:11:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uwR9h-003Nib-0k
 for xen-changelog@lists.xenproject.org;
 Wed, 10 Sep 2025 20: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=TkFOL78U0mXVcedQ7Tb802JmQ8QnPILJPhXwTfR21iE=; b=HrwqEaomAJdbYi7BR3Lci3uTZ0
	4bvil9xPuT1prBkNsQzqnY60CFU0iwkLDBPxwPPJ/+ASeuZyqYfSj1XaFioackto0EPLK9mNbe8sq
	V7+DZtycxM5lnJ0W9/Tt58S8bEo3hxoQzrtQvc0txDC+ih5VT7+TufdYawRyAK+vNMf4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.20] CI: Create initrd fragments explicitly as root
Message-Id: <E1uwR9h-003Nib-0k@xenbits.xenproject.org>
Date: Wed, 10 Sep 2025 20:11:01 +0000

commit ae992e68d3ed7a177adea8b9afa4ec88c27254f0
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Sep 9 18:06:37 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Sep 10 17:19:50 2025 +0100

    CI: Create initrd fragments explicitly as root
    
    We have a mix of root and non-root containers, and are trying to become
    rootless.  This can cause the local CPIO fragements to end up being user:user
    in the test environment.
    
    Nothing seems to go wrong so far, but it's a trap waiting to happen.
    
    Make everything consistently root for the initrds, irrespective of the
    rootness of the container the test is running in.
    
    No practical change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Denis Mukhin <dmukhin@ford.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
    (cherry picked from commit e3042c9fc28f2cbeaae6fd248eee7f63ac2ae494)
---
 automation/scripts/build                          | 2 +-
 automation/scripts/qemu-alpine-x86_64.sh          | 4 ++--
 automation/scripts/qemu-smoke-dom0-arm32.sh       | 4 ++--
 automation/scripts/qemu-smoke-dom0-arm64.sh       | 4 ++--
 automation/scripts/qemu-smoke-dom0less-arm32.sh   | 2 +-
 automation/scripts/qemu-smoke-dom0less-arm64.sh   | 4 ++--
 automation/scripts/qubes-x86-64.sh                | 4 ++--
 automation/scripts/xilinx-smoke-dom0-x86_64.sh    | 4 ++--
 automation/scripts/xilinx-smoke-dom0less-arm64.sh | 4 ++--
 9 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/automation/scripts/build b/automation/scripts/build
index a348c781d1..fdf72ee735 100755
--- a/automation/scripts/build
+++ b/automation/scripts/build
@@ -108,7 +108,7 @@ else
     # Note: Some smoke tests depending on finding binaries/xen on a full build
     # even though dist/ contains everything, while some containers don't even
     # build Xen
-    (cd dist/install; find | cpio -o -H newc | gzip) > binaries/xen-tools.cpio.gz
+    (cd dist/install; find | cpio -R 0:0 -o -H newc | gzip) > binaries/xen-tools.cpio.gz
     cp -r tools/tests binaries/
     collect_xen_artefacts
 fi
diff --git a/automation/scripts/qemu-alpine-x86_64.sh b/automation/scripts/qemu-alpine-x86_64.sh
index 746e70483d..b95e63360b 100755
--- a/automation/scripts/qemu-alpine-x86_64.sh
+++ b/automation/scripts/qemu-alpine-x86_64.sh
@@ -25,7 +25,7 @@ mount -t devtmpfs devtmpfs /dev
 chmod +x initrd/init
 # DomU rootfs
 cd initrd
-find . | cpio -H newc -o | gzip > ../domU-rootfs.cpio.gz
+find . | cpio -R 0:0 -H newc -o | gzip > ../domU-rootfs.cpio.gz
 cd ..
 
 # Dom0 rootfs
@@ -57,7 +57,7 @@ xl -vvv create -c /root/domU.cfg
 
 " > etc/local.d/xen.start
 chmod +x etc/local.d/xen.start
-find . | cpio -H newc -o | gzip >> ../dom0-rootfs.cpio.gz
+find . | cpio -R 0:0 -H newc -o | gzip >> ../dom0-rootfs.cpio.gz
 cd ../..
 
 cat >> binaries/pxelinux.0 << EOF
diff --git a/automation/scripts/qemu-smoke-dom0-arm32.sh b/automation/scripts/qemu-smoke-dom0-arm32.sh
index 4f50eabdef..43bb4102e5 100755
--- a/automation/scripts/qemu-smoke-dom0-arm32.sh
+++ b/automation/scripts/qemu-smoke-dom0-arm32.sh
@@ -30,13 +30,13 @@ curl --fail --silent --show-error --location --output initrd.tar.gz https://dl-c
 mkdir rootfs
 cd rootfs
 tar xvzf ../initrd.tar.gz
-find . | cpio -H newc -o | gzip > ../root/initrd.cpio.gz
+find . | cpio -R 0:0 -H newc -o | gzip > ../root/initrd.cpio.gz
 cd ..
 rm -rf rootfs
 rm initrd.tar.gz
 
 cp ../zImage ./root
-find . | cpio -H newc -o | gzip > ../initrd.gz
+find . | cpio -R 0:0 -H newc -o | gzip > ../initrd.gz
 cd ..
 
 # XXX QEMU looks for "efi-virtio.rom" even if it is unneeded
diff --git a/automation/scripts/qemu-smoke-dom0-arm64.sh b/automation/scripts/qemu-smoke-dom0-arm64.sh
index d6f6b74880..6517437a5d 100755
--- a/automation/scripts/qemu-smoke-dom0-arm64.sh
+++ b/automation/scripts/qemu-smoke-dom0-arm64.sh
@@ -24,7 +24,7 @@ mount -t devtmpfs devtmpfs /dev
 /bin/sh" > initrd/init
 chmod +x initrd/init
 cd initrd
-find . | cpio -H newc -o | gzip > ../domU-rootfs.cpio.gz
+find . | cpio -R 0:0 -H newc -o | gzip > ../domU-rootfs.cpio.gz
 cd ..
 
 # Dom0 rootfs
@@ -54,7 +54,7 @@ xl -vvv create -c /root/domU.cfg
 
 " > etc/local.d/xen.start
 chmod +x etc/local.d/xen.start
-find . | cpio -H newc -o | gzip >> ../dom0-rootfs.cpio.gz
+find . | cpio -R 0:0 -H newc -o | gzip >> ../dom0-rootfs.cpio.gz
 cd ../..
 
 # XXX QEMU looks for "efi-virtio.rom" even if it is unneeded
diff --git a/automation/scripts/qemu-smoke-dom0less-arm32.sh b/automation/scripts/qemu-smoke-dom0less-arm32.sh
index 0e2c5496db..f100a9a9d2 100755
--- a/automation/scripts/qemu-smoke-dom0less-arm32.sh
+++ b/automation/scripts/qemu-smoke-dom0less-arm32.sh
@@ -75,7 +75,7 @@ mount -t devtmpfs devtmpfs /dev
 ${domU_check}
 /bin/sh" > init
 chmod +x init
-find . | cpio -H newc -o | gzip > ../initrd.gz
+find . | cpio -R 0:0 -H newc -o | gzip > ../initrd.gz
 cd ..
 
 # XXX QEMU looks for "efi-virtio.rom" even if it is unneeded
diff --git a/automation/scripts/qemu-smoke-dom0less-arm64.sh b/automation/scripts/qemu-smoke-dom0less-arm64.sh
index 18ea071c2a..4d08d2f4f5 100755
--- a/automation/scripts/qemu-smoke-dom0less-arm64.sh
+++ b/automation/scripts/qemu-smoke-dom0less-arm64.sh
@@ -108,7 +108,7 @@ ${domU_check}
 /bin/sh" > initrd/init
 chmod +x initrd/init
 cd initrd
-find . | cpio --create --format='newc' | gzip > ../binaries/initrd
+find . | cpio -R 0:0 -o -H newc | gzip > ../binaries/initrd
 cd ..
 
 # Dom0 rootfs
@@ -136,7 +136,7 @@ xl network-attach 1 type=vif
 ${dom0_check}
 " > etc/local.d/xen.start
 chmod +x etc/local.d/xen.start
-find . | cpio -H newc -o | gzip >> ../binaries/dom0-rootfs.cpio.gz
+find . | cpio -R 0:0 -H newc -o | gzip >> ../binaries/dom0-rootfs.cpio.gz
 cd ..
 
 # ImageBuilder
diff --git a/automation/scripts/qubes-x86-64.sh b/automation/scripts/qubes-x86-64.sh
index bfdd2ceb99..e20a38e4f3 100755
--- a/automation/scripts/qubes-x86-64.sh
+++ b/automation/scripts/qubes-x86-64.sh
@@ -182,7 +182,7 @@ ${domU_check}
 Kernel \r on an \m (\l)
 
 " > etc/issue
-    find . | cpio -H newc -o | gzip >> ../binaries/domU-rootfs.cpio.gz
+    find . | cpio -R 0:0 -H newc -o | gzip >> ../binaries/domU-rootfs.cpio.gz
     cd ..
     rm -rf rootfs
 fi
@@ -239,7 +239,7 @@ cp ../binaries/bzImage boot/vmlinuz
 if [ -n "$domU_check" ]; then
     cp ../binaries/domU-rootfs.cpio.gz boot/initrd-domU
 fi
-find . | cpio -H newc -o | gzip >> ../binaries/dom0-rootfs.cpio.gz
+find . | cpio -R 0:0 -H newc -o | gzip >> ../binaries/dom0-rootfs.cpio.gz
 cd ..
 
 
diff --git a/automation/scripts/xilinx-smoke-dom0-x86_64.sh b/automation/scripts/xilinx-smoke-dom0-x86_64.sh
index 8f02fa73bd..e68b0ce61f 100755
--- a/automation/scripts/xilinx-smoke-dom0-x86_64.sh
+++ b/automation/scripts/xilinx-smoke-dom0-x86_64.sh
@@ -99,7 +99,7 @@ echo "domU Welcome to Alpine Linux
 Kernel \r on an \m (\l)
 
 " > etc/issue
-find . | cpio -H newc -o | gzip >> ../binaries/domU-rootfs.cpio.gz
+find . | cpio -R 0:0 -H newc -o | gzip >> ../binaries/domU-rootfs.cpio.gz
 cd ..
 rm -rf rootfs
 
@@ -127,7 +127,7 @@ echo "QEMU_XEN=/bin/false" >> etc/default/xencommons
 mkdir -p var/log/xen/console
 cp ../binaries/bzImage boot/vmlinuz
 cp ../binaries/domU-rootfs.cpio.gz boot/initrd-domU
-find . | cpio -H newc -o | gzip >> ../binaries/dom0-rootfs.cpio.gz
+find . | cpio -R 0:0 -H newc -o | gzip >> ../binaries/dom0-rootfs.cpio.gz
 cd ..
 
 # Load software into TFTP server directory.
diff --git a/automation/scripts/xilinx-smoke-dom0less-arm64.sh b/automation/scripts/xilinx-smoke-dom0less-arm64.sh
index 293232eebf..3c89b8694a 100755
--- a/automation/scripts/xilinx-smoke-dom0less-arm64.sh
+++ b/automation/scripts/xilinx-smoke-dom0less-arm64.sh
@@ -50,7 +50,7 @@ echo "#!/bin/sh
 ${domU_check}
 /bin/sh" > etc/local.d/xen.start
 chmod +x etc/local.d/xen.start
-find . | cpio -H newc -o | gzip >> ../binaries/domU-rootfs.cpio.gz
+find . | cpio -R 0:0 -H newc -o | gzip >> ../binaries/domU-rootfs.cpio.gz
 cd ..
 rm -rf rootfs
 
@@ -71,7 +71,7 @@ bash /etc/init.d/xencommons start
 ${dom0_check}
 " > etc/local.d/xen.start
 chmod +x etc/local.d/xen.start
-find . | cpio -H newc -o | gzip >> ../binaries/dom0-rootfs.cpio.gz
+find . | cpio -R 0:0 -H newc -o | gzip >> ../binaries/dom0-rootfs.cpio.gz
 cd ..
 
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.20


From xen-changelog-bounces@lists.xenproject.org Wed Sep 10 20:55:05 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 10 Sep 2025 20:55:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1118797.1464481 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uwRqJ-0007XX-0R; Wed, 10 Sep 2025 20:55:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1118797.1464481; Wed, 10 Sep 2025 20: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 1uwRqI-0007XP-UA; Wed, 10 Sep 2025 20:55:02 +0000
Received: by outflank-mailman (input) for mailman id 1118797;
 Wed, 10 Sep 2025 20: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 1uwRqH-0007XJ-Ql
 for xen-changelog@lists.xenproject.org; Wed, 10 Sep 2025 20: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 1uwRqH-003RVa-2K
 for xen-changelog@lists.xenproject.org;
 Wed, 10 Sep 2025 20:55:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uwRqH-003QP9-2D
 for xen-changelog@lists.xenproject.org;
 Wed, 10 Sep 2025 20: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=yEsDR2sUXPu9xRYYUnS24AB4BcXFzKp6bkv7EMqFHtM=; b=Zsyg+abdYLff5x/Br6FoWiTMiB
	pJ2A4hc7vSsQ3GH42VwF4k0bAFG2CvLvRBSuQlf/pMH+KX8WEepbJGdPoVubddziA60jm9QeK5YSR
	lTuXqwHtPyiOSDkgxvGRvHLhhIYRKwXSU73gYh2Upxa225jdUiaBs6QqOwW7XgI4PL/4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] stubdom: Fix -Wimplicit-int in newlib
Message-Id: <E1uwRqH-003QP9-2D@xenbits.xenproject.org>
Date: Wed, 10 Sep 2025 20:55:01 +0000

commit dc39962c782ce516e988379969288c4e620cf66f
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Sat Aug 9 22:55:26 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Sep 10 17:30:22 2025 +0100

    stubdom: Fix -Wimplicit-int in newlib
    
    This is an error now Debian Trixie's gcc-14
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
---
 stubdom/Makefile               |  1 +
 stubdom/newlib-fix-etext.patch | 23 +++++++++++++++++++++++
 2 files changed, 24 insertions(+)

diff --git a/stubdom/Makefile b/stubdom/Makefile
index 666c3221dc..9aa0d3dee4 100644
--- a/stubdom/Makefile
+++ b/stubdom/Makefile
@@ -94,6 +94,7 @@ newlib-$(NEWLIB_VERSION): newlib-$(NEWLIB_VERSION).tar.gz
 	patch -d $@ -p1 < newlib-cygmon-gmon.patch
 	patch -d $@ -p1 < newlib-makedoc.patch
 	patch -d $@ -p1 < newlib-fix-copy_past_newline.patch
+	patch -d $@ -p1 < newlib-fix-etext.patch
 	find $@ -type f | xargs perl -i.bak \
 		-pe 's/\b_(tzname|daylight|timezone)\b/$$1/g'
 	touch $@
diff --git a/stubdom/newlib-fix-etext.patch b/stubdom/newlib-fix-etext.patch
new file mode 100644
index 0000000000..e7bd4bb0ce
--- /dev/null
+++ b/stubdom/newlib-fix-etext.patch
@@ -0,0 +1,23 @@
+GCC-14 in Debian Trixie i386 complains:
+
+../../../../newlib-1.16.0/libgloss/i386/cygmon-gmon.c: In function '_mcount':
+../../../../newlib-1.16.0/libgloss/i386/cygmon-gmon.c:227:14: error: type defaults to 'int' in declaration of '_etext' [-Wimplicit-int]
+  227 |       extern _etext();
+      |              ^~~~~~
+../../../../newlib-1.16.0/libgloss/i386/cygmon-gmon.c:228:14: error: type defaults to 'int' in declaration of '_ftext' [-Wimplicit-int]
+  228 |       extern _ftext();
+      |              ^~~~~~
+
+--- newlib-1.16.0/libgloss/i386/cygmon-gmon.c.orig	2025-08-09 22:48:09.864068481 +0100
++++ newlib-1.16.0/libgloss/i386/cygmon-gmon.c	2025-08-09 22:52:18.458393484 +0100
+@@ -224,8 +224,8 @@
+ 
+   if (! already_setup) 
+     {
+-      extern _etext();
+-      extern _ftext();
++      extern char _etext[];
++      extern char _ftext[];
+       already_setup = 1;
+       monstartup(_ftext, _etext);
+       atexit(_mcleanup);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Sep 10 20:55:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 10 Sep 2025 20:55:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1118798.1464486 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uwRqT-0007ZO-2Q; Wed, 10 Sep 2025 20:55:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1118798.1464486; Wed, 10 Sep 2025 20: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 1uwRqS-0007ZE-VX; Wed, 10 Sep 2025 20:55:12 +0000
Received: by outflank-mailman (input) for mailman id 1118798;
 Wed, 10 Sep 2025 20: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 1uwRqR-0007Yt-Sx
 for xen-changelog@lists.xenproject.org; Wed, 10 Sep 2025 20: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 1uwRqR-003RVv-2n
 for xen-changelog@lists.xenproject.org;
 Wed, 10 Sep 2025 20:55:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uwRqR-003QPZ-2V
 for xen-changelog@lists.xenproject.org;
 Wed, 10 Sep 2025 20: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=1Kp1L1pfJN8Wx1a+iNOMKgl6IrFF1+FSuENkdDRnIqI=; b=sp+2EKwJCwrYzf+naP9cfMFQs9
	1QgsY7YL9rmhcQKGAZOHb5wfj7yXAIQ4gv3/JkFcuOR7OGViFCRCEoDR7w8s2eDMbYj91WRztQKhC
	SEcwAwm0RGQ9aFW9Fhm0GDYUjGgChxTb0RBaHGTR2EnIEUZIC1ZD981uCy6wXy5rHSKk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] CI: Update riscv64 to use Debian Trixie
Message-Id: <E1uwRqR-003QPZ-2V@xenbits.xenproject.org>
Date: Wed, 10 Sep 2025 20:55:11 +0000

commit aad6ebf0596f7eda6ea709f1c293ef5911ae8938
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Sat Aug 9 21:05:11 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Sep 10 17:30:22 2025 +0100

    CI: Update riscv64 to use Debian Trixie
    
    Everything works fine with Debian 13.  Provide two new build jobs, and update
    both the randconfig the test jobs.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
---
 automation/build/debian/13-riscv64.dockerfile | 37 +++++++++++++++++++++++++++
 automation/gitlab-ci/build.yaml               | 22 +++++++++++++---
 automation/gitlab-ci/test.yaml                |  2 +-
 automation/scripts/containerize               |  1 +
 4 files changed, 57 insertions(+), 5 deletions(-)

diff --git a/automation/build/debian/13-riscv64.dockerfile b/automation/build/debian/13-riscv64.dockerfile
new file mode 100644
index 0000000000..d2736c657d
--- /dev/null
+++ b/automation/build/debian/13-riscv64.dockerfile
@@ -0,0 +1,37 @@
+# syntax=docker/dockerfile:1
+FROM --platform=linux/amd64 debian:trixie-slim
+LABEL maintainer.name="The Xen Project"
+LABEL maintainer.email="xen-devel@lists.xenproject.org"
+
+ENV DEBIAN_FRONTEND=noninteractive
+ENV CROSS_COMPILE=riscv64-linux-gnu-
+ENV XEN_TARGET_ARCH=riscv64
+
+RUN <<EOF
+#!/bin/bash
+    set -e
+
+    useradd --create-home user
+
+    apt-get update
+
+    DEPS=(
+        # Xen
+        bison
+        build-essential
+        checkpolicy
+        flex
+        gcc-riscv64-linux-gnu
+        python3-minimal
+
+        # Qemu for test phase
+        qemu-system-riscv64
+        expect
+    )
+
+    apt-get -y --no-install-recommends install "${DEPS[@]}"
+    rm -rf /var/lib/apt/lists/*
+EOF
+
+USER user
+WORKDIR /build
diff --git a/automation/gitlab-ci/build.yaml b/automation/gitlab-ci/build.yaml
index ab5211f77e..c0728e58c4 100644
--- a/automation/gitlab-ci/build.yaml
+++ b/automation/gitlab-ci/build.yaml
@@ -329,10 +329,10 @@ debian-12-ppc64le-gcc-debug:
       CONFIG_UBSAN=y
       CONFIG_UBSAN_FATAL=y
 
-debian-12-riscv64-gcc-debug:
+debian-13-riscv64-gcc-debug:
   extends: .gcc-riscv64-cross-build-debug
   variables:
-    CONTAINER: debian:12-riscv64
+    CONTAINER: debian:13-riscv64
     KBUILD_DEFCONFIG: tiny64_defconfig
     HYPERVISOR_ONLY: y
     EXTRA_XEN_CONFIG: |
@@ -713,6 +713,20 @@ debian-12-riscv64-gcc:
     KBUILD_DEFCONFIG: tiny64_defconfig
     HYPERVISOR_ONLY: y
 
+debian-12-riscv64-gcc-debug:
+  extends: .gcc-riscv64-cross-build-debug
+  variables:
+    CONTAINER: debian:12-riscv64
+    KBUILD_DEFCONFIG: tiny64_defconfig
+    HYPERVISOR_ONLY: y
+
+debian-13-riscv64-gcc:
+  extends: .gcc-riscv64-cross-build
+  variables:
+    CONTAINER: debian:13-riscv64
+    KBUILD_DEFCONFIG: tiny64_defconfig
+    HYPERVISOR_ONLY: y
+
 .riscv-fixed-randconfig:
   variables: &riscv-fixed-randconfig
     EXTRA_FIXED_RANDCONFIG: |
@@ -725,10 +739,10 @@ debian-12-riscv64-gcc:
       CONFIG_VM_EVENT=n
       CONFIG_XSM=n
 
-debian-12-riscv64-gcc-randconfig:
+debian-13-riscv64-gcc-randconfig:
   extends: .gcc-riscv64-cross-build
   variables:
-    CONTAINER: debian:12-riscv64
+    CONTAINER: debian:13-riscv64
     KBUILD_DEFCONFIG: tiny64_defconfig
     RANDCONFIG: y
     <<: *riscv-fixed-randconfig
diff --git a/automation/gitlab-ci/test.yaml b/automation/gitlab-ci/test.yaml
index 1f0b27b237..95b883b32b 100644
--- a/automation/gitlab-ci/test.yaml
+++ b/automation/gitlab-ci/test.yaml
@@ -705,7 +705,7 @@ qemu-smoke-riscv64-gcc:
   script:
     - ./automation/scripts/qemu-smoke-riscv64.sh 2>&1 | tee ${LOGFILE}
   needs:
-    - debian-12-riscv64-gcc-debug
+    - debian-13-riscv64-gcc-debug
 
 qemu-smoke-ppc64le-powernv9-gcc:
   extends: .qemu-ppc64le
diff --git a/automation/scripts/containerize b/automation/scripts/containerize
index 0953e0728c..340b6caaab 100755
--- a/automation/scripts/containerize
+++ b/automation/scripts/containerize
@@ -32,6 +32,7 @@ case "_${CONTAINER}" in
     _bullseye-ppc64le) CONTAINER="${BASE}/debian:11-ppc64le" ;;
     _bookworm-ppc64le) CONTAINER="${BASE}/debian:12-ppc64le" ;;
     _bookworm-riscv64) CONTAINER="${BASE}/debian:12-riscv64" ;;
+    _trixie-riscv64) CONTAINER="${BASE}/debian:13-riscv64" ;;
     _bookworm-x86_64-gcc-ibt) CONTAINER="${BASE}/debian:12-x86_64-gcc-ibt" ;;
     _bookworm|_bookworm-x86_64|_) CONTAINER="${BASE}/debian:12-x86_64" ;;
     _bookworm-i386|_bookworm-x86_32) CONTAINER="${BASE}/debian:12-x86_32" ;;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Sep 11 12:33:07 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 11 Sep 2025 12:33:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1120209.1465235 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uwgU3-0003N5-8w; Thu, 11 Sep 2025 12:33:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1120209.1465235; Thu, 11 Sep 2025 12: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 1uwgU3-0003Mx-6H; Thu, 11 Sep 2025 12:33:03 +0000
Received: by outflank-mailman (input) for mailman id 1120209;
 Thu, 11 Sep 2025 12: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 1uwgU1-0003Mr-VS
 for xen-changelog@lists.xenproject.org; Thu, 11 Sep 2025 12: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 1uwgU1-004sQU-2q
 for xen-changelog@lists.xenproject.org;
 Thu, 11 Sep 2025 12:33:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uwgU1-004Fly-2j
 for xen-changelog@lists.xenproject.org;
 Thu, 11 Sep 2025 12: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=/bfH7X/eYAxaRZHW51kCCmYKvwJUm8zHI+2Sp7se0Cw=; b=i8q02P6eB7mqvhnNOkJui33hxL
	lMdgGW3DgRUDCZnCpukr0BVlgncq9LrHKza7b5029elAauTnRl3Q8/0rAIDI8fG4FT8b84CdqHFgz
	u1yOQaOcteXk1qzh8s1hgzi1DxzlJi6Mf4oDKUK9rWJ4T8rBsBAS0f4DLeEyCbrJ9DSA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/IO-APIC: drop setup_ioapic_ids_from_mpc()
Message-Id: <E1uwgU1-004Fly-2j@xenbits.xenproject.org>
Date: Thu, 11 Sep 2025 12:33:01 +0000

commit 85face437570d7faeb829376328c6245f245306d
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Sep 11 12:31:15 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Sep 11 12:31:15 2025 +0200

    x86/IO-APIC: drop setup_ioapic_ids_from_mpc()
    
    Along the lines of what b89f8f054f96 ("x86/apic: Drop sync_Arb_IDs()")
    said, the function is dead logic as well: All 64-bit capable Intel systems
    have (at least) xAPIC (if not x2APIC).
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Release-Acked-by: Oleksii Kurochko<oleksii.kurochko@gmail.com>
---
 xen/arch/x86/io_apic.c | 119 -------------------------------------------------
 1 file changed, 119 deletions(-)

diff --git a/xen/arch/x86/io_apic.c b/xen/arch/x86/io_apic.c
index 17e6827f4b..3336d16c0e 100644
--- a/xen/arch/x86/io_apic.c
+++ b/xen/arch/x86/io_apic.c
@@ -1458,119 +1458,6 @@ void disable_IO_APIC(void)
     disconnect_bsp_APIC(ioapic_i8259.pin != -1);
 }
 
-/*
- * function to set the IO-APIC physical IDs based on the
- * values stored in the MPC table.
- *
- * by Matt Domsch <Matt_Domsch@dell.com>  Tue Dec 21 12:25:05 CST 1999
- */
-
-static void __init setup_ioapic_ids_from_mpc(void)
-{
-    union IO_APIC_reg_00 reg_00;
-    static physid_mask_t __initdata phys_id_present_map;
-    int apic;
-    int i;
-    unsigned char old_id;
-    unsigned long flags;
-    const uint32_t broadcast_id = 0xf;
-
-    /*
-     * Don't check I/O APIC IDs for xAPIC systems. They have
-     * no meaning without the serial APIC bus.
-     */
-    if (!(boot_cpu_data.x86_vendor == X86_VENDOR_INTEL)
-        || APIC_XAPIC(apic_version[boot_cpu_physical_apicid]))
-        return;
-
-    /*
-     * This is broken; anything with a real cpu count has to
-     * circumvent this idiocy regardless.
-     */
-    phys_id_present_map = phys_cpu_present_map;
-
-    /*
-     * Set the IOAPIC ID to the value stored in the MPC table.
-     */
-    for (apic = 0; apic < nr_ioapics; apic++) {
-        if (!nr_ioapic_entries[apic])
-            continue;
-
-        /* Read the register 0 value */
-        spin_lock_irqsave(&ioapic_lock, flags);
-        reg_00.raw = io_apic_read(apic, 0);
-        spin_unlock_irqrestore(&ioapic_lock, flags);
-		
-        old_id = mp_ioapics[apic].mpc_apicid;
-
-        if (mp_ioapics[apic].mpc_apicid >= broadcast_id) {
-            printk(KERN_ERR "BIOS bug, IO-APIC#%d ID is %d in the MPC table!...\n",
-                   apic, mp_ioapics[apic].mpc_apicid);
-            printk(KERN_ERR "... fixing up to %d. (tell your hw vendor)\n",
-                   reg_00.bits.ID);
-            mp_ioapics[apic].mpc_apicid = reg_00.bits.ID;
-        }
-
-        /*
-         * Sanity check, is the ID really free? Every APIC in a
-         * system must have a unique ID or we get lots of nice
-         * 'stuck on smp_invalidate_needed IPI wait' messages.
-         */
-        if ( physid_isset(mp_ioapics[apic].mpc_apicid, phys_id_present_map) )
-        {
-            printk(KERN_ERR "BIOS bug, IO-APIC#%d ID %d is already used!...\n",
-                   apic, mp_ioapics[apic].mpc_apicid);
-            for (i = 0; i < broadcast_id; i++)
-                if (!physid_isset(i, phys_id_present_map))
-                    break;
-            if (i >= broadcast_id)
-                panic("Max APIC ID exceeded\n");
-            printk(KERN_ERR "... fixing up to %d. (tell your hw vendor)\n",
-                   i);
-            mp_ioapics[apic].mpc_apicid = i;
-        } else {
-            apic_printk(APIC_VERBOSE, "Setting %d in the "
-                        "phys_id_present_map\n",
-                        mp_ioapics[apic].mpc_apicid);
-        }
-        physid_set(mp_ioapics[apic].mpc_apicid, phys_id_present_map);
-
-        /*
-         * We need to adjust the IRQ routing table
-         * if the ID changed.
-         */
-        if (old_id != mp_ioapics[apic].mpc_apicid)
-            for (i = 0; i < mp_irq_entries; i++)
-                if (mp_irqs[i].mpc_dstapic == old_id)
-                    mp_irqs[i].mpc_dstapic
-                        = mp_ioapics[apic].mpc_apicid;
-
-        /*
-         * Read the right value from the MPC table and
-         * write it into the ID register.
-         */
-        apic_printk(APIC_VERBOSE, KERN_INFO
-                    "...changing IO-APIC physical APIC ID to %d ...",
-                    mp_ioapics[apic].mpc_apicid);
-
-        reg_00.bits.ID = mp_ioapics[apic].mpc_apicid;
-        spin_lock_irqsave(&ioapic_lock, flags);
-        io_apic_write(apic, 0, reg_00.raw);
-        spin_unlock_irqrestore(&ioapic_lock, flags);
-
-        /*
-         * Sanity check
-         */
-        spin_lock_irqsave(&ioapic_lock, flags);
-        reg_00.raw = io_apic_read(apic, 0);
-        spin_unlock_irqrestore(&ioapic_lock, flags);
-        if (reg_00.bits.ID != mp_ioapics[apic].mpc_apicid)
-            printk("could not set ID!\n");
-        else
-            apic_printk(APIC_VERBOSE, " ok.\n");
-    }
-}
-
 /*
  * There is a nasty bug in some older SMP boards, their mptable lies
  * about the timer IRQ. We do the following to work around the situation:
@@ -2158,12 +2045,6 @@ void __init setup_IO_APIC(void)
         ioapic_level_type.end = end_level_ioapic_irq_new;
     }
 
-    /*
-     * Set up IO-APIC IRQ routing.
-     */
-    if (!acpi_ioapic)
-        setup_ioapic_ids_from_mpc();
-
     setup_IO_APIC_irqs();
     init_IO_APIC_traps();
     check_timer();
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Sep 11 12:33:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 11 Sep 2025 12:33:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1120210.1465238 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uwgUD-0003Og-Ap; Thu, 11 Sep 2025 12:33:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1120210.1465238; Thu, 11 Sep 2025 12: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 1uwgUD-0003OY-7d; Thu, 11 Sep 2025 12:33:13 +0000
Received: by outflank-mailman (input) for mailman id 1120210;
 Thu, 11 Sep 2025 12: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 1uwgUC-0003OQ-0k
 for xen-changelog@lists.xenproject.org; Thu, 11 Sep 2025 12: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 1uwgUB-004sQg-3A
 for xen-changelog@lists.xenproject.org;
 Thu, 11 Sep 2025 12:33:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uwgUB-004FmK-32
 for xen-changelog@lists.xenproject.org;
 Thu, 11 Sep 2025 12: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=ggjIwcuDB562no/Qdc5CWKY3PyaF/s8GdTaDXMeDQEk=; b=Q6G2Qk5QBrBVatR95+JDGUKiYU
	n85ScXIFUUDgyAkrl4xhGI2Ps7R1HjxxyVhe8/J/sVwkV+Ea2oiAeL7drHoDRzz0m5DAzmsf0pW6A
	1utvAwEkXRO+Td2uOWpLcOSCFI/tEsPzv/+RxWCk6pY4GKznICVv3d672MFvJwA2nrpc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/IO-APIC: drop io_apic_get_unique_id()
Message-Id: <E1uwgUB-004FmK-32@xenbits.xenproject.org>
Date: Thu, 11 Sep 2025 12:33:11 +0000

commit 624ae9ff96f6e64d0b523ba0f34838fed6d35614
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Sep 11 12:31:37 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Sep 11 12:31:37 2025 +0200

    x86/IO-APIC: drop io_apic_get_unique_id()
    
    Along the lines of what b89f8f054f96 ("x86/apic: Drop sync_Arb_IDs()")
    said, the function is dead logic as well: All 64-bit capable Intel systems
    have (at least) xAPIC (if not x2APIC).
    
    As this removes the last user of APIC_XAPIC(), remove the macro as well.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Release-Acked-by: Oleksii Kurochko<oleksii.kurochko@gmail.com>
---
 xen/arch/x86/include/asm/apicdef.h |  1 -
 xen/arch/x86/include/asm/io_apic.h |  1 -
 xen/arch/x86/io_apic.c             | 80 --------------------------------------
 xen/arch/x86/mpparse.c             | 12 +-----
 4 files changed, 1 insertion(+), 93 deletions(-)

diff --git a/xen/arch/x86/include/asm/apicdef.h b/xen/arch/x86/include/asm/apicdef.h
index 63dab01dde..112c1dc613 100644
--- a/xen/arch/x86/include/asm/apicdef.h
+++ b/xen/arch/x86/include/asm/apicdef.h
@@ -19,7 +19,6 @@
 #define			APIC_LVR_DIRECTED_EOI	(1 << 24)
 #define			GET_APIC_VERSION(x)	((x)&0xFF)
 #define			GET_APIC_MAXLVT(x)	(((x)>>16)&0xFF)
-#define			APIC_XAPIC(x)		((x) >= 0x14)
 #define		APIC_TASKPRI	0x80
 #define			APIC_TPRI_MASK		0xFF
 #define		APIC_ARBPRI	0x90
diff --git a/xen/arch/x86/include/asm/io_apic.h b/xen/arch/x86/include/asm/io_apic.h
index 62456806c7..4680dce9e1 100644
--- a/xen/arch/x86/include/asm/io_apic.h
+++ b/xen/arch/x86/include/asm/io_apic.h
@@ -184,7 +184,6 @@ extern bool skip_ioapic_setup;
 extern bool ioapic_ack_new;
 extern bool ioapic_ack_forced;
 
-extern int io_apic_get_unique_id (int ioapic, int apic_id);
 extern int io_apic_get_version (int ioapic);
 extern int io_apic_get_redir_entries (int ioapic);
 extern int io_apic_set_pci_routing (int ioapic, int pin, int irq, int edge_level, int active_high_low);
diff --git a/xen/arch/x86/io_apic.c b/xen/arch/x86/io_apic.c
index 3336d16c0e..c384f10c1b 100644
--- a/xen/arch/x86/io_apic.c
+++ b/xen/arch/x86/io_apic.c
@@ -2092,86 +2092,6 @@ void ioapic_resume(void)
     spin_unlock_irqrestore(&ioapic_lock, flags);
 }
 
-/* --------------------------------------------------------------------------
-                          ACPI-based IOAPIC Configuration
-   -------------------------------------------------------------------------- */
-
-
-int __init io_apic_get_unique_id (int ioapic, int apic_id)
-{
-    union IO_APIC_reg_00 reg_00;
-    static physid_mask_t __initdata apic_id_map = PHYSID_MASK_NONE;
-    unsigned long flags;
-    int i = 0;
-    const uint32_t broadcast_id = 0xf;
-
-    /*
-     * The P4 platform supports up to 256 APIC IDs on two separate APIC 
-     * buses (one for LAPICs, one for IOAPICs), where predecessors only 
-     * supports up to 16 on one shared APIC bus.
-     * 
-     * TBD: Expand LAPIC/IOAPIC support on P4-class systems to take full
-     *      advantage of new APIC bus architecture.
-     */
-
-    if (physids_empty(apic_id_map))
-        apic_id_map = phys_cpu_present_map;
-
-    spin_lock_irqsave(&ioapic_lock, flags);
-    reg_00.raw = io_apic_read(ioapic, 0);
-    spin_unlock_irqrestore(&ioapic_lock, flags);
-
-    if (apic_id >= broadcast_id) {
-        printk(KERN_WARNING "IOAPIC[%d]: Invalid apic_id %d, trying "
-               "%d\n", ioapic, apic_id, reg_00.bits.ID);
-        apic_id = reg_00.bits.ID;
-    }
-
-    /*
-     * Every APIC in a system must have a unique ID or we get lots of nice 
-     * 'stuck on smp_invalidate_needed IPI wait' messages.
-     */
-    if ( physid_isset(apic_id, apic_id_map) )
-    {
-
-        for (i = 0; i < broadcast_id; i++) {
-            if ( !physid_isset(i, apic_id_map) )
-                break;
-        }
-
-        if (i == broadcast_id)
-            panic("Max apic_id exceeded\n");
-
-        printk(KERN_WARNING "IOAPIC[%d]: apic_id %d already used, "
-               "trying %d\n", ioapic, apic_id, i);
-
-        apic_id = i;
-    } 
-
-    physid_set(apic_id, apic_id_map);
-
-    if (reg_00.bits.ID != apic_id) {
-        reg_00.bits.ID = apic_id;
-
-        spin_lock_irqsave(&ioapic_lock, flags);
-        io_apic_write(ioapic, 0, reg_00.raw);
-        reg_00.raw = io_apic_read(ioapic, 0);
-        spin_unlock_irqrestore(&ioapic_lock, flags);
-
-        /* Sanity check */
-        if (reg_00.bits.ID != apic_id) {
-            printk("IOAPIC[%d]: Unable to change apic_id!\n", ioapic);
-            return -1;
-        }
-    }
-
-    apic_printk(APIC_VERBOSE, KERN_INFO
-                "IOAPIC[%d]: Assigned apic_id %d\n", ioapic, apic_id);
-
-    return apic_id;
-}
-
-
 int __init io_apic_get_version (int ioapic)
 {
     union IO_APIC_reg_01	reg_01;
diff --git a/xen/arch/x86/mpparse.c b/xen/arch/x86/mpparse.c
index e74a714f50..c1171f7a3a 100644
--- a/xen/arch/x86/mpparse.c
+++ b/xen/arch/x86/mpparse.c
@@ -871,7 +871,6 @@ void __init mp_register_ioapic (
 	u32			gsi_base)
 {
 	int			idx = 0;
-	int			tmpid;
 
 	if (nr_ioapics >= MAX_IO_APICS) {
 		printk(KERN_ERR "ERROR: Max # of I/O APICs (%d) exceeded "
@@ -891,16 +890,7 @@ void __init mp_register_ioapic (
 	mp_ioapics[idx].mpc_apicaddr = address;
 
 	set_fixmap_nocache(FIX_IO_APIC_BASE_0 + idx, address);
-	if ((boot_cpu_data.x86_vendor == X86_VENDOR_INTEL)
-		&& !APIC_XAPIC(apic_version[boot_cpu_physical_apicid]))
-		tmpid = io_apic_get_unique_id(idx, id);
-	else
-		tmpid = id;
-	if (tmpid == -1) {
-		nr_ioapics--;
-		return;
-	}
-	mp_ioapics[idx].mpc_apicid = tmpid;
+	mp_ioapics[idx].mpc_apicid = id;
 	mp_ioapics[idx].mpc_apicver = io_apic_get_version(idx);
 	
 	/* 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Sep 11 12:33:23 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 11 Sep 2025 12:33:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1120211.1465243 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uwgUN-0003Ql-Bi; Thu, 11 Sep 2025 12:33:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1120211.1465243; Thu, 11 Sep 2025 12: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 1uwgUN-0003Qd-99; Thu, 11 Sep 2025 12:33:23 +0000
Received: by outflank-mailman (input) for mailman id 1120211;
 Thu, 11 Sep 2025 12: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 1uwgUM-0003QV-4L
 for xen-changelog@lists.xenproject.org; Thu, 11 Sep 2025 12: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 1uwgUM-004sQu-0K
 for xen-changelog@lists.xenproject.org;
 Thu, 11 Sep 2025 12:33:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uwgUM-004FnL-08
 for xen-changelog@lists.xenproject.org;
 Thu, 11 Sep 2025 12: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=MLuS/Mk7SNPTGYZFWIgdg9NAcUil8ZTVMNsB9ee/tz4=; b=KtQPeuz/ZX+/AdIYnz9Tqpyy9l
	ivqXHR0i05QXowsn5AXlKW+OOjPFv0G4SQZAxUjLkx1P6kM650w08KBZzU37ITqhFJfJPPYpgnZvm
	RtxeQTlQ9L+YbjzrWGrtEAETBGR0LJZflvfnlhQ3ywDEF2wAA9PvhO47no4y/Z0kNqp4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/x86: consolidate vram tracking support
Message-Id: <E1uwgUM-004FnL-08@xenbits.xenproject.org>
Date: Thu, 11 Sep 2025 12:33:22 +0000

commit 240bde75cbe6e5de38b5ca1d3da26b4a7f511727
Author:     Penny Zheng <Penny.Zheng@amd.com>
AuthorDate: Thu Sep 11 12:32:04 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Sep 11 12:32:04 2025 +0200

    xen/x86: consolidate vram tracking support
    
    Flag PG_log_dirty is for paging log dirty support, not vram tracking support.
    However data structure sh_dirty_vram{} and function paging_log_dirty_range()
    designed for vram tracking support, are guarded with PG_log_dirty.
    We release both from PG_log_dirty, and also move paging_log_dirty_range(),
    remamed with p2m_log_dirty_range(), into p2m.c, where it logically belongs.
    
    Signed-off-by: Penny Zheng <Penny.Zheng@amd.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/include/asm/p2m.h    |  4 ++++
 xen/arch/x86/include/asm/paging.h | 32 +++++++++++++-------------------
 xen/arch/x86/mm/hap/hap.c         |  4 ++--
 xen/arch/x86/mm/p2m.c             | 28 ++++++++++++++++++++++++++++
 xen/arch/x86/mm/paging.c          | 32 --------------------------------
 5 files changed, 47 insertions(+), 53 deletions(-)

diff --git a/xen/arch/x86/include/asm/p2m.h b/xen/arch/x86/include/asm/p2m.h
index 3b860e30c3..9016e88411 100644
--- a/xen/arch/x86/include/asm/p2m.h
+++ b/xen/arch/x86/include/asm/p2m.h
@@ -1110,6 +1110,10 @@ static inline int p2m_entry_modify(struct p2m_domain *p2m, p2m_type_t nt,
 
 #endif /* CONFIG_HVM */
 
+/* Get the dirty bitmap for a specific range of pfns */
+void p2m_log_dirty_range(struct domain *d, unsigned long begin_pfn,
+                         unsigned long nr, uint8_t *dirty_bitmap);
+
 #endif /* _XEN_ASM_X86_P2M_H */
 
 /*
diff --git a/xen/arch/x86/include/asm/paging.h b/xen/arch/x86/include/asm/paging.h
index 768b077ebd..1b0694bb36 100644
--- a/xen/arch/x86/include/asm/paging.h
+++ b/xen/arch/x86/include/asm/paging.h
@@ -133,13 +133,20 @@ struct paging_mode {
     (DIV_ROUND_UP(PADDR_BITS - PAGE_SHIFT - (PAGE_SHIFT + 3), \
                   PAGE_SHIFT - ilog2(sizeof(mfn_t))) + 1)
 
-#if PG_log_dirty
+#ifdef CONFIG_HVM
+/* VRAM dirty tracking support */
+struct sh_dirty_vram {
+    unsigned long begin_pfn;
+    unsigned long end_pfn;
+#ifdef CONFIG_SHADOW_PAGING
+    paddr_t *sl1ma;
+    uint8_t *dirty_bitmap;
+    s_time_t last_dirty;
+#endif
+};
+#endif
 
-/* get the dirty bitmap for a specific range of pfns */
-void paging_log_dirty_range(struct domain *d,
-                            unsigned long begin_pfn,
-                            unsigned long nr,
-                            uint8_t *dirty_bitmap);
+#if PG_log_dirty
 
 /* log dirty initialization */
 void paging_log_dirty_init(struct domain *d, const struct log_dirty_ops *ops);
@@ -171,19 +178,6 @@ bool paging_mfn_is_dirty(const struct domain *d, mfn_t gmfn);
 #define L4_LOGDIRTY_IDX(pfn) ((pfn_x(pfn) >> (PAGE_SHIFT + 3 + PAGETABLE_ORDER * 2)) & \
                               (LOGDIRTY_NODE_ENTRIES-1))
 
-#ifdef CONFIG_HVM
-/* VRAM dirty tracking support */
-struct sh_dirty_vram {
-    unsigned long begin_pfn;
-    unsigned long end_pfn;
-#ifdef CONFIG_SHADOW_PAGING
-    paddr_t *sl1ma;
-    uint8_t *dirty_bitmap;
-    s_time_t last_dirty;
-#endif
-};
-#endif
-
 #else /* !PG_log_dirty */
 
 static inline void paging_log_dirty_init(struct domain *d,
diff --git a/xen/arch/x86/mm/hap/hap.c b/xen/arch/x86/mm/hap/hap.c
index 4aec98109d..2f69ff9c7b 100644
--- a/xen/arch/x86/mm/hap/hap.c
+++ b/xen/arch/x86/mm/hap/hap.c
@@ -42,7 +42,7 @@
  * Create a dirty vram range on demand when some [begin_pfn:begin_pfn+nr] is
  * first encountered.
  * Collect the guest_dirty bitmask, a bit mask of the dirty vram pages, by
- * calling paging_log_dirty_range(), which interrogates each vram
+ * calling p2m_log_dirty_range(), which interrogates each vram
  * page's p2m type looking for pages that have been made writable.
  */
 
@@ -119,7 +119,7 @@ int hap_track_dirty_vram(struct domain *d,
             p2m_flush_hardware_cached_dirty(d);
 
             /* get the bitmap */
-            paging_log_dirty_range(d, begin_pfn, nr_frames, dirty_bitmap);
+            p2m_log_dirty_range(d, begin_pfn, nr_frames, dirty_bitmap);
 
             domain_unpause(d);
         }
diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index e802f2e4e6..e2a00a0efd 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -2161,6 +2161,34 @@ int relinquish_p2m_mapping(struct domain *d)
     return rc;
 }
 
+void p2m_log_dirty_range(struct domain *d, unsigned long begin_pfn,
+                         unsigned long nr, uint8_t *dirty_bitmap)
+{
+    struct p2m_domain *p2m = p2m_get_hostp2m(d);
+    unsigned int i;
+    unsigned long pfn;
+
+    /*
+     * Set l1e entries of P2M table to be read-only.
+     *
+     * On first write, it page faults, its entry is changed to read-write,
+     * and on retry the write succeeds.
+     *
+     * We populate dirty_bitmap by looking for entries that have been
+     * switched to read-write.
+     */
+
+    p2m_lock(p2m);
+
+    for ( i = 0, pfn = begin_pfn; pfn < begin_pfn + nr; i++, pfn++ )
+        if ( !p2m_change_type_one(d, pfn, p2m_ram_rw, p2m_ram_logdirty) )
+            dirty_bitmap[i >> 3] |= (1 << (i & 7));
+
+    p2m_unlock(p2m);
+
+    guest_flush_tlb_mask(d, d->dirty_cpumask);
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/xen/arch/x86/mm/paging.c b/xen/arch/x86/mm/paging.c
index 3aafb0990b..65455a6867 100644
--- a/xen/arch/x86/mm/paging.c
+++ b/xen/arch/x86/mm/paging.c
@@ -583,38 +583,6 @@ static int paging_log_dirty_op(struct domain *d,
     return rv;
 }
 
-#ifdef CONFIG_HVM
-void paging_log_dirty_range(struct domain *d,
-                           unsigned long begin_pfn,
-                           unsigned long nr,
-                           uint8_t *dirty_bitmap)
-{
-    struct p2m_domain *p2m = p2m_get_hostp2m(d);
-    int i;
-    unsigned long pfn;
-
-    /*
-     * Set l1e entries of P2M table to be read-only.
-     *
-     * On first write, it page faults, its entry is changed to read-write,
-     * and on retry the write succeeds.
-     *
-     * We populate dirty_bitmap by looking for entries that have been
-     * switched to read-write.
-     */
-
-    p2m_lock(p2m);
-
-    for ( i = 0, pfn = begin_pfn; pfn < begin_pfn + nr; i++, pfn++ )
-        if ( !p2m_change_type_one(d, pfn, p2m_ram_rw, p2m_ram_logdirty) )
-            dirty_bitmap[i >> 3] |= (1 << (i & 7));
-
-    p2m_unlock(p2m);
-
-    guest_flush_tlb_mask(d, d->dirty_cpumask);
-}
-#endif
-
 /*
  * Callers must supply log_dirty_ops for the log dirty code to call. This
  * function usually is invoked when paging is enabled. Check shadow_enable()
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Sep 11 12:33:33 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 11 Sep 2025 12:33:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1120212.1465247 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uwgUX-0003TH-DP; Thu, 11 Sep 2025 12:33:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1120212.1465247; Thu, 11 Sep 2025 12: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 1uwgUX-0003T9-AU; Thu, 11 Sep 2025 12:33:33 +0000
Received: by outflank-mailman (input) for mailman id 1120212;
 Thu, 11 Sep 2025 12: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 1uwgUW-0003Sx-6z
 for xen-changelog@lists.xenproject.org; Thu, 11 Sep 2025 12: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 1uwgUW-004sRM-0b
 for xen-changelog@lists.xenproject.org;
 Thu, 11 Sep 2025 12:33:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uwgUW-004Fo2-0U
 for xen-changelog@lists.xenproject.org;
 Thu, 11 Sep 2025 12: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=dIq4lOL03qc+FcYMmBbqPIDRBJ1T4i/Jxv5QWYFrp+0=; b=PST7AIe+fvGIiNaUjdSFjHtgJt
	51I4QZ8eP0EjWblfkDFNkEbIzRTZ2s/HjCWQ87XIcaRikB4TSSr7lc8ZcKAFK9M/QaaMO/iYGd4Aw
	Wspor5MX8QthLJdVgKAyVWOasOuwWniurKGY3C/2fNRvCZ6khPJwRD99gSz1MBLJzGoY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] coverage: add missing include for macro
Message-Id: <E1uwgUW-004Fo2-0U@xenbits.xenproject.org>
Date: Thu, 11 Sep 2025 12:33:32 +0000

commit 16fae1561354f35dd524eb8953385d31eac3ce37
Author:     Victor Lira <victorm.lira@amd.com>
AuthorDate: Thu Sep 11 12:32:47 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Sep 11 12:32:47 2025 +0200

    coverage: add missing include for macro
    
    The missing include prevents it from compiling when CONFIG_COVERAGE is not set
    and the header is included in a file that has not already included errno.h,
    causing EOPNOTSUPP to be undeclared.
    
    Add the missing include and a few blank lines.
    
    Signed-off-by: Victor Lira <victorm.lira@amd.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/include/xen/coverage.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/xen/include/xen/coverage.h b/xen/include/xen/coverage.h
index ba5fb67947..91b0d44625 100644
--- a/xen/include/xen/coverage.h
+++ b/xen/include/xen/coverage.h
@@ -2,13 +2,18 @@
 #define _XEN_COV_H
 
 #ifdef CONFIG_COVERAGE
+
 #include <public/sysctl.h>
 int sysctl_cov_op(struct xen_sysctl_coverage_op *op);
+
 #else
+
+#include <xen/errno.h>
 static inline int sysctl_cov_op(void *unused)
 {
     return -EOPNOTSUPP;
 }
+
 #endif
 
 #endif	/* _XEN_GCOV_H */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Sep 11 13:44:06 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 11 Sep 2025 13:44:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1120312.1465311 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uwhal-0007Ri-IA; Thu, 11 Sep 2025 13:44:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1120312.1465311; Thu, 11 Sep 2025 13: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 1uwhal-0007Ra-FQ; Thu, 11 Sep 2025 13:44:03 +0000
Received: by outflank-mailman (input) for mailman id 1120312;
 Thu, 11 Sep 2025 13: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 1uwhaj-0007RU-W6
 for xen-changelog@lists.xenproject.org; Thu, 11 Sep 2025 13: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 1uwhaj-004tpo-2q
 for xen-changelog@lists.xenproject.org;
 Thu, 11 Sep 2025 13:44:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uwhaj-004K9R-2g
 for xen-changelog@lists.xenproject.org;
 Thu, 11 Sep 2025 13: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=lAc7oiyLm6wuySloHHd10Je67r8wYfsVaIvjP99Lj+0=; b=lkTJD7grnaIAuigwSusloKrv9d
	xbpU7cbLauxxyv2zqh5OZ5An6CSDL2GwIsWvYbF8awYeVXkhn1BAo6exN4S9IbiBaPFIC1x1/iTCV
	flkUjaQ/GwobqVkalW05Ico7xnDSIVEWj+t6RQYGcKs9mOkwYLmVF4e+VuVGKcLs8LRQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/IO-APIC: drop setup_ioapic_ids_from_mpc()
Message-Id: <E1uwhaj-004K9R-2g@xenbits.xenproject.org>
Date: Thu, 11 Sep 2025 13:44:01 +0000

commit 85face437570d7faeb829376328c6245f245306d
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Sep 11 12:31:15 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Sep 11 12:31:15 2025 +0200

    x86/IO-APIC: drop setup_ioapic_ids_from_mpc()
    
    Along the lines of what b89f8f054f96 ("x86/apic: Drop sync_Arb_IDs()")
    said, the function is dead logic as well: All 64-bit capable Intel systems
    have (at least) xAPIC (if not x2APIC).
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Release-Acked-by: Oleksii Kurochko<oleksii.kurochko@gmail.com>
---
 xen/arch/x86/io_apic.c | 119 -------------------------------------------------
 1 file changed, 119 deletions(-)

diff --git a/xen/arch/x86/io_apic.c b/xen/arch/x86/io_apic.c
index 17e6827f4b..3336d16c0e 100644
--- a/xen/arch/x86/io_apic.c
+++ b/xen/arch/x86/io_apic.c
@@ -1458,119 +1458,6 @@ void disable_IO_APIC(void)
     disconnect_bsp_APIC(ioapic_i8259.pin != -1);
 }
 
-/*
- * function to set the IO-APIC physical IDs based on the
- * values stored in the MPC table.
- *
- * by Matt Domsch <Matt_Domsch@dell.com>  Tue Dec 21 12:25:05 CST 1999
- */
-
-static void __init setup_ioapic_ids_from_mpc(void)
-{
-    union IO_APIC_reg_00 reg_00;
-    static physid_mask_t __initdata phys_id_present_map;
-    int apic;
-    int i;
-    unsigned char old_id;
-    unsigned long flags;
-    const uint32_t broadcast_id = 0xf;
-
-    /*
-     * Don't check I/O APIC IDs for xAPIC systems. They have
-     * no meaning without the serial APIC bus.
-     */
-    if (!(boot_cpu_data.x86_vendor == X86_VENDOR_INTEL)
-        || APIC_XAPIC(apic_version[boot_cpu_physical_apicid]))
-        return;
-
-    /*
-     * This is broken; anything with a real cpu count has to
-     * circumvent this idiocy regardless.
-     */
-    phys_id_present_map = phys_cpu_present_map;
-
-    /*
-     * Set the IOAPIC ID to the value stored in the MPC table.
-     */
-    for (apic = 0; apic < nr_ioapics; apic++) {
-        if (!nr_ioapic_entries[apic])
-            continue;
-
-        /* Read the register 0 value */
-        spin_lock_irqsave(&ioapic_lock, flags);
-        reg_00.raw = io_apic_read(apic, 0);
-        spin_unlock_irqrestore(&ioapic_lock, flags);
-		
-        old_id = mp_ioapics[apic].mpc_apicid;
-
-        if (mp_ioapics[apic].mpc_apicid >= broadcast_id) {
-            printk(KERN_ERR "BIOS bug, IO-APIC#%d ID is %d in the MPC table!...\n",
-                   apic, mp_ioapics[apic].mpc_apicid);
-            printk(KERN_ERR "... fixing up to %d. (tell your hw vendor)\n",
-                   reg_00.bits.ID);
-            mp_ioapics[apic].mpc_apicid = reg_00.bits.ID;
-        }
-
-        /*
-         * Sanity check, is the ID really free? Every APIC in a
-         * system must have a unique ID or we get lots of nice
-         * 'stuck on smp_invalidate_needed IPI wait' messages.
-         */
-        if ( physid_isset(mp_ioapics[apic].mpc_apicid, phys_id_present_map) )
-        {
-            printk(KERN_ERR "BIOS bug, IO-APIC#%d ID %d is already used!...\n",
-                   apic, mp_ioapics[apic].mpc_apicid);
-            for (i = 0; i < broadcast_id; i++)
-                if (!physid_isset(i, phys_id_present_map))
-                    break;
-            if (i >= broadcast_id)
-                panic("Max APIC ID exceeded\n");
-            printk(KERN_ERR "... fixing up to %d. (tell your hw vendor)\n",
-                   i);
-            mp_ioapics[apic].mpc_apicid = i;
-        } else {
-            apic_printk(APIC_VERBOSE, "Setting %d in the "
-                        "phys_id_present_map\n",
-                        mp_ioapics[apic].mpc_apicid);
-        }
-        physid_set(mp_ioapics[apic].mpc_apicid, phys_id_present_map);
-
-        /*
-         * We need to adjust the IRQ routing table
-         * if the ID changed.
-         */
-        if (old_id != mp_ioapics[apic].mpc_apicid)
-            for (i = 0; i < mp_irq_entries; i++)
-                if (mp_irqs[i].mpc_dstapic == old_id)
-                    mp_irqs[i].mpc_dstapic
-                        = mp_ioapics[apic].mpc_apicid;
-
-        /*
-         * Read the right value from the MPC table and
-         * write it into the ID register.
-         */
-        apic_printk(APIC_VERBOSE, KERN_INFO
-                    "...changing IO-APIC physical APIC ID to %d ...",
-                    mp_ioapics[apic].mpc_apicid);
-
-        reg_00.bits.ID = mp_ioapics[apic].mpc_apicid;
-        spin_lock_irqsave(&ioapic_lock, flags);
-        io_apic_write(apic, 0, reg_00.raw);
-        spin_unlock_irqrestore(&ioapic_lock, flags);
-
-        /*
-         * Sanity check
-         */
-        spin_lock_irqsave(&ioapic_lock, flags);
-        reg_00.raw = io_apic_read(apic, 0);
-        spin_unlock_irqrestore(&ioapic_lock, flags);
-        if (reg_00.bits.ID != mp_ioapics[apic].mpc_apicid)
-            printk("could not set ID!\n");
-        else
-            apic_printk(APIC_VERBOSE, " ok.\n");
-    }
-}
-
 /*
  * There is a nasty bug in some older SMP boards, their mptable lies
  * about the timer IRQ. We do the following to work around the situation:
@@ -2158,12 +2045,6 @@ void __init setup_IO_APIC(void)
         ioapic_level_type.end = end_level_ioapic_irq_new;
     }
 
-    /*
-     * Set up IO-APIC IRQ routing.
-     */
-    if (!acpi_ioapic)
-        setup_ioapic_ids_from_mpc();
-
     setup_IO_APIC_irqs();
     init_IO_APIC_traps();
     check_timer();
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Sep 11 13:44:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 11 Sep 2025 13:44:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1120313.1465315 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uwhav-0007Tv-Ks; Thu, 11 Sep 2025 13:44:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1120313.1465315; Thu, 11 Sep 2025 13: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 1uwhav-0007Tn-I8; Thu, 11 Sep 2025 13:44:13 +0000
Received: by outflank-mailman (input) for mailman id 1120313;
 Thu, 11 Sep 2025 13: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 1uwhau-0007Ta-2B
 for xen-changelog@lists.xenproject.org; Thu, 11 Sep 2025 13: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 1uwhau-004tpv-07
 for xen-changelog@lists.xenproject.org;
 Thu, 11 Sep 2025 13:44:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uwhat-004KAe-31
 for xen-changelog@lists.xenproject.org;
 Thu, 11 Sep 2025 13: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=EVDKJFi0+JvgFG2bjcNi9dArFjeu5JFGbfly3CMUxQY=; b=uuAGFa9246q509gvpTW9eLkPZl
	oIYSN9JBA5BZO9C1J3gXSeGUdFCnnPKAMXqygoDGYR0MDgb42pjpZ0Tpj+WvdFq+qPiJeRK9FSL3F
	962wr4+gIuD9TwdluxwIWCHczVVKOpbWj/CoiiFcHNfBmq+joJeWrczsfeOTE187ofmA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/IO-APIC: drop io_apic_get_unique_id()
Message-Id: <E1uwhat-004KAe-31@xenbits.xenproject.org>
Date: Thu, 11 Sep 2025 13:44:11 +0000

commit 624ae9ff96f6e64d0b523ba0f34838fed6d35614
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Sep 11 12:31:37 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Sep 11 12:31:37 2025 +0200

    x86/IO-APIC: drop io_apic_get_unique_id()
    
    Along the lines of what b89f8f054f96 ("x86/apic: Drop sync_Arb_IDs()")
    said, the function is dead logic as well: All 64-bit capable Intel systems
    have (at least) xAPIC (if not x2APIC).
    
    As this removes the last user of APIC_XAPIC(), remove the macro as well.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Release-Acked-by: Oleksii Kurochko<oleksii.kurochko@gmail.com>
---
 xen/arch/x86/include/asm/apicdef.h |  1 -
 xen/arch/x86/include/asm/io_apic.h |  1 -
 xen/arch/x86/io_apic.c             | 80 --------------------------------------
 xen/arch/x86/mpparse.c             | 12 +-----
 4 files changed, 1 insertion(+), 93 deletions(-)

diff --git a/xen/arch/x86/include/asm/apicdef.h b/xen/arch/x86/include/asm/apicdef.h
index 63dab01dde..112c1dc613 100644
--- a/xen/arch/x86/include/asm/apicdef.h
+++ b/xen/arch/x86/include/asm/apicdef.h
@@ -19,7 +19,6 @@
 #define			APIC_LVR_DIRECTED_EOI	(1 << 24)
 #define			GET_APIC_VERSION(x)	((x)&0xFF)
 #define			GET_APIC_MAXLVT(x)	(((x)>>16)&0xFF)
-#define			APIC_XAPIC(x)		((x) >= 0x14)
 #define		APIC_TASKPRI	0x80
 #define			APIC_TPRI_MASK		0xFF
 #define		APIC_ARBPRI	0x90
diff --git a/xen/arch/x86/include/asm/io_apic.h b/xen/arch/x86/include/asm/io_apic.h
index 62456806c7..4680dce9e1 100644
--- a/xen/arch/x86/include/asm/io_apic.h
+++ b/xen/arch/x86/include/asm/io_apic.h
@@ -184,7 +184,6 @@ extern bool skip_ioapic_setup;
 extern bool ioapic_ack_new;
 extern bool ioapic_ack_forced;
 
-extern int io_apic_get_unique_id (int ioapic, int apic_id);
 extern int io_apic_get_version (int ioapic);
 extern int io_apic_get_redir_entries (int ioapic);
 extern int io_apic_set_pci_routing (int ioapic, int pin, int irq, int edge_level, int active_high_low);
diff --git a/xen/arch/x86/io_apic.c b/xen/arch/x86/io_apic.c
index 3336d16c0e..c384f10c1b 100644
--- a/xen/arch/x86/io_apic.c
+++ b/xen/arch/x86/io_apic.c
@@ -2092,86 +2092,6 @@ void ioapic_resume(void)
     spin_unlock_irqrestore(&ioapic_lock, flags);
 }
 
-/* --------------------------------------------------------------------------
-                          ACPI-based IOAPIC Configuration
-   -------------------------------------------------------------------------- */
-
-
-int __init io_apic_get_unique_id (int ioapic, int apic_id)
-{
-    union IO_APIC_reg_00 reg_00;
-    static physid_mask_t __initdata apic_id_map = PHYSID_MASK_NONE;
-    unsigned long flags;
-    int i = 0;
-    const uint32_t broadcast_id = 0xf;
-
-    /*
-     * The P4 platform supports up to 256 APIC IDs on two separate APIC 
-     * buses (one for LAPICs, one for IOAPICs), where predecessors only 
-     * supports up to 16 on one shared APIC bus.
-     * 
-     * TBD: Expand LAPIC/IOAPIC support on P4-class systems to take full
-     *      advantage of new APIC bus architecture.
-     */
-
-    if (physids_empty(apic_id_map))
-        apic_id_map = phys_cpu_present_map;
-
-    spin_lock_irqsave(&ioapic_lock, flags);
-    reg_00.raw = io_apic_read(ioapic, 0);
-    spin_unlock_irqrestore(&ioapic_lock, flags);
-
-    if (apic_id >= broadcast_id) {
-        printk(KERN_WARNING "IOAPIC[%d]: Invalid apic_id %d, trying "
-               "%d\n", ioapic, apic_id, reg_00.bits.ID);
-        apic_id = reg_00.bits.ID;
-    }
-
-    /*
-     * Every APIC in a system must have a unique ID or we get lots of nice 
-     * 'stuck on smp_invalidate_needed IPI wait' messages.
-     */
-    if ( physid_isset(apic_id, apic_id_map) )
-    {
-
-        for (i = 0; i < broadcast_id; i++) {
-            if ( !physid_isset(i, apic_id_map) )
-                break;
-        }
-
-        if (i == broadcast_id)
-            panic("Max apic_id exceeded\n");
-
-        printk(KERN_WARNING "IOAPIC[%d]: apic_id %d already used, "
-               "trying %d\n", ioapic, apic_id, i);
-
-        apic_id = i;
-    } 
-
-    physid_set(apic_id, apic_id_map);
-
-    if (reg_00.bits.ID != apic_id) {
-        reg_00.bits.ID = apic_id;
-
-        spin_lock_irqsave(&ioapic_lock, flags);
-        io_apic_write(ioapic, 0, reg_00.raw);
-        reg_00.raw = io_apic_read(ioapic, 0);
-        spin_unlock_irqrestore(&ioapic_lock, flags);
-
-        /* Sanity check */
-        if (reg_00.bits.ID != apic_id) {
-            printk("IOAPIC[%d]: Unable to change apic_id!\n", ioapic);
-            return -1;
-        }
-    }
-
-    apic_printk(APIC_VERBOSE, KERN_INFO
-                "IOAPIC[%d]: Assigned apic_id %d\n", ioapic, apic_id);
-
-    return apic_id;
-}
-
-
 int __init io_apic_get_version (int ioapic)
 {
     union IO_APIC_reg_01	reg_01;
diff --git a/xen/arch/x86/mpparse.c b/xen/arch/x86/mpparse.c
index e74a714f50..c1171f7a3a 100644
--- a/xen/arch/x86/mpparse.c
+++ b/xen/arch/x86/mpparse.c
@@ -871,7 +871,6 @@ void __init mp_register_ioapic (
 	u32			gsi_base)
 {
 	int			idx = 0;
-	int			tmpid;
 
 	if (nr_ioapics >= MAX_IO_APICS) {
 		printk(KERN_ERR "ERROR: Max # of I/O APICs (%d) exceeded "
@@ -891,16 +890,7 @@ void __init mp_register_ioapic (
 	mp_ioapics[idx].mpc_apicaddr = address;
 
 	set_fixmap_nocache(FIX_IO_APIC_BASE_0 + idx, address);
-	if ((boot_cpu_data.x86_vendor == X86_VENDOR_INTEL)
-		&& !APIC_XAPIC(apic_version[boot_cpu_physical_apicid]))
-		tmpid = io_apic_get_unique_id(idx, id);
-	else
-		tmpid = id;
-	if (tmpid == -1) {
-		nr_ioapics--;
-		return;
-	}
-	mp_ioapics[idx].mpc_apicid = tmpid;
+	mp_ioapics[idx].mpc_apicid = id;
 	mp_ioapics[idx].mpc_apicver = io_apic_get_version(idx);
 	
 	/* 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Sep 11 13:44:23 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 11 Sep 2025 13:44:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1120314.1465319 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uwhb5-0007W0-MO; Thu, 11 Sep 2025 13:44:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1120314.1465319; Thu, 11 Sep 2025 13: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 1uwhb5-0007Vs-JV; Thu, 11 Sep 2025 13:44:23 +0000
Received: by outflank-mailman (input) for mailman id 1120314;
 Thu, 11 Sep 2025 13: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 1uwhb4-0007Vk-5G
 for xen-changelog@lists.xenproject.org; Thu, 11 Sep 2025 13: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 1uwhb4-004tq0-0P
 for xen-changelog@lists.xenproject.org;
 Thu, 11 Sep 2025 13:44:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uwhb4-004KBu-0J
 for xen-changelog@lists.xenproject.org;
 Thu, 11 Sep 2025 13: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=+5TlP2ZGJtPSqMGc7k34n9Sml7N53dc29G/h5Ig4/sA=; b=qLngxRC+zC+xbD1NltjJ8pTuEJ
	iAoodmEdbDXgkE+qMn+ect+y3+NBRZwTvk/XmcylSxKzMN0WxOlGqmPjHIFgAeAQvfHXZc377r+L2
	Pz1wxiliMIyI6bKF2Vo0c07DPNGrGihEbwH8CudeSfkFh9xZwVh/ktGlXO1C0/TLgO9g=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/x86: consolidate vram tracking support
Message-Id: <E1uwhb4-004KBu-0J@xenbits.xenproject.org>
Date: Thu, 11 Sep 2025 13:44:22 +0000

commit 240bde75cbe6e5de38b5ca1d3da26b4a7f511727
Author:     Penny Zheng <Penny.Zheng@amd.com>
AuthorDate: Thu Sep 11 12:32:04 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Sep 11 12:32:04 2025 +0200

    xen/x86: consolidate vram tracking support
    
    Flag PG_log_dirty is for paging log dirty support, not vram tracking support.
    However data structure sh_dirty_vram{} and function paging_log_dirty_range()
    designed for vram tracking support, are guarded with PG_log_dirty.
    We release both from PG_log_dirty, and also move paging_log_dirty_range(),
    remamed with p2m_log_dirty_range(), into p2m.c, where it logically belongs.
    
    Signed-off-by: Penny Zheng <Penny.Zheng@amd.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/include/asm/p2m.h    |  4 ++++
 xen/arch/x86/include/asm/paging.h | 32 +++++++++++++-------------------
 xen/arch/x86/mm/hap/hap.c         |  4 ++--
 xen/arch/x86/mm/p2m.c             | 28 ++++++++++++++++++++++++++++
 xen/arch/x86/mm/paging.c          | 32 --------------------------------
 5 files changed, 47 insertions(+), 53 deletions(-)

diff --git a/xen/arch/x86/include/asm/p2m.h b/xen/arch/x86/include/asm/p2m.h
index 3b860e30c3..9016e88411 100644
--- a/xen/arch/x86/include/asm/p2m.h
+++ b/xen/arch/x86/include/asm/p2m.h
@@ -1110,6 +1110,10 @@ static inline int p2m_entry_modify(struct p2m_domain *p2m, p2m_type_t nt,
 
 #endif /* CONFIG_HVM */
 
+/* Get the dirty bitmap for a specific range of pfns */
+void p2m_log_dirty_range(struct domain *d, unsigned long begin_pfn,
+                         unsigned long nr, uint8_t *dirty_bitmap);
+
 #endif /* _XEN_ASM_X86_P2M_H */
 
 /*
diff --git a/xen/arch/x86/include/asm/paging.h b/xen/arch/x86/include/asm/paging.h
index 768b077ebd..1b0694bb36 100644
--- a/xen/arch/x86/include/asm/paging.h
+++ b/xen/arch/x86/include/asm/paging.h
@@ -133,13 +133,20 @@ struct paging_mode {
     (DIV_ROUND_UP(PADDR_BITS - PAGE_SHIFT - (PAGE_SHIFT + 3), \
                   PAGE_SHIFT - ilog2(sizeof(mfn_t))) + 1)
 
-#if PG_log_dirty
+#ifdef CONFIG_HVM
+/* VRAM dirty tracking support */
+struct sh_dirty_vram {
+    unsigned long begin_pfn;
+    unsigned long end_pfn;
+#ifdef CONFIG_SHADOW_PAGING
+    paddr_t *sl1ma;
+    uint8_t *dirty_bitmap;
+    s_time_t last_dirty;
+#endif
+};
+#endif
 
-/* get the dirty bitmap for a specific range of pfns */
-void paging_log_dirty_range(struct domain *d,
-                            unsigned long begin_pfn,
-                            unsigned long nr,
-                            uint8_t *dirty_bitmap);
+#if PG_log_dirty
 
 /* log dirty initialization */
 void paging_log_dirty_init(struct domain *d, const struct log_dirty_ops *ops);
@@ -171,19 +178,6 @@ bool paging_mfn_is_dirty(const struct domain *d, mfn_t gmfn);
 #define L4_LOGDIRTY_IDX(pfn) ((pfn_x(pfn) >> (PAGE_SHIFT + 3 + PAGETABLE_ORDER * 2)) & \
                               (LOGDIRTY_NODE_ENTRIES-1))
 
-#ifdef CONFIG_HVM
-/* VRAM dirty tracking support */
-struct sh_dirty_vram {
-    unsigned long begin_pfn;
-    unsigned long end_pfn;
-#ifdef CONFIG_SHADOW_PAGING
-    paddr_t *sl1ma;
-    uint8_t *dirty_bitmap;
-    s_time_t last_dirty;
-#endif
-};
-#endif
-
 #else /* !PG_log_dirty */
 
 static inline void paging_log_dirty_init(struct domain *d,
diff --git a/xen/arch/x86/mm/hap/hap.c b/xen/arch/x86/mm/hap/hap.c
index 4aec98109d..2f69ff9c7b 100644
--- a/xen/arch/x86/mm/hap/hap.c
+++ b/xen/arch/x86/mm/hap/hap.c
@@ -42,7 +42,7 @@
  * Create a dirty vram range on demand when some [begin_pfn:begin_pfn+nr] is
  * first encountered.
  * Collect the guest_dirty bitmask, a bit mask of the dirty vram pages, by
- * calling paging_log_dirty_range(), which interrogates each vram
+ * calling p2m_log_dirty_range(), which interrogates each vram
  * page's p2m type looking for pages that have been made writable.
  */
 
@@ -119,7 +119,7 @@ int hap_track_dirty_vram(struct domain *d,
             p2m_flush_hardware_cached_dirty(d);
 
             /* get the bitmap */
-            paging_log_dirty_range(d, begin_pfn, nr_frames, dirty_bitmap);
+            p2m_log_dirty_range(d, begin_pfn, nr_frames, dirty_bitmap);
 
             domain_unpause(d);
         }
diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index e802f2e4e6..e2a00a0efd 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -2161,6 +2161,34 @@ int relinquish_p2m_mapping(struct domain *d)
     return rc;
 }
 
+void p2m_log_dirty_range(struct domain *d, unsigned long begin_pfn,
+                         unsigned long nr, uint8_t *dirty_bitmap)
+{
+    struct p2m_domain *p2m = p2m_get_hostp2m(d);
+    unsigned int i;
+    unsigned long pfn;
+
+    /*
+     * Set l1e entries of P2M table to be read-only.
+     *
+     * On first write, it page faults, its entry is changed to read-write,
+     * and on retry the write succeeds.
+     *
+     * We populate dirty_bitmap by looking for entries that have been
+     * switched to read-write.
+     */
+
+    p2m_lock(p2m);
+
+    for ( i = 0, pfn = begin_pfn; pfn < begin_pfn + nr; i++, pfn++ )
+        if ( !p2m_change_type_one(d, pfn, p2m_ram_rw, p2m_ram_logdirty) )
+            dirty_bitmap[i >> 3] |= (1 << (i & 7));
+
+    p2m_unlock(p2m);
+
+    guest_flush_tlb_mask(d, d->dirty_cpumask);
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/xen/arch/x86/mm/paging.c b/xen/arch/x86/mm/paging.c
index 3aafb0990b..65455a6867 100644
--- a/xen/arch/x86/mm/paging.c
+++ b/xen/arch/x86/mm/paging.c
@@ -583,38 +583,6 @@ static int paging_log_dirty_op(struct domain *d,
     return rv;
 }
 
-#ifdef CONFIG_HVM
-void paging_log_dirty_range(struct domain *d,
-                           unsigned long begin_pfn,
-                           unsigned long nr,
-                           uint8_t *dirty_bitmap)
-{
-    struct p2m_domain *p2m = p2m_get_hostp2m(d);
-    int i;
-    unsigned long pfn;
-
-    /*
-     * Set l1e entries of P2M table to be read-only.
-     *
-     * On first write, it page faults, its entry is changed to read-write,
-     * and on retry the write succeeds.
-     *
-     * We populate dirty_bitmap by looking for entries that have been
-     * switched to read-write.
-     */
-
-    p2m_lock(p2m);
-
-    for ( i = 0, pfn = begin_pfn; pfn < begin_pfn + nr; i++, pfn++ )
-        if ( !p2m_change_type_one(d, pfn, p2m_ram_rw, p2m_ram_logdirty) )
-            dirty_bitmap[i >> 3] |= (1 << (i & 7));
-
-    p2m_unlock(p2m);
-
-    guest_flush_tlb_mask(d, d->dirty_cpumask);
-}
-#endif
-
 /*
  * Callers must supply log_dirty_ops for the log dirty code to call. This
  * function usually is invoked when paging is enabled. Check shadow_enable()
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Sep 11 13:44:33 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 11 Sep 2025 13:44:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1120315.1465323 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uwhbF-0007YW-Na; Thu, 11 Sep 2025 13:44:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1120315.1465323; Thu, 11 Sep 2025 13: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 1uwhbF-0007YK-Kr; Thu, 11 Sep 2025 13:44:33 +0000
Received: by outflank-mailman (input) for mailman id 1120315;
 Thu, 11 Sep 2025 13: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 1uwhbE-0007Y8-9P
 for xen-changelog@lists.xenproject.org; Thu, 11 Sep 2025 13: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 1uwhbE-004tqN-0f
 for xen-changelog@lists.xenproject.org;
 Thu, 11 Sep 2025 13:44:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uwhbE-004KD5-0a
 for xen-changelog@lists.xenproject.org;
 Thu, 11 Sep 2025 13: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=NI6WC0sSpxU+4SwCvx/ifHYOn2x+KSpbdXGefUBMtRk=; b=ZkihZ5qJNZGOVbOmRTaLyFHhHi
	gWeydfTu2u+QuBMYOO84DuYLbzwAG6lL03kQmijUMmyu4KJM8IvD2H/nlXUSIHMmfNVVZImNJDaRn
	3O86CrVDLgdDHOpgvEyDOnKjWa0fdBqb5Dm3EKzx2H2eilY1DUj+T40SRNFSMQWGiizw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] coverage: add missing include for macro
Message-Id: <E1uwhbE-004KD5-0a@xenbits.xenproject.org>
Date: Thu, 11 Sep 2025 13:44:32 +0000

commit 16fae1561354f35dd524eb8953385d31eac3ce37
Author:     Victor Lira <victorm.lira@amd.com>
AuthorDate: Thu Sep 11 12:32:47 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Sep 11 12:32:47 2025 +0200

    coverage: add missing include for macro
    
    The missing include prevents it from compiling when CONFIG_COVERAGE is not set
    and the header is included in a file that has not already included errno.h,
    causing EOPNOTSUPP to be undeclared.
    
    Add the missing include and a few blank lines.
    
    Signed-off-by: Victor Lira <victorm.lira@amd.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/include/xen/coverage.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/xen/include/xen/coverage.h b/xen/include/xen/coverage.h
index ba5fb67947..91b0d44625 100644
--- a/xen/include/xen/coverage.h
+++ b/xen/include/xen/coverage.h
@@ -2,13 +2,18 @@
 #define _XEN_COV_H
 
 #ifdef CONFIG_COVERAGE
+
 #include <public/sysctl.h>
 int sysctl_cov_op(struct xen_sysctl_coverage_op *op);
+
 #else
+
+#include <xen/errno.h>
 static inline int sysctl_cov_op(void *unused)
 {
     return -EOPNOTSUPP;
 }
+
 #endif
 
 #endif	/* _XEN_GCOV_H */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Sep 12 06:55:06 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 12 Sep 2025 06:55:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1121463.1465740 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uwxgV-0002IN-6L; Fri, 12 Sep 2025 06:55:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1121463.1465740; Fri, 12 Sep 2025 06: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 1uwxgV-0002IF-3a; Fri, 12 Sep 2025 06:55:03 +0000
Received: by outflank-mailman (input) for mailman id 1121463;
 Fri, 12 Sep 2025 06: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 1uwxgT-0002I9-UB
 for xen-changelog@lists.xenproject.org; Fri, 12 Sep 2025 06: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 1uwxgT-006MPl-2a
 for xen-changelog@lists.xenproject.org;
 Fri, 12 Sep 2025 06:55:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uwxgT-005Ixr-2S
 for xen-changelog@lists.xenproject.org;
 Fri, 12 Sep 2025 06: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=YQtmW5kFL3FpvztgZvE8IEvPAGdeejJECDpAMhEAzpY=; b=hZ4zS659jIKQRQuA/azuS71goZ
	v8VZ5DumYE+NsudlkICkhl6tqG7OjqwSb8DQPocIjXXVlIFpzV+8yr2PtiaC6PBNWFIzJ22QeawnG
	y8qGELMAI32oplk1tXfLVU9hLdah8V87aiYXjuisVL1il15n8RhAP8GjYwpZvYr88ynQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86: Fix AMD_SVM and INTEL_VMX dependency
Message-Id: <E1uwxgT-005Ixr-2S@xenbits.xenproject.org>
Date: Fri, 12 Sep 2025 06:55:01 +0000

commit b99227347230281699b5d8b5e677829f91c6e199
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Tue Sep 2 09:40:48 2025 +0200
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Fri Sep 12 08:48:28 2025 +0200

    x86: Fix AMD_SVM and INTEL_VMX dependency
    
    Commit e3ed540f2e9f was meant to make AMD_SVM dependent on AMD and
    INTEL_VMX on INTEL. This dependency was reflected using 'if' next to a
    prompt which is incorrect as it that deals only with the visibility of the
    given Kconfig option. This makes it impossible to e.g. disable INTEL_VMX
    when INTEL is disabled (option is hidden). Fix it while keeping the
    possibility of e.g. enabling INTEL_VMX when INTEL is disabled.
    
    Fixes: e3ed540f2e9f ("x86/hvm: add HVM-specific Kconfig")
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/Kconfig | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/hvm/Kconfig b/xen/arch/x86/hvm/Kconfig
index b903764bda..5cb9f29042 100644
--- a/xen/arch/x86/hvm/Kconfig
+++ b/xen/arch/x86/hvm/Kconfig
@@ -16,8 +16,8 @@ menuconfig HVM
 if HVM
 
 config AMD_SVM
-	bool "AMD-V" if AMD && EXPERT
-	default y
+	bool "AMD-V" if EXPERT
+	default AMD
 	help
 	  Enables virtual machine extensions on platforms that implement the
 	  AMD Virtualization Technology (AMD-V).
@@ -25,8 +25,8 @@ config AMD_SVM
 	  If in doubt, say Y.
 
 config INTEL_VMX
-	bool "Intel VT-x" if INTEL && EXPERT
-	default y
+	bool "Intel VT-x" if EXPERT
+	default INTEL
 	select ARCH_VCPU_IOREQ_COMPLETION
 	help
 	  Enables virtual machine extensions on platforms that implement the
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Sep 12 08:11:06 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 12 Sep 2025 08:11:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1121605.1465804 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uwys3-0007MU-UE; Fri, 12 Sep 2025 08:11:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1121605.1465804; Fri, 12 Sep 2025 08: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 1uwys3-0007ML-Rd; Fri, 12 Sep 2025 08:11:03 +0000
Received: by outflank-mailman (input) for mailman id 1121605;
 Fri, 12 Sep 2025 08: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 1uwys2-0007MF-68
 for xen-changelog@lists.xenproject.org; Fri, 12 Sep 2025 08: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 1uwys2-006OIS-0N
 for xen-changelog@lists.xenproject.org;
 Fri, 12 Sep 2025 08:11:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uwys2-005OU3-0G
 for xen-changelog@lists.xenproject.org;
 Fri, 12 Sep 2025 08: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=8R5u9Qh9RooNwmSWO4KCHS7hWABtwrL8uTq9TTqG6Hc=; b=z84FNtXyKu3nUc0G5ui9FXsAL9
	4tLKRVkUFBY6Zpgk0h2c9l7ipIN4eD/tEtXlbMTCf98dxwp4VzymmNoxdpWWa8lLAcwY+5MQc8cKX
	zC4okXp0lIc/AwueAtVrIeAFW0EW/LqbWw2DyewBa3xK+08STeXrzBpFjYz+T8/RWmcI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86: Fix AMD_SVM and INTEL_VMX dependency
Message-Id: <E1uwys2-005OU3-0G@xenbits.xenproject.org>
Date: Fri, 12 Sep 2025 08:11:02 +0000

commit b99227347230281699b5d8b5e677829f91c6e199
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Tue Sep 2 09:40:48 2025 +0200
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Fri Sep 12 08:48:28 2025 +0200

    x86: Fix AMD_SVM and INTEL_VMX dependency
    
    Commit e3ed540f2e9f was meant to make AMD_SVM dependent on AMD and
    INTEL_VMX on INTEL. This dependency was reflected using 'if' next to a
    prompt which is incorrect as it that deals only with the visibility of the
    given Kconfig option. This makes it impossible to e.g. disable INTEL_VMX
    when INTEL is disabled (option is hidden). Fix it while keeping the
    possibility of e.g. enabling INTEL_VMX when INTEL is disabled.
    
    Fixes: e3ed540f2e9f ("x86/hvm: add HVM-specific Kconfig")
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/Kconfig | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/hvm/Kconfig b/xen/arch/x86/hvm/Kconfig
index b903764bda..5cb9f29042 100644
--- a/xen/arch/x86/hvm/Kconfig
+++ b/xen/arch/x86/hvm/Kconfig
@@ -16,8 +16,8 @@ menuconfig HVM
 if HVM
 
 config AMD_SVM
-	bool "AMD-V" if AMD && EXPERT
-	default y
+	bool "AMD-V" if EXPERT
+	default AMD
 	help
 	  Enables virtual machine extensions on platforms that implement the
 	  AMD Virtualization Technology (AMD-V).
@@ -25,8 +25,8 @@ config AMD_SVM
 	  If in doubt, say Y.
 
 config INTEL_VMX
-	bool "Intel VT-x" if INTEL && EXPERT
-	default y
+	bool "Intel VT-x" if EXPERT
+	default INTEL
 	select ARCH_VCPU_IOREQ_COMPLETION
 	help
 	  Enables virtual machine extensions on platforms that implement the
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Sep 13 00:11:07 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 13 Sep 2025 00:11:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1122869.1466308 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uxDr5-0007e8-8u; Sat, 13 Sep 2025 00:11:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1122869.1466308; Sat, 13 Sep 2025 00: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 1uxDr5-0007dz-61; Sat, 13 Sep 2025 00:11:03 +0000
Received: by outflank-mailman (input) for mailman id 1122869;
 Sat, 13 Sep 2025 00: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 1uxDr4-0007dt-65
 for xen-changelog@lists.xenproject.org; Sat, 13 Sep 2025 00: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 1uxDr4-006hb0-0Q
 for xen-changelog@lists.xenproject.org;
 Sat, 13 Sep 2025 00:11:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uxDr4-006JKZ-0J
 for xen-changelog@lists.xenproject.org;
 Sat, 13 Sep 2025 00: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=9zB7bs67ImMDA99MCGKOAkaVCP+mNKs/ucaAQyNx0to=; b=hGjfLdNxCsilivUJ4ifl2QHsuB
	xvCO8/JjilhY7Kzc+JLdoQdDEE64TM+EDQtRrF+zKOyUXxst2F4JuxCNojS02UbDk7pCbiSHb3vYQ
	PVF23ZKG028jkK0AVYeSjYSvh77lmjyNiQlcZcid8YJXc1r+Lh0/MtOdszLMTJ68txCE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] CI: Use the Debian Trixie container for RISC-V test jobs
Message-Id: <E1uxDr4-006JKZ-0J@xenbits.xenproject.org>
Date: Sat, 13 Sep 2025 00:11:02 +0000

commit 80a7a325bdea365931245d5284371021eb3b097c
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Sep 11 15:47:31 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Sat Sep 13 01:02:28 2025 +0100

    CI: Use the Debian Trixie container for RISC-V test jobs
    
    This was missed when introducing Trixie.
    
    Fixes: aad6ebf0596f ("CI: Update riscv64 to use Debian Trixie")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Denis Mukhin <dmukhin@ford.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/gitlab-ci/test.yaml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/automation/gitlab-ci/test.yaml b/automation/gitlab-ci/test.yaml
index 95b883b32b..1de68a0fe4 100644
--- a/automation/gitlab-ci/test.yaml
+++ b/automation/gitlab-ci/test.yaml
@@ -77,7 +77,7 @@
 .qemu-riscv64:
   extends: .test-jobs-common
   variables:
-    CONTAINER: debian:12-riscv64
+    CONTAINER: debian:13-riscv64
     LOGFILE: qemu-smoke-riscv64.log
   artifacts:
     paths:
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Sat Sep 13 00:11:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 13 Sep 2025 00:11:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1122870.1466313 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uxDrF-0007fy-Ae; Sat, 13 Sep 2025 00:11:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1122870.1466313; Sat, 13 Sep 2025 00: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 1uxDrF-0007fp-7Y; Sat, 13 Sep 2025 00:11:13 +0000
Received: by outflank-mailman (input) for mailman id 1122870;
 Sat, 13 Sep 2025 00: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 1uxDrE-0007fh-8f
 for xen-changelog@lists.xenproject.org; Sat, 13 Sep 2025 00: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 1uxDrE-006hb4-0k
 for xen-changelog@lists.xenproject.org;
 Sat, 13 Sep 2025 00:11:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uxDrE-006JLO-0c
 for xen-changelog@lists.xenproject.org;
 Sat, 13 Sep 2025 00: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=u9CBy7k1tXLF9UoQV5F0DKcKnXMnha+625neJph2nN0=; b=X/S2MWnsh1hfwqxpF7fMdCzs/u
	KNpJCiNQrUKJ1bbs7UUXeVdaEt9y63x06dprgEEsfBYFXrGkZ3wzuKPtPly3WNBc6ukzSQjOF0JBc
	acRm30d0ZiO8E9UGvJntZu4cVzV7E1EW6MaxnS0K3gsljYdu+XCFyhxxMv3Vrx+CISIE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] CI: Update ppc64 to use Debian Trixie
Message-Id: <E1uxDrE-006JLO-0c@xenbits.xenproject.org>
Date: Sat, 13 Sep 2025 00:11:12 +0000

commit 5ec86c3b831ce328d0e7d31b56cf23e4473117f7
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Sat Aug 9 21:05:11 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Sat Sep 13 01:02:28 2025 +0100

    CI: Update ppc64 to use Debian Trixie
    
    Everything works fine with Debian 13.  Provide two new build jobs (for a total
    of 6), and update the test jobs.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Denis Mukhin <dmukhin@ford.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/build/debian/13-ppc64le.dockerfile | 37 +++++++++++++++++++++++++++
 automation/gitlab-ci/build.yaml               | 18 +++++++++++--
 automation/gitlab-ci/test.yaml                |  4 +--
 automation/scripts/containerize               |  1 +
 4 files changed, 56 insertions(+), 4 deletions(-)

diff --git a/automation/build/debian/13-ppc64le.dockerfile b/automation/build/debian/13-ppc64le.dockerfile
new file mode 100644
index 0000000000..5b22a45458
--- /dev/null
+++ b/automation/build/debian/13-ppc64le.dockerfile
@@ -0,0 +1,37 @@
+# syntax=docker/dockerfile:1
+FROM --platform=linux/amd64 debian:trixie-slim
+LABEL maintainer.name="The Xen Project"
+LABEL maintainer.email="xen-devel@lists.xenproject.org"
+
+ENV DEBIAN_FRONTEND=noninteractive
+ENV CROSS_COMPILE=powerpc64le-linux-gnu-
+ENV XEN_TARGET_ARCH=ppc64
+
+RUN <<EOF
+#!/bin/bash
+    set -e
+
+    useradd --create-home user
+
+    apt-get update
+
+    DEPS=(
+        # Xen
+        bison
+        build-essential
+        checkpolicy
+        flex
+        gcc-powerpc64le-linux-gnu
+        python3-minimal
+
+        # Qemu for test phase
+        qemu-system-ppc
+        expect
+    )
+
+    apt-get -y --no-install-recommends install "${DEPS[@]}"
+    rm -rf /var/lib/apt/lists/*
+EOF
+
+USER user
+WORKDIR /build
diff --git a/automation/gitlab-ci/build.yaml b/automation/gitlab-ci/build.yaml
index c0728e58c4..f8e45f3467 100644
--- a/automation/gitlab-ci/build.yaml
+++ b/automation/gitlab-ci/build.yaml
@@ -319,10 +319,10 @@ debian-12-x86_64-clang-debug:
   variables:
     CONTAINER: debian:12-x86_64
 
-debian-12-ppc64le-gcc-debug:
+debian-13-ppc64le-gcc-debug:
   extends: .gcc-ppc64le-cross-build-debug
   variables:
-    CONTAINER: debian:12-ppc64le
+    CONTAINER: debian:13-ppc64le
     KBUILD_DEFCONFIG: ppc64_defconfig
     HYPERVISOR_ONLY: y
     EXTRA_XEN_CONFIG: |
@@ -705,6 +705,20 @@ debian-12-ppc64le-gcc:
     KBUILD_DEFCONFIG: ppc64_defconfig
     HYPERVISOR_ONLY: y
 
+debian-12-ppc64le-gcc-debug:
+  extends: .gcc-ppc64le-cross-build-debug
+  variables:
+    CONTAINER: debian:12-ppc64le
+    KBUILD_DEFCONFIG: ppc64_defconfig
+    HYPERVISOR_ONLY: y
+
+debian-13-ppc64le-gcc:
+  extends: .gcc-ppc64le-cross-build
+  variables:
+    CONTAINER: debian:13-ppc64le
+    KBUILD_DEFCONFIG: ppc64_defconfig
+    HYPERVISOR_ONLY: y
+
 # RISC-V 64 cross-build
 debian-12-riscv64-gcc:
   extends: .gcc-riscv64-cross-build
diff --git a/automation/gitlab-ci/test.yaml b/automation/gitlab-ci/test.yaml
index 1de68a0fe4..e8946e15dc 100644
--- a/automation/gitlab-ci/test.yaml
+++ b/automation/gitlab-ci/test.yaml
@@ -90,7 +90,7 @@
 .qemu-ppc64le:
   extends: .test-jobs-common
   variables:
-    CONTAINER: debian:12-ppc64le
+    CONTAINER: debian:13-ppc64le
     LOGFILE: qemu-smoke-ppc64le.log
   artifacts:
     paths:
@@ -712,4 +712,4 @@ qemu-smoke-ppc64le-powernv9-gcc:
   script:
     - ./automation/scripts/qemu-smoke-ppc64le.sh powernv9 2>&1 | tee ${LOGFILE}
   needs:
-    - debian-12-ppc64le-gcc-debug
+    - debian-13-ppc64le-gcc-debug
diff --git a/automation/scripts/containerize b/automation/scripts/containerize
index 340b6caaab..65c8804ce5 100755
--- a/automation/scripts/containerize
+++ b/automation/scripts/containerize
@@ -31,6 +31,7 @@ case "_${CONTAINER}" in
     _fedora) CONTAINER="${BASE}/fedora:41-x86_64";;
     _bullseye-ppc64le) CONTAINER="${BASE}/debian:11-ppc64le" ;;
     _bookworm-ppc64le) CONTAINER="${BASE}/debian:12-ppc64le" ;;
+    _trixie-ppc64le) CONTAINER="${BASE}/debian:13-ppc64le" ;;
     _bookworm-riscv64) CONTAINER="${BASE}/debian:12-riscv64" ;;
     _trixie-riscv64) CONTAINER="${BASE}/debian:13-riscv64" ;;
     _bookworm-x86_64-gcc-ibt) CONTAINER="${BASE}/debian:12-x86_64-gcc-ibt" ;;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Sat Sep 13 00:11:23 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 13 Sep 2025 00:11:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1122871.1466316 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uxDrP-0007i8-C2; Sat, 13 Sep 2025 00:11:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1122871.1466316; Sat, 13 Sep 2025 00: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 1uxDrP-0007i0-8t; Sat, 13 Sep 2025 00:11:23 +0000
Received: by outflank-mailman (input) for mailman id 1122871;
 Sat, 13 Sep 2025 00: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 1uxDrO-0007hs-BC
 for xen-changelog@lists.xenproject.org; Sat, 13 Sep 2025 00: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 1uxDrO-006hb8-11
 for xen-changelog@lists.xenproject.org;
 Sat, 13 Sep 2025 00:11:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uxDrO-006JMN-0u
 for xen-changelog@lists.xenproject.org;
 Sat, 13 Sep 2025 00: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=QYsn8LjBgEOmOXRqCyxgktDmBV/rVwQaY/0ZxUYqMEU=; b=IGGECVXHzbeeNOgN2j+qfCXr22
	X58RwiMFFBzp8JdTjKz8P0CxTVgiSv9R+0r9vqPAwXe7JQ3X95PHflAFoAIl/ZIJ3QtA6pOvBXQXU
	NNidpL/x7rCQeERihVzO8fM5wuN/Z1OEwP9JeHVyiS3joOvqauWI620cs1fbgsZVj1dI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] CI: Merge categories in debian/12-x86_64.dockerfile
Message-Id: <E1uxDrO-006JMN-0u@xenbits.xenproject.org>
Date: Sat, 13 Sep 2025 00:11:22 +0000

commit fa4649e2340bfbd358a32df34370174b730cc863
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Sep 11 14:31:53 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Sat Sep 13 01:02:28 2025 +0100

    CI: Merge categories in debian/12-x86_64.dockerfile
    
    cpio needs to be in Tools (general) now that it's used by the general build
    script.  Merge the rest of the test phase jobs into one group, to avoid being
    overly fine-grain.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Denis Mukhin <dmukhin@ford.com>
    Reviewed-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/build/debian/12-x86_64.dockerfile | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/automation/build/debian/12-x86_64.dockerfile b/automation/build/debian/12-x86_64.dockerfile
index 3cf99c730b..4e533ee879 100644
--- a/automation/build/debian/12-x86_64.dockerfile
+++ b/automation/build/debian/12-x86_64.dockerfile
@@ -23,6 +23,7 @@ RUN <<EOF
 
         # Tools (general)
         ca-certificates
+        cpio
         git-core
         pkg-config
         wget
@@ -52,19 +53,14 @@ RUN <<EOF
         ocaml-nox
         ocaml-findlib
 
-        # for test phase, qemu-smoke-* jobs
+        # for test phase, qemu-* jobs
+        busybox-static
         expect
+        ovmf
         qemu-system-x86
 
         # for build-each-commit-gcc
         ccache
-
-        # for qemu-alpine-x86_64-gcc
-        busybox-static
-        cpio
-
-        # For *-efi jobs
-        ovmf
     )
 
     apt-get -y --no-install-recommends install "${DEPS[@]}"
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Sat Sep 13 00:11:33 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 13 Sep 2025 00:11:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1122872.1466319 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uxDrZ-0007k9-Cn; Sat, 13 Sep 2025 00:11:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1122872.1466319; Sat, 13 Sep 2025 00: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 1uxDrZ-0007k2-AH; Sat, 13 Sep 2025 00:11:33 +0000
Received: by outflank-mailman (input) for mailman id 1122872;
 Sat, 13 Sep 2025 00: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 1uxDrY-0007js-E7
 for xen-changelog@lists.xenproject.org; Sat, 13 Sep 2025 00: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 1uxDrY-006hbK-1J
 for xen-changelog@lists.xenproject.org;
 Sat, 13 Sep 2025 00:11:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uxDrY-006JMj-1C
 for xen-changelog@lists.xenproject.org;
 Sat, 13 Sep 2025 00: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=7XrHE+KsK0zfbuWIot4WJzkGAa2rbmzs7NxAz+w+Xqk=; b=fGz8GBeerHLYsEDacWZ2/A4HZQ
	pi+WPmkK5f2LT32YPIfOLK3hdG9pfySeHGXun5J/KU1Opl09Te1vK1IOvwYuNgaNUrpYTn4wDv1Mo
	8m81XuExBjKqHOD9C711VGGlNDMP6WcemBvqt8WCoQEd6HZFvRyq6BZ7D6Hh59M+6R7s=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] CI: Make qemu-smoke-x86-64-gcc-efi compatible with Debian Trixie
Message-Id: <E1uxDrY-006JMj-1C@xenbits.xenproject.org>
Date: Sat, 13 Sep 2025 00:11:32 +0000

commit e2bff412e03fa1a9bd43b75ecdca24860ee32e39
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Sep 12 02:10:09 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Sat Sep 13 01:02:28 2025 +0100

    CI: Make qemu-smoke-x86-64-gcc-efi compatible with Debian Trixie
    
    The OVMF package in Debian Trixie has _4M suffixes on the files.  Have
    scripts/include/xtf-x86-64-efi check for this before falling back to no
    suffix.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Denis Mukhin <dmukhin@ford.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/scripts/include/xtf-x86-64-efi | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/automation/scripts/include/xtf-x86-64-efi b/automation/scripts/include/xtf-x86-64-efi
index e0d821b3f6..8340c745db 100644
--- a/automation/scripts/include/xtf-x86-64-efi
+++ b/automation/scripts/include/xtf-x86-64-efi
@@ -20,6 +20,7 @@ function xtf_arch_setup()
 {
     local esp_dir="${WORKDIR}/boot-esp"
     local efi_dir="${esp_dir}/EFI/BOOT"
+    local suff=
 
     # Generate EFI boot environment
     mkdir -p ${efi_dir}
@@ -35,8 +36,13 @@ options=${XEN_CMDLINE}
 kernel=kernel
 EOF
 
+    # Vs older versions, Debian Trixie names the OVMF files with a _4M suffix.
+    if [[ -e ${FW_PREFIX}/OVMF_VARS_4M.fd ]]; then
+        suff=_4M
+    fi
+
     # NB: OVMF_CODE.fd is read-only, no need to copy
-    cp ${FW_PREFIX}OVMF_VARS.fd ${WORKDIR}
+    cp ${FW_PREFIX}OVMF_VARS${suff}.fd ${WORKDIR}
 
     export TEST_CMD="${QEMU_PREFIX}qemu-system-x86_64 \
         -no-reboot \
@@ -45,8 +51,8 @@ EOF
         -serial stdio \
         -m 512 \
         -M q35,kernel-irqchip=split \
-        -drive if=pflash,format=raw,readonly=on,file=${FW_PREFIX}OVMF_CODE.fd \
-        -drive if=pflash,format=raw,file=${WORKDIR}/OVMF_VARS.fd \
+        -drive if=pflash,format=raw,readonly=on,file=${FW_PREFIX}OVMF_CODE${suff}.fd \
+        -drive if=pflash,format=raw,file=${WORKDIR}/OVMF_VARS${suff}.fd \
         -drive file=fat:rw:${esp_dir},media=disk,index=0,format=raw \
     "
 }
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Sat Sep 13 00:11:43 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 13 Sep 2025 00:11:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1122873.1466325 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uxDrj-0007md-FB; Sat, 13 Sep 2025 00:11:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1122873.1466325; Sat, 13 Sep 2025 00: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 1uxDrj-0007mU-Bp; Sat, 13 Sep 2025 00:11:43 +0000
Received: by outflank-mailman (input) for mailman id 1122873;
 Sat, 13 Sep 2025 00: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 1uxDri-0007mI-H7
 for xen-changelog@lists.xenproject.org; Sat, 13 Sep 2025 00: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 1uxDri-006hbO-1c
 for xen-changelog@lists.xenproject.org;
 Sat, 13 Sep 2025 00:11:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uxDri-006JO2-1V
 for xen-changelog@lists.xenproject.org;
 Sat, 13 Sep 2025 00: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=2E79GNTBDs9Hfdtxaz7K03AHf8sQ9J+0JBWyJhS4c7g=; b=38FU+yYaj6LY85P7WJT0q1GY0u
	zqPqOmSauXA1+qifQ3ybEOQ8Iv/bcUpbCjuzWoM/jFtRJgs3aMv5a6B6Fl566xXRGxCXmdg7vj8Qe
	lKnXHhp9ehHP09Z9SVLEAHeDClKJIf3DuGWupQybaa//Q/3LsPGnaFtbp6ufTDoKrw90=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/emul: Make condition coverage warning non-fatal
Message-Id: <E1uxDri-006JO2-1V@xenbits.xenproject.org>
Date: Sat, 13 Sep 2025 00:11:42 +0000

commit 3718af7ed485aa61fd7f3fc53559349ed6fd1f60
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Sep 12 10:03:01 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Sat Sep 13 01:02:28 2025 +0100

    x86/emul: Make condition coverage warning non-fatal
    
    Randconfig with GCC-14 (Debian Trixie) found:
    
      In file included from arch/x86/x86_emulate/x86_emulate.c:11,
                       from arch/x86/x86_emulate.c:27:
      arch/x86/x86_emulate/x86_emulate.c: In function 'x86_emulate':
      arch/x86/x86_emulate/private.h:482:8: error: Too many conditions (found 826); giving up coverage [-Werror=coverage-too-many-conditions]
        482 | ({  if ( (p) ) {                                                          \
            |        ^
      arch/x86/x86_emulate/x86_emulate.c:1283:5: note: in expansion of macro 'generate_exception_if'
       1283 |     generate_exception_if((mode_vif() &&
            |     ^~~~~~~~~~~~~~~~~~~~~
    
    which is a consequence of having a new enough compiler to allow
    CONFIG_CONDITION_COVERAGE in to the mix.
    
    In the short term make warning non-fatal, but this will need fixing
    properly in due course.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/arch/x86/Makefile | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile
index d7aed7d92c..407571c510 100644
--- a/xen/arch/x86/Makefile
+++ b/xen/arch/x86/Makefile
@@ -98,6 +98,9 @@ $(obj)/usercopy.o: CFLAGS-y += -iquote .
 ifneq ($(CONFIG_HVM),y)
 $(obj)/x86_emulate.o: CFLAGS-y += -Wno-unused-label
 endif
+ifeq ($(CONFIG_CONDITION_COVERAGE),y)
+$(obj)/x86_emulate.o: CFLAGS-y += -Wno-error=coverage-too-many-conditions
+endif
 
 efi-y := $(shell if [ ! -r $(objtree)/include/xen/compile.h -o \
                       -O $(objtree)/include/xen/compile.h ]; then \
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Sat Sep 13 00:11:53 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 13 Sep 2025 00:11:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1122874.1466328 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uxDrt-0007ox-Fi; Sat, 13 Sep 2025 00:11:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1122874.1466328; Sat, 13 Sep 2025 00: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 1uxDrt-0007op-DB; Sat, 13 Sep 2025 00:11:53 +0000
Received: by outflank-mailman (input) for mailman id 1122874;
 Sat, 13 Sep 2025 00: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 1uxDrs-0007og-Jq
 for xen-changelog@lists.xenproject.org; Sat, 13 Sep 2025 00: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 1uxDrs-006hbS-1t
 for xen-changelog@lists.xenproject.org;
 Sat, 13 Sep 2025 00:11:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uxDrs-006JOO-1n
 for xen-changelog@lists.xenproject.org;
 Sat, 13 Sep 2025 00: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=lNZrGTv3l87EFaIW9/gPs0jplFavjrdVqLENvdbUdFc=; b=h9Hp5c1TQxfFfo5EjN+EZErdNg
	EkGwoLPCPOVjeYIx8I9Bo7FfjY/i9KXq2S+OmtWP6usaLAgdX8lZgxePIFIorr5HpvHH0kjOZHobb
	cCKdwSpFmjetDBruLP6wTAmJo3Dyv+1ZzyhzTekgBTp9LSmB7aGMg70bI7UQMSfBQwXA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] CI: Use pipefail in scripts/build
Message-Id: <E1uxDrs-006JOO-1n@xenbits.xenproject.org>
Date: Sat, 13 Sep 2025 00:11:52 +0000

commit fdc202394568dea45367359a9a8dc7c8b45622e6
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Sep 12 09:55:55 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Sat Sep 13 01:02:28 2025 +0100

    CI: Use pipefail in scripts/build
    
    Marek noticed that some builds were failing with:
    
      + cd dist/install
      + find
      + cpio -R 0:0 -o -H newc
      ./automation/scripts/build: line 111: cpio: command not found
      + gzip
    
    but succeeding overall, and producing a zero length xen-tools.cpio.gz as an
    artefact.
    
    In fact, it's all of:
    
      archlinux:current
      debian:12-x86_32
      fedora:41
      opensuse:tumbleweed
      ubuntu (all versions)
    
    Add cpio into all of these containers, including opensuse leap for good
    measure, and use pipefail in the build script.
    
    Fixes: 4611ae6fb8f9 ("CI: save toolstack artifact as cpio.gz")
    Reported-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Denis Mukhin <dmukhin@ford.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/build/archlinux/current.dockerfile          | 1 +
 automation/build/debian/12-x86_32.dockerfile           | 1 +
 automation/build/fedora/41-x86_64.dockerfile           | 1 +
 automation/build/opensuse/leap-15.6-x86_64.dockerfile  | 1 +
 automation/build/opensuse/tumbleweed-x86_64.dockerfile | 1 +
 automation/build/ubuntu/16.04-x86_64.dockerfile        | 1 +
 automation/build/ubuntu/18.04-x86_64.dockerfile        | 1 +
 automation/build/ubuntu/20.04-x86_64.dockerfile        | 1 +
 automation/build/ubuntu/22.04-x86_64.dockerfile        | 1 +
 automation/build/ubuntu/24.04-x86_64.dockerfile        | 1 +
 automation/scripts/build                               | 2 ++
 11 files changed, 12 insertions(+)

diff --git a/automation/build/archlinux/current.dockerfile b/automation/build/archlinux/current.dockerfile
index 657ddd77a8..4e53c835fa 100644
--- a/automation/build/archlinux/current.dockerfile
+++ b/automation/build/archlinux/current.dockerfile
@@ -8,6 +8,7 @@ RUN pacman-key --init
 RUN pacman -S --refresh --sysupgrade --noconfirm --noprogressbar --needed \
         bridge-utils \
         bzip2 \
+        cpio \
         discount \
         dtc \
         e2fsprogs \
diff --git a/automation/build/debian/12-x86_32.dockerfile b/automation/build/debian/12-x86_32.dockerfile
index ef7a257155..447152d7e5 100644
--- a/automation/build/debian/12-x86_32.dockerfile
+++ b/automation/build/debian/12-x86_32.dockerfile
@@ -23,6 +23,7 @@ RUN <<EOF
 
         # Tools (general)
         ca-certificates
+        cpio
         git-core
         pkg-config
         wget
diff --git a/automation/build/fedora/41-x86_64.dockerfile b/automation/build/fedora/41-x86_64.dockerfile
index 8032a20986..e33329aedc 100644
--- a/automation/build/fedora/41-x86_64.dockerfile
+++ b/automation/build/fedora/41-x86_64.dockerfile
@@ -23,6 +23,7 @@ RUN <<EOF
         checkpolicy
 
         # Tools (general)
+        cpio
         git-core
         gzip
         patch
diff --git a/automation/build/opensuse/leap-15.6-x86_64.dockerfile b/automation/build/opensuse/leap-15.6-x86_64.dockerfile
index 97890dfc00..33db3ecd63 100644
--- a/automation/build/opensuse/leap-15.6-x86_64.dockerfile
+++ b/automation/build/opensuse/leap-15.6-x86_64.dockerfile
@@ -29,6 +29,7 @@ RUN <<EOF
         python311
 
         # Tools (general)
+        cpio
         git-core
         gzip
         patch
diff --git a/automation/build/opensuse/tumbleweed-x86_64.dockerfile b/automation/build/opensuse/tumbleweed-x86_64.dockerfile
index 61e840fc67..218bc45294 100644
--- a/automation/build/opensuse/tumbleweed-x86_64.dockerfile
+++ b/automation/build/opensuse/tumbleweed-x86_64.dockerfile
@@ -28,6 +28,7 @@ RUN <<EOF
         python3
 
         # Tools (general)
+        cpio
         git-core
         gzip
         patch
diff --git a/automation/build/ubuntu/16.04-x86_64.dockerfile b/automation/build/ubuntu/16.04-x86_64.dockerfile
index 9cc8ca89e8..72a46389fa 100644
--- a/automation/build/ubuntu/16.04-x86_64.dockerfile
+++ b/automation/build/ubuntu/16.04-x86_64.dockerfile
@@ -24,6 +24,7 @@ RUN <<EOF
 
         # Tools (general)
         ca-certificates
+        cpio
         git-core
         gzip
         patch
diff --git a/automation/build/ubuntu/18.04-x86_64.dockerfile b/automation/build/ubuntu/18.04-x86_64.dockerfile
index aefe52125a..2634856c89 100644
--- a/automation/build/ubuntu/18.04-x86_64.dockerfile
+++ b/automation/build/ubuntu/18.04-x86_64.dockerfile
@@ -24,6 +24,7 @@ RUN <<EOF
 
         # Tools (general)
         ca-certificates
+        cpio
         git-core
         gzip
         patch
diff --git a/automation/build/ubuntu/20.04-x86_64.dockerfile b/automation/build/ubuntu/20.04-x86_64.dockerfile
index 1ee20a13ac..9ec57eb975 100644
--- a/automation/build/ubuntu/20.04-x86_64.dockerfile
+++ b/automation/build/ubuntu/20.04-x86_64.dockerfile
@@ -24,6 +24,7 @@ RUN <<EOF
 
         # Tools (general)
         ca-certificates
+        cpio
         git-core
         gzip
         patch
diff --git a/automation/build/ubuntu/22.04-x86_64.dockerfile b/automation/build/ubuntu/22.04-x86_64.dockerfile
index a9a9b84930..6ae7f4faa8 100644
--- a/automation/build/ubuntu/22.04-x86_64.dockerfile
+++ b/automation/build/ubuntu/22.04-x86_64.dockerfile
@@ -24,6 +24,7 @@ RUN <<EOF
 
         # Tools (general)
         ca-certificates
+        cpio
         git-core
         gzip
         patch
diff --git a/automation/build/ubuntu/24.04-x86_64.dockerfile b/automation/build/ubuntu/24.04-x86_64.dockerfile
index 2005723b31..84777d188c 100644
--- a/automation/build/ubuntu/24.04-x86_64.dockerfile
+++ b/automation/build/ubuntu/24.04-x86_64.dockerfile
@@ -24,6 +24,7 @@ RUN <<EOF
 
         # Tools (general)
         ca-certificates
+        cpio
         git-core
         gzip
         patch
diff --git a/automation/scripts/build b/automation/scripts/build
index d0511843e7..7a81d229de 100755
--- a/automation/scripts/build
+++ b/automation/scripts/build
@@ -1,5 +1,7 @@
 #!/bin/bash -ex
 
+set -o pipefail
+
 test -f /etc/os-release && cat "$_"
 
 # Construct $cc such that it matches what `make` will chose when taking
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Sat Sep 13 00:12:03 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 13 Sep 2025 00:12:03 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1122875.1466332 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uxDs3-0007rB-HB; Sat, 13 Sep 2025 00:12:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1122875.1466332; Sat, 13 Sep 2025 00: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 1uxDs3-0007r2-Ed; Sat, 13 Sep 2025 00:12:03 +0000
Received: by outflank-mailman (input) for mailman id 1122875;
 Sat, 13 Sep 2025 00: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 1uxDs2-0007qt-Mh
 for xen-changelog@lists.xenproject.org; Sat, 13 Sep 2025 00: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 1uxDs2-006hbx-2A
 for xen-changelog@lists.xenproject.org;
 Sat, 13 Sep 2025 00:12:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uxDs2-006JS9-24
 for xen-changelog@lists.xenproject.org;
 Sat, 13 Sep 2025 00: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=1f5uQhhy08AtOjhgXq1paC+tcNSKMEqk7/rx+XfprwM=; b=j3i0dhS27y6PSRHnNhAgckF/o0
	riZPDAxVTi99AoJg1n4iM35rZ2Xyourm8JydxMhiQ3RA+aKHK5pLMhH736Nqk3Sk9n9a0A2duudYm
	OsYTpMzE148Nq/knpfFi6FI9G7iY6CuIJ4K1qV9lYUC3Ru19SB2GoeAJLNXcVDOzrzgw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] CI: Update x86 to use Debian Trixie
Message-Id: <E1uxDs2-006JS9-24@xenbits.xenproject.org>
Date: Sat, 13 Sep 2025 00:12:02 +0000

commit 809bd86db6f40abf1c7edf9b0dbaf1d580bc7b19
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Sat Aug 9 21:05:11 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Sat Sep 13 01:02:28 2025 +0100

    CI: Update x86 to use Debian Trixie
    
    With the exception of the custom IBT job, copy all Debian 12 jobs making
    Debian 13 versions, then trim the Debian 12 ranconfig jobs.
    
    Update the test jobs using Debian 12 to use 13.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Denis Mukhin <dmukhin@ford.com>
    Reviewed-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/build/debian/13-x86_32.dockerfile | 52 ++++++++++++++++++++
 automation/build/debian/13-x86_64.dockerfile | 72 ++++++++++++++++++++++++++++
 automation/gitlab-ci/build.yaml              | 54 ++++++++++++++++-----
 automation/gitlab-ci/test.yaml               | 12 ++---
 automation/scripts/containerize              |  3 +-
 5 files changed, 174 insertions(+), 19 deletions(-)

diff --git a/automation/build/debian/13-x86_32.dockerfile b/automation/build/debian/13-x86_32.dockerfile
new file mode 100644
index 0000000000..464b4fc55e
--- /dev/null
+++ b/automation/build/debian/13-x86_32.dockerfile
@@ -0,0 +1,52 @@
+# syntax=docker/dockerfile:1
+FROM --platform=linux/i386 debian:trixie-slim
+LABEL maintainer.name="The Xen Project"
+LABEL maintainer.email="xen-devel@lists.xenproject.org"
+
+ENV DEBIAN_FRONTEND=noninteractive
+
+RUN <<EOF
+#!/bin/bash
+    set -eu
+
+    useradd --create-home user
+
+    apt-get update
+
+    DEPS=(
+        # Xen
+        bison
+        build-essential
+        checkpolicy
+        clang
+        flex
+
+        # Tools (general)
+        ca-certificates
+        cpio
+        git-core
+        pkg-config
+        wget
+        # libacpi
+        acpica-tools
+        # libxl
+        uuid-dev
+        libyajl-dev
+        # xentop
+        libncurses5-dev
+        # Python bindings
+        python3-dev
+        python3-setuptools
+        # Ocaml bindings/oxenstored
+        ocaml-nox
+        ocaml-findlib
+    )
+
+    apt-get -y --no-install-recommends install "${DEPS[@]}"
+
+    rm -rf /var/lib/apt/lists*
+EOF
+
+USER user
+WORKDIR /build
+ENTRYPOINT ["linux32"]
diff --git a/automation/build/debian/13-x86_64.dockerfile b/automation/build/debian/13-x86_64.dockerfile
new file mode 100644
index 0000000000..2c6c9d4a50
--- /dev/null
+++ b/automation/build/debian/13-x86_64.dockerfile
@@ -0,0 +1,72 @@
+# syntax=docker/dockerfile:1
+FROM --platform=linux/amd64 debian:trixie-slim
+LABEL maintainer.name="The Xen Project"
+LABEL maintainer.email="xen-devel@lists.xenproject.org"
+
+ENV DEBIAN_FRONTEND=noninteractive
+
+RUN <<EOF
+#!/bin/bash
+    set -eu
+
+    useradd --create-home user
+
+    apt-get update
+
+    DEPS=(
+        # Xen
+        bison
+        build-essential
+        checkpolicy
+        clang
+        flex
+
+        # Tools (general)
+        ca-certificates
+        cpio
+        git-core
+        pkg-config
+        wget
+        # libxenguest dombuilder
+        libbz2-dev
+        liblzma-dev
+        liblzo2-dev
+        libzstd-dev
+        zlib1g-dev
+        # libacpi
+        acpica-tools
+        # libxl
+        uuid-dev
+        libnl-3-dev
+        libyajl-dev
+        # RomBIOS
+        bcc
+        bin86
+        # xentop
+        libncurses5-dev
+        # Python bindings
+        python3-dev
+        python3-setuptools
+        # Golang bindings
+        golang-go
+        # Ocaml bindings/oxenstored
+        ocaml-nox
+        ocaml-findlib
+
+        # for test phase, qemu-* jobs
+        busybox-static
+        expect
+        ovmf
+        qemu-system-x86
+
+        # for build-each-commit-gcc
+        ccache
+    )
+
+    apt-get -y --no-install-recommends install "${DEPS[@]}"
+
+    rm -rf /var/lib/apt/lists*
+EOF
+
+USER user
+WORKDIR /build
diff --git a/automation/gitlab-ci/build.yaml b/automation/gitlab-ci/build.yaml
index f8e45f3467..4cb52fe597 100644
--- a/automation/gitlab-ci/build.yaml
+++ b/automation/gitlab-ci/build.yaml
@@ -309,15 +309,15 @@ alpine-3.18-gcc-debug:
       CONFIG_UCODE_SCAN_DEFAULT=y
       CONFIG_XHCI=y
 
-debian-12-x86_64-gcc-debug:
+debian-13-x86_64-gcc-debug:
   extends: .gcc-x86-64-build-debug
   variables:
-    CONTAINER: debian:12-x86_64
+    CONTAINER: debian:13-x86_64
 
-debian-12-x86_64-clang-debug:
+debian-13-x86_64-clang-debug:
   extends: .clang-x86-64-build-debug
   variables:
-    CONTAINER: debian:12-x86_64
+    CONTAINER: debian:13-x86_64
 
 debian-13-ppc64le-gcc-debug:
   extends: .gcc-ppc64le-cross-build-debug
@@ -545,24 +545,20 @@ debian-12-x86_64-clang:
   variables:
     CONTAINER: debian:12-x86_64
 
-debian-12-x86_64-clang-randconfig:
-  extends: .clang-x86-64-build
+debian-12-x86_64-clang-debug:
+  extends: .clang-x86-64-build-debug
   variables:
     CONTAINER: debian:12-x86_64
-    RANDCONFIG: y
-    EXTRA_FIXED_RANDCONFIG: |
-      CONFIG_COVERAGE=n # Disable coverage otherwise build times out.
 
 debian-12-x86_64-gcc:
   extends: .gcc-x86-64-build
   variables:
     CONTAINER: debian:12-x86_64
 
-debian-12-x86_64-gcc-randconfig:
-  extends: .gcc-x86-64-build
+debian-12-x86_64-gcc-debug:
+  extends: .gcc-x86-64-build-debug
   variables:
     CONTAINER: debian:12-x86_64
-    RANDCONFIG: y
 
 debian-12-x86_32-clang-debug:
   extends: .clang-x86-32-build-debug
@@ -574,6 +570,40 @@ debian-12-x86_32-gcc-debug:
   variables:
     CONTAINER: debian:12-x86_32
 
+debian-13-x86_64-clang:
+  extends: .clang-x86-64-build
+  variables:
+    CONTAINER: debian:13-x86_64
+
+debian-13-x86_64-clang-randconfig:
+  extends: .clang-x86-64-build
+  variables:
+    CONTAINER: debian:13-x86_64
+    RANDCONFIG: y
+    EXTRA_FIXED_RANDCONFIG: |
+      CONFIG_COVERAGE=n # Disable coverage otherwise build times out.
+
+debian-13-x86_64-gcc:
+  extends: .gcc-x86-64-build
+  variables:
+    CONTAINER: debian:13-x86_64
+
+debian-13-x86_64-gcc-randconfig:
+  extends: .gcc-x86-64-build
+  variables:
+    CONTAINER: debian:13-x86_64
+    RANDCONFIG: y
+
+debian-13-x86_32-clang-debug:
+  extends: .clang-x86-32-build-debug
+  variables:
+    CONTAINER: debian:13-x86_32
+
+debian-13-x86_32-gcc-debug:
+  extends: .gcc-x86-32-build-debug
+  variables:
+    CONTAINER: debian:13-x86_32
+
 fedora-41-x86_64-gcc:
   extends: .gcc-x86-64-build
   variables:
diff --git a/automation/gitlab-ci/test.yaml b/automation/gitlab-ci/test.yaml
index e8946e15dc..8d8f62c8d0 100644
--- a/automation/gitlab-ci/test.yaml
+++ b/automation/gitlab-ci/test.yaml
@@ -59,7 +59,7 @@
 .qemu-x86-64:
   extends: .test-jobs-common
   variables:
-    CONTAINER: debian:12-x86_64
+    CONTAINER: debian:13-x86_64
     LOGFILE: qemu-smoke-x86-64.log
   artifacts:
     paths:
@@ -661,35 +661,35 @@ qemu-smoke-x86-64-gcc:
   script:
     - ./automation/scripts/qemu-xtf.sh x86-64 pv64 example 2>&1 | tee ${LOGFILE}
   needs:
-    - debian-12-x86_64-gcc-debug
+    - debian-13-x86_64-gcc-debug
 
 qemu-smoke-x86-64-clang:
   extends: .qemu-smoke-x86-64
   script:
     - ./automation/scripts/qemu-xtf.sh x86-64 pv64 example 2>&1 | tee ${LOGFILE}
   needs:
-    - debian-12-x86_64-clang-debug
+    - debian-13-x86_64-clang-debug
 
 qemu-smoke-x86-64-gcc-pvh:
   extends: .qemu-smoke-x86-64
   script:
     - ./automation/scripts/qemu-xtf.sh x86-64 hvm64 example 2>&1 | tee ${LOGFILE}
   needs:
-    - debian-12-x86_64-gcc-debug
+    - debian-13-x86_64-gcc-debug
 
 qemu-smoke-x86-64-clang-pvh:
   extends: .qemu-smoke-x86-64
   script:
     - ./automation/scripts/qemu-xtf.sh x86-64 hvm64 example 2>&1 | tee ${LOGFILE}
   needs:
-    - debian-12-x86_64-clang-debug
+    - debian-13-x86_64-clang-debug
 
 qemu-smoke-x86-64-gcc-efi:
   extends: .qemu-smoke-x86-64
   script:
     - ./automation/scripts/qemu-xtf.sh x86-64-efi pv64 example 2>&1 | tee ${LOGFILE}
   needs:
-    - debian-12-x86_64-gcc-debug
+    - debian-13-x86_64-gcc-debug
 
 qemu-xtf-argo-x86_64-gcc-debug:
   extends: .qemu-smoke-x86-64
diff --git a/automation/scripts/containerize b/automation/scripts/containerize
index 65c8804ce5..743567cb77 100755
--- a/automation/scripts/containerize
+++ b/automation/scripts/containerize
@@ -35,7 +35,8 @@ case "_${CONTAINER}" in
     _bookworm-riscv64) CONTAINER="${BASE}/debian:12-riscv64" ;;
     _trixie-riscv64) CONTAINER="${BASE}/debian:13-riscv64" ;;
     _bookworm-x86_64-gcc-ibt) CONTAINER="${BASE}/debian:12-x86_64-gcc-ibt" ;;
-    _bookworm|_bookworm-x86_64|_) CONTAINER="${BASE}/debian:12-x86_64" ;;
+    _bookworm|_bookworm-x86_64) CONTAINER="${BASE}/debian:12-x86_64" ;;
+    _trixie-x86_64|_) CONTAINER="${BASE}/debian:13-x86_64" ;;
     _bookworm-i386|_bookworm-x86_32) CONTAINER="${BASE}/debian:12-x86_32" ;;
     _bookworm-arm64v8-arm32-gcc) CONTAINER="${BASE}/debian:bookworm-arm64v8-arm32-gcc" ;;
     _bookworm-arm64v8) CONTAINER="${BASE}/debian:bookworm-arm64v8" ;;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Sat Sep 13 00:12:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 13 Sep 2025 00:12:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1122876.1466335 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uxDsD-0007w9-KF; Sat, 13 Sep 2025 00:12:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1122876.1466335; Sat, 13 Sep 2025 00:12: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 1uxDsD-0007w1-He; Sat, 13 Sep 2025 00:12:13 +0000
Received: by outflank-mailman (input) for mailman id 1122876;
 Sat, 13 Sep 2025 00: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 1uxDsC-0007vr-PJ
 for xen-changelog@lists.xenproject.org; Sat, 13 Sep 2025 00: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 1uxDsC-006hc6-2R
 for xen-changelog@lists.xenproject.org;
 Sat, 13 Sep 2025 00:12:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uxDsC-006JSh-2L
 for xen-changelog@lists.xenproject.org;
 Sat, 13 Sep 2025 00: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=NU0aTSX5wGSTio637jdzWaDI+qvIO5UWKxCe9BmOfsE=; b=nDCYNYIHVHL7ENHzG6Wg8UteO6
	O8Yy4DpyyAIdapcbXpkp/Wj7gDIEEJL29nMlJOujPtVqbEZz9gSgnT7lf7agXnv/t+olrUbqa9w/p
	uU4ydKita6WSTchi8xEk00lg/57yAQ+W5CU4+8C9JjUgqQNLs9Kfcf4GA8XY8LOg34MI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] CHANGELOG: Notes about distro changes in CI
Message-Id: <E1uxDsC-006JSh-2L@xenbits.xenproject.org>
Date: Sat, 13 Sep 2025 00:12:12 +0000

commit 09de61c200c0b5c7d615e135434a5e187f9a8349
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Sep 10 23:17:42 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Sat Sep 13 01:02:29 2025 +0100

    CHANGELOG: Notes about distro changes in CI
    
    Also state the RISC-V baseline now it's been set, as it's the reason why
    RISC-V Bullseye got dropped.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Reviewed-by: Denis Mukhin <dmukhin@ford.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
    ---
    CC: Anthony PERARD <anthony.perard@vates.tech>
    CC: Michal Orzel <michal.orzel@amd.com>
    CC: Jan Beulich <jbeulich@suse.com>
    CC: Julien Grall <julien@xen.org>
    CC: Roger Pau Monné <roger.pau@citrix.com>
    CC: Stefano Stabellini <sstabellini@kernel.org>
    CC: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    
    v2:
     * New
---
 CHANGELOG.md | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7bd96ac09d..ca1b43b940 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,6 +10,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
  - The minimum toolchain requirements have increased for some architectures:
    - For x86, GCC 5.1 and Binutils 2.25, or Clang/LLVM 11
    - For ARM32 and ARM64, GCC 5.1 and Binutils 2.25
+   - For RISC-V, GCC 12.2 and Binutils 2.39
+ - Debian Trixie added to CI.  Debian Bullseye retired from CI for RISC-V due
+   to the baseline change.
  - Linux based device model stubdomains are now fully supported.
 
  - On x86:
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Sat Sep 13 01:11:06 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 13 Sep 2025 01:11:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1122886.1466340 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uxEn9-0005ak-Hz; Sat, 13 Sep 2025 01:11:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1122886.1466340; Sat, 13 Sep 2025 01: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 1uxEn9-0005ac-FC; Sat, 13 Sep 2025 01:11:03 +0000
Received: by outflank-mailman (input) for mailman id 1122886;
 Sat, 13 Sep 2025 01: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 1uxEn8-0005aW-I8
 for xen-changelog@lists.xenproject.org; Sat, 13 Sep 2025 01: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 1uxEn8-007p9C-1Z
 for xen-changelog@lists.xenproject.org;
 Sat, 13 Sep 2025 01:11:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uxEn8-006MVz-1R
 for xen-changelog@lists.xenproject.org;
 Sat, 13 Sep 2025 01: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=MVnChO7w9MZnXyWn+Ys7GHTWHNfZrZF9y0EDNkE9qNM=; b=lESX/991EUGXgvpqORlDSHzTPk
	hKwZdtsCnvu6s1KT75TZ4/R1+QGmbb/aIyXJYvsWAT+ezcdYy0HULP6CEAInHj67+Bbpo5pPwshwq
	5qDzv4fSBnJUMrqnKDJmPICFeB7hQIXcerKarwjvkxnlrOfx2Pp94RT+2czPSUTyiC+c=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] CI: Use the Debian Trixie container for RISC-V test jobs
Message-Id: <E1uxEn8-006MVz-1R@xenbits.xenproject.org>
Date: Sat, 13 Sep 2025 01:11:02 +0000

commit 80a7a325bdea365931245d5284371021eb3b097c
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Sep 11 15:47:31 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Sat Sep 13 01:02:28 2025 +0100

    CI: Use the Debian Trixie container for RISC-V test jobs
    
    This was missed when introducing Trixie.
    
    Fixes: aad6ebf0596f ("CI: Update riscv64 to use Debian Trixie")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Denis Mukhin <dmukhin@ford.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/gitlab-ci/test.yaml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/automation/gitlab-ci/test.yaml b/automation/gitlab-ci/test.yaml
index 95b883b32b..1de68a0fe4 100644
--- a/automation/gitlab-ci/test.yaml
+++ b/automation/gitlab-ci/test.yaml
@@ -77,7 +77,7 @@
 .qemu-riscv64:
   extends: .test-jobs-common
   variables:
-    CONTAINER: debian:12-riscv64
+    CONTAINER: debian:13-riscv64
     LOGFILE: qemu-smoke-riscv64.log
   artifacts:
     paths:
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Sep 13 01:11:15 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 13 Sep 2025 01:11:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1122887.1466343 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uxEnJ-0005cV-JF; Sat, 13 Sep 2025 01:11:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1122887.1466343; Sat, 13 Sep 2025 01: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 1uxEnJ-0005cO-Go; Sat, 13 Sep 2025 01:11:13 +0000
Received: by outflank-mailman (input) for mailman id 1122887;
 Sat, 13 Sep 2025 01: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 1uxEnI-0005cE-JY
 for xen-changelog@lists.xenproject.org; Sat, 13 Sep 2025 01: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 1uxEnI-007p9G-1r
 for xen-changelog@lists.xenproject.org;
 Sat, 13 Sep 2025 01:11:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uxEnI-006MWc-1k
 for xen-changelog@lists.xenproject.org;
 Sat, 13 Sep 2025 01: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=BhbKFh5g3dRsXblwfnaAVyc1g+C4pdjW32Ay19mNNKg=; b=WxrS9SftdqGllgGKZNAmQP45rY
	lyaUh2KO8gBG8it2ItlLuBhidIzm+mNBp/7rQO8DhXDseWb+ytxjoC3EpfV6fhBinQ1z0bOfWWzA4
	mVxhxcLDY/Asp2oNUYswwG+oLblMeCBvLzZBKyYR39K8t4PNV/4JaLM+HM6GsrvrM1Ks=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] CI: Update ppc64 to use Debian Trixie
Message-Id: <E1uxEnI-006MWc-1k@xenbits.xenproject.org>
Date: Sat, 13 Sep 2025 01:11:12 +0000

commit 5ec86c3b831ce328d0e7d31b56cf23e4473117f7
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Sat Aug 9 21:05:11 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Sat Sep 13 01:02:28 2025 +0100

    CI: Update ppc64 to use Debian Trixie
    
    Everything works fine with Debian 13.  Provide two new build jobs (for a total
    of 6), and update the test jobs.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Denis Mukhin <dmukhin@ford.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/build/debian/13-ppc64le.dockerfile | 37 +++++++++++++++++++++++++++
 automation/gitlab-ci/build.yaml               | 18 +++++++++++--
 automation/gitlab-ci/test.yaml                |  4 +--
 automation/scripts/containerize               |  1 +
 4 files changed, 56 insertions(+), 4 deletions(-)

diff --git a/automation/build/debian/13-ppc64le.dockerfile b/automation/build/debian/13-ppc64le.dockerfile
new file mode 100644
index 0000000000..5b22a45458
--- /dev/null
+++ b/automation/build/debian/13-ppc64le.dockerfile
@@ -0,0 +1,37 @@
+# syntax=docker/dockerfile:1
+FROM --platform=linux/amd64 debian:trixie-slim
+LABEL maintainer.name="The Xen Project"
+LABEL maintainer.email="xen-devel@lists.xenproject.org"
+
+ENV DEBIAN_FRONTEND=noninteractive
+ENV CROSS_COMPILE=powerpc64le-linux-gnu-
+ENV XEN_TARGET_ARCH=ppc64
+
+RUN <<EOF
+#!/bin/bash
+    set -e
+
+    useradd --create-home user
+
+    apt-get update
+
+    DEPS=(
+        # Xen
+        bison
+        build-essential
+        checkpolicy
+        flex
+        gcc-powerpc64le-linux-gnu
+        python3-minimal
+
+        # Qemu for test phase
+        qemu-system-ppc
+        expect
+    )
+
+    apt-get -y --no-install-recommends install "${DEPS[@]}"
+    rm -rf /var/lib/apt/lists/*
+EOF
+
+USER user
+WORKDIR /build
diff --git a/automation/gitlab-ci/build.yaml b/automation/gitlab-ci/build.yaml
index c0728e58c4..f8e45f3467 100644
--- a/automation/gitlab-ci/build.yaml
+++ b/automation/gitlab-ci/build.yaml
@@ -319,10 +319,10 @@ debian-12-x86_64-clang-debug:
   variables:
     CONTAINER: debian:12-x86_64
 
-debian-12-ppc64le-gcc-debug:
+debian-13-ppc64le-gcc-debug:
   extends: .gcc-ppc64le-cross-build-debug
   variables:
-    CONTAINER: debian:12-ppc64le
+    CONTAINER: debian:13-ppc64le
     KBUILD_DEFCONFIG: ppc64_defconfig
     HYPERVISOR_ONLY: y
     EXTRA_XEN_CONFIG: |
@@ -705,6 +705,20 @@ debian-12-ppc64le-gcc:
     KBUILD_DEFCONFIG: ppc64_defconfig
     HYPERVISOR_ONLY: y
 
+debian-12-ppc64le-gcc-debug:
+  extends: .gcc-ppc64le-cross-build-debug
+  variables:
+    CONTAINER: debian:12-ppc64le
+    KBUILD_DEFCONFIG: ppc64_defconfig
+    HYPERVISOR_ONLY: y
+
+debian-13-ppc64le-gcc:
+  extends: .gcc-ppc64le-cross-build
+  variables:
+    CONTAINER: debian:13-ppc64le
+    KBUILD_DEFCONFIG: ppc64_defconfig
+    HYPERVISOR_ONLY: y
+
 # RISC-V 64 cross-build
 debian-12-riscv64-gcc:
   extends: .gcc-riscv64-cross-build
diff --git a/automation/gitlab-ci/test.yaml b/automation/gitlab-ci/test.yaml
index 1de68a0fe4..e8946e15dc 100644
--- a/automation/gitlab-ci/test.yaml
+++ b/automation/gitlab-ci/test.yaml
@@ -90,7 +90,7 @@
 .qemu-ppc64le:
   extends: .test-jobs-common
   variables:
-    CONTAINER: debian:12-ppc64le
+    CONTAINER: debian:13-ppc64le
     LOGFILE: qemu-smoke-ppc64le.log
   artifacts:
     paths:
@@ -712,4 +712,4 @@ qemu-smoke-ppc64le-powernv9-gcc:
   script:
     - ./automation/scripts/qemu-smoke-ppc64le.sh powernv9 2>&1 | tee ${LOGFILE}
   needs:
-    - debian-12-ppc64le-gcc-debug
+    - debian-13-ppc64le-gcc-debug
diff --git a/automation/scripts/containerize b/automation/scripts/containerize
index 340b6caaab..65c8804ce5 100755
--- a/automation/scripts/containerize
+++ b/automation/scripts/containerize
@@ -31,6 +31,7 @@ case "_${CONTAINER}" in
     _fedora) CONTAINER="${BASE}/fedora:41-x86_64";;
     _bullseye-ppc64le) CONTAINER="${BASE}/debian:11-ppc64le" ;;
     _bookworm-ppc64le) CONTAINER="${BASE}/debian:12-ppc64le" ;;
+    _trixie-ppc64le) CONTAINER="${BASE}/debian:13-ppc64le" ;;
     _bookworm-riscv64) CONTAINER="${BASE}/debian:12-riscv64" ;;
     _trixie-riscv64) CONTAINER="${BASE}/debian:13-riscv64" ;;
     _bookworm-x86_64-gcc-ibt) CONTAINER="${BASE}/debian:12-x86_64-gcc-ibt" ;;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Sep 13 01:11:23 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 13 Sep 2025 01:11:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1122888.1466348 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uxEnT-0005es-Kp; Sat, 13 Sep 2025 01:11:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1122888.1466348; Sat, 13 Sep 2025 01: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 1uxEnT-0005ek-IE; Sat, 13 Sep 2025 01:11:23 +0000
Received: by outflank-mailman (input) for mailman id 1122888;
 Sat, 13 Sep 2025 01: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 1uxEnS-0005ea-N0
 for xen-changelog@lists.xenproject.org; Sat, 13 Sep 2025 01: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 1uxEnS-007p9O-2B
 for xen-changelog@lists.xenproject.org;
 Sat, 13 Sep 2025 01:11:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uxEnS-006MXB-21
 for xen-changelog@lists.xenproject.org;
 Sat, 13 Sep 2025 01: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=R+112tooq7MIwdu3ObH7bnuvQVo/qq0+LzURycch3fs=; b=50V/EDSx+c1IyJbPX7P234+v87
	TtSkSN7B76krPHcSQ+Ppqaq3lV/ajSYYysDGINdbgUdIedld20Te8ByDVnyhGU63sgxHW1I062GjF
	LACJjW5bhDZkq9upwWDHmqcr/0XmpXGK4V2/CYAsBO0gi/vxpxqTqn1KBlwDydiBp6aI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] CI: Merge categories in debian/12-x86_64.dockerfile
Message-Id: <E1uxEnS-006MXB-21@xenbits.xenproject.org>
Date: Sat, 13 Sep 2025 01:11:22 +0000

commit fa4649e2340bfbd358a32df34370174b730cc863
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Sep 11 14:31:53 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Sat Sep 13 01:02:28 2025 +0100

    CI: Merge categories in debian/12-x86_64.dockerfile
    
    cpio needs to be in Tools (general) now that it's used by the general build
    script.  Merge the rest of the test phase jobs into one group, to avoid being
    overly fine-grain.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Denis Mukhin <dmukhin@ford.com>
    Reviewed-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/build/debian/12-x86_64.dockerfile | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/automation/build/debian/12-x86_64.dockerfile b/automation/build/debian/12-x86_64.dockerfile
index 3cf99c730b..4e533ee879 100644
--- a/automation/build/debian/12-x86_64.dockerfile
+++ b/automation/build/debian/12-x86_64.dockerfile
@@ -23,6 +23,7 @@ RUN <<EOF
 
         # Tools (general)
         ca-certificates
+        cpio
         git-core
         pkg-config
         wget
@@ -52,19 +53,14 @@ RUN <<EOF
         ocaml-nox
         ocaml-findlib
 
-        # for test phase, qemu-smoke-* jobs
+        # for test phase, qemu-* jobs
+        busybox-static
         expect
+        ovmf
         qemu-system-x86
 
         # for build-each-commit-gcc
         ccache
-
-        # for qemu-alpine-x86_64-gcc
-        busybox-static
-        cpio
-
-        # For *-efi jobs
-        ovmf
     )
 
     apt-get -y --no-install-recommends install "${DEPS[@]}"
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Sep 13 01:11:33 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 13 Sep 2025 01:11:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1122889.1466352 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uxEnd-0005h9-MF; Sat, 13 Sep 2025 01:11:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1122889.1466352; Sat, 13 Sep 2025 01: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 1uxEnd-0005h1-Jb; Sat, 13 Sep 2025 01:11:33 +0000
Received: by outflank-mailman (input) for mailman id 1122889;
 Sat, 13 Sep 2025 01: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 1uxEnc-0005gt-Rj
 for xen-changelog@lists.xenproject.org; Sat, 13 Sep 2025 01: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 1uxEnc-007p9V-2V
 for xen-changelog@lists.xenproject.org;
 Sat, 13 Sep 2025 01:11:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uxEnc-006MXe-2M
 for xen-changelog@lists.xenproject.org;
 Sat, 13 Sep 2025 01: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=QQL827EYsDE5NSOkQdCrYHXJNWHJySy4xz5Kpypvdvo=; b=4Dpd/kTAbXF+khzVzIw/CIAI/O
	I2spSYmndiM/+E4glcerSEUoNWUs2qxgBIxP3CBzvE6O8MByr2xHvIxUdhvy/F0fUOfrzyQl+5a0t
	EFrkeX9S15NwAYYTnQXbiF944PbB5Ebz6+qo2rfXq33uyfPtW8j5K8lJkuRjHRuOAaUg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] CI: Make qemu-smoke-x86-64-gcc-efi compatible with Debian Trixie
Message-Id: <E1uxEnc-006MXe-2M@xenbits.xenproject.org>
Date: Sat, 13 Sep 2025 01:11:32 +0000

commit e2bff412e03fa1a9bd43b75ecdca24860ee32e39
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Sep 12 02:10:09 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Sat Sep 13 01:02:28 2025 +0100

    CI: Make qemu-smoke-x86-64-gcc-efi compatible with Debian Trixie
    
    The OVMF package in Debian Trixie has _4M suffixes on the files.  Have
    scripts/include/xtf-x86-64-efi check for this before falling back to no
    suffix.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Denis Mukhin <dmukhin@ford.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/scripts/include/xtf-x86-64-efi | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/automation/scripts/include/xtf-x86-64-efi b/automation/scripts/include/xtf-x86-64-efi
index e0d821b3f6..8340c745db 100644
--- a/automation/scripts/include/xtf-x86-64-efi
+++ b/automation/scripts/include/xtf-x86-64-efi
@@ -20,6 +20,7 @@ function xtf_arch_setup()
 {
     local esp_dir="${WORKDIR}/boot-esp"
     local efi_dir="${esp_dir}/EFI/BOOT"
+    local suff=
 
     # Generate EFI boot environment
     mkdir -p ${efi_dir}
@@ -35,8 +36,13 @@ options=${XEN_CMDLINE}
 kernel=kernel
 EOF
 
+    # Vs older versions, Debian Trixie names the OVMF files with a _4M suffix.
+    if [[ -e ${FW_PREFIX}/OVMF_VARS_4M.fd ]]; then
+        suff=_4M
+    fi
+
     # NB: OVMF_CODE.fd is read-only, no need to copy
-    cp ${FW_PREFIX}OVMF_VARS.fd ${WORKDIR}
+    cp ${FW_PREFIX}OVMF_VARS${suff}.fd ${WORKDIR}
 
     export TEST_CMD="${QEMU_PREFIX}qemu-system-x86_64 \
         -no-reboot \
@@ -45,8 +51,8 @@ EOF
         -serial stdio \
         -m 512 \
         -M q35,kernel-irqchip=split \
-        -drive if=pflash,format=raw,readonly=on,file=${FW_PREFIX}OVMF_CODE.fd \
-        -drive if=pflash,format=raw,file=${WORKDIR}/OVMF_VARS.fd \
+        -drive if=pflash,format=raw,readonly=on,file=${FW_PREFIX}OVMF_CODE${suff}.fd \
+        -drive if=pflash,format=raw,file=${WORKDIR}/OVMF_VARS${suff}.fd \
         -drive file=fat:rw:${esp_dir},media=disk,index=0,format=raw \
     "
 }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Sep 13 01:11:43 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 13 Sep 2025 01:11:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1122890.1466355 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uxEnn-0005jK-NS; Sat, 13 Sep 2025 01:11:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1122890.1466355; Sat, 13 Sep 2025 01: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 1uxEnn-0005jC-Kz; Sat, 13 Sep 2025 01:11:43 +0000
Received: by outflank-mailman (input) for mailman id 1122890;
 Sat, 13 Sep 2025 01:11: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 1uxEnm-0005j4-VE
 for xen-changelog@lists.xenproject.org; Sat, 13 Sep 2025 01: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 1uxEnm-007p9b-2q
 for xen-changelog@lists.xenproject.org;
 Sat, 13 Sep 2025 01:11:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uxEnm-006MY8-2g
 for xen-changelog@lists.xenproject.org;
 Sat, 13 Sep 2025 01: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=HGEGIBg/ExTEh4HT1qy81yCujrzyg97nQNwQvf9ioeQ=; b=LcF+DqCHtaHJ3rJgB1erLI9BVP
	VYh+/y0v8NMfgHATUz/aM7WyoBU0S+V/Db3TcAx8TM1s4h5V54T5ph5Hk30T63vZcXjIgUnuqGaaG
	5t5/g8zl6inMKjJ8cRwbVN8QnArdMUhHe+diHEmrDkJOIJ+h96crXuekPNRpFFUwEsw8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/emul: Make condition coverage warning non-fatal
Message-Id: <E1uxEnm-006MY8-2g@xenbits.xenproject.org>
Date: Sat, 13 Sep 2025 01:11:42 +0000

commit 3718af7ed485aa61fd7f3fc53559349ed6fd1f60
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Sep 12 10:03:01 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Sat Sep 13 01:02:28 2025 +0100

    x86/emul: Make condition coverage warning non-fatal
    
    Randconfig with GCC-14 (Debian Trixie) found:
    
      In file included from arch/x86/x86_emulate/x86_emulate.c:11,
                       from arch/x86/x86_emulate.c:27:
      arch/x86/x86_emulate/x86_emulate.c: In function 'x86_emulate':
      arch/x86/x86_emulate/private.h:482:8: error: Too many conditions (found 826); giving up coverage [-Werror=coverage-too-many-conditions]
        482 | ({  if ( (p) ) {                                                          \
            |        ^
      arch/x86/x86_emulate/x86_emulate.c:1283:5: note: in expansion of macro 'generate_exception_if'
       1283 |     generate_exception_if((mode_vif() &&
            |     ^~~~~~~~~~~~~~~~~~~~~
    
    which is a consequence of having a new enough compiler to allow
    CONFIG_CONDITION_COVERAGE in to the mix.
    
    In the short term make warning non-fatal, but this will need fixing
    properly in due course.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/arch/x86/Makefile | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile
index d7aed7d92c..407571c510 100644
--- a/xen/arch/x86/Makefile
+++ b/xen/arch/x86/Makefile
@@ -98,6 +98,9 @@ $(obj)/usercopy.o: CFLAGS-y += -iquote .
 ifneq ($(CONFIG_HVM),y)
 $(obj)/x86_emulate.o: CFLAGS-y += -Wno-unused-label
 endif
+ifeq ($(CONFIG_CONDITION_COVERAGE),y)
+$(obj)/x86_emulate.o: CFLAGS-y += -Wno-error=coverage-too-many-conditions
+endif
 
 efi-y := $(shell if [ ! -r $(objtree)/include/xen/compile.h -o \
                       -O $(objtree)/include/xen/compile.h ]; then \
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Sep 13 01:11:53 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 13 Sep 2025 01:11:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1122891.1466359 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uxEnx-0005lR-Oz; Sat, 13 Sep 2025 01:11:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1122891.1466359; Sat, 13 Sep 2025 01: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 1uxEnx-0005lJ-MN; Sat, 13 Sep 2025 01:11:53 +0000
Received: by outflank-mailman (input) for mailman id 1122891;
 Sat, 13 Sep 2025 01: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 1uxEnw-0005lC-Vy
 for xen-changelog@lists.xenproject.org; Sat, 13 Sep 2025 01: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 1uxEnw-007p9f-37
 for xen-changelog@lists.xenproject.org;
 Sat, 13 Sep 2025 01:11:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uxEnw-006MZ3-31
 for xen-changelog@lists.xenproject.org;
 Sat, 13 Sep 2025 01: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=XM/+YyvBPoka7Id1GKv/uWz3NQs07yerVZuQu9GQ3Lw=; b=ZaWdgRxitjejvGjS8UsEV4UwZg
	M4FL+eQlt7G2qqqZ9rvbCWq6bgSes3w8NxjF/7PkoZY4g4orkyWzbk4Jd9Qy2I/+Reht/U+XLC3Q7
	T/RrOWfJ2AFvDEFSGEQxhHrIJY68QZA83ihjgZzRmcUy7or6n1sPOIu7SLntmeyH915c=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] CI: Use pipefail in scripts/build
Message-Id: <E1uxEnw-006MZ3-31@xenbits.xenproject.org>
Date: Sat, 13 Sep 2025 01:11:52 +0000

commit fdc202394568dea45367359a9a8dc7c8b45622e6
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Sep 12 09:55:55 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Sat Sep 13 01:02:28 2025 +0100

    CI: Use pipefail in scripts/build
    
    Marek noticed that some builds were failing with:
    
      + cd dist/install
      + find
      + cpio -R 0:0 -o -H newc
      ./automation/scripts/build: line 111: cpio: command not found
      + gzip
    
    but succeeding overall, and producing a zero length xen-tools.cpio.gz as an
    artefact.
    
    In fact, it's all of:
    
      archlinux:current
      debian:12-x86_32
      fedora:41
      opensuse:tumbleweed
      ubuntu (all versions)
    
    Add cpio into all of these containers, including opensuse leap for good
    measure, and use pipefail in the build script.
    
    Fixes: 4611ae6fb8f9 ("CI: save toolstack artifact as cpio.gz")
    Reported-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Denis Mukhin <dmukhin@ford.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/build/archlinux/current.dockerfile          | 1 +
 automation/build/debian/12-x86_32.dockerfile           | 1 +
 automation/build/fedora/41-x86_64.dockerfile           | 1 +
 automation/build/opensuse/leap-15.6-x86_64.dockerfile  | 1 +
 automation/build/opensuse/tumbleweed-x86_64.dockerfile | 1 +
 automation/build/ubuntu/16.04-x86_64.dockerfile        | 1 +
 automation/build/ubuntu/18.04-x86_64.dockerfile        | 1 +
 automation/build/ubuntu/20.04-x86_64.dockerfile        | 1 +
 automation/build/ubuntu/22.04-x86_64.dockerfile        | 1 +
 automation/build/ubuntu/24.04-x86_64.dockerfile        | 1 +
 automation/scripts/build                               | 2 ++
 11 files changed, 12 insertions(+)

diff --git a/automation/build/archlinux/current.dockerfile b/automation/build/archlinux/current.dockerfile
index 657ddd77a8..4e53c835fa 100644
--- a/automation/build/archlinux/current.dockerfile
+++ b/automation/build/archlinux/current.dockerfile
@@ -8,6 +8,7 @@ RUN pacman-key --init
 RUN pacman -S --refresh --sysupgrade --noconfirm --noprogressbar --needed \
         bridge-utils \
         bzip2 \
+        cpio \
         discount \
         dtc \
         e2fsprogs \
diff --git a/automation/build/debian/12-x86_32.dockerfile b/automation/build/debian/12-x86_32.dockerfile
index ef7a257155..447152d7e5 100644
--- a/automation/build/debian/12-x86_32.dockerfile
+++ b/automation/build/debian/12-x86_32.dockerfile
@@ -23,6 +23,7 @@ RUN <<EOF
 
         # Tools (general)
         ca-certificates
+        cpio
         git-core
         pkg-config
         wget
diff --git a/automation/build/fedora/41-x86_64.dockerfile b/automation/build/fedora/41-x86_64.dockerfile
index 8032a20986..e33329aedc 100644
--- a/automation/build/fedora/41-x86_64.dockerfile
+++ b/automation/build/fedora/41-x86_64.dockerfile
@@ -23,6 +23,7 @@ RUN <<EOF
         checkpolicy
 
         # Tools (general)
+        cpio
         git-core
         gzip
         patch
diff --git a/automation/build/opensuse/leap-15.6-x86_64.dockerfile b/automation/build/opensuse/leap-15.6-x86_64.dockerfile
index 97890dfc00..33db3ecd63 100644
--- a/automation/build/opensuse/leap-15.6-x86_64.dockerfile
+++ b/automation/build/opensuse/leap-15.6-x86_64.dockerfile
@@ -29,6 +29,7 @@ RUN <<EOF
         python311
 
         # Tools (general)
+        cpio
         git-core
         gzip
         patch
diff --git a/automation/build/opensuse/tumbleweed-x86_64.dockerfile b/automation/build/opensuse/tumbleweed-x86_64.dockerfile
index 61e840fc67..218bc45294 100644
--- a/automation/build/opensuse/tumbleweed-x86_64.dockerfile
+++ b/automation/build/opensuse/tumbleweed-x86_64.dockerfile
@@ -28,6 +28,7 @@ RUN <<EOF
         python3
 
         # Tools (general)
+        cpio
         git-core
         gzip
         patch
diff --git a/automation/build/ubuntu/16.04-x86_64.dockerfile b/automation/build/ubuntu/16.04-x86_64.dockerfile
index 9cc8ca89e8..72a46389fa 100644
--- a/automation/build/ubuntu/16.04-x86_64.dockerfile
+++ b/automation/build/ubuntu/16.04-x86_64.dockerfile
@@ -24,6 +24,7 @@ RUN <<EOF
 
         # Tools (general)
         ca-certificates
+        cpio
         git-core
         gzip
         patch
diff --git a/automation/build/ubuntu/18.04-x86_64.dockerfile b/automation/build/ubuntu/18.04-x86_64.dockerfile
index aefe52125a..2634856c89 100644
--- a/automation/build/ubuntu/18.04-x86_64.dockerfile
+++ b/automation/build/ubuntu/18.04-x86_64.dockerfile
@@ -24,6 +24,7 @@ RUN <<EOF
 
         # Tools (general)
         ca-certificates
+        cpio
         git-core
         gzip
         patch
diff --git a/automation/build/ubuntu/20.04-x86_64.dockerfile b/automation/build/ubuntu/20.04-x86_64.dockerfile
index 1ee20a13ac..9ec57eb975 100644
--- a/automation/build/ubuntu/20.04-x86_64.dockerfile
+++ b/automation/build/ubuntu/20.04-x86_64.dockerfile
@@ -24,6 +24,7 @@ RUN <<EOF
 
         # Tools (general)
         ca-certificates
+        cpio
         git-core
         gzip
         patch
diff --git a/automation/build/ubuntu/22.04-x86_64.dockerfile b/automation/build/ubuntu/22.04-x86_64.dockerfile
index a9a9b84930..6ae7f4faa8 100644
--- a/automation/build/ubuntu/22.04-x86_64.dockerfile
+++ b/automation/build/ubuntu/22.04-x86_64.dockerfile
@@ -24,6 +24,7 @@ RUN <<EOF
 
         # Tools (general)
         ca-certificates
+        cpio
         git-core
         gzip
         patch
diff --git a/automation/build/ubuntu/24.04-x86_64.dockerfile b/automation/build/ubuntu/24.04-x86_64.dockerfile
index 2005723b31..84777d188c 100644
--- a/automation/build/ubuntu/24.04-x86_64.dockerfile
+++ b/automation/build/ubuntu/24.04-x86_64.dockerfile
@@ -24,6 +24,7 @@ RUN <<EOF
 
         # Tools (general)
         ca-certificates
+        cpio
         git-core
         gzip
         patch
diff --git a/automation/scripts/build b/automation/scripts/build
index d0511843e7..7a81d229de 100755
--- a/automation/scripts/build
+++ b/automation/scripts/build
@@ -1,5 +1,7 @@
 #!/bin/bash -ex
 
+set -o pipefail
+
 test -f /etc/os-release && cat "$_"
 
 # Construct $cc such that it matches what `make` will chose when taking
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Sep 13 01:12:03 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 13 Sep 2025 01:12:03 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1122892.1466364 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uxEo7-0005oJ-S9; Sat, 13 Sep 2025 01:12:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1122892.1466364; Sat, 13 Sep 2025 01: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 1uxEo7-0005oB-PX; Sat, 13 Sep 2025 01:12:03 +0000
Received: by outflank-mailman (input) for mailman id 1122892;
 Sat, 13 Sep 2025 01: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 1uxEo7-0005o2-2T
 for xen-changelog@lists.xenproject.org; Sat, 13 Sep 2025 01: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 1uxEo7-007pAA-09
 for xen-changelog@lists.xenproject.org;
 Sat, 13 Sep 2025 01:12:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uxEo7-006Mcf-04
 for xen-changelog@lists.xenproject.org;
 Sat, 13 Sep 2025 01: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=9TwphJnOasz+JqfTMJqK4lRSnfcU44uLGtv07jckFek=; b=afRATME5STOBEXuf1IxiUTju34
	Aoafb3fdPPTn//6sFJjVBEkKsL6jZKRJKgD3sGuCP0NDHbkUDa4c0fBQ1TUqaFrYBtM4HqcLTDoia
	oRfRGpd6U4u1q9pPaAfAQ23Vudyb7z9V1Vb5d25tDjuJXMGSsxYBlyGm9dMq9AmsTmX8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] CI: Update x86 to use Debian Trixie
Message-Id: <E1uxEo7-006Mcf-04@xenbits.xenproject.org>
Date: Sat, 13 Sep 2025 01:12:03 +0000

commit 809bd86db6f40abf1c7edf9b0dbaf1d580bc7b19
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Sat Aug 9 21:05:11 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Sat Sep 13 01:02:28 2025 +0100

    CI: Update x86 to use Debian Trixie
    
    With the exception of the custom IBT job, copy all Debian 12 jobs making
    Debian 13 versions, then trim the Debian 12 ranconfig jobs.
    
    Update the test jobs using Debian 12 to use 13.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Denis Mukhin <dmukhin@ford.com>
    Reviewed-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/build/debian/13-x86_32.dockerfile | 52 ++++++++++++++++++++
 automation/build/debian/13-x86_64.dockerfile | 72 ++++++++++++++++++++++++++++
 automation/gitlab-ci/build.yaml              | 54 ++++++++++++++++-----
 automation/gitlab-ci/test.yaml               | 12 ++---
 automation/scripts/containerize              |  3 +-
 5 files changed, 174 insertions(+), 19 deletions(-)

diff --git a/automation/build/debian/13-x86_32.dockerfile b/automation/build/debian/13-x86_32.dockerfile
new file mode 100644
index 0000000000..464b4fc55e
--- /dev/null
+++ b/automation/build/debian/13-x86_32.dockerfile
@@ -0,0 +1,52 @@
+# syntax=docker/dockerfile:1
+FROM --platform=linux/i386 debian:trixie-slim
+LABEL maintainer.name="The Xen Project"
+LABEL maintainer.email="xen-devel@lists.xenproject.org"
+
+ENV DEBIAN_FRONTEND=noninteractive
+
+RUN <<EOF
+#!/bin/bash
+    set -eu
+
+    useradd --create-home user
+
+    apt-get update
+
+    DEPS=(
+        # Xen
+        bison
+        build-essential
+        checkpolicy
+        clang
+        flex
+
+        # Tools (general)
+        ca-certificates
+        cpio
+        git-core
+        pkg-config
+        wget
+        # libacpi
+        acpica-tools
+        # libxl
+        uuid-dev
+        libyajl-dev
+        # xentop
+        libncurses5-dev
+        # Python bindings
+        python3-dev
+        python3-setuptools
+        # Ocaml bindings/oxenstored
+        ocaml-nox
+        ocaml-findlib
+    )
+
+    apt-get -y --no-install-recommends install "${DEPS[@]}"
+
+    rm -rf /var/lib/apt/lists*
+EOF
+
+USER user
+WORKDIR /build
+ENTRYPOINT ["linux32"]
diff --git a/automation/build/debian/13-x86_64.dockerfile b/automation/build/debian/13-x86_64.dockerfile
new file mode 100644
index 0000000000..2c6c9d4a50
--- /dev/null
+++ b/automation/build/debian/13-x86_64.dockerfile
@@ -0,0 +1,72 @@
+# syntax=docker/dockerfile:1
+FROM --platform=linux/amd64 debian:trixie-slim
+LABEL maintainer.name="The Xen Project"
+LABEL maintainer.email="xen-devel@lists.xenproject.org"
+
+ENV DEBIAN_FRONTEND=noninteractive
+
+RUN <<EOF
+#!/bin/bash
+    set -eu
+
+    useradd --create-home user
+
+    apt-get update
+
+    DEPS=(
+        # Xen
+        bison
+        build-essential
+        checkpolicy
+        clang
+        flex
+
+        # Tools (general)
+        ca-certificates
+        cpio
+        git-core
+        pkg-config
+        wget
+        # libxenguest dombuilder
+        libbz2-dev
+        liblzma-dev
+        liblzo2-dev
+        libzstd-dev
+        zlib1g-dev
+        # libacpi
+        acpica-tools
+        # libxl
+        uuid-dev
+        libnl-3-dev
+        libyajl-dev
+        # RomBIOS
+        bcc
+        bin86
+        # xentop
+        libncurses5-dev
+        # Python bindings
+        python3-dev
+        python3-setuptools
+        # Golang bindings
+        golang-go
+        # Ocaml bindings/oxenstored
+        ocaml-nox
+        ocaml-findlib
+
+        # for test phase, qemu-* jobs
+        busybox-static
+        expect
+        ovmf
+        qemu-system-x86
+
+        # for build-each-commit-gcc
+        ccache
+    )
+
+    apt-get -y --no-install-recommends install "${DEPS[@]}"
+
+    rm -rf /var/lib/apt/lists*
+EOF
+
+USER user
+WORKDIR /build
diff --git a/automation/gitlab-ci/build.yaml b/automation/gitlab-ci/build.yaml
index f8e45f3467..4cb52fe597 100644
--- a/automation/gitlab-ci/build.yaml
+++ b/automation/gitlab-ci/build.yaml
@@ -309,15 +309,15 @@ alpine-3.18-gcc-debug:
       CONFIG_UCODE_SCAN_DEFAULT=y
       CONFIG_XHCI=y
 
-debian-12-x86_64-gcc-debug:
+debian-13-x86_64-gcc-debug:
   extends: .gcc-x86-64-build-debug
   variables:
-    CONTAINER: debian:12-x86_64
+    CONTAINER: debian:13-x86_64
 
-debian-12-x86_64-clang-debug:
+debian-13-x86_64-clang-debug:
   extends: .clang-x86-64-build-debug
   variables:
-    CONTAINER: debian:12-x86_64
+    CONTAINER: debian:13-x86_64
 
 debian-13-ppc64le-gcc-debug:
   extends: .gcc-ppc64le-cross-build-debug
@@ -545,24 +545,20 @@ debian-12-x86_64-clang:
   variables:
     CONTAINER: debian:12-x86_64
 
-debian-12-x86_64-clang-randconfig:
-  extends: .clang-x86-64-build
+debian-12-x86_64-clang-debug:
+  extends: .clang-x86-64-build-debug
   variables:
     CONTAINER: debian:12-x86_64
-    RANDCONFIG: y
-    EXTRA_FIXED_RANDCONFIG: |
-      CONFIG_COVERAGE=n # Disable coverage otherwise build times out.
 
 debian-12-x86_64-gcc:
   extends: .gcc-x86-64-build
   variables:
     CONTAINER: debian:12-x86_64
 
-debian-12-x86_64-gcc-randconfig:
-  extends: .gcc-x86-64-build
+debian-12-x86_64-gcc-debug:
+  extends: .gcc-x86-64-build-debug
   variables:
     CONTAINER: debian:12-x86_64
-    RANDCONFIG: y
 
 debian-12-x86_32-clang-debug:
   extends: .clang-x86-32-build-debug
@@ -574,6 +570,40 @@ debian-12-x86_32-gcc-debug:
   variables:
     CONTAINER: debian:12-x86_32
 
+debian-13-x86_64-clang:
+  extends: .clang-x86-64-build
+  variables:
+    CONTAINER: debian:13-x86_64
+
+debian-13-x86_64-clang-randconfig:
+  extends: .clang-x86-64-build
+  variables:
+    CONTAINER: debian:13-x86_64
+    RANDCONFIG: y
+    EXTRA_FIXED_RANDCONFIG: |
+      CONFIG_COVERAGE=n # Disable coverage otherwise build times out.
+
+debian-13-x86_64-gcc:
+  extends: .gcc-x86-64-build
+  variables:
+    CONTAINER: debian:13-x86_64
+
+debian-13-x86_64-gcc-randconfig:
+  extends: .gcc-x86-64-build
+  variables:
+    CONTAINER: debian:13-x86_64
+    RANDCONFIG: y
+
+debian-13-x86_32-clang-debug:
+  extends: .clang-x86-32-build-debug
+  variables:
+    CONTAINER: debian:13-x86_32
+
+debian-13-x86_32-gcc-debug:
+  extends: .gcc-x86-32-build-debug
+  variables:
+    CONTAINER: debian:13-x86_32
+
 fedora-41-x86_64-gcc:
   extends: .gcc-x86-64-build
   variables:
diff --git a/automation/gitlab-ci/test.yaml b/automation/gitlab-ci/test.yaml
index e8946e15dc..8d8f62c8d0 100644
--- a/automation/gitlab-ci/test.yaml
+++ b/automation/gitlab-ci/test.yaml
@@ -59,7 +59,7 @@
 .qemu-x86-64:
   extends: .test-jobs-common
   variables:
-    CONTAINER: debian:12-x86_64
+    CONTAINER: debian:13-x86_64
     LOGFILE: qemu-smoke-x86-64.log
   artifacts:
     paths:
@@ -661,35 +661,35 @@ qemu-smoke-x86-64-gcc:
   script:
     - ./automation/scripts/qemu-xtf.sh x86-64 pv64 example 2>&1 | tee ${LOGFILE}
   needs:
-    - debian-12-x86_64-gcc-debug
+    - debian-13-x86_64-gcc-debug
 
 qemu-smoke-x86-64-clang:
   extends: .qemu-smoke-x86-64
   script:
     - ./automation/scripts/qemu-xtf.sh x86-64 pv64 example 2>&1 | tee ${LOGFILE}
   needs:
-    - debian-12-x86_64-clang-debug
+    - debian-13-x86_64-clang-debug
 
 qemu-smoke-x86-64-gcc-pvh:
   extends: .qemu-smoke-x86-64
   script:
     - ./automation/scripts/qemu-xtf.sh x86-64 hvm64 example 2>&1 | tee ${LOGFILE}
   needs:
-    - debian-12-x86_64-gcc-debug
+    - debian-13-x86_64-gcc-debug
 
 qemu-smoke-x86-64-clang-pvh:
   extends: .qemu-smoke-x86-64
   script:
     - ./automation/scripts/qemu-xtf.sh x86-64 hvm64 example 2>&1 | tee ${LOGFILE}
   needs:
-    - debian-12-x86_64-clang-debug
+    - debian-13-x86_64-clang-debug
 
 qemu-smoke-x86-64-gcc-efi:
   extends: .qemu-smoke-x86-64
   script:
     - ./automation/scripts/qemu-xtf.sh x86-64-efi pv64 example 2>&1 | tee ${LOGFILE}
   needs:
-    - debian-12-x86_64-gcc-debug
+    - debian-13-x86_64-gcc-debug
 
 qemu-xtf-argo-x86_64-gcc-debug:
   extends: .qemu-smoke-x86-64
diff --git a/automation/scripts/containerize b/automation/scripts/containerize
index 65c8804ce5..743567cb77 100755
--- a/automation/scripts/containerize
+++ b/automation/scripts/containerize
@@ -35,7 +35,8 @@ case "_${CONTAINER}" in
     _bookworm-riscv64) CONTAINER="${BASE}/debian:12-riscv64" ;;
     _trixie-riscv64) CONTAINER="${BASE}/debian:13-riscv64" ;;
     _bookworm-x86_64-gcc-ibt) CONTAINER="${BASE}/debian:12-x86_64-gcc-ibt" ;;
-    _bookworm|_bookworm-x86_64|_) CONTAINER="${BASE}/debian:12-x86_64" ;;
+    _bookworm|_bookworm-x86_64) CONTAINER="${BASE}/debian:12-x86_64" ;;
+    _trixie-x86_64|_) CONTAINER="${BASE}/debian:13-x86_64" ;;
     _bookworm-i386|_bookworm-x86_32) CONTAINER="${BASE}/debian:12-x86_32" ;;
     _bookworm-arm64v8-arm32-gcc) CONTAINER="${BASE}/debian:bookworm-arm64v8-arm32-gcc" ;;
     _bookworm-arm64v8) CONTAINER="${BASE}/debian:bookworm-arm64v8" ;;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Sep 13 01:12:14 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 13 Sep 2025 01:12:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1122893.1466369 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uxEoI-0005sK-Ts; Sat, 13 Sep 2025 01:12:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1122893.1466369; Sat, 13 Sep 2025 01: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 1uxEoI-0005sC-Qx; Sat, 13 Sep 2025 01:12:14 +0000
Received: by outflank-mailman (input) for mailman id 1122893;
 Sat, 13 Sep 2025 01: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 1uxEoH-0005rx-7B
 for xen-changelog@lists.xenproject.org; Sat, 13 Sep 2025 01: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 1uxEoH-007pAJ-0c
 for xen-changelog@lists.xenproject.org;
 Sat, 13 Sep 2025 01:12:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uxEoH-006Mdp-0K
 for xen-changelog@lists.xenproject.org;
 Sat, 13 Sep 2025 01: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=mC+04fXm5Pvq1bQ/m/xzF16QJtCXIqDOyaUCEwrWZ+M=; b=2IkTSdSS+rMPji+9pIPf8V72hi
	TeOBaiBBD1grbXx1C57pHawpTsnpNb1IhTChDi1a6yIGfVANqS6puSZikR1rW600NTjJHlleWzvr/
	kk670V8FFJw8BTeyyN1n7J4ugflQ9GtM96TQTMP591Iwjj5tTIAm5aw7r9d4+CNjCnEg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] CHANGELOG: Notes about distro changes in CI
Message-Id: <E1uxEoH-006Mdp-0K@xenbits.xenproject.org>
Date: Sat, 13 Sep 2025 01:12:13 +0000

commit 09de61c200c0b5c7d615e135434a5e187f9a8349
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Sep 10 23:17:42 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Sat Sep 13 01:02:29 2025 +0100

    CHANGELOG: Notes about distro changes in CI
    
    Also state the RISC-V baseline now it's been set, as it's the reason why
    RISC-V Bullseye got dropped.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Reviewed-by: Denis Mukhin <dmukhin@ford.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
    ---
    CC: Anthony PERARD <anthony.perard@vates.tech>
    CC: Michal Orzel <michal.orzel@amd.com>
    CC: Jan Beulich <jbeulich@suse.com>
    CC: Julien Grall <julien@xen.org>
    CC: Roger Pau Monné <roger.pau@citrix.com>
    CC: Stefano Stabellini <sstabellini@kernel.org>
    CC: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    
    v2:
     * New
---
 CHANGELOG.md | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7bd96ac09d..ca1b43b940 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,6 +10,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
  - The minimum toolchain requirements have increased for some architectures:
    - For x86, GCC 5.1 and Binutils 2.25, or Clang/LLVM 11
    - For ARM32 and ARM64, GCC 5.1 and Binutils 2.25
+   - For RISC-V, GCC 12.2 and Binutils 2.39
+ - Debian Trixie added to CI.  Debian Bullseye retired from CI for RISC-V due
+   to the baseline change.
  - Linux based device model stubdomains are now fully supported.
 
  - On x86:
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Sep 13 12:11:06 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 13 Sep 2025 12:11:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1123208.1466412 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uxP5q-0007yS-TJ; Sat, 13 Sep 2025 12:11:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1123208.1466412; Sat, 13 Sep 2025 12: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 1uxP5q-0007yK-QJ; Sat, 13 Sep 2025 12:11:02 +0000
Received: by outflank-mailman (input) for mailman id 1123208;
 Sat, 13 Sep 2025 12: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 1uxP5p-0007yE-PV
 for xen-changelog@lists.xenproject.org; Sat, 13 Sep 2025 12: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 1uxP5p-0082RX-2G
 for xen-changelog@lists.xenproject.org;
 Sat, 13 Sep 2025 12:11:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uxP5p-00711M-26
 for xen-changelog@lists.xenproject.org;
 Sat, 13 Sep 2025 12: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=gD8UVyo5JUreE7ySFlNMWLXBPa/lgkF/7OfWHLpXo8E=; b=jdaQw+XLNwqcIvvnHr1LvQO2ct
	llwiyCTiSWXL9oVTFanPBy3RLiSAHC2qsbrmZtrmrmboS+Hb/Ej0r9FofRiLyO4viqBJLUxD/AbZW
	gj7XuVC71Cd0RUL0JqD9jd7z1caCmJrQ0M/YmHo/Lsxz/KeTKcQ8mybrPJWSVpnRqwVo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/domctl: Fix double domid_free in XEN_DOMCTL_createdomain error path
Message-Id: <E1uxP5p-00711M-26@xenbits.xenproject.org>
Date: Sat, 13 Sep 2025 12:11:01 +0000

commit 656b9ca03bd340715aecf405da63c515afb344a1
Author:     Oleksii Moisieiev <Oleksii_Moisieiev@epam.com>
AuthorDate: Sat Sep 13 10:44:39 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Sat Sep 13 12:59:29 2025 +0100

    xen/domctl: Fix double domid_free in XEN_DOMCTL_createdomain error path
    
    Remove redundant domid_free() call in the XEN_DOMCTL_createdomain error
    handling path to prevent a double-free condition.
    
    When domain_create() fails, it internally calls _domain_destroy() during
    its cleanup routine, which already invokes domid_free() to release the
    allocated domain ID. The additional domid_free() call in the domctl error
    path creates a double-free scenario, triggering an assertion failure in
    domid.c:
    
        Assertion 'rc' failed at common/domid.c:84
    
    The domain creation flow is:
    1. domid_alloc() allocates a domain ID
    2. domain_create() is called with the allocated ID
    3. If domain_create() fails:
       a) domain_create() calls _domain_destroy() internally
       b) _domain_destroy() calls domid_free() to release the ID
       c) domctl incorrectly calls domid_free() again
    
    This double-free violates the domain ID management invariants and causes
    system instability. The fix ensures domid_free() is called exactly once
    per allocated domain ID, maintaining proper resource cleanup
    semantics.
    
    Signed-off-by: Oleksii Moisieiev <oleksii_moisieiev@epam.com>
    Fixes: 2d5065060710 ("xen/domain: unify domain ID allocation")
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/common/domctl.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/xen/common/domctl.c b/xen/common/domctl.c
index 71e712c1f3..954d790226 100644
--- a/xen/common/domctl.c
+++ b/xen/common/domctl.c
@@ -421,7 +421,6 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl)
         d = domain_create(domid, &op->u.createdomain, false);
         if ( IS_ERR(d) )
         {
-            domid_free(domid);
             ret = PTR_ERR(d);
             d = NULL;
             break;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Sat Sep 13 14:33:06 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 13 Sep 2025 14:33:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1123319.1466426 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1uxRJH-0007T0-De; Sat, 13 Sep 2025 14:33:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1123319.1466426; Sat, 13 Sep 2025 14: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 1uxRJH-0007Ss-BB; Sat, 13 Sep 2025 14:33:03 +0000
Received: by outflank-mailman (input) for mailman id 1123319;
 Sat, 13 Sep 2025 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 1uxRJF-0007Sm-Qj
 for xen-changelog@lists.xenproject.org; Sat, 13 Sep 2025 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 1uxRJF-00855Q-2K
 for xen-changelog@lists.xenproject.org;
 Sat, 13 Sep 2025 14:33:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1uxRJF-0079yK-1r
 for xen-changelog@lists.xenproject.org;
 Sat, 13 Sep 2025 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=QmLJjxX8ZBcwmDuVjkdKOmSCFK943LMZxSfnMCPt13U=; b=6D+5Gmg6risyhAF6LZHjiGq56P
	PWdnLEby7ZGslSpC1n/2la/ejuEDR8DhS6kRfSikVVC2/hq3z6wUR63zBM2ZLaBaDviU80okU9iYc
	LrmmoFO3a9QWgle6Er5zDtvjeDGaODGylKtymVU656ZSk3cSdFugXYcYp19+lJPCdL7g=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/domctl: Fix double domid_free in XEN_DOMCTL_createdomain error path
Message-Id: <E1uxRJF-0079yK-1r@xenbits.xenproject.org>
Date: Sat, 13 Sep 2025 14:33:01 +0000

commit 656b9ca03bd340715aecf405da63c515afb344a1
Author:     Oleksii Moisieiev <Oleksii_Moisieiev@epam.com>
AuthorDate: Sat Sep 13 10:44:39 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Sat Sep 13 12:59:29 2025 +0100

    xen/domctl: Fix double domid_free in XEN_DOMCTL_createdomain error path
    
    Remove redundant domid_free() call in the XEN_DOMCTL_createdomain error
    handling path to prevent a double-free condition.
    
    When domain_create() fails, it internally calls _domain_destroy() during
    its cleanup routine, which already invokes domid_free() to release the
    allocated domain ID. The additional domid_free() call in the domctl error
    path creates a double-free scenario, triggering an assertion failure in
    domid.c:
    
        Assertion 'rc' failed at common/domid.c:84
    
    The domain creation flow is:
    1. domid_alloc() allocates a domain ID
    2. domain_create() is called with the allocated ID
    3. If domain_create() fails:
       a) domain_create() calls _domain_destroy() internally
       b) _domain_destroy() calls domid_free() to release the ID
       c) domctl incorrectly calls domid_free() again
    
    This double-free violates the domain ID management invariants and causes
    system instability. The fix ensures domid_free() is called exactly once
    per allocated domain ID, maintaining proper resource cleanup
    semantics.
    
    Signed-off-by: Oleksii Moisieiev <oleksii_moisieiev@epam.com>
    Fixes: 2d5065060710 ("xen/domain: unify domain ID allocation")
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/common/domctl.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/xen/common/domctl.c b/xen/common/domctl.c
index 71e712c1f3..954d790226 100644
--- a/xen/common/domctl.c
+++ b/xen/common/domctl.c
@@ -421,7 +421,6 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl)
         d = domain_create(domid, &op->u.createdomain, false);
         if ( IS_ERR(d) )
         {
-            domid_free(domid);
             ret = PTR_ERR(d);
             d = NULL;
             break;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Sep 25 09:55:07 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Sep 2025 09:55:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1130300.1469843 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1v1igp-0006P4-Qr; Thu, 25 Sep 2025 09:55:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1130300.1469843; Thu, 25 Sep 2025 09: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 1v1igp-0006Ow-O8; Thu, 25 Sep 2025 09:55:03 +0000
Received: by outflank-mailman (input) for mailman id 1130300;
 Thu, 25 Sep 2025 09: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 1v1igo-0006Oq-Jy
 for xen-changelog@lists.xenproject.org; Thu, 25 Sep 2025 09: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 1v1igo-009cL4-1l
 for xen-changelog@lists.xenproject.org;
 Thu, 25 Sep 2025 09:55:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1v1igo-00E0b7-1e
 for xen-changelog@lists.xenproject.org;
 Thu, 25 Sep 2025 09: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=YPDN79xdHVOFDSM3lu+y2DiCoHvbxoqRLD+DK1ddLeQ=; b=3I1YJXtXUmzBVdwQNuSXYvst1O
	UZrcmbIIVUNN2PnpNJrV8nz/qlyAaHnSr3WyBNFfKKsB6F9KJ7bEJw9lvPgbw+/8M8+U6Ne6k7e1k
	ULG3SBen/CpQz2t7zP5yoIiA2Uic94oY6LiJOB9eAjIyTz+FVXanvIc+9Ng1fhmGYwwE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] SUPPORT.md: add xenstorepvh-stubdom live update
Message-Id: <E1v1igo-00E0b7-1e@xenbits.xenproject.org>
Date: Thu, 25 Sep 2025 09:55:02 +0000

commit 39785fabd25edda5db1b4465726f76204b5c9d16
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Thu Sep 25 09:18:38 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Sep 25 09:18:38 2025 +0200

    SUPPORT.md: add xenstorepvh-stubdom live update
    
    Live update is now working with the PVH variant of xenstore-stubdom.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 SUPPORT.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/SUPPORT.md b/SUPPORT.md
index 6a82a92189..eb44ee85fd 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -280,7 +280,7 @@ or itself will not be regarded a security issue.
 ### C xenstore stubdom PVH
 
     Status: Supported
-    Status, Liveupdate: Not implemented
+    Status, Liveupdate: Supported
 
 ### OCaml xenstored daemon
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Sep 25 09:55:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Sep 2025 09:55:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1130301.1469848 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1v1igz-0006Qm-SP; Thu, 25 Sep 2025 09:55:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1130301.1469848; Thu, 25 Sep 2025 09: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 1v1igz-0006Qb-PS; Thu, 25 Sep 2025 09:55:13 +0000
Received: by outflank-mailman (input) for mailman id 1130301;
 Thu, 25 Sep 2025 09: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 1v1igy-0006QR-Lr
 for xen-changelog@lists.xenproject.org; Thu, 25 Sep 2025 09: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 1v1igy-009cLU-25
 for xen-changelog@lists.xenproject.org;
 Thu, 25 Sep 2025 09:55:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1v1igy-00E0cx-1w
 for xen-changelog@lists.xenproject.org;
 Thu, 25 Sep 2025 09: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=t9lC7RF1es2dVBMvA2Q+4BUxTvQEU983we6KRqW8JRg=; b=sbEoXMDf9yY2Vdp46MDPHD/64m
	4Lk3Z7QEquhQTY/zXE66fStN4hiaZlSm0EYY03NEcowVxP0kkRE5uTeCn5TIDgS8wDkRHwRhblAxQ
	/cNDv2dPh3B/AEmfIJwA4jpMEWz4lZnuMXFZ/vv4qPRXaF6FBFpehlO2EfXlbmW32cnA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] libacpi: Remove CPU hotplug and GPE handling from PVH DSDTs
Message-Id: <E1v1igy-00E0cx-1w@xenbits.xenproject.org>
Date: Thu, 25 Sep 2025 09:55:12 +0000

commit b59e564aa0830f60214b9b5afb4f8543dd1bf2b0
Author:     Alejandro Vallejo <alejandro.garciavallejo@amd.com>
AuthorDate: Thu Sep 25 09:18:55 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Sep 25 09:18:55 2025 +0200

    libacpi: Remove CPU hotplug and GPE handling from PVH DSDTs
    
    PVH guests have no DM, so this causes the guest to fetch the online CPU
    bitmap from an unbacked 0xaf00 PIO port when executing the GPE handler.
    
    Seeing how ACPI CPU hotplug is the only event delivered via GPE, remove
    the GPE handler in addition to anything ACPI CPU hotplug related.
    
    This shrinks PVH's DSDT substantially and prevents spuriously executing
    a large amount of AML with no purpose at all.
    
    Fixes: 062975dc9441("acpi: PVH guests need _E02 method")
    Signed-off-by: Alejandro Vallejo <alejandro.garciavallejo@amd.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 tools/libacpi/mk_dsdt.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/tools/libacpi/mk_dsdt.c b/tools/libacpi/mk_dsdt.c
index 8ac4f9d0b4..f71de6c8c6 100644
--- a/tools/libacpi/mk_dsdt.c
+++ b/tools/libacpi/mk_dsdt.c
@@ -218,6 +218,11 @@ int main(int argc, char **argv)
     pop_block();
     /**** Processor end ****/
 #else
+    if (dm_version == QEMU_NONE) {
+        pop_block();
+        pop_block();
+        return 0;
+    }
 
     /* Operation Region 'PRST': bitmask of online CPUs. */
     stmt("OperationRegion", "PRST, SystemIO, %#x, %d",
@@ -264,10 +269,6 @@ int main(int argc, char **argv)
     pop_block();
     pop_block();
 
-    if (dm_version == QEMU_NONE) {
-        pop_block();
-        return 0;
-    }
     /**** Processor end ****/
 
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Sep 25 09:55:23 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Sep 2025 09:55:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1130302.1469852 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1v1ih9-0006TG-UT; Thu, 25 Sep 2025 09:55:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1130302.1469852; Thu, 25 Sep 2025 09: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 1v1ih9-0006T6-Qz; Thu, 25 Sep 2025 09:55:23 +0000
Received: by outflank-mailman (input) for mailman id 1130302;
 Thu, 25 Sep 2025 09: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 1v1ih8-0006Sc-Oq
 for xen-changelog@lists.xenproject.org; Thu, 25 Sep 2025 09: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 1v1ih8-009cLe-2N
 for xen-changelog@lists.xenproject.org;
 Thu, 25 Sep 2025 09:55:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1v1ih8-00E0eQ-2G
 for xen-changelog@lists.xenproject.org;
 Thu, 25 Sep 2025 09: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=ueCenYl0gR1o8q29U/r1rSYtcPxw2mHncVvOaqp8Z/0=; b=SVROjqy9WKYpB7efQlWCqGN/JF
	xtkx8/IIy+xmGiIu2E9MTOM7CUIeqar4kpSff2aJv+Q36fTd02X/M9QwOXdDMBgZSCvxkEFWrnQkn
	4Zck9UrlkT4LL8YrLK54W2U8JBJ+0Vad6MbQYdVAY/0z6ga04JrFodMk1WkZXY/2fc9U=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] MAINTAINERS: add myself as vPCI reviewer
Message-Id: <E1v1ih8-00E0eQ-2G@xenbits.xenproject.org>
Date: Thu, 25 Sep 2025 09:55:22 +0000

commit ac58e34a0960bcc71583edfc6b4d6baa5e81c7d0
Author:     Stewart Hildebrand <stewart.hildebrand@amd.com>
AuthorDate: Thu Sep 25 09:19:21 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Sep 25 09:19:21 2025 +0200

    MAINTAINERS: add myself as vPCI reviewer
    
    I'd like to take a more active role in reviewing vPCI bits.
    
    Signed-off-by: Stewart Hildebrand <stewart.hildebrand@amd.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 31dbba54bb..793561f63f 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -578,6 +578,7 @@ F:	xen/include/*/vm_event.h
 
 VPCI
 M:	Roger Pau Monné <roger.pau@citrix.com>
+R:	Stewart Hildebrand <stewart.hildebrand@amd.com>
 S:	Supported
 F:	tools/tests/vpci/
 F:	xen/drivers/vpci/
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Sep 25 09:55:33 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Sep 2025 09:55:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1130303.1469855 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1v1ihJ-0006Ve-VC; Thu, 25 Sep 2025 09:55:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1130303.1469855; Thu, 25 Sep 2025 09: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 1v1ihJ-0006VW-ST; Thu, 25 Sep 2025 09:55:33 +0000
Received: by outflank-mailman (input) for mailman id 1130303;
 Thu, 25 Sep 2025 09: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 1v1ihI-0006VO-RJ
 for xen-changelog@lists.xenproject.org; Thu, 25 Sep 2025 09: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 1v1ihI-009cLo-2d
 for xen-changelog@lists.xenproject.org;
 Thu, 25 Sep 2025 09:55:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1v1ihI-00E0fS-2X
 for xen-changelog@lists.xenproject.org;
 Thu, 25 Sep 2025 09: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=CwVzIC9liB7CHiq8hyqjj8Exq0cV7kvGstl2TWOlvKc=; b=kj+yHYobLrizvvHtRf5oMeb1R3
	ZPXyqVACjotM32IjXwnT2ZhUiVSGDulfMj2/JJp6qE5zFqcAPU+lUN5e6PVcboMJBE2LZoMCY4nfU
	mXadvUXLOjVBf/UmPXnO6e5BmTGyPxbysA5Ii8q8FMwBRu//jfWZ/pltlbfJn4mjPNC4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/cpufreq: make HW_ALL the only expected value for CPPC mode
Message-Id: <E1v1ihI-00E0fS-2X@xenbits.xenproject.org>
Date: Thu, 25 Sep 2025 09:55:32 +0000

commit f404dad459a610c33d5987a3c2eb8bafda720932
Author:     Penny Zheng <Penny.Zheng@amd.com>
AuthorDate: Thu Sep 25 09:19:41 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Sep 25 09:19:41 2025 +0200

    xen/cpufreq: make HW_ALL the only expected value for CPPC mode
    
    Right now, no matter for code construction or hardware restriction, HW_ALL
    shall be the only expected values in _PSD for AMD CPPC mode
    
    Suggested-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Penny Zheng <Penny.Zheng@amd.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/drivers/cpufreq/cpufreq.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/xen/drivers/cpufreq/cpufreq.c b/xen/drivers/cpufreq/cpufreq.c
index fe6bd7ff25..4b74f5590b 100644
--- a/xen/drivers/cpufreq/cpufreq.c
+++ b/xen/drivers/cpufreq/cpufreq.c
@@ -765,6 +765,16 @@ int set_cppc_pminfo(unsigned int acpi_id,
         goto out;
     }
 
+    /* Right now, HW_ALL shall be the only expected value in CPPC mode */
+    if ( cppc_data->shared_type != CPUFREQ_SHARED_TYPE_HW )
+    {
+        ret = -EINVAL;
+        printk_once(XENLOG_ERR
+                    "Unsupported sharing type %u in CPPC mode\n",
+                    cppc_data->shared_type);
+        goto out;
+    }
+
     if ( cppc_data->flags & XEN_CPPC_CPC )
     {
         if ( cppc_data->cpc.highest_perf == 0 ||
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Sep 25 09:55:44 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Sep 2025 09:55:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1130304.1469859 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1v1ihU-0006Xr-0T; Thu, 25 Sep 2025 09:55:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1130304.1469859; Thu, 25 Sep 2025 09: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 1v1ihT-0006Xj-Tt; Thu, 25 Sep 2025 09:55:43 +0000
Received: by outflank-mailman (input) for mailman id 1130304;
 Thu, 25 Sep 2025 09: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 1v1ihS-0006XU-UX
 for xen-changelog@lists.xenproject.org; Thu, 25 Sep 2025 09: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 1v1ihS-009cLv-2x
 for xen-changelog@lists.xenproject.org;
 Thu, 25 Sep 2025 09:55:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1v1ihS-00E0j5-2r
 for xen-changelog@lists.xenproject.org;
 Thu, 25 Sep 2025 09: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=Fjmie4pkc924Svf4U1y++D+ow2cJi64GZSC4MDxXvpE=; b=6C8/Ee9r/3C9ywNYyIFBeCg2oi
	63+pmkNYskb7WwRptzCi0FcRdL0FjU96rR9SLJQxHNVqjMOu/Ygft9+R2zpmdHTzOJRFPHLq+On18
	Km3OWox7kalSXdssIvzO9inmqRwzI1eJ7QOQygs4LyHQDAS5u9DJGW2JHD7LUR0H3YPY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/cpufreq: implement amd-cppc driver for CPPC in passive mode
Message-Id: <E1v1ihS-00E0j5-2r@xenbits.xenproject.org>
Date: Thu, 25 Sep 2025 09:55:42 +0000

commit f3727dd10a86605946aafddd46473a3d85e134ea
Author:     Penny Zheng <Penny.Zheng@amd.com>
AuthorDate: Thu Sep 25 09:20:36 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Sep 25 09:20:36 2025 +0200

    xen/cpufreq: implement amd-cppc driver for CPPC in passive mode
    
    amd-cppc is the AMD CPU performance scaling driver that introduces a
    new CPU frequency control mechanism. The new mechanism is based on
    Collaborative Processor Performance Control (CPPC) which is a finer grain
    frequency management than legacy ACPI hardware P-States.
    Current AMD CPU platforms are using the ACPI P-states driver to
    manage CPU frequency and clocks with switching only in 3 P-states, while the
    new amd-cppc allows a more flexible, low-latency interface for Xen
    to directly communicate the performance hints to hardware.
    
    "amd-cppc" driver is responsible for implementing CPPC in passive mode, which
    still leverages Xen governors such as *ondemand*, *performance*, etc, to
    calculate the performance hints. In the future, we will introduce an advanced
    active mode to enable autonomous performence level selection.
    
    Field epp, energy performance preference, which only has meaning when active
    mode is enabled and will be introduced later in details, so we read
    pre-defined BIOS value for it in passive mode.
    
    Signed-off-by: Penny Zheng <Penny.Zheng@amd.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/acpi/cpufreq/amd-cppc.c | 418 ++++++++++++++++++++++++++++++++++-
 xen/arch/x86/cpu/amd.c               |   8 +-
 xen/arch/x86/include/asm/amd.h       |   2 +
 xen/arch/x86/include/asm/msr-index.h |   6 +
 xen/include/public/sysctl.h          |   1 +
 5 files changed, 430 insertions(+), 5 deletions(-)

diff --git a/xen/arch/x86/acpi/cpufreq/amd-cppc.c b/xen/arch/x86/acpi/cpufreq/amd-cppc.c
index 3377783f7e..5b99b86fb7 100644
--- a/xen/arch/x86/acpi/cpufreq/amd-cppc.c
+++ b/xen/arch/x86/acpi/cpufreq/amd-cppc.c
@@ -14,7 +14,98 @@
 #include <xen/domain.h>
 #include <xen/init.h>
 #include <xen/param.h>
+#include <xen/percpu.h>
+#include <xen/xvmalloc.h>
 #include <acpi/cpufreq/cpufreq.h>
+#include <asm/amd.h>
+#include <asm/msr.h>
+
+#define amd_cppc_err(cpu, fmt, args...)                             \
+    printk(XENLOG_ERR "AMD-CPPC: CPU%u error: " fmt, cpu, ## args)
+#define amd_cppc_warn(cpu, fmt, args...)                            \
+    printk(XENLOG_WARNING "AMD-CPPC: CPU%u warning: " fmt, cpu, ## args)
+#define amd_cppc_verbose(cpu, fmt, args...)                         \
+({                                                                  \
+    if ( cpufreq_verbose )                                          \
+        printk(XENLOG_DEBUG "AMD-CPPC: CPU%u " fmt, cpu, ## args);  \
+})
+
+/*
+ * Field highest_perf, nominal_perf, lowest_nonlinear_perf, and lowest_perf
+ * contain the values read from CPPC capability MSR. They represent the limits
+ * of managed performance range as well as the dynamic capability, which may
+ * change during processor operation
+ * Field highest_perf represents highest performance, which is the absolute
+ * maximum performance an individual processor may reach, assuming ideal
+ * conditions. This performance level may not be sustainable for long
+ * durations and may only be achievable if other platform components
+ * are in a specific state; for example, it may require other processors be
+ * in an idle state. This would be equivalent to the highest frequencies
+ * supported by the processor.
+ * Field nominal_perf represents maximum sustained performance level of the
+ * processor, assuming ideal operating conditions. All cores/processors are
+ * expected to be able to sustain their nominal performance state
+ * simultaneously.
+ * Field lowest_nonlinear_perf represents Lowest Nonlinear Performance, which
+ * is the lowest performance level at which nonlinear power savings are
+ * achieved. Above this threshold, lower performance levels should be
+ * generally more energy efficient than higher performance levels. So in
+ * traditional terms, this represents the P-state range of performance levels.
+ * Field lowest_perf represents the absolute lowest performance level of the
+ * platform. Selecting it may cause an efficiency penalty but should reduce
+ * the instantaneous power consumption of the processor. So in traditional
+ * terms, this represents the T-state range of performance levels.
+ *
+ * Field max_perf, min_perf, des_perf store the values for CPPC request MSR.
+ * Software passes performance goals through these fields.
+ * Field max_perf conveys the maximum performance level at which the platform
+ * may run. And it may be set to any performance value in the range
+ * [lowest_perf, highest_perf], inclusive.
+ * Field min_perf conveys the minimum performance level at which the platform
+ * may run. And it may be set to any performance value in the range
+ * [lowest_perf, highest_perf], inclusive but must be less than or equal to
+ * max_perf.
+ * Field des_perf conveys performance level Xen governor is requesting. And it
+ * may be set to any performance value in the range [min_perf, max_perf],
+ * inclusive.
+ * Field epp represents energy performance preference, which only has meaning
+ * when active mode is enabled.
+ */
+struct amd_cppc_drv_data
+{
+    const struct xen_processor_cppc *cppc_data;
+    union {
+        uint64_t raw;
+        struct {
+            unsigned int lowest_perf:8;
+            unsigned int lowest_nonlinear_perf:8;
+            unsigned int nominal_perf:8;
+            unsigned int highest_perf:8;
+            unsigned int :32;
+        };
+    } caps;
+    union {
+        uint64_t raw;
+        struct {
+            unsigned int max_perf:8;
+            unsigned int min_perf:8;
+            unsigned int des_perf:8;
+            unsigned int epp:8;
+            unsigned int :32;
+        };
+    } req;
+
+    int err;
+};
+
+static DEFINE_PER_CPU_READ_MOSTLY(struct amd_cppc_drv_data *,
+                                  amd_cppc_drv_data);
+/*
+ * Core max frequency read from PstateDef as anchor point
+ * for freq-to-perf transition
+ */
+static DEFINE_PER_CPU_READ_MOSTLY(unsigned int, pxfreq_mhz);
+static DEFINE_PER_CPU_READ_MOSTLY(uint8_t, epp_init);
 
 static bool __init amd_cppc_handle_option(const char *s, const char *end)
 {
@@ -50,10 +141,335 @@ int __init amd_cppc_cmdline_parse(const char *s, const char *e)
     return 0;
 }
 
+/*
+ * If CPPC lowest_freq and nominal_freq registers are exposed then we can
+ * use them to convert perf to freq and vice versa. The conversion is
+ * extrapolated as an linear function passing by the 2 points:
+ *  - (Low perf, Low freq)
+ *  - (Nominal perf, Nominal freq)
+ * Parameter freq is always in kHz.
+ */
+static int amd_cppc_khz_to_perf(const struct amd_cppc_drv_data *data,
+                                unsigned int freq, uint8_t *perf)
+{
+    const struct xen_processor_cppc *cppc_data = data->cppc_data;
+    unsigned int mul, div;
+    int offset = 0, res;
+
+    if ( cppc_data->cpc.lowest_mhz &&
+         data->caps.nominal_perf > data->caps.lowest_perf &&
+         cppc_data->cpc.nominal_mhz > cppc_data->cpc.lowest_mhz )
+    {
+        mul = data->caps.nominal_perf - data->caps.lowest_perf;
+        div = cppc_data->cpc.nominal_mhz - cppc_data->cpc.lowest_mhz;
+
+        /*
+         * We don't need to convert to kHz for computing offset and can
+         * directly use nominal_mhz and lowest_mhz as the division
+         * will remove the frequency unit.
+         */
+        offset = data->caps.nominal_perf -
+                 (mul * cppc_data->cpc.nominal_mhz) / div;
+    }
+    else
+    {
+        /* Read Processor Max Speed(MHz) as anchor point */
+        mul = data->caps.highest_perf;
+        div = this_cpu(pxfreq_mhz);
+        if ( !div )
+            return -EOPNOTSUPP;
+    }
+
+    res = offset + (mul * freq) / (div * 1000);
+    if ( res > UINT8_MAX )
+    {
+        printk_once(XENLOG_WARNING
+                    "Perf value exceeds maximum value 255: %d\n", res);
+        *perf = UINT8_MAX;
+        return 0;
+    }
+    if ( res <= 0 )
+    {
+        printk_once(XENLOG_WARNING
+                    "Perf value smaller than minimum value: %d\n", res);
+        return -ERANGE;
+    }
+    *perf = res;
+
+    return 0;
+}
+
+/*
+ * _CPC may define nominal frequecy and lowest frequency, if not, use
+ * Processor Max Speed as anchor point to calculate.
+ * Output freq stores cpc frequency in kHz
+ */
+static int amd_get_cpc_freq(const struct amd_cppc_drv_data *data,
+                            unsigned int cpc_mhz, uint8_t perf,
+                            unsigned int *freq)
+{
+    unsigned int mul, div, res;
+
+    if ( cpc_mhz )
+    {
+        /* Switch to kHz */
+        *freq = cpc_mhz * 1000;
+        return 0;
+    }
+
+    /* Read Processor Max Speed(MHz) as anchor point */
+    mul = this_cpu(pxfreq_mhz);
+    if ( !mul )
+        return -EOPNOTSUPP;
+    div = data->caps.highest_perf;
+    res = (mul * perf * 1000) / div;
+    if ( unlikely(!res) )
+        return -EOPNOTSUPP;
+
+    return 0;
+}
+
+/* Output max_freq stores calculated maximum frequency in kHz */
+static int amd_get_max_freq(const struct amd_cppc_drv_data *data,
+                            unsigned int *max_freq)
+{
+    unsigned int nom_freq = 0;
+    int res;
+
+    res = amd_get_cpc_freq(data, data->cppc_data->cpc.nominal_mhz,
+                           data->caps.nominal_perf, &nom_freq);
+    if ( res )
+        return res;
+
+    *max_freq = (data->caps.highest_perf * nom_freq) / data->caps.nominal_perf;
+
+    return 0;
+}
+
+static int cf_check amd_cppc_cpufreq_verify(struct cpufreq_policy *policy)
+{
+    cpufreq_verify_within_limits(policy, policy->cpuinfo.min_freq,
+                                 policy->cpuinfo.max_freq);
+
+    return 0;
+}
+
+static void cf_check amd_cppc_write_request_msrs(void *info)
+{
+    const struct amd_cppc_drv_data *data = info;
+
+    wrmsrl(MSR_AMD_CPPC_REQ, data->req.raw);
+}
+
+static void amd_cppc_write_request(unsigned int cpu, uint8_t min_perf,
+                                   uint8_t des_perf, uint8_t max_perf,
+                                   uint8_t epp)
+{
+    struct amd_cppc_drv_data *data = per_cpu(amd_cppc_drv_data, cpu);
+    uint64_t prev = data->req.raw;
+
+    data->req.min_perf = min_perf;
+    data->req.max_perf = max_perf;
+    data->req.des_perf = des_perf;
+    data->req.epp = epp;
+
+    if ( prev == data->req.raw )
+        return;
+
+    on_selected_cpus(cpumask_of(cpu), amd_cppc_write_request_msrs, data, 1);
+}
+
+static int cf_check amd_cppc_cpufreq_target(struct cpufreq_policy *policy,
+                                            unsigned int target_freq,
+                                            unsigned int relation)
+{
+    unsigned int cpu = policy->cpu;
+    const struct amd_cppc_drv_data *data = per_cpu(amd_cppc_drv_data, cpu);
+    uint8_t des_perf;
+    int res;
+
+    if ( unlikely(!target_freq) )
+        return 0;
+
+    res = amd_cppc_khz_to_perf(data, target_freq, &des_perf);
+    if ( res )
+        return res;
+
+    /*
+     * Having a performance level lower than the lowest nonlinear
+     * performance level, such as, lowest_perf <= perf <= lowest_nonliner_perf,
+     * may actually cause an efficiency penalty, So when deciding the min_perf
+     * value, we prefer lowest nonlinear performance over lowest performance.
+     */
+    amd_cppc_write_request(policy->cpu, data->caps.lowest_nonlinear_perf,
+                           des_perf, data->caps.highest_perf,
+                           /* Pre-defined BIOS value for passive mode */
+                           per_cpu(epp_init, policy->cpu));
+    return 0;
+}
+
+static void cf_check amd_cppc_init_msrs(void *info)
+{
+    struct cpufreq_policy *policy = info;
+    struct amd_cppc_drv_data *data = this_cpu(amd_cppc_drv_data);
+    uint64_t val;
+    unsigned int min_freq = 0, nominal_freq = 0, max_freq;
+
+    /* Package level MSR */
+    rdmsrl(MSR_AMD_CPPC_ENABLE, val);
+    /*
+     * Only when Enable bit is on, the hardware will calculate the processor’s
+     * performance capabilities and initialize the performance level fields in
+     * the CPPC capability registers.
+     */
+    if ( !(val & AMD_CPPC_ENABLE) )
+    {
+        val |= AMD_CPPC_ENABLE;
+        wrmsrl(MSR_AMD_CPPC_ENABLE, val);
+    }
+
+    rdmsrl(MSR_AMD_CPPC_CAP1, data->caps.raw);
+
+    if ( data->caps.highest_perf == 0 || data->caps.lowest_perf == 0 ||
+         data->caps.nominal_perf == 0 || data->caps.lowest_nonlinear_perf == 0 ||
+         data->caps.lowest_perf > data->caps.lowest_nonlinear_perf ||
+         data->caps.lowest_nonlinear_perf > data->caps.nominal_perf ||
+         data->caps.nominal_perf > data->caps.highest_perf )
+    {
+        amd_cppc_err(policy->cpu,
+                     "Out of range values: highest(%u), lowest(%u), nominal(%u), lowest_nonlinear(%u)\n",
+                     data->caps.highest_perf, data->caps.lowest_perf,
+                     data->caps.nominal_perf, data->caps.lowest_nonlinear_perf);
+        goto err;
+    }
+
+    amd_process_freq(&cpu_data[policy->cpu],
+                     NULL, NULL, &this_cpu(pxfreq_mhz));
+
+    data->err = amd_get_cpc_freq(data, data->cppc_data->cpc.lowest_mhz,
+                                 data->caps.lowest_perf, &min_freq);
+    if ( data->err )
+        return;
+
+    data->err = amd_get_cpc_freq(data, data->cppc_data->cpc.nominal_mhz,
+                                 data->caps.nominal_perf, &nominal_freq);
+    if ( data->err )
+        return;
+
+    data->err = amd_get_max_freq(data, &max_freq);
+    if ( data->err )
+        return;
+
+    if ( min_freq > nominal_freq || nominal_freq > max_freq )
+    {
+        amd_cppc_err(policy->cpu,
+                     "min(%u), or max(%u), or nominal(%u) freq value is incorrect\n",
+                     min_freq, max_freq, nominal_freq);
+        goto err;
+    }
+
+    policy->min = min_freq;
+    policy->max = max_freq;
+
+    policy->cpuinfo.min_freq = min_freq;
+    policy->cpuinfo.max_freq = max_freq;
+    policy->cpuinfo.perf_freq = nominal_freq;
+    /*
+     * Set after policy->cpuinfo.perf_freq, as we are taking
+     * APERF/MPERF average frequency as current frequency.
+     */
+    policy->cur = cpufreq_driver_getavg(policy->cpu, GOV_GETAVG);
+
+    /* Store pre-defined BIOS value for passive mode */
+    rdmsrl(MSR_AMD_CPPC_REQ, val);
+    this_cpu(epp_init) = MASK_EXTR(val, AMD_CPPC_EPP_MASK);
+
+    return;
+
+ err:
+    /*
+     * No fallback shceme is available here, see more explanation at call
+     * site in amd_cppc_cpufreq_cpu_init().
+     */
+    data->err = -EINVAL;
+}
+
+/*
+ * AMD CPPC driver is different than legacy ACPI hardware P-State,
+ * which has a finer grain frequency range between the highest and lowest
+ * frequency. And boost frequency is actually the frequency which is mapped on
+ * highest performance ratio. The legacy P0 frequency is actually mapped on
+ * nominal performance ratio.
+ */
+static void amd_cppc_boost_init(struct cpufreq_policy *policy,
+                                const struct amd_cppc_drv_data *data)
+{
+    if ( data->caps.highest_perf <= data->caps.nominal_perf )
+        return;
+
+    policy->turbo = CPUFREQ_TURBO_ENABLED;
+}
+
+static int cf_check amd_cppc_cpufreq_cpu_exit(struct cpufreq_policy *policy)
+{
+    XVFREE(per_cpu(amd_cppc_drv_data, policy->cpu));
+
+    return 0;
+}
+
+static int cf_check amd_cppc_cpufreq_cpu_init(struct cpufreq_policy *policy)
+{
+    unsigned int cpu = policy->cpu;
+    struct amd_cppc_drv_data *data;
+
+    data = xvzalloc(struct amd_cppc_drv_data);
+    if ( !data )
+        return -ENOMEM;
+
+    data->cppc_data = &processor_pminfo[cpu]->cppc_data;
+
+    per_cpu(amd_cppc_drv_data, cpu) = data;
+
+    on_selected_cpus(cpumask_of(cpu), amd_cppc_init_msrs, policy, 1);
+
+    /*
+     * The enable bit is sticky, as we need to enable it at the very first
+     * begining, before CPPC capability values sanity check.
+     * If error path is taken effective, not only amd-cppc cpufreq core fails
+     * to initialize, but also we could not fall back to legacy P-states
+     * driver, irrespective of the command line specifying a fallback option.
+     */
+    if ( data->err )
+    {
+        amd_cppc_err(cpu, "Could not initialize cpufreq core in CPPC mode\n");
+        amd_cppc_cpufreq_cpu_exit(policy);
+        return data->err;
+    }
+
+    policy->governor = cpufreq_opt_governor ? : CPUFREQ_DEFAULT_GOVERNOR;
+
+    amd_cppc_boost_init(policy, data);
+
+    amd_cppc_verbose(policy->cpu,
+                     "CPU initialized with amd-cppc passive mode\n");
+
+    return 0;
+}
+
+static const struct cpufreq_driver __initconst_cf_clobber
+amd_cppc_cpufreq_driver =
+{
+    .name   = XEN_AMD_CPPC_DRIVER_NAME,
+    .verify = amd_cppc_cpufreq_verify,
+    .target = amd_cppc_cpufreq_target,
+    .init   = amd_cppc_cpufreq_cpu_init,
+    .exit   = amd_cppc_cpufreq_cpu_exit,
+};
+
 int __init amd_cppc_register_driver(void)
 {
     if ( !cpu_has_cppc )
         return -ENODEV;
 
-    return -EOPNOTSUPP;
+    return cpufreq_register_driver(&amd_cppc_cpufreq_driver);
 }
diff --git a/xen/arch/x86/cpu/amd.c b/xen/arch/x86/cpu/amd.c
index 567b992a9f..9767f63539 100644
--- a/xen/arch/x86/cpu/amd.c
+++ b/xen/arch/x86/cpu/amd.c
@@ -613,10 +613,10 @@ static unsigned int attr_const amd_parse_freq(unsigned int family,
 	return freq;
 }
 
-static void amd_process_freq(const struct cpuinfo_x86 *c,
-			     unsigned int *low_mhz,
-			     unsigned int *nom_mhz,
-			     unsigned int *hi_mhz)
+void amd_process_freq(const struct cpuinfo_x86 *c,
+		      unsigned int *low_mhz,
+		      unsigned int *nom_mhz,
+		      unsigned int *hi_mhz)
 {
 	unsigned int idx = 0, h;
 	uint64_t hi, lo, val;
diff --git a/xen/arch/x86/include/asm/amd.h b/xen/arch/x86/include/asm/amd.h
index 9c9599a622..72df42a6f6 100644
--- a/xen/arch/x86/include/asm/amd.h
+++ b/xen/arch/x86/include/asm/amd.h
@@ -173,5 +173,7 @@ extern bool amd_virt_spec_ctrl;
 bool amd_setup_legacy_ssbd(void);
 void amd_set_legacy_ssbd(bool enable);
 void amd_set_cpuid_user_dis(bool enable);
+void amd_process_freq(const struct cpuinfo_x86 *c, unsigned int *low_mhz,
+                      unsigned int *nom_mhz, unsigned int *hi_mhz);
 
 #endif /* __AMD_H__ */
diff --git a/xen/arch/x86/include/asm/msr-index.h b/xen/arch/x86/include/asm/msr-index.h
index bb48d16f0c..df52587c85 100644
--- a/xen/arch/x86/include/asm/msr-index.h
+++ b/xen/arch/x86/include/asm/msr-index.h
@@ -252,6 +252,12 @@
 
 #define MSR_AMD_CSTATE_CFG                  0xc0010296U
 
+#define MSR_AMD_CPPC_CAP1                   0xc00102b0U
+#define MSR_AMD_CPPC_ENABLE                 0xc00102b1U
+#define  AMD_CPPC_ENABLE                    (_AC(1, ULL) << 0)
+#define MSR_AMD_CPPC_REQ                    0xc00102b3U
+#define  AMD_CPPC_EPP_MASK                  (_AC(0xff, ULL) << 24)
+
 /*
  * Legacy MSR constants in need of cleanup.  No new MSRs below this comment.
  */
diff --git a/xen/include/public/sysctl.h b/xen/include/public/sysctl.h
index aafa7fcf2b..aa29a5401c 100644
--- a/xen/include/public/sysctl.h
+++ b/xen/include/public/sysctl.h
@@ -453,6 +453,7 @@ struct xen_set_cppc_para {
     uint32_t activity_window;
 };
 
+#define XEN_AMD_CPPC_DRIVER_NAME "amd-cppc"
 #define XEN_HWP_DRIVER_NAME "hwp"
 
 /*
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Sep 25 09:55:54 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Sep 2025 09:55:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1130305.1469863 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1v1ihe-0006aI-3D; Thu, 25 Sep 2025 09:55:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1130305.1469863; Thu, 25 Sep 2025 09: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 1v1ihe-0006aA-0V; Thu, 25 Sep 2025 09:55:54 +0000
Received: by outflank-mailman (input) for mailman id 1130305;
 Thu, 25 Sep 2025 09: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 1v1ihd-0006a4-1I
 for xen-changelog@lists.xenproject.org; Thu, 25 Sep 2025 09: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 1v1ihd-009cM3-02
 for xen-changelog@lists.xenproject.org;
 Thu, 25 Sep 2025 09:55:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1v1ihc-00E0mW-3A
 for xen-changelog@lists.xenproject.org;
 Thu, 25 Sep 2025 09: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=GeH1PAqyFkKAWRcGlRcwuazuPN2huUGOoh0tOe84/98=; b=xUsNZCvMp9reSGHJRzrD9iFYF8
	7ZE+YgN9j7Tpqrvj49wjzboQPXm31RHQHtSEP/tjU28M2uCASVQSMA58TVu3ueIgaZSqmOkyOeewx
	BxvDIjQr42lK2u87UoL64G7d3AC+qto/WeTRkN02SfR6RDPjS5BJUIX7eScnsULaobvw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/cpufreq: implement amd-cppc-epp driver for CPPC in active mode
Message-Id: <E1v1ihc-00E0mW-3A@xenbits.xenproject.org>
Date: Thu, 25 Sep 2025 09:55:52 +0000

commit 94411808fbaaa8185993d9c29a2eb551e23cc148
Author:     Penny Zheng <Penny.Zheng@amd.com>
AuthorDate: Thu Sep 25 09:20:52 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Sep 25 09:20:52 2025 +0200

    xen/cpufreq: implement amd-cppc-epp driver for CPPC in active mode
    
    amd-cppc has 2 operation modes: autonomous (active) mode and
    non-autonomous (passive) mode.
    In active mode, we don't need Xen governor to calculate and tune the cpu
    frequency, while hardware built-in CPPC power algorithm will calculate the
    runtime workload and adjust cores frequency automatically according to the
    power supply, thermal, core voltage and some other hardware conditions.
    In active mode, CPPC ignores requests done in the desired performance field,
    and takes into account only the values set to the minimum performance, maximum
    performance, and energy performance preference registers.
    
    A new field EPP (energy performance preference), in CPPC request register, is
    introduced. It will be used in the CCLK DPM controller to drive the frequency
    that a core is going to operate during short periods of activity, called
    minimum active frequency, It could contatin a range of values from 0 to 0xff.
    An EPP of zero sets the min active frequency to maximum frequency, while
    an EPP of 0xff sets the min active frequency to approxiately Idle frequency.
    
    We implement a new AMD CPU frequency driver `amd-cppc-epp` for active mode.
    It requires `active` tag in Xen cmdline for users to explicitly select active
    mode.
    In driver `active-cppc-epp`, ->setpolicy() is hooked, not the ->target(), as
    it does not depend on xen governor to do performance tuning.
    
    We also introduce a new field "policy" (CPUFREQ_POLICY_xxx) to represent
    performance policy. Right now, it supports three values:
    CPUFREQ_POLICY_PERFORMANCE as maximum performance, CPUFREQ_POLICY_POWERSAVE
    as the least power consumption, and CPUFREQ_POLICY_ONDEMAND as no preference,
    just corresponding to "performance", "powersave" and "ondemand" Xen governor,
    which benefit users from re-using "governor" in Xen cmdline to deliver
    which performance policy they want to apply.
    
    Signed-off-by: Penny Zheng <Penny.Zheng@amd.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 docs/misc/xen-command-line.pandoc    |   9 ++-
 xen/arch/x86/acpi/cpufreq/amd-cppc.c | 135 +++++++++++++++++++++++++++++++++--
 xen/drivers/cpufreq/utility.c        |  15 ++++
 xen/include/acpi/cpufreq/cpufreq.h   |  18 +++++
 xen/include/public/sysctl.h          |   1 +
 5 files changed, 173 insertions(+), 5 deletions(-)

diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index 518e42d965..28a98321c7 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -515,7 +515,7 @@ If set, force use of the performance counters for oprofile, rather than detectin
 available support.
 
 ### cpufreq
-> `= none | {{ <boolean> | xen } { [:[powersave|performance|ondemand|userspace][,[<maxfreq>]][,[<minfreq>]]] } [,verbose]} | dom0-kernel | hwp[:[<hdc>][,verbose]] | amd-cppc[:[verbose]]`
+> `= none | {{ <boolean> | xen } { [:[powersave|performance|ondemand|userspace][,[<maxfreq>]][,[<minfreq>]]] } [,verbose]} | dom0-kernel | hwp[:[<hdc>][,verbose]] | amd-cppc[:[active][,verbose]]`
 
 > Default: `xen`
 
@@ -537,6 +537,13 @@ choice of `dom0-kernel` is deprecated and not supported by all Dom0 kernels.
 * `amd-cppc` selects ACPI Collaborative Performance and Power Control (CPPC)
   on supported AMD hardware to provide finer grained frequency control
   mechanism. The default is disabled.
+* `active` is a boolean to enable amd-cppc driver in active(autonomous) mode.
+  In this mode, users don't rely on Xen governor to do performance monitoring
+  and tuning. Hardware built-in CPPC power algorithm will calculate the runtime
+  workload and adjust cores frequency automatically according to the power
+  supply, thermal, core voltage and some other hardware conditions.
+  The default is disabled, and the option only applies when `amd-cppc` is
+  enabled.
 
 There is also support for `;`-separated fallback options:
 `cpufreq=hwp;xen,verbose`.  This first tries `hwp` and falls back to `xen` if
diff --git a/xen/arch/x86/acpi/cpufreq/amd-cppc.c b/xen/arch/x86/acpi/cpufreq/amd-cppc.c
index 5b99b86fb7..bb7f4e4a9e 100644
--- a/xen/arch/x86/acpi/cpufreq/amd-cppc.c
+++ b/xen/arch/x86/acpi/cpufreq/amd-cppc.c
@@ -67,9 +67,14 @@
  * max_perf.
  * Field des_perf conveys performance level Xen governor is requesting. And it
  * may be set to any performance value in the range [min_perf, max_perf],
- * inclusive.
+ * inclusive. In active mode, des_perf must be zero.
  * Field epp represents energy performance preference, which only has meaning
- * when active mode is enabled.
+ * when active mode is enabled. The EPP is used in the CCLK DPM controller
+ * to drive the frequency that a core is going to operate during short periods
+ * of activity, called minimum active frequency, It could contatin a range of
+ * values from 0 to 0xff. An EPP of zero sets the min active frequency to
+ * maximum frequency, while an EPP of 0xff sets the min active frequency to
+ * approxiately Idle frequency.
  */
 struct amd_cppc_drv_data
 {
@@ -106,6 +111,12 @@ static DEFINE_PER_CPU_READ_MOSTLY(struct amd_cppc_drv_data *,
  */
 static DEFINE_PER_CPU_READ_MOSTLY(unsigned int, pxfreq_mhz);
 static DEFINE_PER_CPU_READ_MOSTLY(uint8_t, epp_init);
+#ifndef NDEBUG
+static bool __ro_after_init opt_active_mode;
+#else
+static bool __initdata opt_active_mode;
+#endif
+
 
 static bool __init amd_cppc_handle_option(const char *s, const char *end)
 {
@@ -118,6 +129,13 @@ static bool __init amd_cppc_handle_option(const char *s, const char *end)
         return true;
     }
 
+    ret = parse_boolean("active", s, end);
+    if ( ret >= 0 )
+    {
+        opt_active_mode = ret;
+        return true;
+    }
+
     return false;
 }
 
@@ -270,6 +288,7 @@ static void amd_cppc_write_request(unsigned int cpu, uint8_t min_perf,
 
     data->req.min_perf = min_perf;
     data->req.max_perf = max_perf;
+    ASSERT(!opt_active_mode || !des_perf);
     data->req.des_perf = des_perf;
     data->req.epp = epp;
 
@@ -417,7 +436,7 @@ static int cf_check amd_cppc_cpufreq_cpu_exit(struct cpufreq_policy *policy)
     return 0;
 }
 
-static int cf_check amd_cppc_cpufreq_cpu_init(struct cpufreq_policy *policy)
+static int amd_cppc_cpufreq_init_perf(struct cpufreq_policy *policy)
 {
     unsigned int cpu = policy->cpu;
     struct amd_cppc_drv_data *data;
@@ -450,12 +469,103 @@ static int cf_check amd_cppc_cpufreq_cpu_init(struct cpufreq_policy *policy)
 
     amd_cppc_boost_init(policy, data);
 
+    return 0;
+}
+
+static int cf_check amd_cppc_cpufreq_cpu_init(struct cpufreq_policy *policy)
+{
+    int ret;
+
+    ret = amd_cppc_cpufreq_init_perf(policy);
+    if ( ret )
+        return ret;
+
     amd_cppc_verbose(policy->cpu,
                      "CPU initialized with amd-cppc passive mode\n");
 
     return 0;
 }
 
+static int cf_check amd_cppc_epp_cpu_init(struct cpufreq_policy *policy)
+{
+    int ret;
+
+    ret = amd_cppc_cpufreq_init_perf(policy);
+    if ( ret )
+        return ret;
+
+    policy->policy = cpufreq_policy_from_governor(policy->governor);
+
+    amd_cppc_verbose(policy->cpu,
+                     "CPU initialized with amd-cppc active mode\n");
+
+    return 0;
+}
+
+static void amd_cppc_prepare_policy(struct cpufreq_policy *policy,
+                                    uint8_t *max_perf, uint8_t *min_perf,
+                                    uint8_t *epp)
+{
+    const struct amd_cppc_drv_data *data = per_cpu(amd_cppc_drv_data,
+                                                   policy->cpu);
+
+    /*
+     * On default, set min_perf with lowest_nonlinear_perf, and max_perf
+     * with the highest, to ensure performance scaling in P-states range.
+     */
+    *max_perf = data->caps.highest_perf;
+    *min_perf = data->caps.lowest_nonlinear_perf;
+
+    /*
+     * In policy CPUFREQ_POLICY_PERFORMANCE, increase min_perf to
+     * highest_perf to achieve ultmost performance.
+     * In policy CPUFREQ_POLICY_POWERSAVE, decrease max_perf to
+     * lowest_nonlinear_perf to achieve ultmost power saving.
+     * Set governor only to help print proper policy info to users.
+     */
+    switch ( policy->policy )
+    {
+    case CPUFREQ_POLICY_PERFORMANCE:
+        /* Force the epp value to be zero for performance policy */
+        *epp = CPPC_ENERGY_PERF_MAX_PERFORMANCE;
+        *min_perf = *max_perf;
+        policy->governor = &cpufreq_gov_performance;
+        break;
+
+    case CPUFREQ_POLICY_POWERSAVE:
+        /* Force the epp value to be 0xff for powersave policy */
+        *epp = CPPC_ENERGY_PERF_MAX_POWERSAVE;
+        *max_perf = *min_perf;
+        policy->governor = &cpufreq_gov_powersave;
+        break;
+
+    case CPUFREQ_POLICY_ONDEMAND:
+        /*
+         * Set epp with medium value to show no preference over performance
+         * or powersave
+         */
+        *epp = CPPC_ENERGY_PERF_BALANCE;
+        policy->governor = &cpufreq_gov_dbs;
+        break;
+
+    default:
+        *epp = per_cpu(epp_init, policy->cpu);
+        break;
+    }
+}
+
+static int cf_check amd_cppc_epp_set_policy(struct cpufreq_policy *policy)
+{
+    uint8_t max_perf, min_perf, epp;
+
+    amd_cppc_prepare_policy(policy, &max_perf, &min_perf, &epp);
+
+    amd_cppc_write_request(policy->cpu, min_perf,
+                           0 /* no des_perf in active mode */,
+                           max_perf, epp);
+    return 0;
+}
+
 static const struct cpufreq_driver __initconst_cf_clobber
 amd_cppc_cpufreq_driver =
 {
@@ -466,10 +576,27 @@ amd_cppc_cpufreq_driver =
     .exit   = amd_cppc_cpufreq_cpu_exit,
 };
 
+static const struct cpufreq_driver __initconst_cf_clobber
+amd_cppc_epp_driver =
+{
+    .name       = XEN_AMD_CPPC_EPP_DRIVER_NAME,
+    .verify     = amd_cppc_cpufreq_verify,
+    .setpolicy  = amd_cppc_epp_set_policy,
+    .init       = amd_cppc_epp_cpu_init,
+    .exit       = amd_cppc_cpufreq_cpu_exit,
+};
+
 int __init amd_cppc_register_driver(void)
 {
+    int ret;
+
     if ( !cpu_has_cppc )
         return -ENODEV;
 
-    return cpufreq_register_driver(&amd_cppc_cpufreq_driver);
+    if ( opt_active_mode )
+        ret = cpufreq_register_driver(&amd_cppc_epp_driver);
+    else
+        ret = cpufreq_register_driver(&amd_cppc_cpufreq_driver);
+
+    return ret;
 }
diff --git a/xen/drivers/cpufreq/utility.c b/xen/drivers/cpufreq/utility.c
index 987c3b5929..e2cc9ff2af 100644
--- a/xen/drivers/cpufreq/utility.c
+++ b/xen/drivers/cpufreq/utility.c
@@ -250,6 +250,7 @@ int __cpufreq_set_policy(struct cpufreq_policy *data,
     data->min = policy->min;
     data->max = policy->max;
     data->limits = policy->limits;
+    data->policy = policy->policy;
     if (cpufreq_driver.setpolicy)
         return alternative_call(cpufreq_driver.setpolicy, data);
 
@@ -281,3 +282,17 @@ int __cpufreq_set_policy(struct cpufreq_policy *data,
 
     return __cpufreq_governor(data, CPUFREQ_GOV_LIMITS);
 }
+
+unsigned int cpufreq_policy_from_governor(const struct cpufreq_governor *gov)
+{
+    if ( !strncmp(gov->name, "performance", CPUFREQ_NAME_LEN) )
+        return CPUFREQ_POLICY_PERFORMANCE;
+
+    if ( !strncmp(gov->name, "powersave", CPUFREQ_NAME_LEN) )
+        return CPUFREQ_POLICY_POWERSAVE;
+
+    if ( !strncmp(gov->name, "ondemand", CPUFREQ_NAME_LEN) )
+        return CPUFREQ_POLICY_ONDEMAND;
+
+    return CPUFREQ_POLICY_UNKNOWN;
+}
diff --git a/xen/include/acpi/cpufreq/cpufreq.h b/xen/include/acpi/cpufreq/cpufreq.h
index 5d4881eea8..9ef7c4683a 100644
--- a/xen/include/acpi/cpufreq/cpufreq.h
+++ b/xen/include/acpi/cpufreq/cpufreq.h
@@ -81,6 +81,7 @@ struct cpufreq_policy {
     int8_t              turbo;  /* tristate flag: 0 for unsupported
                                  * -1 for disable, 1 for enabled
                                  * See CPUFREQ_TURBO_* below for defines */
+    unsigned int        policy; /* CPUFREQ_POLICY_* */
 };
 DECLARE_PER_CPU(struct cpufreq_policy *, cpufreq_cpu_policy);
 
@@ -131,6 +132,23 @@ extern int cpufreq_register_governor(struct cpufreq_governor *governor);
 extern struct cpufreq_governor *__find_governor(const char *governor);
 #define CPUFREQ_DEFAULT_GOVERNOR &cpufreq_gov_dbs
 
+/*
+ * Performance Policy
+ * If cpufreq_driver->target() exists, the ->governor decides what frequency
+ * within the limits is used. If cpufreq_driver->setpolicy() exists, these
+ * following policies are available:
+ * CPUFREQ_POLICY_PERFORMANCE represents maximum performance
+ * CPUFREQ_POLICY_POWERSAVE represents least power consumption
+ * CPUFREQ_POLICY_ONDEMAND represents no preference over performance or
+ * powersave
+ */
+#define CPUFREQ_POLICY_UNKNOWN      0
+#define CPUFREQ_POLICY_POWERSAVE    1
+#define CPUFREQ_POLICY_PERFORMANCE  2
+#define CPUFREQ_POLICY_ONDEMAND     3
+
+unsigned int cpufreq_policy_from_governor(const struct cpufreq_governor *gov);
+
 /* pass a target to the cpufreq driver */
 extern int __cpufreq_driver_target(struct cpufreq_policy *policy,
                                    unsigned int target_freq,
diff --git a/xen/include/public/sysctl.h b/xen/include/public/sysctl.h
index aa29a5401c..eb3a23b038 100644
--- a/xen/include/public/sysctl.h
+++ b/xen/include/public/sysctl.h
@@ -454,6 +454,7 @@ struct xen_set_cppc_para {
 };
 
 #define XEN_AMD_CPPC_DRIVER_NAME "amd-cppc"
+#define XEN_AMD_CPPC_EPP_DRIVER_NAME "amd-cppc-epp"
 #define XEN_HWP_DRIVER_NAME "hwp"
 
 /*
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Sep 25 09:56:04 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Sep 2025 09:56:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1130306.1469868 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1v1iho-0006c7-5a; Thu, 25 Sep 2025 09:56:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1130306.1469868; Thu, 25 Sep 2025 09: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 1v1iho-0006bz-1v; Thu, 25 Sep 2025 09:56:04 +0000
Received: by outflank-mailman (input) for mailman id 1130306;
 Thu, 25 Sep 2025 09: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 1v1ihn-0006bt-5u
 for xen-changelog@lists.xenproject.org; Thu, 25 Sep 2025 09: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 1v1ihn-009cMK-0U
 for xen-changelog@lists.xenproject.org;
 Thu, 25 Sep 2025 09:56:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1v1ihn-00E0pK-0C
 for xen-changelog@lists.xenproject.org;
 Thu, 25 Sep 2025 09: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=FyNZeS5Y3iYmGKVt/Tu8aZpXHLdDKJ0ZdAxNNtOHD4s=; b=w8T+IzJe0yYd0mwf48x/SzmHi1
	faJHYJyiBKrfr9bKlh9eDTHR+naqkoJXzVCqZ5suidxZ0RKWJkxvPkmKaZHCnFp7WI0ZXGvzgS/yO
	SwiD/fLJKt1see9l8BoTYDi2qRwBOlTKdkOGoZs/a2a/DukBV+h6eQG/so50w9WJTjMk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/cpufreq: get performance policy from governor set via xenpm
Message-Id: <E1v1ihn-00E0pK-0C@xenbits.xenproject.org>
Date: Thu, 25 Sep 2025 09:56:03 +0000

commit 983a15a36ec5aee89770f50316a4f6dcdcf245f6
Author:     Penny Zheng <Penny.Zheng@amd.com>
AuthorDate: Thu Sep 25 09:21:07 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Sep 25 09:21:07 2025 +0200

    xen/cpufreq: get performance policy from governor set via xenpm
    
    Even if Xen governor is not used in amd-cppc active mode, we could
    somehow deduce which performance policy (CPUFREQ_POLICY_xxx) user wants to
    apply through which governor they choose, such as:
    If user chooses performance governor, they want maximum performance, then
    the policy shall be CPUFREQ_POLICY_PERFORMANCE
    If user chooses powersave governor, they want the least power consumption,
    then the policy shall be CPUFREQ_POLICY_POWERSAVE
    Function cpufreq_policy_from_governor() is responsible for above transition,
    and it shall be also effective when users setting new governor through xenpm.
    
    Userspace is a forbidden choice, and if users specify such option, we shall
    not only give warning message to suggest using "xenpm set-cpufreq-cppc", but
    also error out.
    
    Signed-off-by: Penny Zheng <Penny.Zheng@amd.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/drivers/acpi/pm-op.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/xen/drivers/acpi/pm-op.c b/xen/drivers/acpi/pm-op.c
index 2f516e62b1..a7eaf29c31 100644
--- a/xen/drivers/acpi/pm-op.c
+++ b/xen/drivers/acpi/pm-op.c
@@ -207,6 +207,17 @@ static int set_cpufreq_gov(struct xen_sysctl_pm_op *op)
     if ( new_policy.governor == NULL )
         return -EINVAL;
 
+    if ( processor_pminfo[op->cpuid]->init & XEN_CPPC_INIT )
+    {
+        new_policy.policy = cpufreq_policy_from_governor(new_policy.governor);
+        if ( new_policy.policy == CPUFREQ_POLICY_UNKNOWN )
+        {
+            printk("Failed to get performance policy from %s, Try \"xenpm set-cpufreq-cppc\"\n",
+                   new_policy.governor->name);
+            return -EINVAL;
+        }
+    }
+
     return __cpufreq_set_policy(old_policy, &new_policy);
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Sep 25 09:56:15 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Sep 2025 09:56:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1130307.1469870 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1v1ihz-0006jD-6F; Thu, 25 Sep 2025 09:56:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1130307.1469870; Thu, 25 Sep 2025 09:56: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 1v1ihz-0006j5-3O; Thu, 25 Sep 2025 09:56:15 +0000
Received: by outflank-mailman (input) for mailman id 1130307;
 Thu, 25 Sep 2025 09: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 1v1ihx-0006iq-9H
 for xen-changelog@lists.xenproject.org; Thu, 25 Sep 2025 09: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 1v1ihx-009cMg-0p
 for xen-changelog@lists.xenproject.org;
 Thu, 25 Sep 2025 09:56:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1v1ihx-00E0rg-0i
 for xen-changelog@lists.xenproject.org;
 Thu, 25 Sep 2025 09: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=iqIPgTIUED+5JYj9M9N6wmpLAXpnxDlVBa8fNIT9lpE=; b=Bylpvq/qWcbxinjMoRySrJ4oSn
	Goau69NpFBQ0Wm9CZ5i7Rc7ArMFXWhncaCz0kOh82LRBLNMVYHGI51J0fWwCY+xo7qTySozdttD9B
	3m/C3PtfIxPSbRCeB59gPhB7KJllrUy2TdSalB8dCLgZbm+euuAkJF/kIv5fBflqg2RU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/cpufreq: extract CPPC para from cpufreq para
Message-Id: <E1v1ihx-00E0rg-0i@xenbits.xenproject.org>
Date: Thu, 25 Sep 2025 09:56:13 +0000

commit e3305043b2bd065abf5814df3a5de0e12e976493
Author:     Penny Zheng <Penny.Zheng@amd.com>
AuthorDate: Thu Sep 25 09:21:24 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Sep 25 09:21:24 2025 +0200

    tools/cpufreq: extract CPPC para from cpufreq para
    
    We extract cppc info from "struct xen_get_cpufreq_para", where it acts as
    a member of union, and share the space with governor info.
    However, it may fail in amd-cppc passive mode, in which governor info and
    CPPC info could co-exist, and both need to be printed together via xenpm tool.
    If we tried to still put it in "struct xen_get_cpufreq_para" (e.g. just move
    out of union), "struct xen_get_cpufreq_para" will enlarge too much to further
    make xen_sysctl.u exceed 128 bytes.
    
    So we introduce a new sub-field GET_CPUFREQ_CPPC to dedicatedly acquire
    CPPC-related para, and make get-cpufreq-para invoke GET_CPUFREQ_CPPC
    if available.
    New helpers print_cppc_para() and get_cpufreq_cppc() are introduced to
    extract CPPC-related parameters process from cpufreq para.
    
    Signed-off-by: Penny Zheng <Penny.Zheng@amd.com>
    Acked-by: Jan Beulich <jbeulich@suse.com> # hypervisor
    Acked-by: Anthony PERARD <anthony.perard@vates.tech>
---
 tools/include/xenctrl.h     |  27 ++++++------
 tools/libs/ctrl/xc_pm.c     |  47 ++++++++++++++------
 tools/misc/xenpm.c          | 103 +++++++++++++++++++++++++++-----------------
 xen/drivers/acpi/pm-op.c    |  43 +++++++++++-------
 xen/include/public/sysctl.h |  31 +++++++------
 5 files changed, 155 insertions(+), 96 deletions(-)

diff --git a/tools/include/xenctrl.h b/tools/include/xenctrl.h
index 965d3b585a..c14ecd66aa 100644
--- a/tools/include/xenctrl.h
+++ b/tools/include/xenctrl.h
@@ -1924,22 +1924,19 @@ struct xc_get_cpufreq_para {
     uint32_t cpuinfo_cur_freq;
     uint32_t cpuinfo_max_freq;
     uint32_t cpuinfo_min_freq;
-    union {
-        struct {
-            uint32_t scaling_cur_freq;
+    struct {
+        uint32_t scaling_cur_freq;
 
-            char scaling_governor[CPUFREQ_NAME_LEN];
-            uint32_t scaling_max_freq;
-            uint32_t scaling_min_freq;
+        char scaling_governor[CPUFREQ_NAME_LEN];
+        uint32_t scaling_max_freq;
+        uint32_t scaling_min_freq;
 
-            /* for specific governor */
-            union {
-                xc_userspace_t userspace;
-                xc_ondemand_t ondemand;
-            } u;
-        } s;
-        xc_cppc_para_t cppc_para;
-    } u;
+        /* for specific governor */
+        union {
+            xc_userspace_t userspace;
+            xc_ondemand_t ondemand;
+        } u;
+    } s;
 
     int32_t turbo_enabled;
 };
@@ -1953,6 +1950,8 @@ int xc_set_cpufreq_para(xc_interface *xch, int cpuid,
                         int ctrl_type, int ctrl_value);
 int xc_set_cpufreq_cppc(xc_interface *xch, int cpuid,
                         xc_set_cppc_para_t *set_cppc);
+int xc_get_cppc_para(xc_interface *xch, unsigned int cpuid,
+                     xc_cppc_para_t *cppc_para);
 int xc_get_cpufreq_avgfreq(xc_interface *xch, int cpuid, int *avg_freq);
 
 int xc_set_sched_opt_smt(xc_interface *xch, uint32_t value);
diff --git a/tools/libs/ctrl/xc_pm.c b/tools/libs/ctrl/xc_pm.c
index 6fda973f1f..5b4e489acf 100644
--- a/tools/libs/ctrl/xc_pm.c
+++ b/tools/libs/ctrl/xc_pm.c
@@ -274,25 +274,24 @@ int xc_get_cpufreq_para(xc_interface *xch, int cpuid,
         /*
          * Copy to user_para no matter what cpufreq driver/governor.
          *
-         * First sanity check layout of the union subject to memcpy() below.
+         * First sanity check layout of the struct subject to memcpy() below.
          */
-        BUILD_BUG_ON(sizeof(user_para->u) != sizeof(sys_para->u));
+        BUILD_BUG_ON(sizeof(user_para->s) != sizeof(sys_para->s));
 
 #define CHK_FIELD(fld) \
-        BUILD_BUG_ON(offsetof(typeof(user_para->u), fld) != \
-                     offsetof(typeof(sys_para->u),  fld))
+        BUILD_BUG_ON(offsetof(typeof(user_para->s), fld) != \
+                     offsetof(typeof(sys_para->s),  fld))
 
-        CHK_FIELD(s.scaling_cur_freq);
-        CHK_FIELD(s.scaling_governor);
-        CHK_FIELD(s.scaling_max_freq);
-        CHK_FIELD(s.scaling_min_freq);
-        CHK_FIELD(s.u.userspace);
-        CHK_FIELD(s.u.ondemand);
-        CHK_FIELD(cppc_para);
+        CHK_FIELD(scaling_cur_freq);
+        CHK_FIELD(scaling_governor);
+        CHK_FIELD(scaling_max_freq);
+        CHK_FIELD(scaling_min_freq);
+        CHK_FIELD(u.userspace);
+        CHK_FIELD(u.ondemand);
 
 #undef CHK_FIELD
 
-        memcpy(&user_para->u, &sys_para->u, sizeof(sys_para->u));
+        memcpy(&user_para->s, &sys_para->s, sizeof(sys_para->s));
     }
 
 unlock_4:
@@ -366,6 +365,30 @@ int xc_set_cpufreq_cppc(xc_interface *xch, int cpuid,
     return ret;
 }
 
+int xc_get_cppc_para(xc_interface *xch, unsigned int cpuid,
+                     xc_cppc_para_t *cppc_para)
+{
+    int ret;
+    struct xen_sysctl sysctl = {};
+
+    if ( !xch  || !cppc_para )
+    {
+        errno = EINVAL;
+        return -1;
+    }
+
+    sysctl.cmd = XEN_SYSCTL_pm_op;
+    sysctl.u.pm_op.cmd = GET_CPUFREQ_CPPC;
+    sysctl.u.pm_op.cpuid = cpuid;
+
+    ret = xc_sysctl(xch, &sysctl);
+    if ( ret )
+        return ret;
+
+    *cppc_para = sysctl.u.pm_op.u.get_cppc;
+    return ret;
+}
+
 int xc_get_cpufreq_avgfreq(xc_interface *xch, int cpuid, int *avg_freq)
 {
     int ret = 0;
diff --git a/tools/misc/xenpm.c b/tools/misc/xenpm.c
index 6b054b10a4..c7f19cea28 100644
--- a/tools/misc/xenpm.c
+++ b/tools/misc/xenpm.c
@@ -801,6 +801,34 @@ static unsigned int calculate_activity_window(const xc_cppc_para_t *cppc,
     return mantissa * multiplier;
 }
 
+/* print out parameters about cpu cppc */
+static void print_cppc_para(unsigned int cpuid,
+                            const xc_cppc_para_t *cppc)
+{
+    printf("cppc variables       :\n");
+    printf("  hardware limits    : lowest [%"PRIu32"] lowest nonlinear [%"PRIu32"]\n",
+           cppc->lowest, cppc->lowest_nonlinear);
+    printf("                     : nominal [%"PRIu32"] highest [%"PRIu32"]\n",
+           cppc->nominal, cppc->highest);
+    printf("  configured limits  : min [%"PRIu32"] max [%"PRIu32"] energy perf [%"PRIu32"]\n",
+           cppc->minimum, cppc->maximum, cppc->energy_perf);
+
+    if ( cppc->features & XEN_SYSCTL_CPPC_FEAT_ACT_WINDOW )
+    {
+        unsigned int activity_window;
+        const char *units;
+
+        activity_window = calculate_activity_window(cppc, &units);
+        printf("                     : activity_window [%"PRIu32" %s]\n",
+               activity_window, units);
+    }
+
+    printf("                     : desired [%"PRIu32"%s]\n",
+           cppc->desired,
+           cppc->desired ? "" : " hw autonomous");
+    printf("\n");
+}
+
 /* print out parameters about cpu frequency */
 static void print_cpufreq_para(int cpuid, struct xc_get_cpufreq_para *p_cpufreq)
 {
@@ -826,71 +854,45 @@ static void print_cpufreq_para(int cpuid, struct xc_get_cpufreq_para *p_cpufreq)
 
     printf("scaling_driver       : %s\n", p_cpufreq->scaling_driver);
 
-    if ( hwp )
-    {
-        const xc_cppc_para_t *cppc = &p_cpufreq->u.cppc_para;
-
-        printf("cppc variables       :\n");
-        printf("  hardware limits    : lowest [%"PRIu32"] lowest nonlinear [%"PRIu32"]\n",
-               cppc->lowest, cppc->lowest_nonlinear);
-        printf("                     : nominal [%"PRIu32"] highest [%"PRIu32"]\n",
-               cppc->nominal, cppc->highest);
-        printf("  configured limits  : min [%"PRIu32"] max [%"PRIu32"] energy perf [%"PRIu32"]\n",
-               cppc->minimum, cppc->maximum, cppc->energy_perf);
-
-        if ( cppc->features & XEN_SYSCTL_CPPC_FEAT_ACT_WINDOW )
-        {
-            unsigned int activity_window;
-            const char *units;
-
-            activity_window = calculate_activity_window(cppc, &units);
-            printf("                     : activity_window [%"PRIu32" %s]\n",
-                   activity_window, units);
-        }
-
-        printf("                     : desired [%"PRIu32"%s]\n",
-               cppc->desired,
-               cppc->desired ? "" : " hw autonomous");
-    }
-    else
+    if ( !hwp )
     {
         if ( p_cpufreq->gov_num )
             printf("scaling_avail_gov    : %s\n",
                    p_cpufreq->scaling_available_governors);
 
-        printf("current_governor     : %s\n", p_cpufreq->u.s.scaling_governor);
-        if ( !strncmp(p_cpufreq->u.s.scaling_governor,
+        printf("current_governor     : %s\n", p_cpufreq->s.scaling_governor);
+        if ( !strncmp(p_cpufreq->s.scaling_governor,
                       "userspace", CPUFREQ_NAME_LEN) )
         {
             printf("  userspace specific :\n");
             printf("    scaling_setspeed : %u\n",
-                   p_cpufreq->u.s.u.userspace.scaling_setspeed);
+                   p_cpufreq->s.u.userspace.scaling_setspeed);
         }
-        else if ( !strncmp(p_cpufreq->u.s.scaling_governor,
+        else if ( !strncmp(p_cpufreq->s.scaling_governor,
                            "ondemand", CPUFREQ_NAME_LEN) )
         {
             printf("  ondemand specific  :\n");
             printf("    sampling_rate    : max [%u] min [%u] cur [%u]\n",
-                   p_cpufreq->u.s.u.ondemand.sampling_rate_max,
-                   p_cpufreq->u.s.u.ondemand.sampling_rate_min,
-                   p_cpufreq->u.s.u.ondemand.sampling_rate);
+                   p_cpufreq->s.u.ondemand.sampling_rate_max,
+                   p_cpufreq->s.u.ondemand.sampling_rate_min,
+                   p_cpufreq->s.u.ondemand.sampling_rate);
             printf("    up_threshold     : %u\n",
-                   p_cpufreq->u.s.u.ondemand.up_threshold);
+                   p_cpufreq->s.u.ondemand.up_threshold);
         }
 
         printf("scaling_avail_freq   :");
         for ( i = 0; i < p_cpufreq->freq_num; i++ )
             if ( p_cpufreq->scaling_available_frequencies[i] ==
-                 p_cpufreq->u.s.scaling_cur_freq )
+                 p_cpufreq->s.scaling_cur_freq )
                 printf(" *%d", p_cpufreq->scaling_available_frequencies[i]);
             else
                 printf(" %d", p_cpufreq->scaling_available_frequencies[i]);
         printf("\n");
 
         printf("scaling frequency    : max [%u] min [%u] cur [%u]\n",
-               p_cpufreq->u.s.scaling_max_freq,
-               p_cpufreq->u.s.scaling_min_freq,
-               p_cpufreq->u.s.scaling_cur_freq);
+               p_cpufreq->s.scaling_max_freq,
+               p_cpufreq->s.scaling_min_freq,
+               p_cpufreq->s.scaling_cur_freq);
     }
 
     printf("turbo mode           : %s\n",
@@ -898,6 +900,24 @@ static void print_cpufreq_para(int cpuid, struct xc_get_cpufreq_para *p_cpufreq)
     printf("\n");
 }
 
+/* show cpu cppc parameters information on CPU cpuid */
+static int show_cppc_para_by_cpuid(xc_interface *xc_handle, unsigned int cpuid)
+{
+    int ret;
+    xc_cppc_para_t cppc_para;
+
+    ret = xc_get_cppc_para(xc_handle, cpuid, &cppc_para);
+    if ( !ret )
+        print_cppc_para(cpuid, &cppc_para);
+    else if ( errno == ENODEV )
+        ret = 0; /* Ignore unsupported platform */
+    else
+        fprintf(stderr, "[CPU%u] failed to get cppc parameter: %s\n",
+                cpuid, strerror(errno));
+
+    return ret;
+}
+
 /* show cpu frequency parameters information on CPU cpuid */
 static int show_cpufreq_para_by_cpuid(xc_interface *xc_handle, int cpuid)
 {
@@ -957,7 +977,12 @@ static int show_cpufreq_para_by_cpuid(xc_interface *xc_handle, int cpuid)
     } while ( ret && errno == EAGAIN );
 
     if ( ret == 0 )
+    {
         print_cpufreq_para(cpuid, p_cpufreq);
+
+        /* Show CPPC parameters if available */
+        ret = show_cppc_para_by_cpuid(xc_handle, cpuid);
+    }
     else if ( errno == ENODEV )
     {
         ret = -ENODEV;
diff --git a/xen/drivers/acpi/pm-op.c b/xen/drivers/acpi/pm-op.c
index a7eaf29c31..f50acd7088 100644
--- a/xen/drivers/acpi/pm-op.c
+++ b/xen/drivers/acpi/pm-op.c
@@ -77,6 +77,17 @@ static int read_scaling_available_governors(char *scaling_available_governors,
     return 0;
 }
 
+static int get_cpufreq_cppc(unsigned int cpu,
+                            struct xen_get_cppc_para *cppc_para)
+{
+    int ret = -ENODEV;
+
+    if ( hwp_active() )
+        ret = get_hwp_para(cpu, cppc_para);
+
+    return ret;
+}
+
 static int get_cpufreq_para(struct xen_sysctl_pm_op *op)
 {
     uint32_t ret = 0;
@@ -143,9 +154,7 @@ static int get_cpufreq_para(struct xen_sysctl_pm_op *op)
     else
         strlcpy(op->u.get_para.scaling_driver, "Unknown", CPUFREQ_NAME_LEN);
 
-    if ( hwp_active() )
-        ret = get_hwp_para(policy->cpu, &op->u.get_para.u.cppc_para);
-    else
+    if ( !hwp_active() )
     {
         if ( !(scaling_available_governors =
                xzalloc_array(char, gov_num * CPUFREQ_NAME_LEN)) )
@@ -165,29 +174,29 @@ static int get_cpufreq_para(struct xen_sysctl_pm_op *op)
         if ( ret )
             return -EFAULT;
 
-        op->u.get_para.u.s.scaling_cur_freq = policy->cur;
-        op->u.get_para.u.s.scaling_max_freq = policy->max;
-        op->u.get_para.u.s.scaling_min_freq = policy->min;
+        op->u.get_para.s.scaling_cur_freq = policy->cur;
+        op->u.get_para.s.scaling_max_freq = policy->max;
+        op->u.get_para.s.scaling_min_freq = policy->min;
 
         if ( policy->governor->name[0] )
-            strlcpy(op->u.get_para.u.s.scaling_governor,
+            strlcpy(op->u.get_para.s.scaling_governor,
                     policy->governor->name, CPUFREQ_NAME_LEN);
         else
-            strlcpy(op->u.get_para.u.s.scaling_governor, "Unknown",
+            strlcpy(op->u.get_para.s.scaling_governor, "Unknown",
                     CPUFREQ_NAME_LEN);
 
         /* governor specific para */
-        if ( !strncasecmp(op->u.get_para.u.s.scaling_governor,
+        if ( !strncasecmp(op->u.get_para.s.scaling_governor,
                           "userspace", CPUFREQ_NAME_LEN) )
-            op->u.get_para.u.s.u.userspace.scaling_setspeed = policy->cur;
+            op->u.get_para.s.u.userspace.scaling_setspeed = policy->cur;
 
-        if ( !strncasecmp(op->u.get_para.u.s.scaling_governor,
+        if ( !strncasecmp(op->u.get_para.s.scaling_governor,
                           "ondemand", CPUFREQ_NAME_LEN) )
             ret = get_cpufreq_ondemand_para(
-                &op->u.get_para.u.s.u.ondemand.sampling_rate_max,
-                &op->u.get_para.u.s.u.ondemand.sampling_rate_min,
-                &op->u.get_para.u.s.u.ondemand.sampling_rate,
-                &op->u.get_para.u.s.u.ondemand.up_threshold);
+                &op->u.get_para.s.u.ondemand.sampling_rate_max,
+                &op->u.get_para.s.u.ondemand.sampling_rate_min,
+                &op->u.get_para.s.u.ondemand.sampling_rate,
+                &op->u.get_para.s.u.ondemand.up_threshold);
     }
 
     return ret;
@@ -385,6 +394,10 @@ int do_pm_op(struct xen_sysctl_pm_op *op)
         ret = set_cpufreq_para(op);
         break;
 
+    case GET_CPUFREQ_CPPC:
+        ret = get_cpufreq_cppc(op->cpuid, &op->u.get_cppc);
+        break;
+
     case SET_CPUFREQ_CPPC:
         ret = set_cpufreq_cppc(op);
         break;
diff --git a/xen/include/public/sysctl.h b/xen/include/public/sysctl.h
index eb3a23b038..66c9b65465 100644
--- a/xen/include/public/sysctl.h
+++ b/xen/include/public/sysctl.h
@@ -478,22 +478,19 @@ struct xen_get_cpufreq_para {
     uint32_t cpuinfo_cur_freq;
     uint32_t cpuinfo_max_freq;
     uint32_t cpuinfo_min_freq;
-    union {
-        struct {
-            uint32_t scaling_cur_freq;
-
-            char scaling_governor[CPUFREQ_NAME_LEN];
-            uint32_t scaling_max_freq;
-            uint32_t scaling_min_freq;
-
-            /* for specific governor */
-            union {
-                struct  xen_userspace userspace;
-                struct  xen_ondemand ondemand;
-            } u;
-        } s;
-        struct xen_get_cppc_para cppc_para;
-    } u;
+    struct {
+        uint32_t scaling_cur_freq;
+
+        char scaling_governor[CPUFREQ_NAME_LEN];
+        uint32_t scaling_max_freq;
+        uint32_t scaling_min_freq;
+
+        /* for specific governor */
+        union {
+            struct  xen_userspace userspace;
+            struct  xen_ondemand ondemand;
+        } u;
+    } s;
 
     int32_t turbo_enabled;
 };
@@ -523,6 +520,7 @@ struct xen_sysctl_pm_op {
     #define SET_CPUFREQ_PARA           (CPUFREQ_PARA | 0x03)
     #define GET_CPUFREQ_AVGFREQ        (CPUFREQ_PARA | 0x04)
     #define SET_CPUFREQ_CPPC           (CPUFREQ_PARA | 0x05)
+    #define GET_CPUFREQ_CPPC           (CPUFREQ_PARA | 0x06)
 
     /* set/reset scheduler power saving option */
     #define XEN_SYSCTL_pm_op_set_sched_opt_smt    0x21
@@ -547,6 +545,7 @@ struct xen_sysctl_pm_op {
     uint32_t cpuid;
     union {
         struct xen_get_cpufreq_para get_para;
+        struct xen_get_cppc_para    get_cppc;
         struct xen_set_cpufreq_gov  set_gov;
         struct xen_set_cpufreq_para set_para;
         struct xen_set_cppc_para    set_cppc;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Sep 25 09:56:25 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Sep 2025 09:56:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1130308.1469875 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1v1ii9-0006mZ-9E; Thu, 25 Sep 2025 09:56:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1130308.1469875; Thu, 25 Sep 2025 09: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 1v1ii9-0006mS-6U; Thu, 25 Sep 2025 09:56:25 +0000
Received: by outflank-mailman (input) for mailman id 1130308;
 Thu, 25 Sep 2025 09: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 1v1ii7-0006lu-CA
 for xen-changelog@lists.xenproject.org; Thu, 25 Sep 2025 09: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 1v1ii7-009cMu-18
 for xen-changelog@lists.xenproject.org;
 Thu, 25 Sep 2025 09:56:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1v1ii7-00E0yH-12
 for xen-changelog@lists.xenproject.org;
 Thu, 25 Sep 2025 09: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=y17Rx16yqOH4OwmMPaA1ExD948JgSTWlqTLmi4Wdrmo=; b=CuCLiVXOh4U9l3Q+LKqKZefrNz
	quYt4OTTvNxbYkku6ifL107IBge+33e+ZZN9/HO8g8umyXmPKEYXngj7W5+zw9q1onmAbAa4M+966
	wNjlheLROuN09AYX1C69AdGKK4V6QmpVAvQvji/SRp6p9245fS20AUcmz8ug3Dx5u43A=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/cpufreq: bypass governor-related para for amd-cppc-epp
Message-Id: <E1v1ii7-00E0yH-12@xenbits.xenproject.org>
Date: Thu, 25 Sep 2025 09:56:23 +0000

commit 494de59f045fea01956cd252ef35a9c25037cabf
Author:     Penny Zheng <Penny.Zheng@amd.com>
AuthorDate: Thu Sep 25 09:21:41 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Sep 25 10:21:31 2025 +0200

    xen/cpufreq: bypass governor-related para for amd-cppc-epp
    
    HWP and amd-cppc-epp are both governor-less driver, so we introduce
    "is_governor_less" flag and cpufreq_is_governorless() to help bypass
    governor-related info on dealing with cpufreq para.
    
    Signed-off-by: Penny Zheng <Penny.Zheng@amd.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Anthony PERARD <anthony.perard@vates.tech>
---
 tools/misc/xenpm.c                 | 10 +++++++---
 xen/drivers/acpi/pm-op.c           |  4 ++--
 xen/include/acpi/cpufreq/cpufreq.h | 12 ++++++++++++
 3 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/tools/misc/xenpm.c b/tools/misc/xenpm.c
index c7f19cea28..682d092479 100644
--- a/tools/misc/xenpm.c
+++ b/tools/misc/xenpm.c
@@ -832,9 +832,13 @@ static void print_cppc_para(unsigned int cpuid,
 /* print out parameters about cpu frequency */
 static void print_cpufreq_para(int cpuid, struct xc_get_cpufreq_para *p_cpufreq)
 {
-    bool hwp = strcmp(p_cpufreq->scaling_driver, XEN_HWP_DRIVER_NAME) == 0;
+    bool is_governor_less = false;
     int i;
 
+    if ( !strcmp(p_cpufreq->scaling_driver, XEN_HWP_DRIVER_NAME) ||
+         !strcmp(p_cpufreq->scaling_driver, XEN_AMD_CPPC_EPP_DRIVER_NAME) )
+        is_governor_less = true;
+
     printf("cpu id               : %d\n", cpuid);
 
     printf("affected_cpus        :");
@@ -842,7 +846,7 @@ static void print_cpufreq_para(int cpuid, struct xc_get_cpufreq_para *p_cpufreq)
         printf(" %d", p_cpufreq->affected_cpus[i]);
     printf("\n");
 
-    if ( hwp )
+    if ( is_governor_less )
         printf("cpuinfo frequency    : base [%"PRIu32"] max [%"PRIu32"]\n",
                p_cpufreq->cpuinfo_min_freq,
                p_cpufreq->cpuinfo_max_freq);
@@ -854,7 +858,7 @@ static void print_cpufreq_para(int cpuid, struct xc_get_cpufreq_para *p_cpufreq)
 
     printf("scaling_driver       : %s\n", p_cpufreq->scaling_driver);
 
-    if ( !hwp )
+    if ( !is_governor_less )
     {
         if ( p_cpufreq->gov_num )
             printf("scaling_avail_gov    : %s\n",
diff --git a/xen/drivers/acpi/pm-op.c b/xen/drivers/acpi/pm-op.c
index f50acd7088..4cca42c4fc 100644
--- a/xen/drivers/acpi/pm-op.c
+++ b/xen/drivers/acpi/pm-op.c
@@ -154,7 +154,7 @@ static int get_cpufreq_para(struct xen_sysctl_pm_op *op)
     else
         strlcpy(op->u.get_para.scaling_driver, "Unknown", CPUFREQ_NAME_LEN);
 
-    if ( !hwp_active() )
+    if ( !cpufreq_is_governorless(op->cpuid) )
     {
         if ( !(scaling_available_governors =
                xzalloc_array(char, gov_num * CPUFREQ_NAME_LEN)) )
@@ -240,7 +240,7 @@ static int set_cpufreq_para(struct xen_sysctl_pm_op *op)
     if ( !policy || !policy->governor )
         return -EINVAL;
 
-    if ( hwp_active() )
+    if ( cpufreq_is_governorless(op->cpuid) )
         return -EOPNOTSUPP;
 
     switch( op->u.set_para.ctrl_type )
diff --git a/xen/include/acpi/cpufreq/cpufreq.h b/xen/include/acpi/cpufreq/cpufreq.h
index 9ef7c4683a..3efa71d442 100644
--- a/xen/include/acpi/cpufreq/cpufreq.h
+++ b/xen/include/acpi/cpufreq/cpufreq.h
@@ -294,4 +294,16 @@ int acpi_cpufreq_register(void);
 int amd_cppc_cmdline_parse(const char *s, const char *e);
 int amd_cppc_register_driver(void);
 
+/*
+ * Governor-less cpufreq driver indicates the driver doesn't rely on Xen
+ * governor to do performance tuning, mostly it has hardware built-in
+ * algorithm to calculate runtime workload and adjust cores frequency
+ * automatically, like Intel HWP, or CPPC in AMD.
+ */
+static inline bool cpufreq_is_governorless(unsigned int cpu)
+{
+    return processor_pminfo[cpu]->init && (hwp_active() ||
+                                           cpufreq_driver.setpolicy);
+}
+
 #endif /* __XEN_CPUFREQ_PM_H__ */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Sep 25 09:56:35 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Sep 2025 09:56:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1130309.1469879 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1v1iiJ-0006on-Aa; Thu, 25 Sep 2025 09:56:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1130309.1469879; Thu, 25 Sep 2025 09: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 1v1iiJ-0006of-7u; Thu, 25 Sep 2025 09:56:35 +0000
Received: by outflank-mailman (input) for mailman id 1130309;
 Thu, 25 Sep 2025 09: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 1v1iiH-0006oR-F8
 for xen-changelog@lists.xenproject.org; Thu, 25 Sep 2025 09:56: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 1v1iiH-009cN3-1P
 for xen-changelog@lists.xenproject.org;
 Thu, 25 Sep 2025 09:56:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1v1iiH-00E0yp-1J
 for xen-changelog@lists.xenproject.org;
 Thu, 25 Sep 2025 09: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=LtOT/Ardu+mZoanHFGaBZFkk9Ppe7TZ0hoZKtX0k/cE=; b=0qDvkbZdflY2kmzXSdH5HNIplV
	yDKFD6c80gqbS+/ECpRI1n7S6JHzmdClh32nyJO2zKmsbHeMIzVGou8QOO9QCYIGrIHzik479OBRH
	Hq8yVFU90+wnM124TJAGZba0ybnb+PJXAfT3FIrGM/ElnzPWL7fEuKwq9niaTGYA+Y44=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] CHANGELOG.md: add amd-cppc/amd-cppc-epp cpufreq driver support
Message-Id: <E1v1iiH-00E0yp-1J@xenbits.xenproject.org>
Date: Thu, 25 Sep 2025 09:56:33 +0000

commit b768b46ff1b34a36aeca579bf6a1c13ae383e631
Author:     Penny Zheng <Penny.Zheng@amd.com>
AuthorDate: Thu Sep 25 09:21:55 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Sep 25 10:21:46 2025 +0200

    CHANGELOG.md: add amd-cppc/amd-cppc-epp cpufreq driver support
    
    Signed-off-by: Penny Zheng <Penny.Zheng@amd.com>
    Acked-by: Oleksii Kurochko<oleksii.kurochko@gmail.com>
---
 CHANGELOG.md | 1 +
 1 file changed, 1 insertion(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index ca1b43b940..7b9518ff08 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -36,6 +36,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
    - Support in hvmloader for new SMBIOS tables: 7 (Cache Info), 8 (Port
      Connector), 9 (System Slots), 26 (Voltage Probe), 27 (Cooling Device),
      and 28 (Temperature Probe).
+   - New amd-cppc/amd-cppc-epp cpufreq driver.
 
  - On Arm:
     - Ability to enable stack protector
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Sep 25 09:56:45 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Sep 2025 09:56:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1130311.1469883 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1v1iiT-0006r0-C1; Thu, 25 Sep 2025 09:56:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1130311.1469883; Thu, 25 Sep 2025 09: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 1v1iiT-0006qs-9G; Thu, 25 Sep 2025 09:56:45 +0000
Received: by outflank-mailman (input) for mailman id 1130311;
 Thu, 25 Sep 2025 09: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 1v1iiR-0006qh-JJ
 for xen-changelog@lists.xenproject.org; Thu, 25 Sep 2025 09: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 1v1iiR-009cNB-1q
 for xen-changelog@lists.xenproject.org;
 Thu, 25 Sep 2025 09:56:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1v1iiR-00E0za-1Z
 for xen-changelog@lists.xenproject.org;
 Thu, 25 Sep 2025 09:56: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=aOt5gI647ztjFTnA3bERGzu/VLfQbid5NhH18n6gtcs=; b=qbJ6eLZifi2Cdr5YxEi272G/Wn
	bfevj2fo43N7yXMqK1fGPeKfT/UIMl8JzDKpDNfPwkoZD3lyLreZHzqWa2ul0Q964jwcyE2c52zAz
	ln1LaYNIdkjPO8TwHn7ktQ2PHqjib6Be26+9LtDtIPVyKhaTRp7hIH8r+CIRq1m5izeU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] releases: use newer compression methods for tarballs
Message-Id: <E1v1iiR-00E0za-1Z@xenbits.xenproject.org>
Date: Thu, 25 Sep 2025 09:56:43 +0000

commit 63ebd0e9649e51d4f09e7f289e995dfcd3240df6
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Sep 25 10:22:55 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Sep 25 10:22:55 2025 +0200

    releases: use newer compression methods for tarballs
    
    Other projects have long switched to xz and/or lzip.
    
    Tidy things some as well: With the removal of qemu from the tarball,
    intermediately extracting the tarball again has become wasteful. Drop
    that. Invoke compressors using asynchronous lists, to reduce overall
    latency. Drop the -v option from the (previously implicit) gzip
    invocation.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
    Tested-by: Julien Grall <jgrall@amazon.com>
---
 docs/process/release-technician-checklist.txt | 15 +++++++++++----
 docs/process/xen-release-management.pandoc    |  4 ++--
 tools/misc/mktarball                          | 23 ++++++++++-------------
 3 files changed, 23 insertions(+), 19 deletions(-)

diff --git a/docs/process/release-technician-checklist.txt b/docs/process/release-technician-checklist.txt
index 64ed9fd5b2..ae369c6dc5 100644
--- a/docs/process/release-technician-checklist.txt
+++ b/docs/process/release-technician-checklist.txt
@@ -119,7 +119,7 @@ RELEASE TARBALL
        make src-tarball           # uses git-describe (best for RCs)
         # ^find some way to add git-cache-proxy to this (done in ~iwj/.gitconfig)
        mkdir /volatile/iwj/website-thing/xen.org/oss-xen/release/$v
-       mv dist/xen-$v.tar.gz /volatile/iwj/website-thing/xen.org/oss-xen/release/$v/.
+       mv dist/xen-$v.tar.[glx]z /volatile/iwj/website-thing/xen.org/oss-xen/release/$v/.
 
        # website-thing/xen.org is cvs -d mail.xenproject.org:/home/downloads-cvs/cvs-repos co xen.org
 	cd /volatile/iwj/website-thing/xen.org
@@ -139,9 +139,12 @@ RELEASE TARBALL
 	cvs add -kb oss-xen/release/$v/
 
         cd oss-xen/release/$v
-        gpg --digest-algo=SHA256 --detach-sign -u 'xen tree' xen-$v.tar.gz
-	cvs add -kb xen-$v.tar.gz
-        cvs add -kb xen-$v.tar.gz.sig
+        for t in xen-$v.tar.[glx]z
+        do
+            gpg --digest-algo=SHA256 --detach-sign -u 'xen tree' $t
+            cvs add -kb $t
+            cvs add -kb $t.sig
+        done
         cd ../../..
 
 	cvs ci -m $v
@@ -152,6 +155,10 @@ RELEASE TARBALL
 	# should show something like
 	#   U oss-xen/release/4.8.0-rc2/xen-4.8.0-rc2.tar.gz
 	#   U oss-xen/release/4.8.0-rc2/xen-4.8.0-rc2.tar.gz.sig
+	#   U oss-xen/release/4.8.0-rc2/xen-4.8.0-rc2.tar.lz
+	#   U oss-xen/release/4.8.0-rc2/xen-4.8.0-rc2.tar.lz.sig
+	#   U oss-xen/release/4.8.0-rc2/xen-4.8.0-rc2.tar.xz
+	#   U oss-xen/release/4.8.0-rc2/xen-4.8.0-rc2.tar.xz.sig
 
 After a .0 release, update XEN_EXTRAVERSION again (to .1-pre, see above).
 
diff --git a/docs/process/xen-release-management.pandoc b/docs/process/xen-release-management.pandoc
index 5da18f6da1..3e12082789 100644
--- a/docs/process/xen-release-management.pandoc
+++ b/docs/process/xen-release-management.pandoc
@@ -274,10 +274,10 @@ Xen X.Y rcZ is tagged. You can check that out from xen.git:
 https://xenbits.xen.org/git-http/xen.git X.Y.0-rcZ
 
 For your convenience there is also a tarball at:
-https://downloads.xenproject.org/release/xen/X.Y.0-rcZ/xen-X.Y.0-rcZ.tar.gz
+https://downloads.xenproject.org/release/xen/X.Y.0-rcZ/xen-X.Y.0-rcZ.tar.[glx]z
 
 And the signature is at:
-https://downloads.xenproject.org/release/xen/X.Y.0-rcZ/xen-X.Y.0-rcZ.tar.gz.sig
+https://downloads.xenproject.org/release/xen/X.Y.0-rcZ/xen-X.Y.0-rcZ.tar.[glx]z.sig
 
 Please send bug reports and test reports to xen-devel@lists.xenproject.org.
 When sending bug reports, please CC relevant maintainers and me
diff --git a/tools/misc/mktarball b/tools/misc/mktarball
index 7f9b61da43..72c5b0b5ee 100755
--- a/tools/misc/mktarball
+++ b/tools/misc/mktarball
@@ -5,14 +5,6 @@
 # Takes 2 arguments, the path to the dist directory and the version
 set -ex
 
-function git_archive_into {
-    mkdir -p "$2"
-
-    git --git-dir="$1"/.git \
-	archive --format=tar HEAD | \
-	tar Cxf "$2" -
-}
-
 if [[ -z "$1" || -z "$2" ]] ; then
   echo "usage: $0 path-to-XEN_ROOT xen-version"
   exit 1
@@ -21,14 +13,19 @@ fi
 xen_root="$1"
 desc="$2"
 
-tdir="$xen_root/dist/tmp.src-tarball"
+tdir="$xen_root/dist"
 
-rm -rf $tdir
+rm -f $tdir/xen-$desc.tar*
 
 mkdir -p $tdir
 
-git_archive_into $xen_root $tdir/xen-$desc
+git --git-dir="$xen_root/.git" archive --format=tar HEAD --prefix=xen-$desc/ \
+    >"$tdir/xen-$desc.tar"
 
-GZIP=-9v tar cz -f $xen_root/dist/xen-$desc.tar.gz -C $tdir xen-$desc
+gzip -9k "$tdir/xen-$desc.tar" &
+xz -9k "$tdir/xen-$desc.tar" &
+lzip -9k "$tdir/xen-$desc.tar" &
+wait
 
-echo "Source tarball in $xen_root/dist/xen-$desc.tar.gz"
+echo "Source tarball(s):"
+ls -lh $tdir/xen-$desc.tar*
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Sep 25 10:44:06 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Sep 2025 10:44:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1130335.1469897 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1v1jSF-0004e7-P8; Thu, 25 Sep 2025 10:44:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1130335.1469897; Thu, 25 Sep 2025 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 1v1jSF-0004dy-M8; Thu, 25 Sep 2025 10:44:03 +0000
Received: by outflank-mailman (input) for mailman id 1130335;
 Thu, 25 Sep 2025 10: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 1v1jSE-0004ds-JH
 for xen-changelog@lists.xenproject.org; Thu, 25 Sep 2025 10: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 1v1jSE-009dWp-1f
 for xen-changelog@lists.xenproject.org;
 Thu, 25 Sep 2025 10:44:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1v1jSE-00E6Q4-1O
 for xen-changelog@lists.xenproject.org;
 Thu, 25 Sep 2025 10: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=hmD/NYMjFsbnD+/kA6sbrNhjjiJe8bMGLTWjysJs2x4=; b=o9jVztHX8iWYYfU574EPDu1mHP
	pKmFBxkTjl1UuAOH3+X8laAHzki91EsttAoBZlqqkfYFrXe8ur6tDOT9CfvTQhVKWcR99ACANl9m+
	euIzp26xL4bTjDA6R57AEx0ZOwmirwiF+YUgg7ISveIf1ltVESo3TKleIo4tIn5G/1o8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] SUPPORT.md: add xenstorepvh-stubdom live update
Message-Id: <E1v1jSE-00E6Q4-1O@xenbits.xenproject.org>
Date: Thu, 25 Sep 2025 10:44:02 +0000

commit 39785fabd25edda5db1b4465726f76204b5c9d16
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Thu Sep 25 09:18:38 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Sep 25 09:18:38 2025 +0200

    SUPPORT.md: add xenstorepvh-stubdom live update
    
    Live update is now working with the PVH variant of xenstore-stubdom.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 SUPPORT.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/SUPPORT.md b/SUPPORT.md
index 6a82a92189..eb44ee85fd 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -280,7 +280,7 @@ or itself will not be regarded a security issue.
 ### C xenstore stubdom PVH
 
     Status: Supported
-    Status, Liveupdate: Not implemented
+    Status, Liveupdate: Supported
 
 ### OCaml xenstored daemon
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Sep 25 10:44:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Sep 2025 10:44:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1130336.1469901 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1v1jSP-0004fk-Q1; Thu, 25 Sep 2025 10:44:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1130336.1469901; Thu, 25 Sep 2025 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 1v1jSP-0004fb-NQ; Thu, 25 Sep 2025 10:44:13 +0000
Received: by outflank-mailman (input) for mailman id 1130336;
 Thu, 25 Sep 2025 10: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 1v1jSO-0004fP-Ke
 for xen-changelog@lists.xenproject.org; Thu, 25 Sep 2025 10: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 1v1jSO-009dXC-1y
 for xen-changelog@lists.xenproject.org;
 Thu, 25 Sep 2025 10:44:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1v1jSO-00E6Tf-1q
 for xen-changelog@lists.xenproject.org;
 Thu, 25 Sep 2025 10: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=ulVtiAy88/XVo80SuUxsWTZGML70C5AfFYuqBc5u8HM=; b=KWB08XRP9NMHLbf1UIqF8hzQky
	eb7qJxwOlBB8haPJ2bxQatF90ZGmcQtPip73rS/RJfvHIY4hnd5dqkZlsbS1XofQx0J3ZMUJBo+Nd
	ACASBAiu06r2GM5YtHKvmBcFhcu+eXYa4BORRTKeOLtfyVB6SYTWcQ8Hrcy+Iy0I+038=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] libacpi: Remove CPU hotplug and GPE handling from PVH DSDTs
Message-Id: <E1v1jSO-00E6Tf-1q@xenbits.xenproject.org>
Date: Thu, 25 Sep 2025 10:44:12 +0000

commit b59e564aa0830f60214b9b5afb4f8543dd1bf2b0
Author:     Alejandro Vallejo <alejandro.garciavallejo@amd.com>
AuthorDate: Thu Sep 25 09:18:55 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Sep 25 09:18:55 2025 +0200

    libacpi: Remove CPU hotplug and GPE handling from PVH DSDTs
    
    PVH guests have no DM, so this causes the guest to fetch the online CPU
    bitmap from an unbacked 0xaf00 PIO port when executing the GPE handler.
    
    Seeing how ACPI CPU hotplug is the only event delivered via GPE, remove
    the GPE handler in addition to anything ACPI CPU hotplug related.
    
    This shrinks PVH's DSDT substantially and prevents spuriously executing
    a large amount of AML with no purpose at all.
    
    Fixes: 062975dc9441("acpi: PVH guests need _E02 method")
    Signed-off-by: Alejandro Vallejo <alejandro.garciavallejo@amd.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 tools/libacpi/mk_dsdt.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/tools/libacpi/mk_dsdt.c b/tools/libacpi/mk_dsdt.c
index 8ac4f9d0b4..f71de6c8c6 100644
--- a/tools/libacpi/mk_dsdt.c
+++ b/tools/libacpi/mk_dsdt.c
@@ -218,6 +218,11 @@ int main(int argc, char **argv)
     pop_block();
     /**** Processor end ****/
 #else
+    if (dm_version == QEMU_NONE) {
+        pop_block();
+        pop_block();
+        return 0;
+    }
 
     /* Operation Region 'PRST': bitmask of online CPUs. */
     stmt("OperationRegion", "PRST, SystemIO, %#x, %d",
@@ -264,10 +269,6 @@ int main(int argc, char **argv)
     pop_block();
     pop_block();
 
-    if (dm_version == QEMU_NONE) {
-        pop_block();
-        return 0;
-    }
     /**** Processor end ****/
 
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Sep 25 10:44:23 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Sep 2025 10:44:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1130337.1469905 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1v1jSZ-0004ig-RO; Thu, 25 Sep 2025 10:44:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1130337.1469905; Thu, 25 Sep 2025 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 1v1jSZ-0004iY-Oj; Thu, 25 Sep 2025 10:44:23 +0000
Received: by outflank-mailman (input) for mailman id 1130337;
 Thu, 25 Sep 2025 10: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 1v1jSY-0004iQ-R4
 for xen-changelog@lists.xenproject.org; Thu, 25 Sep 2025 10: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 1v1jSY-009dXH-2b
 for xen-changelog@lists.xenproject.org;
 Thu, 25 Sep 2025 10:44:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1v1jSY-00E6VA-28
 for xen-changelog@lists.xenproject.org;
 Thu, 25 Sep 2025 10: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=l1W3vwZjIOhM+0Oy1HMPOisLBLLC1YZZGqrMNHkA9mI=; b=etOeBvbBzTxVgd+D4sPEDT3in/
	zVBEQQM0uOM2DY1rKbeSDQYnSJ1dBMaYEzT86ESJ22eltTaylUjLuPVKDbgtPuvBmlZvM0/OpkbmF
	mJ1yndLTbHwE18b1/eJVF4OWpEQie/5NnlFV24Qu1TtA5087okir/wTGYwg4ivF41aKY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] MAINTAINERS: add myself as vPCI reviewer
Message-Id: <E1v1jSY-00E6VA-28@xenbits.xenproject.org>
Date: Thu, 25 Sep 2025 10:44:22 +0000

commit ac58e34a0960bcc71583edfc6b4d6baa5e81c7d0
Author:     Stewart Hildebrand <stewart.hildebrand@amd.com>
AuthorDate: Thu Sep 25 09:19:21 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Sep 25 09:19:21 2025 +0200

    MAINTAINERS: add myself as vPCI reviewer
    
    I'd like to take a more active role in reviewing vPCI bits.
    
    Signed-off-by: Stewart Hildebrand <stewart.hildebrand@amd.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 31dbba54bb..793561f63f 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -578,6 +578,7 @@ F:	xen/include/*/vm_event.h
 
 VPCI
 M:	Roger Pau Monné <roger.pau@citrix.com>
+R:	Stewart Hildebrand <stewart.hildebrand@amd.com>
 S:	Supported
 F:	tools/tests/vpci/
 F:	xen/drivers/vpci/
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Sep 25 10:44:33 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Sep 2025 10:44:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1130338.1469909 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1v1jSj-0004lR-Sr; Thu, 25 Sep 2025 10:44:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1130338.1469909; Thu, 25 Sep 2025 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 1v1jSj-0004lJ-QG; Thu, 25 Sep 2025 10:44:33 +0000
Received: by outflank-mailman (input) for mailman id 1130338;
 Thu, 25 Sep 2025 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 1v1jSi-0004l7-Ui
 for xen-changelog@lists.xenproject.org; Thu, 25 Sep 2025 10: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 1v1jSi-009dXL-2y
 for xen-changelog@lists.xenproject.org;
 Thu, 25 Sep 2025 10:44:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1v1jSi-00E6WF-2m
 for xen-changelog@lists.xenproject.org;
 Thu, 25 Sep 2025 10: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=yoPzM34+JGVO4v+vroNIy8ESbsG4ZkngPzSuV4CVNeo=; b=SSpn/LAViAP1gFA8V+l9qRdG8W
	CIpRnCUKTS7mEJZ+7ELYvndpPrjj0xfPQbm60t62B/FtNjM8CjWl6Yq4ET7FMd94OaKjWQnuX/XR4
	/tF/Bw4ezs9InV0kiRKMbfZ4WHzMFqVtVvtr0r/KXujDKPQBT8Q+r+sjzn0brKfI1e34=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/cpufreq: make HW_ALL the only expected value for CPPC mode
Message-Id: <E1v1jSi-00E6WF-2m@xenbits.xenproject.org>
Date: Thu, 25 Sep 2025 10:44:32 +0000

commit f404dad459a610c33d5987a3c2eb8bafda720932
Author:     Penny Zheng <Penny.Zheng@amd.com>
AuthorDate: Thu Sep 25 09:19:41 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Sep 25 09:19:41 2025 +0200

    xen/cpufreq: make HW_ALL the only expected value for CPPC mode
    
    Right now, no matter for code construction or hardware restriction, HW_ALL
    shall be the only expected values in _PSD for AMD CPPC mode
    
    Suggested-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Penny Zheng <Penny.Zheng@amd.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/drivers/cpufreq/cpufreq.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/xen/drivers/cpufreq/cpufreq.c b/xen/drivers/cpufreq/cpufreq.c
index fe6bd7ff25..4b74f5590b 100644
--- a/xen/drivers/cpufreq/cpufreq.c
+++ b/xen/drivers/cpufreq/cpufreq.c
@@ -765,6 +765,16 @@ int set_cppc_pminfo(unsigned int acpi_id,
         goto out;
     }
 
+    /* Right now, HW_ALL shall be the only expected value in CPPC mode */
+    if ( cppc_data->shared_type != CPUFREQ_SHARED_TYPE_HW )
+    {
+        ret = -EINVAL;
+        printk_once(XENLOG_ERR
+                    "Unsupported sharing type %u in CPPC mode\n",
+                    cppc_data->shared_type);
+        goto out;
+    }
+
     if ( cppc_data->flags & XEN_CPPC_CPC )
     {
         if ( cppc_data->cpc.highest_perf == 0 ||
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Sep 25 10:44:43 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Sep 2025 10:44:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1130339.1469914 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1v1jSt-0004oO-VD; Thu, 25 Sep 2025 10:44:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1130339.1469914; Thu, 25 Sep 2025 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 1v1jSt-0004oG-Rh; Thu, 25 Sep 2025 10:44:43 +0000
Received: by outflank-mailman (input) for mailman id 1130339;
 Thu, 25 Sep 2025 10:44: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 1v1jSt-0004o1-34
 for xen-changelog@lists.xenproject.org; Thu, 25 Sep 2025 10:44: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 1v1jSt-009dXR-02
 for xen-changelog@lists.xenproject.org;
 Thu, 25 Sep 2025 10:44:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1v1jSs-00E6Wv-3A
 for xen-changelog@lists.xenproject.org;
 Thu, 25 Sep 2025 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=wty5W/JnBDJpomzq+URCCArdABLSeola0zQBize4XqA=; b=tlPmAmFJNmIVFRfcsmPD8vyYjE
	FZyvPaZLHVxhXDRoF3jgmTC6isEiv9O7OzIYPHIDHecDci3+TnzVMUWVXbjTpdxthZqh18yaucPwZ
	WxFOob6a0TltCIcPGCEGHiQQyZ1+WThW15/TV2ntT7I5m28IwVcXvJoi/ZUw+S7gR1sU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/cpufreq: implement amd-cppc driver for CPPC in passive mode
Message-Id: <E1v1jSs-00E6Wv-3A@xenbits.xenproject.org>
Date: Thu, 25 Sep 2025 10:44:42 +0000

commit f3727dd10a86605946aafddd46473a3d85e134ea
Author:     Penny Zheng <Penny.Zheng@amd.com>
AuthorDate: Thu Sep 25 09:20:36 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Sep 25 09:20:36 2025 +0200

    xen/cpufreq: implement amd-cppc driver for CPPC in passive mode
    
    amd-cppc is the AMD CPU performance scaling driver that introduces a
    new CPU frequency control mechanism. The new mechanism is based on
    Collaborative Processor Performance Control (CPPC) which is a finer grain
    frequency management than legacy ACPI hardware P-States.
    Current AMD CPU platforms are using the ACPI P-states driver to
    manage CPU frequency and clocks with switching only in 3 P-states, while the
    new amd-cppc allows a more flexible, low-latency interface for Xen
    to directly communicate the performance hints to hardware.
    
    "amd-cppc" driver is responsible for implementing CPPC in passive mode, which
    still leverages Xen governors such as *ondemand*, *performance*, etc, to
    calculate the performance hints. In the future, we will introduce an advanced
    active mode to enable autonomous performence level selection.
    
    Field epp, energy performance preference, which only has meaning when active
    mode is enabled and will be introduced later in details, so we read
    pre-defined BIOS value for it in passive mode.
    
    Signed-off-by: Penny Zheng <Penny.Zheng@amd.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/acpi/cpufreq/amd-cppc.c | 418 ++++++++++++++++++++++++++++++++++-
 xen/arch/x86/cpu/amd.c               |   8 +-
 xen/arch/x86/include/asm/amd.h       |   2 +
 xen/arch/x86/include/asm/msr-index.h |   6 +
 xen/include/public/sysctl.h          |   1 +
 5 files changed, 430 insertions(+), 5 deletions(-)

diff --git a/xen/arch/x86/acpi/cpufreq/amd-cppc.c b/xen/arch/x86/acpi/cpufreq/amd-cppc.c
index 3377783f7e..5b99b86fb7 100644
--- a/xen/arch/x86/acpi/cpufreq/amd-cppc.c
+++ b/xen/arch/x86/acpi/cpufreq/amd-cppc.c
@@ -14,7 +14,98 @@
 #include <xen/domain.h>
 #include <xen/init.h>
 #include <xen/param.h>
+#include <xen/percpu.h>
+#include <xen/xvmalloc.h>
 #include <acpi/cpufreq/cpufreq.h>
+#include <asm/amd.h>
+#include <asm/msr.h>
+
+#define amd_cppc_err(cpu, fmt, args...)                             \
+    printk(XENLOG_ERR "AMD-CPPC: CPU%u error: " fmt, cpu, ## args)
+#define amd_cppc_warn(cpu, fmt, args...)                            \
+    printk(XENLOG_WARNING "AMD-CPPC: CPU%u warning: " fmt, cpu, ## args)
+#define amd_cppc_verbose(cpu, fmt, args...)                         \
+({                                                                  \
+    if ( cpufreq_verbose )                                          \
+        printk(XENLOG_DEBUG "AMD-CPPC: CPU%u " fmt, cpu, ## args);  \
+})
+
+/*
+ * Field highest_perf, nominal_perf, lowest_nonlinear_perf, and lowest_perf
+ * contain the values read from CPPC capability MSR. They represent the limits
+ * of managed performance range as well as the dynamic capability, which may
+ * change during processor operation
+ * Field highest_perf represents highest performance, which is the absolute
+ * maximum performance an individual processor may reach, assuming ideal
+ * conditions. This performance level may not be sustainable for long
+ * durations and may only be achievable if other platform components
+ * are in a specific state; for example, it may require other processors be
+ * in an idle state. This would be equivalent to the highest frequencies
+ * supported by the processor.
+ * Field nominal_perf represents maximum sustained performance level of the
+ * processor, assuming ideal operating conditions. All cores/processors are
+ * expected to be able to sustain their nominal performance state
+ * simultaneously.
+ * Field lowest_nonlinear_perf represents Lowest Nonlinear Performance, which
+ * is the lowest performance level at which nonlinear power savings are
+ * achieved. Above this threshold, lower performance levels should be
+ * generally more energy efficient than higher performance levels. So in
+ * traditional terms, this represents the P-state range of performance levels.
+ * Field lowest_perf represents the absolute lowest performance level of the
+ * platform. Selecting it may cause an efficiency penalty but should reduce
+ * the instantaneous power consumption of the processor. So in traditional
+ * terms, this represents the T-state range of performance levels.
+ *
+ * Field max_perf, min_perf, des_perf store the values for CPPC request MSR.
+ * Software passes performance goals through these fields.
+ * Field max_perf conveys the maximum performance level at which the platform
+ * may run. And it may be set to any performance value in the range
+ * [lowest_perf, highest_perf], inclusive.
+ * Field min_perf conveys the minimum performance level at which the platform
+ * may run. And it may be set to any performance value in the range
+ * [lowest_perf, highest_perf], inclusive but must be less than or equal to
+ * max_perf.
+ * Field des_perf conveys performance level Xen governor is requesting. And it
+ * may be set to any performance value in the range [min_perf, max_perf],
+ * inclusive.
+ * Field epp represents energy performance preference, which only has meaning
+ * when active mode is enabled.
+ */
+struct amd_cppc_drv_data
+{
+    const struct xen_processor_cppc *cppc_data;
+    union {
+        uint64_t raw;
+        struct {
+            unsigned int lowest_perf:8;
+            unsigned int lowest_nonlinear_perf:8;
+            unsigned int nominal_perf:8;
+            unsigned int highest_perf:8;
+            unsigned int :32;
+        };
+    } caps;
+    union {
+        uint64_t raw;
+        struct {
+            unsigned int max_perf:8;
+            unsigned int min_perf:8;
+            unsigned int des_perf:8;
+            unsigned int epp:8;
+            unsigned int :32;
+        };
+    } req;
+
+    int err;
+};
+
+static DEFINE_PER_CPU_READ_MOSTLY(struct amd_cppc_drv_data *,
+                                  amd_cppc_drv_data);
+/*
+ * Core max frequency read from PstateDef as anchor point
+ * for freq-to-perf transition
+ */
+static DEFINE_PER_CPU_READ_MOSTLY(unsigned int, pxfreq_mhz);
+static DEFINE_PER_CPU_READ_MOSTLY(uint8_t, epp_init);
 
 static bool __init amd_cppc_handle_option(const char *s, const char *end)
 {
@@ -50,10 +141,335 @@ int __init amd_cppc_cmdline_parse(const char *s, const char *e)
     return 0;
 }
 
+/*
+ * If CPPC lowest_freq and nominal_freq registers are exposed then we can
+ * use them to convert perf to freq and vice versa. The conversion is
+ * extrapolated as an linear function passing by the 2 points:
+ *  - (Low perf, Low freq)
+ *  - (Nominal perf, Nominal freq)
+ * Parameter freq is always in kHz.
+ */
+static int amd_cppc_khz_to_perf(const struct amd_cppc_drv_data *data,
+                                unsigned int freq, uint8_t *perf)
+{
+    const struct xen_processor_cppc *cppc_data = data->cppc_data;
+    unsigned int mul, div;
+    int offset = 0, res;
+
+    if ( cppc_data->cpc.lowest_mhz &&
+         data->caps.nominal_perf > data->caps.lowest_perf &&
+         cppc_data->cpc.nominal_mhz > cppc_data->cpc.lowest_mhz )
+    {
+        mul = data->caps.nominal_perf - data->caps.lowest_perf;
+        div = cppc_data->cpc.nominal_mhz - cppc_data->cpc.lowest_mhz;
+
+        /*
+         * We don't need to convert to kHz for computing offset and can
+         * directly use nominal_mhz and lowest_mhz as the division
+         * will remove the frequency unit.
+         */
+        offset = data->caps.nominal_perf -
+                 (mul * cppc_data->cpc.nominal_mhz) / div;
+    }
+    else
+    {
+        /* Read Processor Max Speed(MHz) as anchor point */
+        mul = data->caps.highest_perf;
+        div = this_cpu(pxfreq_mhz);
+        if ( !div )
+            return -EOPNOTSUPP;
+    }
+
+    res = offset + (mul * freq) / (div * 1000);
+    if ( res > UINT8_MAX )
+    {
+        printk_once(XENLOG_WARNING
+                    "Perf value exceeds maximum value 255: %d\n", res);
+        *perf = UINT8_MAX;
+        return 0;
+    }
+    if ( res <= 0 )
+    {
+        printk_once(XENLOG_WARNING
+                    "Perf value smaller than minimum value: %d\n", res);
+        return -ERANGE;
+    }
+    *perf = res;
+
+    return 0;
+}
+
+/*
+ * _CPC may define nominal frequecy and lowest frequency, if not, use
+ * Processor Max Speed as anchor point to calculate.
+ * Output freq stores cpc frequency in kHz
+ */
+static int amd_get_cpc_freq(const struct amd_cppc_drv_data *data,
+                            unsigned int cpc_mhz, uint8_t perf,
+                            unsigned int *freq)
+{
+    unsigned int mul, div, res;
+
+    if ( cpc_mhz )
+    {
+        /* Switch to kHz */
+        *freq = cpc_mhz * 1000;
+        return 0;
+    }
+
+    /* Read Processor Max Speed(MHz) as anchor point */
+    mul = this_cpu(pxfreq_mhz);
+    if ( !mul )
+        return -EOPNOTSUPP;
+    div = data->caps.highest_perf;
+    res = (mul * perf * 1000) / div;
+    if ( unlikely(!res) )
+        return -EOPNOTSUPP;
+
+    return 0;
+}
+
+/* Output max_freq stores calculated maximum frequency in kHz */
+static int amd_get_max_freq(const struct amd_cppc_drv_data *data,
+                            unsigned int *max_freq)
+{
+    unsigned int nom_freq = 0;
+    int res;
+
+    res = amd_get_cpc_freq(data, data->cppc_data->cpc.nominal_mhz,
+                           data->caps.nominal_perf, &nom_freq);
+    if ( res )
+        return res;
+
+    *max_freq = (data->caps.highest_perf * nom_freq) / data->caps.nominal_perf;
+
+    return 0;
+}
+
+static int cf_check amd_cppc_cpufreq_verify(struct cpufreq_policy *policy)
+{
+    cpufreq_verify_within_limits(policy, policy->cpuinfo.min_freq,
+                                 policy->cpuinfo.max_freq);
+
+    return 0;
+}
+
+static void cf_check amd_cppc_write_request_msrs(void *info)
+{
+    const struct amd_cppc_drv_data *data = info;
+
+    wrmsrl(MSR_AMD_CPPC_REQ, data->req.raw);
+}
+
+static void amd_cppc_write_request(unsigned int cpu, uint8_t min_perf,
+                                   uint8_t des_perf, uint8_t max_perf,
+                                   uint8_t epp)
+{
+    struct amd_cppc_drv_data *data = per_cpu(amd_cppc_drv_data, cpu);
+    uint64_t prev = data->req.raw;
+
+    data->req.min_perf = min_perf;
+    data->req.max_perf = max_perf;
+    data->req.des_perf = des_perf;
+    data->req.epp = epp;
+
+    if ( prev == data->req.raw )
+        return;
+
+    on_selected_cpus(cpumask_of(cpu), amd_cppc_write_request_msrs, data, 1);
+}
+
+static int cf_check amd_cppc_cpufreq_target(struct cpufreq_policy *policy,
+                                            unsigned int target_freq,
+                                            unsigned int relation)
+{
+    unsigned int cpu = policy->cpu;
+    const struct amd_cppc_drv_data *data = per_cpu(amd_cppc_drv_data, cpu);
+    uint8_t des_perf;
+    int res;
+
+    if ( unlikely(!target_freq) )
+        return 0;
+
+    res = amd_cppc_khz_to_perf(data, target_freq, &des_perf);
+    if ( res )
+        return res;
+
+    /*
+     * Having a performance level lower than the lowest nonlinear
+     * performance level, such as, lowest_perf <= perf <= lowest_nonliner_perf,
+     * may actually cause an efficiency penalty, So when deciding the min_perf
+     * value, we prefer lowest nonlinear performance over lowest performance.
+     */
+    amd_cppc_write_request(policy->cpu, data->caps.lowest_nonlinear_perf,
+                           des_perf, data->caps.highest_perf,
+                           /* Pre-defined BIOS value for passive mode */
+                           per_cpu(epp_init, policy->cpu));
+    return 0;
+}
+
+static void cf_check amd_cppc_init_msrs(void *info)
+{
+    struct cpufreq_policy *policy = info;
+    struct amd_cppc_drv_data *data = this_cpu(amd_cppc_drv_data);
+    uint64_t val;
+    unsigned int min_freq = 0, nominal_freq = 0, max_freq;
+
+    /* Package level MSR */
+    rdmsrl(MSR_AMD_CPPC_ENABLE, val);
+    /*
+     * Only when Enable bit is on, the hardware will calculate the processor’s
+     * performance capabilities and initialize the performance level fields in
+     * the CPPC capability registers.
+     */
+    if ( !(val & AMD_CPPC_ENABLE) )
+    {
+        val |= AMD_CPPC_ENABLE;
+        wrmsrl(MSR_AMD_CPPC_ENABLE, val);
+    }
+
+    rdmsrl(MSR_AMD_CPPC_CAP1, data->caps.raw);
+
+    if ( data->caps.highest_perf == 0 || data->caps.lowest_perf == 0 ||
+         data->caps.nominal_perf == 0 || data->caps.lowest_nonlinear_perf == 0 ||
+         data->caps.lowest_perf > data->caps.lowest_nonlinear_perf ||
+         data->caps.lowest_nonlinear_perf > data->caps.nominal_perf ||
+         data->caps.nominal_perf > data->caps.highest_perf )
+    {
+        amd_cppc_err(policy->cpu,
+                     "Out of range values: highest(%u), lowest(%u), nominal(%u), lowest_nonlinear(%u)\n",
+                     data->caps.highest_perf, data->caps.lowest_perf,
+                     data->caps.nominal_perf, data->caps.lowest_nonlinear_perf);
+        goto err;
+    }
+
+    amd_process_freq(&cpu_data[policy->cpu],
+                     NULL, NULL, &this_cpu(pxfreq_mhz));
+
+    data->err = amd_get_cpc_freq(data, data->cppc_data->cpc.lowest_mhz,
+                                 data->caps.lowest_perf, &min_freq);
+    if ( data->err )
+        return;
+
+    data->err = amd_get_cpc_freq(data, data->cppc_data->cpc.nominal_mhz,
+                                 data->caps.nominal_perf, &nominal_freq);
+    if ( data->err )
+        return;
+
+    data->err = amd_get_max_freq(data, &max_freq);
+    if ( data->err )
+        return;
+
+    if ( min_freq > nominal_freq || nominal_freq > max_freq )
+    {
+        amd_cppc_err(policy->cpu,
+                     "min(%u), or max(%u), or nominal(%u) freq value is incorrect\n",
+                     min_freq, max_freq, nominal_freq);
+        goto err;
+    }
+
+    policy->min = min_freq;
+    policy->max = max_freq;
+
+    policy->cpuinfo.min_freq = min_freq;
+    policy->cpuinfo.max_freq = max_freq;
+    policy->cpuinfo.perf_freq = nominal_freq;
+    /*
+     * Set after policy->cpuinfo.perf_freq, as we are taking
+     * APERF/MPERF average frequency as current frequency.
+     */
+    policy->cur = cpufreq_driver_getavg(policy->cpu, GOV_GETAVG);
+
+    /* Store pre-defined BIOS value for passive mode */
+    rdmsrl(MSR_AMD_CPPC_REQ, val);
+    this_cpu(epp_init) = MASK_EXTR(val, AMD_CPPC_EPP_MASK);
+
+    return;
+
+ err:
+    /*
+     * No fallback shceme is available here, see more explanation at call
+     * site in amd_cppc_cpufreq_cpu_init().
+     */
+    data->err = -EINVAL;
+}
+
+/*
+ * AMD CPPC driver is different than legacy ACPI hardware P-State,
+ * which has a finer grain frequency range between the highest and lowest
+ * frequency. And boost frequency is actually the frequency which is mapped on
+ * highest performance ratio. The legacy P0 frequency is actually mapped on
+ * nominal performance ratio.
+ */
+static void amd_cppc_boost_init(struct cpufreq_policy *policy,
+                                const struct amd_cppc_drv_data *data)
+{
+    if ( data->caps.highest_perf <= data->caps.nominal_perf )
+        return;
+
+    policy->turbo = CPUFREQ_TURBO_ENABLED;
+}
+
+static int cf_check amd_cppc_cpufreq_cpu_exit(struct cpufreq_policy *policy)
+{
+    XVFREE(per_cpu(amd_cppc_drv_data, policy->cpu));
+
+    return 0;
+}
+
+static int cf_check amd_cppc_cpufreq_cpu_init(struct cpufreq_policy *policy)
+{
+    unsigned int cpu = policy->cpu;
+    struct amd_cppc_drv_data *data;
+
+    data = xvzalloc(struct amd_cppc_drv_data);
+    if ( !data )
+        return -ENOMEM;
+
+    data->cppc_data = &processor_pminfo[cpu]->cppc_data;
+
+    per_cpu(amd_cppc_drv_data, cpu) = data;
+
+    on_selected_cpus(cpumask_of(cpu), amd_cppc_init_msrs, policy, 1);
+
+    /*
+     * The enable bit is sticky, as we need to enable it at the very first
+     * begining, before CPPC capability values sanity check.
+     * If error path is taken effective, not only amd-cppc cpufreq core fails
+     * to initialize, but also we could not fall back to legacy P-states
+     * driver, irrespective of the command line specifying a fallback option.
+     */
+    if ( data->err )
+    {
+        amd_cppc_err(cpu, "Could not initialize cpufreq core in CPPC mode\n");
+        amd_cppc_cpufreq_cpu_exit(policy);
+        return data->err;
+    }
+
+    policy->governor = cpufreq_opt_governor ? : CPUFREQ_DEFAULT_GOVERNOR;
+
+    amd_cppc_boost_init(policy, data);
+
+    amd_cppc_verbose(policy->cpu,
+                     "CPU initialized with amd-cppc passive mode\n");
+
+    return 0;
+}
+
+static const struct cpufreq_driver __initconst_cf_clobber
+amd_cppc_cpufreq_driver =
+{
+    .name   = XEN_AMD_CPPC_DRIVER_NAME,
+    .verify = amd_cppc_cpufreq_verify,
+    .target = amd_cppc_cpufreq_target,
+    .init   = amd_cppc_cpufreq_cpu_init,
+    .exit   = amd_cppc_cpufreq_cpu_exit,
+};
+
 int __init amd_cppc_register_driver(void)
 {
     if ( !cpu_has_cppc )
         return -ENODEV;
 
-    return -EOPNOTSUPP;
+    return cpufreq_register_driver(&amd_cppc_cpufreq_driver);
 }
diff --git a/xen/arch/x86/cpu/amd.c b/xen/arch/x86/cpu/amd.c
index 567b992a9f..9767f63539 100644
--- a/xen/arch/x86/cpu/amd.c
+++ b/xen/arch/x86/cpu/amd.c
@@ -613,10 +613,10 @@ static unsigned int attr_const amd_parse_freq(unsigned int family,
 	return freq;
 }
 
-static void amd_process_freq(const struct cpuinfo_x86 *c,
-			     unsigned int *low_mhz,
-			     unsigned int *nom_mhz,
-			     unsigned int *hi_mhz)
+void amd_process_freq(const struct cpuinfo_x86 *c,
+		      unsigned int *low_mhz,
+		      unsigned int *nom_mhz,
+		      unsigned int *hi_mhz)
 {
 	unsigned int idx = 0, h;
 	uint64_t hi, lo, val;
diff --git a/xen/arch/x86/include/asm/amd.h b/xen/arch/x86/include/asm/amd.h
index 9c9599a622..72df42a6f6 100644
--- a/xen/arch/x86/include/asm/amd.h
+++ b/xen/arch/x86/include/asm/amd.h
@@ -173,5 +173,7 @@ extern bool amd_virt_spec_ctrl;
 bool amd_setup_legacy_ssbd(void);
 void amd_set_legacy_ssbd(bool enable);
 void amd_set_cpuid_user_dis(bool enable);
+void amd_process_freq(const struct cpuinfo_x86 *c, unsigned int *low_mhz,
+                      unsigned int *nom_mhz, unsigned int *hi_mhz);
 
 #endif /* __AMD_H__ */
diff --git a/xen/arch/x86/include/asm/msr-index.h b/xen/arch/x86/include/asm/msr-index.h
index bb48d16f0c..df52587c85 100644
--- a/xen/arch/x86/include/asm/msr-index.h
+++ b/xen/arch/x86/include/asm/msr-index.h
@@ -252,6 +252,12 @@
 
 #define MSR_AMD_CSTATE_CFG                  0xc0010296U
 
+#define MSR_AMD_CPPC_CAP1                   0xc00102b0U
+#define MSR_AMD_CPPC_ENABLE                 0xc00102b1U
+#define  AMD_CPPC_ENABLE                    (_AC(1, ULL) << 0)
+#define MSR_AMD_CPPC_REQ                    0xc00102b3U
+#define  AMD_CPPC_EPP_MASK                  (_AC(0xff, ULL) << 24)
+
 /*
  * Legacy MSR constants in need of cleanup.  No new MSRs below this comment.
  */
diff --git a/xen/include/public/sysctl.h b/xen/include/public/sysctl.h
index aafa7fcf2b..aa29a5401c 100644
--- a/xen/include/public/sysctl.h
+++ b/xen/include/public/sysctl.h
@@ -453,6 +453,7 @@ struct xen_set_cppc_para {
     uint32_t activity_window;
 };
 
+#define XEN_AMD_CPPC_DRIVER_NAME "amd-cppc"
 #define XEN_HWP_DRIVER_NAME "hwp"
 
 /*
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Sep 25 10:44:54 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Sep 2025 10:44:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1130340.1469918 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1v1jT4-0004rC-1Z; Thu, 25 Sep 2025 10:44:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1130340.1469918; Thu, 25 Sep 2025 10: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 1v1jT3-0004r4-Ur; Thu, 25 Sep 2025 10:44:53 +0000
Received: by outflank-mailman (input) for mailman id 1130340;
 Thu, 25 Sep 2025 10:44: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 1v1jT3-0004qw-4M
 for xen-changelog@lists.xenproject.org; Thu, 25 Sep 2025 10:44: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 1v1jT3-009dXV-0K
 for xen-changelog@lists.xenproject.org;
 Thu, 25 Sep 2025 10:44:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1v1jT3-00E6Xb-0F
 for xen-changelog@lists.xenproject.org;
 Thu, 25 Sep 2025 10:44: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=W6x6mMAvW+4JGGGFG8BOiOKgu/tGlrigX+BTVVh/+zU=; b=0c0vB/lq+w65d/shtPlnlIUyob
	pGZKS/vfSKiNhx2Rf54xoSSkEjaGKJcrVi0ETzlD6crTwWQll9PNtLdGfvPfVPXXkfSJTgt49ApdR
	bugxK+qIhmp0rQohaTJajVujyLXD9wY4OveS1/Kad3I31eB4dBK0V/Apm2mNJsnnv80s=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/cpufreq: implement amd-cppc-epp driver for CPPC in active mode
Message-Id: <E1v1jT3-00E6Xb-0F@xenbits.xenproject.org>
Date: Thu, 25 Sep 2025 10:44:53 +0000

commit 94411808fbaaa8185993d9c29a2eb551e23cc148
Author:     Penny Zheng <Penny.Zheng@amd.com>
AuthorDate: Thu Sep 25 09:20:52 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Sep 25 09:20:52 2025 +0200

    xen/cpufreq: implement amd-cppc-epp driver for CPPC in active mode
    
    amd-cppc has 2 operation modes: autonomous (active) mode and
    non-autonomous (passive) mode.
    In active mode, we don't need Xen governor to calculate and tune the cpu
    frequency, while hardware built-in CPPC power algorithm will calculate the
    runtime workload and adjust cores frequency automatically according to the
    power supply, thermal, core voltage and some other hardware conditions.
    In active mode, CPPC ignores requests done in the desired performance field,
    and takes into account only the values set to the minimum performance, maximum
    performance, and energy performance preference registers.
    
    A new field EPP (energy performance preference), in CPPC request register, is
    introduced. It will be used in the CCLK DPM controller to drive the frequency
    that a core is going to operate during short periods of activity, called
    minimum active frequency, It could contatin a range of values from 0 to 0xff.
    An EPP of zero sets the min active frequency to maximum frequency, while
    an EPP of 0xff sets the min active frequency to approxiately Idle frequency.
    
    We implement a new AMD CPU frequency driver `amd-cppc-epp` for active mode.
    It requires `active` tag in Xen cmdline for users to explicitly select active
    mode.
    In driver `active-cppc-epp`, ->setpolicy() is hooked, not the ->target(), as
    it does not depend on xen governor to do performance tuning.
    
    We also introduce a new field "policy" (CPUFREQ_POLICY_xxx) to represent
    performance policy. Right now, it supports three values:
    CPUFREQ_POLICY_PERFORMANCE as maximum performance, CPUFREQ_POLICY_POWERSAVE
    as the least power consumption, and CPUFREQ_POLICY_ONDEMAND as no preference,
    just corresponding to "performance", "powersave" and "ondemand" Xen governor,
    which benefit users from re-using "governor" in Xen cmdline to deliver
    which performance policy they want to apply.
    
    Signed-off-by: Penny Zheng <Penny.Zheng@amd.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 docs/misc/xen-command-line.pandoc    |   9 ++-
 xen/arch/x86/acpi/cpufreq/amd-cppc.c | 135 +++++++++++++++++++++++++++++++++--
 xen/drivers/cpufreq/utility.c        |  15 ++++
 xen/include/acpi/cpufreq/cpufreq.h   |  18 +++++
 xen/include/public/sysctl.h          |   1 +
 5 files changed, 173 insertions(+), 5 deletions(-)

diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index 518e42d965..28a98321c7 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -515,7 +515,7 @@ If set, force use of the performance counters for oprofile, rather than detectin
 available support.
 
 ### cpufreq
-> `= none | {{ <boolean> | xen } { [:[powersave|performance|ondemand|userspace][,[<maxfreq>]][,[<minfreq>]]] } [,verbose]} | dom0-kernel | hwp[:[<hdc>][,verbose]] | amd-cppc[:[verbose]]`
+> `= none | {{ <boolean> | xen } { [:[powersave|performance|ondemand|userspace][,[<maxfreq>]][,[<minfreq>]]] } [,verbose]} | dom0-kernel | hwp[:[<hdc>][,verbose]] | amd-cppc[:[active][,verbose]]`
 
 > Default: `xen`
 
@@ -537,6 +537,13 @@ choice of `dom0-kernel` is deprecated and not supported by all Dom0 kernels.
 * `amd-cppc` selects ACPI Collaborative Performance and Power Control (CPPC)
   on supported AMD hardware to provide finer grained frequency control
   mechanism. The default is disabled.
+* `active` is a boolean to enable amd-cppc driver in active(autonomous) mode.
+  In this mode, users don't rely on Xen governor to do performance monitoring
+  and tuning. Hardware built-in CPPC power algorithm will calculate the runtime
+  workload and adjust cores frequency automatically according to the power
+  supply, thermal, core voltage and some other hardware conditions.
+  The default is disabled, and the option only applies when `amd-cppc` is
+  enabled.
 
 There is also support for `;`-separated fallback options:
 `cpufreq=hwp;xen,verbose`.  This first tries `hwp` and falls back to `xen` if
diff --git a/xen/arch/x86/acpi/cpufreq/amd-cppc.c b/xen/arch/x86/acpi/cpufreq/amd-cppc.c
index 5b99b86fb7..bb7f4e4a9e 100644
--- a/xen/arch/x86/acpi/cpufreq/amd-cppc.c
+++ b/xen/arch/x86/acpi/cpufreq/amd-cppc.c
@@ -67,9 +67,14 @@
  * max_perf.
  * Field des_perf conveys performance level Xen governor is requesting. And it
  * may be set to any performance value in the range [min_perf, max_perf],
- * inclusive.
+ * inclusive. In active mode, des_perf must be zero.
  * Field epp represents energy performance preference, which only has meaning
- * when active mode is enabled.
+ * when active mode is enabled. The EPP is used in the CCLK DPM controller
+ * to drive the frequency that a core is going to operate during short periods
+ * of activity, called minimum active frequency, It could contatin a range of
+ * values from 0 to 0xff. An EPP of zero sets the min active frequency to
+ * maximum frequency, while an EPP of 0xff sets the min active frequency to
+ * approxiately Idle frequency.
  */
 struct amd_cppc_drv_data
 {
@@ -106,6 +111,12 @@ static DEFINE_PER_CPU_READ_MOSTLY(struct amd_cppc_drv_data *,
  */
 static DEFINE_PER_CPU_READ_MOSTLY(unsigned int, pxfreq_mhz);
 static DEFINE_PER_CPU_READ_MOSTLY(uint8_t, epp_init);
+#ifndef NDEBUG
+static bool __ro_after_init opt_active_mode;
+#else
+static bool __initdata opt_active_mode;
+#endif
+
 
 static bool __init amd_cppc_handle_option(const char *s, const char *end)
 {
@@ -118,6 +129,13 @@ static bool __init amd_cppc_handle_option(const char *s, const char *end)
         return true;
     }
 
+    ret = parse_boolean("active", s, end);
+    if ( ret >= 0 )
+    {
+        opt_active_mode = ret;
+        return true;
+    }
+
     return false;
 }
 
@@ -270,6 +288,7 @@ static void amd_cppc_write_request(unsigned int cpu, uint8_t min_perf,
 
     data->req.min_perf = min_perf;
     data->req.max_perf = max_perf;
+    ASSERT(!opt_active_mode || !des_perf);
     data->req.des_perf = des_perf;
     data->req.epp = epp;
 
@@ -417,7 +436,7 @@ static int cf_check amd_cppc_cpufreq_cpu_exit(struct cpufreq_policy *policy)
     return 0;
 }
 
-static int cf_check amd_cppc_cpufreq_cpu_init(struct cpufreq_policy *policy)
+static int amd_cppc_cpufreq_init_perf(struct cpufreq_policy *policy)
 {
     unsigned int cpu = policy->cpu;
     struct amd_cppc_drv_data *data;
@@ -450,12 +469,103 @@ static int cf_check amd_cppc_cpufreq_cpu_init(struct cpufreq_policy *policy)
 
     amd_cppc_boost_init(policy, data);
 
+    return 0;
+}
+
+static int cf_check amd_cppc_cpufreq_cpu_init(struct cpufreq_policy *policy)
+{
+    int ret;
+
+    ret = amd_cppc_cpufreq_init_perf(policy);
+    if ( ret )
+        return ret;
+
     amd_cppc_verbose(policy->cpu,
                      "CPU initialized with amd-cppc passive mode\n");
 
     return 0;
 }
 
+static int cf_check amd_cppc_epp_cpu_init(struct cpufreq_policy *policy)
+{
+    int ret;
+
+    ret = amd_cppc_cpufreq_init_perf(policy);
+    if ( ret )
+        return ret;
+
+    policy->policy = cpufreq_policy_from_governor(policy->governor);
+
+    amd_cppc_verbose(policy->cpu,
+                     "CPU initialized with amd-cppc active mode\n");
+
+    return 0;
+}
+
+static void amd_cppc_prepare_policy(struct cpufreq_policy *policy,
+                                    uint8_t *max_perf, uint8_t *min_perf,
+                                    uint8_t *epp)
+{
+    const struct amd_cppc_drv_data *data = per_cpu(amd_cppc_drv_data,
+                                                   policy->cpu);
+
+    /*
+     * On default, set min_perf with lowest_nonlinear_perf, and max_perf
+     * with the highest, to ensure performance scaling in P-states range.
+     */
+    *max_perf = data->caps.highest_perf;
+    *min_perf = data->caps.lowest_nonlinear_perf;
+
+    /*
+     * In policy CPUFREQ_POLICY_PERFORMANCE, increase min_perf to
+     * highest_perf to achieve ultmost performance.
+     * In policy CPUFREQ_POLICY_POWERSAVE, decrease max_perf to
+     * lowest_nonlinear_perf to achieve ultmost power saving.
+     * Set governor only to help print proper policy info to users.
+     */
+    switch ( policy->policy )
+    {
+    case CPUFREQ_POLICY_PERFORMANCE:
+        /* Force the epp value to be zero for performance policy */
+        *epp = CPPC_ENERGY_PERF_MAX_PERFORMANCE;
+        *min_perf = *max_perf;
+        policy->governor = &cpufreq_gov_performance;
+        break;
+
+    case CPUFREQ_POLICY_POWERSAVE:
+        /* Force the epp value to be 0xff for powersave policy */
+        *epp = CPPC_ENERGY_PERF_MAX_POWERSAVE;
+        *max_perf = *min_perf;
+        policy->governor = &cpufreq_gov_powersave;
+        break;
+
+    case CPUFREQ_POLICY_ONDEMAND:
+        /*
+         * Set epp with medium value to show no preference over performance
+         * or powersave
+         */
+        *epp = CPPC_ENERGY_PERF_BALANCE;
+        policy->governor = &cpufreq_gov_dbs;
+        break;
+
+    default:
+        *epp = per_cpu(epp_init, policy->cpu);
+        break;
+    }
+}
+
+static int cf_check amd_cppc_epp_set_policy(struct cpufreq_policy *policy)
+{
+    uint8_t max_perf, min_perf, epp;
+
+    amd_cppc_prepare_policy(policy, &max_perf, &min_perf, &epp);
+
+    amd_cppc_write_request(policy->cpu, min_perf,
+                           0 /* no des_perf in active mode */,
+                           max_perf, epp);
+    return 0;
+}
+
 static const struct cpufreq_driver __initconst_cf_clobber
 amd_cppc_cpufreq_driver =
 {
@@ -466,10 +576,27 @@ amd_cppc_cpufreq_driver =
     .exit   = amd_cppc_cpufreq_cpu_exit,
 };
 
+static const struct cpufreq_driver __initconst_cf_clobber
+amd_cppc_epp_driver =
+{
+    .name       = XEN_AMD_CPPC_EPP_DRIVER_NAME,
+    .verify     = amd_cppc_cpufreq_verify,
+    .setpolicy  = amd_cppc_epp_set_policy,
+    .init       = amd_cppc_epp_cpu_init,
+    .exit       = amd_cppc_cpufreq_cpu_exit,
+};
+
 int __init amd_cppc_register_driver(void)
 {
+    int ret;
+
     if ( !cpu_has_cppc )
         return -ENODEV;
 
-    return cpufreq_register_driver(&amd_cppc_cpufreq_driver);
+    if ( opt_active_mode )
+        ret = cpufreq_register_driver(&amd_cppc_epp_driver);
+    else
+        ret = cpufreq_register_driver(&amd_cppc_cpufreq_driver);
+
+    return ret;
 }
diff --git a/xen/drivers/cpufreq/utility.c b/xen/drivers/cpufreq/utility.c
index 987c3b5929..e2cc9ff2af 100644
--- a/xen/drivers/cpufreq/utility.c
+++ b/xen/drivers/cpufreq/utility.c
@@ -250,6 +250,7 @@ int __cpufreq_set_policy(struct cpufreq_policy *data,
     data->min = policy->min;
     data->max = policy->max;
     data->limits = policy->limits;
+    data->policy = policy->policy;
     if (cpufreq_driver.setpolicy)
         return alternative_call(cpufreq_driver.setpolicy, data);
 
@@ -281,3 +282,17 @@ int __cpufreq_set_policy(struct cpufreq_policy *data,
 
     return __cpufreq_governor(data, CPUFREQ_GOV_LIMITS);
 }
+
+unsigned int cpufreq_policy_from_governor(const struct cpufreq_governor *gov)
+{
+    if ( !strncmp(gov->name, "performance", CPUFREQ_NAME_LEN) )
+        return CPUFREQ_POLICY_PERFORMANCE;
+
+    if ( !strncmp(gov->name, "powersave", CPUFREQ_NAME_LEN) )
+        return CPUFREQ_POLICY_POWERSAVE;
+
+    if ( !strncmp(gov->name, "ondemand", CPUFREQ_NAME_LEN) )
+        return CPUFREQ_POLICY_ONDEMAND;
+
+    return CPUFREQ_POLICY_UNKNOWN;
+}
diff --git a/xen/include/acpi/cpufreq/cpufreq.h b/xen/include/acpi/cpufreq/cpufreq.h
index 5d4881eea8..9ef7c4683a 100644
--- a/xen/include/acpi/cpufreq/cpufreq.h
+++ b/xen/include/acpi/cpufreq/cpufreq.h
@@ -81,6 +81,7 @@ struct cpufreq_policy {
     int8_t              turbo;  /* tristate flag: 0 for unsupported
                                  * -1 for disable, 1 for enabled
                                  * See CPUFREQ_TURBO_* below for defines */
+    unsigned int        policy; /* CPUFREQ_POLICY_* */
 };
 DECLARE_PER_CPU(struct cpufreq_policy *, cpufreq_cpu_policy);
 
@@ -131,6 +132,23 @@ extern int cpufreq_register_governor(struct cpufreq_governor *governor);
 extern struct cpufreq_governor *__find_governor(const char *governor);
 #define CPUFREQ_DEFAULT_GOVERNOR &cpufreq_gov_dbs
 
+/*
+ * Performance Policy
+ * If cpufreq_driver->target() exists, the ->governor decides what frequency
+ * within the limits is used. If cpufreq_driver->setpolicy() exists, these
+ * following policies are available:
+ * CPUFREQ_POLICY_PERFORMANCE represents maximum performance
+ * CPUFREQ_POLICY_POWERSAVE represents least power consumption
+ * CPUFREQ_POLICY_ONDEMAND represents no preference over performance or
+ * powersave
+ */
+#define CPUFREQ_POLICY_UNKNOWN      0
+#define CPUFREQ_POLICY_POWERSAVE    1
+#define CPUFREQ_POLICY_PERFORMANCE  2
+#define CPUFREQ_POLICY_ONDEMAND     3
+
+unsigned int cpufreq_policy_from_governor(const struct cpufreq_governor *gov);
+
 /* pass a target to the cpufreq driver */
 extern int __cpufreq_driver_target(struct cpufreq_policy *policy,
                                    unsigned int target_freq,
diff --git a/xen/include/public/sysctl.h b/xen/include/public/sysctl.h
index aa29a5401c..eb3a23b038 100644
--- a/xen/include/public/sysctl.h
+++ b/xen/include/public/sysctl.h
@@ -454,6 +454,7 @@ struct xen_set_cppc_para {
 };
 
 #define XEN_AMD_CPPC_DRIVER_NAME "amd-cppc"
+#define XEN_AMD_CPPC_EPP_DRIVER_NAME "amd-cppc-epp"
 #define XEN_HWP_DRIVER_NAME "hwp"
 
 /*
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Sep 25 10:45:04 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Sep 2025 10:45:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1130341.1469922 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1v1jTE-0004tT-3J; Thu, 25 Sep 2025 10:45:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1130341.1469922; Thu, 25 Sep 2025 10: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 1v1jTE-0004tJ-08; Thu, 25 Sep 2025 10:45:04 +0000
Received: by outflank-mailman (input) for mailman id 1130341;
 Thu, 25 Sep 2025 10:45: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 1v1jTD-0004tB-6n
 for xen-changelog@lists.xenproject.org; Thu, 25 Sep 2025 10:45: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 1v1jTD-009dY1-0a
 for xen-changelog@lists.xenproject.org;
 Thu, 25 Sep 2025 10:45:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1v1jTD-00E6Yp-0V
 for xen-changelog@lists.xenproject.org;
 Thu, 25 Sep 2025 10:45: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=2Hxki/HaduC9s3H+Ms+H231y0OB6u686FZNSCfS4y94=; b=IJykgY0OjxTQpB8v8hAi1jUseJ
	zpxQo65rc9JEJhUZVw3YGttD/ingGD2O2QpO0lsOVdGlE+5HpoXmqzO922C+kkBPii2ZgrrFIvaVd
	VwZRk3jqJRj5KYPNKzuEiaY/egFzAZTj/apiUodPYrs3/7PrMBo9Hjm3Goumdk6bTKlQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/cpufreq: get performance policy from governor set via xenpm
Message-Id: <E1v1jTD-00E6Yp-0V@xenbits.xenproject.org>
Date: Thu, 25 Sep 2025 10:45:03 +0000

commit 983a15a36ec5aee89770f50316a4f6dcdcf245f6
Author:     Penny Zheng <Penny.Zheng@amd.com>
AuthorDate: Thu Sep 25 09:21:07 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Sep 25 09:21:07 2025 +0200

    xen/cpufreq: get performance policy from governor set via xenpm
    
    Even if Xen governor is not used in amd-cppc active mode, we could
    somehow deduce which performance policy (CPUFREQ_POLICY_xxx) user wants to
    apply through which governor they choose, such as:
    If user chooses performance governor, they want maximum performance, then
    the policy shall be CPUFREQ_POLICY_PERFORMANCE
    If user chooses powersave governor, they want the least power consumption,
    then the policy shall be CPUFREQ_POLICY_POWERSAVE
    Function cpufreq_policy_from_governor() is responsible for above transition,
    and it shall be also effective when users setting new governor through xenpm.
    
    Userspace is a forbidden choice, and if users specify such option, we shall
    not only give warning message to suggest using "xenpm set-cpufreq-cppc", but
    also error out.
    
    Signed-off-by: Penny Zheng <Penny.Zheng@amd.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/drivers/acpi/pm-op.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/xen/drivers/acpi/pm-op.c b/xen/drivers/acpi/pm-op.c
index 2f516e62b1..a7eaf29c31 100644
--- a/xen/drivers/acpi/pm-op.c
+++ b/xen/drivers/acpi/pm-op.c
@@ -207,6 +207,17 @@ static int set_cpufreq_gov(struct xen_sysctl_pm_op *op)
     if ( new_policy.governor == NULL )
         return -EINVAL;
 
+    if ( processor_pminfo[op->cpuid]->init & XEN_CPPC_INIT )
+    {
+        new_policy.policy = cpufreq_policy_from_governor(new_policy.governor);
+        if ( new_policy.policy == CPUFREQ_POLICY_UNKNOWN )
+        {
+            printk("Failed to get performance policy from %s, Try \"xenpm set-cpufreq-cppc\"\n",
+                   new_policy.governor->name);
+            return -EINVAL;
+        }
+    }
+
     return __cpufreq_set_policy(old_policy, &new_policy);
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Sep 25 10:45:14 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Sep 2025 10:45:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1130342.1469924 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1v1jTO-0004vh-43; Thu, 25 Sep 2025 10:45:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1130342.1469924; Thu, 25 Sep 2025 10: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 1v1jTO-0004vZ-1Z; Thu, 25 Sep 2025 10:45:14 +0000
Received: by outflank-mailman (input) for mailman id 1130342;
 Thu, 25 Sep 2025 10:45: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 1v1jTN-0004vP-A9
 for xen-changelog@lists.xenproject.org; Thu, 25 Sep 2025 10:45: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 1v1jTN-009dYP-0u
 for xen-changelog@lists.xenproject.org;
 Thu, 25 Sep 2025 10:45:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1v1jTN-00E6Zs-0p
 for xen-changelog@lists.xenproject.org;
 Thu, 25 Sep 2025 10:45: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=4qZifyW4Yfnz9t5RzjR8YgbTkDP2lETLWO0WPFykq58=; b=jnqf+pHkKoqkHzKSkvpmQoVLdG
	nOpbsdIukhLy6Tk/Xx0w4t+isXw7OwfPbhSDCZp0xxCtgLiFiYOGq3cFGqoVBxKbVzDbmAHLNaGWD
	TDsLKOdN/3Y28/SnSnFOtATRxBb4nJTH6EleFfQP/ix8yHj649lmGcWTOmVEWjw1Oj9s=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/cpufreq: extract CPPC para from cpufreq para
Message-Id: <E1v1jTN-00E6Zs-0p@xenbits.xenproject.org>
Date: Thu, 25 Sep 2025 10:45:13 +0000

commit e3305043b2bd065abf5814df3a5de0e12e976493
Author:     Penny Zheng <Penny.Zheng@amd.com>
AuthorDate: Thu Sep 25 09:21:24 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Sep 25 09:21:24 2025 +0200

    tools/cpufreq: extract CPPC para from cpufreq para
    
    We extract cppc info from "struct xen_get_cpufreq_para", where it acts as
    a member of union, and share the space with governor info.
    However, it may fail in amd-cppc passive mode, in which governor info and
    CPPC info could co-exist, and both need to be printed together via xenpm tool.
    If we tried to still put it in "struct xen_get_cpufreq_para" (e.g. just move
    out of union), "struct xen_get_cpufreq_para" will enlarge too much to further
    make xen_sysctl.u exceed 128 bytes.
    
    So we introduce a new sub-field GET_CPUFREQ_CPPC to dedicatedly acquire
    CPPC-related para, and make get-cpufreq-para invoke GET_CPUFREQ_CPPC
    if available.
    New helpers print_cppc_para() and get_cpufreq_cppc() are introduced to
    extract CPPC-related parameters process from cpufreq para.
    
    Signed-off-by: Penny Zheng <Penny.Zheng@amd.com>
    Acked-by: Jan Beulich <jbeulich@suse.com> # hypervisor
    Acked-by: Anthony PERARD <anthony.perard@vates.tech>
---
 tools/include/xenctrl.h     |  27 ++++++------
 tools/libs/ctrl/xc_pm.c     |  47 ++++++++++++++------
 tools/misc/xenpm.c          | 103 +++++++++++++++++++++++++++-----------------
 xen/drivers/acpi/pm-op.c    |  43 +++++++++++-------
 xen/include/public/sysctl.h |  31 +++++++------
 5 files changed, 155 insertions(+), 96 deletions(-)

diff --git a/tools/include/xenctrl.h b/tools/include/xenctrl.h
index 965d3b585a..c14ecd66aa 100644
--- a/tools/include/xenctrl.h
+++ b/tools/include/xenctrl.h
@@ -1924,22 +1924,19 @@ struct xc_get_cpufreq_para {
     uint32_t cpuinfo_cur_freq;
     uint32_t cpuinfo_max_freq;
     uint32_t cpuinfo_min_freq;
-    union {
-        struct {
-            uint32_t scaling_cur_freq;
+    struct {
+        uint32_t scaling_cur_freq;
 
-            char scaling_governor[CPUFREQ_NAME_LEN];
-            uint32_t scaling_max_freq;
-            uint32_t scaling_min_freq;
+        char scaling_governor[CPUFREQ_NAME_LEN];
+        uint32_t scaling_max_freq;
+        uint32_t scaling_min_freq;
 
-            /* for specific governor */
-            union {
-                xc_userspace_t userspace;
-                xc_ondemand_t ondemand;
-            } u;
-        } s;
-        xc_cppc_para_t cppc_para;
-    } u;
+        /* for specific governor */
+        union {
+            xc_userspace_t userspace;
+            xc_ondemand_t ondemand;
+        } u;
+    } s;
 
     int32_t turbo_enabled;
 };
@@ -1953,6 +1950,8 @@ int xc_set_cpufreq_para(xc_interface *xch, int cpuid,
                         int ctrl_type, int ctrl_value);
 int xc_set_cpufreq_cppc(xc_interface *xch, int cpuid,
                         xc_set_cppc_para_t *set_cppc);
+int xc_get_cppc_para(xc_interface *xch, unsigned int cpuid,
+                     xc_cppc_para_t *cppc_para);
 int xc_get_cpufreq_avgfreq(xc_interface *xch, int cpuid, int *avg_freq);
 
 int xc_set_sched_opt_smt(xc_interface *xch, uint32_t value);
diff --git a/tools/libs/ctrl/xc_pm.c b/tools/libs/ctrl/xc_pm.c
index 6fda973f1f..5b4e489acf 100644
--- a/tools/libs/ctrl/xc_pm.c
+++ b/tools/libs/ctrl/xc_pm.c
@@ -274,25 +274,24 @@ int xc_get_cpufreq_para(xc_interface *xch, int cpuid,
         /*
          * Copy to user_para no matter what cpufreq driver/governor.
          *
-         * First sanity check layout of the union subject to memcpy() below.
+         * First sanity check layout of the struct subject to memcpy() below.
          */
-        BUILD_BUG_ON(sizeof(user_para->u) != sizeof(sys_para->u));
+        BUILD_BUG_ON(sizeof(user_para->s) != sizeof(sys_para->s));
 
 #define CHK_FIELD(fld) \
-        BUILD_BUG_ON(offsetof(typeof(user_para->u), fld) != \
-                     offsetof(typeof(sys_para->u),  fld))
+        BUILD_BUG_ON(offsetof(typeof(user_para->s), fld) != \
+                     offsetof(typeof(sys_para->s),  fld))
 
-        CHK_FIELD(s.scaling_cur_freq);
-        CHK_FIELD(s.scaling_governor);
-        CHK_FIELD(s.scaling_max_freq);
-        CHK_FIELD(s.scaling_min_freq);
-        CHK_FIELD(s.u.userspace);
-        CHK_FIELD(s.u.ondemand);
-        CHK_FIELD(cppc_para);
+        CHK_FIELD(scaling_cur_freq);
+        CHK_FIELD(scaling_governor);
+        CHK_FIELD(scaling_max_freq);
+        CHK_FIELD(scaling_min_freq);
+        CHK_FIELD(u.userspace);
+        CHK_FIELD(u.ondemand);
 
 #undef CHK_FIELD
 
-        memcpy(&user_para->u, &sys_para->u, sizeof(sys_para->u));
+        memcpy(&user_para->s, &sys_para->s, sizeof(sys_para->s));
     }
 
 unlock_4:
@@ -366,6 +365,30 @@ int xc_set_cpufreq_cppc(xc_interface *xch, int cpuid,
     return ret;
 }
 
+int xc_get_cppc_para(xc_interface *xch, unsigned int cpuid,
+                     xc_cppc_para_t *cppc_para)
+{
+    int ret;
+    struct xen_sysctl sysctl = {};
+
+    if ( !xch  || !cppc_para )
+    {
+        errno = EINVAL;
+        return -1;
+    }
+
+    sysctl.cmd = XEN_SYSCTL_pm_op;
+    sysctl.u.pm_op.cmd = GET_CPUFREQ_CPPC;
+    sysctl.u.pm_op.cpuid = cpuid;
+
+    ret = xc_sysctl(xch, &sysctl);
+    if ( ret )
+        return ret;
+
+    *cppc_para = sysctl.u.pm_op.u.get_cppc;
+    return ret;
+}
+
 int xc_get_cpufreq_avgfreq(xc_interface *xch, int cpuid, int *avg_freq)
 {
     int ret = 0;
diff --git a/tools/misc/xenpm.c b/tools/misc/xenpm.c
index 6b054b10a4..c7f19cea28 100644
--- a/tools/misc/xenpm.c
+++ b/tools/misc/xenpm.c
@@ -801,6 +801,34 @@ static unsigned int calculate_activity_window(const xc_cppc_para_t *cppc,
     return mantissa * multiplier;
 }
 
+/* print out parameters about cpu cppc */
+static void print_cppc_para(unsigned int cpuid,
+                            const xc_cppc_para_t *cppc)
+{
+    printf("cppc variables       :\n");
+    printf("  hardware limits    : lowest [%"PRIu32"] lowest nonlinear [%"PRIu32"]\n",
+           cppc->lowest, cppc->lowest_nonlinear);
+    printf("                     : nominal [%"PRIu32"] highest [%"PRIu32"]\n",
+           cppc->nominal, cppc->highest);
+    printf("  configured limits  : min [%"PRIu32"] max [%"PRIu32"] energy perf [%"PRIu32"]\n",
+           cppc->minimum, cppc->maximum, cppc->energy_perf);
+
+    if ( cppc->features & XEN_SYSCTL_CPPC_FEAT_ACT_WINDOW )
+    {
+        unsigned int activity_window;
+        const char *units;
+
+        activity_window = calculate_activity_window(cppc, &units);
+        printf("                     : activity_window [%"PRIu32" %s]\n",
+               activity_window, units);
+    }
+
+    printf("                     : desired [%"PRIu32"%s]\n",
+           cppc->desired,
+           cppc->desired ? "" : " hw autonomous");
+    printf("\n");
+}
+
 /* print out parameters about cpu frequency */
 static void print_cpufreq_para(int cpuid, struct xc_get_cpufreq_para *p_cpufreq)
 {
@@ -826,71 +854,45 @@ static void print_cpufreq_para(int cpuid, struct xc_get_cpufreq_para *p_cpufreq)
 
     printf("scaling_driver       : %s\n", p_cpufreq->scaling_driver);
 
-    if ( hwp )
-    {
-        const xc_cppc_para_t *cppc = &p_cpufreq->u.cppc_para;
-
-        printf("cppc variables       :\n");
-        printf("  hardware limits    : lowest [%"PRIu32"] lowest nonlinear [%"PRIu32"]\n",
-               cppc->lowest, cppc->lowest_nonlinear);
-        printf("                     : nominal [%"PRIu32"] highest [%"PRIu32"]\n",
-               cppc->nominal, cppc->highest);
-        printf("  configured limits  : min [%"PRIu32"] max [%"PRIu32"] energy perf [%"PRIu32"]\n",
-               cppc->minimum, cppc->maximum, cppc->energy_perf);
-
-        if ( cppc->features & XEN_SYSCTL_CPPC_FEAT_ACT_WINDOW )
-        {
-            unsigned int activity_window;
-            const char *units;
-
-            activity_window = calculate_activity_window(cppc, &units);
-            printf("                     : activity_window [%"PRIu32" %s]\n",
-                   activity_window, units);
-        }
-
-        printf("                     : desired [%"PRIu32"%s]\n",
-               cppc->desired,
-               cppc->desired ? "" : " hw autonomous");
-    }
-    else
+    if ( !hwp )
     {
         if ( p_cpufreq->gov_num )
             printf("scaling_avail_gov    : %s\n",
                    p_cpufreq->scaling_available_governors);
 
-        printf("current_governor     : %s\n", p_cpufreq->u.s.scaling_governor);
-        if ( !strncmp(p_cpufreq->u.s.scaling_governor,
+        printf("current_governor     : %s\n", p_cpufreq->s.scaling_governor);
+        if ( !strncmp(p_cpufreq->s.scaling_governor,
                       "userspace", CPUFREQ_NAME_LEN) )
         {
             printf("  userspace specific :\n");
             printf("    scaling_setspeed : %u\n",
-                   p_cpufreq->u.s.u.userspace.scaling_setspeed);
+                   p_cpufreq->s.u.userspace.scaling_setspeed);
         }
-        else if ( !strncmp(p_cpufreq->u.s.scaling_governor,
+        else if ( !strncmp(p_cpufreq->s.scaling_governor,
                            "ondemand", CPUFREQ_NAME_LEN) )
         {
             printf("  ondemand specific  :\n");
             printf("    sampling_rate    : max [%u] min [%u] cur [%u]\n",
-                   p_cpufreq->u.s.u.ondemand.sampling_rate_max,
-                   p_cpufreq->u.s.u.ondemand.sampling_rate_min,
-                   p_cpufreq->u.s.u.ondemand.sampling_rate);
+                   p_cpufreq->s.u.ondemand.sampling_rate_max,
+                   p_cpufreq->s.u.ondemand.sampling_rate_min,
+                   p_cpufreq->s.u.ondemand.sampling_rate);
             printf("    up_threshold     : %u\n",
-                   p_cpufreq->u.s.u.ondemand.up_threshold);
+                   p_cpufreq->s.u.ondemand.up_threshold);
         }
 
         printf("scaling_avail_freq   :");
         for ( i = 0; i < p_cpufreq->freq_num; i++ )
             if ( p_cpufreq->scaling_available_frequencies[i] ==
-                 p_cpufreq->u.s.scaling_cur_freq )
+                 p_cpufreq->s.scaling_cur_freq )
                 printf(" *%d", p_cpufreq->scaling_available_frequencies[i]);
             else
                 printf(" %d", p_cpufreq->scaling_available_frequencies[i]);
         printf("\n");
 
         printf("scaling frequency    : max [%u] min [%u] cur [%u]\n",
-               p_cpufreq->u.s.scaling_max_freq,
-               p_cpufreq->u.s.scaling_min_freq,
-               p_cpufreq->u.s.scaling_cur_freq);
+               p_cpufreq->s.scaling_max_freq,
+               p_cpufreq->s.scaling_min_freq,
+               p_cpufreq->s.scaling_cur_freq);
     }
 
     printf("turbo mode           : %s\n",
@@ -898,6 +900,24 @@ static void print_cpufreq_para(int cpuid, struct xc_get_cpufreq_para *p_cpufreq)
     printf("\n");
 }
 
+/* show cpu cppc parameters information on CPU cpuid */
+static int show_cppc_para_by_cpuid(xc_interface *xc_handle, unsigned int cpuid)
+{
+    int ret;
+    xc_cppc_para_t cppc_para;
+
+    ret = xc_get_cppc_para(xc_handle, cpuid, &cppc_para);
+    if ( !ret )
+        print_cppc_para(cpuid, &cppc_para);
+    else if ( errno == ENODEV )
+        ret = 0; /* Ignore unsupported platform */
+    else
+        fprintf(stderr, "[CPU%u] failed to get cppc parameter: %s\n",
+                cpuid, strerror(errno));
+
+    return ret;
+}
+
 /* show cpu frequency parameters information on CPU cpuid */
 static int show_cpufreq_para_by_cpuid(xc_interface *xc_handle, int cpuid)
 {
@@ -957,7 +977,12 @@ static int show_cpufreq_para_by_cpuid(xc_interface *xc_handle, int cpuid)
     } while ( ret && errno == EAGAIN );
 
     if ( ret == 0 )
+    {
         print_cpufreq_para(cpuid, p_cpufreq);
+
+        /* Show CPPC parameters if available */
+        ret = show_cppc_para_by_cpuid(xc_handle, cpuid);
+    }
     else if ( errno == ENODEV )
     {
         ret = -ENODEV;
diff --git a/xen/drivers/acpi/pm-op.c b/xen/drivers/acpi/pm-op.c
index a7eaf29c31..f50acd7088 100644
--- a/xen/drivers/acpi/pm-op.c
+++ b/xen/drivers/acpi/pm-op.c
@@ -77,6 +77,17 @@ static int read_scaling_available_governors(char *scaling_available_governors,
     return 0;
 }
 
+static int get_cpufreq_cppc(unsigned int cpu,
+                            struct xen_get_cppc_para *cppc_para)
+{
+    int ret = -ENODEV;
+
+    if ( hwp_active() )
+        ret = get_hwp_para(cpu, cppc_para);
+
+    return ret;
+}
+
 static int get_cpufreq_para(struct xen_sysctl_pm_op *op)
 {
     uint32_t ret = 0;
@@ -143,9 +154,7 @@ static int get_cpufreq_para(struct xen_sysctl_pm_op *op)
     else
         strlcpy(op->u.get_para.scaling_driver, "Unknown", CPUFREQ_NAME_LEN);
 
-    if ( hwp_active() )
-        ret = get_hwp_para(policy->cpu, &op->u.get_para.u.cppc_para);
-    else
+    if ( !hwp_active() )
     {
         if ( !(scaling_available_governors =
                xzalloc_array(char, gov_num * CPUFREQ_NAME_LEN)) )
@@ -165,29 +174,29 @@ static int get_cpufreq_para(struct xen_sysctl_pm_op *op)
         if ( ret )
             return -EFAULT;
 
-        op->u.get_para.u.s.scaling_cur_freq = policy->cur;
-        op->u.get_para.u.s.scaling_max_freq = policy->max;
-        op->u.get_para.u.s.scaling_min_freq = policy->min;
+        op->u.get_para.s.scaling_cur_freq = policy->cur;
+        op->u.get_para.s.scaling_max_freq = policy->max;
+        op->u.get_para.s.scaling_min_freq = policy->min;
 
         if ( policy->governor->name[0] )
-            strlcpy(op->u.get_para.u.s.scaling_governor,
+            strlcpy(op->u.get_para.s.scaling_governor,
                     policy->governor->name, CPUFREQ_NAME_LEN);
         else
-            strlcpy(op->u.get_para.u.s.scaling_governor, "Unknown",
+            strlcpy(op->u.get_para.s.scaling_governor, "Unknown",
                     CPUFREQ_NAME_LEN);
 
         /* governor specific para */
-        if ( !strncasecmp(op->u.get_para.u.s.scaling_governor,
+        if ( !strncasecmp(op->u.get_para.s.scaling_governor,
                           "userspace", CPUFREQ_NAME_LEN) )
-            op->u.get_para.u.s.u.userspace.scaling_setspeed = policy->cur;
+            op->u.get_para.s.u.userspace.scaling_setspeed = policy->cur;
 
-        if ( !strncasecmp(op->u.get_para.u.s.scaling_governor,
+        if ( !strncasecmp(op->u.get_para.s.scaling_governor,
                           "ondemand", CPUFREQ_NAME_LEN) )
             ret = get_cpufreq_ondemand_para(
-                &op->u.get_para.u.s.u.ondemand.sampling_rate_max,
-                &op->u.get_para.u.s.u.ondemand.sampling_rate_min,
-                &op->u.get_para.u.s.u.ondemand.sampling_rate,
-                &op->u.get_para.u.s.u.ondemand.up_threshold);
+                &op->u.get_para.s.u.ondemand.sampling_rate_max,
+                &op->u.get_para.s.u.ondemand.sampling_rate_min,
+                &op->u.get_para.s.u.ondemand.sampling_rate,
+                &op->u.get_para.s.u.ondemand.up_threshold);
     }
 
     return ret;
@@ -385,6 +394,10 @@ int do_pm_op(struct xen_sysctl_pm_op *op)
         ret = set_cpufreq_para(op);
         break;
 
+    case GET_CPUFREQ_CPPC:
+        ret = get_cpufreq_cppc(op->cpuid, &op->u.get_cppc);
+        break;
+
     case SET_CPUFREQ_CPPC:
         ret = set_cpufreq_cppc(op);
         break;
diff --git a/xen/include/public/sysctl.h b/xen/include/public/sysctl.h
index eb3a23b038..66c9b65465 100644
--- a/xen/include/public/sysctl.h
+++ b/xen/include/public/sysctl.h
@@ -478,22 +478,19 @@ struct xen_get_cpufreq_para {
     uint32_t cpuinfo_cur_freq;
     uint32_t cpuinfo_max_freq;
     uint32_t cpuinfo_min_freq;
-    union {
-        struct {
-            uint32_t scaling_cur_freq;
-
-            char scaling_governor[CPUFREQ_NAME_LEN];
-            uint32_t scaling_max_freq;
-            uint32_t scaling_min_freq;
-
-            /* for specific governor */
-            union {
-                struct  xen_userspace userspace;
-                struct  xen_ondemand ondemand;
-            } u;
-        } s;
-        struct xen_get_cppc_para cppc_para;
-    } u;
+    struct {
+        uint32_t scaling_cur_freq;
+
+        char scaling_governor[CPUFREQ_NAME_LEN];
+        uint32_t scaling_max_freq;
+        uint32_t scaling_min_freq;
+
+        /* for specific governor */
+        union {
+            struct  xen_userspace userspace;
+            struct  xen_ondemand ondemand;
+        } u;
+    } s;
 
     int32_t turbo_enabled;
 };
@@ -523,6 +520,7 @@ struct xen_sysctl_pm_op {
     #define SET_CPUFREQ_PARA           (CPUFREQ_PARA | 0x03)
     #define GET_CPUFREQ_AVGFREQ        (CPUFREQ_PARA | 0x04)
     #define SET_CPUFREQ_CPPC           (CPUFREQ_PARA | 0x05)
+    #define GET_CPUFREQ_CPPC           (CPUFREQ_PARA | 0x06)
 
     /* set/reset scheduler power saving option */
     #define XEN_SYSCTL_pm_op_set_sched_opt_smt    0x21
@@ -547,6 +545,7 @@ struct xen_sysctl_pm_op {
     uint32_t cpuid;
     union {
         struct xen_get_cpufreq_para get_para;
+        struct xen_get_cppc_para    get_cppc;
         struct xen_set_cpufreq_gov  set_gov;
         struct xen_set_cpufreq_para set_para;
         struct xen_set_cppc_para    set_cppc;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Sep 25 10:45:24 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Sep 2025 10:45:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1130343.1469929 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1v1jTY-0004yW-75; Thu, 25 Sep 2025 10:45:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1130343.1469929; Thu, 25 Sep 2025 10: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 1v1jTY-0004yD-4M; Thu, 25 Sep 2025 10:45:24 +0000
Received: by outflank-mailman (input) for mailman id 1130343;
 Thu, 25 Sep 2025 10:45: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 1v1jTX-0004y2-DD
 for xen-changelog@lists.xenproject.org; Thu, 25 Sep 2025 10:45: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 1v1jTX-009dYT-1D
 for xen-changelog@lists.xenproject.org;
 Thu, 25 Sep 2025 10:45:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1v1jTX-00E6ab-17
 for xen-changelog@lists.xenproject.org;
 Thu, 25 Sep 2025 10:45: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=HCUGLM4ZtSEDtZo7df4xZ8rr8jl6aKojwS9qzPTJM3I=; b=xyfguKFl35LH3WmGoqL7/1mMbG
	Y6+6boGO4IfNwBwCduT61ChYxGHfot6DeHzK0OcOp2dJlEh3TuVsUJik5jwPX15wbtt+1HgeMPbT8
	p29was3zo50yX/rhOJttn8Fx/Y/HkZq7rzbqvtOZlaucrAoz0dVjjS+gcFu51++haur4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/cpufreq: bypass governor-related para for amd-cppc-epp
Message-Id: <E1v1jTX-00E6ab-17@xenbits.xenproject.org>
Date: Thu, 25 Sep 2025 10:45:23 +0000

commit 494de59f045fea01956cd252ef35a9c25037cabf
Author:     Penny Zheng <Penny.Zheng@amd.com>
AuthorDate: Thu Sep 25 09:21:41 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Sep 25 10:21:31 2025 +0200

    xen/cpufreq: bypass governor-related para for amd-cppc-epp
    
    HWP and amd-cppc-epp are both governor-less driver, so we introduce
    "is_governor_less" flag and cpufreq_is_governorless() to help bypass
    governor-related info on dealing with cpufreq para.
    
    Signed-off-by: Penny Zheng <Penny.Zheng@amd.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Anthony PERARD <anthony.perard@vates.tech>
---
 tools/misc/xenpm.c                 | 10 +++++++---
 xen/drivers/acpi/pm-op.c           |  4 ++--
 xen/include/acpi/cpufreq/cpufreq.h | 12 ++++++++++++
 3 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/tools/misc/xenpm.c b/tools/misc/xenpm.c
index c7f19cea28..682d092479 100644
--- a/tools/misc/xenpm.c
+++ b/tools/misc/xenpm.c
@@ -832,9 +832,13 @@ static void print_cppc_para(unsigned int cpuid,
 /* print out parameters about cpu frequency */
 static void print_cpufreq_para(int cpuid, struct xc_get_cpufreq_para *p_cpufreq)
 {
-    bool hwp = strcmp(p_cpufreq->scaling_driver, XEN_HWP_DRIVER_NAME) == 0;
+    bool is_governor_less = false;
     int i;
 
+    if ( !strcmp(p_cpufreq->scaling_driver, XEN_HWP_DRIVER_NAME) ||
+         !strcmp(p_cpufreq->scaling_driver, XEN_AMD_CPPC_EPP_DRIVER_NAME) )
+        is_governor_less = true;
+
     printf("cpu id               : %d\n", cpuid);
 
     printf("affected_cpus        :");
@@ -842,7 +846,7 @@ static void print_cpufreq_para(int cpuid, struct xc_get_cpufreq_para *p_cpufreq)
         printf(" %d", p_cpufreq->affected_cpus[i]);
     printf("\n");
 
-    if ( hwp )
+    if ( is_governor_less )
         printf("cpuinfo frequency    : base [%"PRIu32"] max [%"PRIu32"]\n",
                p_cpufreq->cpuinfo_min_freq,
                p_cpufreq->cpuinfo_max_freq);
@@ -854,7 +858,7 @@ static void print_cpufreq_para(int cpuid, struct xc_get_cpufreq_para *p_cpufreq)
 
     printf("scaling_driver       : %s\n", p_cpufreq->scaling_driver);
 
-    if ( !hwp )
+    if ( !is_governor_less )
     {
         if ( p_cpufreq->gov_num )
             printf("scaling_avail_gov    : %s\n",
diff --git a/xen/drivers/acpi/pm-op.c b/xen/drivers/acpi/pm-op.c
index f50acd7088..4cca42c4fc 100644
--- a/xen/drivers/acpi/pm-op.c
+++ b/xen/drivers/acpi/pm-op.c
@@ -154,7 +154,7 @@ static int get_cpufreq_para(struct xen_sysctl_pm_op *op)
     else
         strlcpy(op->u.get_para.scaling_driver, "Unknown", CPUFREQ_NAME_LEN);
 
-    if ( !hwp_active() )
+    if ( !cpufreq_is_governorless(op->cpuid) )
     {
         if ( !(scaling_available_governors =
                xzalloc_array(char, gov_num * CPUFREQ_NAME_LEN)) )
@@ -240,7 +240,7 @@ static int set_cpufreq_para(struct xen_sysctl_pm_op *op)
     if ( !policy || !policy->governor )
         return -EINVAL;
 
-    if ( hwp_active() )
+    if ( cpufreq_is_governorless(op->cpuid) )
         return -EOPNOTSUPP;
 
     switch( op->u.set_para.ctrl_type )
diff --git a/xen/include/acpi/cpufreq/cpufreq.h b/xen/include/acpi/cpufreq/cpufreq.h
index 9ef7c4683a..3efa71d442 100644
--- a/xen/include/acpi/cpufreq/cpufreq.h
+++ b/xen/include/acpi/cpufreq/cpufreq.h
@@ -294,4 +294,16 @@ int acpi_cpufreq_register(void);
 int amd_cppc_cmdline_parse(const char *s, const char *e);
 int amd_cppc_register_driver(void);
 
+/*
+ * Governor-less cpufreq driver indicates the driver doesn't rely on Xen
+ * governor to do performance tuning, mostly it has hardware built-in
+ * algorithm to calculate runtime workload and adjust cores frequency
+ * automatically, like Intel HWP, or CPPC in AMD.
+ */
+static inline bool cpufreq_is_governorless(unsigned int cpu)
+{
+    return processor_pminfo[cpu]->init && (hwp_active() ||
+                                           cpufreq_driver.setpolicy);
+}
+
 #endif /* __XEN_CPUFREQ_PM_H__ */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Sep 25 10:45:34 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Sep 2025 10:45:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1130344.1469933 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1v1jTi-00050k-8B; Thu, 25 Sep 2025 10:45:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1130344.1469933; Thu, 25 Sep 2025 10: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 1v1jTi-00050c-5e; Thu, 25 Sep 2025 10:45:34 +0000
Received: by outflank-mailman (input) for mailman id 1130344;
 Thu, 25 Sep 2025 10: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 1v1jTh-00050U-Fc
 for xen-changelog@lists.xenproject.org; Thu, 25 Sep 2025 10:45: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 1v1jTh-009dYa-1T
 for xen-changelog@lists.xenproject.org;
 Thu, 25 Sep 2025 10:45:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1v1jTh-00E6bG-1N
 for xen-changelog@lists.xenproject.org;
 Thu, 25 Sep 2025 10:45: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=MCUPZVhaqiT+33cPFpV3rzhf4476fnllElr1uaRPDww=; b=z85z0WUYbsG91EfdxaOKTQD/ln
	/tpH0HMKdNlQF5vkNlT5FzCZJx2MncbKCUmOqmkF94QdLPMxU9pRT6D5hINveLYX1KsjsZ3A3Nauc
	69+y2ddxLoZyJ5MfBABSrbpKlv6adYQITb7907qjJVPzdsryeED69tfiUcLtXsAb8WPA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] CHANGELOG.md: add amd-cppc/amd-cppc-epp cpufreq driver support
Message-Id: <E1v1jTh-00E6bG-1N@xenbits.xenproject.org>
Date: Thu, 25 Sep 2025 10:45:33 +0000

commit b768b46ff1b34a36aeca579bf6a1c13ae383e631
Author:     Penny Zheng <Penny.Zheng@amd.com>
AuthorDate: Thu Sep 25 09:21:55 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Sep 25 10:21:46 2025 +0200

    CHANGELOG.md: add amd-cppc/amd-cppc-epp cpufreq driver support
    
    Signed-off-by: Penny Zheng <Penny.Zheng@amd.com>
    Acked-by: Oleksii Kurochko<oleksii.kurochko@gmail.com>
---
 CHANGELOG.md | 1 +
 1 file changed, 1 insertion(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index ca1b43b940..7b9518ff08 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -36,6 +36,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
    - Support in hvmloader for new SMBIOS tables: 7 (Cache Info), 8 (Port
      Connector), 9 (System Slots), 26 (Voltage Probe), 27 (Cooling Device),
      and 28 (Temperature Probe).
+   - New amd-cppc/amd-cppc-epp cpufreq driver.
 
  - On Arm:
     - Ability to enable stack protector
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Sep 25 10:45:44 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Sep 2025 10:45:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1130346.1469947 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1v1jTs-0005I8-HT; Thu, 25 Sep 2025 10:45:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1130346.1469947; Thu, 25 Sep 2025 10: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 1v1jTs-0005Hz-Ec; Thu, 25 Sep 2025 10:45:44 +0000
Received: by outflank-mailman (input) for mailman id 1130346;
 Thu, 25 Sep 2025 10: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 1v1jTr-0005Hl-K0
 for xen-changelog@lists.xenproject.org; Thu, 25 Sep 2025 10: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 1v1jTr-009dYe-1u
 for xen-changelog@lists.xenproject.org;
 Thu, 25 Sep 2025 10:45:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1v1jTr-00E6bi-1e
 for xen-changelog@lists.xenproject.org;
 Thu, 25 Sep 2025 10: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=DNNh3iD7ErVU7X21YEpsZlwBPWFKx/bGhuHIVTdA/fI=; b=63e0H/Y2SSttrzOX7zHLnvtbUl
	P7rLsPfND229qQEJRFs4PuDeQEJ5XlHwbrM3DBMlvbOLvywVv0h/wFk4E1HPdva2uaUdbnYQA2FgP
	lO1RVXKgrtwLzjNP5Gteix/cRSTwK8hjZcVZd9Pfibd57hiE6GyJmMFZ21sxY/t1KSI8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] releases: use newer compression methods for tarballs
Message-Id: <E1v1jTr-00E6bi-1e@xenbits.xenproject.org>
Date: Thu, 25 Sep 2025 10:45:43 +0000

commit 63ebd0e9649e51d4f09e7f289e995dfcd3240df6
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Sep 25 10:22:55 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Sep 25 10:22:55 2025 +0200

    releases: use newer compression methods for tarballs
    
    Other projects have long switched to xz and/or lzip.
    
    Tidy things some as well: With the removal of qemu from the tarball,
    intermediately extracting the tarball again has become wasteful. Drop
    that. Invoke compressors using asynchronous lists, to reduce overall
    latency. Drop the -v option from the (previously implicit) gzip
    invocation.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
    Tested-by: Julien Grall <jgrall@amazon.com>
---
 docs/process/release-technician-checklist.txt | 15 +++++++++++----
 docs/process/xen-release-management.pandoc    |  4 ++--
 tools/misc/mktarball                          | 23 ++++++++++-------------
 3 files changed, 23 insertions(+), 19 deletions(-)

diff --git a/docs/process/release-technician-checklist.txt b/docs/process/release-technician-checklist.txt
index 64ed9fd5b2..ae369c6dc5 100644
--- a/docs/process/release-technician-checklist.txt
+++ b/docs/process/release-technician-checklist.txt
@@ -119,7 +119,7 @@ RELEASE TARBALL
        make src-tarball           # uses git-describe (best for RCs)
         # ^find some way to add git-cache-proxy to this (done in ~iwj/.gitconfig)
        mkdir /volatile/iwj/website-thing/xen.org/oss-xen/release/$v
-       mv dist/xen-$v.tar.gz /volatile/iwj/website-thing/xen.org/oss-xen/release/$v/.
+       mv dist/xen-$v.tar.[glx]z /volatile/iwj/website-thing/xen.org/oss-xen/release/$v/.
 
        # website-thing/xen.org is cvs -d mail.xenproject.org:/home/downloads-cvs/cvs-repos co xen.org
 	cd /volatile/iwj/website-thing/xen.org
@@ -139,9 +139,12 @@ RELEASE TARBALL
 	cvs add -kb oss-xen/release/$v/
 
         cd oss-xen/release/$v
-        gpg --digest-algo=SHA256 --detach-sign -u 'xen tree' xen-$v.tar.gz
-	cvs add -kb xen-$v.tar.gz
-        cvs add -kb xen-$v.tar.gz.sig
+        for t in xen-$v.tar.[glx]z
+        do
+            gpg --digest-algo=SHA256 --detach-sign -u 'xen tree' $t
+            cvs add -kb $t
+            cvs add -kb $t.sig
+        done
         cd ../../..
 
 	cvs ci -m $v
@@ -152,6 +155,10 @@ RELEASE TARBALL
 	# should show something like
 	#   U oss-xen/release/4.8.0-rc2/xen-4.8.0-rc2.tar.gz
 	#   U oss-xen/release/4.8.0-rc2/xen-4.8.0-rc2.tar.gz.sig
+	#   U oss-xen/release/4.8.0-rc2/xen-4.8.0-rc2.tar.lz
+	#   U oss-xen/release/4.8.0-rc2/xen-4.8.0-rc2.tar.lz.sig
+	#   U oss-xen/release/4.8.0-rc2/xen-4.8.0-rc2.tar.xz
+	#   U oss-xen/release/4.8.0-rc2/xen-4.8.0-rc2.tar.xz.sig
 
 After a .0 release, update XEN_EXTRAVERSION again (to .1-pre, see above).
 
diff --git a/docs/process/xen-release-management.pandoc b/docs/process/xen-release-management.pandoc
index 5da18f6da1..3e12082789 100644
--- a/docs/process/xen-release-management.pandoc
+++ b/docs/process/xen-release-management.pandoc
@@ -274,10 +274,10 @@ Xen X.Y rcZ is tagged. You can check that out from xen.git:
 https://xenbits.xen.org/git-http/xen.git X.Y.0-rcZ
 
 For your convenience there is also a tarball at:
-https://downloads.xenproject.org/release/xen/X.Y.0-rcZ/xen-X.Y.0-rcZ.tar.gz
+https://downloads.xenproject.org/release/xen/X.Y.0-rcZ/xen-X.Y.0-rcZ.tar.[glx]z
 
 And the signature is at:
-https://downloads.xenproject.org/release/xen/X.Y.0-rcZ/xen-X.Y.0-rcZ.tar.gz.sig
+https://downloads.xenproject.org/release/xen/X.Y.0-rcZ/xen-X.Y.0-rcZ.tar.[glx]z.sig
 
 Please send bug reports and test reports to xen-devel@lists.xenproject.org.
 When sending bug reports, please CC relevant maintainers and me
diff --git a/tools/misc/mktarball b/tools/misc/mktarball
index 7f9b61da43..72c5b0b5ee 100755
--- a/tools/misc/mktarball
+++ b/tools/misc/mktarball
@@ -5,14 +5,6 @@
 # Takes 2 arguments, the path to the dist directory and the version
 set -ex
 
-function git_archive_into {
-    mkdir -p "$2"
-
-    git --git-dir="$1"/.git \
-	archive --format=tar HEAD | \
-	tar Cxf "$2" -
-}
-
 if [[ -z "$1" || -z "$2" ]] ; then
   echo "usage: $0 path-to-XEN_ROOT xen-version"
   exit 1
@@ -21,14 +13,19 @@ fi
 xen_root="$1"
 desc="$2"
 
-tdir="$xen_root/dist/tmp.src-tarball"
+tdir="$xen_root/dist"
 
-rm -rf $tdir
+rm -f $tdir/xen-$desc.tar*
 
 mkdir -p $tdir
 
-git_archive_into $xen_root $tdir/xen-$desc
+git --git-dir="$xen_root/.git" archive --format=tar HEAD --prefix=xen-$desc/ \
+    >"$tdir/xen-$desc.tar"
 
-GZIP=-9v tar cz -f $xen_root/dist/xen-$desc.tar.gz -C $tdir xen-$desc
+gzip -9k "$tdir/xen-$desc.tar" &
+xz -9k "$tdir/xen-$desc.tar" &
+lzip -9k "$tdir/xen-$desc.tar" &
+wait
 
-echo "Source tarball in $xen_root/dist/xen-$desc.tar.gz"
+echo "Source tarball(s):"
+ls -lh $tdir/xen-$desc.tar*
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Sep 25 14:11:08 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Sep 2025 14:11:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1130608.1470090 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1v1mgZ-0003mC-Mp; Thu, 25 Sep 2025 14:11:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1130608.1470090; Thu, 25 Sep 2025 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 1v1mgZ-0003m4-KJ; Thu, 25 Sep 2025 14:11:03 +0000
Received: by outflank-mailman (input) for mailman id 1130608;
 Thu, 25 Sep 2025 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 1v1mgY-0003ly-HC
 for xen-changelog@lists.xenproject.org; Thu, 25 Sep 2025 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 1v1mgY-009hjM-1T
 for xen-changelog@lists.xenproject.org;
 Thu, 25 Sep 2025 14:11:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1v1mgY-00ET8z-1K
 for xen-changelog@lists.xenproject.org;
 Thu, 25 Sep 2025 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=jovMyxiXneW0hgxpRvcJyDNrjZFKpZ2I/9qybVgUzgg=; b=reSdxRXuSEh7ILXYfkG9scC+BG
	eu5O7BcE1sA+S5cA6QBb2MxMIP8zcwcbOYFSWH3boys7f4niLPZtn6xFA4J+FzullDCDXRU5TwVQG
	cZZJqCgecddOlNsKgxoBjgegblXh3B6O7DKO/Y+kc9cQKdh7/XEcbimgSJ7/N+0W4GHE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] efi: Fix line length in init_secure_boot_mode
Message-Id: <E1v1mgY-00ET8z-1K@xenbits.xenproject.org>
Date: Thu, 25 Sep 2025 14:11:02 +0000

commit 85d7fe2e14e562e9a006d19f5e165bc870639f0f
Author:     Gerald Elder-Vass <gerald.elder-vass@cloud.com>
AuthorDate: Thu Sep 25 16:01:36 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Sep 25 16:01:36 2025 +0200

    efi: Fix line length in init_secure_boot_mode
    
    Commit cb41b4ce14a9 introduced init_secure_boot_mode but one line was
    not wrapped appropriately.
    
    Signed-off-by: Gerald Elder-Vass <gerald.elder-vass@cloud.com>
    Reviewed-by: Alejandro Vallejo <alejandro.garciavallejo@amd.com>
    Acked-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
---
 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 b86c83d334..69fc022c18 100644
--- a/xen/common/efi/boot.c
+++ b/xen/common/efi/boot.c
@@ -923,7 +923,8 @@ static void __init init_secure_boot_mode(void)
 
     if ( status == EFI_NOT_FOUND ||
          (status == EFI_SUCCESS &&
-          attr == (EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS) &&
+          attr == (EFI_VARIABLE_BOOTSERVICE_ACCESS |
+                   EFI_VARIABLE_RUNTIME_ACCESS) &&
           size == 1 && data == 0) )
         /* Platform does not support Secure Boot or it's disabled. */
         efi_secure_boot = false;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Sep 25 14:11:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Sep 2025 14:11:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1130609.1470094 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1v1mgj-0003nj-OA; Thu, 25 Sep 2025 14:11:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1130609.1470094; Thu, 25 Sep 2025 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 1v1mgj-0003nb-Lc; Thu, 25 Sep 2025 14:11:13 +0000
Received: by outflank-mailman (input) for mailman id 1130609;
 Thu, 25 Sep 2025 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 1v1mgi-0003nR-J8
 for xen-changelog@lists.xenproject.org; Thu, 25 Sep 2025 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 1v1mgi-009hjl-1m
 for xen-changelog@lists.xenproject.org;
 Thu, 25 Sep 2025 14:11:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1v1mgi-00ETA5-1e
 for xen-changelog@lists.xenproject.org;
 Thu, 25 Sep 2025 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=X55OL7Hs4fUoZ7lmXHVCPTt1JgB8APlqxRXY3nJTJBs=; b=JKrByO4P1R9QtpF0Jr7PbowZ9l
	ps/xvXOrK8zgpZqD9VVFf8PhVNIj4c8KqfqX3wIVHdQqqYO9170UjUQZ7Fw3Yaajh4Hc65s0xDP6o
	T0qsDN6iFZZtpgSo8HgZ3NFOQQyvtD4sxJsYj3WVjgIH85l+ZD0ziqZwS7fnKeCo9QRM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] efi: Limit Shim's Verify success to EFI_SUCCESS
Message-Id: <E1v1mgi-00ETA5-1e@xenbits.xenproject.org>
Date: Thu, 25 Sep 2025 14:11:12 +0000

commit 38a5e0d0317b0f5a1143b3ec9cea7b757b26b935
Author:     Gerald Elder-Vass <gerald.elder-vass@cloud.com>
AuthorDate: Thu Sep 25 16:02:14 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Sep 25 16:02:14 2025 +0200

    efi: Limit Shim's Verify success to EFI_SUCCESS
    
    Commit 59a1d6d3ea1e replaced the Verify status check with
    !EFI_ERROR(...), this changed the behaviour to consider any warnings
    (EFI_WARN_) to be considered a successful verification.
    
    This commit reverts that behaviour change.
    
    Fixes: 59a1d6d3ea1e ("efi: Support using Shim's LoadImage protocol")
    Reported-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Gerald Elder-Vass <gerald.elder-vass@cloud.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
---
 xen/common/efi/boot.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c
index 69fc022c18..5b84dbf26e 100644
--- a/xen/common/efi/boot.c
+++ b/xen/common/efi/boot.c
@@ -1089,7 +1089,7 @@ static void __init efi_verify_kernel(EFI_HANDLE ImageHandle)
     if ( !verified &&
          !EFI_ERROR(efi_bs->LocateProtocol(&shim_lock_guid, NULL,
                                            (void **)&shim_lock)) &&
-         !EFI_ERROR(shim_lock->Verify(kernel.ptr, kernel.size)) )
+         shim_lock->Verify(kernel.ptr, kernel.size) == EFI_SUCCESS )
         verified = true;
 
     if ( !verified )
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Sep 25 15:22:08 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Sep 2025 15:22:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1130647.1470119 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1v1nnH-0004c7-Of; Thu, 25 Sep 2025 15:22:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1130647.1470119; Thu, 25 Sep 2025 15: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 1v1nnH-0004c0-M1; Thu, 25 Sep 2025 15:22:03 +0000
Received: by outflank-mailman (input) for mailman id 1130647;
 Thu, 25 Sep 2025 15: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 1v1nnF-0004bu-Ho
 for xen-changelog@lists.xenproject.org; Thu, 25 Sep 2025 15: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 1v1nnF-009j0o-1V
 for xen-changelog@lists.xenproject.org;
 Thu, 25 Sep 2025 15:22:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1v1nnF-00EbXG-1M
 for xen-changelog@lists.xenproject.org;
 Thu, 25 Sep 2025 15: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=21CqMFoEzJ/7ZCBdabkkhlKV2Bh9WAP38ddNbbqXJYo=; b=GLWGv2lhi4rucPHq3WomAhlatR
	38cJGHyrxXX4LPWG5yZXjItsFoXQ7Qto6Ccth0Qk1yJxLkcpD4/WU4KH7hYQFJ5CEIgdRGWHMwFcp
	WGSx0A9YlPrCZ/vyWV4duWIPWMJtDLj+eYBIJFINCRMxNKSBN9b/7WqDrbisoSq+sO28=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/cpu: populate CPUID 0x1.edx features early for self-snoop detection
Message-Id: <E1v1nnF-00EbXG-1M@xenbits.xenproject.org>
Date: Thu, 25 Sep 2025 15:22:01 +0000

commit 382dd0d166cb85139d86ff26fd96af102ae4fef3
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Wed Sep 24 09:59:46 2025 +0200
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Thu Sep 25 16:07:05 2025 +0200

    x86/cpu: populate CPUID 0x1.edx features early for self-snoop detection
    
    Otherwise the check for the SS feature in
    check_memory_type_self_snoop_errata() fails unconditionally, which leads to
    X86_FEATURE_XEN_SELFSNOOP never being set.
    
    We could also avoid this by not doing the reset_cpuinfo() for the BSP in
    identify_cpu(), because SS detection uses boot_cpu_data.  However that
    creates an imbalance on the state of the BSP versus the APs in the
    identify_cpu() code.
    
    I've opted for the less controversial solution of populating FEATURESET_1d
    in generic_identify(), as the value is already there.  The same is done for
    the AMD faulting probe code.  While there also populate the FEATURESET_1c
    element, as the value is in context.
    
    Fixes: f2663ca2e520 ("x86/cpu/intel: Clear cache self-snoop capability in CPUs with known errata")
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/cpu/common.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c
index 530b9eb39a..8c8bf1a806 100644
--- a/xen/arch/x86/cpu/common.c
+++ b/xen/arch/x86/cpu/common.c
@@ -490,6 +490,13 @@ static void generic_identify(struct cpuinfo_x86 *c)
 	c->apicid = phys_pkg_id((ebx >> 24) & 0xFF, 0);
 	c->phys_proc_id = c->apicid;
 
+	/*
+	 * Early init of Self Snoop support requires 0x1.edx, while there also
+	 * set 0x1.ecx as the value is in context.
+	 */
+	c->x86_capability[FEATURESET_1c] = ecx;
+	c->x86_capability[FEATURESET_1d] = edx;
+
 	eax = cpuid_eax(0x80000000);
 	if ((eax >> 16) == 0x8000)
 		c->extended_cpuid_level = eax;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Sep 25 16:11:04 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Sep 2025 16:11:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1130688.1470136 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1v1oYg-0002xA-EL; Thu, 25 Sep 2025 16:11:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1130688.1470136; Thu, 25 Sep 2025 16: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 1v1oYg-0002x2-Bc; Thu, 25 Sep 2025 16:11:02 +0000
Received: by outflank-mailman (input) for mailman id 1130688;
 Thu, 25 Sep 2025 16: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 1v1oYf-0002ww-Pi
 for xen-changelog@lists.xenproject.org; Thu, 25 Sep 2025 16: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 1v1oYf-009kdu-2J
 for xen-changelog@lists.xenproject.org;
 Thu, 25 Sep 2025 16:11:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1v1oYf-00EhEX-2A
 for xen-changelog@lists.xenproject.org;
 Thu, 25 Sep 2025 16: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=OjvU5XmjbseWOcot72FaLlJ65xgWJtr2DaQ8UVL5Vfk=; b=E2PoFO0tjR1xQv5xLbnEE67ZbX
	7vNVSlJdvlOzB0QARc1dXIx3zOT2/b9bXVpboQDufwcLh3wHYSHa/evnDj/JGQkAH1n1R/PDktS26
	hs7OV7LJHZBYnwRaCa+BZDzen17R54VnW3XuIFzHXJ6YaOmmFsDXP0qVW3ZUeUpV5/10=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] efi: Fix line length in init_secure_boot_mode
Message-Id: <E1v1oYf-00EhEX-2A@xenbits.xenproject.org>
Date: Thu, 25 Sep 2025 16:11:01 +0000

commit 85d7fe2e14e562e9a006d19f5e165bc870639f0f
Author:     Gerald Elder-Vass <gerald.elder-vass@cloud.com>
AuthorDate: Thu Sep 25 16:01:36 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Sep 25 16:01:36 2025 +0200

    efi: Fix line length in init_secure_boot_mode
    
    Commit cb41b4ce14a9 introduced init_secure_boot_mode but one line was
    not wrapped appropriately.
    
    Signed-off-by: Gerald Elder-Vass <gerald.elder-vass@cloud.com>
    Reviewed-by: Alejandro Vallejo <alejandro.garciavallejo@amd.com>
    Acked-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
---
 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 b86c83d334..69fc022c18 100644
--- a/xen/common/efi/boot.c
+++ b/xen/common/efi/boot.c
@@ -923,7 +923,8 @@ static void __init init_secure_boot_mode(void)
 
     if ( status == EFI_NOT_FOUND ||
          (status == EFI_SUCCESS &&
-          attr == (EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS) &&
+          attr == (EFI_VARIABLE_BOOTSERVICE_ACCESS |
+                   EFI_VARIABLE_RUNTIME_ACCESS) &&
           size == 1 && data == 0) )
         /* Platform does not support Secure Boot or it's disabled. */
         efi_secure_boot = false;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Sep 25 16:11:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Sep 2025 16:11:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1130689.1470140 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1v1oYr-0002yr-FV; Thu, 25 Sep 2025 16:11:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1130689.1470140; Thu, 25 Sep 2025 16: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 1v1oYr-0002yk-Cw; Thu, 25 Sep 2025 16:11:13 +0000
Received: by outflank-mailman (input) for mailman id 1130689;
 Thu, 25 Sep 2025 16: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 1v1oYp-0002yZ-RV
 for xen-changelog@lists.xenproject.org; Thu, 25 Sep 2025 16: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 1v1oYp-009keH-2b
 for xen-changelog@lists.xenproject.org;
 Thu, 25 Sep 2025 16:11:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1v1oYp-00EhHp-2U
 for xen-changelog@lists.xenproject.org;
 Thu, 25 Sep 2025 16: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=RZRU4xLsUr6ExzCRmv2BWTPRombmoCmSetDLgS3QTdU=; b=jTULS1fNFqhUxM8vSSwG7Bqkax
	vOl010QkblfCE/JxAwk+2Bc9lu6S2hvGPTjH7CYbDGb8XZJEkiBOwsLsXW37SU78anZBr3CHOms0K
	EN/Sq76B1IFg2+xu5NliUqWfEqkrNKz+ZXDsT+Z0om7XxjYkC4AvSGn8KXmMgotf/d7w=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] efi: Limit Shim's Verify success to EFI_SUCCESS
Message-Id: <E1v1oYp-00EhHp-2U@xenbits.xenproject.org>
Date: Thu, 25 Sep 2025 16:11:11 +0000

commit 38a5e0d0317b0f5a1143b3ec9cea7b757b26b935
Author:     Gerald Elder-Vass <gerald.elder-vass@cloud.com>
AuthorDate: Thu Sep 25 16:02:14 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Sep 25 16:02:14 2025 +0200

    efi: Limit Shim's Verify success to EFI_SUCCESS
    
    Commit 59a1d6d3ea1e replaced the Verify status check with
    !EFI_ERROR(...), this changed the behaviour to consider any warnings
    (EFI_WARN_) to be considered a successful verification.
    
    This commit reverts that behaviour change.
    
    Fixes: 59a1d6d3ea1e ("efi: Support using Shim's LoadImage protocol")
    Reported-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Gerald Elder-Vass <gerald.elder-vass@cloud.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
---
 xen/common/efi/boot.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c
index 69fc022c18..5b84dbf26e 100644
--- a/xen/common/efi/boot.c
+++ b/xen/common/efi/boot.c
@@ -1089,7 +1089,7 @@ static void __init efi_verify_kernel(EFI_HANDLE ImageHandle)
     if ( !verified &&
          !EFI_ERROR(efi_bs->LocateProtocol(&shim_lock_guid, NULL,
                                            (void **)&shim_lock)) &&
-         !EFI_ERROR(shim_lock->Verify(kernel.ptr, kernel.size)) )
+         shim_lock->Verify(kernel.ptr, kernel.size) == EFI_SUCCESS )
         verified = true;
 
     if ( !verified )
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Sep 25 16:11:23 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Sep 2025 16:11:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1130690.1470144 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1v1oZ1-000318-HJ; Thu, 25 Sep 2025 16:11:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1130690.1470144; Thu, 25 Sep 2025 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 1v1oZ1-000310-EZ; Thu, 25 Sep 2025 16:11:23 +0000
Received: by outflank-mailman (input) for mailman id 1130690;
 Thu, 25 Sep 2025 16: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 1v1oYz-00030m-To
 for xen-changelog@lists.xenproject.org; Thu, 25 Sep 2025 16: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 1v1oYz-009keR-2t
 for xen-changelog@lists.xenproject.org;
 Thu, 25 Sep 2025 16:11:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1v1oYz-00EhIX-2m
 for xen-changelog@lists.xenproject.org;
 Thu, 25 Sep 2025 16: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=etBdJuPay6oRA8O83YryFJ6KVlHHMyA6+quN0OkEFlY=; b=OeAfvOW3d//wzTmPl/cd3m+CJj
	U756bUO9MOhoujlPj+9xu2hdXHvQ/FFm/+FSeGQQQ2fRRL8FgMVa0FTr2JkKDOPbviOmNE4f1qXTV
	SApv0k9YJ415LMcdiJeoPeyBTe2xod58AKrKJeVYuvQbNiBjO5CCt71DABoZWzbwKlDk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/cpu: populate CPUID 0x1.edx features early for self-snoop detection
Message-Id: <E1v1oYz-00EhIX-2m@xenbits.xenproject.org>
Date: Thu, 25 Sep 2025 16:11:21 +0000

commit 382dd0d166cb85139d86ff26fd96af102ae4fef3
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Wed Sep 24 09:59:46 2025 +0200
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Thu Sep 25 16:07:05 2025 +0200

    x86/cpu: populate CPUID 0x1.edx features early for self-snoop detection
    
    Otherwise the check for the SS feature in
    check_memory_type_self_snoop_errata() fails unconditionally, which leads to
    X86_FEATURE_XEN_SELFSNOOP never being set.
    
    We could also avoid this by not doing the reset_cpuinfo() for the BSP in
    identify_cpu(), because SS detection uses boot_cpu_data.  However that
    creates an imbalance on the state of the BSP versus the APs in the
    identify_cpu() code.
    
    I've opted for the less controversial solution of populating FEATURESET_1d
    in generic_identify(), as the value is already there.  The same is done for
    the AMD faulting probe code.  While there also populate the FEATURESET_1c
    element, as the value is in context.
    
    Fixes: f2663ca2e520 ("x86/cpu/intel: Clear cache self-snoop capability in CPUs with known errata")
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/cpu/common.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c
index 530b9eb39a..8c8bf1a806 100644
--- a/xen/arch/x86/cpu/common.c
+++ b/xen/arch/x86/cpu/common.c
@@ -490,6 +490,13 @@ static void generic_identify(struct cpuinfo_x86 *c)
 	c->apicid = phys_pkg_id((ebx >> 24) & 0xFF, 0);
 	c->phys_proc_id = c->apicid;
 
+	/*
+	 * Early init of Self Snoop support requires 0x1.edx, while there also
+	 * set 0x1.ecx as the value is in context.
+	 */
+	c->x86_capability[FEATURESET_1c] = ecx;
+	c->x86_capability[FEATURESET_1d] = edx;
+
 	eax = cpuid_eax(0x80000000);
 	if ((eax >> 16) == 0x8000)
 		c->extended_cpuid_level = eax;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Sep 29 14:33:08 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 29 Sep 2025 14:33:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1132945.1471148 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1v3Ew3-0007jQ-1R; Mon, 29 Sep 2025 14:33:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1132945.1471148; Mon, 29 Sep 2025 14: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 1v3Ew2-0007jH-Us; Mon, 29 Sep 2025 14:33:02 +0000
Received: by outflank-mailman (input) for mailman id 1132945;
 Mon, 29 Sep 2025 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 1v3Ew1-0007jB-Mc
 for xen-changelog@lists.xenproject.org; Mon, 29 Sep 2025 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 1v3Ew1-00GaLb-1n
 for xen-changelog@lists.xenproject.org;
 Mon, 29 Sep 2025 14:33:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1v3Ew1-004YZG-1b
 for xen-changelog@lists.xenproject.org;
 Mon, 29 Sep 2025 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=CUsYDFSOoUf1dG+uE9EucX6V1XGoCch9QIQtcSHn19I=; b=MFyfdB9d+VkI1Sk6IMgvj7SqdY
	GrnqkZLPAPg/kGl5HBbH1AyqsioMFyqCrk7/yTy/RuFKMf+k90+U6WP8QZvRCMbXd/MGfR0oisSaY
	OTkZhywuVY8XBJi9oYwd0wszRd9KQTJkq0IJhORhYqk2ISuLZslpQVf/N/e1ujNZvWzY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: Reorder SCI resource cleanup in domain destruction
Message-Id: <E1v3Ew1-004YZG-1b@xenbits.xenproject.org>
Date: Mon, 29 Sep 2025 14:33:01 +0000

commit 45c609078331f82a746033595b2eaed7ff2a7a0b
Author:     Oleksii Moisieiev <Oleksii_Moisieiev@epam.com>
AuthorDate: Sun Sep 14 13:26:42 2025 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Sat Sep 27 18:07:34 2025 +0100

    xen/arm: Reorder SCI resource cleanup in domain destruction
    
    Move the SCI (System Control and Management Interface) resource cleanup
    earlier in the domain_relinquish_resources() sequence to ensure proper
    cleanup ordering during domain destruction.
    
    The SCI cleanup is now performed before TEE (Trusted Execution Environment)
    cleanup rather than after P2M mapping cleanup. This reordering ensures that
    SCI resources are properly released before other subsystems that might
    depend on them are torn down.
    
    This change addresses potential resource cleanup dependencies where SCI
    resources need to be released before P2M mappings are cleaned up, preventing
    potential issues during domain destruction on ARM platforms with SCI support.
    
    Fixes: e2cc10867b63 ("xen/arm: add generic SCI subsystem")
    
    Signed-off-by: Oleksii Moisieiev <oleksii_moisieiev@epam.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/domain.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c
index 1a8585d02b..e36719bce4 100644
--- a/xen/arch/arm/domain.c
+++ b/xen/arch/arm/domain.c
@@ -1042,6 +1042,7 @@ static int relinquish_memory(struct domain *d, struct page_list_head *list)
  */
 enum {
     PROG_pci = 1,
+    PROG_sci,
     PROG_tee,
     PROG_xen,
     PROG_page,
@@ -1049,7 +1050,6 @@ enum {
     PROG_p2m_root,
     PROG_p2m,
     PROG_p2m_pool,
-    PROG_sci,
     PROG_done,
 };
 
@@ -1090,6 +1090,11 @@ int domain_relinquish_resources(struct domain *d)
             return ret;
 #endif
 
+    PROGRESS(sci):
+        ret = sci_relinquish_resources(d);
+        if ( ret )
+            return ret;
+
     PROGRESS(tee):
         ret = tee_relinquish_resources(d);
         if (ret )
@@ -1109,10 +1114,6 @@ int domain_relinquish_resources(struct domain *d)
         ret = relinquish_p2m_mapping(d);
         if ( ret )
             return ret;
-    PROGRESS(sci):
-        ret = sci_relinquish_resources(d);
-        if ( ret )
-            return ret;
 
     PROGRESS(p2m_root):
         /*
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Sep 29 15:33:05 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 29 Sep 2025 15:33:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1132977.1471172 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1v3Fs7-000785-JX; Mon, 29 Sep 2025 15:33:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1132977.1471172; Mon, 29 Sep 2025 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 1v3Fs7-00077x-Gj; Mon, 29 Sep 2025 15:33:03 +0000
Received: by outflank-mailman (input) for mailman id 1132977;
 Mon, 29 Sep 2025 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 1v3Fs6-00077r-5T
 for xen-changelog@lists.xenproject.org; Mon, 29 Sep 2025 15: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 1v3Fs6-00GbUy-0F
 for xen-changelog@lists.xenproject.org;
 Mon, 29 Sep 2025 15:33:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1v3Fs6-004eIR-06
 for xen-changelog@lists.xenproject.org;
 Mon, 29 Sep 2025 15: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=5wZ8cFZl/b61cvs9jUChm4KfYZahE416EaqzM8CmnGM=; b=nl8fCQvXxxz+ATPZXLhK/xTstp
	514Kx+K3eJMIffBDWm26PdKa9JcXZsqqXZvKX0mAk/YorDsZ52qjEBCVlIsZX4wLttH4oPyW1gVlQ
	TLy6HHHgYhoRKI7BlhPOJ8RzMgIkBd+DjvpXWW58K1HajE7MdB4lpsBPkpWb9q6Wj0vs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: Reorder SCI resource cleanup in domain destruction
Message-Id: <E1v3Fs6-004eIR-06@xenbits.xenproject.org>
Date: Mon, 29 Sep 2025 15:33:02 +0000

commit 45c609078331f82a746033595b2eaed7ff2a7a0b
Author:     Oleksii Moisieiev <Oleksii_Moisieiev@epam.com>
AuthorDate: Sun Sep 14 13:26:42 2025 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Sat Sep 27 18:07:34 2025 +0100

    xen/arm: Reorder SCI resource cleanup in domain destruction
    
    Move the SCI (System Control and Management Interface) resource cleanup
    earlier in the domain_relinquish_resources() sequence to ensure proper
    cleanup ordering during domain destruction.
    
    The SCI cleanup is now performed before TEE (Trusted Execution Environment)
    cleanup rather than after P2M mapping cleanup. This reordering ensures that
    SCI resources are properly released before other subsystems that might
    depend on them are torn down.
    
    This change addresses potential resource cleanup dependencies where SCI
    resources need to be released before P2M mappings are cleaned up, preventing
    potential issues during domain destruction on ARM platforms with SCI support.
    
    Fixes: e2cc10867b63 ("xen/arm: add generic SCI subsystem")
    
    Signed-off-by: Oleksii Moisieiev <oleksii_moisieiev@epam.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/domain.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c
index 1a8585d02b..e36719bce4 100644
--- a/xen/arch/arm/domain.c
+++ b/xen/arch/arm/domain.c
@@ -1042,6 +1042,7 @@ static int relinquish_memory(struct domain *d, struct page_list_head *list)
  */
 enum {
     PROG_pci = 1,
+    PROG_sci,
     PROG_tee,
     PROG_xen,
     PROG_page,
@@ -1049,7 +1050,6 @@ enum {
     PROG_p2m_root,
     PROG_p2m,
     PROG_p2m_pool,
-    PROG_sci,
     PROG_done,
 };
 
@@ -1090,6 +1090,11 @@ int domain_relinquish_resources(struct domain *d)
             return ret;
 #endif
 
+    PROGRESS(sci):
+        ret = sci_relinquish_resources(d);
+        if ( ret )
+            return ret;
+
     PROGRESS(tee):
         ret = tee_relinquish_resources(d);
         if (ret )
@@ -1109,10 +1114,6 @@ int domain_relinquish_resources(struct domain *d)
         ret = relinquish_p2m_mapping(d);
         if ( ret )
             return ret;
-    PROGRESS(sci):
-        ret = sci_relinquish_resources(d);
-        if ( ret )
-            return ret;
 
     PROGRESS(p2m_root):
         /*
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Sep 29 19:44:08 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 29 Sep 2025 19:44:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1133354.1471480 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1v3Jn0-00054F-A1; Mon, 29 Sep 2025 19:44:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1133354.1471480; Mon, 29 Sep 2025 19: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 1v3Jn0-000547-7R; Mon, 29 Sep 2025 19:44:02 +0000
Received: by outflank-mailman (input) for mailman id 1133354;
 Mon, 29 Sep 2025 19: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 1v3Jmz-000541-Ty
 for xen-changelog@lists.xenproject.org; Mon, 29 Sep 2025 19: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 1v3Jmz-00GhNn-2f
 for xen-changelog@lists.xenproject.org;
 Mon, 29 Sep 2025 19:44:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1v3Jmz-00547u-2N
 for xen-changelog@lists.xenproject.org;
 Mon, 29 Sep 2025 19: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=U3l8b7OpfNLoMv1MkhJqJFckKs6T27sl7WSZAw4MaLI=; b=sF7fttwyQVnX2awOIoM7rlxbXD
	XdHCsgdq0Z9c/2+FX1SOAulGTxUwV/qTXJsDFF3dpireGmHMxdBnwQEtX/MjQ9pMQmI8HcKvdYxrE
	0ZNZrkWqv2TBwtNg4S7LRqKba5ub0J6zvKEFv762C7oi1yLOBJCkIOqT9oGEiVMH9oI8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/libs/guest: Use superpages where possible on migrate/resume
Message-Id: <E1v3Jmz-00547u-2N@xenbits.xenproject.org>
Date: Mon, 29 Sep 2025 19:44:01 +0000

commit 50baf2d9f7bb8502d497385846789ea1755901cc
Author:     Frediano Ziglio <frediano.ziglio@cloud.com>
AuthorDate: Fri Sep 12 10:57:44 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Sep 29 21:32:37 2025 +0200

    tools/libs/guest: Use superpages where possible on migrate/resume
    
    Right now on migrate/resume, all guest memory is allocated with 4k
    small pages.  This was an intended oversight in the original Migration
    v2 implementation.
    
    With some test memory program stressing TLB (many small random memory
    accesses) superpages can show a 15% performance improvement.
    
    On the first memory iteration the sender is currently sending memory
    in 4MB aligned chunks of GFN space which allows the receiver to
    allocate most pages as 2MB superpages instead of single 4KB pages.
    
    This change does not handle 1GB superpages as this will require
    changes to the migration protocol.
    
    Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Release-Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
---
 tools/libs/guest/xg_sr_restore.c | 57 +++++++++++++++++++++++++++++++++++++---
 1 file changed, 54 insertions(+), 3 deletions(-)

diff --git a/tools/libs/guest/xg_sr_restore.c b/tools/libs/guest/xg_sr_restore.c
index 06231ca826..4aed5cf4ac 100644
--- a/tools/libs/guest/xg_sr_restore.c
+++ b/tools/libs/guest/xg_sr_restore.c
@@ -129,6 +129,35 @@ static int pfn_set_populated(struct xc_sr_context *ctx, xen_pfn_t pfn)
     return 0;
 }
 
+#if defined(__i386__) || defined(__x86_64__)
+/* Order of the smallest superpage */
+#define SMALL_SUPERPAGE_ORDER 9
+#else
+#error Define SMALL_SUPERPAGE_ORDER for this platform
+#endif
+
+static bool populate_small_superpage(struct xc_sr_context *ctx, xen_pfn_t gfn)
+{
+    xen_pfn_t mfn = gfn;
+
+    if ( xc_domain_populate_physmap_exact(
+         ctx->xch, ctx->domid, 1, SMALL_SUPERPAGE_ORDER, 0, &mfn) )
+        return false;
+
+    /*
+     * XENMEM_populate_physmap has no coherent error semantics.
+     * Assume a failure here is ENOMEM, and fall back to allocating
+     * small pages.
+     */
+    if ( mfn == INVALID_MFN )
+        return false;
+
+    for ( size_t i = 0; i < (1UL << SMALL_SUPERPAGE_ORDER); ++i )
+        ctx->restore.ops.set_gfn(ctx, gfn + i, mfn + i);
+
+    return true;
+}
+
 /*
  * Given a set of pfns, obtain memory from Xen to fill the physmap for the
  * unpopulated subset.  If types is NULL, no page type checking is performed
@@ -142,6 +171,9 @@ int populate_pfns(struct xc_sr_context *ctx, unsigned int count,
         *pfns = malloc(count * sizeof(*pfns));
     unsigned int i, nr_pfns = 0;
     int rc = -1;
+    xen_pfn_t prev = 0;
+    unsigned int num_contiguous = 0;
+    xen_pfn_t mask = (1ULL << SMALL_SUPERPAGE_ORDER) - 1;
 
     if ( !mfns || !pfns )
     {
@@ -152,14 +184,33 @@ int populate_pfns(struct xc_sr_context *ctx, unsigned int count,
 
     for ( i = 0; i < count; ++i )
     {
+        xen_pfn_t pfn = original_pfns[i];
+
         if ( (!types || page_type_to_populate(types[i])) &&
-             !pfn_is_populated(ctx, original_pfns[i]) )
+             !pfn_is_populated(ctx, pfn) )
         {
-            rc = pfn_set_populated(ctx, original_pfns[i]);
+            rc = pfn_set_populated(ctx, pfn);
             if ( rc )
                 goto err;
-            pfns[nr_pfns] = mfns[nr_pfns] = original_pfns[i];
+            pfns[nr_pfns] = mfns[nr_pfns] = pfn;
             ++nr_pfns;
+
+            /*
+             * During the first pass for x86 HVM guests, PAGE_DATA
+             * records contain metadata about 4M aligned chunks of GFN
+             * space.  Reconstruct 2M superpages where possible.
+             */
+            if ( pfn != prev + 1 )
+                num_contiguous = 0;
+            num_contiguous++;
+            prev = pfn;
+
+            if ( num_contiguous > mask && (pfn & mask) == mask &&
+                 populate_small_superpage(ctx, pfn - mask) )
+            {
+                nr_pfns -= mask + 1;
+                num_contiguous = 0;
+            }
         }
     }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Sep 29 21:44:08 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 29 Sep 2025 21:44:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1133385.1471503 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1v3Lf9-0002rz-VX; Mon, 29 Sep 2025 21:44:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1133385.1471503; Mon, 29 Sep 2025 21: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 1v3Lf9-0002rr-T4; Mon, 29 Sep 2025 21:44:03 +0000
Received: by outflank-mailman (input) for mailman id 1133385;
 Mon, 29 Sep 2025 21: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 1v3Lf8-0002rl-8P
 for xen-changelog@lists.xenproject.org; Mon, 29 Sep 2025 21: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 1v3Lf8-00GjnJ-0X
 for xen-changelog@lists.xenproject.org;
 Mon, 29 Sep 2025 21:44:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1v3Lf8-005Bof-0O
 for xen-changelog@lists.xenproject.org;
 Mon, 29 Sep 2025 21: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=Hb7Y6afFfqVQCQ8x3zgBR/AZEDmkG2Q0+XF9sDd6fpU=; b=twIvmPZ5RGpUEcKCeT8isnE7gn
	0Kn7b2O3j/6BkGM4IqoBdls9N6jb6cay8BDRwkXgYw2gEA6zsEH5pMSGwf9m25Gy97XMwLaYkcEk5
	R+IJZWyLx1yzAyn4LTZ2fyZL5S9MKf8Iuu7YWFjxbzAq6z49PeuNwohE8NhGY3eEtHAg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/libs/guest: Use superpages where possible on migrate/resume
Message-Id: <E1v3Lf8-005Bof-0O@xenbits.xenproject.org>
Date: Mon, 29 Sep 2025 21:44:02 +0000

commit 50baf2d9f7bb8502d497385846789ea1755901cc
Author:     Frediano Ziglio <frediano.ziglio@cloud.com>
AuthorDate: Fri Sep 12 10:57:44 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Sep 29 21:32:37 2025 +0200

    tools/libs/guest: Use superpages where possible on migrate/resume
    
    Right now on migrate/resume, all guest memory is allocated with 4k
    small pages.  This was an intended oversight in the original Migration
    v2 implementation.
    
    With some test memory program stressing TLB (many small random memory
    accesses) superpages can show a 15% performance improvement.
    
    On the first memory iteration the sender is currently sending memory
    in 4MB aligned chunks of GFN space which allows the receiver to
    allocate most pages as 2MB superpages instead of single 4KB pages.
    
    This change does not handle 1GB superpages as this will require
    changes to the migration protocol.
    
    Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Release-Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
---
 tools/libs/guest/xg_sr_restore.c | 57 +++++++++++++++++++++++++++++++++++++---
 1 file changed, 54 insertions(+), 3 deletions(-)

diff --git a/tools/libs/guest/xg_sr_restore.c b/tools/libs/guest/xg_sr_restore.c
index 06231ca826..4aed5cf4ac 100644
--- a/tools/libs/guest/xg_sr_restore.c
+++ b/tools/libs/guest/xg_sr_restore.c
@@ -129,6 +129,35 @@ static int pfn_set_populated(struct xc_sr_context *ctx, xen_pfn_t pfn)
     return 0;
 }
 
+#if defined(__i386__) || defined(__x86_64__)
+/* Order of the smallest superpage */
+#define SMALL_SUPERPAGE_ORDER 9
+#else
+#error Define SMALL_SUPERPAGE_ORDER for this platform
+#endif
+
+static bool populate_small_superpage(struct xc_sr_context *ctx, xen_pfn_t gfn)
+{
+    xen_pfn_t mfn = gfn;
+
+    if ( xc_domain_populate_physmap_exact(
+         ctx->xch, ctx->domid, 1, SMALL_SUPERPAGE_ORDER, 0, &mfn) )
+        return false;
+
+    /*
+     * XENMEM_populate_physmap has no coherent error semantics.
+     * Assume a failure here is ENOMEM, and fall back to allocating
+     * small pages.
+     */
+    if ( mfn == INVALID_MFN )
+        return false;
+
+    for ( size_t i = 0; i < (1UL << SMALL_SUPERPAGE_ORDER); ++i )
+        ctx->restore.ops.set_gfn(ctx, gfn + i, mfn + i);
+
+    return true;
+}
+
 /*
  * Given a set of pfns, obtain memory from Xen to fill the physmap for the
  * unpopulated subset.  If types is NULL, no page type checking is performed
@@ -142,6 +171,9 @@ int populate_pfns(struct xc_sr_context *ctx, unsigned int count,
         *pfns = malloc(count * sizeof(*pfns));
     unsigned int i, nr_pfns = 0;
     int rc = -1;
+    xen_pfn_t prev = 0;
+    unsigned int num_contiguous = 0;
+    xen_pfn_t mask = (1ULL << SMALL_SUPERPAGE_ORDER) - 1;
 
     if ( !mfns || !pfns )
     {
@@ -152,14 +184,33 @@ int populate_pfns(struct xc_sr_context *ctx, unsigned int count,
 
     for ( i = 0; i < count; ++i )
     {
+        xen_pfn_t pfn = original_pfns[i];
+
         if ( (!types || page_type_to_populate(types[i])) &&
-             !pfn_is_populated(ctx, original_pfns[i]) )
+             !pfn_is_populated(ctx, pfn) )
         {
-            rc = pfn_set_populated(ctx, original_pfns[i]);
+            rc = pfn_set_populated(ctx, pfn);
             if ( rc )
                 goto err;
-            pfns[nr_pfns] = mfns[nr_pfns] = original_pfns[i];
+            pfns[nr_pfns] = mfns[nr_pfns] = pfn;
             ++nr_pfns;
+
+            /*
+             * During the first pass for x86 HVM guests, PAGE_DATA
+             * records contain metadata about 4M aligned chunks of GFN
+             * space.  Reconstruct 2M superpages where possible.
+             */
+            if ( pfn != prev + 1 )
+                num_contiguous = 0;
+            num_contiguous++;
+            prev = pfn;
+
+            if ( num_contiguous > mask && (pfn & mask) == mask &&
+                 populate_small_superpage(ctx, pfn - mask) )
+            {
+                nr_pfns -= mask + 1;
+                num_contiguous = 0;
+            }
         }
     }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Sep 30 07:11:07 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 30 Sep 2025 07:11:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1133773.1471827 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1v3UVq-0003DH-KU; Tue, 30 Sep 2025 07:11:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1133773.1471827; Tue, 30 Sep 2025 07: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 1v3UVq-0003DA-I1; Tue, 30 Sep 2025 07:11:02 +0000
Received: by outflank-mailman (input) for mailman id 1133773;
 Tue, 30 Sep 2025 07: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 1v3UVp-0003D4-UP
 for xen-changelog@lists.xenproject.org; Tue, 30 Sep 2025 07: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 1v3UVp-000W23-2i
 for xen-changelog@lists.xenproject.org;
 Tue, 30 Sep 2025 07:11:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1v3UVp-006Cyj-2a
 for xen-changelog@lists.xenproject.org;
 Tue, 30 Sep 2025 07: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=te79dAA3RWWRl/hd0M/DlqcQetE/uPuVXS+g83rC3ew=; b=qOv2LJrt7iQ/vjChFU6irR4e0W
	yavTQyOtvydPVWZ8kYntbB5c1fHtn8WHirR8amiz5uZxC8ISjK+y/UN2O3HuQRJuo1ssB4aLgdBdR
	Rsd2Ml9Hle5tqJK60ZTcTZ5ELBGzoS06k3U9Dz1p4PJbSsDJiYDcfHKyuIOW0qYgKYp8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] docs: fusa: Define the requirements for XEN_VERSION hypercall.
Message-Id: <E1v3UVp-006Cyj-2a@xenbits.xenproject.org>
Date: Tue, 30 Sep 2025 07:11:01 +0000

commit df2fffac079916b6ad85d48cfbf20ea30ef49612
Author:     Ayan Kumar Halder <ayan.kumar.halder@amd.com>
AuthorDate: Tue Aug 19 12:27:08 2025 +0100
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Tue Sep 30 09:04:27 2025 +0200

    docs: fusa: Define the requirements for XEN_VERSION hypercall.
    
    Define the requirements which are common for all the commands.
    
    Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 docs/fusa/reqs/design-reqs/arm64/hypercall.rst    | 60 +++++++++++++++++++++++
 docs/fusa/reqs/index.rst                          |  2 +
 docs/fusa/reqs/market-reqs/reqs.rst               | 16 ++++++
 docs/fusa/reqs/product-reqs/version_hypercall.rst | 42 ++++++++++++++++
 4 files changed, 120 insertions(+)

diff --git a/docs/fusa/reqs/design-reqs/arm64/hypercall.rst b/docs/fusa/reqs/design-reqs/arm64/hypercall.rst
new file mode 100644
index 0000000000..82ecf690a3
--- /dev/null
+++ b/docs/fusa/reqs/design-reqs/arm64/hypercall.rst
@@ -0,0 +1,60 @@
+.. SPDX-License-Identifier: CC-BY-4.0
+
+Hypercall
+=========
+
+Instruction
+-----------
+
+`XenSwdgn~arm64_hyp_instr~1`
+
+Description:
+Xen shall treat domain hvc instruction execution (with 0xEA1) as hypercall
+requests.
+
+Rationale:
+
+Comments:
+Hypercall is one of the communication mechanism between Xen and domains.
+Domains use hypercalls for various requests to Xen.
+The exception syndrome register should have the following values :-
+ESR_EL2.ISS should be 0xEA1.
+ESR_EL2.EC should be 0x16.
+
+Covers:
+ - `XenProd~version_hyp_first_param~1`
+ - `XenProd~version_hyp_second_param~1`
+
+Parameters
+----------
+
+`XenSwdgn~arm64_hyp_param~1`
+
+Description:
+Xen shall use x0 - x4 core registers to obtain the arguments for domain hypercall
+requests.
+
+Rationale:
+
+Comments:
+Xen shall read x0 for the first argument, x1 for the second argument and so on.
+
+Covers:
+ - `XenProd~version_hyp_first_param~1`
+ - `XenProd~version_hyp_second_param~1`
+
+Hypercall number
+----------------
+
+`XenSwdgn~arm64_hyp_num~1`
+
+Description:
+Xen shall read x16 to obtain the hypercall number.
+
+Rationale:
+
+Comments:
+
+Covers:
+ - `XenProd~version_hyp_first_param~1`
+ - `XenProd~version_hyp_second_param~1`
diff --git a/docs/fusa/reqs/index.rst b/docs/fusa/reqs/index.rst
index 1088a51d52..d8683edce7 100644
--- a/docs/fusa/reqs/index.rst
+++ b/docs/fusa/reqs/index.rst
@@ -10,5 +10,7 @@ Requirements documentation
    market-reqs/reqs
    product-reqs/reqs
    product-reqs/arm64/reqs
+   product-reqs/version_hypercall
    design-reqs/arm64/generic-timer
    design-reqs/arm64/sbsa-uart
+   design-reqs/arm64/hypercall
diff --git a/docs/fusa/reqs/market-reqs/reqs.rst b/docs/fusa/reqs/market-reqs/reqs.rst
index 2d297ecc13..7e3912c8f8 100644
--- a/docs/fusa/reqs/market-reqs/reqs.rst
+++ b/docs/fusa/reqs/market-reqs/reqs.rst
@@ -79,3 +79,19 @@ Comments:
 
 Needs:
  - XenProd
+
+Version hypercall
+-----------------
+
+`XenMkt~version_hypercall~1`
+
+Description:
+Xen shall provide a hypercall for the domains to retrieve Xen's version, type
+and compilation information.
+
+Rationale:
+
+Comments:
+
+Needs:
+ - XenProd
diff --git a/docs/fusa/reqs/product-reqs/version_hypercall.rst b/docs/fusa/reqs/product-reqs/version_hypercall.rst
new file mode 100644
index 0000000000..b824c539b0
--- /dev/null
+++ b/docs/fusa/reqs/product-reqs/version_hypercall.rst
@@ -0,0 +1,42 @@
+.. SPDX-License-Identifier: CC-BY-4.0
+
+Version hypercall
+=================
+
+First Parameter
+---------------
+
+`XenProd~version_hyp_first_param~1`
+
+Description:
+Xen shall treat the value stored in x0 as the command number for the hypercall.
+
+Rationale:
+
+Comments:
+
+Covers:
+ - `XenMkt~version_hypercall~1`
+
+Needs:
+ - XenSwdgn
+
+Second Parameter
+----------------
+
+`XenProd~version_hyp_second_param~1`
+
+Description:
+Xen shall treat the value stored in x1 as a domain virtual address (mapped as
+Normal Inner Write-Back Outer Write-Back Inner-Shareable) to buffer in domain's
+memory.
+
+Rationale:
+
+Comments:
+
+Covers:
+ - `XenMkt~version_hypercall~1`
+
+Needs:
+ - XenSwdgn
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Sep 30 07:11:12 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 30 Sep 2025 07:11:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1133774.1471831 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1v3UW0-0003Ex-MI; Tue, 30 Sep 2025 07:11:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1133774.1471831; Tue, 30 Sep 2025 07: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 1v3UW0-0003Eq-Jo; Tue, 30 Sep 2025 07:11:12 +0000
Received: by outflank-mailman (input) for mailman id 1133774;
 Tue, 30 Sep 2025 07: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 1v3UVz-0003Ee-Vg
 for xen-changelog@lists.xenproject.org; Tue, 30 Sep 2025 07: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 1v3UVz-000W27-33
 for xen-changelog@lists.xenproject.org;
 Tue, 30 Sep 2025 07:11:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1v3UVz-006Czf-2t
 for xen-changelog@lists.xenproject.org;
 Tue, 30 Sep 2025 07: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=3CGVyV9r810986Qgpo6TsG2MqsTkQUyRRv5ZGwXIZMQ=; b=yWc0dx9eyi8XyKmICgB22J8yHD
	mIm9IWfZUKg1pzA9oyeQpSeVIOQvgbnZdLNkas1UPZB+3XA+3bEilg+ai1D0KDESPQq0+xLDsaA4i
	PQ4X5rw8vpinZrxtDdB/THb7OkWhRKE5Fr6Ek5Dpd3+floaspeqbpT7b9Znw8H2fcQwY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] docs: fusa: Add the requirements for some of the commands of XEN_VERSION
Message-Id: <E1v3UVz-006Czf-2t@xenbits.xenproject.org>
Date: Tue, 30 Sep 2025 07:11:11 +0000

commit 3d3a690f174e527275436f09720f5e74b1232c7b
Author:     Ayan Kumar Halder <ayan.kumar.halder@amd.com>
AuthorDate: Tue Aug 19 12:27:09 2025 +0100
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Tue Sep 30 09:04:27 2025 +0200

    docs: fusa: Add the requirements for some of the commands of XEN_VERSION
    
    We have written the requirements for some of the commands of the XEN_VERSION
    hypercall.
    
    Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 docs/fusa/reqs/design-reqs/arm64/hypercall.rst     | 15 ++++
 .../reqs/design-reqs/arm64/version_hypercall.rst   | 32 ++++++++
 docs/fusa/reqs/design-reqs/version_hypercall.rst   | 63 ++++++++++++++++
 docs/fusa/reqs/index.rst                           |  3 +
 docs/fusa/reqs/product-reqs/hypercall.rst          | 20 +++++
 docs/fusa/reqs/product-reqs/version_hypercall.rst  | 85 ++++++++++++++++++++++
 6 files changed, 218 insertions(+)

diff --git a/docs/fusa/reqs/design-reqs/arm64/hypercall.rst b/docs/fusa/reqs/design-reqs/arm64/hypercall.rst
index 82ecf690a3..3b4af18323 100644
--- a/docs/fusa/reqs/design-reqs/arm64/hypercall.rst
+++ b/docs/fusa/reqs/design-reqs/arm64/hypercall.rst
@@ -58,3 +58,18 @@ Comments:
 Covers:
  - `XenProd~version_hyp_first_param~1`
  - `XenProd~version_hyp_second_param~1`
+
+Return value
+------------
+
+`XenSwdgn~arm64_ret_val~1`
+
+Description:
+Xen shall store the return value in x0.
+
+Rationale:
+
+Comments:
+
+Covers:
+ - `XenProd~hyp_err_ret_val~1`
diff --git a/docs/fusa/reqs/design-reqs/arm64/version_hypercall.rst b/docs/fusa/reqs/design-reqs/arm64/version_hypercall.rst
new file mode 100644
index 0000000000..ccfcb35a7a
--- /dev/null
+++ b/docs/fusa/reqs/design-reqs/arm64/version_hypercall.rst
@@ -0,0 +1,32 @@
+.. SPDX-License-Identifier: CC-BY-4.0
+
+Capabilities
+------------
+
+`XenSwdgn~arm64_capabilities~1`
+
+Description:
+Xen shall return xen-3.0-aarch64 to denote that the cpu is running in arm64 mode.
+
+Rationale:
+
+Comments:
+
+Covers:
+ - `XenProd~version_hyp_capabilities_cmd~1`
+
+Capabilities AArch32
+--------------------
+
+`XenSwdgn~arm64_capabilities_aarch32~1`
+
+Description:
+Xen shall return xen-3.0-armv7l to denote that the cpu is running in arm32 mode.
+
+Rationale:
+
+Comments:
+
+Covers:
+ - `XenProd~version_hyp_capabilities_cmd~1`
+
diff --git a/docs/fusa/reqs/design-reqs/version_hypercall.rst b/docs/fusa/reqs/design-reqs/version_hypercall.rst
new file mode 100644
index 0000000000..b05481b9dc
--- /dev/null
+++ b/docs/fusa/reqs/design-reqs/version_hypercall.rst
@@ -0,0 +1,63 @@
+.. SPDX-License-Identifier: CC-BY-4.0
+
+Version
+-------
+
+`XenSwdgn~version~1`
+
+Description:
+Xen shall return its version when XENVER_version command is invoked.
+
+Rationale:
+
+Comments:
+
+Covers:
+ - `XenProd~version_hyp_version_cmd~1`
+
+Error copying buffer
+--------------------
+
+`XenSwdgn~error_copy_buffer~1`
+
+Description:
+Xen shall return -EFAULT if it is not able to copy data to domain's buffer.
+
+Rationale:
+-EFAULT is one of the error code defined in
+http://xenbits.xen.org/gitweb/?p=xen.git;a=blob;f=xen/include/public/errno.h.
+
+Comments:
+
+Covers:
+ - `XenProd~hyp_err_ret_val~1`
+
+Extraversion
+------------
+
+`XenSwdgn~extraversion~1`
+
+Description:
+Xen shall return its extraversion when XENVER_extraversion command is invoked.
+
+Rationale:
+
+Comments:
+
+Covers:
+ - `XenProd~version_hyp_extraversion_cmd~1`
+
+Changeset
+---------
+
+`XenSwdgn~changeset~1`
+
+Description:
+Xen shall return its changeset when XENVER_changeset command is invoked.
+
+Rationale:
+
+Comments:
+
+Covers:
+ - `XenProd~version_hyp_changeset_cmd~1`
diff --git a/docs/fusa/reqs/index.rst b/docs/fusa/reqs/index.rst
index d8683edce7..de19b0cda2 100644
--- a/docs/fusa/reqs/index.rst
+++ b/docs/fusa/reqs/index.rst
@@ -11,6 +11,9 @@ Requirements documentation
    product-reqs/reqs
    product-reqs/arm64/reqs
    product-reqs/version_hypercall
+   product-reqs/hypercall
    design-reqs/arm64/generic-timer
    design-reqs/arm64/sbsa-uart
    design-reqs/arm64/hypercall
+   design-reqs/arm64/version_hypercall
+   design-reqs/version_hypercall
diff --git a/docs/fusa/reqs/product-reqs/hypercall.rst b/docs/fusa/reqs/product-reqs/hypercall.rst
new file mode 100644
index 0000000000..9fb46cf451
--- /dev/null
+++ b/docs/fusa/reqs/product-reqs/hypercall.rst
@@ -0,0 +1,20 @@
+.. SPDX-License-Identifier: CC-BY-4.0
+
+Error Return Value
+------------------
+
+`XenProd~hyp_err_ret_val~1`
+
+Description:
+In case any hypercall fails, Xen shall return one of the error codes defined
+in http://xenbits.xen.org/gitweb/?p=xen.git;a=blob;f=xen/include/public/errno.h.
+
+Rationale:
+
+Comments:
+
+Covers:
+ - `XenMkt~version_hypercall~1`
+
+Needs:
+ - XenSwdgn
diff --git a/docs/fusa/reqs/product-reqs/version_hypercall.rst b/docs/fusa/reqs/product-reqs/version_hypercall.rst
index b824c539b0..466eb4108b 100644
--- a/docs/fusa/reqs/product-reqs/version_hypercall.rst
+++ b/docs/fusa/reqs/product-reqs/version_hypercall.rst
@@ -40,3 +40,88 @@ Covers:
 
 Needs:
  - XenSwdgn
+
+Version command
+---------------
+
+`XenProd~version_hyp_version_cmd~1`
+
+Description:
+Xen shall provide a command (num 0) for  hypercall (num 17) to retrieve Xen's
+version in the domain's register 0.
+
+Rationale:
+
+Comments:
+Xen version is composed of major (ie version) and minor (ie subversion) number.
+The minor number is encoded in the 16 least significant bits and the major number
+is encoded in the top remaining bits.
+
+Covers:
+ - `XenMkt~version_hypercall~1`
+
+Needs:
+ - XenSwdgn
+
+Extraversion command
+--------------------
+
+`XenProd~version_hyp_extraversion_cmd~1`
+
+Description:
+Xen shall provide a command (num 1) for hypercall (num 17) to copy its
+extraversion in the domain's buffer.
+
+Rationale:
+
+Comments:
+Xen's extra version consists of a string passed with 'XEN_VENDORVERSION' command
+line parameter while building Xen.
+
+Covers:
+ - `XenMkt~version_hypercall~1`
+
+Needs:
+ - XenSwdgn
+
+Capabilities command
+--------------------
+
+`XenProd~version_hyp_capabilities_cmd~1`
+
+Description:
+Xen shall provide a command (num 3) for hypercall (num 17) to copy its
+capabilities to the domain's buffer.
+
+Rationale:
+
+Comments:
+Capabilities related information is represented by char[1024].
+For Arm64, the capabilities should contain "xen-3.0-aarch64" string.
+
+Covers:
+ - `XenMkt~version_hypercall~1`
+
+Needs:
+ - XenSwdgn
+
+Changeset command
+-----------------
+
+`XenProd~version_hyp_changeset_cmd~1`
+
+Description:
+Xen shall provide a command (num 4) for hypercall (num 17) to copy changeset
+to the domain's buffer.
+
+Rationale:
+
+Comments:
+Changeset is string denoting the date, time and git hash of the last change
+made to Xen's codebase.
+
+Covers:
+ - `XenMkt~version_hypercall~1`
+
+Needs:
+ - XenSwdgn
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Sep 30 08:33:06 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 30 Sep 2025 08:33:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1134035.1472086 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1v3VnD-0002xY-J7; Tue, 30 Sep 2025 08:33:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1134035.1472086; Tue, 30 Sep 2025 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 1v3VnD-0002xQ-GV; Tue, 30 Sep 2025 08:33:03 +0000
Received: by outflank-mailman (input) for mailman id 1134035;
 Tue, 30 Sep 2025 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 1v3VnC-0002xI-3M
 for xen-changelog@lists.xenproject.org; Tue, 30 Sep 2025 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 1v3VnC-000YNN-09
 for xen-changelog@lists.xenproject.org;
 Tue, 30 Sep 2025 08:33:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1v3VnB-006Md8-35
 for xen-changelog@lists.xenproject.org;
 Tue, 30 Sep 2025 08: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=fo4ak016VwyFY7PF/OjiOtCB1DB0I3dRpyKvghczHJg=; b=GYFV0Nou5XdB5jAXj8MslihDps
	I//RYYk4YgWMUHn2i4M3wGTeFLeZ0Rkn6N8FlT6PKIGogtMS+ov15WgFdz1SaKCB5eeh/bgWhJKLl
	pguzkywcYSqFlROU/yh9MiHMJtg6aJLNpa7t3N4bTWu0FfubrwCdKWQliWrQEH0ClKYI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] docs: fusa: Define the requirements for XEN_VERSION hypercall.
Message-Id: <E1v3VnB-006Md8-35@xenbits.xenproject.org>
Date: Tue, 30 Sep 2025 08:33:01 +0000

commit df2fffac079916b6ad85d48cfbf20ea30ef49612
Author:     Ayan Kumar Halder <ayan.kumar.halder@amd.com>
AuthorDate: Tue Aug 19 12:27:08 2025 +0100
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Tue Sep 30 09:04:27 2025 +0200

    docs: fusa: Define the requirements for XEN_VERSION hypercall.
    
    Define the requirements which are common for all the commands.
    
    Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 docs/fusa/reqs/design-reqs/arm64/hypercall.rst    | 60 +++++++++++++++++++++++
 docs/fusa/reqs/index.rst                          |  2 +
 docs/fusa/reqs/market-reqs/reqs.rst               | 16 ++++++
 docs/fusa/reqs/product-reqs/version_hypercall.rst | 42 ++++++++++++++++
 4 files changed, 120 insertions(+)

diff --git a/docs/fusa/reqs/design-reqs/arm64/hypercall.rst b/docs/fusa/reqs/design-reqs/arm64/hypercall.rst
new file mode 100644
index 0000000000..82ecf690a3
--- /dev/null
+++ b/docs/fusa/reqs/design-reqs/arm64/hypercall.rst
@@ -0,0 +1,60 @@
+.. SPDX-License-Identifier: CC-BY-4.0
+
+Hypercall
+=========
+
+Instruction
+-----------
+
+`XenSwdgn~arm64_hyp_instr~1`
+
+Description:
+Xen shall treat domain hvc instruction execution (with 0xEA1) as hypercall
+requests.
+
+Rationale:
+
+Comments:
+Hypercall is one of the communication mechanism between Xen and domains.
+Domains use hypercalls for various requests to Xen.
+The exception syndrome register should have the following values :-
+ESR_EL2.ISS should be 0xEA1.
+ESR_EL2.EC should be 0x16.
+
+Covers:
+ - `XenProd~version_hyp_first_param~1`
+ - `XenProd~version_hyp_second_param~1`
+
+Parameters
+----------
+
+`XenSwdgn~arm64_hyp_param~1`
+
+Description:
+Xen shall use x0 - x4 core registers to obtain the arguments for domain hypercall
+requests.
+
+Rationale:
+
+Comments:
+Xen shall read x0 for the first argument, x1 for the second argument and so on.
+
+Covers:
+ - `XenProd~version_hyp_first_param~1`
+ - `XenProd~version_hyp_second_param~1`
+
+Hypercall number
+----------------
+
+`XenSwdgn~arm64_hyp_num~1`
+
+Description:
+Xen shall read x16 to obtain the hypercall number.
+
+Rationale:
+
+Comments:
+
+Covers:
+ - `XenProd~version_hyp_first_param~1`
+ - `XenProd~version_hyp_second_param~1`
diff --git a/docs/fusa/reqs/index.rst b/docs/fusa/reqs/index.rst
index 1088a51d52..d8683edce7 100644
--- a/docs/fusa/reqs/index.rst
+++ b/docs/fusa/reqs/index.rst
@@ -10,5 +10,7 @@ Requirements documentation
    market-reqs/reqs
    product-reqs/reqs
    product-reqs/arm64/reqs
+   product-reqs/version_hypercall
    design-reqs/arm64/generic-timer
    design-reqs/arm64/sbsa-uart
+   design-reqs/arm64/hypercall
diff --git a/docs/fusa/reqs/market-reqs/reqs.rst b/docs/fusa/reqs/market-reqs/reqs.rst
index 2d297ecc13..7e3912c8f8 100644
--- a/docs/fusa/reqs/market-reqs/reqs.rst
+++ b/docs/fusa/reqs/market-reqs/reqs.rst
@@ -79,3 +79,19 @@ Comments:
 
 Needs:
  - XenProd
+
+Version hypercall
+-----------------
+
+`XenMkt~version_hypercall~1`
+
+Description:
+Xen shall provide a hypercall for the domains to retrieve Xen's version, type
+and compilation information.
+
+Rationale:
+
+Comments:
+
+Needs:
+ - XenProd
diff --git a/docs/fusa/reqs/product-reqs/version_hypercall.rst b/docs/fusa/reqs/product-reqs/version_hypercall.rst
new file mode 100644
index 0000000000..b824c539b0
--- /dev/null
+++ b/docs/fusa/reqs/product-reqs/version_hypercall.rst
@@ -0,0 +1,42 @@
+.. SPDX-License-Identifier: CC-BY-4.0
+
+Version hypercall
+=================
+
+First Parameter
+---------------
+
+`XenProd~version_hyp_first_param~1`
+
+Description:
+Xen shall treat the value stored in x0 as the command number for the hypercall.
+
+Rationale:
+
+Comments:
+
+Covers:
+ - `XenMkt~version_hypercall~1`
+
+Needs:
+ - XenSwdgn
+
+Second Parameter
+----------------
+
+`XenProd~version_hyp_second_param~1`
+
+Description:
+Xen shall treat the value stored in x1 as a domain virtual address (mapped as
+Normal Inner Write-Back Outer Write-Back Inner-Shareable) to buffer in domain's
+memory.
+
+Rationale:
+
+Comments:
+
+Covers:
+ - `XenMkt~version_hypercall~1`
+
+Needs:
+ - XenSwdgn
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Sep 30 08:33:12 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 30 Sep 2025 08:33:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1134036.1472090 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1v3VnM-0002zT-Kp; Tue, 30 Sep 2025 08:33:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1134036.1472090; Tue, 30 Sep 2025 08: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 1v3VnM-0002zN-Hs; Tue, 30 Sep 2025 08:33:12 +0000
Received: by outflank-mailman (input) for mailman id 1134036;
 Tue, 30 Sep 2025 08: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 1v3VnM-0002zD-57
 for xen-changelog@lists.xenproject.org; Tue, 30 Sep 2025 08: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 1v3VnM-000YNc-0Q
 for xen-changelog@lists.xenproject.org;
 Tue, 30 Sep 2025 08:33:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1v3VnM-006Mdh-0J
 for xen-changelog@lists.xenproject.org;
 Tue, 30 Sep 2025 08: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=mGPVLzRpN5Hgq9co3bdVAZFdebhWay+clqDOqhLjnYQ=; b=XZwgebvOOzze1eWf4QUOshg7Hk
	/BVAcASc6AwiBNELpSN4EMw0eo/XouuSFuy6FNENEpp47QhdoYywMkwAmSecT7KMZjJKbMtRkhW5T
	tSMbibb3jugPzmUTP37PnDlSZTHXaiUsrcidYmmjmqy/sGWR0pU5wE0UiPclxoMr6SWI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] docs: fusa: Add the requirements for some of the commands of XEN_VERSION
Message-Id: <E1v3VnM-006Mdh-0J@xenbits.xenproject.org>
Date: Tue, 30 Sep 2025 08:33:12 +0000

commit 3d3a690f174e527275436f09720f5e74b1232c7b
Author:     Ayan Kumar Halder <ayan.kumar.halder@amd.com>
AuthorDate: Tue Aug 19 12:27:09 2025 +0100
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Tue Sep 30 09:04:27 2025 +0200

    docs: fusa: Add the requirements for some of the commands of XEN_VERSION
    
    We have written the requirements for some of the commands of the XEN_VERSION
    hypercall.
    
    Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 docs/fusa/reqs/design-reqs/arm64/hypercall.rst     | 15 ++++
 .../reqs/design-reqs/arm64/version_hypercall.rst   | 32 ++++++++
 docs/fusa/reqs/design-reqs/version_hypercall.rst   | 63 ++++++++++++++++
 docs/fusa/reqs/index.rst                           |  3 +
 docs/fusa/reqs/product-reqs/hypercall.rst          | 20 +++++
 docs/fusa/reqs/product-reqs/version_hypercall.rst  | 85 ++++++++++++++++++++++
 6 files changed, 218 insertions(+)

diff --git a/docs/fusa/reqs/design-reqs/arm64/hypercall.rst b/docs/fusa/reqs/design-reqs/arm64/hypercall.rst
index 82ecf690a3..3b4af18323 100644
--- a/docs/fusa/reqs/design-reqs/arm64/hypercall.rst
+++ b/docs/fusa/reqs/design-reqs/arm64/hypercall.rst
@@ -58,3 +58,18 @@ Comments:
 Covers:
  - `XenProd~version_hyp_first_param~1`
  - `XenProd~version_hyp_second_param~1`
+
+Return value
+------------
+
+`XenSwdgn~arm64_ret_val~1`
+
+Description:
+Xen shall store the return value in x0.
+
+Rationale:
+
+Comments:
+
+Covers:
+ - `XenProd~hyp_err_ret_val~1`
diff --git a/docs/fusa/reqs/design-reqs/arm64/version_hypercall.rst b/docs/fusa/reqs/design-reqs/arm64/version_hypercall.rst
new file mode 100644
index 0000000000..ccfcb35a7a
--- /dev/null
+++ b/docs/fusa/reqs/design-reqs/arm64/version_hypercall.rst
@@ -0,0 +1,32 @@
+.. SPDX-License-Identifier: CC-BY-4.0
+
+Capabilities
+------------
+
+`XenSwdgn~arm64_capabilities~1`
+
+Description:
+Xen shall return xen-3.0-aarch64 to denote that the cpu is running in arm64 mode.
+
+Rationale:
+
+Comments:
+
+Covers:
+ - `XenProd~version_hyp_capabilities_cmd~1`
+
+Capabilities AArch32
+--------------------
+
+`XenSwdgn~arm64_capabilities_aarch32~1`
+
+Description:
+Xen shall return xen-3.0-armv7l to denote that the cpu is running in arm32 mode.
+
+Rationale:
+
+Comments:
+
+Covers:
+ - `XenProd~version_hyp_capabilities_cmd~1`
+
diff --git a/docs/fusa/reqs/design-reqs/version_hypercall.rst b/docs/fusa/reqs/design-reqs/version_hypercall.rst
new file mode 100644
index 0000000000..b05481b9dc
--- /dev/null
+++ b/docs/fusa/reqs/design-reqs/version_hypercall.rst
@@ -0,0 +1,63 @@
+.. SPDX-License-Identifier: CC-BY-4.0
+
+Version
+-------
+
+`XenSwdgn~version~1`
+
+Description:
+Xen shall return its version when XENVER_version command is invoked.
+
+Rationale:
+
+Comments:
+
+Covers:
+ - `XenProd~version_hyp_version_cmd~1`
+
+Error copying buffer
+--------------------
+
+`XenSwdgn~error_copy_buffer~1`
+
+Description:
+Xen shall return -EFAULT if it is not able to copy data to domain's buffer.
+
+Rationale:
+-EFAULT is one of the error code defined in
+http://xenbits.xen.org/gitweb/?p=xen.git;a=blob;f=xen/include/public/errno.h.
+
+Comments:
+
+Covers:
+ - `XenProd~hyp_err_ret_val~1`
+
+Extraversion
+------------
+
+`XenSwdgn~extraversion~1`
+
+Description:
+Xen shall return its extraversion when XENVER_extraversion command is invoked.
+
+Rationale:
+
+Comments:
+
+Covers:
+ - `XenProd~version_hyp_extraversion_cmd~1`
+
+Changeset
+---------
+
+`XenSwdgn~changeset~1`
+
+Description:
+Xen shall return its changeset when XENVER_changeset command is invoked.
+
+Rationale:
+
+Comments:
+
+Covers:
+ - `XenProd~version_hyp_changeset_cmd~1`
diff --git a/docs/fusa/reqs/index.rst b/docs/fusa/reqs/index.rst
index d8683edce7..de19b0cda2 100644
--- a/docs/fusa/reqs/index.rst
+++ b/docs/fusa/reqs/index.rst
@@ -11,6 +11,9 @@ Requirements documentation
    product-reqs/reqs
    product-reqs/arm64/reqs
    product-reqs/version_hypercall
+   product-reqs/hypercall
    design-reqs/arm64/generic-timer
    design-reqs/arm64/sbsa-uart
    design-reqs/arm64/hypercall
+   design-reqs/arm64/version_hypercall
+   design-reqs/version_hypercall
diff --git a/docs/fusa/reqs/product-reqs/hypercall.rst b/docs/fusa/reqs/product-reqs/hypercall.rst
new file mode 100644
index 0000000000..9fb46cf451
--- /dev/null
+++ b/docs/fusa/reqs/product-reqs/hypercall.rst
@@ -0,0 +1,20 @@
+.. SPDX-License-Identifier: CC-BY-4.0
+
+Error Return Value
+------------------
+
+`XenProd~hyp_err_ret_val~1`
+
+Description:
+In case any hypercall fails, Xen shall return one of the error codes defined
+in http://xenbits.xen.org/gitweb/?p=xen.git;a=blob;f=xen/include/public/errno.h.
+
+Rationale:
+
+Comments:
+
+Covers:
+ - `XenMkt~version_hypercall~1`
+
+Needs:
+ - XenSwdgn
diff --git a/docs/fusa/reqs/product-reqs/version_hypercall.rst b/docs/fusa/reqs/product-reqs/version_hypercall.rst
index b824c539b0..466eb4108b 100644
--- a/docs/fusa/reqs/product-reqs/version_hypercall.rst
+++ b/docs/fusa/reqs/product-reqs/version_hypercall.rst
@@ -40,3 +40,88 @@ Covers:
 
 Needs:
  - XenSwdgn
+
+Version command
+---------------
+
+`XenProd~version_hyp_version_cmd~1`
+
+Description:
+Xen shall provide a command (num 0) for  hypercall (num 17) to retrieve Xen's
+version in the domain's register 0.
+
+Rationale:
+
+Comments:
+Xen version is composed of major (ie version) and minor (ie subversion) number.
+The minor number is encoded in the 16 least significant bits and the major number
+is encoded in the top remaining bits.
+
+Covers:
+ - `XenMkt~version_hypercall~1`
+
+Needs:
+ - XenSwdgn
+
+Extraversion command
+--------------------
+
+`XenProd~version_hyp_extraversion_cmd~1`
+
+Description:
+Xen shall provide a command (num 1) for hypercall (num 17) to copy its
+extraversion in the domain's buffer.
+
+Rationale:
+
+Comments:
+Xen's extra version consists of a string passed with 'XEN_VENDORVERSION' command
+line parameter while building Xen.
+
+Covers:
+ - `XenMkt~version_hypercall~1`
+
+Needs:
+ - XenSwdgn
+
+Capabilities command
+--------------------
+
+`XenProd~version_hyp_capabilities_cmd~1`
+
+Description:
+Xen shall provide a command (num 3) for hypercall (num 17) to copy its
+capabilities to the domain's buffer.
+
+Rationale:
+
+Comments:
+Capabilities related information is represented by char[1024].
+For Arm64, the capabilities should contain "xen-3.0-aarch64" string.
+
+Covers:
+ - `XenMkt~version_hypercall~1`
+
+Needs:
+ - XenSwdgn
+
+Changeset command
+-----------------
+
+`XenProd~version_hyp_changeset_cmd~1`
+
+Description:
+Xen shall provide a command (num 4) for hypercall (num 17) to copy changeset
+to the domain's buffer.
+
+Rationale:
+
+Comments:
+Changeset is string denoting the date, time and git hash of the last change
+made to Xen's codebase.
+
+Covers:
+ - `XenMkt~version_hypercall~1`
+
+Needs:
+ - XenSwdgn
--
generated by git-patchbot for /home/xen/git/xen.git#master


